1import{c as F,j as e}from"./react-vendor-BPVS6nhZ.js";import{u as S,d as D,K as d,h as o,E as m,F as l,B as i,ac as z,a0 as u}from"./index-DRO5rV4c.js";import{u as $,E as k}from"./useCareerDocuments-DRfGhkxE.js";import{L as h}from"./loader-circle-CTufH0Vi.js";import{D as L}from"./download-DaCF_4SR.js";import{T as _}from"./trash-2-df5oec6c.js";import"./i18n-DCFGyhQR.js";import"./radix-Dju3oJNz.js";import"./supabase-C8V-QVu6.js";const U=()=>{const{user:j,loading:f}=S(),{documents:x,isLoading:p,deleteDocument:g}=$(),c=F(),{toast:N}=D();if(f)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(h,{className:"h-8 w-8 animate-spin text-primary"})});if(!j)return e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx(d,{showAuth:!0,showNav:!0}),e.jsx("main",{className:"flex-1 flex items-center justify-center",children:e.jsx(o,{className:"max-w-md",children:e.jsxs(m,{className:"p-8 text-center space-y-4",children:[e.jsx(l,{className:"h-12 w-12 text-muted-foreground mx-auto"}),e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Sign in to view your documents"}),e.jsx("p",{className:"text-muted-foreground",children:"Create an account to save and access your generated resumes and cover letters."}),e.jsxs(i,{onClick:()=>c("/auth"),children:[e.jsx(z,{className:"h-4 w-4 mr-2"})," Sign In"]})]})})}),e.jsx(u,{})]});const v=t=>{const s=new k,r=20,y=s.internal.pageSize.getWidth()-r*2;let a=r;s.setFont("helvetica","bold"),s.setFontSize(16);const w=t.type==="resume"?"Resume":"Cover Letter";s.text(`${w}${t.job_title?` â ${t.job_title}`:""}${t.company?` at ${t.company}`:""}`,r,a),a+=14,s.setFont("helvetica","normal"),s.setFontSize(11);const b=s.splitTextToSize(t.generated_text||"",y);for(const n of b)a>s.internal.pageSize.getHeight()-r&&(s.addPage(),a=r),n===n.toUpperCase()&&n.trim().length>2&&!n.includes("|")?(s.setFont("helvetica","bold"),s.setFontSize(12),a+=4):(s.setFont("helvetica","normal"),s.setFontSize(11)),s.text(n,r,a),a+=7;const C=`${t.type==="resume"?"Resume":"CoverLetter"}_${(t.company||"doc").replace(/\s+/g,"_")}.pdf`;s.save(C),N({title:"PDF downloaded!"})};return e.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[e.jsx(d,{showAuth:!0,showNav:!0}),e.jsx("main",{className:"flex-1 container mx-auto px-4 sm:px-6 py-8",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-3xl font-bold text-foreground",children:"My Documents"}),e.jsxs(i,{onClick:()=>c("/careercraft"),children:[e.jsx(l,{className:"h-4 w-4 mr-2"})," Create New"]})]}),p?e.jsx("div",{className:"flex justify-center py-12",children:e.jsx(h,{className:"h-8 w-8 animate-spin text-primary"})}):x.length===0?e.jsx(o,{children:e.jsxs(m,{className:"p-12 text-center space-y-4",children:[e.jsx(l,{className:"h-12 w-12 text-muted-foreground mx-auto"}),e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"No documents yet"}),e.jsx("p",{className:"text-muted-foreground",children:"Use CultulyCareer AI to generate your first resume and cover letter."}),e.jsx(i,{onClick:()=>c("/careercraft"),children:"Get Started"})]})}):e.jsx("div",{className:"space-y-3",children:x.map(t=>e.jsx(o,{children:e.jsxs(m,{className:"p-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(l,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"font-medium text-foreground",children:[t.type==="resume"?"Resume":"Cover Letter",t.job_title&&` â ${t.job_title}`]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.company&&`${t.company} · `,new Date(t.created_at).toLocaleDateString()]})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(i,{variant:"outline",size:"sm",onClick:()=>v(t),children:e.jsx(L,{className:"h-4 w-4"})}),e.jsx(i,{variant:"outline",size:"sm",onClick:()=>g.mutate(t.id),className:"text-destructive hover:text-destructive",children:e.jsx(_,{className:"h-4 w-4"})})]})]})},t.id))})]})}),e.jsx(u,{})]})};export{U 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.