PageSourceSearch

https://savvskout.com/assets/Applications-7DC9tCpe.js

js savvskout.com collected 2026-09-24 14:51:59 UTC 56,267 bytes, 45 lines download raw bytes

1import{k as Q,r as c,j as e,b as j,ai as Xe,g as Ze,n as de,A as os,m as De,M as be,B as es,z as ss,d as S,T as Qe,E as U,F as $e,l as ds,ah as cs,C as Ce,a as Se,v as ms,c as ne,R as Ae}from"./index-DXrArQYD.js";import{u as z}from"./useMutation-C0aHL6vv.js";import{B as se}from"./badge-ppuZSzLI.js";import{T as Ve,a as Ye,b as L,c as Te}from"./tabs-BNVQcW2o.js";import{D as xs,a as us,b as hs,c as gs}from"./dialog-BjPktj2z.js";import{T as ce}from"./textarea-CJC6YZ_4.js";import{S as xe,a as ue,b as he,c as ge,d as O}from"./select-v4RepEwe.js";import{A as W,b as J,c as H,d as G,f as X,g as Z,h as ee,a as ie,e as le}from"./alert-dialog-B3xTSGp8.js";import{f as Pe}from"./format-DCW6RvxT.js";import{toast as C}from"./index-BgSsJLP5.js";import{P as ps}from"./plus-Dap-94t9.js";import{S as Ee}from"./send-BjWYf3vq.js";import{C as pe}from"./check-C9CotNQ_.js";import{C as We}from"./checkbox-C9_aWZHU.js";import{T as bs,i as fs}from"./TemplateSelector-1oW3WIJ5.js";import{L as js}from"./loader-circle-eDQ2inhp.js";import{C as ys}from"./chevron-up-8sgxm9yZ.js";import{C as vs}from"./chevron-down-BZajJeqR.js";import{S as ws}from"./sparkles-BQn-y8AA.js";import{L as Ns,T as ks}from"./twitter-BaEpRDXX.js";import{C as ts}from"./copy-Cb4wWHGH.js";import{C as _s}from"./circle-check-D8h2iiSk.js";import{C as Cs}from"./clock-DD7U8J8v.js";import{C as Ss}from"./circle-alert-O9jckEVq.js";import{S as As}from"./shield-check-B3qfj6zX.js";import{T as Je}from"./trash-2-DDCO2Ue2.js";import{C as Me}from"./circle-x-42_SW2B6.js";import{S as Ts}from"./save-C4rNtIJF.js";import"./index-CIfQHpcR.js";import"./index-CAqmWOh_.js";import"./index-BiWyZ4So.js";import"./index-DDn793ea.js";import"./index--ElPzDDs.js";import"./index-Dsm7RlKc.js";import"./index-CqrQvUcc.js";import"./en-US-wfBU2YNu.js";/**
2 * @license lucide-react v0.475.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Ms=[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]],me=Q("BrainCircuit",Ms);/**
7 * @license lucide-react v0.475.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ds=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]],as=Q("ClipboardCopy",Ds);/**
12 * @license lucide-react v0.475.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const $s=[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]],Es=Q("Kanban",$s);/**
17 * @license lucide-react v0.475.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Ps=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],Ls=Q("LayoutList",Ps);/**
22 * @license lucide-react v0.475.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const qs=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],Rs=Q("Link",qs);/**
27 * @license lucide-react v0.475.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const Is=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Fs=Q("SquarePen",Is),q={draft:"bg-muted text-muted-foreground border-border",pending_review:"bg-amber-500/15 text-amber-700 dark:text-amber-300 border-amber-500/30",submitted:"bg-secondary/15 text-secondary border-secondary/30",accepted:"bg-green-500/15 text-green-700 dark:text-green-300 border-green-500/30",completed:"bg-blue-500/15 text-blue-700 dark:text-blue-300 border-blue-500/30",rejected:"bg-destructive/15 text-destructive border-destructive/30",withdrawn:"bg-orange-500/15 text-orange-700 dark:text-orange-300 border-orange-500/30"},zs={draft:"bg-muted-foreground",pending_review:"bg-amber-500",submitted:"bg-secondary",accepted:"bg-green-500",completed:"bg-blue-500",rejected:"bg-destructive",withdrawn:"bg-orange-500"},Le=[{id:"draft",label:"Draft",colorTop:"border-t-muted-foreground",headerBg:"bg-muted/40",countColor:"text-muted-foreground font-bold",badge:"bg-muted text-muted-foreground"},{id:"pending_review",label:"Pending Review",colorTop:"border-t-amber-500",headerBg:"bg-amber-500/10",countColor:"text-amber-700 dark:text-amber-300 font-bold",badge:"bg-amber-500/15 text-amber-700 dark:text-amber-300"},{id:"submitted",label:"Applied",colorTop:"border-t-secondary",headerBg:"bg-secondary/10",countColor:"text-secondary font-bold",badge:"bg-secondary/15 text-secondary"},{id:"accepted",label:"Interviewing",colorTop:"border-t-green-500",headerBg:"bg-green-500/10",countColor:"text-green-700 dark:text-green-300 font-bold",badge:"bg-green-500/15 text-green-700 dark:text-green-300"},{id:"completed",label:"Offer / Won",colorTop:"border-t-blue-500",headerBg:"bg-blue-500/10",countColor:"text-blue-700 dark:text-blue-300 font-bold",badge:"bg-blue-500/15 text-blue-700 dark:text-blue-300"},{id:"rejected",label:"Rejected",colorTop:"border-t-destructive",headerBg:"bg-destructive/10",countColor:"text-destructive font-bold",badge:"bg-destructive/15 text-destructive"}
31],He=Le.map(t=>t.id),Os=Object.fromEntries(Le.map(t=>[t.id,t]));function Bs({applications:t,onStatusChange:l,onView:p}){const[a,b]=c.useState(null),[u,v]=c.useState(null),x=c.useRef(null),g={};He.forEach(r=>{g[r]=[]}),t.forEach(r=>{const d=He.includes(r.status)?r.status:"draft";g[d].push(r)});const o=(r,d)=>{x.current=d,b(d.id),r.dataTransfer.effectAllowed="move"},y=()=>{b(null),v(null),x.current=null},N=(r,d)=>{r.preventDefault(),r.dataTransfer.dropEffect="move",v(d)},f=()=>{v(null)},w=(r,d)=>{r.preventDefault(),v(null),x.current&&x.current.status!==d&&l(x.current.id,d),b(null),x.current=null};return e.jsx("div",{className:"flex gap-3 overflow-x-auto pb-4 -mx-1 px-1",children:Le.map(r=>{const d=g[r.id]||[],A=u===r.id;return e.jsxs("div",{className:"flex flex-col min-w-[210px] w-[210px] shrink-0",onDragOver:h=>N(h,r.id),onDragLeave:f,onDrop:h=>w(h,r.id),children:[e.jsxs("div",{className:`flex items-center justify-between px-4 py-3 rounded-t-lg border-t-4 ${r.colorTop} ${r.headerBg} border-b border-border`,children:[e.jsx("span",{className:"text-sm font-bold text-foreground truncate",children:r.label}),e.jsx("span",{className:`text-sm font-black ml-2 shrink-0 px-2.5 py-0.5 rounded-full ${r.badge}`,children:d.length})]}),e.jsxs("div",{className:`flex-1 min-h-[140px] rounded-b-lg p-3 space-y-2.5 transition-colors ${A?"bg-secondary/20 ring-2 ring-inset ring-secondary/50 border-b-2 border-secondary":"bg-muted/20 border-b border-border"}`,children:[d.map(h=>{var n,T,_,E,D,te,P,B;return e.jsxs("div",{draggable:!0,onDragStart:I=>o(I,h),onDragEnd:y,className:`bg-card rounded-lg border-2 p-3.5 space-y-2 cursor-grab active:cursor-grabbing select-none transition-all ${a===h.id?"opacity-50 scale-95 shadow-lg":"hover:shadow-lg hover:border-secondary/50"} border ${(n=q[h.status])!=null&&n.includes("border")?"":"border-border"}`,style:{borderColor:(T=q[h.status])!=null&&T.includes("secondary")?"hsl(174 62% 47% / 0.3)":(_=q[h.status])!=null&&_.includes("amber")?"hsl(38 92% 50% / 0.2)":(E=q[h.status])!=null&&E.includes("green")?"hsl(142 71% 45% / 0.2)":(D=q[h.status])!=null&&D.includes("blue")?"hsl(210 100% 50% / 0.2)":(te=q[h.status])!=null&&te.includes("destructive")?"hsl(0 84% 60% / 0.2)":(P=q[h.status])!=null&&P.includes("orange")?"hsl(38 92% 50% / 0.2)":"var(--border)"},children:[e.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[e.jsx("p",{className:"text-xs font-bold text-foreground leading-snug flex-1 min-w-0",children:h.job_title}),e.jsxs("span",{className:`shrink-0 inline-flex items-center gap-1 text-[9px] font-bold px-2 py-1 rounded-full border ${q[h.status]||"bg-muted text-muted-foreground"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${zs[h.status]||"bg-muted-foreground"}`}),((B=Os[h.status])==null?void 0:B.label)||h.status]})]}),e.jsx("p",{className:"text-[10px] font-medium text-foreground/70 truncate",children:h.company||"—"}),h.applied_date&&e.jsx("p",{className:"text-[9px] text-foreground/50 font-medium",children:Pe(new Date(h.applied_date),"MMM d, yyyy")}),e.jsx("div",{className:"pt-1.5",children:e.jsxs(j,{variant:"ghost",size:"sm",className:"h-7 px-2 text-[10px] font-bold text-secondary hover:bg-secondary/10 hover:text-secondary",onClick:()=>p(h),children:[e.jsx(Xe,{className:"w-3 h-3 mr-1"})," View"]})})]},h.id)}),d.length===0&&e.jsx("div",{className:`flex items-center justify-center min-h-[100px] rounded-lg border-2 border-dashed transition-colors font-medium ${A?"border-secondary text-secondary bg-secondary/5":"border-muted-foreground/20 text-muted-foreground/50"}`,children:e.jsx("p",{className:"text-xs",children:A?"↓ Drop here":"Empty"})})]})]},r.id)})})}const Ge={user:{icon:ss,label:"You",bubbleClass:"bg-secondary text-secondary-foreground ml-auto",iconClass:"bg-secondary/20 text-secondary"},employer:{icon:be,label:"Employer",bubbleClass:"bg-muted text-foreground",iconClass:"bg-muted text-muted-foreground"},system:{icon:es,label:"System",bubbleClass:"bg-primary/10 text-primary border border-primary/20",iconClass:"bg-primary/10 text-primary"}},Ks=[{value:"text",label:"Message"},{value:"offer",label:"Offer"},{value:"assignment",label:"Assignment"},{value:"notification",label:"Notification"}];function Us({application:t,user:l}){const p=Ze(),[a,b]=c.useState(""),[u,v]=c.useState("employer"),[x,g]=c.useState("text"),[o,y]=c.useState(!1),N=c.useRef(null),{data:f=[],isLoading:w}=de({queryKey:["app-messages",t.id],queryFn:()=>
31S.entities.Message.filter({application_id:t.id},"created_date"),enabled:!!t.id}),r=z({mutationFn:n=>S.entities.Message.update(n,{read:!0}),onMutate:async n=>{await p.cancelQueries({queryKey:["app-messages",t.id]});const T=p.getQueryData(["app-messages",t.id]);return p.setQueryData(["app-messages",t.id],(_=[])=>_.map(E=>E.id===n?{...E,read:!0}:E)),{previous:T}},onError:(n,T,_)=>{_!=null&&_.previous&&p.setQueryData(["app-messages",t.id],_.previous)},onSettled:()=>{p.invalidateQueries({queryKey:["messages",l==null?void 0:l.email]})}}),d=z({mutationFn:n=>S.entities.Message.create(n),onSuccess:()=>{p.invalidateQueries({queryKey:["app-messages",t.id]}),p.invalidateQueries({queryKey:["messages",l==null?void 0:l.email]}),b(""),y(!1),C.success("Message logged")}});c.useEffect(()=>{f.filter(n=>!n.read&&n.sender!=="user").forEach(n=>r.mutate(n.id))},[f.length]),c.useEffect(()=>{var n;(n=N.current)==null||n.scrollIntoView({behavior:"smooth"})},[f.length]);const A=()=>{a.trim()&&d.mutate({application_id:t.id,job_title:t.job_title,sender:u,sender_name:u==="user"?(l==null?void 0:l.full_name)||"You":u==="employer"?t.company||"Employer":"System",content:a.trim(),message_type:x,read:u==="user",user_email:l==null?void 0:l.email})},h=f.filter(n=>!n.read&&n.sender!=="user").length;return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"Correspondence Log"}),h>0&&e.jsxs(se,{className:"bg-destructive text-destructive-foreground text-xs",children:[h," unread"]})]}),e.jsxs(j,{size:"sm",variant:"outline",onClick:()=>y(n=>!n),children:[e.jsx(ps,{className:"w-3.5 h-3.5 mr-1"})," Log Message"]})]}),e.jsx(os,{children:o&&e.jsx(De.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"overflow-hidden",children:e.jsxs("div",{className:"border rounded-lg p-3 space-y-3 bg-muted/30",children:[e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsx("div",{className:"flex-1 min-w-[120px]",children:e.jsxs(xe,{value:u,onValueChange:v,children:[e.jsx(ue,{className:"h-8 text-xs",children:e.jsx(he,{placeholder:"From"})}),e.jsxs(ge,{children:[e.jsx(O,{value:"user",children:"You (outgoing)"}),e.jsx(O,{value:"employer",children:"Employer (incoming)"}),e.jsx(O,{value:"system",children:"System / Platform"})]})]})}),e.jsx("div",{className:"flex-1 min-w-[120px]",children:e.jsxs(xe,{value:x,onValueChange:g,children:[e.jsx(ue,{className:"h-8 text-xs",children:e.jsx(he,{placeholder:"Type"})}),e.jsx(ge,{children:Ks.map(n=>e.jsx(O,{value:n.value,children:n.label},n.value))})]})})]}),e.jsx(ce,{value:a,onChange:n=>b(n.target.value),placeholder:u==="employer"?"Paste or type the employer's message...":"Type your message / note...",rows:3,className:"text-sm resize-none",onKeyDown:n=>{n.key==="Enter"&&n.ctrlKey&&A()}}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(j,{variant:"ghost",size:"sm",onClick:()=>y(!1),children:"Cancel"}),e.jsxs(j,{size:"sm",className:"bg-secondary text-secondary-foreground",onClick:A,disabled:!a.trim()||d.isPending,children:[e.jsx(Ee,{className:"w-3.5 h-3.5 mr-1"})," ",d.isPending?"Saving...":"Log Message"]})]})]})})}),e.jsxs("div",{className:"flex flex-col gap-2 max-h-[320px] overflow-y-auto pr-1",children:[w?e.jsx("p",{className:"text-xs text-muted-foreground text-center py-6",children:"Loading messages..."}):f.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx(be,{className:"w-8 h-8 text-muted-foreground mx-auto mb-2 opacity-40"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"No messages yet. Log employer replies or your outgoing messages here for full accountability."})]}):f.map((n,T)=>{const _=Ge[n.sender]||Ge.system,E=_.icon,D=n.sender==="user";return e.jsxs(De.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{delay:T*.02},className:`flex gap-2 items-end ${D?"flex-row-reverse":"flex-row"}`,children:[e.jsx("div",{className:`w-7 h-7 rounded-full flex items-center justify-center flex-shrink-0 ${_.iconClass}`,children:e.jsx(E,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{className:`max-w-[78%] rounded-2xl px-3 py-2 text-sm ${_.bubbleClass} ${!n.read&&!D?"ring-1 ring-secondary/40":""}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5 flex-wrap",children:[e.jsx("span",{className:"text-xs font-medium opacity-70",children:n.sender_name||_.label}),n.message_type&&n.message_type!=="text"&&e.jsx(se,{variant:"outline",className:"text-[10px] px-1 py-0 h-4 opacity-70",children:n.message_type})]}),e.jsx("p",{className:"leading-relaxed whitespace-pre-wrap break-words",children:n.content}),e.jsxs("div",{className:`flex items-center gap-1 mt-1 ${D?"justify-end":"justify-start"}`,children:[e.jsx("span",{className:"text-[10px] opacity-50",children:n.created_date?Pe(new Date(n.created_date),"MMM d, h:mm a"):""}),D&&n.read&&e.jsx(pe,{className:"w-3 h-3 opacity-40"})]})]}),!n.read&&!D&&e.jsx("button",{className:"text-[10px] text-secondary hover:underline self-center",onClick:()=>r.mutate(n.id),children:"Mark read"})]},n.id)}),e.jsx("div",{ref:N})]})]})}const Qs=["linkedin","indeed","glassdoor","ziprecruiter"];function Vs(t){return t?Qs.some(l=>t.toLowerCase().includes(l)):!1}
31function Ys({open:t,onConfirm:l,onCancel:p,jobTitle:a,company:b,platform:u,jobUrl:v}){const[x,g]=c.useState(!1),[o,y]=c.useState(!1),N=Vs(u),f=x&&o,w=r=>{r||(g(!1),y(!1),p())};return e.jsx(W,{open:t,onOpenChange:w,children:e.jsxs(J,{className:"max-w-md",children:[e.jsx(H,{children:e.jsxs(G,{className:"flex items-center gap-2 font-heading text-base",children:[e.jsx(Qe,{className:"w-5 h-5 text-amber-500 shrink-0"}),"Before You Submit"]})}),e.jsxs("div",{className:"space-y-4 py-1",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You're about to submit your application for ",e.jsx("strong",{className:"text-foreground",children:a}),b?e.jsxs(e.Fragment,{children:[" at ",e.jsx("strong",{className:"text-foreground",children:b})]}):"",".",v&&e.jsxs(e.Fragment,{children:[" ",e.jsxs("a",{href:v,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-secondary underline underline-offset-2 hover:text-secondary/80 ml-1",children:["View job ",e.jsx(U,{className:"w-3 h-3 inline"})]})]})]}),N&&e.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-lg bg-amber-50 dark:bg-amber-950/30 border border-amber-300/60 dark:border-amber-700/50",children:[e.jsx(Qe,{className:"w-4 h-4 text-amber-600 dark:text-amber-400 shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-xs text-amber-800 dark:text-amber-300 leading-relaxed",children:[e.jsx("strong",{children:"Heads up:"})," This job was sourced from ",e.jsx("strong",{children:u}),", a platform that may have policies restricting AI-assisted applications. Submitting may be against their Terms of Service."," ",e.jsx("a",{href:"/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-amber-900 dark:hover:text-amber-100",children:"See our ToS §7 & §11"})," ","for what this means for you."]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[e.jsx(We,{checked:x,onCheckedChange:g,className:"mt-0.5 shrink-0"}),e.jsxs("span",{className:"text-sm leading-snug text-foreground group-hover:text-foreground/80",children:["I have reviewed and approve the AI-drafted cover letter and proposal for submission. SavvSkout submits via ",e.jsx("strong",{children:"direct email or ATS autofill"})," (Greenhouse, Lever, Ashby, Workable). If no automated path is confirmed, a link to the job page and your pre-filled package will be provided for manual submission."]})]}),e.jsxs("label",{className:"flex items-start gap-3 cursor-pointer group",children:[e.jsx(We,{checked:o,onCheckedChange:y,className:"mt-0.5 shrink-0"}),e.jsxs("span",{className:"text-sm leading-snug text-foreground group-hover:text-foreground/80",children:["I understand that SavvSkout ",e.jsx("strong",{children:"does not bypass CAPTCHAs, SSO walls, or any platform access controls"}),", and makes no guarantee of employer response or hiring outcome. My use of third-party platforms is governed by those platforms' own Terms of Service and is at my own risk."]})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["See our"," ",e.jsx("a",{href:"/terms-of-service",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"Terms of Service §7a & §11"})," ","for full details on automated submission capabilities, service levels, and liability limitations."]})]}),e.jsxs(X,{children:[e.jsx(Z,{onClick:()=>{g(!1),y(!1),p()},children:"Go Back"}),e.jsx(ee,{disabled:!f,onClick:()=>{g(!1),y(!1),l()},className:"bg-secondary text-secondary-foreground hover:bg-secondary/90 disabled:opacity-40",children:"Confirm & Submit"})]})]})})}function Ws({application:t}){var o,y,N,f,w;const[l,p]=c.useState(null),[a,b]=c.useState(!1),[u,v]=c.useState({}),x=async()=>{b(!0);try{const r=new Promise((h,n)=>setTimeout(()=>n(new Error("Interview prep generation timed out after 45s")),45e3)),d=S.integrations.Core.InvokeLLM({prompt:`You are an expert interview coach. Generate a comprehensive interview prep guide for this job application.
32
33Job Title: ${t.job_title}
34Company: ${t.company||"Unknown Company"}
35Platform: ${t.platform||""}
36Cover Letter submitted: ${t.cover_letter?t.cover_letter.substring(0,500):"N/A"}
37
38Return a JSON object with:
391. "likely_questions" — array of 8 likely interview questions (mix of behavioral, technical, and role-specific)
402. "suggested_answers" — array matching likely_questions, each with a 2-3 sentence suggested answer framework (use STAR method for behavioral)
413. "company_research" — array of 4 bullet points the candidate should know/research about the company/role
424. "questions_to_ask" — array of 4 smart questions the candidate should ask the interviewer
435. "red_flags" — array of 3 things to avoid or watch out for in this type of interview`,response_json_schema:{type:"object",properties:{likely_questions:{type:"array",items:{type:"string"}},suggested_answers:{type:"array",items:{type:"string"}},company_research:{type:"array",items:{type:"string"}},questions_to_ask:{type:"array",items:{type:"string"}},red_flags:{type:"array",items:{type:"string"}}}}}),A=await Promise.race([d,r]);p(A)}catch(r){console.error("Interview prep generation failed:",r.message)}finally{b(!1)}},g=r=>v(d=>({...d,[r]:!d[r]}));return!l&&!a?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8 text-center",children:[e.jsx(me,{className:"w-10 h-10 text-secondary"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Interview Prep Assistant"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Generate AI-
43powered interview questions, suggested answers, and preparation tips tailored to this role."})]}),e.jsxs(j,{onClick:x,className:"bg-secondary text-secondary-foreground hover:bg-secondary/90 mt-2",children:[e.jsx(me,{className:"w-4 h-4 mr-2"})," Generate Interview Prep"]})]}):a?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-10",children:[e.jsx(js,{className:"w-8 h-8 text-secondary animate-spin"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Preparing your interview guide..."})]}):e.jsxs("div",{className:"space-y-4",children:[e.jsx(oe,{title:"Likely Interview Questions",badge:`${((o=l.likely_questions)==null?void 0:o.length)||0} questions`,expanded:u.questions,onToggle:()=>g("questions"),children:e.jsx("div",{className:"space-y-3",children:(y=l.likely_questions)==null?void 0:y.map((r,d)=>{var A;return e.jsxs("div",{className:"p-3 rounded-lg bg-muted/50",children:[e.jsxs("p",{className:"text-sm font-medium mb-1",children:["Q",d+1,": ",r]}),((A=l.suggested_answers)==null?void 0:A[d])&&e.jsx("p",{className:"text-xs text-muted-foreground border-l-2 border-secondary pl-3 mt-2",children:l.suggested_answers[d]})]},d)})})}
43),e.jsx(oe,{title:"What to Research",badge:"4 points",expanded:u.research,onToggle:()=>g("research"),children:e.jsx("ul",{className:"space-y-2",children:(N=l.company_research)==null?void 0:N.map((r,d)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-secondary/20 text-secondary text-xs flex items-center justify-center shrink-0 mt-0.5",children:d+1}),r]},d))})}),e.jsx(oe,{title:"Questions to Ask the Interviewer",badge:"4 questions",expanded:u.ask,onToggle:()=>g("ask"),children:e.jsx("ul",{className:"space-y-2",children:(f=l.questions_to_ask)==null?void 0:f.map((r,d)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"text-secondary shrink-0",children:"→"}),r]},d))})}),e.jsx(oe,{title:"Watch Out For",badge:"avoid these",badgeVariant:"destructive",expanded:u.flags,onToggle:()=>g("flags"),children:e.jsx("ul",{className:"space-y-2",children:(w=l.red_flags)==null?void 0:w.map((r,d)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx("span",{className:"text-destructive shrink-0",children:"⚠"}),r]},d))})}),e.jsxs(j,{variant:"outline",size:"sm",onClick:x,className:"w-full",children:[e.jsx(me,{className:"w-3.5 h-3.5 mr-2"})," Regenerate"]})]})}function oe({title:t,badge:l,badgeVariant:p="secondary",expanded:a,onToggle:b,children:u}){return e.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[e.jsxs("button",{onClick:b,className:"w-full flex items-center justify-between p-3 text-left hover:bg-muted/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:t}),e.jsx(se,{variant:"outline",className:`text-xs ${p==="destructive"?"text-destructive border-destructive/40":"text-secondary border-secondary/40"}`,children:l})]}),a?e.jsx(ys,{className:"w-4 h-4 text-muted-foreground"}):e.jsx(vs,{className:"w-4 h-4 text-muted-foreground"})]}),a&&e.jsx("div",{className:"p-3 pt-0 border-t border-border",children:u})]})}function Js({jobTitle:t,company:l,referralLink:p}){const[a,b]=c.useState(!1),u=p||"https://savvskout.com",v=`Just applied to ${t||"a great role"}${l?` at ${l}`:""} using SavvSkout — AI-powered auto-applications that actually land interviews. Check it out:`,x=encodeURIComponent(v),g=encodeURIComponent(u),o=()=>{const y=`${v} ${u}`;navigator.clipboard.writeText(y).then(()=>{b(!0),C.success("Post copied to clipboard!"),setTimeout(()=>b(!1),2500)})};return e.jsxs("div",{className:"mt-3 pt-3 border-t border-secondary/20",children:[e.jsxs("p",{className:"text-[10px] text-muted-foreground mb-2 flex items-center gap-1",children:[e.jsx(ws,{className:"w-3 h-3 text-accent"}),"Share your milestone — earn referral rewards"]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("a",{href:`https://www.linkedin.com/sharing/share-offsite/?url=${g}`,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(j,{size:"sm",variant:"outline",className:"gap-1.5 text-xs h-7",children:[e.jsx(Ns,{className:"w-3 h-3"})," LinkedIn"]})}),e.jsx("a",{href:`https://twitter.com/intent/tweet?text=${x}&url=${g}`,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(j,{size:"sm",variant:"outline",className:"gap-1.5 text-xs h-7",children:[e.jsx(ks,{className:"w-3 h-3"})," Post on X"]})}),e.jsxs(j,{size:"sm",variant:"ghost",className:"gap-1.5 text-xs h-7",onClick:o,children:[a?e.jsx(pe,{className:"w-3 h-3 text-secondary"}):e.jsx(ts,{className:"w-3 h-3"}),a?"Copied!":"Copy post"]})]})]})}function Hs({result:t,onCopy:l}){var v,x,g;const[p,a]=c.useState(null),b=(o,y)=>{navigator.clipboard.writeText(o).then(()=>{a(y),C.success("Copied!"),setTimeout(()=>a(null),2500)})},u=()=>{var N,f,w,r;if(!t.clipboard_pack)return;const o=t.clipboard_pack,y=[`Name: ${((N=o.answers)==null?void 0:N.name)||""}`,`Email: ${((f=o.answers)==null?void 0:f.email)||""}`,(w=o.answers)!=null&&w.bid_amount?`Rate: $${o.answers.bid_amount} (${o.answers.bid_type})`:null,"","--- Cover Letter ---",o.cover_letter||"",(r=o.answers)!=null&&r.resume_url?`
44Resume: ${o.answers.resume_url}`:null].filter(d=>d!==null).join(`
45`);b(y,"all"),l&&l(y)};if(t.success)return e.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl bg-secondary/10 border border-secondary/30",children:[e.jsx(_s,{className:"w-5 h-5 text-secondary shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold text-sm text-secondary-foreground",children:"Application sent!"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.method==="email"?`Email delivered to ${t.sent_to}.`:`Submitted via ${t.method} ATS.`}),t.job_url&&e.jsxs("a",{href:t.job_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs font-medium text-secondary underline underline-offset-2 mt
45-2",children:["Open job page ",e.jsx(U,{className:"w-3 h-3"})]}),e.jsx(Js,{jobTitle:t.job_title,company:t.company,referralLink:t.referral_link})]})]});if(t.pending_review){const o=t.clipboard_pack,y=[((v=o==null?void 0:o.answers)==null?void 0:v.name)&&{key:"name",label:"Full Name",icon:ss,value:o.answers.name},((x=o==null?void 0:o.answers)==null?void 0:x.email)&&{key:"email",label:"Email",icon:be,value:o.answers.email},(o==null?void 0:o.cover_letter)&&{key:"cover",label:"Cover Letter",icon:$e,value:o.cover_letter},((g=o==null?void 0:o.answers)==null?void 0:g.resume_url)&&{key:"resume",label:"Resume URL",icon:Rs,value:o.answers.resume_url}].filter(Boolean);return e.jsxs("div",{className:"rounded-xl border border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3 p-4 pb-3",children:[e.jsx(Cs,{className:"w-5 h-5 text-amber-600 dark:text-amber-400 shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-sm text-amber-900 dark:text-amber-200",children:"Apply manually — your content is ready"}),e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 mt-0.5",children:"This job portal doesn't expose a direct email. Tap each field to copy it, then paste on the job page."})]})]}),e.jsx("div",{className:"px-4 pb-3",children:e.jsx("ol",{className:"text-xs text-amber-800 dark:text-amber-300 space-y-1 list-none",children:["Copy your cover letter below","Open the job page","Paste into the application form and submit"].map((N,f)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-amber-200 dark:bg-amber-700 text-amber-900 dark:text-amber-100 text-[10px] font-bold flex items-center justify-center",children:f+1}),e.jsx("span",{className:"mt-0.5",children:N})]},f))})}),y.length>0&&e.jsx("div",{className:"px-4 pb-3 space-y-2",children:y.map(({key:N,label:f,icon:w,value:r})=>e.jsxs("button",{onClick:()=>b(r,N),className:"w-full flex items-center justify-between gap-2 p-2.5 rounded-lg border border-amber-200 dark:border-amber-700 bg-white dark:bg-amber-900/20 hover:bg-amber-100 dark:hover:bg-amber-800/30 transition-colors text-left group",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(w,{className:"w-3.5 h-3.5 text-amber-600 dark:text-amber-400 shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] font-semibold text-amber-700 dark:text-amber-400 uppercase tracking-wide",children:f}),e.jsx("p",{className:"text-xs text-amber-900 dark:text-amber-200 truncate max-w-[260px]",children:r})]})]}),e.jsx("span",{className:"shrink-0",children:p===N?e.jsx(pe,{className:"w-4 h-4 text-green-600"}):e.jsx(ts,{className:"w-4 h-4 text-amber-500 group-hover:text-amber-700"})})]},N))}),e.jsxs("div",{className:"flex flex-wrap gap-2 p-4 pt-1 border-t border-amber-200 dark:border-amber-800",children:[o&&e.jsxs(j,{size:"sm",onClick:u,className:`gap-1.5 transition-all ${p==="all"?"bg-green-600 text-white hover:bg-green-600":"bg-amber-600 hover:bg-amber-700 text-white"}`,children:[p==="all"?e.jsx(pe,{className:"w-3.5 h-3.5"}):e.jsx(as,{className:"w-3.5 h-3.5"}),p==="all"?"Copied!":"Copy Everything"]}),t.job_url&&e.jsx("a",{href:t.job_url,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(j,{size:"sm",onClick:o?()=>{u()}:void 0,className:"gap-1.5 bg-amber-700 hover:bg-amber-800 text-white",children:[e.jsx(U,{className:"w-3.5 h-3.5"})," Open Job Page"]})})]})]})}return e.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl bg-destructive/10 border border-destructive/20",children:[e.jsx(Ss,{className:"w-5 h-5 text-destructive shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-semibold text-sm text-destructive",children:"Submission failed"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.message}),t.job_url&&e.jsxs("a",{href:t.job_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs font-medium text-destructive underline underline-offset-2 mt
45-2",children:["Apply manually on the job page ",e.jsx(U,{className:"w-3 h-3"})]})]})]})}const Gs=[];function Xs({jobId:t}){const[l,p]=Ae.useState(null),[a,b]=Ae.useState(!1);return Ae.useEffect(()=>{t&&S.entities.Job.get(t).then(u=>p((u==null?void 0:u.url)||null)).catch(()=>{})},[t]),!t||l===null||!l?null:e.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(j,{size:"sm",variant:"outline",className:"gap-1.5 h-8 text-xs border-amber-400 text-amber-700 dark:text-amber-300 hover:bg-amber-100 dark:hover:bg-amber-900/30",children:[e.jsx(U,{className:"w-3.5 h-3.5"})," Open Job Page"]})})}const R={draft:{label:"Draft",color:"bg-muted text-muted-foreground",dot:"bg-muted-foreground"},pending_review:{label:"Pending Review",color:"bg-amber-500/10 text-amber-700 border-amber-500/20",dot:"bg-amber-500"},submitted:{label:"Submitted",color:"bg-secondary/10 text-secondary border-secondary/20",dot:"bg-secondary"},withdrawn:{label:"Withdrawn",color:"bg-destructive/10 text-destructive border-destructive/20",dot:"bg-destructive"},accepted:{label:"Accepted",color:"bg-green-500/10 text-green-700 border-green-500/20",dot:"bg-green-500"},rejected:{label:"Rejected",color:"bg-destructive/10 text-destructive border-destructive/20",dot:"bg-destructive"},completed:{label:"Completed",color:"bg-primary/10 text-primary border-primary/20",dot:"bg-primary"}};function Lt(){var Be,Ke;const{user:t,settings:l}=ds(),p=Ze(),[a,b]=c.useState(null),[u,v]=c.useState(!1),[x,g]=c.useState({}),[o,y]=c.useState("all"),[N,f]=c.useState("details"),[w,r]=c.useState(new Set),[d,A]=c.useState(""),[h,n]=c.useState("list");c.useEffect(()=>{if(!a)return;["details","correspondence",...a.status==="accepted"?["interview"]:[]].includes(N)||f("details")},[a==null?void 0:a.id]);const[T,_]=c.useState(0),[E,D]=c.useState(!0),[te,P]=c.useState([]),B=50,{data:I=Gs,isError:qe,refetch:rs,isFetching:ae}=de({queryKey:["applications-paginated",t==null?void 0:t.email,T],queryFn:async()=>await S.entities.Application.filter({user_email:t==null?void 0:t.email},"-created_date",B,T*B),enabled:!!(t!=null&&t.email),staleTime:120*1e3});c.useEffect(()=>{if(!I.length&&T===0){P([]);return}P(T===0?I:s=>{const i=new Set(s.map(k=>k.id)),m=I.filter(k=>!i.has(k.id));return[...s,...m]}
45),D(I.length===B)},[I,T]),c.useEffect(()=>{_(0),P([]),D(!0)},[t==null?void 0:t.email]);const M=te,K=(s,i)=>{P(m=>m.map(k=>k.id===s?{...k,...i}:k)),b(m=>(m==null?void 0:m.id)===s?{...m,...i}:m)},ns=s=>{const i=new Set(s);P(m=>m.filter(k=>!i.has(k.id))),b(m=>m&&i.has(m.id)?null:m),r(m=>{const k=new Set(m);return s.forEach($=>k.delete($)),k})},Re=z({mutationFn:({id:s,data:i})=>S.entities.Application.update(s,i),onMutate:({id:s,data:i})=>{K(s,i)},onError:()=>{p.invalidateQueries({queryKey:["applications-paginated",t==null?void 0:t.email]})},onSuccess:()=>{v(!1),C.success("Application updated")}}),Ie=z({mutationFn:async s=>{const i={status:"withdrawn",withdrawn_date:new Date().toISOString(),withdrawal_reason:"User initiated withdrawal"};await S.entities.Application.update(s.id,i),await S.entities.ActivityLog.create({action:`User withdrew application for "${s.job_title}" at ${s.company}`,agent:"executor",entity_type:"application",entity_id:s.id,details:"Executor Agent handling mechanical withdrawal from platform",status:"success",user_email:t==null?void 0:t.email})},onMutate:s=>{K(s.id,{status:"withdrawn"})},onError:()=>{p.invalidateQueries({queryKey:["applications-paginated",t==null?void 0:t.email]})},onSuccess:()=>{b(null),C.success("Application withdrawn — Executor Agent notified")}}),fe=z({mutationFn:async s=>{if(s.length===1)await S.entities.Application.delete(s[0]);else{const i=await S.functions.invoke("bulkDeleteApplications",{application_ids:s});if(!(i!=null&&i.data))throw new Error("No response from server")}},onMutate:s=>{ns(s)},onError:()=>{p.invalidateQueries({queryKey:["applications-paginated",t==null?void 0:t.email]})},onSuccess:(s,i)=>{C.success(`${i.length} application(s) deleted`)}}),je=z({mutationFn:async({ids:s,status:i})=>{await Promise.all(s.map(m=>S.entities.Application.update(m,{status:i})))},onMutate:({ids:s,status:i})=>{s.forEach(m=>K(m,{status:i}))},onError:()=>{p.invalidateQueries({queryKey:["applications-paginated",t==null?void 0:t.email]})},onSuccess:(s,{ids:i,status:m})=>{var $;const k=(($=R[m])==null?void 0:$.label)||m;C.success(`${i.length} application(s) moved to ${k}`),r(new Set),A("")}}),[V,F]=c.useState(null),[is,re]=c.useState(!1),[ye,ve]=c.useState(null),[we,Ne]=c.useState(null);c.useEffect(()=>{if(!(a!=null&&a.job_id)){ve(null),Ne(null);return}S.entities.Job.get(a.job_id).then(s=>{ve((s==null?void 0:s.url)||null),Ne(s||null)}).catch(()=>{ve(null),Ne(null)})},[a==null?void 0:a.id]);const Y=z({mutationFn:s=>fs({applicationId:s.id,jobId:s.job_id}),onSuccess:s=>{p.invalidateQueries({queryKey:["applications-paginated"]}),s.success?(F({success:!0,sent_to:s.sent_to,method:s.method,job_url:s.job_url,clipboard_pack:s.clipboard_pack,referral_link:ke==null?void 0:ke.deep_link}),s.method==="extension_apply"&&s.job_url&&window.open(s.job_url,"_blank","noopener,noreferrer"),C.success(s.method==="email"?`Application sent to ${s.sent_to}!`:`Application submitted via ${s.method}!`)):s.reason==="pending_review"?(F({pending_review:!0,job_url:s.job_url,clipboard_pack:s.clipboard_pack,message:s.message}),C.info(s.message||"No email found — prefilled answers ready to copy.")):s.reason==="no_email_found"?(F({success:!1,job_url:s.job_url,message:s.message}),C.info("No contact email found — apply manually via the job link.")):C.error(s.message||s.error||"Submission failed.")},onError:()=>{C.error("Failed to submit application. Please try again.")}}),{data:ke}=de({queryKey:["share-link",t==null?void 0:t.email],queryFn:()=>S.functions.invoke("manageUserReferral",{}).then(s=>s.data),enabled:!!(t!=null&&t.email),staleTime:300*1e3}),Fe=c.useMemo(()=>o==="all"?M:M.filter(s=>s.status===o),[M,o]),{data:ze=[]}=de({queryKey:["messages-unread",t==null?void 0:t.email],queryFn:()=>S.entities.Message.filter({user_email:t==null?void 0:t.email,read:!1},"-created_date",100),enabled:!!(t!=null&&t.email),staleTime:60*1e3}),Oe=c.useMemo(()=>{const s={};return ze.filter(i=>!i.read&&i.sender==="employer").forEach(i=>{i.application_id&&(s[i.application_id]=(s[i.application_id]||0)+1)}),s},[ze]);
45return e.jsxs("div",{className:"space-y-6 min-w-0 w-full",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h1",{className:"font-heading text-2xl font-bold",children:"My Applications"}),(l==null?void 0:l.verification_badge_unlocked)&&(!(l!=null&&l.verification_badge_expires_at)||new Date(l.verification_badge_expires_at)>new Date)&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-secondary/15 text-secondary text-xs font-semibold border border-secondary/30",children:[e.jsx(As,{className:"w-3.5 h-3.5"})," Verified"]})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Review AI-drafted applications, edit, submit, or withdraw at any time"})]}),e.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted/40 rounded-lg shrink-0",children:[e.jsx("button",{onClick:()=>n("list"),className:`p-1.5 rounded-md transition-colors ${h==="list"?"bg-card shadow text-foreground":"text-muted-foreground hover:text-foreground"}`,title:"List view",children:e.jsx(Ls,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>n("kanban"),className:`p-1.5 rounded-md transition-colors ${h==="kanban"?"bg-card shadow text-foreground":"text-muted-foreground hover:text-foreground"}`,title:"Kanban view",children:e.jsx(Es,{className:"w-4 h-4"})})]})]}),M.length>0&&e.jsx("div",{className:"grid grid-cols-4 gap-2",children:[{label:"Total",count:M.length,color:"text-foreground",bg:"bg-muted/60",border:"border-border"},{label:"Pending",count:M.filter(s=>s.status==="pending_review").length,color:"text-amber-700",bg:"bg-amber-500/10",border:"border-amber-500/20"},{label:"Submitted",count:M.filter(s=>s.status==="submitted").length,color:"text-secondary",bg:"bg-secondary/10",border:"border-secondary/20"},{label:"Accepted",count:M.filter(s=>s.status==="accepted").length,color:"text-green-700",bg:"bg-green-500/10",border:"border-green-500/20"}].map(({label:s,count:i,color:m,bg:k,border:$})=>e.jsxs("div",{className:`flex flex-col items-center py-3 px-2 rounded-xl border ${k} ${$}`,children:[e.jsx("span",{className:`text-2xl font-bold font-heading leading-none ${m}`,children:i}),e.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:s})]},s))}),e.jsx(Ve,{value:o,onValueChange:y,className:h==="kanban"?"hidden":"",children:e.jsxs(Ye,{className:"bg-muted flex-wrap h-auto gap-1",children:[e.jsxs(L,{value:"all",children:["All (",M.length,")"]}),e.jsx(L,{value:"pending_review",children:"Pending Review"}),e.jsx(L,{value:"draft",children:"Drafts"}),e.jsx(L,{value:"submitted",children:"Submitted"}),e.jsx(L,{value:"accepted",children:"Accepted"}),e.jsx(L,{value:"withdrawn",children:"Withdrawn"})]})}),w.size>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 p-3 bg-secondary/10 border border-secondary/30 rounded-lg",children:[e.jsxs("span",{className:"text-sm font-semibold text-secondary flex items-center gap-1.5",children:[e.jsx(cs,{className:"w-4 h-4"})," ",w.size," selected"]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(xe,{value:d,onValueChange:A,children:[e.jsx(ue,{className:"h-8 text-xs w-[160px]",children:e.jsx(he,{placeholder:"Move to stage…"})}),e.jsx(ge,{children:Object.entries(R).map(([s,{label:i}])=>e.jsx(O,{value:s,children:i},s))})]}),e.jsx(j,{size:"sm",className:"h-8 bg-secondary text-secondary-foreground",disabled:!d||je.isPending,onClick:()=>je.mutate({ids:Array.from(w),status:d}),children:je.isPending?"Updating…":"Apply"})]}),e.jsx("div",{className:"h-4 w-px bg-border hidden sm:block"}),e.jsxs(W,{children:[e.jsx(ie,{asChild:!0,children:e.jsxs(j,{variant:"destructive",size:"sm",className:"h-8",children:[e.jsx(Je,{className:"w-3.5 h-3.5 mr-1.5"})," Delete"]})}
45),e.jsxs(J,{children:[e.jsxs(H,{children:[e.jsxs(G,{children:["Delete ",w.size," application(s)?"]}),e.jsx(le,{children:"This action cannot be undone. Selected applications will be permanently deleted."})]}),e.jsxs(X,{children:[e.jsx(Z,{children:"Cancel"}),e.jsx(ee,{className:"bg-destructive text-destructive-foreground",onClick:()=>fe.mutate(Array.from(w)),children:fe.isPending?"Deleting…":"Delete"})]})]})]}),e.jsx(j,{variant:"ghost",size:"sm",className:"h-8 ml-auto text-muted-foreground",onClick:()=>{r(new Set),A("")},children:"Clear"})]}),h==="kanban"&&e.jsx(Bs,{applications:M,onStatusChange:(s,i)=>{const m=M.find($=>$.id===s),k={draft:"Draft",pending_review:"Pending Review",submitted:"Applied",accepted:"Interviewing",completed:"Offer / Won",rejected:"Rejected",withdrawn:"Withdrawn"};K(s,{status:i}),S.entities.Application.update(s,{status:i}).then(()=>C.success(`"${m==null?void 0:m.job_title}" moved to ${k[i]||i}`)).catch(()=>{K(s,{status:m==null?void 0:m.status}),C.error("Failed to update status. Please try again.")})},onView:s=>{b(s),g(s),f("details"),F(null)}}),e.jsx("div",{className:`space-y-3 ${h==="kanban"?"hidden":""}`,children:qe?e.jsx(Ce,{className:"border-0 shadow-sm border-destructive/20",children:e.jsxs(Se,{className:"py-12 text-center",children:[e.jsx(Me,{className:"w-10 h-10 text-destructive mx-auto mb-3"}),e.jsx("p",{className:"font-medium text-sm mb-1",children:"Failed to Load Applications"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"A network error occurred. Check your connection and try again."}),e.jsx(j,{onClick:()=>rs(),disabled:ae,size:"sm",className:"bg-secondary text-secondary-foreground",children:ae?"Retrying...":"Retry"})]})}):Fe.length===0?e.jsx(Ce,{className:"border-0 shadow-sm",children:e.jsxs(Se,{className:"py-12 text-center",children:[e.jsx($e,{className:"w-10 h-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"font-medium text-sm mb-1",children:"No Applications Yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Go to Scouting, find matching jobs, and approve the AI to draft your application."})]})}):Fe.map((s,i)=>{var m,k,$,Ue;return e.jsx(De.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:i*.03},children:e.jsx(Ce,{className:`border-0 shadow-sm hover:shadow-md transition-shadow ${w.has(s.id)?"bg-secondary/5 border border-secondary/30":""}`,children:e.jsx(Se,{className:"p-4",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[e.jsx("input",{type:"checkbox",checked:w.has(s.id),onChange:ls=>{const _e=new Set(w);ls.target.checked?_e.add(s.id):_e.delete(s.id),r(_e)},className:"w-4 h-4 rounded border-input mt-1.5 cursor-pointer shrink-0"}),e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center shrink-0 ${((m=R[s.status])==null?void 0:m.color)||"bg-muted text-muted-foreground"} border`,children:e.jsx("span",{className:`w-2.5 h-2.5 rounded-full ${((k=R[s.status])==null?void 0:k.dot)||"bg-muted-foreground"}`})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5 flex-wrap",children:[e.jsx("h3",{className:"font-medium truncate",children:s.job_title}),e.jsx(se,{className:`border text-xs ${($=R[s.status])==null?void 0:$.color}`,children:(Ue=R[s.status])==null?void 0:Ue.label})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.company," · ",s.platform," · ",s.applied_date?Pe(new Date(s.applied_date),"MMM d, yyyy"):"Not submitted yet"]})]})]}),e.jsxs("div",{className:"flex gap-2 shrink-0 flex-wrap",children:[(s.status==="pending_review"||s.status==="draft")&&e.jsxs(j,{size:"sm",className:"bg-secondary hover:bg-secondary/90 text-secondary-foreground gap-1.5 h-8",onClick:()=>{b(s),g(s),f("details"),F(null),re(!0)},disabled:Y.isPending,children:[e.jsx(Ee,{className:"w-3.5 h-3.5"})," ",Y.isPending?"...":"Submit Now"]}),e.jsxs(j,{variant:"outline",size:"sm",onClick:()=>{b(s),g(s),f("details"),F(null)},className:"relative",children:[e.jsx(Xe,{className:"w-4 h-4 mr-1"})," View",Oe[s.id]>0&&e.jsx("span",{className:"absolute -top-1.5 -right-1.5 w-4 h-4 rounded-full bg-destructive text-destructive-foreground text-[10px] flex items-center justify-center font-bold",children:Oe[s.id]})]}),e.jsxs(W,{children:[e.jsx(ie,{asChild:!0,children:e.jsx(j,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",children:e.jsx(Je,{className:"w-4 h-4"})})}
45),e.jsxs(J,{children:[e.jsxs(H,{children:[e.jsx(G,{children:"Delete Application?"}),e.jsxs(le,{children:["This will permanently delete your application for ",e.jsx("strong",{children:s.job_title}),". This action cannot be undone."]})]}),e.jsxs(X,{children:[e.jsx(Z,{children:"Cancel"}),e.jsx(ee,{className:"bg-destructive text-destructive-foreground",onClick:()=>fe.mutate([s.id]),children:"Delete"})]})]})]}),!["withdrawn","rejected","completed"].includes(s.status)&&e.jsxs(W,{children:[e.jsx(ie,{asChild:!0,children:e.jsxs(j,{variant:"destructive",size:"sm",children:[e.jsx(Me,{className:"w-4 h-4 mr-1"})," Withdraw"]})}),e.jsxs(J,{children:[e.jsxs(H,{children:[e.jsx(G,{children:"Withdraw Application?"}),e.jsxs(le,{children:["This will withdraw your application for ",e.jsx("strong",{children:s.job_title})," at ",e.jsx("strong",{children:s.company}),". The Executor Agent will handle the mechanical withdrawal from the platform. This action is logged."]})]}),e.jsxs(X,{children:[e.jsx(Z,{children:"Cancel"}),e.jsx(ee,{className:"bg-destructive text-destructive-foreground",onClick:()=>Ie.mutate(s),children:"Yes, Withdraw"})]})]})]})]})]})})})},s.id)})}),E&&M.length>0&&!qe&&e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(j,{variant:"outline",size:"sm",onClick:()=>_(s=>s+1),disabled:ae,className:"min-h-[40px]",children:ae?"Loading...":`Load more (showing ${M.length})`})}),e.jsx(xs,{open:!!a,onOpenChange:()=>{b(null),v(!1),f("details"),F(null)},children:e.jsxs(us,{className:"w-[calc(100vw-2rem)] max-w-2xl max-h-[90svh] overflow-y-auto",children:[e.jsx(hs,{children:e.jsx(gs,{className:"font-heading",children:a==null?void 0:a.job_title})}),a&&e.jsxs("div",{className:"space-y-4 mt-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(se,{className:(Be=R[a.status])==null?void 0:Be.color,children:(Ke=R[a.status])==null?void 0:Ke.label}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[a.company," · ",a.platform]})]}),e.jsxs(Ve,{value:N,onValueChange:s=>{f(s),v(!1)},children:[e.jsxs(Ye,{className:"w-full",children:[e.jsxs(L,{value:"details",className:"flex-1",children:[e.jsx($e,{className:"w-3.5 h-3.5 mr-1.5"}),"Application"]}),e.jsxs(L,{value:"correspondence",className:"flex-1",children:[e.jsx(ms,{className:"w-3.5 h-3.5 mr-1.5"}),"Correspondence"]}),(a==null?void 0:a.status)==="accepted"&&e.jsxs(L,{value:"interview",className:"flex-1",children:[e.jsx(me,{className:"w-3.5 h-3.5 mr-1.5"}),"Interview Prep"]})]}),e.jsxs(Te,{value:"details",className:"space-y-4 mt-4",children:[a.status==="pending_review"&&((a.submission_tier==="auto_email_ready"||a.submission_tier==="auto_submit_supported")&&a.employer_email?e.jsxs("div",{className:"p-3 rounded-lg bg-green-50 dark:bg-green-950/20 border border-green-200 dark:border-green-800",children:[e.jsxs("div",{className:"flex items-start gap-2 mb-1",children:[e.jsx(be,{className:"w-4 h-4 text-green-700 dark:text-green-400 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-xs text-green-800 dark:text-green-300 font-medium",children:"Email-ready — verified employer contact found"})]}),e.jsxs("p",{className:"text-xs text-green-700 dark:text-green-400",children:["Your application is ready to send to ",e.jsx("strong",{children:a.employer_email}),". Click “Approve & Send Email” below to submit."]})]}):e.jsxs("div",{className:"p-3 rounded-lg bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800",children:[e.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[e.jsx(es,{className:"w-4 h-4 text-amber-700 dark:text-amber-400 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-xs text-amber-800 dark:text-amber-300 font-medium",children:"Ready to apply — no auto-submit route found for this portal"})]}),e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 mb-2",children:"Your cover letter is drafted. Copy it, then open the job page and paste it in the application form."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.cover_letter&&e.jsxs(j,{size:"sm",className:"bg-amber-600 hover:bg-amber-700 text-white gap-1.5 h-8 text-xs",onClick:()=>{navigator.clipboard.writeText(a.cover_letter),C.success("Cover letter copied!")},children:[e.jsx(as,{className:"w-3.5 h-3.5"})," Copy Cover Letter"]}),e.jsx(Xs,{jobId:a.job_id})]})]})),["draft","pending_review"].includes(a.status)&&e.jsx(bs,{app:{...a,job_description:(we==null?void 0:we.description)||""},user:t,onApplied:s=>{K(a.id,{cover_letter:s}),g(i=>({...i,cover_letter:s}))}}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(ne,{className:"font-medium",children:"Your Bid"}),u?e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsxs(xe,{value:x.bid_type||"fixed",onValueChange:s=>g({...x,bid_type:s}),children:[e.jsx(ue,{className:"w-[180px]",children:e.jsx(he,{})}),e.jsxs(ge,{children:[e.jsx(O,{value:"fixed",children:"Fixed Fee ($)"}),e.jsx(O,{value:"hourly",children:"Hourly Rate ($/hr)"})]})]}),e.jsx("input",{type:"number",min:"0",step:"0.01",value:x.bid_amount||"",onChange:s=>g({...x,bid_amount:s.target.value===""?"":s.target.value}),placeholder:"e.g. 250",className:"flex-1 h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-ring"})]}):e.jsx("p",{className:"text-sm mt-1",children:a.bid_amount?e.jsxs("span",{className:"font-medium text-secondary",children:["$",a.bid_amount," ",a.bid_type==="hourly"?"/ hr":"(fixed)"]}):e.jsx("span",{className:"text-muted-foreground",children:"—"})})]}),e.jsxs("div",{children:[e.jsx(ne,{className:"font-medium",children:"Cover Letter"}),u?e.jsx(ce,{value:x.cover_letter||"",onChange:s=>g({...x,cover_letter:s.target.value}),rows:7,className:"mt-1",placeholder:"Cover letter..."}):e.jsx("div",{className:"mt-1 p-3 rounded-lg bg-muted/50 text-sm text-foreground
45/80 whitespace-pre-wrap min-h-[80px]",children:a.cover_letter||e.jsx("span",{className:"text-muted-foreground italic",children:"Awaiting AI draft..."})})]}),e.jsxs("div",{children:[e.jsx(ne,{className:"font-medium",children:"Proposal"}),u?e.jsx(ce,{value:x.proposal||"",onChange:s=>g({...x,proposal:s.target.value}),rows:5,className:"mt-1",placeholder:"Proposal / pitch..."}):e.jsx("div",{className:"mt-1 p-3 rounded-lg bg-muted/50 text-sm text-foreground/80 whitespace-pre-wrap min-h-[60px]",children:a.proposal||e.jsx("span",{className:"text-muted-foreground italic",children:"Awaiting AI draft..."})})]}),e.jsxs("div",{children:[e.jsx(ne,{className:"font-medium",children:"Notes"}),u?e.jsx(ce,{value:x.notes||"",onChange:s=>g({...x,notes:s.target.value}),rows:2,className:"mt-1"}):e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:a.notes||"—"})]})]}),V&&e.jsx(Hs,{result:V,onCopy:s=>{navigator.clipboard.writeText(s),C.success("Copied to clipboard!")}}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-4 border-t",children:u?e.jsxs(e.Fragment,{children:[e.jsxs(j,{onClick:()=>{const s={...x,bid_amount:x.bid_amount!==""&&x.bid_amount!=null?parseFloat(x.bid_amount):null};Re.mutate({id:a.id,data:s})},className:"bg-secondary text-secondary-foreground",disabled:Re.isPending,children:[e.jsx(Ts,{className:"w-4 h-4 mr-2"})," Save Changes"]}),e.jsx(j,{variant:"outline",onClick:()=>v(!1),children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs(j,{variant:"outline",onClick:()=>{v(!0),g(a)},children:[e.jsx(Fs,{className:"w-4 h-4 mr-2"})," Edit Draft"]}),["draft","pending_review"].includes(a.status)&&!(V!=null&&V.success)&&(()=>{const s=a.submission_tier==="auto_email_ready"||a.submission_tier==="auto_submit_supported",i=a.submission_tier==="extension_apply_ready";return!s&&!i&&ye?e.jsx("a",{href:ye,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(j,{className:"bg-secondary text-secondary-foreground",children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),"Open Job & Apply"]})}):e.jsxs(j,{className:"bg-secondary text-secondary-foreground",onClick:()=>re(!0),disabled:Y.isPending,children:[e.jsx(Ee,{className:"w-4 h-4 mr-2"})," ",Y.isPending?"Submitting...":s?"Approve & Send Email":i?"Autofill with Extension":"Submit"]})})(),e.jsx(Ys,{open:is,jobTitle:a==null?void 0:a.job_title,company:a==null?void 0:a.company,platform:a==null?void 0:a.platform,jobUrl:ye,onConfirm:()=>{re(!1),Y.mutate(a)},onCancel:()=>re(!1)}),!["withdrawn","rejected","completed"].includes(a.status)&&e.jsxs(W,{children:[e.jsx(ie,{asChild:!0,children:e.jsxs(j,{variant:"destructive",children:[e.jsx(Me,{className:"w-4 h-4 mr-2"})," Withdraw Application"]})}
45),e.jsxs(J,{children:[e.jsxs(H,{children:[e.jsx(G,{children:"Withdraw Application?"}),e.jsxs(le,{children:["This will withdraw your application for ",e.jsx("strong",{children:a.job_title}),". The Executor Agent will handle the withdrawal. This is logged and irreversible."]})]}),e.jsxs(X,{children:[e.jsx(Z,{children:"Cancel"}),e.jsx(ee,{className:"bg-destructive text-destructive-foreground",onClick:()=>Ie.mutate(a),children:"Yes, Withdraw"})]})]})]})]})})]}),e.jsx(Te,{value:"correspondence",className:"mt-4",children:e.jsx(Us,{application:a,user:t})}),e.jsx(Te,{value:"interview",className:"mt-4",children:e.jsx(Ws,{application:a})})]})]})]})})]})}export{Lt 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.