PageSourceSearch

https://maieutic.ca/assets/PublicClientPortalRoute-BXaEHLFR.js

js maieutic.ca collected 2026-10-01 15:03:00 UTC 66,681 bytes, 1 lines download raw bytes

1import{j as e,R as m,d as Le,u as Pe,r as O,c as Ie}from"./index-DbENjIaX.js";import{a as Te}from"./portalAccentYellow-D9o9ZDbY.js";import{E as Me}from"./EngagementWizardCelebrationBanner-t_8v6Po-.js";import{C as Ve}from"./ClientLogoMark-D-0ua6dc.js";import{P as $e}from"./PreEmploymentEngagementWizardModal-Ct7_FXU8.js";import{E as Oe}from"./EngagementWizardActionConfirmationModal-BPa_z0Cp.js";import{c as Fe,f as De,P as Ue}from"./publicClientPortalRouteResponsiveFixes-ngGgVU2C.js";import{C as Be,a as ze}from"./icons-Bs-YOTv4.js";import{a as J,t as qe,e as re,q as We,c as ye,u as _e,k as He,v as ke,L as le,f as Ke,w as Je,o as oe,x as Ze,y as Ye,z as Ge,A as Xe,B as Qe,C as et}from"./index-BvanFLXZ.js";import{b as tt}from"./normalizedResume-_nRB_G2w.js";import{r as de,a as nt}from"./itinerary-CMk2Z1Pa.js";import{N as st}from"./JobDescriptionCareerPreviewCardLead-bqjTbCAS.js";import{R as rt}from"./ReferenceListCard-DWoXGMIJ.js";import{R as lt}from"./ReferenceReportDocument-Bc9Ok97a.js";import"./recruiterAppOrigin-BKo--0zc.js";import"./originUtils-DijZYY3r.js";import"./jobColors-CfmKVWEF.js";import"./iconRegistry-B1T0q4BA.js";import"./engagement-wizard-45wYq_Xn.js";import"./Modal-C9bvt6v9.js";import"./displayProfile-CATPA6mH.js";import"./htmlPlainText-Wtwhqbo9.js";import"./careerListingDisplayTitle-C15yTJw8.js";import"./effectiveClientIdentity-8Q5f6xny.js";import"./useInterviewReportQaViewState-Do_fVJaK.js";import"./FastTooltip-CxPvouaq.js";import"./useMediaQuery-DCCIdQf5.js";import"./SafeHtmlContent-CFY6uaoB.js";import"./EditableItineraryMapPanel-DDBE0yVs.js";import"./PlacesAutocompleteInput-CGJjVdVf.js";import"./clients-_K2CO-pK.js";import"./useObjectUrl-B5QyUE2R.js";import"./InterviewReportDocumentSurface-D0UE7KKK.js";import"./CandidateProfileQAModal-CPrLzWwE.js";import"./GeminiVoiceInterviewPanel-D2f90KdZ.js";import"./publicVoiceBrowserCapability-DRRtzk_Y.js";import"./liveCallTranscriptionControls-1tI1j2gQ.js";import"./sanitize-BZWg29nX.js";import"./maieuticLogoMark-BEwngr14.js";import"./itineraryMapUtils-CXH_1KG8.js";import"./primaryClientSite-Bq21KgUH.js";const it=({selectId:t,label:n="Candidat à réviser",reviewCount:r,reviewOptions:s,selectedCandidateId:l,onSelectCandidate:c,collapsed:i=!1,onToggleCollapsed:o})=>{const d=typeof o=="function",j=i?`Afficher le panneau ${n}`:`Réduire le panneau ${n}`;return e.jsxs("section",{className:`rf-client-portal-card rf-client-portal-review-picker-card ${i?"is-collapsed":""}`,children:[e.jsxs("div",{className:"rf-client-portal-review-picker-head",children:[e.jsx("label",{className:"rf-client-portal-label",htmlFor:t,children:n}),e.jsxs("div",{className:"rf-client-portal-review-picker-meta",children:[e.jsx("div",{className:"rf-client-portal-pill",children:r}),d?e.jsx("button",{type:"button",className:"rf-client-portal-review-picker-toggle","aria-label":j,"aria-expanded":!i,onClick:o,children:i?e.jsx(Be,{className:"h-4 w-4"}):e.jsx(ze,{className:"h-4 w-4"})}):null]})]}),e.jsx("div",{className:"rf-client-portal-review-picker-body",children:s.length===0?e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun candidat disponible."}):e.jsx("select",{id:t,className:"rf-client-portal-select",value:l||"",onChange:u=>c(u.target.value||null),children:s.map(u=>e.jsx("option",{value:u.id,children:u.name},u.id))})})]})},ie=t=>{if(typeof t!="string"||!t.trim())return null;const n=new Date(t);return Number.isFinite(n.getTime())?n:null},Q=(t,n,r)=>{const s=ie(t);if(!s)return"Date à confirmer";const l=ie(n),c=s.toLocaleDateString("fr-CA",{year:"numeric",month:"long",day:"numeric",timeZone:r||void 0}),i=s.toLocaleTimeString("fr-CA",{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:r||void 0}),o=l?l.toLocaleTimeString("fr-CA",{hour:"2-digit",minute:"2-digit",hour12:!1,timeZone:r||void 0}):null;return`${c} à ${i}${o?` - ${o}`:""}`},ee=t=>{const n=ie(t);return n?n.toLocaleDateString("fr-CA",{year:"numeric",month:"long",day:"numeric"}):"—"},Ee=t=>{const n=t==null?void 0:t.availabilityProgress;if(!n)return{headline:"—",detail:"Aucun suivi des créneaux"};switch(n.code){case"awaiting_candidate_response":return{headline:"En attente du candidat",detail:"Le client a proposé des créneaux."};case"candidate_proposed_new_slots":return{headline:"Nouveaux créneaux reçus",detail
1:"Le candidat a proposé des créneaux."};case"interview_confirmed":return{headline:"Entrevue confirmée",detail:n.interviewAt?ee(n.interviewAt):"Date confirmée"};case"awaiting_schedule":return{headline:"Créneaux à définir",detail:"Aucun créneau confirmé pour l’instant."};default:return{headline:"—",detail:"Aucun suivi des créneaux"}}},ue=new Set(["Sent to Client","Sent to Client (Portal)","Envoyé au client","Envoyer au client","Client Approval"]),pe={consent_not_signed:"le consentement candidat n’est pas encore signé",references_not_published:"les références demandées ne sont pas encore complétées",verification_items_not_completed:"certaines vérifications demandées ne sont pas encore complétées",readiness_unavailable:"l’état des vérifications ne peut pas être confirmé pour le moment"},te=new Set(["Engaged","Rejected"]);function me(t){return t==="Engaged"?"Candidat engagé":t==="Rejected"?"Candidature refusée":"Candidat"}const he=({payload:t,submitting:n,successMessage:r,successAction:s=null,clearSuccessMessage:l=()=>{},submitDecision:c,consentSaving:i,saveConsent:o})=>{var R,$,q,B,f,S,D,z,F,T;const[d,j]=m.useState(""),[u,h]=m.useState(""),[a,b]=m.useState(""),[y,E]=m.useState(!1),[_,g]=m.useState(null),C=m.useMemo(()=>new Set(t.decision.allowedActions),[t.decision.allowedActions]),v=m.useCallback(I=>C.has(I),[C]),V=!!(C.size&&((R=t==null?void 0:t.candidate)!=null&&R.id)),L=!!(($=t.decision.preEmploymentCheckpoint)!=null&&$.active||t.decision.currentStatus==="Pre-employment Verification"),M=L||v("post_interview_engaged"),w=!L&&v("post_interview_continue_process"),P=((q=t.decision.preEmploymentCheckpoint)==null?void 0:q.readiness)||null,A=L&&!v("post_interview_engaged"),p=P!=null&&P.reason&&pe[P.reason]?pe[P.reason]:null,N=Q(((B=t.interview)==null?void 0:B.start)||null,((f=t.interview)==null?void 0:f.end)||null,((S=t.interview)==null?void 0:S.timeZone)||null),x=((D=t.interview)==null?void 0:D.mode)==="virtual"?"Visioconférence":"En présence",k=((z=t.candidate)==null?void 0:z.name)||"Le candidat";return e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsx("div",{className:"rf-client-portal-section-head",children:e.jsxs("div",{children:[e.jsx("h2",{children:"Décision post-entrevue"}),e.jsxs("p",{className:"rf-client-portal-muted",children:["Entrevue: ",N," · Mode: ",x]})]})}),(F=t.portalConsent)!=null&&F.acknowledged?null:e.jsx("button",{type:"button",className:"rf-client-portal-secondary",onClick:()=>void o(),disabled:i,children:i?"Enregistrement…":"Enregistrer mon consentement"}),V?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rf-client-portal-actions rf-client-portal-post-decision-actions",children:[w?e.jsx("button",{type:"button",className:"rf-client-portal-btn rf-client-portal-post-decision-hiring-process",disabled:n||!v("post_interview_continue_process"),onClick:()=>g("post_interview_continue_process"),children:"Entamer processus d'embauche"}):null,M?e.jsx("button",{type:"button",className:"rf-client-portal-btn rf-client-portal-btn-success",disabled:n||!v("post_interview_engaged"),onClick:()=>void c({action:"post_interview_engaged",notes:a}),children:"Engager directement"}):null,e.jsx("button",{type:"button",className:"rf-client-portal-secondary rf-client-portal-post-decision-secondary",disabled:n||!v("post_interview_still_deciding"),onClick:()=>void c({action:"post_interview_still_deciding",notes:a}),children:"Toujours en décision"}),e.jsx("button",{type:"button",className:"rf-client-portal-btn rf-client-portal-btn-danger",disabled:n||!v("post_interview_rejected"),onClick:()=>E(!0),children:"Rejeter le candidat"}),e.jsx("button",{type:"button",className:"rf-client-portal-btn rf-client-portal-post-decision-no-show rf-client-portal-post-decision-no-show-action",disabled:n||!v("post_interview_no_show"),onClick:()=>void c({action:"post_interview_no_show",notes:a}),children:"Candidat absent (no-show)"})]}),A?e.jsxs("p",{className:"rf-client-portal-muted",role:"status",children:["Les vérifications préembauche sont en cours. Le candidat pourra être engagé lorsque les éléments demandés seront complétés",p?` : ${p}.`:"."]}):null,y?e.jsxs("div",{className:"rf-client-portal-reject-block",children:[e.jsx("label",{className:"rf-client-portal-label",htmlFor:"post-reject-reason",children:"Motif de refus"}),e.jsxs("select",{id:"post-reject-reason",className:"rf-client-portal-select",value:d,onChange:I=>j(I.target.value),disabled:n,children:[e.jsx("option",{value:"",children:"Sélectionner un motif"}),t.decision.rejectionTemplates.map(I=>e.jsx("option",{value:I.label||"",children:I.label||"Motif"},I.id||I.label))]}),e.jsx("label",{className:"rf-client-portal-label",htmlFor:"post-reject-custom",children:"Détails (optionnel)"}),e.jsx("input",{id:"post-reject-custom",className:"rf-client-portal-input",type:"text",value:u,onChange:I=>h(I.target.value),placeholder:"Précision libre",disabled:n}),e.jsx("button",{type:"button",className:"rf-client-portal-btn rf-client-portal-btn-danger",disabled:n||!v("post_interview_rejected")||!d&&!u,onClick:()=>void c({action:"post_interview_rejected",reasonLabel:d,customReason:u,notes:a}),children:"Confirmer le refus"})]}):null,e.jsx("label",{className:"rf-client-portal-label",htmlFor:"post-decision-notes",children:"Notes (optionnel)"}),e.jsx("textarea",{id:"post-decision-notes",className:"rf-client-portal-textarea",value:a,onChange:I=>b(I.target.value),placeholder:"Ajoutez un contexte pour le recruteur",disabled:n}),_==="post_interview_continue_process"?e.jsx($e,{isOpen:!0,isSubmitting:n,candidateName:(T=t.candidate)==null?void 0:T.name,variant:"checkpoint",onClose:()=>g(null),onSubmit:async I=>{await c({action:"post_interview_continue_process",notes:a,preEmploymentVerification:I})}}):null]}):e.jsx("p",{className:"rf-client-portal-muted",children:"Cette candidature ne peut plus être modifiée depuis ce lien."}),r&&s&&s!=="post_interview_continue_process"?e.jsx(Oe,{isOpen:!0,title:s==="post_interview_engaged"?"Candidat engagé":s==="post_interview_still_deciding"?"Décision en attente":s==="post_interview_rejected"?"Refus confirmé":s==="post_interview_no_show"?"Absence enregistrée":"Action enregistrée",message:s==="post_interview_engaged"?`Félicitations! Vous avez engagé ${k} ! Votre recruteur recevra automatiquement une notification de votre décision.`:s==="post_interview_still_deciding"?"La décision reste en attente. Le recruteur a bien été informé de ce statut.":s==="post_interview_rejected"?"Le candidat est désormais marqué Refusé dans le portail.":s==="post_interview_no_show"?`${k} a été marqué comme ne s'étant jamais présenté. Le suivi de dossier a été mis à jour.`:"Votre action a bien été enregistrée.",closeLabel:"Terminé",onClose:l}):null]})},at=({payload:t,selectedCandidateId:n,setCandidateId:r,submitting:s,successMessage:l,successAction:c,clearSuccessMessage:i,submitDecision:o,consentSaving:d,saveConsent:j})=>{const u=m.useMemo(()=>t.candidates||[],[t.candidates]),h=m.useMemo(()=>{const v=u.filter(V=>{const L=(V==null?void 0:V.status)||"";return L==="Physical Interview"||L==="Pre-employment Verification"||ue.has(L)});return v.length>0?v:u},[u]),a=h.find(v=>v.id===n)||h.find(v=>v.selected)||h[0]||null,b=(a==null?void 0:a.status)||null,y=(a==null?void 0:a.preInterviewReportAccessToken)||null,E=b?ue.has(b):!1,_=a?Ee(a):null,g=m.useMemo(()=>h.filter(v=>typeof(v==null?void 0:v.id)=="string"&&v.id.trim().length>0).map(v=>({id:v.id,name:v.name})),[h]),C=()=>e.jsx(it,{selectId:"decision-candidate-select",label:te.has(b||"")?me(b):void 0,reviewCount:h.length,reviewOptions:g,selectedCandidateId:(a==null?void 0:a.id)||null,onSelectCandidate:r});return e.jsx("div",{className:"rf-client-portal-main-stack",children:E?e.
1jsx(Fe,{reportToken:y,reviewCount:h.length,reviewOptions:g,selectedCandidateId:(a==null?void 0:a.id)||null,onSelectCandidate:r}):b==="Physical Interview"?e.jsxs(e.Fragment,{children:[C(),e.jsx(he,{payload:t,submitting:s,successMessage:l,successAction:c,clearSuccessMessage:i,submitDecision:o,consentSaving:d,saveConsent:j})]}):b==="Pre-employment Verification"?e.jsxs(e.Fragment,{children:[C(),e.jsx(he,{payload:t,submitting:s,successMessage:l,successAction:c,clearSuccessMessage:i,submitDecision:o,consentSaving:d,saveConsent:j})]}):e.jsxs(e.Fragment,{children:[C(),e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsx("h2",{children:te.has(b||"")?me(b):"Espace décision"}),te.has(b||"")?null:e.jsx("p",{className:"rf-client-portal-muted",children:"Sélectionnez un candidat pour afficher les actions disponibles."}),_?e.jsx("div",{className:"rf-client-portal-actions-row",children:e.jsx("span",{className:"rf-client-portal-pill",children:_.headline})}):null]})]})})},ct=["post_interview_no_show","post_interview_continue_process","post_interview_engaged","post_interview_rejected","post_interview_still_deciding"],ot=["cancel_client_interview","counter_propose_slots","reschedule_client_interview"],dt=t=>typeof t=="string"&&ot.includes(t),ut=t=>typeof t=="string"&&ct.includes(t),U=t=>!!t&&typeof t=="object"&&!Array.isArray(t),pt={portal:{ingress:"public-alias",path:"/api/public-client-portal"},action:{ingress:"ai-path",path:"/api/ai?path=public-client-post-interview-action"},interviewAction:{ingress:"ai-path",path:"/api/ai?path=public-client-action"},consent:{ingress:"ai-path",path:"/api/ai?path=portal-consent"},cv:{ingress:"ai-path",path:"/api/ai?path=public-client-cv"}},Z=(t,n={})=>{const r=pt[t],s=new URL(r.path,"https://app.maieutic.ca");for(const[l,c]of Object.entries(n))typeof c=="string"&&c.length>0&&s.searchParams.set(l,c);return`${s.pathname}${s.search}`},Y=async t=>{try{const n=await t.json();return U(n)?n:{}}catch{return{}}},G=(t,n)=>typeof t[n]=="string",fe=t=>t===null||U(t),mt=t=>{const n=t.job,r=t.client,s=t.candidate,l=t.decision;if(!U(n)||!G(n,"id")||!G(n,"title")||!U(r)||!G(r,"id")||!G(r,"name")||!fe(s)||!Array.isArray(t.candidates)||!U(l)||!Array.isArray(l.allowedActions)||!Array.isArray(l.rejectionTemplates))throw new Error("Réponse du portail invalide.");if(!l.allowedActions.every(ut))throw new Error("Réponse du portail invalide.");const c=U(t.dashboard)?t.dashboard:null,i=U(c==null?void 0:c.interviews)?c.interviews:null,o=U(i)?i.items:void 0;if(Array.isArray(o)&&o.some(j=>!fe(j)))throw new Error("Réponse du portail invalide.");if(s&&(typeof s.id!="string"||typeof s.name!="string"))throw new Error("Réponse du portail invalide.");return t},ht=async t=>{const n=await fetch(Z("portal",{token:t.token,candidateId:t.candidateId}),{method:"GET",headers:{Accept:"application/json"}}),r=await Y(n);if(!n.ok)throw new Error(typeof r.error=="string"?r.error:"Lien expiré ou invalide.");return mt(r)},ft=async t=>{const n=await fetch(Z("action"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({token:t.token,action:t.action,payload:t.payload})}),r=await Y(n);if(!n.ok)throw new Error(typeof r.error=="string"?r.error:"Erreur lors de l’enregistrement.");return r},xt=async t=>{if(!dt(t.action))throw new Error("Action d’entrevue invalide.");const n=await fetch(Z("interviewAction"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({token:t.token,action:t.action,payload:t.payload})}),r=await Y(n);if(!n.ok)throw new Error(typeof r.error=="string"?r.error:"Erreur lors de l’enregistrement.");return r},jt=async t=>{const n=await fetch(Z("consent"),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({token:t.token,context:"client_portal"})}),r=await Y(n);if(!n.ok)throw new Error(typeof r.error=="string"?r.error:"Erreur lors de l’enregistrement du consentement.")},bt=async t=>{const n=await fetch(Z("cv",{token:t.token,candidateId:t.candidateId}),{method:"GET",headers:{Accept:"application/json"}}),r=await Y(n);if(!n.ok)throw new Error(typeof r.error=="string"?r.error:"Aucun CV n’est disponible.");const s=r.file,l=r.normalizedResume,c=U(s)&&typeof s.base64=="string"&&typeof s.type=="string"?{base64:s.base64,type:s.type,name:typeof s.name=="string"?s.name:null}:null,i=U(l)&&typeof l.text=="string"?l.text:null,o=U(l)&&U(l.structured)?l.structured:null,d=i||o?{text:i,structured:o,structuredVersion:U(l)&&typeof l.structuredVersion=="str
1ing"?l.structuredVersion:null,fileName:(c==null?void 0:c.name)||null,fileType:(c==null?void 0:c.type)||null}:null;if(!c&&!d)throw new Error("Aucun CV n’est disponible.");return{file:c,normalizedResume:d}},vt=(t,n)=>{const r=typeof t=="string"?t.trim():"";if(!r)return null;const s=atob(r),l=s.length,c=new Uint8Array(l);for(let i=0;i<l;i+=1)c[i]=s.charCodeAt(i);return new Blob([c],{type:n||"application/pdf"})},xe=(t,n)=>{const r=document.createElement("a");r.href=t,r.download=n,r.rel="noopener noreferrer",document.body.appendChild(r),r.click(),r.remove()},Se=({candidate:t,onClose:n,portalToken:r})=>{var x,k,R,$,q,B;const s=m.useRef(null),[l,c]=m.useState(null),[i,o]=m.useState(null),[d,j]=m.useState(null),[u,h]=m.useState(!1),[a,b]=m.useState(null),[y,E]=m.useState(!1),[_,g]=m.useState(null),[C,v]=m.useState(null),V=m.useMemo(()=>{var f,S;return de({cvText:(f=t.resume)==null?void 0:f.text,cvStructured:(S=t.resume)==null?void 0:S.structured,fallbackName:t.name})},[t.name,(x=t.resume)==null?void 0:x.structured,(k=t.resume)==null?void 0:k.text]),L=m.useMemo(()=>de({cvText:C==null?void 0:C.text,cvStructured:C==null?void 0:C.structured,fallbackName:t.name}),[t.name,C==null?void 0:C.structured,C==null?void 0:C.text]),M=!!V.trim(),w=M?V:L,P=M?(R=t.resume)==null?void 0:R.structured:C==null?void 0:C.structured,A=!!w.trim(),p=m.useMemo(()=>A?nt(w,"#ffbf23",{fallbackName:t.name,structuredValue:P}):"",[t.name,A,P,w]);m.useEffect(()=>{g(null)},[t.id]),m.useEffect(()=>{h(!1),b(null),o(null),j(null),v(null),c(f=>(f&&URL.revokeObjectURL(f),s.current=null,null))},[t.id]),m.useEffect(()=>{if(M)return;if(!t.id||!r){b("Aucun CV n’est disponible pour ce candidat.");return}let f=!1,S=null;return h(!0),b(null),(async()=>{var D,z;try{const F=await bt({token:r,candidateId:t.id}),T=F.file,I=T?vt(T.base64,T.type):null;if(!I&&!F.normalizedResume)throw new Error("Aucun CV n’est disponible.");if(I&&(S=URL.createObjectURL(I)),f&&S){URL.revokeObjectURL(S);return}if(f)return;F.normalizedResume&&v(F.normalizedResume),S&&c(W=>(W&&URL.revokeObjectURL(W),s.current=S,S)),j((T==null?void 0:T.type)||((D=t.resume)==null?void 0:D.fileType)||null),o((T==null?void 0:T.name)||((z=t.resume)==null?void 0:z.fileName)||"cv")}catch(F){if(f)return;c(T=>(T&&URL.revokeObjectURL(T),s.current=null,null)),v(null),j(null),o(null),b((F==null?void 0:F.message)||"Aucun CV n’est disponible.")}finally{f||h(!1)}})(),()=>{f=!0,S&&URL.revokeObjectURL(S)}},[t.id,($=t.resume)==null?void 0:$.fileName,(q=t.resume)==null?void 0:q.fileType,M,r]),m.useEffect(()=>()=>{s.current&&(URL.revokeObjectURL(s.current),s.current=null)},[]);const N=m.useCallback(async()=>{if(g(null),A){try{E(!0);const f=await tt({resumeHtml:w,candidateName:t.name||"candidat",structuredValue:P});xe(`data:application/pdf;base64,${f.base64}`,f.filename)}catch{g("Impossible de générer le PDF du CV pour le moment.")}finally{E(!1)}return}if(!l){g("Aucun CV téléchargeable n’est disponible.");return}xe(l,i||"cv-original.pdf")},[t.name,A,P,w,l,i]);return e.jsxs("div",{className:"rf-client-portal-modal",role:"dialog","aria-modal":!0,children:[e.jsx("button",{type:"button","aria-label":"Fermer le CV",className:"rf-client-portal-modal-backdrop",onClick:n}),e.jsxs("section",{className:"rf-client-portal-modal-card",children:[e.jsxs("div",{className:"rf-client-portal-modal-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"rf-client-portal-eyebrow",children:"CV du candidat"}),e.jsx("h3",{children:t.name}),e.jsx("p",{className:"rf-client-portal-muted",children:A?"Version normalisée":(B=t.resume)!=null&&B.fileName?`Fichier: ${t.resume.fileName}`:"CV original"})]}),e.jsx("button",{type:"button",className:"rf-client-portal-mobile-close",onClick:n,"aria-label":"Fermer",children:e.jsx(J,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"rf-client-portal-resume-viewer-shell",children:[e.jsx("div",{className:"rf-client-portal-resume-viewer-actions",children:e.jsxs("button",{type:"button",className:"rf-client-portal-secondary",onClick:()=>void N(),disabled:y||u,children:[e.jsx(qe,{className:"h-4 w-4","aria-hidden":!0}),y?"Préparation du PDF…":"Télécharger en PDF"]})}),_?e.jsx("p",{className:"rf-client-portal-inline-error",children:_}):null,A?e.jsx(st,{html:p,heightClassName:null,className:"rf-client-portal-resume-normalized",contentClassName:"rf-client-portal-resume-normalized-content",title:t.name?`CV normalisé de ${t.name}`:"CV normalisé"}):u?e.jsx("p",{className:"rf-client-portal-muted",role:"status",children:"Chargement du CV…"}):a?e.jsx("p",{className:"rf-client-portal-inline-error",children:a}):l?e.jsx("iframe",{title:`CV original ${t.name}`,className:"rf-client-portal-resume-viewer-frame",src:l}):e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun CV n’est disponible pour ce candidat."})]})]})]})},wt=t=>({id:t.id,name:t.name,status:t.status,distanceKm:null,location:null,transportModes:[],resume:t.resume||{text:null,fileName:null,fileType:null}}),Nt=t=>{var n,r,s;return!!(t.id||(n=t.resume)!=null&&n.text||(r=t.resume)!=null&&r.fileName||(s=t.resume)!=null&&s.fileType)},gt=(t,n)=>n?`${t}/${n} complétée(s)`:"Aucune provision",Ct=({payload:t,portalToken:n,setActiveSection:r})=>{var i,o;const s=((o=(i=t.dashboard)==null?void 0:i.engagedCandidates)==null?void 0:o.items)||[],[l,c]=m.useState(null);return e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsxs("div",{className:"rf-client-portal-section-head",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Candidats engagés"}),e.jsx("p",{className:"rf-client-portal-muted",children:"Candidats confirmés, rapports disponibles, CV et suivi des enquêtes."})]}),e.jsxs("div",{className:"rf-client-portal-pill",children:[s.length," candidat(s)"]})]}),s.length===0?e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun candidat engagé n’est disponible pour ce mandat."}):e.jsx("div",{className:"rf-client-portal-table-wrap",children:e.jsxs("table",{className:"rf-client-portal-table",role:"table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidat"}),e.jsx("th",{children:"CV"}),e.jsx("th",{children:"Rapports"}),e.jsx("th",{children:"Enquête et références"})]})}),e.jsx("tbody",{children:s.map(d=>{const j=d.reports[0]||null,u=d.verification;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("strong",{children:d.name}),e.jsx("p",{className:"rf-client-portal-muted",children:d.status})]}),e.jsx("td",{children:e.jsxs("button",{type:"button",className:"rf-client-portal-secondary",onClick:()=>c(wt(d)),disabled:!Nt(d),"aria-label":`Ouvrir le CV de ${d.name}`,children:[e.jsx(re,{className:"h-4 w-4","aria-hidden":!0}),e.jsx("span",{children:"CV"})]})}),e.jsxs("td",{children:[j!=null&&j.publicUrl?e.jsxs("a",{className:"rf-client-portal-secondary",href:j.publicUrl,target:"_blank",rel:"noreferrer","aria-label":`Ouvrir le rapport de ${d.name}`,children:[e.jsx(We,{className:"h-4 w-4","aria-hidden":!0}),e.jsxs("span",{children:["Rapport",j.createdAt?` · ${ee(j.createdAt)}`:""]})]}):e.jsx("span",{className:"rf-client-portal-muted",children:"Aucun rapport visible"}),d.reports.length>1?e.jsxs("p",{className:"rf-client-portal-muted",children:[d.reports.length," rapport(s) visible(s)"]}):null]}),e.jsx("td",{children:u?e.jsxs("div",{className:"rf-client-portal-engaged-ver
1ification",children:[e.jsxs("div",{className:"rf-client-portal-actions-row",children:[e.jsxs("span",{className:"rf-client-portal-pill",children:["Consentement:"," ",u.consentStatus||"en attente"]}),e.jsx("span",{className:"rf-client-portal-pill",children:gt(u.completedItems,u.totalItems)}),e.jsxs("span",{className:"rf-client-portal-pill",children:["Références: ",u.submittedReferences,"/",u.totalReferences]})]}),e.jsxs("button",{type:"button",className:"rf-client-portal-secondary",onClick:()=>r("preemployment_verifications"),children:[e.jsx(ye,{className:"h-4 w-4","aria-hidden":!0}),e.jsx("span",{children:"Voir enquête et références"})]})]}):e.jsx("span",{className:"rf-client-portal-muted",children:"Aucune demande ouverte"})})]},d.id||d.name)})})]})}),l?e.jsx(Se,{candidate:l,onClose:()=>c(null),portalToken:n}):null]})},yt=t=>t.timeZone||Intl.DateTimeFormat().resolvedOptions().timeZone||"America/Toronto",X=t=>String(t).padStart(2,"0"),_t=t=>{if(!t)return"";const n=new Date(t);return Number.isFinite(n.getTime())?`${n.getFullYear()}-${X(n.getMonth()+1)}-${X(n.getDate())}T${X(n.getHours())}:${X(n.getMinutes())}`:""},kt=t=>{const n=t.start?new Date(t.start).getTime():NaN,r=t.end?new Date(t.end).getTime():NaN,s=Math.round((r-n)/6e4);return Number.isFinite(s)&&s>0?s:60},Et=({payload:t,submitting:n,successMessage:r,clearSuccessMessage:s=()=>{},submitInterviewAction:l})=>{var L,M;const c=((M=(L=t.dashboard)==null?void 0:L.interviews)==null?void 0:M.items)||[],[i,o]=m.useState(null),[d,j]=m.useState(""),[u,h]=m.useState(60),[a,b]=m.useState(""),[y,E]=m.useState(null),_=i?yt(i):"America/Toronto",g=w=>{s(),E(null),b(""),j(_t(w.start)),h(kt(w)),o(w)},C=()=>{n||(o(null),E(null),b(""),j(""),h(60))},v=async()=>{if(!(i!=null&&i.candidateId))return;const w=new Date(d),P=Number(u);if(!d||!Number.isFinite(w.getTime())||!Number.isFinite(P)||P<=0){E("Sélectionnez une date, une heure et une durée valides.");return}const A=new Date(w.getTime()+P*6e4);E(null),await l({action:"reschedule_client_interview",candidateId:i.candidateId,eventId:i.eventId,start:w.toISOString(),end:A.toISOString(),timezone:_,mode:i.mode||"physical",notes:a.trim()||null}),C()},V=async w=>{w.candidateId&&(s(),await l({action:"cancel_client_interview",candidateId:w.candidateId,eventId:w.eventId}))};return c.length===0?e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsx("div",{className:"rf-client-portal-section-head",children:e.jsx("div",{children:e.jsx("h2",{children:"Entrevues"})})}),e.jsx("p",{className:"rf-client-portal-muted",children:"Aucune entrevue à venir pour ce mandat."})]}):e.jsxs("section",{className:"rf-client-portal-main-stack",children:[e.jsxs("div",{className:"rf-client-portal-card",children:[e.jsx("div",{className:"rf-client-portal-section-head",children:e.jsxs("div",{children:[e.jsx("h2",{children:"Entrevues"}),e.jsxs("p",{className:"rf-client-portal-muted",children:[t.job.title," · ",t.client.name]})]})}),r?e.jsx("p",{className:"rf-client-portal-success",children:r}):null]}),c.map(w=>{const P=w.mode==="virtual"?"Visioconférence":"En présence",A=w.mode==="virtual"?w.hangoutLink||"Lien de réunion à confirmer":w.location||"Lieu à confirmer",p=(i==null?void 0:i.candidateId)===w.candidateId;return e.jsxs("article",{className:"rf-client-portal-card rf-client-portal-interview-card",children:[e.jsxs("div",{className:"rf-client-portal-interview-card-main",children:[e.jsx("div",{className:"rf-client-portal-interview-icon",children:e.jsx(_e,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("h3",{children:w.candidateName}),e.jsx("p",{className:"rf-client-portal-muted",children:Q(w.start,w.end,w.timeZone)}),e.jsxs("p",{className:"rf-client-portal-interview-meta",children:[w.mode==="virtual"?e.jsx(He,{className:"h-4 w-4"}):e.jsx(ke,{className:"h-4 w-4"}),e.jsxs("span",{children:[P," · ",A]})]})]})]}),e.jsxs("div",{className:"rf-client-portal-actions-row",children:[e.jsx("button",{type:"button",className:"rf-client-portal-btn",disabled:n,onClick:()=>g(w),children:"Modifier la date et l’heure"}),e.jsx("button",{type:"button",className:"rf-client-portal-secondary",disabled:n,onClick:()=>void V(w),children:"Annuler l’entrevue"})]}),p?e.jsxs("div",{className:"rf-client-portal-interview-reschedule",children:[e.jsxs("div",{className:"rf-client-portal-interview-reschedule-head",children:[e.jsx("h4",{children:"Nouvelle date et heure"}),e.jsx("button",{type:"button",className:"rf-client-portal-icon-btn","aria-label":"Fermer la modification",onClick:C,disabled:n,children:e.jsx(J,{className:"h-4 w-4"})})]}),e.jsx("label",{className:"rf-client-portal-label",htmlFor:"client-interview-reschedule-start",children:"Date et heure"}),e.jsx("input",{id:"client-interview-reschedule-start",className:"rf-client-portal-input",type:"datetime-local",value:d,onChange:N=>j(N.target.value),disabled:n}),e.jsx("label",{className:"rf-client-portal-label",htmlFor:"client-interview-reschedule-duration",children:"Durée (minutes)"}),e.jsx("input",{id:"client-interview-reschedule-duration",className:"rf-client-portal-input",type:"number",min:15,step:15,value:u,onChange:N=>h(Number(N.target.value)),disabled:n}),e.jsx("label",{className:"rf-client-portal-label",htmlFor:"client-interview-reschedule-notes",children:"Notes"}),e.jsx("textarea",{id:"client-interview-reschedule-notes",className:"rf-client-portal-textarea",value:a,onChange:N=>b(N.target.value),disabled:n}),y?e.jsx("p",{className:"rf-client-portal-inline-error",role:"alert",children:y}):null,e.jsxs("div",{className:"rf-client-portal-actions-row",children:[e.jsx("button",{type:"button",className:"rf-client-portal-btn",disabled:n,onClick:()=>void v(),children:n?"Enregistrement…":"Mettre à jour l’entrevue"}),e.jsx("button",{type:"button",className:"rf-client-portal-secondary",disabled:n,onClick:C,children:"Fermer"})]})]}):null]},`${w.candidateId||"candidate"}-${w.start||"start"}`)})]})},St=t=>typeof t=="string"?t.trim():"",je=t=>
1{const n=t.split("/").filter(Boolean);return n.length<3||n[0]!=="public"||n[1]!=="report"&&n[1]!=="client"?null:decodeURIComponent(n[2]||"").trim()||null},Ae=t=>{const n=St(t);if(!n)return null;try{const r=new URL(n);return je(r.pathname)}catch{return je(n)}},At=t=>{const n=Array.isArray(t.reports)?t.reports:[];if(!n.length)return 0;const r=t.initialAccessToken.trim();if(r){const s=n.findIndex(l=>Ae(l==null?void 0:l.publicUrl)===r);if(s>=0)return s}if(t.selectedCandidateId){const s=n.findIndex(l=>(l==null?void 0:l.candidateId)===t.selectedCandidateId);if(s>=0)return s}return 0},Rt=({initialAccessToken:t,payload:n,isMainMenuExpanded:r})=>{var w,P,A,p,N;const s=m.useMemo(()=>{var k,R,$,q;return[...Array.isArray((R=(k=n.dashboard)==null?void 0:k.interviewReports)==null?void 0:R.items)?(q=($=n.dashboard)==null?void 0:$.interviewReports)==null?void 0:q.items:[]].sort((B,f)=>{const S=new Date((B==null?void 0:B.createdAt)||0).getTime();return new Date((f==null?void 0:f.createdAt)||0).getTime()-S})},[(P=(w=n.dashboard)==null?void 0:w.interviewReports)==null?void 0:P.items]),l=typeof((A=n.candidate)==null?void 0:A.id)=="string"&&n.candidate.id.trim()?n.candidate.id.trim():null,c=m.useMemo(()=>At({initialAccessToken:t,reports:s,selectedCandidateId:l}),[t,s,l]),[i,o]=m.useState(c),[d,j]=m.useState(!1),[u,h]=m.useState(null),[a,b]=m.useState(null),[y,E]=m.useState(!1);m.useEffect(()=>{if(!s.length){o(0),E(!1);return}o(x=>x>=s.length?c:x===c?x:c)},[c,s.length]),m.useEffect(()=>{if(!y||typeof window>"u")return;const x=k=>{k.key==="Escape"&&E(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[y]);const _=s[i]||null,g=Ae(_==null?void 0:_.publicUrl),C=r||y;m.useEffect(()=>{let x=!1;if(!g){b(null),h("Lien de rapport indisponible."),j(!1);return}return j(!0),h(null),b(null),(async()=>{try{const k=await De({token:g});if(x)return;b(k)}catch(k){if(x)return;h((k==null?void 0:k.message)||"Erreur de chargement du rapport.")}finally{x||j(!1)}})(),()=>{x=!0}},[i,_,g,s.length]);const v=Number(((N=(p=n.dashboard)==null?void 0:p.interviewReports)==null?void 0:N.total)||s.length),V=x=>{o(x),E(!1)},L=e.jsxs("div",{className:"rf-client-portal-actions-row rf-client-portal-report-header-actions",children:[e.jsx("button",{type:"button",className:"rf-client-portal-secondary rf-client-portal-report-pager-btn",onClick:()=>o(x=>Math.max(x-1,0)),disabled:i<=0,children:"Précédent"}),e.jsx("button",{type:"button",className:"rf-client-portal-secondary rf-client-portal-report-pager-btn",onClick:()=>o(x=>Math.min(x+1,s.length-1)),disabled:i>=s.length-1,children:"Suivant"})]}),M=e.jsxs("div",{className:"rf-client-portal-report-header-leading",children:[e.jsxs("div",{className:"rf-client-portal-report-selected-title",children:[e.jsx("p",{className:"rf-client-portal-eyebrow",children:"Rapport d'entrevue sélectionné"}),e.jsx("h3",{children:(_==null?void 0:_.candidateName)||"Rapport"})]}),L]});return e.jsx("section",{className:"rf-client-portal-card rf-client-portal-interview-reports-card",children:s.length===0?e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun rapport d’entrevue n’est encore disponible."}):e.jsxs("div",{className:`rf-client-portal-reports-shell ${y?"is-report-menu-expanded":""}`,children:[e.jsxs("aside",{className:`rf-client-portal-reports-side-menu ${y?"is-expanded":"is-collapsed"}`,children:[e.jsxs("div",{className:"rf-client-portal-reports-side-menu-head",children:[e.jsx("button",{type:"button",className:"rf-client-portal-sidebar-toggle",onClick:()=>E(x=>!x),"aria-label":y?"Réduire la liste des rapports":"Ouvrir la liste des rapports",children:y?e.jsx(J,{className:"h-4 w-4"}):e.jsx(le,{className:"h-4 w-4"})}),y?e.jsxs("div",{className:"rf-client-portal-reports-side-menu-meta",children:[e.jsx("p",{className:"rf-client-portal-eyebrow",children:"Rapports"}),e.jsxs("div",{className:"rf-client-portal-pill",children:[v," rapport(s)"]})]}):null]}),y?e.jsx("nav",{className:"rf-client-portal-reports-nav",children:s.map((x,k)=>e.jsxs("button",{type:"button",className:`rf-client-portal-report-nav-item ${k===i?"is-active":""}`,onClick:()=>V(k),children:[e.jsx("strong",{children:x.candidateName}),e.jsxs("span",{children:[ee(x.createdAt),x.interviewAt?` · Entrevue ${ee(x.interviewAt)}`:""]})]},x.reportId||`${x.candidateId||"candidate"}-${x.createdAt}`))}):null]}),e.jsxs("div",{className:`rf-client-portal-report-stage ${C?"is-blurred":""}`,children:[y&&!r?e.jsx("button",{type:"button",className:"rf-client-portal-report-viewer-overlay",onClick:()=>E(!1),"aria-label":"Fermer la liste des rapports"}):null,d?e.jsx("p",{className:"rf-client-portal-muted",children:"Chargement du rapport…"}):u||!a?e.jsxs("div",{className:"rf-client-portal-inline-error-block",children:[e.jsx("p",{className:"rf-client-portal-inline-error",children:u||"Rapport indisponible."}),_!=null&&_.publicUrl?e.jsx("a",{className:"rf-client-portal-report-link",href:_.publicUrl,target:"_blank",rel:"noreferrer",children:"Ouvrir le rapport dans un nouvel onglet"}):null]}):e.jsx(Ue,{data:a,showIssueAnalysis:!1,className:"rf-client-portal-report-workspace h-full min-h-0",headerLeading:M})]})]})})},Lt=({text:t,children:n})=>{const r=m.useRef(null),s=m.useRef(null),[l,c]=m.useState(!1),[i,o]=m.useState({left:0,top:0}),d=m.useCallback(()=>{const j=r.current,u=s.current;if(!j||!u)return;const h=j.getBoundingClientRect(),a=u.getBoundingClientRect(),b=8,y=window.innerWidth,E=window.innerHeight;let _=h.top-a.height-8;_<b&&(_=h.bottom+8),_+a.height>E-b&&(_=Math.max(b,E-a.height-b));let g=h.left+h.width/2-a.width/2;g=Math.max(b,Math.min(g,y-a.width-b)),o({left:g,top:_})},[]);return m.useLayoutEffect(()=>{if(!l)return;d();const j=()=>d();return window.addEventListener("resize",j),window.addEventListener("scroll",j,!0),()=>{window.removeEventListener("resize",j),window.removeEventListener("scroll",j,!0)}},[d,l]),e.jsxs(e.Fragment,{children:[e.jsx("span",{ref:r,className:"block w-full",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),children:n}),typeof document<"u"?Le.createPortal(e.jsx("span",{ref:s,className:`pointer-events-none fixed z-[2147483000] rounded-md bg-[#545454] px-2 py-1 text-[11px] font-semibold text-white shadow-lg transition-opacity duration-75 ${l?"opacity-100":"opacity-0"}`,style:{left:`${i.left}px`,top:`${i.top}px`},role:"tooltip",children:t}),document.body):null]})},Pt=[{key:"interviews",label:"Entrevues",helpAliases:["entrevue","entrevues","modifier entrevue"]},{key:"decision",label:"Décision post-entrevue",helpAliases:["décision","statut après entrevue"]},{key:"interview_reports",label:"Rapports d’entrevues",helpAliases:["rapport","rapports","rapport d'entrevue"]},{key:"engaged_candidates",label:"Candidats engagés",helpAliases:["engagés","candidats engagés","candidats embauchés"]},{key:"pipeline",label:"Pipeline",helpAliases:["candidats","pipeline du mandat"]},{key:"profile",label:"Profil",helpAliases:["profil client","coordonnées client"]},{key:"preemployment_verifications",label:"Enquête et références",helpAliases:["références","enquête","consentement"]}],It="decision";function Tt(t){var l,c,i,o,d,j,u,h,a,b;const n=((l=t==null?void 0:t.dashboard)==null?void 0:l.portalSettings)||{},r=((i=(c=t==null?void 0:t.dashboard)==null?void 0:c.interviews)==null?void 0:i.total)??((j=(d=(o=t==null?void 0:t.dashboard)==null?void 0:o.interviews)==null?void 0:d.items)==null?void 0:j.length)??0,s=[];return r>0&&s.push("interviews"),n.showDecision!==!1&&s.push("decision"),n.showInterviewReports!==!1&&s.push("interview_reports"),(((h=(u=t==null?void 0:t.dashboard)==null?void 0:u.engagedCandidates)==null?void 0:h.total)||0)>0&&s.push("engaged_candidates"),n.showPipeline!==!1&&s.push("pipeline"),n.showProfile!==!1&&s.push("profile"),(((b=(a=t==null?void 0:t.dashboard)==null?void 0:a.preEmploymentVerification)==null?void 0:b.total)||0)>0&&s.push("preemployment_verifications"),s.length>0?s:[It]}const Mt={decision:e.jsx(Ye,{className:"h-4 w-4",color:"#ffbf23"}),interviews:e.jsx(_e,{className:"h-4 w-4"}),engaged_candidates:e.jsx(Ze,{className:"h-4 w-4"}),recruitment_report:e.jsx(oe,{className:"h-4 w-4"}),interview_reports:e.jsx(oe,{className:"h-4 w-4"}),pipeline:e.jsx(Je,{className:"h-4 w-4"}),profile:e.jsx(Ke,{className:"h-4 w-4"}),preemployment_verifications:e.jsx(ye,{className:"h-4 w-4"})},be=Pt.map(t=>
1({key:t.key,label:t.label,icon:Mt[t.key]})),Vt=({activeSection:t,setActiveSection:n,visibleSections:r,clientName:s,desktopCollapsed:l,setDesktopCollapsed:c})=>{const i=m.useMemo(()=>{const h=Array.isArray(r)?new Set(r):null;return h?be.filter(a=>h.has(a.key)):be},[r]),[o,d]=m.useState(!1);m.useEffect(()=>{if(!o||typeof document>"u")return;const h=document.body.style.overflow,a=document.body.style.touchAction;return document.body.style.overflow="hidden",document.body.style.touchAction="none",()=>{document.body.style.overflow=h,document.body.style.touchAction=a}},[o]),m.useEffect(()=>{if(!o||typeof window>"u")return;const h=a=>{a.key==="Escape"&&d(!1)};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[o]);const j=h=>{if(l&&t===h){c(!1),d(!1);return}n(h),c(!0),d(!1)},u=(h,a)=>{const b=(a==null?void 0:a.compact)??!1,y=(a==null?void 0:a.mobile)??!1,E=e.jsxs("button",{type:"button",className:`rf-client-portal-menu-item ${t===h.key?"is-active":""} ${b?"is-compact":""} ${y?"is-mobile":""}`,"aria-current":t===h.key?"page":void 0,"aria-label":b?h.label:void 0,onClick:()=>j(h.key),children:[e.jsx("span",{children:h.icon}),b?null:e.jsx("span",{children:h.label})]},h.key);return b?e.jsx(Lt,{text:h.label,children:E},h.key):E};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rf-client-portal-mobile-menu",children:[e.jsxs("div",{children:[e.jsx("p",{className:"rf-client-portal-eyebrow",children:"Menu"}),e.jsx("p",{className:"rf-client-portal-mobile-client",children:s})]}),e.jsxs("button",{type:"button",className:"rf-client-portal-mobile-menu-btn",onClick:()=>d(!0),"aria-label":"Ouvrir le menu du portail client","aria-expanded":o,children:[e.jsx(le,{className:"h-4 w-4"}),e.jsx("span",{children:"Menu"})]})]}),o?e.jsxs("div",{className:"rf-client-portal-mobile-drawer",role:"dialog","aria-modal":!0,children:[e.jsx("button",{type:"button","aria-label":"Fermer le menu du portail client",className:"rf-client-portal-mobile-backdrop",onClick:()=>d(!1)}),e.jsxs("aside",{className:"rf-client-portal-mobile-panel",children:[e.jsxs("div",{className:"rf-client-portal-mobile-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"rf-client-portal-eyebrow",children:"Portail client"}),e.jsx("p",{className:"rf-client-portal-mobile-client",children:s})]}),e.jsx("button",{type:"button",className:"rf-client-portal-mobile-close",onClick:()=>d(!1),"aria-label":"Fermer le menu",children:e.jsx(J,{className:"h-4 w-4"})})]}),e.jsx("nav",{className:"rf-client-portal-mobile-nav",children:i.map(h=>u(h,{mobile:!0}))})]})]}):null,e.jsxs("aside",{className:`rf-client-portal-sidebar ${l?"is-collapsed":""}`,children:[e.jsxs("div",{className:"rf-client-portal-sidebar-head",children:[e.jsxs("div",{children:[e.jsx("p",{className:"rf-client-portal-eyebrow",children:"Menu"}),l?null:e.jsx("p",{className:"rf-client-portal-sidebar-client",children:s})]}),e.jsx("button",{type:"button",className:"rf-client-portal-main-menu-toggle rf-client-portal-sidebar-toggle",onClick:()=>c(!l),"aria-label":l?"Déplier le menu":"Réduire le menu","aria-expanded":!l,children:l?e.jsx(le,{className:"h-4 w-4"}):e.jsx(J,{className:"h-4 w-4"})})]}),e.jsx("nav",{className:"rf-client-portal-sidebar-nav",children:i.map(h=>u(h,{compact:l}))})]})]})},ve={bike:"Vélo",foot:"À pied",bus:"Bus",car:"Voiture"},$t={totalCandidates:"Candidats",pending:"En progression",recruiterInterview:"Entrevues recruteur",clientInterview:"Entrevues client",engaged:"Engagés",rejected:"Refusés"},Ot={"Not Yet Treated":"À traiter","Candidate Contacted":"Contact candidat","Virtual Interview":"Entrevue recruteur","Client Approval":"Décision client","Sent to Client":"En révision client","Sent to Client (Portal)":"En révision client","Physical Interview":"Entrevue client",Engaged:"Engagé",Rejected:"Refusé"},we=t=>{const n=typeof t=="string"?t.trim():"";return n?Ot[n]||n:"—"},Ne=({mode:t})=>{switch(t){case"bike":return e.jsx(et,{className:"h-4 w-4","aria-hidden":!0});case"foot":return e.jsx(Qe,{className:"h-4 w-4","aria-hidden":!0});case"bus":return e.jsx(Xe,{className:"h-4 w-4","aria-hidden":!0});case"car":return e.jsx(Ge,{className:"h-4 w-4","aria-hidden":!0});default:return e.jsx(ke,{className:"h-4 w-4","aria-hidden":!0})}},ge=t=>typeof t!="number"||!Number.isFinite(t)?"Distance indisponible":`${Math.max(0,Math.round(t))} km`,Ce=t=>!!t.id,ne=t=>t.id||`name:${t.name.trim().toLowerCase()}`,Ft=({payload:t,portalToken:n})=>{var E,_,g,C,v,V,L,M,w,P,A;const r=(E=t.dashboard)==null?void 0:E.recruitmentReport,s=m.useMemo(()=>{var N,x,k,R,$;const p=Array.isArray((x=(N=t.dashboard)==null?void 0:N.pipelineStats)==null?void 0:x.scopes)?(R=(k=t.dashboard)==null?void 0:k.pipelineStats)==null?void 0:R.scopes:[];return p.length>0?p:[{scopeId:"all_mandates",jobId:null,title:"Tous les mandats",totalCandidates:Number((($=r==null?void 0:r.totals)==null?void 0:$.totalCandidates)||0),totals:(r==null?void 0:r.totals)||{},statusBreakdown:Array.isArray(r==null?void 0:r.statusBreakdown)?r.statusBreakdown:[]}]},[(g=(_=t.dashboard)==null?void 0:_.pipelineStats)==null?void 0:g.scopes,r==null?void 0:r.statusBreakdown,r==null?void 0:r.totals]),[l,c]=m.useState("all_mandates");m.useEffect(()=>{var x,k,R;const p=((k=(x=t.dashboard)==null?void 0:x.pipelineStats)==null?void 0:k.defaultScope)==="current_mandate"?t.job.id:"all_mandates",N=new Set(s.map($=>$.scopeId));c(N.has(p)?p:((R=s[0])==null?void 0:R.scopeId)||"all_mandates")},[(v=(C=t.dashboard)==null?void 0:C.pipelineStats)==null?void 0:v.defaultScope,t.job.id,s]);const i=s.find(p=>p.scopeId===l)||s[0]||null,o=(i==null?void 0:i.totals)||(r==null?void 0:r.totals)||{},d=Array.isArray(i==null?void 0:i.statusBreakdown)?i.statusBreakdown:Array.isArray(r==null?void 0:r.statusBreakdown)?r.statusBreakdown:[],j=Math.max(1,...d.map(p=>Number(p.count||0))),u=m.useMemo(()=>{var p,N;return((N=(p=t.dashboard)==null?void 0:p.pipeline)==null?void 0:N.statuses)||[]},[(L=(V=t.dashboard)==null?void 0:V.pipeline)==null?void 0:L.statuses]),h=m.useMemo(()=>u.flatMap(p=>p.candidates.map(N=>({...N,statusLabel:we(N.status||p.status)}))),[u]),a=m.useMemo(()=>{const p=new Map;for(const N of t.candidates||[]){const x=ne({id:N.id||null,name:N.name||""});p.set(x,Ee(N))}return p},[t.candidates]),[b,y]=m.useState(null);return e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsxs("div",{className:"rf-client-portal-section-head",children:[e.jsxs("div",{children:[e.jsx("h2",{children:"Pipeline"}),e.jsx("p",{className:"rf-client-portal-muted",children:"KPI multi-mandats, répartition des statuts et suivi des candidats."})]}),e.jsxs("div",{className:"rf-client-portal-pill",children:[(i==null?void 0:i.totalCandidates)??((w=(M=t.dashboard)==null?void 0:M.pipeline)==null?void 0:w.totalCandidates)??0," ","candidat(s)"]})]}),((A=(P=t.dashboard)==null?void 0:P.pipelineStats)==null?void 0:A.allowMandateSwitch)!==!1&&s.length>1?e.jsxs("div",{className:"rf-client-portal-stats-scope-row",children:[e.jsx("label",{className:"rf-client-portal-muted",htmlFor:"pipelineScope",children:"Vue statistiques"}),e.jsx("select",{id:"pipelineScope",className:"rf-client-portal-select",value:l,onCh
1ange:p=>c(p.target.value),children:s.map(p=>e.jsx("option",{value:p.scopeId,children:p.title},p.scopeId))})]}):null,e.jsx("div",{className:"rf-client-portal-metrics-grid",children:Object.entries($t).map(([p,N])=>{const x=Number(o[p]||0);return e.jsxs("article",{className:"rf-client-portal-metric-card",children:[e.jsx("p",{className:"rf-client-portal-metric-label",children:N}),e.jsx("p",{className:"rf-client-portal-metric-value",children:x})]},p)})}),e.jsxs("div",{className:"rf-client-portal-breakdown",children:[e.jsx("h3",{children:"Répartition par statut"}),d.length===0?e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun statut disponible."}):e.jsx("ul",{className:"rf-client-portal-breakdown-bars",children:d.map(p=>{const N=Number(p.count||0),x=Math.max(6,Math.round(N/j*100));return e.jsxs("li",{children:[e.jsx("span",{children:we(p.status)}),e.jsx("div",{className:"rf-client-portal-breakdown-track",children:e.jsx("div",{className:"rf-client-portal-breakdown-fill",style:{width:`${x}%`}})}),e.jsx("strong",{children:N})]},`${p.status}-${p.count}`)})})]}),h.length===0?e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun candidat dans le pipeline pour ce mandat."}):e.jsxs(e.Fragment,{children:[i!=null&&i.jobId&&i.jobId!==t.job.id?e.jsxs("p",{className:"rf-client-portal-muted",children:["Le tableau détaillé ci-dessous affiche le mandat courant (",t.job.title,")."]}):null,e.jsx("div",{className:"rf-client-portal-pipeline-mobile-list",children:h.map(p=>{const N=ne(p),x=a.get(N)||{headline:"—",detail:"Aucun suivi des créneaux"},k=Ce(p);return e.jsxs("article",{className:"rf-client-portal-pipeline-mobile-card",children:[e.jsxs("div",{className:"rf-client-portal-pipeline-mobile-card-head",children:[e.jsxs("div",{children:[e.jsx("h3",{children:p.name||"Candidat"}),e.jsx("p",{className:"rf-client-portal-muted",children:ge(p.distanceKm)})]}),e.jsx("span",{className:"rf-client-portal-pill",children:p.statusLabel||"—"})]}),e.jsxs("div",{className:"rf-client-portal-pipeline-mobile-grid",children:[e.jsxs("div",{children:[e.jsx("p",{className:"rf-client-portal-label",children:"Transport"}),p.transportModes.length?e.jsx("div",{className:"rf-client-portal-transport-row",children:p.transportModes.map(R=>e.jsxs("span",{className:"rf-client-portal-transport-chip",children:[e.jsx(Ne,{mode:R}),e.jsx("span",{children:ve[R]||R})]},`${N}-mobile-${R}`))}):e.jsx("p",{className:"rf-client-portal-muted",children:"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"rf-client-portal-label",children:"Progression créneaux"}),e.jsx("span",{className:"rf-client-portal-pill",children:x.headline}),e.jsx("p",{className:"rf-client-portal-muted",children:x.detail})]})]}),e.jsx("div",{className:"rf-client-portal-pipeline-mobile-actions",children:e.jsxs("button",{type:"button",className:"rf-client-portal-secondary",onClick:()=>k&&y(p),disabled:!k,"aria-label":`Ouvrir le CV de ${p.name}`,children:[e.jsx(re,{className:"h-4 w-4","aria-hidden":!0}),e.jsx("span",{children:"Voir le CV"})]})})]},`${N}-mobile`)})}),e.jsx("div",{className:"rf-client-portal-table-wrap",children:e.jsxs("table",{className:"rf-client-portal-table",role:"table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Candidat"}),e.jsx("th",{children:"Statut"}),e.jsx("th",{children:"Distance"}),e.jsx("th",{children:"Transport"}),e.jsx("th",{children:"Progression créneaux"}),e.jsx("th",{children:"CV"})]})}),e.jsx("tbody",{children:h.map(p=>{const N=ne(p),x=a.get(N)||{headline:"—",detail:"Aucun suivi des créneaux"},k=Ce(p);return e.jsxs("tr",{children:[e.jsx("td",{children:p.name||"Candidat"}),e.jsx("td",{children:e.jsx("span",{className:"rf-client-portal-pill",children:p.statusLabel||"—"})}),e.jsx("td",{children:ge(p.distanceKm)}),e.jsx("td",{children:p.transportModes.length?e.jsx("div",{className:"rf-client-portal-transport-row",children:p.transportModes.map(R=>e.jsxs("span",{className:"rf-client-portal-transport-chip",children:[e.jsx(Ne,{mode:R}),e.jsx("span",{children:ve[R]||R})]},`${N}-${R}`))}):e.jsx("span",{className:"rf-client-portal-muted",children:"—"})}),e.jsx("td",{children:e.jsxs("div",{children:[e.jsx("span",{className:"rf-client-portal-pill",children:x.headline}),e.jsx("p",{className:"rf-client-portal-muted",children:x.detail})]})}),e.jsx("td",{children:e.jsx("button",{type:"button",className:"rf-client-portal-secondary",style:{padding:"6px 9px",lineHeight:0},onClick:()=>k&&y(p),disabled:!k,"aria-label":`Ouvrir le CV de ${p.name}`,title:"Voir le CV",children:e.jsx(re,{className:"h-4 w-4","aria-hidden":!0})})})]},N)})})]})})]}),b?e.jsx(Se,{candidate:b,onClose:()=>y(null),portalToken:n}):null]})},Dt=({payload:t})=>{var l,c,i,o,d,j;const n=((c=(l=t.dashboard)==null?void 0:l.profile)==null?void 0:c.contacts)||[],r=((o=(i=t.dashboard)==null?void 0:i.profile)==null?void 0:o.sites)||[],s=((j=(d=t.dashboard)==null?void 0:d.profile)==null?void 0:j.interviewSite)||null;return e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsx("div",{className:"rf-client-portal-section-head",children:e.jsxs("div",{children:[e.jsx("h2",{children:"Profil"}),e.jsx("p",{className:"rf-client-portal-muted",children:"Contacts, sites du client et adresse prévue pour l’entrevue."})]})}),e.jsxs("div",{className:"rf-client-portal-profile-block",children:[e.jsx("h3",{children:"Contacts"}),n.length===0?e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun contact disponible."}):e.jsx("div",{className:"rf-client-portal-contacts-grid",children:n.map(u=>e.jsxs("article",{className:"rf-client-portal-profile-card",children:[e.jsxs("div",{className:"rf-client-portal-profile-card-head",children:[e.jsx("strong",{children:u.name||"Contact"}),u.isPrimary?e.jsx("span",{className:"rf-client-portal-pill",children:"Principal"}):null]}),u.title?e.jsx("p",{className:"rf-client-portal-muted",children:u.title}):null,u.email?e.jsx("p",{children:e.jsx("a",{className:"rf-client-portal-report-link",href:`mailto:${u.email}`,children:u.email})}):null,u.phone?e.jsx("p",{className:"rf-client-portal-muted",children:u.phone}):null]},u.id))})]}),e.jsxs("div",{className:"rf-client-portal-profile-block",children:[e.jsx("h3",{children:"Sites"}),r.length===0?e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun site configuré."}):e.jsx("div",{className:"rf-client-portal-sites-grid",children:r.map(u=>e.jsxs("article",{className:"rf-client-portal-profile-card",children:[e.jsxs("div",{className:"rf-client-portal-profile-card-head",children:[e.jsx("strong",{children:u.label}),u.includedInMandate?e.jsx("span",{className:"rf-client-portal-pill",children:"Mandat"}):null]}),u.address?e.jsx("p",{className:"rf-client-portal-muted",children:u.address}):null,u.city?e.jsx("p",{className:"rf-client-portal-muted",children:u.city}):null]},u.id))})]}),e.jsxs("div",{className:"rf-client-portal-profile-block",children:[e.jsx("h3",{children:"Site d’entrevue"}),e.jsxs("article",{className:"rf-client-portal-profile-card",children:[s!=null&&s.label?e.jsx("p",{children:e.jsx("strong",{children:s.label})}):null,e.jsx("p",{className:"rf-client-portal-muted",children:(s==null?void 0:s.address)||"Adresse à confirmer"}),e.jsxs("p",{className:"rf-client-portal-muted",children:["Source: ",(s==null?void 0:s.source)||"non définie"]})]})]})]})},se=t=>{switch(t){case"signed":return"Signé";case"submitted":return"Soumis";case"completed":return"Complété";case"in_progress":return"En cours";
1case"pending":return"En attente";case"blocked":return"Bloqué par le consentement";case"requested":return"Demandé";default:return t||"Non disponible"}},ae=t=>t&&typeof t=="object"&&!Array.isArray(t)?t:{},K=t=>typeof t=="string"&&t.trim()?t.trim():null,Ut=t=>Array.isArray(t.sections)?t.sections.map(n=>ae(n)).map(n=>({id:K(n.id)||K(n.title)||"section",title:K(n.title)||"Détail",body:K(n.body)})).filter(n=>n.body):[],Bt=({entry:t,clientName:n,jobTitle:r})=>{var i,o;const[s,l]=m.useState(null);if(m.useEffect(()=>{s&&!t.references.some(d=>d.id===s)&&l(null)},[t.references,s]),t.references.length===0)return e.jsx("p",{className:"mt-3 text-sm text-slate-600",children:"Aucune référence fournie pour le moment."});const c=t.references.find(d=>d.id===s);return c?e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsx("button",{type:"button",className:"text-sm font-semibold text-slate-700 hover:text-slate-900",onClick:()=>l(null),children:"← Retour aux références"}),e.jsx(lt,{meta:{candidateName:t.candidateName,clientName:n,jobTitle:r,referenceName:c.name,referenceCompany:c.company,referenceTitle:c.title,referenceRelationship:c.relationship},questions:((i=c.check)==null?void 0:i.questionnaire)||[],mode:"read",notes:(o=c.check)==null?void 0:o.notes,documentLabel:"RAPPORT DE RÉFÉRENCE",subtitle:"Résultat publié au portail client"})]}):e.jsx("div",{className:"mt-4",children:e.jsx(rt,{references:t.references.map(d=>{var j,u;return{id:d.id,name:d.name,company:d.company,title:d.title,relationship:d.relationship,checkStatus:((j=d.check)==null?void 0:j.status)||d.status,questionnaire:(u=d.check)==null?void 0:u.questionnaire}}),selectedId:s,onSelect:l})})},zt=({payload:t})=>{var l,c,i,o;const n=((c=(l=t.dashboard)==null?void 0:l.preEmploymentVerification)==null?void 0:c.cases)||[],r=((i=t.client)==null?void 0:i.name)||"Client",s=((o=t.job)==null?void 0:o.title)||"Poste";return n.length===0?e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsx("h2",{children:"Enquête et références"}),e.jsx("p",{className:"rf-client-portal-muted",children:"Aucun dossier de vérification n’est disponible pour le moment."})]}):e.jsx("div",{className:"rf-client-portal-main-stack",children:n.map(d=>{var u,h;const j=d.items.filter(a=>a.kind!=="references");return e.jsxs("section",{className:"rf-client-portal-card",children:[e.jsx("div",{className:"rf-client-portal-section-head",children:e.jsxs("div",{children:[e.jsx("h2",{children:d.candidateName}),e.jsxs("p",{className:"rf-client-portal-muted",children:["Consentement: ",se((u=d.consent)==null?void 0:u.status),(h=d.consent)!=null&&h.signedAt?` · signé le ${Q(d.consent.signedAt,null,null)}`:""]})]})}),e.jsx("div",{className:"rf-client-portal-actions-row",children:d.items.map(a=>e.jsxs("span",{className:"rf-client-portal-pill",children:[a.label,": ",se(a.status)]},a.kind))}),j.length?e.jsx("div",{className:"rf-client-portal-table-wrap",children:e.jsxs("table",{className:"rf-client-portal-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Vérification"}),e.jsx("th",{children:"Statut"}),e.jsx("th",{children:"Résultat publié"}),e.jsx("th",{children:"Rapport"})]})}),e.jsx("tbody",{children:j.map(a=>{const b=ae(a.clientVisibleResult),y=ae(b.artifact),E=Ut(y),_=K(y.title)||`${a.label} - résultat`;return e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("strong",{children:a.label}),a.description?e.jsx("span",{className:"block text-xs text-slate-500",children:a.description}):null]}),e.jsxs("td",{children:[se(a.status),a.providerCompletedAt?e.jsxs("span",{className:"block text-xs text-slate-500",children:["Complété le"," ",Q(a.providerCompletedAt,null,null)]}):null]}),e.jsx("td",{children:a.resultVisible?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm font-semibold text-slate-800",children:a.resultStatus||"Résultat reçu"}),a.resultSummary?e.jsx("p",{className:"mt-1 text-sm text-slate-700",children:a.resultSummary}):null,a.providerName?e.jsxs("p",{className:"mt-1 text-xs text-slate-500",children:["Source: ",a.providerName,a.providerReference?` · ${a.providerReference}`:""]}):null]}):"Non publié"}),e.jsx("td",{children:a.resultVisible&&E.length?e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer text-sm font-semibold text-slate-800",children:_}),e.jsx("div",{className:"mt-2 space-y-2",children:E.map(g=>e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-slate-700",children:g.title}),e.jsx("p",{className:"text-sm text-slate-700",children:g.body})]},g.id))})]}):"À venir"})]},a.kind)})})]})}):null,e.jsxs("div",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:"Références professionnelles"}),e.jsx("p",{className:"mt-1 text-sm text-slate-600",children:"Sélectionnez une référence pour consulter le rapport complet."}),e.jsx(Bt,{entry:d,clientName:r,jobTitle:s})]})]},d.case.id)})})},qt=(t,n)=>{switch(t){case"decision":return e.jsx(at,{payload:n.payload,selectedCandidateId:n.selectedCandidateId,setCandidateId:n.setCandidateId,submitting:n.submitting,successMessage:n.successMessage,successAction:n.successAction,clearSuccessMessage:n.clearSuccessMessage,submitDecision:n.submitDecision,consentSaving:n.consentSaving,saveConsent:n.saveConsent});case"interviews":return e.jsx(Et,{payload:n.payload,submitting:n.submitting,successMessage:n.successMessage,clearSuccessMessage:n.clearSuccessMessage,submitInterviewAction:n.submitInterviewAction});case"engaged_candidates":return e.jsx(Ct,{payload:n.payload,portalToken:n.actionPortalToken,setActiveSection:n.setActiveSection});
1case"recruitment_report":case"pipeline":return e.jsx(Ft,{payload:n.payload,portalToken:n.actionPortalToken});case"interview_reports":return e.jsx(Rt,{initialAccessToken:n.actionPortalToken||n.portalToken,payload:n.payload,isMainMenuExpanded:n.isMainMenuExpanded});case"profile":return e.jsx(Dt,{payload:n.payload});case"preemployment_verifications":return e.jsx(zt,{payload:n.payload});default:return null}},Wt=({portalToken:t,actionPortalToken:n=t,loading:r,error:s,payload:l,activeSection:c,setActiveSection:i,selectedCandidateId:o,setCandidateId:d,submitting:j,successMessage:u,successAction:h,clearSuccessMessage:a,submitDecision:b,submitInterviewAction:y=async()=>{},consentSaving:E,saveConsent:_})=>{var w,P;const[g,C]=m.useState(!0),v=!g,V=c==="interview_reports",L=m.useMemo(()=>{var x,k,R,$;const A=(k=(x=l==null?void 0:l.dashboard)==null?void 0:x.profile)==null?void 0:k.interviewSite,p=(R=A==null?void 0:A.address)==null?void 0:R.trim();return p||(($=A==null?void 0:A.label)==null?void 0:$.trim())||null},[(P=(w=l==null?void 0:l.dashboard)==null?void 0:w.profile)==null?void 0:P.interviewSite]),M=m.useMemo(()=>Tt(l),[l]);return m.useEffect(()=>{M.includes(c)||i(M[0])},[c,i,M]),m.useEffect(()=>{c==="interview_reports"&&C(!0)},[c]),m.useEffect(()=>{if(!v||typeof window>"u")return;const A=p=>{p.key==="Escape"&&C(!0)};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[v]),e.jsx("div",{className:"rf-public-portal-theme rf-client-portal-root",children:e.jsxs("div",{className:"rf-client-portal-frame",children:[e.jsxs("header",{className:"rf-client-portal-topbar",children:[e.jsx(Me,{active:!0,showCurve:!1,fill:!0}),e.jsxs("div",{className:"rf-client-portal-topbar-title",children:[e.jsxs("div",{className:"rf-client-portal-topbar-brand",children:[l?e.jsx(Ve,{logoUrl:l.client.brandingLogoUrl??null,logoAlt:l.client.brandingLogoAlt||`Logo ${l.client.name}`,className:"h-9 w-9 rounded-xl",imageClassName:"h-full w-full object-contain p-1.5"}):null,e.jsxs("div",{className:"rf-client-portal-topbar-brand-copy",children:[e.jsx("p",{className:"rf-client-portal-topbar-eyebrow",children:l?`Maieutic - ${l.client.name}`:"Maieutic"}),e.jsx("p",{className:"rf-client-portal-topbar-subtitle",children:"Portail client - Suivi du mandat et décisions"})]})]}),l?e.jsxs("p",{className:"rf-client-portal-topbar-context",children:[e.jsx("strong",{children:l.job.title})," · ",l.client.name,L?` · ${L}`:""]}):null]})]}),e.jsx("div",{className:`rf-client-portal-content ${V?"is-interview-reports":""}`,children:r?e.jsx("div",{className:"rf-client-portal-empty",children:e.jsx("p",{className:"rf-client-portal-muted",children:"Chargement du portail client…"})}):s||!l?e.jsxs("div",{className:"rf-client-portal-empty rf-client-portal-error",children:[e.jsx("h1",{children:"Lien expiré ou invalide"}),e.jsx("p",{children:s||"Ce lien ne permet plus d’accéder au portail client."})]}):e.jsxs("div",{className:"rf-client-portal-layout-shell",children:[e.jsx(Vt,{activeSection:c,setActiveSection:i,visibleSections:M,clientName:l.client.name,desktopCollapsed:g,setDesktopCollapsed:C}),e.jsxs("main",{className:`rf-client-portal-main ${v?"is-main-menu-expanded":""} ${V?"is-interview-reports":""}`,children:[v?e.jsx("button",{type:"button",className:"rf-client-portal-main-blur-overlay","aria-label":"Réduire le menu principal",onClick:()=>C(!0)}):null,qt(c,{portalToken:t,actionPortalToken:n,payload:l,setActiveSection:i,isMainMenuExpanded:v,selectedCandidateId:o,setCandidateId:d,submitting:j,successMessage:u,successAction:h,clearSuccessMessage:a,submitDecision:b,submitInterviewAction:y,consentSaving:E,saveConsent:_})]})]})})]})})},Ht=t=>t==="decision"||t==="interviews"||t==="engaged_candidates"||t==="recruitment_report"||t==="interview_reports"||t==="pipeline"||t==="profile"||t==="preemployment_verifications",Kt=t=>{var x,k,R,$,q,B;const[n,r]=Pe(),[s,l]=O.useState(!0),[c,i]=O.useState(null),[o,d]=O.useState(null),[j,u]=O.useState(!1),[h,a]=O.useState(null),[b,y]=O.useState(null),[E,_]=O.useState(!1),g=O.useMemo(()=>{const f=o==null?void 0:o.resolvedPortalToken;return typeof f=="string"&&f.trim()?f.trim():t||""},[o==null?void 0:o.resolvedPortalToken,t]),C=O.useMemo(()=>{const f=n.get("candidateId");return f&&f.trim()?f.trim():null},[n]),v=O.useMemo(()=>{var S,D,z,F,T;return(((D=(S=o==null?void 0:o.dashboard)==null?void 0:S.interviews)==null?void 0:D.total)??((T=(F=(z=o==null?void 0:o.dashboard)==null?void 0:z.interviews)==null?void 0:F.items)==null?void 0:T.length)??0)>0},[(R=(k=(x=o==null?void 0:o.dashboard)==null?void 0:x.interviews)==null?void 0:k.items)==null?void 0:R.length,(q=($=o==null?void 0:o.dashboard)==null?void 0:$.interviews)==null?void 0:q.total]),V=O.useMemo(()=>{const f=n.get("view");return Ht(f)?f==="recruitment_report"?"pipeline":f:v?"interviews":"decision"},[v,n]),L=O.useCallback(async()=>
1{if(!t){i("Lien expiré ou invalide."),l(!1);return}l(!0),i(null);try{const f=await ht({token:t,candidateId:C});d(f)}catch(f){d(null),i((f==null?void 0:f.message)||"Lien expiré ou invalide.")}finally{l(!1)}},[C,t]);O.useEffect(()=>{L()},[L]);const M=O.useCallback(f=>{const S=new URLSearchParams(n);f?S.set("candidateId",f):S.delete("candidateId"),r(S,{replace:!0}),a(null),y(null)},[n,r]),w=O.useCallback(f=>{const S=new URLSearchParams(n);f==="decision"?v?S.set("view","decision"):S.delete("view"):S.set("view",f),r(S,{replace:!0}),a(null),y(null)},[v,n,r]),P=O.useCallback(()=>{a(null),y(null)},[]),A=O.useCallback(async()=>{if(g){_(!0);try{await jt({token:g}),d(f=>f&&{...f,portalConsent:{...f.portalConsent||{},acknowledged:!0}})}catch(f){i((f==null?void 0:f.message)||"Erreur lors de l’enregistrement du consentement.")}finally{_(!1)}}},[g]),p=O.useCallback(async({action:f,reasonLabel:S,customReason:D,notes:z,preEmploymentVerification:F})=>{var T;if(!(!g||!((T=o==null?void 0:o.candidate)!=null&&T.id))){u(!0),i(null),a(null),y(null);try{await ft({token:g,action:f,payload:{candidateId:o.candidate.id,reason_label:S||void 0,custom_reason:D||void 0,notes:z||void 0,preEmploymentVerification:F||void 0}}),a({post_interview_no_show:"Merci. Le no-show a été enregistré et le recruteur a été notifié.",post_interview_continue_process:"Merci. Le candidat passe à l’étape de vérifications préembauche.",post_interview_engaged:"Merci. Le candidat est maintenant marqué Engagé.",post_interview_rejected:"Merci. Le candidat est maintenant marqué Refusé.",post_interview_still_deciding:"Merci. Votre statut “en décision” a été enregistré."}[f]),y(f),await L()}catch(I){const W=(I==null?void 0:I.message)||"Erreur lors de l’enregistrement.";throw i(W),I instanceof Error?I:new Error(W)}finally{u(!1)}}},[g,L,(B=o==null?void 0:o.candidate)==null?void 0:B.id]),N=O.useCallback(async({action:f,candidateId:S,eventId:D,start:z,end:F,slots:T,timezone:I,mode:W,notes:Re})=>{if(!(!g||!S)){u(!0),i(null),a(null),y(null);try{await xt({token:g,action:f,payload:{candidateId:S,eventId:D||void 0,start:z||void 0,end:F||void 0,slots:T||void 0,timezone:I||void 0,mode:W||void 0,notes:Re||void 0}}),a(f==="cancel_client_interview"?"L’entrevue a été annulée. Le recruteur et le candidat recevront les mises à jour nécessaires.":f==="reschedule_client_interview"?"L’entrevue a été modifiée. Le calendrier, le recruteur et le candidat recevront les mises à jour nécessaires.":"Vos nouveaux créneaux ont été transmis au candidat."),await L()}catch(H){const ce=(H==null?void 0:H.message)||"Erreur lors de l’enregistrement.";throw i(ce),H instanceof Error?H:new Error(ce)}finally{u(!1)}}},[g,L]);return{actionPortalToken:g,loading:s,error:c,payload:o,activeSection:V,setActiveSection:w,selectedCandidateId:C,setCandidateId:M,submitDecision:p,submitInterviewAction:N,successAction:b,clearSuccessMessage:P,submitting:j,successMessage:h,consentSaving:E,saveConsent:A,refresh:L}},Jt=()=>{const{token:t}=Ie(),n=Kt(t);return e.jsx("div",{className:"rf-public-portal-theme rf-client-portal-mobile-shell",children:e.jsx(Wt,{portalToken:t||"",...n})})},$n=()=>e.jsx(Te,{children:e.jsx(Jt,{})});export{$n as PublicClientPortalRoute};

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.