PageSourceSearch

https://horizoncrm.ca/_assets/dashboard.profile-CTpRPmI8.js

js horizoncrm.ca collected 2026-09-24 14:36:30 UTC 29,020 bytes, 1 lines download raw bytes

1import{o as D,s as y,S as h,f as G,A as O,ap as w,x as we,r as z,j as e,aa as q,a8 as Ce,g as re,Z as H,c0 as Ne,ca as be,cb as Se,R as ze,ay as De,b1 as Pe,cB as Te,er as J,c8 as X,c9 as Ee,f7 as Ie,cE as Fe,bu as Me,L as Ae}from"./vendor-B5KZbkSs.js";import{u as ne,F as ie,a as N,b,c as S,d as E,e as ke}from"./Form-2-ZGlGts.js";import{Y as ce,u as C,b as le,B as I,I as R,J as de,S as m,aU as Ue,aX as Le,aY as Re,aZ as Ge}from"./index-DS57U4Yv.js";import{U as ee,u as Oe,a as Be,s as Ve}from"./useUserProfile-nd5k0Eox.js";import{B as $e}from"./index-rQLcFmgX.js";import{f as se}from"./formatPhoneNumber-CxiFbd1e.js";import{D as Ye,f as qe,a as He,b as Qe,c as We,d as Ke,e as Ze}from"./Dialog-CfnQaIW4.js";import{P as $}from"./PasswordInput-BA08UopH.js";import{h as Q}from"./moment-BLMuvzoS.js";import"./fr-Ce55WW3S.js";import{C as ae}from"./ColorPicker-B9I67jSf.js";import{u as Je}from"./useColorThemes-R_6ZV0VN.js";import{T as Xe,a as Y}from"./ToggleGroup-rooCGvP6.js";import{F as es}from"./FileDropzone-BxRBDko-.js";import{A as ss}from"./AddressAutocomplete-hO-bawJv.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";import"./index-DI8S_1Qo.js";import"./Toggle.module-6TAymfSz.js";const as=5*1024*1024,oe=/^data:image\/(png|jpeg|jpg);base64,/,os=D({avatarDataUrl:y().refine(a=>oe.test(a),{message:"Avatar must be a valid base64 encoded image (PNG or JPG)."}).refine(a=>{const s=a.replace(oe,"");return $e.from(s,"base64").length<=as},{message:"Avatar size must be less than 5MB."})}),ts=async(a,s)=>{const o=os.parse(a),n=await fetch("/_api/profile/avatar",{method:"POST",body:h.stringify(o),...s,headers:{"Content-Type":"application/json"}}),l=await n.text();if(!n.ok)try{const r=h.parse(l);throw new Error(r.error)}catch{throw new Error(`Request failed with status ${n.status}: ${l}`)}return h.parse(l)},rs=5*1024*1024,ns=["image/jpeg","image/png","image/jpg"],L=200,is=a=>new Promise((s,o)=>{const n=new FileReader;n.readAsDataURL(a),n.onload=l=>{const r=new Image;r.src=l.target?.result,r.onload=()=>{const i=document.createElement("canvas");i.width=L,i.height=L;const p=i.getContext("2d");if(!p)return o(new Error("Could not get canvas context"));p.drawImage(r,0,0,L,L),s(i.toDataURL("image/png"))},r.onerror=i=>o(i)},n.onerror=l=>o(l)}),ue=a=>ns.includes(a.type)?a.size>rs?"File is too large. Maximum size is 5MB.":null:"Invalid file type. Please select a JPG or PNG image.";function cs(){const a=G();return O({mutationFn:async s=>{const o=ue(s);if(o)throw new Error(o);const n=await is(s);return ts({avatarDataUrl:n})},onSuccess:s=>{w.success("Avatar mis à jour avec succès."),a.invalidateQueries({queryKey:ee}),a.setQueryData(ce,o=>o&&{...o,avatarUrl:s.avatarUrl}),a.setQueryData(ee,o=>o&&!("error"in o)?{...o,avatarUrl:s.avatarUrl}:o)},onError:s=>{w.error("Échec de téléchargement de l'avatar",{description:s instanceof Error?s.message:"An unknown error occurred."})}})}const ls=D({confirmation:y().min(1,"Veuillez entrer le mot de confirmation")}),ds=async(a,s)=>{const o=ls.parse(a),n=await fetch("/_api/profile/delete-account",{method:"POST",body:h.stringify(o),...s,headers:{"Content-Type":"application/json",...s?.headers??{}}}),l=await n.text();if(!n.ok){const r=h.parse(l),i=typeof r=="object"&&r!==null&&"error"in r&&typeof r.error=="string"?r.error:"Échec de la suppression du compte";throw new Error(i)}return h.parse(l)};function us(){const a=G(),{language:s}=C();return O({mutationFn:ds,onSuccess:()=>{w.success(s==="fr"?"Votre compte a été supprimé avec succès.":"Your account has been successfully deleted."),a.removeQueries(),a.setQueryData(ce,null),window.location.href="/login"},onError:o=>{w.error(s==="fr"?`Erreur lors de la suppression: ${o.message}`:`Failed to delete account: ${o.message}`)}})}const ms="_container_1wo5s_1",hs="_header_1wo5s_24",ps="_iconWrapper_1wo5s_30",gs="_icon_1wo5s_30",xs="_title_1wo5s_46",vs="_description_1wo5s_54",ys="_actionArea_1wo5s_61",_s="_deleteBtn_1wo5s_67",js="_dialogTitle_1wo5s_71",fs="_warningBox_1wo5s_75",ws="_warningIcon_1wo5s_88",Cs="_dialogContext_1wo5s_100",Ns="_inputGroup_1wo5s_107",bs="_label_1wo5s_114",g={container:ms,header:hs,iconWrapper:ps,icon:gs,title:xs,description:vs,actionArea:ys,deleteBtn:_s,dialogTitle:js,warningBox:fs,warningIcon:ws,dialogContext:Cs,inputGroup:Ns,label:bs};function Ss({className:a}){const{language:s}=C(),o=we(),{authState:n,logout:l}=le(),r=us(),[i,p]=z.useState(!1),[_,j]=z.useState("");
1if(n.type!=="authenticated")return null;const P=n.user,M=P.role==="owner"||P.companyOwnerUserId&&P.id===P.companyOwnerUserId,T=s==="fr"?"SUPPRIMER":"DELETE",F=_.trim()===T,u={title:s==="fr"?"Supprimer mon compte":"Delete my account",warningOwner:s==="fr"?"En tant que propriétaire, cette action résiliera immédiatement votre abonnement et coupera tous les accès de votre équipe. Vos documents comptables seront conservés conformément aux obligations légales, mais votre profil sera anonymisé.":"As an owner, this action will immediately cancel your subscription and revoke all team access. Your accounting documents will be retained in accordance with legal obligations, but your profile will be anonymized.",warningMember:s==="fr"?"Cette action supprimera définitivement votre compte et toutes vos données personnelles associées. Vous perdrez immédiatement l'accès à l'entreprise.":"This action will permanently delete your account and all associated personal data. You will immediately lose access to the company.",irreversible:s==="fr"?"Cette action est irréversible. Êtes-vous absolument sûr de vouloir continuer ?":"This action is irreversible. Are you absolutely sure you want to continue?",typeToConfirm:s==="fr"?`Veuillez taper "${T}" pour confirmer.`:`Please type "${T}" to confirm.`,cancel:s==="fr"?"Annuler":"Cancel",confirmBtn:s==="fr"?"Oui, supprimer mon compte":"Yes, delete my account"},B=async f=>{if(f.preventDefault(),!!F)try{await r.mutateAsync({confirmation:_}),await l(),o("/login",{replace:!0})}catch(V){console.error("Failed to delete account:",V)}},A=f=>{p(f),f||j("")};return e.jsxs("div",{className:`${g.container} ${a||""}`,children:[e.jsxs("div",{className:g.header,children:[e.jsx("div",{className:g.iconWrapper,children:e.jsx(q,{className:g.icon})}),e.jsx("h3",{className:g.title,children:u.title})]}),e.jsx("p",{className:g.description,children:M?u.warningOwner:u.warningMember}),e.jsx("div",{className:g.actionArea,children:e.jsxs(Ye,{open:i,onOpenChange:A,children:[e.jsx(qe,{asChild:!0,children:e.jsxs(I,{variant:"destructive",className:g.deleteBtn,children:[e.jsx(Ce,{size:16}),u.title]})}),e.jsx(He,{children:e.jsxs("form",{onSubmit:B,children:[e.jsxs(Qe,{children:[e.jsx(We,{className:g.dialogTitle,children:u.title}),e.jsxs(Ke,{children:[e.jsxs("div",{className:g.warningBox,children:[e.jsx(q,{size:20,className:g.warningIcon}),e.jsx("p",{children:u.irreversible})]}),e.jsx("p",{className:g.dialogContext,children:M?u.warningOwner:u.warningMember})]})]}),e.jsxs("div",{className:g.inputGroup,children:[e.jsx("label",{htmlFor:"confirmation",className:g.label,children:u.typeToConfirm}),e.jsx(R,{id:"confirmation",value:_,onChange:f=>j(f.target.value),placeholder:T,autoComplete:"off",disabled:r.isPending})]}),e.jsxs(Ze,{children:[e.jsx(I,{type:"button",variant:"outline",onClick:()=>A(!1),disabled:r.isPending,children:u.cancel}),e.jsx(I,{type:"submit",variant:"destructive",disabled:!F||r.isPending,children:u.confirmBtn})]})]})})]})})]})}const zs=D({oldPassword:y(),newPassword:y().min(8,"Le nouveau mot de passe doit contenir au moins 8 caractères."),confirmPassword:y()}).refine(a=>a.newPassword===a.confirmPassword,{message:"Les nouveaux mots de passe ne correspondent pas.",path:["confirmPassword"]}),Ds=async(a,s)=>{const o=zs.parse(a),n=await fetch("/_api/auth/change-password",{method:"POST",body:h.stringify(o),...s,headers:{"Content-Type":"application/json"}});if(!n.ok){const l=h.parse(await n.text());throw new Error(l.message||"Failed to change password")}return h.parse(await n.text())},Ps=()=>(G(),O({mutationFn:a=>Ds(a),onSuccess:()=>{}}));D({});const Ts=async a=>{const s=await fetch("/_api/auth/sessions",{method:"GET",...a,headers:{"Content-Type":"application/json",...a?.headers??{}}});if(!s.ok){const o=h.parse(await s.text());throw new Error(o.message||"Failed to fetch sessions")}return h.parse(await s.text())},Es=D({sessionId:y()}),Is=async(a,s)=>{const o=Es.parse(a),n=await fetch("/_api/auth/sessions/revoke",{method:"POST",body:h.stringify(o),...s,headers:{"Content-Type":"application/json",...s?.headers??{}}});if(!n.ok){const l=h.parse(await n.text());throw new Error(l.message||"Failed to revoke session")}return h.parse(await n.text())},te=["auth","sessions"],Fs=()=>{const a=G(),{data:s,isFetching:o,error:n}=re({queryKey:te,queryFn:Ts}),l=s?.find(i=>i.current)?.id,r=O({mutationFn:Is,onSuccess:()=>{w.success("Session déconnectée avec succès."),a.invalidateQueries({queryKey:te})},onError:i=>{w.error(i.message||"Erreur lors de la déconnexion de la session.")}});return{data:s,isFetching:o,error:n instanceof Error?n:null,revokeSessionMutation:r,currentSessionId:l}};D({});const Ms=async a=>{const s=await fetch("/_api/auth/login-history",{method:"GET",...a,headers:{"Content-Type":"application/json",...a?.headers??{}}});if(!s.ok){const o=h.parse(await s.text());throw new Error(o.message||"Failed to fetch login history")}return h.parse(await s.text())},As=["auth","loginHistory"],ks=()=>{const{data:a,isFetching:s,error:o}=re({queryKey:As,queryFn:Ms});return{data:a,isFetching:s,error:o instanceof Error?o:null}},Us="_container_1kcyr_1",Ls="_card_1kcyr_9",Rs="_cardTitle_1kcyr_16",Gs="_cardDescription_1kcyr_25",Os="_form_1kcyr_32",Bs="_sessionList_1kcyr_38",Vs="_historyList_1kcyr_39",$s="_sessionItem_1kcyr_45",Ys="_historyItem_1kcyr_46",qs="_sessionInfo_1kcyr_60",Hs="_sessionDevice_1kcyr_64",Qs="_currentTag_1kcyr_73",Ws="_sessionMeta_1kcyr_82",Ks="_historyHeader_1kcyr_88",Zs="_securitySetting_1kcyr_104",Js="_settingText_1kcyr_111",Xs="_errorState_1kcyr_124",c={container:Us,card:Ls,cardTitle:Rs,cardDescription:Gs,form:Os,sessionList:Bs,historyList:Vs,sessionItem:$s,historyItem:Ys,sessionInfo:qs,sessionDevice:Hs,currentTag:Qs,sessionMeta:Ws,historyHeader:Ks,securitySetting:Zs,settingText:Js,errorState:Xs},ea=()=>{const{t:a}=C(),s=z.useMemo(()=>D({oldPassword:y().min(1,a("security_password_old_required")),newPassword:y().min(8,a("security_password_new_min_length")),confirmPassword:y()}).refine(r=>r.newPassword===r.confirmPassword,{message:a("security_password_mismatch"),path:["confirmPassword"]}),[a]),o=ne({schema:s,defaultValues:{oldPassword:"",newPassword:"",confirmPassword:""}}),n=Ps(),l=r=>{n.mutate(r,{onSuccess:()=>{w.success(a("security_password_changed")),o.setValues({oldPassword:"",newPassword:"",confirmPassword:""})},onError:i=>{w.error(i.message||a("common_error_occurred"))}})};return e.jsx(ie,{...o,children:e.jsxs("form",{onSubmit:o.handleSubmit(l),className:c.form,children:[e.jsxs(N,{name:"oldPassword",children:[e.jsx(b,{children:a("security_old_password")}),e.jsx(S,{children:e.jsx($,{value:o.values.oldPassword,onChange:r=>o.setValues(i=>({...i,oldPassword:r.target.value}))})}),e.jsx(E,{})]}),e.jsxs(N,{name:"newPassword",children:[e.jsx(b,{children:a("security_new_password")}),e.jsx(S,{children:e.jsx($,{value:o.values.newPassword,onChange:r=>o.setValues(i=>({...i,newPassword:r.target.value}))})}),e.jsx(E,{})]}),e.jsxs(N,{name:"confirmPassword",children:[e.jsx(b,{children:a("security_confirm_password")}),e.jsx(S,{children:e.jsx($,{value:o.values.confirmPassword,onChange:r=>o.setValues(i=>({...i,confirmPassword:r.target.value}))})}),e.jsx(E,{})]}
1),e.jsx(I,{type:"submit",disabled:n.isPending,children:n.isPending?a("security_changing"):a("security_change_password")})]})})},sa=()=>{const{t:a}=C(),{data:s,isFetching:o,error:n,revokeSessionMutation:l,currentSessionId:r}=Fs(),i=()=>Array.from({length:2}).map((p,_)=>e.jsxs("div",{className:c.sessionItem,children:[e.jsx(m,{style:{width:"24px",height:"24px",borderRadius:"50%"}}),e.jsxs("div",{className:c.sessionInfo,children:[e.jsx(m,{style:{width:"150px",height:"1rem"}}),e.jsx(m,{style:{width:"200px",height:"0.8rem"}})]}),e.jsx(m,{style:{width:"100px",height:"2.5rem",marginLeft:"auto"}})]},_));return o?i():n?e.jsxs("div",{className:c.errorState,children:[e.jsx(H,{})," ",n.message]}):e.jsx("div",{className:c.sessionList,children:s?.map(p=>e.jsxs("div",{className:c.sessionItem,children:[p.isMobile?e.jsx(Ne,{}):e.jsx(be,{}),e.jsxs("div",{className:c.sessionInfo,children:[e.jsxs("p",{className:c.sessionDevice,children:[p.deviceInfo,p.id===r&&e.jsx("span",{className:c.currentTag,children:a("security_current")})]}),e.jsxs("p",{className:c.sessionMeta,children:[a("security_last_activity")," ",Q(p.lastAccessed).fromNow()]})]}),p.id!==r&&e.jsxs(I,{variant:"outline",size:"sm",onClick:()=>l.mutate({sessionId:p.id}),disabled:l.isPending,children:[e.jsx(Se,{size:16}),a("security_disconnect")]})]},p.id))})},aa=()=>{const{t:a}=C(),{data:s,isFetching:o,error:n}=ks(),l=()=>Array.from({length:3}).map((r,i)=>e.jsxs("div",{className:c.historyItem,children:[e.jsx(m,{style:{width:"120px",height:"1rem"}}),e.jsx(m,{style:{width:"100px",height:"1rem"}}),e.jsx(m,{style:{width:"180px",height:"1rem"}})]},i));return o?l():n?e.jsxs("div",{className:c.errorState,children:[e.jsx(H,{})," ",n.message]}):e.jsxs("div",{className:c.historyList,children:[e.jsxs("div",{className:`${c.historyItem} ${c.historyHeader}`,children:[e.jsx("span",{children:a("security_history_date")}),e.jsx("span",{children:a("security_history_ip")}),e.jsx("span",{children:a("security_history_device")})]}),s?.map(r=>e.jsxs("div",{className:c.historyItem,children:[e.jsx("span",{children:Q(r.attemptedAt).format("DD MMM YYYY, HH:mm")}),e.jsx("span",{children:r.ipAddress||"N/A"}),e.jsx("span",{children:r.userAgent||"N/A"})]},r.id))]})},oa=()=>{const{t:a}=C();return e.jsxs("div",{className:c.securitySetting,children:[e.jsxs("div",{className:c.settingText,children:[e.jsx("label",{htmlFor:"auto-logout",children:a("security_auto_logout")}),e.jsx("p",{children:a("security_auto_logout_desc")})]}),e.jsx(de,{id:"auto-logout"})]})},ta=()=>{const{t:a,language:s}=C();return z.useEffect(()=>{Q.locale(s)},[s]),e.jsxs("div",{className:c.container,children:[e.jsxs("div",{className:c.card,children:[e.jsx("h2",{className:c.cardTitle,children:a("security_change_password_title")}),e.jsx(ea,{})]}),e.jsxs("div",{className:c.card,children:[e.jsx("h2",{className:c.cardTitle,children:a("security_active_sessions_title")}),e.jsx("p",{className:c.cardDescription,children:a("security_sessions_description")}),e.jsx(sa,{})]}),e.jsxs("div",{className:c.card,children:[e.jsx("h2",{className:c.cardTitle,children:a("security_login_history_title")}),e.jsx(aa,{})]}),e.jsxs("div",{className:c.card,children:[e.jsx("h2",{className:c.cardTitle,children:a("security_settings_title")}),e.jsx(oa,{})]})]})},ra="_container_1bzu7_1",na="_centered_1bzu7_8",ia="_errorIcon_1bzu7_18",ca="_title_1bzu7_22",la="_grid_1bzu7_29",da="_leftColumn_1bzu7_36",ua="_sectionTitle_1bzu7_48",ma="_sectionDescription_1bzu7_58",ha="_card_1bzu7_65",pa="_cardContent_1bzu7_72",ga="_cardFooter_1bzu7_76",xa="_savingMessage_1bzu7_96",va="_errorMessage_1bzu7_103",ya="_autoSaveNote_1bzu7_109",_a="_avatarUploadContainer_1bzu7_116",ja="_avatarPreview_1bzu7_122",fa="_uploadingOverlay_1bzu7_145",wa="_uploadingText_1bzu7_158",Ca="_avatarUploadSection_1bzu7_165",Na="_avatarDropzone_1bzu7_170",ba="_customizationGrid_1bzu7_197",Sa="_customizationSection_1bzu7_203",za="_customizationTitle_1bzu7_213",Da="_customizationDesc_1bzu7_223",Pa="_colorRow_1bzu7_230",Ta="_colorField_1bzu7_236",Ea="_colorLabel_1bzu7_243",Ia="_modeToggleContainer_1bzu7_249",t={container:ra,centered:na,errorIcon:ia,title:ca,grid:la,leftColumn:da,sectionTitle:ua,sectionDescription:ma,card:ha,cardContent:pa,cardFooter:ga,savingMessage:xa,errorMessage:va,autoSaveNote:ya,avatarUploadContainer:_a,avatarPreview:ja,uploadingOverlay:fa,uploadingText:wa,avatarUploadSection:Ca,avatarDropzone:Na,customizationGrid:ba,customizationSection:Sa,customizationTitle:za,customizationDesc:Da,colorRow:Pa,colorField:Ta,colorLabel:Ea,modeToggleContainer:Ia},Fa={fr:{title:"Profil Utilisateur",metaDescription:"Gérez votre profil utilisateur, vos notifications et vos paramètres de sécurité.",personalInfo:"Informations Personnelles",personalInfoDesc:"Mettez à jour vos informations personnelles ici.",displayName:"Nom d'affichage",displayNamePlaceholder:"Entrez votre nom d'affichage",email:"Email",emailDesc:"Votre email ne peut pas être modifié.",phone:"Téléphone",phonePlaceholder:"(514) 555-1234",address:"Adresse",addressPlaceholder:"Entrez votre adresse",updateProfile:"Mettre à jour le profil",updating:"Mise à jour...",companyCustomization:"Personnalisation d'Entreprise",companyCustomizationDesc:"Personnalisez l'apparence et les modèles de votre interface.",colorTheme:"Thème de couleurs",colorThemeDesc:"Choisissez la couleur principale de votre interface",primaryColor:"Couleur principale",accentColor:"Couleur d'accent",displayMode:"Mode d'affichage",displayModeDesc:"Choisissez entre le mode clair, sombre ou automatique",modeLight:"Mode clair",modeDark:"Mode sombre",modeAuto:"Mode automatique",saveCustomization:"Sauvegarder la personnalisation",saveCustomizationMobile:"Sauvegarder",savingCustomization:"Sauvegarde...",accountSecurity:"Sécurité du Compte",accountSecurityDesc:"Gérez les paramètres de sécurité de votre compte.",accountSecurityWIP:"La gestion de la sécurité du compte sera bientôt disponible.",geolocation:"Géolocalisation",geolocationDesc:"Gérez votre consentement pour le suivi de géolocalisation.",geolocationExplanation:"Nous utilisons la géolocalisation pour optimiser le suivi de vos temps sur les chantiers et informer automatiquement les clients de votre arrivée.",enableGeolocation:"Activer la géolocalisation",consentGivenOn:"Consentement donné le : ",viewConditions:"Voir les conditions complètes",avatar:"Avatar",avatarDesc:"Changez votre photo de profil.",upload:"Télécharger une image",uploadDragDrop:"Cliquez pour téléverser ou glissez-déposez une image",uploadSubtitle:"JPG, PNG jusqu'à 5Mo",uploading:"Téléchargement...",loadingError:"Erreur de chargement du profil",loadingErrorDesc:"Nous n'avons pas pu charger vos données de profil. Veuillez réessayer plus tard."},en:{title:"User Profile",metaDescription:"Manage your user profile, notifications, and security settings.",personalInfo:"Personal Information",personalInfoDesc:"Update your personal information here.",displayName:"Display Name",displayNamePlaceholder:"Enter your display name",email:"Email",emailDesc:"Your email cannot be changed.",phone:"Phone",phonePlaceholder:"(514) 555-1234",address:"Address",addressPlaceholder:"Enter your address",updateProfile:"Update Profile",updating:"Updating...",companyCustomization:"Company Customization",companyCustomizationDesc:"Customize the appearance and templates of your interface.",colorTheme:"Color Theme",colorThemeDesc:"Choose the primary color of your interface",primaryColor:"Primary Color",accentColor:"Accent Color",displayMode:"Display Mode",dis
1playModeDesc:"Choose between light, dark, or automatic mode",modeLight:"Light Mode",modeDark:"Dark Mode",modeAuto:"Auto Mode",saveCustomization:"Save Customization",saveCustomizationMobile:"Save",savingCustomization:"Saving...",accountSecurity:"Account Security",accountSecurityDesc:"Manage your account security settings.",accountSecurityWIP:"Account security management will be available soon.",geolocation:"Geolocation",geolocationDesc:"Manage your consent for geolocation tracking.",geolocationExplanation:"We use geolocation to optimize time tracking on construction sites and automatically notify clients of your arrival.",enableGeolocation:"Enable geolocation",consentGivenOn:"Consent given on: ",viewConditions:"View full conditions",avatar:"Avatar",avatarDesc:"Change your profile picture.",upload:"Upload Image",uploadDragDrop:"Click to upload or drag and drop an image",uploadSubtitle:"JPG, PNG up to 5MB",uploading:"Uploading...",loadingError:"Error Loading Profile",loadingErrorDesc:"We couldn't load your profile data. Please try again later."}},Ma=()=>e.jsxs("div",{className:t.container,children:[e.jsx(m,{style:{height:"2.5rem",width:"200px",marginBottom:"var(--spacing-8)"}}),e.jsxs("div",{className:t.grid,children:[e.jsxs("div",{className:t.leftColumn,children:[e.jsx(m,{style:{height:"2rem",width:"150px"}}),e.jsx(m,{style:{height:"1rem",width:"250px",marginTop:"var(--spacing-2)"}})]}),e.jsx("div",{className:t.card,children:e.jsxs("div",{className:t.cardContent,children:[e.jsx(m,{style:{height:"1.5rem",width:"100px",marginBottom:"var(--spacing-2)"}}),e.jsx(m,{style:{height:"2.5rem",width:"100%"}}),e.jsx(m,{style:{height:"1.5rem",width:"100px",marginTop:"var(--spacing-4)",marginBottom:"var(--spacing-2)"}}),e.jsx(m,{style:{height:"2.5rem",width:"100%"}}),e.jsx(m,{style:{height:"2.5rem",width:"120px",marginTop:"var(--spacing-6)"}})]})})]})]});function eo(){const{language:a}=C(),s=Fa[a],{data:o,isFetching:n,isError:l}=Oe(),{mutate:r,isPending:i}=Be(),{mutate:p,isPending:_}=cs(),{data:j,isFetching:P}=Ue(),{mutate:M,isPending:T}=Le(),{authState:F}=le(),u=F.type==="authenticated"&&F.user.regionCode==="FR_FR",{mode:B,setThemeMode:A}=Re(),f=d=>{d&&A(d)},V=z.useMemo(()=>({}),[]),{roleColors:k,tradeColors:U,setRoleColor:me,setTradeColor:he,isSaving:pe,error:W}=Je(V),[K,ge]=ze.useState(null),v=ne({schema:Ve,defaultValues:{displayName:"",phone:"",address:""}});z.useEffect(()=>{o&&!("error"in o)&&v.setValues({displayName:o.displayName||"",phone:o.phone?se(o.phone,u?"FR_FR":void 0):"",address:o.address||""})},[o,v.setValues,u]),z.useEffect(()=>{k.company&&U.general&&Ge(k.company,U.general)},[k.company,U.general]);const xe=d=>{r(d)},ve=d=>{me("company",d)},ye=d=>{he("general",d)},_e=d=>{M({consentGiven:d})},je=d=>{const x=d[0];if(!x||ue(x))return;const Z=new FileReader;Z.onload=fe=>{ge(fe.target?.result)},Z.readAsDataURL(x),p(x)};return n?e.jsx(Ma,{}):l||!o||"error"in o?e.jsxs("div",{className:`${t.container} ${t.centered}`,children:[e.jsx(H,{size:48,className:t.errorIcon}),e.jsx("h2",{children:s.loadingError}),e.jsx("p",{children:s.loadingErrorDesc})]}):e.jsxs(e.Fragment,{children:[e.jsxs(De,{children:[e.jsx("title",{children:s.title}),e.jsx("meta",{name:"description",content:s.metaDescription})]}),e.jsxs("div",{className:t.container,children:[e.jsx("h1",{className:t.title,children:s.title}),e.jsxs("div",{className:t.grid,children:[e.jsxs("div",{className:t.leftColumn,children:[e.jsxs("h2",{className:t.sectionTitle,children:[e.jsx(Pe,{size:20})," ",s.personalInfo]}),e.jsx("p",{className:t.sectionDescription,children:s.personalInfoDesc})]}),e.jsx("div",{className:t.card,children:e.jsx(ie,{...v,children:e.jsxs("form",{onSubmit:v.handleSubmit(xe),className:t.cardContent,children:[e.jsxs(N,{name:"displayName",children:[e.jsx(b,{children:s.displayName}),e.jsx(S,{children:e.jsx(R,{placeholder:s.displayNamePlaceholder,value:v.values.displayName,onChange:d=>v.setValues(x=>({...x,displayName:d.target.value}))})}),e.jsx(E,{})]}),e.jsxs(N,{name:"email",children:[e.jsx(b,{children:s.email}),e.jsx(S,{children:e.jsx(R,{value:o.email,disabled:!0})}),e.jsx(ke,{children:s.emailDesc})]}),e.jsxs(N,{name:"phone",children:[e.jsx(b,{children:s.phone}),e.jsx(S,{children:e.jsx(R,{placeholder:u?"06 12 34 56 78":s.phonePlaceholder,value:v.values.phone??"",onChange:d=>v.setValues(x=>({...x,phone:se(d.target.value,u?"FR_FR":void 0)}))})}),e.jsx(E,{})]}),e.jsxs(N,{name:"address",children:[e.jsx(b,{children:s.address}),e.jsx(S,{children:e.jsx(ss,{placeholder:s.addressPlaceholder,value:v.values.address??"",onValueChange:d=>v.setValues(x=>({...x,address:d})),onSelect:d=>v.setValues(x=>({...x,address:d.address}
1)),language:a,countryFilter:u?"FR":"CA"})}),e.jsx(E,{})]}),e.jsx("div",{className:t.cardFooter,children:e.jsx(I,{type:"submit",disabled:i,children:i?s.updating:s.updateProfile})})]})})}),e.jsxs("div",{className:t.leftColumn,children:[e.jsx("h2",{className:t.sectionTitle,children:s.avatar}),e.jsx("p",{className:t.sectionDescription,children:s.avatarDesc})]}),e.jsx("div",{className:t.card,children:e.jsx("div",{className:t.cardContent,children:e.jsxs("div",{className:t.avatarUploadContainer,children:[e.jsxs("div",{className:t.avatarPreview,children:[K||o.avatarUrl?e.jsx("img",{src:K||o.avatarUrl||"",alt:"Avatar"}):e.jsx("span",{children:o.displayName?.charAt(0).toUpperCase()}),_&&e.jsx("div",{className:t.uploadingOverlay,children:e.jsx("div",{className:t.uploadingText,children:s.uploading})})]}),e.jsx("div",{className:t.avatarUploadSection,children:e.jsx(es,{accept:"image/jpeg,image/jpg,image/png",maxFiles:1,maxSize:5*1024*1024,onFilesSelected:je,disabled:_,icon:e.jsx(Te,{size:32}),title:s.uploadDragDrop,subtitle:s.uploadSubtitle,className:t.avatarDropzone})})]})})}),e.jsxs("div",{className:t.leftColumn,children:[e.jsxs("h2",{className:t.sectionTitle,children:[e.jsx(J,{size:20})," ",s.companyCustomization]}),e.jsx("p",{className:t.sectionDescription,children:s.companyCustomizationDesc})]}),e.jsx("div",{className:t.card,children:e.jsxs("div",{className:t.cardContent,children:[e.jsxs("div",{className:t.customizationGrid,children:[e.jsxs("div",{className:t.customizationSection,children:[e.jsxs("h3",{className:t.customizationTitle,children:[e.jsx(J,{size:16})," ",s.colorTheme]}),e.jsx("p",{className:t.customizationDesc,children:s.colorThemeDesc}),e.jsxs("div",{className:t.colorRow,children:[e.jsxs("div",{className:t.colorField,children:[e.jsx("label",{className:t.colorLabel,children:s.primaryColor}),e.jsx(ae,{color:k.company||"#00BFFF",onChange:ve,lang:a})]}),e.jsxs("div",{className:t.colorField,children:[e.jsx("label",{className:t.colorLabel,children:s.accentColor}),e.jsx(ae,{color:U.general||"#00BFFF",onChange:ye,lang:a})]})]}),pe&&e.jsx("p",{className:t.savingMessage,children:s.savingCustomization}),W&&e.jsx("p",{className:t.errorMessage,children:W})]}),e.jsxs("div",{className:t.customizationSection,children:[e.jsxs("h3",{className:t.customizationTitle,children:[e.jsx(X,{size:16})," ",s.displayMode]}),e.jsx("p",{className:t.customizationDesc,children:s.displayModeDesc}),e.jsx("div",{className:t.modeToggleContainer,children:e.jsxs(Xe,{type:"single",value:B,onValueChange:f,variant:"outline",size:"md",children:[e.jsxs(Y,{value:"light","aria-label":s.modeLight,children:[e.jsx(X,{size:16,style:{marginRight:"0.5rem"}})," ",s.modeLight]}
1),e.jsxs(Y,{value:"dark","aria-label":s.modeDark,children:[e.jsx(Ee,{size:16,style:{marginRight:"0.5rem"}})," ",s.modeDark]}),e.jsxs(Y,{value:"auto","aria-label":s.modeAuto,children:[e.jsx(Ie,{size:16,style:{marginRight:"0.5rem"}})," ",s.modeAuto]})]})})]})]}),e.jsx("div",{className:t.cardFooter,children:e.jsx("p",{className:t.autoSaveNote,children:a==="fr"?"Les changements de couleurs sont sauvegardés automatiquement":"Color changes are saved automatically"})})]})}),e.jsxs("div",{className:t.leftColumn,children:[e.jsxs("h2",{className:t.sectionTitle,children:[e.jsx(Fe,{size:20})," ",s.accountSecurity]}),e.jsx("p",{className:t.sectionDescription,children:s.accountSecurityDesc})]}),e.jsx("div",{className:t.card,children:e.jsx("div",{className:t.cardContent,children:e.jsx(ta,{})})}),e.jsxs("div",{className:t.leftColumn,children:[e.jsxs("h2",{className:t.sectionTitle,children:[e.jsx(Me,{size:20})," ",s.geolocation]}),e.jsx("p",{className:t.sectionDescription,children:s.geolocationDesc})]}),e.jsx("div",{className:t.card,children:e.jsxs("div",{className:t.cardContent,children:[e.jsx("p",{style:{marginBottom:"var(--spacing-4)",lineHeight:1.5},children:s.geolocationExplanation}),P&&!j?e.jsx(m,{style:{height:"2.5rem",width:"100%"}}):e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"var(--spacing-4)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"var(--spacing-4)"},children:[e.jsx(de,{id:"geolocation-consent",checked:j?.consentGiven??!1,onCheckedChange:_e,disabled:T}),e.jsx("label",{htmlFor:"geolocation-consent",style:{fontWeight:500,color:"var(--foreground)"},children:s.enableGeolocation})]}),j?.consentGiven&&j.consentedAt&&e.jsxs("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground)",margin:0},children:[s.consentGivenOn," ",new Date(j.consentedAt).toLocaleDateString(a==="fr"?"fr-FR":"en-US",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})]}),e.jsx(Ae,{to:"/conditions#geolocation",style:{fontSize:"0.875rem",display:"inline-block",marginTop:"var(--spacing-2)"},children:s.viewConditions})]})]})}),e.jsxs("div",{className:t.leftColumn,children:[e.jsxs("h2",{className:t.sectionTitle,style:{color:"var(--error)"},children:[e.jsx(q,{size:20})," ",a==="fr"?"Zone de danger":"Danger Zone"]}),e.jsx("p",{className:t.sectionDescription,children:a==="fr"?"Actions irréversibles pour votre compte.":"Irreversible actions for your account."})]}),e.jsx("div",{style:{display:"flex",flexDirection:"column"},children:e.jsx(Ss,{})})]})]})]})}export{eo as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.