1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1824],{72863:(e,t,a)=>{"use strict";a.d(t,{C:()=>l,I:()=>n});var s=a(78639),i=a(81118);function l(e,t,a){let[l,n]=(0,s.useState)(null),[r,o]=(0,s.useState)(0),[c,d]=(0,s.useState)(),u=Array.isArray(t)?t.join(","):t;(0,s.useEffect)(()=>{if(!e){n(null),o(0),d(void 0);return}let s=!1;return(async()=>{try{let l=await fetch(`${i.C1}/subscription/me?userId=${encodeURIComponent(e)}`,{credentials:"include"});if(!l.ok||s)return;let r=await l.json(),c=Array.isArray(r?.signupFreeAllowances)?r.signupFreeAllowances:[],u=function(e,t){let a=Array.isArray(t)?t:[t];if(a.includes("ai_assessment_generate")||a.includes("ai_assessment_report")){let t=e.find(e=>"ai_assessment_generate"===e.featureKey),a=e.find(e=>"ai_assessment_report"===e.featureKey);return t||a?{total:Math.max(t?.total??0,a?.total??0),used:Math.max(t?.used??0,a?.used??0),remaining:Math.min(t?.remaining??0,a?.remaining??0)}:null}let s=e.find(e=>e.featureKey===a[0]);return s?{total:s.total,used:s.used,remaining:s.remaining}:null}(c,t);a&&(!u||u.remaining<=0)&&r?.[a]===!0&&(u={total:2,used:1,remaining:1}),s||(n(u),o(Number(r?.creditsRemaining??0)),d("string"==typeof r?.status?r.status:void 0))}catch{s||(n(null),o(0),d(void 0))}})(),()=>{s=!0}},[e,u,a]);let m=l?.remaining??0,p=l?.total??0,h=l?.used??0,y=p>0&&m<=0;return{allowance:l,remaining:m,total:p,used:h,hasFreeUses:m>0,freeUsesExhausted:y,needsSubscription:y&&("signup_bonus"===c||r<=0),creditsRemaining:r,subscriptionStatus:c}}function n(e,t){return`${e} of ${t} free use${1===t?"":"s"} left`}},79277:e=>{e.exports={page:"resume-builder_page__ffdyj",appBar:"resume-builder_appBar__e8j3U",appBarLeft:"resume-builder_appBarLeft__wvx0g",appBarIconBtn:"resume-builder_appBarIconBtn__51dVF",appSavedText:"resume-builder_appSavedText__oCOJQ",appSavedDivider:"resume-builder_appSavedDivider__oBcAC",pi:"resume-builder_pi__TGoLA",appBarCenter:"resume-builder_appBarCenter__J0MRI",docTitle:"resume-builder_docTitle__mNIN4",saveStatus:"resume-builder_saveStatus__0Z0sv",saveStatusPending:"resume-builder_saveStatusPending__EyO2p",appBarRight:"resume-builder_appBarRight__Fe5h5",creditPill:"resume-builder_creditPill__z364r",appBarActionBtn:"resume-builder_appBarActionBtn__X7Wzl",appBarActionBtnPrimary:"resume-builder_appBarActionBtnPrimary__EEc_r",flashBar:"resume-builder_flashBar__8oCZI",flashError:"resume-builder_flashError___wCBw",flashWarn:"resume-builder_flashWarn___9Z7F",statusBannerWrap:"resume-builder_statusBannerWrap___O6LK",loadingText:"resume-builder_loadingText__C2_kE",workspace:"resume-builder_workspace__wIslV",workspaceCollapsed:"resume-builder_workspaceCollapsed__355RK",workspaceWithVersions:"resume-builder_workspaceWithVersions__6mCt9",libraryPane:"resume-builder_libraryPane__LFpzM",libraryPaneCollapsed:"resume-builder_libraryPaneCollapsed__pGMJc",libraryTopActions:"resume-builder_libraryTopActions__oaMlF",libraryCollapseBtn:"resume-builder_libraryCollapseBtn__jhrEr",libraryList:"resume-builder_libraryList__Y1ORr",versionsPane:"resume-builder_versionsPane__gnWM_",versionsHeader:"resume-builder_versionsHeader__lIk4_",versionsEyebrow:"resume-builder_versionsEyebrow__rgTR4",versionsHeading:"resume-builder_versionsHeading__hMme4",versionsHint:"resume-builder_versionsHint__Scu9A",versionsSearch:"resume-builder_versionsSearch___8TNm",versionsSearchInput:"resume-builder_versionsSearchInput__m7f1u",versionsList:"resume-builder_versionsList__EMhJD",versionCard:"resume-builder_versionCard__El1Lw",versionCardActive:"resume-builder_versionCardActive__nclEk",versionCardMain:"resume-builder_versionCardMain__amuSi",versionName:"resume-builder_versionName__AoKMj",versionMeta:"resume-builder_versionMeta__IFnLn",versionDeleteBtn:"resume-builder_versionDeleteBtn__tUWK_",versionsEmpty:"resume-builder_versionsEmpty__8aWta",previewPane:"resume-builder_previewPane__TiPrJ",previewChrome:"resume-builder_previewChrome__TwIa4",previewActions:"resume-builder_previewActions__b7oNw",enhanceBtn:"resume-builder_enhanceBtn__gh1gG",previewExpandBtn:"resume-builder_previewExpandBtn__k9GdX",previewCanvas:"resume-builder_previewCanvas__a2JZv",appBarBtn:"resume-builder_appBarBtn__c_Z_M"}},91824:(e,t,a)=>{"use strict";a.r(t),a.d(t,{ResumeBuilderPage:()=>eq});var s=a(80711),i=a(78639),l=a(51454),n=a(70630),r=a(48222),o=a(36390),c=a(64042),d=a(85908),u=a(2892),m=a(43452),p=a(26988),h=a(22e3),y=a(98292),f=a(4740),g=a(19582),x=a(80917),b=a(58667),v=a(72863),j=a(76914),S=a.n(j);a(80702);var w=a(35668);let N=(e,t,a)=>{let s=Math.min(1,t/Math.max(e.width,e.height)),i=Math.max(1,Math.round(e.width*s)),l=Math.max(1,Math.round(e.height*s)),n=document.createElement("canvas");n.width=i,n.height=l;let r=n.getContext("2d");if(!r)throw Error("Could not process this image in your browser.");return r.drawImage(e,0,0,i,l),n.toDataURL("image/jpeg",a)};async function k(e){if(!e.type.startsWith("image/"))throw Error("Please choose a PNG or JPG image.");let t=await new Promise((t,a)=>{let s=URL.createObjectURL(e),i=new Image;i.onload=()=>{URL.revokeObjectURL(s),t(i)},i.onerror=()=>{URL.revokeObjectURL(s),a(Error("Could not read this image file."))},i.src=s}),a=.82,s=N(t,480,.82);for(;s.length>18e4&&a>.55;)a-=.07,s=N(t,480,a);if(s.length>18e4&&(s=N(t,360,.55)),s.length>18e4)throw Error("This image is too large. Try a smaller photo.");return s}var C=a(89382);let _=(e,t)=>
1String(e[t]??"").trim(),$=()=>({company:"",role:"",startDate:"",endDate:"",achievements:""}),E=()=>({school:"",degree:"",startDate:"",endDate:"",details:""}),T=()=>({name:""}),P=()=>({projectName:"",link:"",details:""}),A=()=>({name:"",issuer:"",date:"",details:""}),D=()=>({name:""}),I=e=>{let t=e.entries;if(Array.isArray(t)){let e=t.map(e=>{let t=e??{};return{company:String(t.company??""),role:String(t.role??""),startDate:String(t.startDate??""),endDate:String(t.endDate??""),achievements:String(t.achievements??"")}});if(e.length>0)return e}let a={company:_(e,"company"),role:_(e,"role"),startDate:_(e,"startDate"),endDate:_(e,"endDate"),achievements:_(e,"achievements")};return[a.company,a.role,a.startDate,a.endDate,a.achievements].some(Boolean)?[a]:[$()]},M=e=>{let t=e.entries;if(Array.isArray(t)){let e=t.map(e=>{let t=e??{};return{school:String(t.school??""),degree:String(t.degree??""),startDate:String(t.startDate??""),endDate:String(t.endDate??""),details:String(t.details??"")}});if(e.length>0)return e}let a={school:_(e,"school"),degree:_(e,"degree"),startDate:_(e,"startDate"),endDate:_(e,"endDate"),details:_(e,"details")};return[a.school,a.degree,a.startDate,a.endDate,a.details].some(Boolean)?[a]:[E()]},R=e=>{let t=e.entries;if(Array.isArray(t)){let e=t.map(e=>"string"==typeof e?{name:e.trim()}:{name:String((e??{}).name??"").trim()}).filter(e=>e.name);if(e.length>0)return e}let a=_(e,"list").split(",").map(e=>e.trim()).filter(Boolean).map(e=>({name:e}));return a.length>0?a:[T()]},B=e=>{let t=e.entries;if(Array.isArray(t)){let e=t.map(e=>{let t=e??{};return{projectName:String(t.projectName??""),link:String(t.link??""),details:String(t.details??"")}});if(e.length>0)return e}let a={projectName:_(e,"projectName"),link:_(e,"link"),details:_(e,"details")};return[a.projectName,a.link,a.details].some(Boolean)?[a]:[P()]},L=e=>{let t=e.entries;if(Array.isArray(t)){let e=t.map(e=>{let t=e??{};return{name:String(t.name??""),issuer:String(t.issuer??""),date:String(t.date??""),details:String(t.details??"")}});if(e.length>0)return e}let a={name:_(e,"name"),issuer:_(e,"issuer"),date:_(e,"date"),details:_(e,"details")};return[a.name,a.issuer,a.date,a.details].some(Boolean)?[a]:[A()]},F=e=>{let t=e.entries;if(Array.isArray(t)){let e=t.map(e=>"string"==typeof e?{name:e.trim()}:{name:String((e??{}).name??"").trim()}).filter(e=>e.name);if(e.length>0)return e}let a=_(e,"list").split(",").map(e=>e.trim()).filter(Boolean).map(e=>({name:e}));return a.length>0?a:[D()]},U=e=>e.map(e=>({school:String(e.institution_name||e.examining_board||"").trim(),degree:String(e.qualification_level||"").trim(),startDate:e.date_enrolled?S()(e.date_enrolled).format("MMM YYYY"):"",endDate:e.date_complete?S()(e.date_complete).format("MMM YYYY"):"",details:""})),Y=e=>e.map(e=>({company:String(e.company_name||"").trim(),role:String(e.job_title||"").trim(),startDate:e.start_date?S()(e.start_date).format("MMM YYYY"):"",endDate:e.end_date?S()(e.end_date).format("MMM YYYY"):"",achievements:(e=>{let t=[],a=e.hr_employement_history_responsibilties_json;if(null!=a&&String(a).trim())try{let e=JSON.parse(String(a));Array.isArray(e)?e.forEach(e=>{if("string"==typeof e&&e.trim())t.push(e.trim());else if(e&&"object"==typeof e){let a=String(e.responsibility??"").trim();a&&t.push(a)}}):"string"==typeof e&&e.trim()&&t.push(e.trim())}catch{let e=String(a).trim();e&&t.push(e)}let s=String(e.reason_for_leaving||"").trim();return s&&t.push(s),t.filter(Boolean).join("\n")})(e)})),H=e=>e.map(e=>({name:String(e.skill_type_title||e.skill_title||"").trim()})).filter(e=>e.name),V=e=>e.map(e=>({name:String(e.language||"").trim()})).filter(e=>e.name),O=e=>e.map(e=>({name:String(e.certification||"").trim(),issuer:String(e.issued_by||"").trim(),date:e.date_awarded?S()(e.date_awarded).format("MMM YYYY"):"",details:""})),W=e=>{let t=String(e?.name??"").trim();if(t)return t;let a=[e?.firstName,e?.lastName].map(e=>String(e??"").trim()).filter(Boolean).join(" ");return a||String(e?.email??"").split("@")[0]?.trim()||""},K=e=>e.trim().toLowerCase().replace(/\s+/g," "),z=e=>{if("header"===e.type){let t=e.data;
1return![t.fullName,t.email,t.phone,t.location,t.linkedin,t.jobTitle,t.photoUrl].some(e=>String(e||"").trim())}if("summary"===e.type)return!String(e.data.text||"").trim();if(["experience","education","skills","certifications","languages","projects"].includes(e.type))return!(e.data.entries??[]).some(e=>Object.values(e).some(e=>String(e||"").trim()));if("custom"===e.type){let t=e.data;return![t.heading,t.content].some(e=>String(e||"").trim())}return!0},J=(e,t,a)=>{let s=a.overwrite??!1,i=a.mergeOnlyEmpty??!1;return!!s||!!t&&(!i||z(e))},Z=(e,t)=>{switch(e){case"header":return"fulfilled"===t.header.status;case"summary":default:return!1;case"education":return"fulfilled"===t.education.status&&t.education.value.length>0;case"experience":return"fulfilled"===t.experience.status&&t.experience.value.length>0;case"skills":return"fulfilled"===t.skills.status&&H(t.skills.value).length>0;case"languages":return"fulfilled"===t.languages.status&&V(t.languages.value).length>0;case"certifications":return"fulfilled"===t.certifications.status&&t.certifications.value.length>0}},G=(e,t,a={})=>{let s,i,l,n,r=a.overwrite??!1;return a.fallbackName,(s=a.overwrite??!1,i=a.mergeOnlyEmpty??!1,l=[...e],n=e=>{(0,w.Uo)(l,e)||(l=(0,w.Ls)(l,(0,w.LU)(e)))},s?(w.Se.forEach(e=>{("header"===e||Z(e,t))&&n(e)}),l=l.filter(e=>{let a;return a=e.type,!w.Se.includes(a)||"header"===e.type||Z(e.type,t)})):(w.Se.forEach(e=>{if(Z(e,t))return void n(e);if(i&&(0,w.Uo)(l,e)){let t=l.find(t=>t.type===e);t&&z(t)&&n(e)}}),l)).map(e=>{if("header"===e.type&&"fulfilled"===t.header.status)return r||z(e)||a.mergeOnlyEmpty?((e,t,a)=>{let s=a.overwrite??!1,i=a.mergeOnlyEmpty??!1,l=a.fallbackName??"",n=t.fullName||l||"",r=[n,t.email,t.phone,t.location,t.linkedin,t.jobTitle,t.photoUrl];if(!s&&!i&&!r.some(e=>String(e||"").trim()))return e;if(i&&!s&&!z(e)){let a=e.data;return{...e,data:{...a,fullName:String(a.fullName??"").trim()||n,jobTitle:String(a.jobTitle??"").trim()||t.jobTitle||"",email:String(a.email??"").trim()||t.email||"",phone:String(a.phone??"").trim()||t.phone||"",location:String(a.location??"").trim()||t.location||"",linkedin:String(a.linkedin??"").trim()||t.linkedin||"",photoUrl:String(a.photoUrl??"").trim()||t.photoUrl||""}}}return{...e,data:{...e.data,fullName:n,jobTitle:t.jobTitle||"",email:t.email||"",phone:t.phone||"",location:t.location||"",linkedin:t.linkedin||"",photoUrl:t.photoUrl||""}}})(e,t.header.value,a):e;if("education"===e.type&&"fulfilled"===t.education.status){let s=t.education.value;return J(e,s.length>0,a)&&(r||s.length)?{...e,visible:!!s.length||e.visible,data:{entries:s.length?U(s):[E()]}}:e}if("experience"===e.type&&"fulfilled"===t.experience.status){let s=t.experience.value;return J(e,s.length>0,a)&&(r||s.length)?{...e,visible:!!s.length||e.visible,data:{entries:s.length?Y(s):[$()]}}:e}if("skills"===e.type&&"fulfilled"===t.skills.status){let s=H(t.skills.value);return J(e,s.length>0,a)&&(r||s.length)?{...e,visible:!!s.length||e.visible,data:{entries:s.length?s:[T()]}}:e}if("languages"===e.type&&"fulfilled"===t.languages.status){let s=V(t.languages.value);return J(e,s.length>0,a)&&(r||s.length)?{...e,visible:!!s.length||e.visible,data:{entries:s.length?s:[D()]}}:e}if("certifications"===e.type&&"fulfilled"===t.certifications.status){let s=t.certifications.value;return J(e,s.length>0,a)&&(r||s.length)?{...e,visible:!!s.length||e.visible,data:{entries:s.length?O(s):[A()]}}:e}return e})};var q=a(1098),Q=a(78177),X=a(55319);let ee=["skills","languages","certifications"],et=[{id:"harvard",label:"Harvard",category:"Professional",description:"Classic centered serif â finance, law, and consulting.",layout:"single",supportsPhoto:!1,photoShape:"circle",accent:"#1a1a1a",accentSoft:"#f7f7f7",sidebarSections:ee},{id:"geneva",label:"Geneva",category:"Professional",description:"Swiss minimalist with airy whitespace and light headings.",layout:"single",supportsPhoto:!1,photoShape:"circle",accent:"#4a5568",accentSoft:"#f9fafb",sidebarSections:ee},{id:"stanford",label:"Stanford",category:"Professional",description:"Teal accent underline with left-aligned modern sections.",layout:"single",supportsPhoto:!1,photoShape:"circle",accent:"#0d5c63",accentSoft:"#f0fdfa",sidebarSections:ee},{id:"chronicle",label:"Chronicle",category:"Professional",description:"Timeline layout with vertical career progression markers.",layout:"timeline",supportsPhoto:!1,photoShape:"circle",accent:"#4f46e5",accentSoft:"#eef2ff",sidebarSections:ee},{id:"prism",label:"Prism",category:"Creative",description:"Bold oversized typography with a colored left stripe.",layout:"single",supportsPhoto:!1,photoShape:"circle",accent:"#be185d",accentSoft:"#fdf2f8",sidebarSections:ee},{id:"corporate",label:"Corporate",category:"Executive",description:"Full-width navy header band with white typography.",layout:"header-band",supportsPhoto:!1,photoShape:"circle",accent:"#1e3a5f",accentSoft:"#e8eef5",sidebarSections:ee},{id:"executive",label:"Executive",category:"Executive",description:"Card-style boxed sections for senior leadership roles.",layout:"single",supportsPhoto:!1,photoShape:"circle",accent:"#1e3a8a",accentSoft:"#eff6ff",sidebarSections:ee},{id:"elegant",label:"Elegant",category:"Executive",description:"Serif typography with burgundy accents and framed border.",layout:"single",supportsPhoto:!1,photoShape:"circle",accent:"#7c2d12",accentSoft:"#fff7ed",sidebarSections:ee},{id:"solstice",label:"Solstice",category:"Creative",description:"Gradient header band with photo â vibrant and modern.",layout:"header-band",supportsPhoto:!0,photoShape:"circle",accent:"#6366f1",accentSoft:"#ede9fe",sidebarSections:ee},{id:"ats",label:"ATS Optimized",category:"ATS",description:"Plain single-column format for applicant tracking systems.",layout:"single",supportsPhoto:!1,photoShape:"circle",accent:"#111827",accentSoft:"#ffffff",sidebarSections:ee},{id:"milan",label:"Milan",category:"Professional",description:"Dark navy left sidebar with photo, contact, and skills.",layout:"sidebar-left",supportsPhoto:!0,photoShape:"circle",accent:"#1e3a5f",accentSoft:"#1e3a5f",sidebarSections:ee},{id:"ember",label:"Ember",category:"Creative",description:"Warm coral sidebar with photo â stands out for creative roles.",layout:"sidebar-left",supportsPhoto:!0,photoShape:"rounded",accent:"#c2410c",accentSoft:"#c2410c",sidebarSections:ee},{id:"tokyo",label:"Tokyo",category:"Professional",description:"Light gray sidebar with circular photo and clean sans-serif.",layout:"sidebar-left",supportsPhoto:!0,photoShape:"circle",accent:"#2d3748",accentSoft:"#f4f5f7",sidebarSections:ee},{id:"avenue",label:"Avenue",category:"Professional",description:"Full-height photo panel on the left â magazine-style layout.",layout:"photo-panel",supportsPhoto:!0,photoShape:"square",accent:"#0f766e",accentSoft:"#0f766e",sidebarSections:ee},{id:"monaco",label:"Monaco",category:"Executive",description:"Executive navy header band with profile photo on the right.",layout:"header-band",supportsPhoto:!0,photoShape:"rounded",accent:"#1e3a5f",accentSoft:"#e8eef5",sidebarSections:ee},{id:"vertex",label:"Vertex",category:"Creative",description:"Angled color block header with photo â dynamic first impression.",layout:"split-header",supportsPhoto:!0,photoShape:"rounded",accent:"#0891b2",accentSoft:"#ecfeff",sidebarSections:ee},{id:"london",label:"London",category:"Professional",description:"Clean split header with photo and underline accent.",layout:"split-header",supportsPhoto:!0,photoShape:"rounded",accent:"#334155",accentSoft:"#f1f5f9",sidebarSections:ee},{id:"sydney",label:"Sydney",category:"Professional",description:"Teal skills sidebar on the right with profile photo.",layout:"sidebar-right",supportsPhoto:!0,photoShape:"circle",accent:"#0d5c63",accentSoft:"#f0fdfa",sidebarSections:ee}],ea="harvard",es={classic:"harvard",modern:"stanford",minimal:"geneva",professional:"stanford",bold:"sydney",contemporary:"prism",studio:"milan",portrait:"avenue",creative:"ember",designer:"prism",vanguard:"solstice",signature:"monaco",premier:"monaco",spotlight:"vertex",horizon:"london",catalyst:"sydney"};function ei(e){let t=el(e);return et.find(e=>e.id===t)??et[0]}function el(e){if(!e)return ea;let t=et.find(t=>
1t.id===e);if(t)return t.id;let a=es[e];return a||ea}function en(e,t){let a=ei(t);return("sidebar-right"===a.layout||"sidebar-left"===a.layout||"photo-panel"===a.layout)&&a.sidebarSections.includes(e)}var er=a(25238);function eo({section:e,handlers:t,children:a,className:i}){let{attributes:l,listeners:n,setNodeRef:c,transform:d,transition:u,isDragging:m}=(0,r.gl)({id:e.id}),p=t.getSectionIndex(e.id),h=t.selectedSectionId===e.id,y=t.justEnhancedSectionId===e.id,f=(t.atsHighlightedSectionTypes??[]).includes(e.type),g=p>=0&&p<t.sectionCount-1,x={transform:er.Ks.Transform.toString(d),transition:u,opacity:m?.55:void 0,zIndex:m?60:h?40:void 0};return(0,s.jsxs)("div",{ref:c,id:`resume-section-${e.id}`,style:x,className:["resume-interactive-section",h?"resume-interactive-section--selected":"",y?"resume-interactive-section--just-enhanced":"",f?"resume-interactive-section--ats-highlight":"",!e.visible?"resume-interactive-section--hidden":"",i].filter(Boolean).join(" "),onClick:a=>{a.stopPropagation(),t.onSelect(e.id)},onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),t.onSelect(e.id))},role:"button",tabIndex:0,"aria-label":`${e.title} section`,"aria-pressed":h,children:[h?(0,s.jsxs)("div",{className:"resume-interactive-toolbar",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-bars",text:!0,className:"resume-interactive-toolbar-btn resume-interactive-toolbar-btn--drag","aria-label":"Drag to reorder",...l,...n}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-arrow-up",text:!0,className:"resume-interactive-toolbar-btn","aria-label":"Move section up",disabled:!(p>0),onClick:()=>t.onMove(e.id,"up")}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-arrow-down",text:!0,className:"resume-interactive-toolbar-btn","aria-label":"Move section down",disabled:!g,onClick:()=>t.onMove(e.id,"down")}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-pencil",text:!0,className:"resume-interactive-toolbar-btn","aria-label":"Edit section",onClick:()=>t.onEdit(e)}),(0,s.jsx)(o.$,{type:"button",icon:e.visible?"pi pi-eye":"pi pi-eye-slash",text:!0,className:"resume-interactive-toolbar-btn","aria-label":e.visible?"Hide section":"Show section",onClick:()=>t.onToggleVisible(e.id)}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-trash",text:!0,severity:"danger",className:"resume-interactive-toolbar-btn","aria-label":"Delete section",onClick:()=>t.onDelete(e.id)})]}):null,(0,s.jsx)("div",{className:"resume-interactive-content",children:a})]})}function ec({icon:e}){return(0,s.jsx)("i",{className:`pi ${e} resume-contact-icon-glyph`,"aria-hidden":!0})}function ed({photoUrl:e,shape:t,className:a}){return e?(0,s.jsx)("img",{src:e,alt:"Profile",className:`resume-photo resume-photo--${t} ${a??""}`,crossOrigin:"anonymous"}):(0,s.jsx)("div",{className:`resume-photo resume-photo--${t} resume-photo--placeholder ${a??""}`,children:(0,s.jsx)("span",{children:"Photo"})})}function eu(e,t,a){return a?(0,s.jsx)(eo,{section:e,handlers:a,children:t},e.id):(0,s.jsx)(i.Fragment,{children:t},e.id)}function em(e,t){return t||e.visible}function ep({section:e,definition:t,variant:a="default",showPhoto:i,handlers:l}){let n=e.data,r=_(n,"fullName"),o=_(n,"jobTitle"),c=[{key:"email",label:_(n,"email"),icon:"pi-envelope"},{key:"phone",label:_(n,"phone"),icon:"pi-phone"},{key:"location",label:_(n,"location"),icon:"pi-map-marker"},{key:"linkedin",label:_(n,"linkedin"),icon:"pi-linkedin"}].filter(e=>e.label),d=_(n,"photoUrl"),u=(i??t.supportsPhoto)&&t.supportsPhoto,m=(0,s.jsxs)("div",{className:"resume-header-content",children:[r?(0,s.jsx)("h1",{children:r}):null,o?(0,s.jsx)("p",{className:"resume-header-title",children:o}):null,c.length>0?(0,s.jsx)("ul",{className:"resume-contact-list",children:c.map(e=>(0,s.jsxs)("li",{children:[(0,s.jsx)("span",{className:"resume-contact-icon","aria-hidden":!0,children:(0,s.jsx)(ec,{icon:e.icon})}),e.label]},e.key))}):null]}),p=u?(0,s.jsx)(ed,{photoUrl:d,shape:t.photoShape,className:"resume-header-photo"}):null;return eu(e,(0,s.jsx)("header",{className:`resume-header resume-header--${t.id} resume-header--${a}`,"data-photo":u?"true":"false",children:"band"===a?(0,s.jsxs)(s.Fragment,{children:[m,p]}):(0,s.jsxs)(s.Fragment,{children:[p,m]})}),l)}function eh(e,t,a){if("header"===e.type||!em(e,!!a))return null;let i=e.data,l=e.title||e.type.charAt(0).toUpperCase()+e.type.slice(1),n=`resume-section resume-section--${t} resume-section-type-${e.type}`,r=null,o=!!a;if("summary"===e.type){let e=_(i,"text");if(!e&&!o)return null;r=(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),(0,s.jsx)("p",{className:"resume-summary-text",children:e||(o?(0,s.jsx)("span",{style:{opacity:.5},children:"Write a concise summary highlighting your value and impact."}):null)})]})}else if("experience"===e.type){let t=I(i).filter(e=>e.company||e.role||e.startDate||e.endDate||e.achievements);if(!t.length&&!o)return null;let a=!t.length&&o,c=t.length?t:a?[{company:"",role:"",startDate:"",endDate:"",achievements:""}]:[];r=(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),c.map((t,i)=>
1{let l=[t.startDate,t.endDate].filter(Boolean).join(" - ");return(0,s.jsxs)("div",{className:i>0?"resume-subsection":void 0,children:[(0,s.jsxs)("div",{className:"resume-row",children:[(0,s.jsxs)("div",{children:[(t.role||a)&&(0,s.jsx)("h4",{children:t.role||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Job Title"}):null)}),(t.company||a)&&(0,s.jsx)("p",{className:"resume-meta",children:t.company||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Company Name"}):null)})]}),(l||a)&&(0,s.jsx)("span",{className:"resume-meta",children:l||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Start - End"}):null)})]}),(t.achievements||a)&&(t.achievements?String(t.achievements).split(/\n+/).map(e=>e.trim()).filter(Boolean).map((t,a)=>(0,s.jsx)("p",{className:"resume-body-text",children:t},`${e.id}-experience-${i}-b${a}`)):(0,s.jsx)("p",{className:"resume-body-text",children:a?(0,s.jsx)("span",{style:{opacity:.5},children:"Add 2-4 achievement-focused bullet points."}):null}))]},`${e.id}-experience-${i}`)})]})}else if("education"===e.type){let t=M(i).filter(e=>e.school||e.degree||e.startDate||e.endDate||e.details);if(!t.length&&!o)return null;let a=!t.length&&o,c=t.length?t:a?[{school:"",degree:"",startDate:"",endDate:"",details:""}]:[];r=(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),c.map((t,i)=>{let l=[t.startDate,t.endDate].filter(Boolean).join(" - ");return(0,s.jsxs)("div",{className:i>0?"resume-subsection":void 0,children:[(0,s.jsxs)("div",{className:"resume-row",children:[(0,s.jsxs)("div",{children:[(t.degree||a)&&(0,s.jsx)("h4",{children:t.degree||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Degree / Qualification"}):null)}),(t.school||a)&&(0,s.jsx)("p",{className:"resume-meta",children:t.school||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Institution Name"}):null)})]}),(l||a)&&(0,s.jsx)("span",{className:"resume-meta",children:l||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Start - End"}):null)})]}),(t.details||a)&&(0,s.jsx)("p",{className:"resume-body-text",children:t.details||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Include honors, key modules, or project work."}):null)})]},`${e.id}-education-${i}`)})]})}else if("skills"===e.type){let e=R(i).map(e=>e.name).filter(Boolean);if(!e.length&&!o)return null;r="ats"===t?(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),e.length?(0,s.jsx)("p",{className:"resume-body-text",children:e.join(", ")}):o&&(0,s.jsx)("p",{className:"resume-body-text",style:{opacity:.5},children:"Add skills"})]}):(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),e.length?(0,s.jsx)("div",{className:"resume-chip-list",children:e.map((e,t)=>(0,s.jsx)("span",{className:"resume-chip",children:e},`${e}-${t}`))}):o&&(0,s.jsx)("p",{className:"resume-body-text",style:{opacity:.5},children:"Add skills"})]})}else if("languages"===e.type){let e=F(i).map(e=>e.name).filter(Boolean);if(!e.length&&!o)return null;r="ats"===t?(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),e.length?(0,s.jsx)("p",{className:"resume-body-text",children:e.join(", ")}):o&&(0,s.jsx)("p",{className:"resume-body-text",style:{opacity:.5},children:"Add languages"})]}):(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),e.length?(0,s.jsx)("div",{className:"resume-chip-list",children:e.map((e,t)=>(0,s.jsx)("span",{className:"resume-chip",children:e},`${e}-${t}`))}):o&&(0,s.jsx)("p",{className:"resume-body-text",style:{opacity:.5},children:"Add languages"})]})}else if("projects"===e.type){let t=B(i).filter(e=>e.projectName||e.link||e.details);if(!t.length&&!o)return null;let a=!t.length&&o,c=t.length?t:a?[{projectName:"",link:"",details:""}]:[];r=(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),c.map((t,i)=>(0,s.jsxs)("div",{className:i>0?"resume-subsection":void 0,children:[(t.projectName||a)&&(0,s.jsx)("h4",{children:t.projectName||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Project Name"}):null)}),(t.link||a)&&(0,s.jsx)("p",{className:"resume-meta",children:t.link||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"https://project-link.example"}):null)}),(t.details||a)&&(0,s.jsx)("p",{className:"resume-body-text",children:t.details||(a?(0,s.jsx)("span",{style:{opacity:.5}
1,children:"Summarize the problem, solution, and your impact."}):null)})]},`${e.id}-project-${i}`))]})}else if("certifications"===e.type){let t=L(i).filter(e=>e.name||e.issuer||e.date||e.details);if(!t.length&&!o)return null;let a=!t.length&&o,c=t.length?t:a?[{name:"",issuer:"",date:"",details:""}]:[];r=(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:l}),c.map((t,i)=>(0,s.jsxs)("div",{className:i>0?"resume-subsection":void 0,children:[(0,s.jsxs)("div",{className:"resume-row",children:[(0,s.jsxs)("div",{children:[(t.name||a)&&(0,s.jsx)("h4",{children:t.name||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Certification Name"}):null)}),(t.issuer||a)&&(0,s.jsx)("p",{className:"resume-meta",children:t.issuer||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Issuer"}):null)})]}),(t.date||a)&&(0,s.jsx)("span",{className:"resume-meta",children:t.date||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Date"}):null)})]}),(t.details||a)&&(0,s.jsx)("p",{className:"resume-body-text",children:t.details||(a?(0,s.jsx)("span",{style:{opacity:.5},children:"Add credential details or ID if relevant."}):null)})]},`${e.id}-certification-${i}`))]})}else{let e=_(i,"heading"),t=_(i,"content");if(!e&&!t&&!o)return null;r=(0,s.jsxs)("section",{className:n,children:[(0,s.jsx)("h3",{children:e||(o&&!t?(0,s.jsx)("span",{style:{opacity:.5},children:l}):l)}),(t||o)&&(0,s.jsx)("p",{children:t||(o?(0,s.jsx)("span",{style:{opacity:.5},children:"Add custom content for this section."}):null)})]})}return eu(e,r,a)}function ey({children:e,interactive:t}){let{setNodeRef:a,isOver:i}=(0,n.zM)({id:"resume-preview-dropzone",disabled:!t});return t?(0,s.jsx)("div",{ref:a,className:i?"resume-preview-dropzone resume-preview-dropzone--active":"resume-preview-dropzone",children:e}):(0,s.jsx)(s.Fragment,{children:e})}function ef({sections:e,template:t,id:a,className:i,style:l,interactiveHandlers:n}){let r=ei(t),o=!!n,c=["resume-paper",o?"resume-paper--interactive":"",`resume-paper--${t}`,`resume-paper--layout-${r.layout}`,i].filter(Boolean).join(" ");return(0,s.jsx)(ey,{interactive:o,children:(0,s.jsx)("div",{id:a,className:c,style:{"--resume-accent":r.accent,"--resume-accent-soft":r.accentSoft,...l},onClick:o?e=>{e.target===e.currentTarget&&n?.onSelect(null)}:void 0,children:function(e,t,a){let i=ei(t),l=!!a,n=e.find(e=>"header"===e.type),r=l?e:e.filter(e=>e.visible),o=(e,t,n)=>em(e,l)?(0,s.jsx)(ep,{section:e,definition:i,variant:t,showPhoto:n,handlers:a},e.id):null;if("sidebar-right"===i.layout){let e=n?o(n,"default",!i.supportsPhoto):null;return(0,s.jsxs)(s.Fragment,{children:[e,(0,s.jsx)("div",{className:"resume-layout-main",children:r.filter(e=>"header"!==e.type&&!en(e.type,t)).map(e=>eh(e,t,a))}),(0,s.jsxs)("aside",{className:"resume-layout-sidebar resume-layout-sidebar--right",children:[i.supportsPhoto&&n&&em(n,l)?(0,s.jsx)(ed,{photoUrl:_(n.data,"photoUrl"),shape:i.photoShape,className:"resume-sidebar-photo"}):null,r.filter(e=>en(e.type,t)).map(e=>eh(e,t,a))]})]})}if("sidebar-left"===i.layout||"photo-panel"===i.layout){let e="photo-panel"===i.layout?"resume-layout-photo-panel":"resume-layout-sidebar resume-layout-sidebar--left";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("aside",{className:e,children:[n?o(n,"sidebar"):null,r.filter(e=>en(e.type,t)).map(e=>eh(e,t,a))]}),(0,s.jsx)("div",{className:"resume-layout-main",children:r.filter(e=>"header"!==e.type&&!en(e.type,t)).map(e=>eh(e,t,a))})]})}return"header-band"===i.layout?(0,s.jsxs)(s.Fragment,{children:[n?o(n,"band"):null,(0,s.jsx)("div",{className:"resume-layout-main resume-layout-main--full",children:r.filter(e=>"header"!==e.type).map(e=>eh(e,t,a))})]}):"split-header"===i.layout?(0,s.jsxs)(s.Fragment,{children:[n?o(n,"split"):null,(0,s.jsx)("div",{className:"resume-layout-main resume-layout-main--full",children:r.filter(e=>"header"!==e.type).map(e=>eh(e,t,a))})]}):"timeline"===i.layout?(0,s.jsx)("div",{className:"resume-layout-timeline",children:r.map(e=>"header"===e.type?o(e,"default"):eh(e,t,a))}):(0,s.jsx)(s.Fragment,{children:r.map(e=>"header"===e.type?o(e,"default"):eh(e,t,a))})}
1(e,t,n)})})}function eg({visible:e,proposal:t,onCancel:a,onApply:i}){return(0,s.jsx)(m.l,{header:"Review enhanced content",visible:e,onHide:a,style:{width:"40rem",maxWidth:"95vw"},baseZIndex:1400,appendTo:"undefined"!=typeof document?document.body:void 0,dismissableMask:!0,className:"resume-enhance-confirm-dialog",footer:(0,s.jsxs)("div",{className:"resume-enhance-confirm-footer",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Don't apply",onClick:a}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-check",label:"Apply changes",onClick:i})]}),children:t?(0,s.jsxs)("div",{className:"resume-enhance-confirm",children:[(0,s.jsx)("p",{className:"resume-enhance-confirm-copy",children:"The following content will be used to enhance this section. Would you like to apply the changes?"}),(0,s.jsxs)("p",{className:"resume-enhance-confirm-meta",children:[(0,s.jsx)("strong",{children:t.sectionLabel}),(0,s.jsxs)("span",{children:[" \xb7 ",t.fieldLabel]})]}),(0,s.jsxs)("div",{className:"resume-enhance-confirm-block",children:[(0,s.jsx)("span",{className:"resume-enhance-confirm-label",children:"Current"}),(0,s.jsx)("div",{className:"resume-enhance-confirm-text",children:t.currentContent})]}),(0,s.jsxs)("div",{className:"resume-enhance-confirm-block resume-enhance-confirm-block--proposed",children:[(0,s.jsx)("span",{className:"resume-enhance-confirm-label",children:"Proposed"}),(0,s.jsx)("div",{className:"resume-enhance-confirm-text",children:t.proposedContent})]})]}):null})}var ex=a(89500);let eb=[{id:"preview-header",type:"header",title:"Header",visible:!0,data:{fullName:"Alex Morgan",jobTitle:"Senior Product Manager",email:"[email protected]",phone:"+44 7700 900123",location:"London, UK",linkedin:"linkedin.com/in/alexmorgan",photoUrl:""}},{id:"preview-summary",type:"summary",title:"Summary",visible:!0,data:{text:"Results-driven product leader with 8+ years building B2B SaaS platforms. Proven track record of scaling teams and delivering measurable revenue growth."}},{id:"preview-experience",type:"experience",title:"Experience",visible:!0,data:{entries:[{role:"Senior Product Manager",company:"Northline Software",startDate:"2021",endDate:"Present",achievements:"Led a cross-functional team of 12. Increased activation by 34% and reduced churn by 18%."},{role:"Product Manager",company:"Beacon Analytics",startDate:"2018",endDate:"2021",achievements:"Shipped enterprise reporting suite adopted by 200+ clients."}]}},{id:"preview-skills",type:"skills",title:"Skills",visible:!0,data:{entries:[{name:"Product Strategy"},{name:"Roadmapping"},{name:"Agile"},{name:"SQL"}]}},{id:"preview-languages",type:"languages",title:"Languages",visible:!0,data:{entries:[{name:"English"},{name:"French"}]}}];function ev({template:e}){let t=(0,i.useRef)(null),[a,l]=(0,i.useState)({scale:.35,paperMinHeight:900});return(0,i.useLayoutEffect)(()=>{let e=t.current;if(!e)return;let a=()=>{let t=e.clientWidth,a=e.clientHeight;if(t<=0||a<=0)return;let s=t/680;l({scale:s,paperMinHeight:a/s})};a();let s=new ResizeObserver(a);return s.observe(e),()=>s.disconnect()},[e]),(0,s.jsx)("div",{ref:t,className:"resume-template-thumb-frame","aria-hidden":!0,children:(0,s.jsx)("div",{className:"resume-template-thumb-scaler",style:{width:680,transform:`scale(${a.scale})`},children:(0,s.jsx)(ef,{template:e,sections:eb,className:"resume-paper--thumbnail",style:{minHeight:a.paperMinHeight}})})})}let ej=["Professional","Executive","Creative","ATS"];function eS({visible:e,value:t,onHide:a,onSelect:l,allowedTemplates:n,lockedMessage:r="Sign in to unlock this template.",onLockedSelect:o}){let[c,u]=(0,i.useState)(""),[p,h]=(0,i.useState)("All"),y=(0,i.useMemo)(()=>n?.length?new Set(n):null,[n]),f=(0,i.useMemo)(()=>{let e=c.trim().toLowerCase();return et.filter(t=>("All"===p||t.category===p)&&(!e||t.label.toLowerCase().includes(e)||t.description.toLowerCase().includes(e)))},[p,c]);return(0,s.jsxs)(m.l,{header:"Choose a resume template",visible:e,onHide:a,style:{width:"min(1120px, 96vw)"},contentStyle:{padding:"0.75rem 1rem 1rem",overflow:"hidden"},className:"resume-template-picker-dialog",children:[(0,s.jsx)("p",{className:"resume-template-picker-intro",children:"Pick from 18 distinct professional designs. Templates with a photo icon support a profile picture."}),(0,s.jsxs)("div",{className:"resume-template-picker-toolbar",children:[(0,s.jsx)(d.S,{value:c,onChange:e=>u(e.target.value),placeholder:"Search templates...",className:"resume-template-picker-search"}),(0,s.jsx)("div",{className:"resume-template-picker-filters",children:["All",...ej].map(e=>(0,s.jsx)("button",{type:"button",className:`resume-template-filter ${p===e?"resume-template-filter--active":""}`,onClick:()=>h(e),children:e},e))})]}),(0,s.jsx)("div",{className:"resume-template-grid",children:f.map(e=>{let i=!!(y&&!y.has(e.id));return(0,s.jsxs)("button",{type:"button",className:`resume-template-card ${t===e.id?"resume-template-card--active":""}${i?" resume-template-card--locked":""}`,onClick:()=>{i?o?.(e.id):(l(e.id),a())},children:[(0,s.jsx)(ev,{template:e.id}),(0,s.jsxs)("div",{className:"resume-template-card-body",children:[(0,s.jsxs)("div",{className:"resume-template-card-title-row",children:[(0,s.jsx)("strong",{children:e.label}),e.supportsPhoto?(0,s.jsx)("span",{className:"resume-template-photo-badge",title:"Supports profile photo",children:(0,s.jsx)("i",{className:"pi pi-image"})}):null]}),(0,s.jsx)("span",{className:"resume-template-card-category",children:e.category}),(0,s.jsx)("p",{children:e.description})]}),i?(0,s.jsxs)("div",{className:"resume-template-lock-overlay","aria-hidden":!0,
1children:[(0,s.jsx)("i",{className:"pi pi-lock"}),(0,s.jsx)("span",{children:r})]}):null]},e.id)})})]})}var ew=a(88313),eN=a(6887);let ek=async e=>{let t=Array.from(e.querySelectorAll("img"));await Promise.all(t.map(e=>new Promise(t=>{e.complete?t():(e.onload=()=>t(),e.onerror=()=>t())})))},eC=["resume-interactive-section--ats-highlight","resume-interactive-section--selected","resume-interactive-section--just-enhanced"],e_=e=>!(e instanceof HTMLElement)||!(e.classList.contains("resume-interactive-toolbar")||e.classList.contains("resume-ats-bar")),e$=async e=>{let t,a,s=document.getElementById(e);if(!s)throw Error("Resume preview not found.");let i=document.createElement("div");i.setAttribute("aria-hidden","true"),i.style.cssText="position:fixed;left:-10000px;top:0;width:auto;height:auto;opacity:1;pointer-events:none;z-index:-1;";let l=s.cloneNode(!0);l.removeAttribute("id"),l.classList.add("resume-pdf-capture"),l.style.margin="0",l.style.transform="none",l.style.boxShadow="none",l.style.borderRadius="0",l.style.outline="none",l.style.width=`${s.offsetWidth}px`,l.style.maxWidth=`${s.offsetWidth}px`,l.style.minHeight="auto",t=getComputedStyle(s).getPropertyValue("--resume-accent"),a=getComputedStyle(s).getPropertyValue("--resume-accent-soft"),t&&l.style.setProperty("--resume-accent",t),a&&l.style.setProperty("--resume-accent-soft",a),l.querySelectorAll(".resume-interactive-toolbar").forEach(e=>e.remove()),l.querySelectorAll(".resume-interactive-section").forEach(e=>{e.style.transform="none",e.style.transition="none",e.style.opacity="1",e.style.zIndex="auto",e.style.outline="none",e.style.boxShadow="none",e.style.background="transparent",e.style.margin="0",eC.forEach(t=>e.classList.remove(t))}),i.appendChild(l),document.body.appendChild(i),s.classList.add("resume-pdf-capture");try{await ek(l),await new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))});let e=Math.max(l.offsetWidth,1),t=Math.max(l.scrollHeight,l.offsetHeight,1),a=await (0,ew.$E)(l,{backgroundColor:"#ffffff",cacheBust:!0,filter:e_,pixelRatio:2,quality:1,width:e,height:t,style:{transform:"none",margin:"0",left:"0",top:"0"}}),s=new Image;s.src=a,await new Promise((e,t)=>{s.onload=()=>e(),s.onerror=()=>t(Error("Could not render the resume preview for PDF export."))});let i=new eN.uE("p","pt","a4"),n=i.internal.pageSize.getWidth(),r=i.internal.pageSize.getHeight(),o=s.height*n/s.width,c=o,d=0;for(i.addImage(a,"PNG",0,d,n,o),c-=r;c>0;)d=c-o,i.addPage(),i.addImage(a,"PNG",0,d,n,o),c-=r;return i}finally{i.remove(),s.classList.remove("resume-pdf-capture")}};async function eE(e,t){(await e$(e)).save(t.endsWith(".pdf")?t:`${t}.pdf`)}async function eT(e){return(await e$(e)).output("blob")}var eP=a(93976);a(52421);var eA=a(79277),eD=a.n(eA);a(55147);let eI="resume_builder_pending_export",eM="/identity/resume-builder",eR={position:"bottom",className:"resume-builder-tooltip",showDelay:280},eB=e=>{let t=e.find(e=>"summary"===e.type);return String(t?.data?.text||"").trim()},eL=e=>{let t=e.find(e=>"custom"===e.type);return String(t?.data?.content||"").trim()},eF=e=>{let t=e.find(e=>"experience"===e.type);return t?I(t.data):[]},eU=e=>{let t=e.find(e=>"education"===e.type);return t?M(t.data):[]},eY=e=>{let t=e.find(e=>"header"===e.type);return String(t?.data?.jobTitle||"").trim()},eH=e=>{let t=e.find(e=>"skills"===e.type);return t?R(t.data).map(e=>e.name).filter(Boolean):[]},eV=e=>{let t=e.find(e=>"header"===e.type)?.data,a=e.find(e=>"projects"===e.type),s=e.find(e=>"certifications"===e.type),i=e.find(e=>"languages"===e.type);return(0,q.Ey)({fullName:String(t?.fullName||"").trim(),jobTitle:String(t?.jobTitle||"").trim(),location:String(t?.location||"").trim(),experience:eF(e),education:eU(e),skills:eH(e),projects:a?B(a.data).map(e=>({projectName:e.projectName,details:e.details})):[],certifications:s?L(s.data).map(e=>({name:e.name,issuer:e.issuer,details:e.details})):[],languages:i?F(i.data).map(e=>e.name).filter(Boolean):[],custom:eL(e)})},eO=e=>e.map(e=>({company:e.company,role:e.role,startDate:e.startDate,endDate:e.endDate,achievements:(0,q.pJ)(e.achievements)})),eW=async e=>{let{items:t,sections:a,userId:s}
1=e,i=eB(a),l=eV(a),n=eF(a),r=eU(a),o=n.filter(e=>(0,q.pJ)(e.achievements)),c=r.filter(e=>String(e.details||"").trim()),d="",u=null,m=null,p=null,h=e=>{(0,C.Cj)(e)&&(p=e)},y=[];t.some(e=>"summary"===e.sectionType&&!(0,q.vk)(e))&&(i||l)&&y.push((0,C.mM)(i,s,i?void 0:l).then(e=>{d=String(e||"").trim()}).catch(h)),t.some(e=>"experience"===e.sectionType&&!(0,q.lR)(e)&&!(0,q.vk)(e))&&o.length&&y.push((0,C.Nd)(o,s).then(e=>{u=eO(e)}).catch(h)),t.some(e=>"education"===e.sectionType&&!(0,q.vk)(e))&&c.length&&y.push((0,C.Xo)(c,s).then(e=>{m=Array.isArray(e)?e:null}).catch(h)),y.length&&await Promise.all(y);let f=eH(a),g=eY(a),x=(await Promise.all(t.map(async e=>{if("custom"!==e.sectionType)return e;let t=(0,q.vk)(e);if(!(!t||(0,q.FZ)(t)))return e;let a=(0,q.wG)({issue:e.issue,suggestion:e.suggestion,jobTitle:g,skills:f});return a.content?{...e,suggestedContent:a.content,customHeading:a.heading||e.customHeading}:e}))).map(e=>{if("summary"===e.sectionType&&!(0,q.vk)(e)&&d)return{...e,suggestedContent:d};if("experience"===e.sectionType&&(0,q.lR)(e)&&!(0,q.vk)(e)){let t=(0,q.jv)({entries:n,summary:i,jobTitle:g,skills:f}),a=(0,q.sv)(t);return a?{...e,experienceDrafts:t,suggestedContent:a,suggestion:"Apply updates unclear job titles from your resume context. Achievements stay unchanged."}:e}if("experience"===e.sectionType&&!(0,q.lR)(e)&&!(0,q.vk)(e)&&u?.some(e=>e.achievements.trim()))return{...e,experienceDrafts:u};if("education"===e.sectionType&&!(0,q.vk)(e)&&m?.length){let t=m.map(e=>String(e.details||"").trim()).filter(Boolean).join("\n");return t?{...e,suggestedContent:t}:e}if("skills"===e.sectionType&&!(0,q.vk)(e)){let t=n.map(e=>`${e.role} ${e.company} ${e.achievements}`).join(" "),a=(0,q.iP)({jobTitle:g,summary:i,suggestion:e.suggestion,existingSkills:f,experienceText:t});if(a.length)return{...e,keywords:a,suggestedContent:a.join(", "),suggestion:`Add these skills to your Skills section: ${a.join(", ")}.`}}return e});if(p&&!d&&!u&&!m)throw p;return x},eK=(e,t)=>{(t?.pendingExport&&window.localStorage.setItem(eI,"1"),"signin"===e)?window.location.assign(`/oauth?callbackUrl=${encodeURIComponent(eM)}`):window.location.assign(`/signup?redirectUrl=${encodeURIComponent(eM)}`)},ez={header:[{key:"fullName",label:"Full name"},{key:"jobTitle",label:"Professional title"},{key:"email",label:"Email"},{key:"phone",label:"Phone"},{key:"location",label:"Location"},{key:"linkedin",label:"LinkedIn"}],summary:[{key:"text",label:"Professional summary",multiline:!0}],education:[{key:"school",label:"School"},{key:"degree",label:"Degree"},{key:"startDate",label:"Start date"},{key:"endDate",label:"End date"},{key:"details",label:"Details",multiline:!0}],experience:[{key:"company",label:"Company"},{key:"role",label:"Role"},{key:"startDate",label:"Start date"},{key:"endDate",label:"End date"},{key:"achievements",label:"Achievements",multiline:!0}],skills:[{key:"list",label:"Skills (comma-separated)",multiline:!0}],projects:[{key:"projectName",label:"Project name"},{key:"link",label:"Project link"},{key:"details",label:"Details",multiline:!0}],certifications:[{key:"name",label:"Certification name"},{key:"issuer",label:"Issuer"},{key:"date",label:"Date"},{key:"details",label:"Details",multiline:!0}],languages:[{key:"list",label:"Languages",multiline:!0}],custom:[{key:"heading",label:"Heading"},{key:"content",label:"Content",multiline:!0}]},eJ=({type:e,label:t,onClick:a,disabled:i=!1})=>{let{attributes:l,listeners:r,setNodeRef:c,transform:d,isDragging:u}=(0,n.PM)({id:`library-${e}`,data:{source:"library",sectionType:e},disabled:i}),m={transform:d?`translate3d(${d.x}px, ${d.y}px, 0)`:void 0,opacity:u?.6:i?.65:1,cursor:i?"not-allowed":"grab"};return(0,s.jsx)("div",{ref:c,style:m,className:`resume-library-item${i?" resume-library-item--disabled":""}`,...i?{}:{...r,...l},children:(0,s.jsx)(o.$,{type:"button",text:!0,disabled:i,className:"w-full resume-library-item-btn resume-library-item-btn-row",icon:`pi ${i?"pi-check":"pi-plus"}`,iconPos:"right",label:t,tooltip:i?"Already added":`Add ${t}`,tooltipOptions:eR,onClick:i?void 0:a})})},eZ=e=>{let t=e.trim();if(!t)return null;let a=S()(t,["MMM YYYY","MMMM YYYY","YYYY-MM","MM/YYYY","DD/MM/YYYY","YYYY"],!0);if(a.isValid())return a.toDate();let s=S()(t);return s.isValid()?s.toDate():null},eG=e=>{let t=Array.isArray(e)?e[0]:e;return t?S()(t).format("MMM YYYY"):""},eq=({isPublicMode:e=!1})=>{let t=(0,n.FR)((0,n.MS)(n.AN,{activationConstraint:{distance:8}})),{data:c,status:j}=(0,g.wV)(),S=(0,x.useSearchParams)(),N=S.get("resumeId")||"",k="resume"===S.get("from"),_=(0,b.v)(),$=c?.user?.id||c?.user?.user_id||c?.user?.sub||"",E=W(c?.user),T=String(c?.user?.email||"").trim(),P=(0,i.useRef)(E),A=(0,i.useRef)(T);P.current=E,A.current=T;let{remaining:D,total:B,hasFreeUses:L,needsSubscription:F}=(0,v.C)($,"resume_builder_action"),U=(0,i.useMemo)(()=>et.slice(0,2).map(e=>e.id),[]),Y=e&&!$,[H,V]=(0,i.useState)("export"),[O,z]=(0,i.useState)(void 0),[J,Z]=(0,i.useState)("My Resume"),[ee,ea]=(0,i.useState)("harvard"),[es,en]=(0,i.useState)((0,w.$b)()),[er,eo]=(0,i.useState)(null),[ec,ed]=(0,i.useState)(!0),[eu,em]=(0,i.useState)(!1),[ep,eh]=(0,i.useState)(null),[ey,eg]=(0,i.useState)(!1),[eb,ev]=(0,i.useState)(!1),[ej,ew]=(0,i.useState)(!1),[eN,ek]=(0,i.useState)(!1),[eC,e_]=(0,i.useState)(null),e$=(0,i.useRef)(null),[eA,eM]=(0,i.useState)(""),[ez,eZ
1]=(0,i.useState)(""),[eG,eq]=(0,i.useState)(""),[eQ,e0]=(0,i.useState)(""),[e1,e2]=(0,i.useState)(""),[e3,e5]=(0,i.useState)(!1),[e4,e8]=(0,i.useState)(null),[e6,e7]=(0,i.useState)(null),e9=(0,i.useRef)(null),[te,tt]=(0,i.useState)([]),[ta,ts]=(0,i.useState)([]),[ti,tl]=(0,i.useState)(!1),[tn,tr]=(0,i.useState)(!1),[to,tc]=(0,i.useState)(null),[td,tu]=(0,i.useState)(null),[tm,tp]=(0,i.useState)(0),[th,ty]=(0,i.useState)(0),[tf,tg]=(0,i.useState)(null),[tx,tb]=(0,i.useState)(null),[tv,tj]=(0,i.useState)(!1),[tS,tw]=(0,i.useState)(null),tN=(0,i.useRef)(!1),tk=(0,i.useRef)(!1),tC=(0,i.useRef)(!1),t_=(0,i.useRef)(!1),[t$,tE]=(0,i.useState)(!1),[tT,tP]=(0,i.useState)(""),[tA,tD]=(0,i.useState)(!1),[tI,tM]=(0,i.useState)(!1),[tR,tB]=(0,i.useState)(!1),[tL,tF]=(0,i.useState)(null),[tU,tY]=(0,i.useState)(""),[tH,tV]=(0,i.useState)(!1),[tO,tW]=(0,i.useState)(!1),[tK,tz]=(0,i.useState)(!1),[tJ,tZ]=(0,i.useState)(""),[tG,tq]=(0,i.useState)(!1),[tQ,tX]=(0,i.useState)([]),[t0,t1]=(0,i.useState)(null),[t2,t3]=(0,i.useState)(""),t5=(0,i.useRef)(!1),t4=(0,i.useRef)(!1),t8=(0,i.useRef)(null),t6=(0,i.useRef)({title:"My Resume",template:"harvard",sections:(0,w.$b)()}),t7=(0,i.useRef)(0),t9=(0,i.useRef)(""),ae=(0,i.useRef)(""),at=(0,i.useRef)(""),aa=(0,i.useRef)(!1),as=(0,i.useRef)(!1),ai=(0,i.useRef)(null);ae.current=tT;let al=e=>{let t=String(e||"").trim();t&&t!==ae.current&&(ae.current=t,tP(t),(0,C.vo)(t,$||void 0))},an=(0,i.useMemo)(()=>es.map(e=>e.id),[es]),ar={id:O,session_id:tT,user_id:$||void 0,title:J,template:ee,sections:es,status:"draft"};t6.current={title:J,template:ee,sections:es};let ao=$?(0,X.bx)($):"",ac=()=>{t7.current+=1},ad=e=>e.title.trim()?e.sections.length?"":"Add at least one section.":"Resume title is required.";(0,i.useEffect)(()=>{let e=(0,eP.Yx)();e.fromResume&&e.resumeId&&(t5.current=!0)},[]),(0,i.useEffect)(()=>{if("loading"===j)return;let e=!0;return(async()=>{try{let t=await (0,C.XD)($||void 0);if(!e)return;tP(t)}catch{if(!e)return;eZ("Could not initialize resume session."),ed(!1)}})(),()=>{e=!1}},[j,$]),(0,i.useEffect)(()=>()=>{e9.current&&clearTimeout(e9.current)},[]),(0,i.useEffect)(()=>{$&&"1"===window.localStorage.getItem(eI)&&tD(!0)},[$]),(0,i.useEffect)(()=>{if(!tT||"loading"===j||$&&!E&&!T)return;let e=$||"guest";if(at.current===e)return;at.current=e,as.current=!1;let t=async()=>{let[e,t,a,s,i,l]=await Promise.allSettled([(0,C.Fm)($,P.current),(0,C.se)($),(0,C.eV)($),(0,C.m3)($),(0,C.Vp)($),(0,C.T4)($)]);return{header:e,education:t,experience:a,skills:s,languages:i,certifications:l}},a=async(e,a)=>{if(!$)return e;try{tM(!0);let s=await t();return G(e,s,{...a,fallbackName:P.current})}catch{return e}finally{tM(!1)}},s=async e=>{let t=String(e.user_id||"").trim();if($&&t&&t!==$)return!1;if(t_.current||t5.current)return al(e.session_id),t_.current&&z(e.id),!0;let s=$?(0,q.Mh)($):null,i=Array.isArray(s?.sections)&&s.sections.length>0?s.sections:null;if(i)return al(e.session_id),z(e.id),Z(String(s?.title||e.title||"My Resume")),ea(el(s?.template||e.template)),en(i),!0;let l=Array.isArray(e.sections)&&e.sections.length>0?e.sections:(0,w.$b)();return!($&&t&&t===$)&&$&&!s&&((e,t)=>{if(!e?.length)return!1;let a=e.find(e=>"header"===e.type),s=a?.data??{},i=K(String(s.fullName??"")),l=K(String(s.email??"")),n=K(String(t.name??"")),r=K(String(t.email??""));return!!l&&!!r&&l!==r||!(!i||!n||i===n||i.includes(n)||n.includes(i))})(l,{name:P.current,email:A.current})?(al(e.session_id),z(void 0),Z("My Resume"),ea("harvard"),en((0,w.$b)())):(al(e.session_id),z(e.id),Z(e.title||"My Resume"),ea(el(e.template)),$&&(e=>{for(let t of e)if("header"===t.type){let e=t.data;if([e.fullName,e.email,e.phone,e.location,e.linkedin,e.jobTitle,e.photoUrl].some(e=>String(e||"").trim()))return!1}else if("summary"===t.type){if(String(t.data.text||"").trim())return!1}else if(["experience","education","skills","certifications","languages"].includes(t.type)&&(t.data.entries??[]).some(e=>Object.values(e).some(e=>String(e||"").trim())))return!1;return!0})(l)?en(await a(l,{overwrite:!1})):en(l)),!0};(async()=>{try{if(aa.current||(ed(!0),eZ("")),$){let e=await (0,C.uH)({userId:$});if(e){if(await s(e))return;eZ("Could not open your saved resume. Please refresh.");return}let t=await (0,C.Zg)($);if(t&&await s(t))return}let e=await (0,C.uH)({userId:$||void 0,sessionId:tT});if(e&&await s(e)||t5.current)return;let t=$?(0,q.Mh)($):null;if(t?.sections&&t.sections.length>0){Z(String(t.title||"My Resume")),t.template&&ea(el(t.template)),en(t.sections);return}
1if($){let e=(0,w.$b)(),t=await a(e,{overwrite:!1});en(t);return}z(void 0),Z("My Resume"),ea("harvard"),en((0,w.$b)())}catch{eZ("Could not load saved resume builder document.")}finally{as.current=!0,ed(!1),aa.current=!0}})()},[$,tT,j,E,T]),(0,i.useEffect)(()=>{if(ec||!$||t5.current)return;let e=(0,q.tO)();if(e?.resumeId&&e.analysis){if(tC.current)return;tC.current=!0,tN.current=!0,(async()=>{try{tM(!0),eZ("");let t=await (0,eP.z4)({resumeId:e.resumeId,userId:$,resumeParsedId:e.resumeParsedId,parsedExtraction:e.parsedExtraction,rawText:e.rawText,resumeFileName:e.resumeFileName});if(!t)return void eZ("Could not load the analyzed resume into the builder. Try re-running ATS analysis.");let a=(0,Q.pH)(t.extraction,{rawText:t.rawText}),s=(0,q.Yt)((0,q.Nt)(e.analysis),!!eB(a)),i=Array.from(new Set(s.map(e=>e.sectionType))),l=(0,Q.iJ)(t.extraction,t.fileName||e.resumeFileName||void 0);t_.current=!0,en(a),Z(l),tt(s),ts(i),tc(e.analysis.atsScore),tp(s.length),ty(0),tu(s[0]?.id??null),tg(e.resumeId),tb(e.analysisId??null),tl(!0),tr(!0),eM("Analyzed resume loaded â preparing enhanced ATS draftsâ¦"),(0,q.Zt)({userId:$,resumeId:e.resumeId,analysisId:e.analysisId??null,atsScore:e.analysis.atsScore,improvements:s,tipsTotal:s.length,tipsResolved:0,highlightedTypes:i,activeTipId:s[0]?.id??null,title:l,template:ee,sections:a,updatedAt:new Date().toISOString()}),tk.current=!0,tj(!0);try{let e=await eW({items:s,sections:a,userId:$});tt(e),eM("Analyzed resume loaded â review ATS tips in the side panel.")}catch(e){(0,C.Cj)(e)&&(eM(C.Gb),ai.current?.show({severity:"warn",summary:"AI credits finished",detail:C.Gb,life:5e3}))}finally{tj(!1)}let n=i[0];if(n){let e=a.find(e=>e.type===n);e&&(e8(e.id),requestAnimationFrame(()=>{document.getElementById(`resume-section-${e.id}`)?.scrollIntoView({behavior:"smooth",block:"nearest"})}))}if(tT)try{let e=await (0,C.f4)({id:O,session_id:tT,user_id:$,title:l,template:ee,sections:a,status:"draft"});e?.id&&z(e.id),e?.session_id&&al(e.session_id)}catch{}}catch{eZ("Could not import ATS resume data into the builder.")}finally{(0,q.a5)(),tM(!1),tC.current=!1}})();return}if(tN.current)return;let t=(0,q.Mh)($);if(t&&(t.improvements.length>0||t.tipsResolved>0||(t.sections?.length??0)>0||t.resumeId)){let e=t.sections&&t.sections.length>0?t.sections:null,a=(0,q.Yt)((0,q.Hp)(t.improvements||[]),!!eB(e||[]));tt(a),ts(t.highlightedTypes||[]),tc(t.atsScore),tp(t.tipsTotal||a.length||0),ty(t.tipsResolved||0),tu(t.activeTipId),tg(t.resumeId??null),tb(t.analysisId??null),tl(!0),tr(a.length>0),e?(en(e),t.title&&Z(t.title),t.template&&ea(el(t.template)),eM("Restored your ATS resume and tips from last session."),tk.current=!0,a.some(e=>("summary"===e.sectionType||"experience"===e.sectionType||"education"===e.sectionType||"custom"===e.sectionType)&&!(0,q.vk)(e))&&(tj(!0),eW({items:a,sections:e,userId:$}).then(e=>tt(e)).catch(e=>{(0,C.Cj)(e)&&ai.current?.show({severity:"warn",summary:"AI credits finished",detail:C.Gb,life:5e3})}).finally(()=>tj(!1)))):t.resumeId?(tC.current=!0,(async()=>{try{tM(!0);let e=await (0,eP.z4)({resumeId:t.resumeId,userId:$});if(!e)return;let a=(0,Q.pH)(e.extraction,{rawText:e.rawText}),s=(0,Q.iJ)(e.extraction,e.fileName||void 0);t_.current=!0,en(a),Z(s),eM("Reloaded resume from your parsed CV.");let i=(0,q.Yt)((0,q.Hp)(t.improvements||[]),!!eB(a)),l=i;i.some(e=>("summary"===e.sectionType||"experience"===e.sectionType||"education"===e.sectionType||"custom"===e.sectionType)&&!(0,q.vk)(e))&&(tj(!0),l=await eW({items:i,sections:a,userId:$}),tt(l),tj(!1)),(0,q.Zt)({...t,improvements:l,title:s,template:ee,sections:a,updatedAt:new Date().toISOString()}),tk.current=!0}catch{}finally{tM(!1),tC.current=!1}})()):tk.current=!0}tN.current=!0},[O,ec,tT,ee,$]),(0,i.useEffect)(()=>{if(ec||!$||t4.current)return;let e=(0,eP.Yx)();e.fromResume&&e.resumeId&&t8.current!==e.resumeId&&(t5.current=!0,t4.current=!0,(async()=>{try{tM(!0),eZ(""),eM("Loading uploaded CV into Resume Builderâ¦");let t=(0,eP.Eh)(),a=await (0,eP.z4)({resumeId:e.resumeId,userId:$,resumeParsedId:t?.resumeParsedId,parsedExtraction:t?.parsedExtraction,rawText:t?.rawText,resumeFileName:t?.resumeFileName});if(!a)return void eZ("Could not load this CV into Resume Builder. Try parsing it from the Resume Module first.");let s=(0,Q.pH)(a.extraction,{rawText:a.rawText}),i=(0,Q.iJ)(a.extraction,a.fileName||void 0);tF(e.resumeId),tY(a.fileName||t?.resumeFileName||""),t8.current=e.resumeId;let l=(0,X.Rr)($);ac(),tX(l),t1(null),Z(i),en((0,X.xe)(s)),t6.current={title:i,template:ee,sections:(0,X.xe)(s)},ao&&(0,X.N_)(ao,l),eM(l.length?`Parsed CV loaded. ${l.length} previous save${1===l.length?"":"s"} are in the list on the right.`:"Parsed CV loaded. Save to keep a copy in the list on the right.")}catch{eZ("Could not open this CV in Resume Builder.")}finally{(0,eP.Zc)(),tM(!1),t4.current=!1}})())},[ec,$,N,k]),(0,i.useEffect)(()=>{$&&"loading"!==j&&tX((0,X.Rr)($))},[j,$]),(0,i.useEffect)(()=>
1{if(ao){if(t9.current!==ao){t9.current=ao;return}(0,X.N_)(ao,tQ.filter(e=>"saved"===e.kind))}},[ao,tQ]);let au=(0,i.useMemo)(()=>tQ.filter(e=>"saved"===e.kind),[tQ]),am=(0,i.useMemo)(()=>{let e=t2.trim().toLowerCase(),t=au.slice().reverse();return e?t.filter(t=>`${t.label} ${t.title}`.toLowerCase().includes(e)):t},[au,t2]);(0,i.useEffect)(()=>{$&&tk.current&&ti&&(t5.current||(0,q.Zt)({userId:$,resumeId:tf,analysisId:tx,atsScore:to,improvements:te,tipsTotal:tm,tipsResolved:th,highlightedTypes:ta,activeTipId:td,title:J,template:ee,sections:es,updatedAt:new Date().toISOString()}))},[td,ta,te,to,ti,tx,tf,th,tm,es,ee,J,$]);let ap=(e,t)=>e.find(e=>e.type===t)??null,ah=(e,t=!0)=>{en(a=>{let s=ap(a,e)?a:(0,w.Ls)(a,(0,w.LU)(e)),i=ap(s,e);return i&&(e8(i.id),t&&eo(i),window.setTimeout(()=>{document.getElementById(`resume-section-${i.id}`)?.scrollIntoView({behavior:"smooth",block:"nearest"})},60)),s})},ay=e=>"summary"===e.sectionType?!!(eB(es)||eV(es)):"custom"===e.sectionType?!!(eL(es)||eH(es).length||eY(es)):"experience"===e.sectionType?(0,q.lR)(e)?eF(es).length>0:eF(es).some(e=>!!(0,q.pJ)(e.achievements)):"education"===e.sectionType?eU(es).some(e=>String(e.details||"").trim()):"skills"===e.sectionType&&((0,q.LQ)(e.suggestedContent||e.suggestion||"",e.keywords).length>0||(0,q.iP)({jobTitle:eY(es),summary:eB(es),suggestion:e.suggestion,existingSkills:eH(es),experienceText:eF(es).map(e=>`${e.role} ${e.company} ${e.achievements}`).join(" ")}).length>0),af=async e=>{let t="skills"===e.sectionType?(0,q.LQ)(e.suggestedContent||e.suggestion||"",e.keywords):[];if("skills"===e.sectionType){if(t.length)return{content:t.join(", "),skillKeywords:t};let a=eF(es).map(e=>`${e.role} ${e.company} ${e.achievements}`).join(" "),s=(0,q.iP)({jobTitle:eY(es),summary:eB(es),suggestion:e.suggestion,existingSkills:eH(es),experienceText:a});return s.length?{content:s.join(", "),skillKeywords:s}:{content:"",skillKeywords:[],manualReason:"This tip has no skill list to add. Open Skills and add role-relevant tools yourself."}}if("experience"===e.sectionType){if((0,q.lR)(e)){let t=e.experienceDrafts?.some(e=>String(e.role||"").trim())?e.experienceDrafts:(0,q.jv)({entries:eF(es),summary:eB(es),jobTitle:eY(es),skills:eH(es)}),a=(0,q.sv)(t);return a?{content:a,skillKeywords:[],experienceDrafts:t}:{content:"",skillKeywords:[],manualReason:"Open Experience and set clear job titles for each role yourself."}}let t=(e.experienceDrafts||[]).map(e=>({...e,achievements:(0,q.pJ)(e.achievements)})).filter(e=>e.achievements);if(t.length)return{content:t.map(e=>e.achievements).join("\n\n"),skillKeywords:[],experienceDrafts:t};let a=eF(es).filter(e=>(0,q.pJ)(e.achievements));if(!a.length)return{content:"",skillKeywords:[],manualReason:"Add achievements for each company/role yourself. Apply only enhances bullets that already exist â it will not invent them or paste this heading."};let s=eO(await (0,C.Nd)(a,$)).map(e=>({...e,achievements:(0,q.pJ)(e.achievements)})).filter(e=>e.achievements);return s.length?{content:s.map(e=>e.achievements).join("\n\n"),skillKeywords:[],experienceDrafts:s}:{content:"",skillKeywords:[],manualReason:"Could not enhance experience bullets. Try again."}}let a=(0,q.vk)(e);if(a)return{content:a,skillKeywords:[],customHeading:e.customHeading};if("summary"===e.sectionType){let e=eB(es),t=eV(es);if(!e&&!t)return{content:"",skillKeywords:[],manualReason:"Add experience, skills, or education first so AI can write a summary from your resume."};let a=String(await (0,C.mM)(e,$,e?void 0:t)||"").trim();return a?{content:a,skillKeywords:[]}:{content:"",skillKeywords:[],manualReason:"Could not generate the summary. Try again."}}if("education"===e.sectionType){let e=eU(es).filter(e=>String(e.details||"").trim());if(!e.length)return{content:"",skillKeywords:[],manualReason:"Add education details first, then Apply can enhance them."};let t=(await (0,C.Xo)(e,$)).map(e=>String(e.details||"").trim()).filter(Boolean).join("\n");return t?{content:t,skillKeywords:[]}:{content:"",skillKeywords:[],manualReason:"Could not enhance education. Try again."}}if("custom"===e.sectionType){let t=(0,q.wG)({issue:e.issue,suggestion:e.suggestion,jobTitle:eY(es),skills:eH(es)}),a=eL(es),s=a&&!(0,q.FZ)(a)?a:t.content;if(!s)return{content:"",skillKeywords:[],manualReason:"Add a few skills first so Apply can build this extra section for you."};if(a&&!(0,q.FZ)(a))try{let e=String(await (0,C.Ah)(a,$)||"").trim();if(e&&!(0,q.FZ)(e))return{content:e,skillKeywords:[],customHeading:t.heading}}catch{}return{content:t.content||s,skillKeywords:[],customHeading:t.heading}}return{content:"",skillKeywords:[],manualReason:`Open ${e.sectionLabel} and update it yourself â this tip is guidance, not resume text.`}},ag=e=>{tt(t=>{let a=t.filter(t=>t.id!==e.id);return ts(Array.from(new Set(a.map(e=>e.sectionType)))),ty(e=>e+1),tu(t=>t!==e.id?t:a[0]?.id??null),0===a.length&&tr(!1),a})},ax=async e=>{tw(e.id);try{let t,a,s,i=await af(e),l=i.skillKeywords,n=i.content,r=i.experienceDrafts,o=i.customHeading||e.customHeading;if(i.manualReason&&!n&&!r?.length){ai.current?.show({severity:"info",summary:`Update ${e.sectionLabel}`,detail:i.manualReason,life:4500}),ah(e.sectionType,!0);return}let{next:c,updatedTarget:d,mode:u}=(t=es.some(t=>t.type===e.sectionType)?es:(0,w.Ls)(es,(0,w.LU)(e.sectionType)),a="replaced",s=null,{next:t.map(t=>{if(t.type!==e.sectionType)return t;if("summary"===t.type)return(0,q.t5)(n)||(0,q.l$)(n)?t:(a="replaced",s={...t,data:{...t.data,text:n}});if("skills"===t.type){let e=[...R(t.data).filter(e=>e.name)];return l.forEach(t=>{e.some(e=>
1e.name.toLowerCase()===t.toLowerCase())||e.push({name:t})}),a="merged",s={...t,data:{entries:e.length?e:[{name:""}]}}}if("experience"===t.type){let i=I(t.data);if((0,q.lR)(e)&&r?.length){let e=i.map((e,t)=>{let a=r[t],s=String(a?.role||"").trim();return s?{...e,role:s}:e});return e.some((e,t)=>e.role!==i[t]?.role)?(a="replaced",s={...t,data:{entries:e}}):t}if(r?.length){let e=new Map(r.map(e=>[`${e.company}|${e.startDate}|${e.endDate}`.toLowerCase(),e])),l=i.map((t,a)=>{let s=`${t.company}|${t.startDate}|${t.endDate}`.toLowerCase(),i=e.get(s)||r[a],l=(0,q.pJ)(String(i?.achievements||""));return l?{...t,achievements:l}:t});return l.some((e,t)=>e.achievements!==i[t]?.achievements)?(a="replaced",s={...t,data:{entries:l}}):t}let l=(0,q.pJ)(n);if(!l||(0,q.t5)(l)||(0,q.l$)(l))return t;let[o,...c]=i.length?i:[{company:"",role:"",startDate:"",endDate:"",achievements:""}];return a="replaced",s={...t,data:{entries:[{...o,achievements:l},...c]}}}if("education"===t.type){let e=M(t.data),[i,...l]=e.length?e:[{school:"",degree:"",startDate:"",endDate:"",details:""}];return a="replaced",s={...t,data:{entries:[{...i,details:n},...l]}}}if("custom"===t.type){let i=o||String(t.data.heading||"").trim()||e.issue;return a="replaced",s={...t,title:i,data:{heading:i,content:n}}}return t}),updatedTarget:s,mode:a});if(!d){ai.current?.show({severity:"info",summary:`Open ${e.sectionLabel}`,detail:"Could not place this draft automatically. Update the section in the editor.",life:3500}),ah(e.sectionType,!0);return}en(c),e8(d.id),eo(d),window.setTimeout(()=>{document.getElementById(`resume-section-${d.id}`)?.scrollIntoView({behavior:"smooth",block:"nearest"})},60),ai.current?.show({severity:"success",summary:"merged"===u?`${l.length} skill${1===l.length?"":"s"} added`:`${e.sectionLabel} enhanced`,detail:"merged"===u?`Applied: ${l.slice(0,6).join(", ")}${l.length>6?"â¦":""}`:`Enhanced ${e.sectionLabel.toLowerCase()} placed in the editor.`,life:3200}),ag(e)}catch(t){ai.current?.show({severity:(0,C.Cj)(t)?"warn":"error",summary:(0,C.Cj)(t)?"AI credits finished":"Could not apply tip",detail:(0,C.Cj)(t)?C.Gb:t instanceof Error&&t.message?t.message:"Try again in a moment.",life:5e3}),ah(e.sectionType,!0)}finally{tw(null)}};(0,i.useEffect)(()=>{E&&!ec&&en(e=>{let t=!1,a=e.map(e=>{if("header"!==e.type)return e;let a=e.data;return String(a.fullName??"").trim()||![a.email,a.phone,a.location,a.linkedin,a.jobTitle,a.photoUrl].some(e=>String(e??"").trim())?e:(t=!0,{...e,data:{...a,fullName:E}})});return t?a:e})},[E,ec]),(0,i.useEffect)(()=>{Y&&(U.includes(ee)||ea(U[0]))},[Y,ee,U]),(0,i.useEffect)(()=>{if(!tT||ec||t5.current||!as.current||!aa.current||null!=eC)return;let e=setTimeout(async()=>{if(!as.current)return;let e=ad(ar);if(eq(e),!e)try{em(!0);let e=await (0,C.f4)({...ar,session_id:tT,user_id:$||void 0,status:"draft"});al(e.session_id),z(e.id),eZ(""),eM(`Autosaved at ${new Date().toLocaleTimeString()}`)}catch(e){eM(""),eZ(e instanceof Error&&e.message?e.message:"Autosave failed. Click Save to try again.")}finally{em(!1)}},1e3);return()=>clearTimeout(e)},[J,ee,es,$,tT,ec,eC]);let ab=(0,i.useMemo)(()=>({selectedSectionId:e4,justEnhancedSectionId:e6,atsHighlightedSectionTypes:ta,onSelect:e8,onEdit:eo,onDelete:e=>{en(t=>t.filter(t=>t.id!==e)),e8(t=>t===e?null:t)},onToggleVisible:e=>{en(t=>t.map(t=>t.id===e?{...t,visible:!t.visible}:t))},onMove:(e,t)=>{en(a=>{let s=a.findIndex(t=>t.id===e);if(s<0)return a;let i="up"===t?s-1:s+1;return i<0||i>=a.length?a:(0,r.be)(a,s,i)})},getSectionIndex:e=>es.findIndex(t=>t.id===e),sectionCount:es.length}),[ta,e6,e4,es]),av=ei(ee),aj=e=>{en(t=>t.map(t=>t.id===e.id?e:t))},aS=async e=>{if(!tT)throw Error("Resume session missing. Please refresh and try again.");let t=await (0,C.f4)({...ar,session_id:tT,user_id:$||void 0,status:e});return"final"===e&&a.e(102).then(a.bind(a,40102)).then(({trackFeatureUsed:t})=>{a.e(3353).then(a.bind(a,73353)).then(({PRODUCT_FEATURE:a})=>{t(a.RESUME_SAVE,{status:e})})}),t},aw=async()=>{if($&&!tI)try{tM(!0),eZ("");let[e,t,a,s,i,n]=await Promise.allSettled([(0,C.Fm)($,E),(0,C.se)($),(0,C.eV)($),(0,C.m3)($),(0,C.Vp)($),(0,C.T4)($)]),r=G((0,w.$b)(),{header:e,education:t,experience:a,skills:s,languages:i,certifications:n},{overwrite:!0,fallbackName:E}),o="fulfilled"===e.status?String(e.value.fullName||"").trim():"",c=o?`${o}'s Resume`:"From Profile";ac(),(0,l.flushSync)(()=>{t1(null),Z(c),en((0,X.xe)(r))}),t6.current={title:c,template:t6.current.template,sections:(0,X.xe)(r)},tB(!1),eM("Loaded profile data. Save to keep this version on the right.")}catch{eZ("Could not import profile data. Please try again.")}finally{tM(!1)}},aN=e=>{let t=e.filter(e=>"saved"===e.kind);return ao&&(t9.current=ao,(0,X.N_)(ao,t)),t},ak=async(e,t)=>{let a=(()=>
1{if(tL&&tL>0)return tL;let e=Number(N);return k&&Number.isFinite(e)&&e>0?e:0})();if(!a||!$)return null;let s=String(t||J).trim()||"My Resume",i=await eT("resume-builder-preview"),l=(0,eP.Fw)("duplicate"===e?null:tU,s),n=new File([i],l,{type:"application/pdf"}),r=await (0,eP.F7)({userId:$,resumeId:a,mode:e,file:n,title:s,template:ee,sections:(0,X.xe)(es)});return tF(r.resumeId),tY(l),{...r,fileName:l}},aC=async(e,t)=>{let a=await aS("draft");al(a.session_id),z(a.id);let s=(e=>{let t=t6.current;ac();let{list:a,saved:s}=(0,X.tQ)(tQ,{label:e,title:e||t.title,template:t.template,sections:t.sections});return(0,l.flushSync)(()=>{tX(a),t1(s.id)}),aN(a),s})(t);return eM(`Saved â${s.label}â.`),ai.current?.show({severity:"success",summary:"Saved",detail:e,life:4e3}),s},a_=async()=>{let e=ad(ar);if(eq(e),!e)try{tq(!0),em(!0),eZ(""),await ak("update"),await aC("Updated the existing CV."),tV(!1),tz(!1)}catch(t){eM("");let e=t instanceof Error&&t.message?t.message:"Could not save CV.";eZ(e),ai.current?.show({severity:"error",summary:"Save failed",detail:e,life:4e3})}finally{tq(!1),em(!1)}},a$=async()=>{let e=tJ.trim();if(!e)return void ai.current?.show({severity:"warn",summary:"Title required",detail:"Enter a title for the duplicate resume.",life:3500});let t=ad(ar);if(eq(t),!t)try{tq(!0),em(!0),eZ(""),(0,l.flushSync)(()=>{Z(e)}),t6.current={...t6.current,title:e},await ak("duplicate",e),await aC(`Saved as a copy titled â${e}â.`,e),tW(!1),tV(!1),tz(!1)}catch(t){eM("");let e=t instanceof Error&&t.message?t.message:"Could not save the copy.";eZ(e),ai.current?.show({severity:"error",summary:"Save failed",detail:e,life:4e3})}finally{tq(!1),em(!1)}},aE=async()=>{let e=ad(ar);(eq(e),e)?ai.current?.show({severity:"warn",summary:"Cannot save",detail:e,life:4e3}):(tz(!1),tZ(J.trim()||"My Resume"),tV(!0))},aT=e=>{eK(e,{pendingExport:!0})},aP=async()=>{if(Y){V("enhance"),tE(!0);return}if(!eQ.trim()||!e1.trim())return void eZ("Job title and job description are required for AI enhancement.");try{e5(!0),eZ(""),e$.current=structuredClone(es);let{sections:e}=await (0,C.Qv)({title:J,template:ee,sections:es,jobTitle:eQ.trim(),jobDescription:e1.trim(),userId:$});e.length?(e_(e),e0(""),e2(""),ek(!1)):(e$.current=null,eZ("Enhancement returned no content. Please try again."))}catch(e){e$.current=null,eZ(e?.message||"Could not enhance resume right now.")}finally{e5(!1),_()}},aA=()=>{let e=e$.current;e$.current=null,e_(null),e?.length&&en(e)},aD=async()=>{try{await aS("final"),eZ(""),(0,l.flushSync)(()=>e8(null));let e=(J||"resume").trim().replace(/[^\w\- ]+/g,"").replace(/\s+/g,"_");await eE("resume-builder-preview",`${e||"resume"}.pdf`),eM("PDF downloaded.")}catch(e){eZ(e instanceof Error?e.message:"Could not generate PDF. Please try again.")}},aI=async()=>{if(Y){try{await aS("draft")}catch{}V("export"),tE(!0);return}await aD()};return(0,i.useEffect)(()=>{tA&&$&&tT&&!ec&&(async()=>{window.localStorage.removeItem(eI),tD(!1),await aD()})()},[tA,$,tT,ec]),(0,s.jsxs)("div",{className:`${eD().page} resume-builder-root`,children:[(0,s.jsx)(f.y,{ref:ai,position:"top-right",className:"resume-builder-toast",appendTo:()=>document.body,baseZIndex:13e3}),(0,s.jsxs)("header",{className:`${eD().appBar} resume-builder-app-bar resume-builder-chrome`,"data-page-tour":"resume-builder-hero",children:[(0,s.jsxs)("div",{className:eD().appBarLeft,children:[(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-undo",className:eD().appBarIconBtn,"aria-label":"Undo",tooltip:"Undo last change",tooltipOptions:eR}),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-refresh",className:eD().appBarIconBtn,"aria-label":"Refresh",tooltip:"Redo last change",tooltipOptions:eR}),eA||eu?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:eD().appSavedDivider,"aria-hidden":!0}),(0,s.jsxs)("span",{className:eD().appSavedText,children:[(0,s.jsx)("i",{className:`pi ${eu?"pi-spin pi-spinner":"pi-cloud"}`,"aria-hidden":!0}),eu?"Saving...":eA]})]}):null]}),(0,s.jsx)("div",{className:eD().appBarCenter,children:(0,s.jsx)(d.S,{id:"resume-builder-title",value:J,onChange:e=>Z(e.target.value),className:eD().docTitle,placeholder:"Untitled resume","aria-label":"Resume name"})}),(0,s.jsxs)("div",{className:eD().appBarRight,children:[(0,s.jsx)(o.$,{type:"button",label:av.label,icon:"pi pi-palette",outlined:!0,className:eD().appBarActionBtn,tooltip:"
1Change CV style",tooltipOptions:eR,onClick:()=>ew(!0)}),(0,s.jsx)(o.$,{type:"button",label:"Save",icon:"pi pi-save",className:eD().appBarActionBtnPrimary,tooltip:"Save resume",tooltipOptions:eR,onClick:aE,loading:eu}),(0,s.jsx)(o.$,{type:"button",label:"Export",icon:"pi pi-file-pdf",outlined:!0,className:eD().appBarActionBtn,tooltip:"Export PDF",tooltipOptions:eR,onClick:aI})]})]}),ez||eG?(0,s.jsxs)("div",{className:`${eD().flashBar} resume-builder-chrome`,children:[ez?(0,s.jsxs)("p",{className:eD().flashError,children:[(0,s.jsx)("i",{className:"pi pi-exclamation-circle","aria-hidden":!0}),ez]}):null,eG?(0,s.jsxs)("p",{className:eD().flashWarn,children:[(0,s.jsx)("i",{className:"pi pi-info-circle","aria-hidden":!0}),eG]}):null]}):null,ec?(0,s.jsx)("p",{className:`${eD().loadingText} resume-builder-chrome`,children:"Loading your resumeâ¦"}):null,ti&&(te.length>0||th>0)?(0,s.jsxs)("div",{className:"resume-ats-bar resume-builder-chrome","data-page-tour":"resume-builder-ats",children:[(0,s.jsxs)("div",{className:"resume-ats-bar-main",children:[(0,s.jsxs)("span",{className:"resume-ats-bar-badge",children:[(0,s.jsx)("i",{className:"pi pi-chart-bar","aria-hidden":!0}),"ATS ",null!=to?`${to}/100`:"tips"]}),(0,s.jsxs)("span",{className:"resume-ats-bar-copy",children:[th,"/",tm||th," tips done",te.length>0?` \xb7 ${te.length} left`:" \xb7 all caught up"]})]}),(0,s.jsxs)("div",{className:"resume-ats-bar-actions",children:[te.length>0?(0,s.jsx)(o.$,{type:"button",label:"Review tips",icon:"pi pi-list",className:"p-button-sm resume-ats-bar-btn",onClick:()=>tr(!0)}):null,(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-times",className:"p-button-sm","aria-label":"Dismiss ATS tips",onClick:()=>{tr(!1),tl(!1),tt([]),ts([]),tc(null),tu(null),tp(0),ty(0),tg(null),tb(null),$&&(0,q.fp)($)}})]})]}):null,(0,s.jsxs)(h.Sidebar,{visible:tn&&te.length>0,position:"right",onHide:()=>tr(!1),className:"resume-ats-drawer",style:{width:"min(400px, 94vw)"},blockScroll:!1,dismissable:!0,showCloseIcon:!0,baseZIndex:1100,header:(0,s.jsxs)("div",{className:"resume-ats-drawer-header",children:[(0,s.jsx)("strong",{children:"ATS tips"}),(0,s.jsxs)("span",{children:[null!=to?`${to}/100`:""," \xb7 ",th,"/",tm," done \xb7"," ",te.length," left"]})]}),children:[(0,s.jsx)("p",{className:"resume-ats-drawer-lead",children:"Apply places the enhanced draft into that section. The heading is advice only â it is never pasted into the resume."}),tv?(0,s.jsx)("p",{className:"resume-ats-drawer-status",children:"Preparing enhanced draftsâ¦"}):null,(0,s.jsx)("div",{className:"resume-ats-drawer-list",children:te.map(e=>{let t=e.id===td,a="skills"===e.sectionType?(0,q.LQ)(e.suggestedContent||e.suggestion||"",e.keywords):[],i=(0,q.vk)(e),l=tS===e.id,n=!!(0,q.vk)(e)||ay(e);return(0,s.jsxs)("article",{className:`resume-ats-tip ${t?"resume-ats-tip--active":""}`,onClick:()=>{tu(e.id),ah(e.sectionType,!1)},children:[(0,s.jsxs)("div",{className:"resume-ats-tip-meta",children:[(0,s.jsx)("span",{className:"resume-ats-tip-section",children:e.sectionLabel}),(0,s.jsx)("span",{className:`resume-ats-tip-priority resume-ats-tip-priority--${e.priority}`,children:e.priority})]}),(0,s.jsx)("h4",{className:"resume-ats-tip-title",children:e.issue}),(0,s.jsx)("p",{className:"resume-ats-tip-body",children:e.suggestion}),a.length>0?(0,s.jsx)("div",{className:"resume-ats-tip-chips",children:a.map(e=>(0,s.jsx)("span",{className:"resume-ats-tip-chip",children:e},e))}):i?(0,s.jsx)("pre",{className:"resume-ats-tip-preview",children:i}):tv&&ay(e)?(0,s.jsx)("p",{className:"resume-ats-tip-count",children:"Building enhanced draftâ¦"}):(0,s.jsx)("p",{className:"resume-ats-tip-manual",children:"experience"===e.sectionType?(0,q.lR)(e)?"Open Experience and set a clear job title for each role.":"Add achievements for each company/role yourself. Apply enhances existing bullets â it will not invent them or paste this heading.":"summary"===e.sectionType?"Add experience, skills, or education first so AI can write a summary from your resume.":"skills"===e.sectionType?"No keyword list in this tip â add role-relevant skills in the editor.":"custom"===e.sectionType?"Apply will add this extra section from your skills.":"This is guidance. Update the section in the editor."}),(0,s.jsxs)("div",{className:"resume-ats-tip-actions",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)(o.$,{type:"button",label:`Open ${e.sectionLabel}`,icon:"pi pi-pencil",className:"p-button-sm p-button-outlined",onClick:()=>ah(e.sectionType,!0)}),n?(0,s.jsx)(o.$,{type:"button",label:"skills"===e.sectionType&&a.length>0?`Apply ${a.length} skill${1===a.length?"":"s"}`:(0,q.lR)(e)?"Apply titles":"Apply",icon:"pi pi-check",className:"p-button-sm",loading:l,onClick:()=>void ax(e)}):null,(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-check-circle",className:"p-button-sm","aria-label":"Mark done",tooltip:"Mark as done",tooltipOptions:eR,onClick:()=>ag(e)})]})]},e.id)})})]}),(0,s.jsxs)(n.Mp,{sensors:t,collisionDetection:n.fp,onDragStart:e=>{eh(String(e.active.id))},onDragEnd:e=>{let{active:t,over:a}=e;if(eh(null),!a)return;let s=String(t.id),i=String(a.id);if(s.startsWith("library-")){let e=s.replace("library-","");en(t=>{if(!(0,w.h3)(t,e))return t;let a=(0,w.LU)(e);if("resume-preview-dropzone"===i)return(0,w.Ls)(t,a);let s=t.findIndex(e=>e.id===i);if(s<0)return(0,w.Ls)(t,a);let l=[...t];return l.splice(s,0,a),l});return}
1t.id!==a.id&&en(e=>{let s=e.findIndex(e=>e.id===t.id),i=e.findIndex(e=>e.id===a.id);return s<0||i<0?e:(0,r.be)(e,s,i)})},children:[(0,s.jsxs)("div",{className:`${eD().workspace} resume-builder-workspace ${ey?`${eD().workspaceCollapsed} resume-builder-workspace--collapsed`:""} ${!Y?eD().workspaceWithVersions:""}`,children:[(0,s.jsx)("aside",{className:`${eD().libraryPane} resume-builder-library-pane resume-builder-col-library ${ey?eD().libraryPaneCollapsed:""}`,children:ey?(0,s.jsx)("div",{className:"resume-collapsed-rail",children:(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-angle-right",className:"resume-collapsed-rail-btn",onClick:()=>eg(!1),"aria-label":"Expand sections",tooltip:"Show sections",tooltipOptions:eR})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:eD().libraryTopActions,children:(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-angle-left",className:eD().libraryCollapseBtn,onClick:()=>eg(!0),"aria-label":"Collapse sections",tooltip:"Hide sections",tooltipOptions:eR})}),Y?null:(0,s.jsx)("div",{className:"resume-import-profile-wrap",children:(0,s.jsx)(o.$,{type:"button",id:"resume-builder-import-profile-btn",icon:tI?"pi pi-spin pi-spinner":"pi pi-user",label:"Import from Profile",className:"resume-import-profile-btn",disabled:tI,tooltip:"Import profile data",tooltipOptions:eR,onClick:()=>tB(!0)})}),(0,s.jsx)("div",{className:`${eD().libraryList} flex flex-column gap-1`,"data-page-tour":"resume-builder-primary",children:w.kd.map(e=>(0,s.jsx)(eJ,{type:e.type,label:e.label,disabled:!(0,w.h3)(es,e.type),onClick:()=>{var t;return t=e.type,void en(e=>(0,w.h3)(e,t)?(0,w.Ls)(e,(0,w.LU)(t)):e)}},e.type))})]})}),(0,s.jsxs)("main",{className:`${eD().previewPane} resume-builder-preview-pane resume-preview-panel`,children:[(0,s.jsx)("div",{className:`${eD().previewChrome} resume-builder-preview-chrome resume-preview-chrome`,"data-page-tour":"resume-builder-list",children:(0,s.jsxs)("div",{className:`${eD().previewActions} resume-builder-preview-actions`,children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-sparkles",label:"Enhance",className:`${eD().enhanceBtn} resume-builder-enhance-btn`,"aria-label":"Enhance with AI",tooltip:"Enhance with AI",tooltipOptions:eR,onClick:()=>{if(Y){V("enhance"),tE(!0);return}ek(!0)}}),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-window-maximize",className:`${eD().previewExpandBtn} resume-builder-expand-btn`,"aria-label":"Open preview fullscreen",tooltip:"Full screen preview",tooltipOptions:eR,onClick:()=>ev(!0)})]})}),(0,s.jsx)("div",{className:`${eD().previewCanvas} resume-builder-preview-canvas resume-panel-body resume-preview-interactive-body`,onClick:()=>e8(null),children:ec?(0,s.jsxs)("div",{className:"resume-paper p-5",style:{minHeight:"800px"},children:[(0,s.jsxs)("div",{className:"flex flex-column gap-2 mb-5",children:[(0,s.jsx)(y.E,{width:"40%",height:"3rem",className:"mb-2"}),(0,s.jsx)(y.E,{width:"60%",height:"1.5rem"}),(0,s.jsx)(y.E,{width:"30%",height:"1.5rem"})]}),(0,s.jsxs)("div",{className:"flex flex-column gap-3 mb-5",children:[(0,s.jsx)(y.E,{width:"20%",height:"2rem",className:"mb-3"}),(0,s.jsx)(y.E,{width:"100%",height:"1.2rem"}),(0,s.jsx)(y.E,{width:"90%",height:"1.2rem"}),(0,s.jsx)(y.E,{width:"95%",height:"1.2rem"})]}),(0,s.jsxs)("div",{className:"flex flex-column gap-3 mb-5",children:[(0,s.jsx)(y.E,{width:"25%",height:"2rem",className:"mb-3"}),(0,s.jsxs)("div",{className:"flex justify-content-between mb-2",children:[(0,s.jsx)(y.E,{width:"40%",height:"1.5rem"}),(0,s.jsx)(y.E,{width:"20%",height:"1.5rem"})]}),(0,s.jsx)(y.E,{width:"100%",height:"1.2rem"}),(0,s.jsx)(y.E,{width:"85%",height:"1.2rem"}),(0,s.jsxs)("div",{className:"flex justify-content-between mt-4 mb-2",children:[(0,s.jsx)(y.E,{width:"40%",height:"1.5rem"}),(0,s.jsx)(y.E,{width:"20%",height:"1.5rem"})]}),(0,s.jsx)(y.E,{width:"100%",height:"1.2rem"}),(0,s.jsx)(y.E,{width:"80%",height:"1.2rem"})]})]}):(0,s.jsx)(r.gB,{items:an,strategy:r._G,children:(0,s.jsx)(ef,{sections:es,template:ee,id:"resume-builder-preview",interactiveHandlers:ab})})})]}),Y?null:(0,s.jsxs)("aside",{className:eD().versionsPane,"aria-label":"Saved CVs",children:[(0,s.jsx)("div",{className:eD().versionsHeader,children:(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:eD().versionsEyebrow,children:"Saved"}),(0,s.jsx)("h3",{className:eD().versionsHeading,children:"My CVs"})]})}),(0,s.jsx)("p",{className:eD().versionsHint,children:"Saved copies keep the title you entered. Search below to find one quickly."}),(0,s.jsxs)("div",{className:eD().versionsSearch,children:[(0,s.jsx)("i",{className:"pi pi-search","aria-hidden":!0}
1),(0,s.jsx)(d.S,{value:t2,onChange:e=>t3(e.target.value),placeholder:"Search by title",className:eD().versionsSearchInput,"aria-label":"Search saved CVs by title"})]}),(0,s.jsx)("div",{className:eD().versionsList,children:au.length?am.length?am.map(e=>{let t=e.id===t0,a=e.label||e.title||"Saved CV";return(0,s.jsxs)("div",{className:`${eD().versionCard}${t?` ${eD().versionCardActive}`:""}`,children:[(0,s.jsxs)("button",{type:"button",className:eD().versionCardMain,onClick:()=>(e=>{if(e===t0)return;let t=tQ.find(t=>t.id===e);t&&(ac(),(0,l.flushSync)(()=>{t1(e),Z(t.title),ea(el(t.template)),en((0,X.xe)(t.sections))}),t6.current={title:t.title,template:el(t.template),sections:(0,X.xe)(t.sections)},eM(`Loaded â${t.label}â. Edit and Save to keep a new copy â this one stays unchanged.`))})(e.id),title:a,children:[(0,s.jsx)("span",{className:eD().versionName,children:a}),(0,s.jsx)("span",{className:eD().versionMeta,children:(0,X.KV)(e.updatedAt)})]}),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-trash",className:eD().versionDeleteBtn,"aria-label":`Delete ${a}`,tooltip:"Delete",tooltipOptions:eR,onClick:t=>{var a;let s;t.stopPropagation(),a=e.id,ac(),s=aN(tQ.filter(e=>e.id!==a)),(0,l.flushSync)(()=>{tX(s),t0===a&&t1(null)}),aN(s),eM("Removed from the saved list.")}})]},e.id)}):(0,s.jsxs)("div",{className:eD().versionsEmpty,children:[(0,s.jsx)("i",{className:"pi pi-search","aria-hidden":!0}),(0,s.jsxs)("p",{children:["No saved CV matches â",t2.trim(),"â."]})]}):(0,s.jsxs)("div",{className:eD().versionsEmpty,children:[(0,s.jsx)("i",{className:"pi pi-bookmark","aria-hidden":!0}),(0,s.jsx)("p",{children:"Nothing saved yet. Click Save to add this CV here."})]})})]})]}),(0,s.jsx)(n.Hd,{children:ep?.startsWith("library-")?(0,s.jsxs)("div",{className:"resume-drag-overlay",children:[(0,s.jsx)("i",{className:"pi pi-plus-circle"}),(0,s.jsx)("span",{children:`Add ${ep.replace("library-","")}`})]}):ep?(0,s.jsxs)("div",{className:"resume-drag-overlay",children:[(0,s.jsx)("i",{className:"pi pi-bars"}),(0,s.jsx)("span",{children:"Reorder section"})]}):null})]}),(0,s.jsx)(m.l,{header:`Resume Preview (${av.label})`,visible:eb,onHide:()=>ev(!1),style:{width:"92vw",maxWidth:"1220px"},contentStyle:{padding:0,overflow:"hidden"},className:"resume-preview-dialog",maximizable:!0,children:(0,s.jsx)("div",{className:"resume-preview-dialog-body",children:(0,s.jsx)(ef,{sections:es,template:ee})})}),(0,s.jsx)(m.l,{header:"Enhance Resume with AI",visible:eN,onHide:()=>ek(!1),style:{width:"42rem",maxWidth:"95vw"},children:(0,s.jsxs)("div",{className:"flex flex-column gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Job title"}),(0,s.jsx)(d.S,{value:eQ,onChange:e=>e0(e.target.value),className:"w-full",placeholder:"e.g. Senior Full Stack Developer"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Job description"}),(0,s.jsx)(u.Z,{rows:8,value:e1,onChange:e=>e2(e.target.value),className:"w-full",placeholder:"Paste the role description to tailor this resume with ATS-friendly keywords."})]}),(0,s.jsxs)("div",{className:"flex justify-content-end gap-2",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Cancel",onClick:()=>ek(!1),disabled:e3}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-sparkles",label:"Enhance",onClick:aP,loading:e3})]})]})}),(0,s.jsx)(m.l,{header:"Review enhanced content",visible:null!=eC,onHide:aA,style:{width:"44rem",maxWidth:"95vw"},className:"resume-enhance-confirm-dialog",footer:(0,s.jsxs)("div",{className:"resume-enhance-confirm-footer",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Don't apply",onClick:aA}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-check",label:"Apply changes",onClick:()=>{if(eC?.length){let e;e$.current=null,e=t6.current,ac(),(0,l.flushSync)(()=>{en((0,X.xe)(eC))}),t6.current={title:e.title,template:e.template,sections:(0,X.xe)(eC)},eM("Enhanced this CV. Save to keep it in the list on the right."),e_(null)}}})]}),children:(0,s.jsxs)("div",{className:"resume-enhance-confirm",children:[(0,s.jsx)("p",{className:"resume-enhance-confirm-copy",children:"The following content will be used to enhance this resume. Would you like to apply the changes?"}),(0,s.jsx)("div",{className:"resume-enhance-confirm-sections",children:(eC??[]).map(e=>{let t=(0,ex.Sh)(e,0);return t?(0,s.jsxs)("div",{className:"resume-enhance-confirm-block resume-enhance-confirm-block--proposed",children:[(0,s.jsx)("span",{className:"resume-enhance-confirm-label",children:e.title}),(0,s.jsx)("div",{className:"resume-enhance-confirm-text",children:t})]},e.id):null})})]})}),(0,s.jsx)(eS,{visible:ej,value:ee,onHide:()=>ew(!1),onSelect:e=>ea(e),allowedTemplates:Y?U:void 0,lockedMessage:"You can access this template after signing in",onLockedSelect:()=>{V("template"),tE(!0)}}),(0,s.jsx)(m.l,{header:"Sign in to continue",visible:t$,onHide:()=>tE(!1),style:{width:"30rem",maxWidth:"95vw"},children:(0,s.jsxs)("div",{className:"flex flex-column gap-3",children:[(0,s.jsx)("p",{className:"m-0 text-700 line-height-3",children:"template"===H?"You can access premium templates after signing in.":"enhance"===H?"AI enhancement is available after signing in.":"save"===H?"Save your resume after signing in or creating an account.":"You can export your resume after signing in or signing up."}),(0,s.jsxs)("div",{className:"flex justify-content-end gap-2",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Maybe later",onClick:()=>tE(!1)}),(0,s.jsx)(o.$,{type:"button",outlined:!0,label:"Sign in",onClick:()=>{"export"===H?aT("signin"):eK("signin")}}),(0,s.jsx)(o.$,{type:"button",label:"Sign up",onClick:()=>{"export"===H?aT("signup"):eK("signup")}})]})]})}),(0,s.jsx)(m.l,{header:"Save CV",visible:tH,closable:!tG,closeOnEscape:!tG,onHide:()=>{tG||(tV(!1),tz(!1))},style:{width:"32rem",maxWidth:"95vw"},footer:(0,s.jsxs)("div",{className:"flex justify-content-end gap-2",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Cancel",disabled:tG,onClick:()=>{tV(!1),tz(!1)}}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-save",label:"Save",loading:tG,onClick:()=>void a_()})]}),children:(0,s.jsxs)("div",{className:"flex flex-column gap-3",children:[(0,s.jsx)("p",{className:"m-0 text-700 line-height-3",children:"Save updates the current CV. Tick Save as copy to create a duplicate with its own title."}),(0,s.jsxs)("label",{className:"flex align-items-start gap-2 cursor-pointer",children:[(0,s.jsx)(p.S,{inputId:"module-save-copy",checked:tK,disabled:tG,onChange:e=>{let t=!!e.checked;tz(t),t&&(tZ(J.trim()||"My Resume"),tV(!1),tW(!0))}}),(0,s.jsxs)("span",{children:[(0,s.jsx)("span",{className:"font-semibold block",children:"Save as copy"}),(0,s.jsx)("span",{className:"text-600 text-sm",children:"Keep the original unchanged and add a new CV in Resume Builder."})]})]})]})}),(0,s.jsx)(m.l,{header:"Name this copy",visible:tO,closable:!tG,closeOnEscape:!tG,onHide:()=>{tG||(tW(!1),tz(!1),tV(!0))},style:{width:"28rem",maxWidth:"95vw"},footer:(0,s.jsxs)("div",{className:"flex justify-content-end gap-2",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Cancel",disabled:tG,onClick:()=>{tW(!1),tz(!1),tV(!0)}}),(0,s.jsx)(o.$,{type:"button",icon:"pi pi-copy",label:"Save copy",loading:tG,onClick:()=>void a$()})]}),children:(0,s.jsxs)("div",{className:"flex flex-column gap-3",children:[(0,s.jsx)("p",{className:"m-0 text-700 line-height-3",children:"Enter a title for the duplicate resume. This name will show in Resume Builder."}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"copy-resume-title",className:"block text-sm font-semibold mb-2",children:"Copy title"}),(0,s.jsx)(d.S,{id:"copy-resume-title",className:"w-full",autoFocus:!0,value:tJ,disabled:tG,onChange:e=>tZ(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),a$())}})]})]})}),(0,s.jsx)(m.l,{header:"Import from Profile",visible:tR,closable:!tI,closeOnEscape:!tI,onHide:()=>{tI||tB(!1)},style:{width:"28rem",maxWidth:"95vw"},footer:(0,s.jsxs)("div",{className:"flex justify-content-end gap-2",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Cancel",disabled:tI,onClick:()=>tB(!1)}),(0,s.jsx)(o.$,{type:"button",label:"Import",icon:"pi pi-user",loading:tI,onClick:()=>void aw()})]}),children:(0,s.jsxs)("div",{className:"flex flex-column gap-3",children:[(0,s.jsx)("p",{className:"m-0 text-700 line-height-3",children:"Your current CV will be saved as a version on the right. A new version will then be created with only profile data â nothing from the previous CV will be mixed in."}),tI?(0,s.jsxs)("p",{className:"m-0 text-600",children:[(0,s.jsx)("i",{className:"pi pi-spin pi-spinner mr-2","aria-hidden":!0}),"Importing your profileâ¦"]}):null]})}),(0,s.jsx)(h.Sidebar,{visible:null!==er,position:"right",className:"p-sidebar-md resume-section-editor-sidebar",header:(0,s.jsx)("h2",{className:"resume-section-editor-title",children:"Edit Section"}),onHide:()=>eo(null),showCloseIcon:!0,baseZIndex:1200,children:er?(0,s.jsx)(eX,{userId:$,refreshTokens:_,sessionName:W(c?.user),section:er,templateSupportsPhoto:av.supportsPhoto,onSave:e=>{aj(e),eo(null),ai.current?.show({severity:"success",summary:"Saved",detail
1:"Section changes have been saved successfully.",life:3e3})},onEnhancementApplied:(e,t)=>{var a;aj(e),a=e.id,e8(a),e7(a),eM(t),e9.current&&clearTimeout(e9.current),e9.current=setTimeout(()=>e7(null),3200),requestAnimationFrame(()=>{document.getElementById(`resume-section-${a}`)?.scrollIntoView({behavior:"smooth",block:"nearest"})})},onCancel:()=>eo(null)}):null})]})},eQ=({photoUrl:e,onChange:t,onError:a})=>{let l=(0,i.useRef)(null),[n,r]=(0,i.useState)(!1),c=!!e.trim(),d=async e=>{let s=e.target.files?.[0];if(e.target.value="",s)try{r(!0),a?.("");let e=await k(s);t(e)}catch(e){a?.(e instanceof Error?e.message:"Could not process this image.")}finally{r(!1)}};return(0,s.jsxs)("div",{className:"resume-photo-upload-card",children:[(0,s.jsx)("button",{type:"button",className:"resume-photo-upload-trigger",onClick:()=>l.current?.click(),disabled:n,"aria-label":c?"Change profile photo":"Upload profile photo",children:c?(0,s.jsx)("img",{src:e,alt:"Profile preview",className:"resume-photo-upload-preview"}):(0,s.jsxs)("span",{className:"resume-photo-upload-empty",children:[(0,s.jsx)("i",{className:n?"pi pi-spin pi-spinner":"pi pi-camera","aria-hidden":!0}),(0,s.jsx)("span",{children:n?"Processingâ¦":"Upload photo"})]})}),(0,s.jsxs)("div",{className:"resume-photo-upload-actions",children:[(0,s.jsx)(o.$,{type:"button",icon:n?"pi pi-spin pi-spinner":"pi pi-upload",label:n?"Processingâ¦":c?"Change image":"Choose image",className:"resume-photo-upload-choose-btn",disabled:n,onClick:()=>l.current?.click()}),c?(0,s.jsx)(o.$,{type:"button",icon:"pi pi-trash",label:"Remove photo",text:!0,severity:"danger",className:"resume-photo-upload-remove-btn",onClick:()=>t("")}):null,(0,s.jsx)("input",{ref:l,type:"file",accept:"image/png,image/jpeg",className:"resume-photo-upload-input",onChange:d}),(0,s.jsx)("p",{className:"resume-photo-upload-hint",children:"PNG or JPG. Large photos are compressed automatically before save."})]})]})},eX=({userId:e,refreshTokens:t,sessionName:a,section:l,templateSupportsPhoto:n,onSave:r,onEnhancementApplied:m,onCancel:p})=>{let[h,y]=(0,i.useState)(l.title),[f,g]=(0,i.useState)(l.data),[x,b]=(0,i.useState)("experience"===l.type?I(l.data):[]),[v,j]=(0,i.useState)("education"===l.type?M(l.data):[]),[S,w]=(0,i.useState)("skills"===l.type?R(l.data):[]),[N,k]=(0,i.useState)("projects"===l.type?B(l.data):[]),[_,W]=(0,i.useState)("certifications"===l.type?L(l.data):[]),[K,z]=(0,i.useState)("languages"===l.type?F(l.data):[]),[J,Z]=(0,i.useState)(!1),[G,q]=(0,i.useState)(""),[Q,X]=(0,i.useState)(!1),[ee,et]=(0,i.useState)(""),[ea,es]=(0,i.useState)(!1),[ei,el]=(0,i.useState)(""),[en,er]=(0,i.useState)(!1),[eo,ec]=(0,i.useState)(""),[ed,eu]=(0,i.useState)(!1),[em,ep]=(0,i.useState)(""),[eh,ey]=(0,i.useState)(!1),[ef,eb]=(0,i.useState)(""),[ev,ej]=(0,i.useState)(""),[eS,ew]=(0,i.useState)(!1),[eN,ek]=(0,i.useState)(""),[eC,e_]=(0,i.useState)(null),[e$,eE]=(0,i.useState)({}),[eT,eP]=(0,i.useState)(null),[eA,eD]=(0,i.useState)({}),[eI,eM]=(0,i.useState)(null),[eR,eB]=(0,i.useState)({}),[eL,eF]=(0,i.useState)(null),[eU,eY]=(0,i.useState)({}),[eH,eV]=(0,i.useState)(!1),[eO,eW]=(0,i.useState)(""),[eK,eJ]=(0,i.useState)(null),[eq,eX]=(0,i.useState)(""),e0=async()=>{if(!e)return void q("User session is missing. Please refresh and try again.");try{Z(!0),q("");let t=await (0,C.se)(e),a=U(t);j(a.length?a:[E()]),t.length||q("No education records found in your profile. Section cleared.")}catch{q("Could not load education from profile.")}finally{Z(!1)}},e1=async()=>{if(!e)return void et("User session is missing. Please refresh and try again.");try{X(!0),et("");let t=await (0,C.eV)(e),a=Y(t);b(a.length?a:[$()]),t.length||et("No employment history found in your profile. Section cleared.")}catch{et("Could not load employment history from profile.")}finally{X(!1)}},e2=async()=>{if(!e)return void el("User session is missing. Please refresh and try again.");try{es(!0),el("");let t=await (0,C.m3)(e),a=H(t);w(a.length?a:[T()]),a.length||el("No skills found in your profile. Section cleared.")}catch{el("Could not load skills from profile.")}finally{es(!1)}},e3=async()=>
1{if(!e)return void ec("User session is missing. Please refresh and try again.");try{er(!0),ec("");let t=await (0,C.Vp)(e),a=V(t);z(a.length?a:[D()]),a.length||ec("No languages found in your profile. Section cleared.")}catch{ec("Could not load languages from profile.")}finally{er(!1)}},e5=async()=>{if(!e)return void ep("User session is missing. Please refresh and try again.");try{eu(!0),ep("");let t=await (0,C.T4)(e),a=O(t);W(a.length?a:[A()]),t.length||ep("No certifications found in your profile. Section cleared.")}catch{ep("Could not load certifications from profile.")}finally{eu(!1)}},e4=async()=>{if(!e)return void eb("User session is missing. Please refresh and try again.");try{ey(!0),eb("");let t=await (0,C.Fm)(e,a);if(![t.fullName,t.email,t.phone,t.location,t.linkedin,t.jobTitle,t.photoUrl].some(Boolean))return void eb("No profile details found to prefill header.");g(e=>({...e,fullName:t.fullName||a||String(e.fullName??"").trim()||"",jobTitle:t.jobTitle||e.jobTitle||"",email:t.email||e.email||"",phone:t.phone||e.phone||"",location:t.location||e.location||"",linkedin:t.linkedin||e.linkedin||"",photoUrl:t.photoUrl||e.photoUrl||""}))}catch{eb("Could not load header details from profile.")}finally{ey(!1)}},e8=()=>h.trim()||l.title,e6=async()=>{let a=String(f.text??"").trim();if(!a)return void ek("Please add some summary text before enhancing.");try{ew(!0),ek(""),eX("");let t=await (0,C.mM)(a,e);if(!t)return void ek("Enhancement returned empty text. Please try again.");eJ({kind:"summary",sectionLabel:e8()||"Professional Summary",fieldLabel:"Professional summary",currentContent:a,proposedContent:t})}catch(e){ek(e?.message||"Could not enhance summary right now.")}finally{ew(!1),t()}},e7=async a=>{let s=x[a],i=String(s?.achievements||"").trim();if(!i)return void eE(e=>({...e,[a]:"Please add achievements text before enhancing."}));try{e_(a),eE(e=>({...e,[a]:""})),eX("");let t=await (0,C.Nd)([s],e),l=String(t[0]?.achievements||"").trim();if(!l)return void eE(e=>({...e,[a]:"Enhancement returned no content. Please try again."}));eJ({kind:"experience",index:a,sectionLabel:(0,ex.VM)(e8()||"Experience","Experience",a,(0,ex.N0)(String(s?.role||""),String(s?.company||""))),fieldLabel:"Achievements",currentContent:i,proposedContent:l})}catch(e){eE(t=>({...t,[a]:e?.message||"Could not enhance experience right now."}))}finally{e_(null),t()}},e9=async a=>{let s=v[a],i=String(s?.details||"").trim();if(!i)return void eD(e=>({...e,[a]:"Please add details text before enhancing."}));try{eP(a),eD(e=>({...e,[a]:""})),eX("");let t=await (0,C.Xo)([s],e),l=String(t[0]?.details||"").trim();if(!l)return void eD(e=>({...e,[a]:"Enhancement returned no content. Please try again."}));eJ({kind:"education",index:a,sectionLabel:(0,ex.VM)(e8()||"Education","Education",a,(0,ex.nD)(String(s?.degree||""),String(s?.school||""))),fieldLabel:"Details",currentContent:i,proposedContent:l})}catch(e){eD(t=>({...t,[a]:e?.message||"Could not enhance education right now."}))}finally{eP(null),t()}},te=async a=>{let s=N[a],i=String(s?.details||"").trim();if(!i)return void eB(e=>({...e,[a]:"Please add details text before enhancing."}));try{eM(a),eB(e=>({...e,[a]:""})),eX("");let t=await (0,C.Wf)([s],e),l=String(t[0]?.details||"").trim();if(!l)return void eB(e=>({...e,[a]:"Enhancement returned no content. Please try again."}));eJ({kind:"projects",index:a,sectionLabel:(0,ex.VM)(e8()||"Projects","Project",a,String(s?.projectName||"")),fieldLabel:"Details",currentContent:i,proposedContent:l})}catch(e){eB(t=>({...t,[a]:e?.message||"Could not enhance project right now."}))}finally{eM(null),t()}},tt=async a=>{let s=_[a],i=String(s?.details||"").trim();if(!i)return void eY(e=>({...e,[a]:"Please add details text before enhancing."}));try{eF(a),eY(e=>({...e,[a]:""})),eX("");let t=await (0,C.tF)([s],e),l=String(t[0]?.details||"").trim();if(!l)return void eY(e=>({...e,[a]:"Enhancement returned no content. Please try again."}));eJ({kind:"certifications",index:a,sectionLabel:(0,ex.VM)(e8()||"Certifications","Certification",a,String(s?.name||"")),fieldLabel:"Details",currentContent:i,proposedContent:l})}catch(e){eY(t=>({...t,[a]:e?.message||"Could not enhance certification right now."}))}finally{eF(null),t()}},ta=async()=>{let a=String(f.content??"").trim();if(!a)return void eW("Please add content text before enhancing.");try{eV(!0),eW(""),eX("");let t=await (0,C.Ah)(a,e);if(!t)return void eW("Enhancement returned empty text. Please try again.");eJ({kind:"custom",sectionLabel:e8()||"Custom section",fieldLabel:"Content",currentContent:a,proposedContent:t})}catch(e){eW(e?.message||"Could not enhance custom content right now.")}finally{eV(!1),t()}};return(0,s.jsxs)("div",{className:"resume-section-editor-shell",children:[(0,s.jsxs)("div",{className:"resume-section-editor-body",children:[eq?(0,s.jsxs)("div",{className:"resume-enhance-
1applied",role:"status",children:[(0,s.jsx)("i",{className:"pi pi-check-circle","aria-hidden":!0}),(0,s.jsx)("span",{children:eq})]}):null,(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Section title"}),(0,s.jsx)(d.S,{value:h,onChange:e=>y(e.target.value),className:"w-full mb-3",placeholder:"e.g. Professional Experience",disabled:"custom"!==l.type}),"experience"===l.type?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-download",text:!0,label:"Fill from profile",onClick:e1,loading:Q}),ee?(0,s.jsx)("small",{className:"block text-red-600 mt-2",children:ee}):null]}),x.map((e,t)=>(0,s.jsxs)("div",{className:"resume-entry-card",children:[(0,s.jsxs)("div",{className:"flex align-items-center justify-content-between mb-2",children:[(0,s.jsxs)("strong",{children:["Experience ",t+1]}),(0,s.jsx)(o.$,{type:"button",text:!0,severity:"danger",icon:"pi pi-trash",disabled:1===x.length,onClick:()=>b(e=>1===e.length?e:e.filter((e,a)=>a!==t))})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Company"}),(0,s.jsx)(d.S,{value:e.company,onChange:e=>b(a=>a.map((a,s)=>s===t?{...a,company:e.target.value}:a)),className:"w-full",placeholder:"e.g. ABC Technologies"})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Role"}),(0,s.jsx)(d.S,{value:e.role,onChange:e=>b(a=>a.map((a,s)=>s===t?{...a,role:e.target.value}:a)),className:"w-full",placeholder:"e.g. Senior Software Engineer"})]}),(0,s.jsxs)("div",{className:"grid",children:[(0,s.jsxs)("div",{className:"col-6",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Start date"}),(0,s.jsx)(c.V,{value:eZ(e.startDate),view:"month",dateFormat:"M yy",showIcon:!0,onChange:e=>b(a=>a.map((a,s)=>s===t?{...a,startDate:eG(e.value)}:a)),className:"w-full",placeholder:"Select start date"})]}),(0,s.jsxs)("div",{className:"col-6",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"End date"}),(0,s.jsx)(c.V,{value:eZ(e.endDate),view:"month",dateFormat:"M yy",showIcon:!0,onChange:e=>b(a=>a.map((a,s)=>s===t?{...a,endDate:eG(e.value)}:a)),className:"w-full",placeholder:"Select end date"})]})]}),(0,s.jsxs)("div",{className:"mb-2",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Achievements"}),(0,s.jsx)(u.Z,{rows:4,value:e.achievements,onChange:e=>b(a=>a.map((a,s)=>s===t?{...a,achievements:e.target.value}:a)),className:"w-full",placeholder:"e.g. Built scalable APIs serving 1M+ requests/day."}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)(o.$,{type:"button",label:"Enhance",icon:"pi pi-sparkles",className:"resume-enhance-btn",loading:eC===t,onClick:()=>e7(t)}),e$[t]?(0,s.jsx)("small",{className:"text-red-700 block mt-2",children:e$[t]}):null]})]})]},`experience-editor-${t}`)),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-plus",label:"Add another experience",onClick:()=>b(e=>[...e,$()]),className:"mb-3"})]}):"education"===l.type?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-download",text:!0,label:"Fill from profile",onClick:e0,loading:J}),G?(0,s.jsx)("small",{className:"block text-red-600 mt-2",children:G}):null]}),v.map((e,t)=>(0,s.jsxs)("div",{className:"resume-entry-card",children:[(0,s.jsxs)("div",{className:"flex align-items-center justify-content-between mb-2",children:[(0,s.jsxs)("strong",{children:["Education ",t+1]}),(0,s.jsx)(o.$,{type:"button",text:!0,severity:"danger",icon:"pi pi-trash",disabled:1===v.length,onClick:()=>j(e=>1===e.length?e:e.filter((e,a)=>a!==t))})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"School"}),(0,s.jsx)(d.S,{value:e.school,onChange:e=>j(a=>a.map((a,s)=>s===t?{...a,school:e.target.value}:a)),className:"w-full",placeholder:"e.g. University of London"})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Degree"}),(0,s.jsx)(d.S,{value:e.degree,onChange:e=>j(a=>a.map((a,s)=>s===t?{...a,degree:e.target.value}:a)),className:"w-full",placeholder:"e.g. BSc Computer Science"})]}),(0,s.jsxs)("div",{className:"grid",children:[(0,s.jsxs)("div",{className:"col-6",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Start date"}),(0,s.jsx)(c.V,{value:eZ(e.startDate),view:"month",dateFormat:"M yy",showIcon:!0,onChange:e=>j(a=>a.map((a,s)=>s===t?{...a,startDate:eG(e.value)}:a)),className:"w-full",placeholder:"Select start date"})]}),(0,s.jsxs)("div",{className:"col-6",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"End date"}),(0,s.jsx)(c.V,{value:eZ(e.endDate),view:"month",dateFormat:"M yy",showIcon:!0,onChange:e=>j(a=>a.map((a,s)=>s===t?{...a,endDate:eG(e.value)}:a)),className:"w-full",placeholder:"Select end date"})]})]}),(0,s.jsxs)("div",{className:"mb-2",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Details"}),(0,s.jsx)(u.Z,{rows:4,value:e.details,onChange:e=>j(a=>a.map((a,s)=>s===t?{...a,details:e.target.value}:a)),className:"w-full",placeholder:"e.g. First Class Honours, thesis on distributed systems."}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)(o.$,{type:"button",label:"Enhance",icon:"pi pi-sparkles",className:"resume-enhance-btn",loading:eT===t,onClick:()=>e9(t)}),eA[t]?(0,s.jsx)("small",{className:"text-red-700 block mt-2",children:eA[t]}):null]})]})]},`education-editor-${t}`)),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-plus",label:"Add another education",onClick:()=>j(e=>[...e,E()]),className:"mb-3"})]}):"skills"===l.type?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-download",text:!0,label:"Fill from profile",onClick:e2,loading:ea}),ei?(0,s.jsx)("small",{className:"block text-red-600 mt-2",children:ei}):null]}),S.map((e,t)=>(0,s.jsxs)("div",{className:"resume-entry-card",children:[(0,s.jsxs)("div",{className:"flex align-items-center justify-content-between mb-2",children:[(0,s.jsxs)("strong",{children:["Skill ",t+1]}),(0,s.jsx)(o.$,{type:"button",text:!0,severity:"danger",icon:"pi pi-trash",disabled:1===S.length,onClick:()=>w(e=>1===e.length?e:e.filter((e,a)=>a!==t))})]}),(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Skill name"}),(0,s.jsx)(d.S,{value:e.name,onChange:e=>w(a=>a.map((a,s)=>s===t?{...a,name:e.target.value}:a)),className:"w-full",placeholder:"e.g. React.js"})]},`skill-editor-${t}`)),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-plus",label:"Add another skill",onClick:()=>w(e=>[...e,T()]),className:"mb-3"})]}):"projects"===l.type?(0,s.jsxs)(s.Fragment,{children:[N.map((e,t)=>(0,s.jsxs)("div",{className:"resume-entry-card",children:[(0,s.jsxs)("div",{className:"flex align-items-center justify-content-between mb-2",children:[(0,s.jsxs)("strong",{children:["Project ",t+1]}),(0,s.jsx)(o.$,{type:"button",text:!0,severity:"danger",icon:"pi pi-trash",disabled:1===N.length,onClick:()=>k(e=>1===e.length?e:e.filter((e,a)=>a!==t))})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Project name"}),(0,s.jsx)(d.S,{value:e.projectName,onChange:e=>k(a=>a.map((a,s)=>s===t?{...a,projectName:e.target.value}:a)),className:"w-full",placeholder:"e.g. AI Job Matching Platform"})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Project link"}),(0,s.jsx)(d.S,{value:e.link,onChange:e=>k(a=>a.map((a,s)=>s===t?{...a,link:e.target.value}:a)),className:"w-full",placeholder:"e.g. https://github.com/username/project"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Details"}),(0,s.jsx)(u.Z,{rows:4,value:e.details,onChange:e=>k(a=>a.map((a,s)=>s===t?{...a,details:e.target.value}:a)),className:"w-full",placeholder:"e.g. Built a real-time recommendation engine with 30% higher match accuracy."}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)(o.$,{type:"button",label:"Enhance",icon:"pi pi-sparkles",className:"resume-enhance-btn",loading:eI===t,onClick:()=>te(t)}),eR[t]?(0,s.jsx)("small",{className:"text-red-700 block mt-2",children:eR[t]}):null]})]})]},`project-editor-${t}`)),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-plus",label:"Add another project",onClick:()=>k(e=>[...e,P()]),className:"mb-3"})]}):"certifications"===l.type?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-download",text:!0,label:"Fill from profile",onClick:e5,loading:ed}),em?(0,s.jsx)("small",{className:"block text-red-600 mt-2",children:em}):null]}),_.map((e,t)=>(0,s.jsxs)("div",{className:"resume-entry-card",children:[(0,s.jsxs)("div",{className:"flex align-items-center justify-content-between mb-2",children:[(0,s.jsxs)("strong",{children:["Certification ",t+1]}),(0,s.jsx)(o.$,{type:"button",text:!0,severity:"danger",icon:"pi pi-trash",disabled:1===_.length,onClick:()=>W(e=>1===e.length?e:e.filter((e,a)=>a!==t))})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Certification name"}),(0,s.jsx)(d.S,{value:e.name,onChange:e=>W(a=>a.map((a,s)=>s===t?{...a,name:e.target.value}:a)),className:"w-full",placeholder:"e.g. AWS Certified Developer Associate"})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Issuer"}),(0,s.jsx)(d.S,{value:e.issuer,onChange:e=>W(a=>a.map((a,s)=>s===t?{...a,issuer:e.target.value}:a)),className:"w-full",placeholder:"e.g. Amazon Web Services"})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Date"}),(0,s.jsx)(c.V,{value:eZ(e.date),view:"month",dateFormat:"M yy",showIcon:!0,onChange:e=>W(a=>a.map((a,s)=>s===t?{...a,date:eG(e.value)}:a)),className:"w-full",placeholder:"Select certification date"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Details"}),(0,s.jsx)(u.Z,{rows:4,value:e.details,onChange:e=>W(a=>a.map((a,s)=>s===t?{...a,details:e.target.value}:a)),className:"w-full",placeholder:"e.g. Credential ID, relevant modules, or outcomes."}),(0,s.jsxs)("div",{className:"mt-2",children:[(0,s.jsx)(o.$,{type:"button",label:"Enhance",icon:"pi pi-sparkles",className:"resume-enhance-btn",loading:eL===t,onClick:()=>tt(t)}),eU[t]?(0,s.jsx)("small",{className:"text-red-700 block mt-2",children:eU[t]}):null]})]})]},`certification-editor-${t}`)),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-plus",label:"Add another certification",onClick:()=>W(e=>[...e,A()]),className:"mb-3"})]}):"languages"===l.type?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-download",text:!0,label:"Fill from profile",onClick:e3,loading:en}),eo?(0,s.jsx)("small",{className:"block text-red-600 mt-2",children:eo}):null]}),K.map((e,t)=>(0,s.jsxs)("div",{className:"resume-entry-card",children:[(0,s.jsxs)("div",{className:"flex align-items-center justify-content-between mb-2",children:[(0,s.jsxs)("strong",{children:["Language ",t+1]}),(0,s.jsx)(o.$,{type:"button",text:!0,severity:"danger",icon:"pi pi-trash",disabled:1===K.length,onClick:()=>z(e=>1===e.length?e:e.filter((e,a)=>a!==t))})]}),(0,s.jsx)("label",{className:"block text-sm mb-2",children:"Language"}),(0,s.jsx)(d.S,{value:e.name,onChange:e=>z(a=>a.map((a,s)=>s===t?{...a,name:e.target.value}:a)),className:"w-full",placeholder:"e.g. English"})]},`language-editor-${t}`)),(0,s.jsx)(o.$,{type:"button",text:!0,icon:"pi pi-plus",label:"Add another language",onClick:()=>z(e=>[...e,D()]),className:"mb-3"})]}):(0,s.jsxs)(s.Fragment,{children:["header"===l.type?(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)(o.$,{type:"button",icon:"pi pi-download",text:!0,label:"Fill from profile",onClick:e4,loading:eh}),ef?(0,s.jsx)("small",{className:"block text-red-600 mt-2",children:ef}):null]}):null,"header"===l.type&&n?(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"resume-photo-upload-label",children:"Profile photo"}),(0,s.jsx)(eQ,{photoUrl:String(f.photoUrl??""),onChange:e=>{ej(""),g(t=>({...t,photoUrl:e}))},onError:ej}),ev?(0,s.jsx)("small",{className:"block text-red-600 mt-2",children:ev}):null,(0,s.jsx)("small",{className:"resume-photo-upload-footnote",children:"Shown on photo templates in the sidebar or header band."})]}):null,ez[l.type].map(e=>(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("label",{className:"block text-sm mb-2",children:e.label}),e.multiline?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.Z,{rows:4,value:String(f[e.key]??""),onChange:t=>g(a=>({...a,[e.key]:t.target.value})),className:"w-full",placeholder:`Enter ${e.label.toLowerCase()}`}),"summary"===l.type&&"text"===e.key&&eN?(0,s.jsx)("small",{className:"text-red-700 block mt-2",children:eN}):null,"custom"===l.type&&"content"===e.key&&eO?(0,s.jsx)("small",{className:"text-red-700 block mt-2",children:eO}):null]}):e.key.toLowerCase().includes("date")?(0,s.jsx)(c.V,{value:eZ(String(f[e.key]??"")),view:"month",dateFormat:"M yy",showIcon:!0,onChange:t=>g(a=>({...a,[e.key]:eG(t.value)})),className:"w-full",placeholder:`Select ${e.label.toLowerCase()}`}):(0,s.jsx)(d.S,{value:String(f[e.key]??""),onChange:t=>g(a=>({...a,[e.key]:t.target.value})),className:"w-full",placeholder:`Enter ${e.label.toLowerCase()}`})]},e.key))]})]}),(0,s.jsxs)("div",{className:"resume-section-editor-footer",children:[(0,s.jsx)("div",{children:"summary"===l.type||"custom"===l.type?(0,s.jsx)(o.$,{type:"button",label:"Enhance",icon:"pi pi-sparkles",className:"resume-enhance-btn",loading:"summary"===l.type?eS:eH,onClick:"summary"===l.type?e6:ta}):null}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(o.$,{type:"button",text:!0,label:"Cancel",onClick:p}),(0,s.jsx)(o.$,{type:"button",label:"Save",onClick:()=>
1{if(h.trim()){if("experience"===l.type)return void r({...l,title:h.trim(),data:{entries:x}});if("education"===l.type)return void r({...l,title:h.trim(),data:{entries:v}});if("skills"===l.type)return void r({...l,title:h.trim(),data:{entries:S}});if("projects"===l.type)return void r({...l,title:h.trim(),data:{entries:N}});if("certifications"===l.type)return void r({...l,title:h.trim(),data:{entries:_}});if("languages"===l.type)return void r({...l,title:h.trim(),data:{entries:K}});r({...l,title:h.trim(),data:f})}}})]})]}),(0,s.jsx)(eg,{visible:null!=eK,proposal:eK,onCancel:()=>eJ(null),onApply:()=>{if(!eK)return;let e=e8(),t=`Enhanced content applied to ${eK.sectionLabel}.`,a=null;if("summary"===eK.kind){let t={...f,text:eK.proposedContent};g(t),a={...l,title:e,data:t}}else if("custom"===eK.kind){let t={...f,content:eK.proposedContent};g(t),a={...l,title:e,data:t}}else if("experience"===eK.kind&&null!=eK.index){let t=x.map((e,t)=>t===eK.index?{...e,achievements:eK.proposedContent}:e);b(t),a={...l,title:e,data:{entries:t}}}else if("education"===eK.kind&&null!=eK.index){let t=v.map((e,t)=>t===eK.index?{...e,details:eK.proposedContent}:e);j(t),a={...l,title:e,data:{entries:t}}}else if("projects"===eK.kind&&null!=eK.index){let t=N.map((e,t)=>t===eK.index?{...e,details:eK.proposedContent}:e);k(t),a={...l,title:e,data:{entries:t}}}else if("certifications"===eK.kind&&null!=eK.index){let t=_.map((e,t)=>t===eK.index?{...e,details:eK.proposedContent}:e);W(t),a={...l,title:e,data:{entries:t}}}a&&(m(a,t),eX(t)),eJ(null)}})]})}}}]);
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.