T.ME/BIBIL_0DAY
CasperSecurity


Server : Apache/2
System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User : gositeme ( 1004)
PHP Version : 8.2.29
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Directory :  /home/gositeme/domains/lavocat.ca/private_html/.next/static/chunks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.ca/private_html/.next/static/chunks/3180-480e5a37c75927ef.js
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3180],{10799:(e,s,a)=>{a.r(s),a.d(s,{default:()=>el});var t=a(37876),r=a(89099),n=a(14232),i=a(10553),o=a(48230),l=a.n(o);let c=()=>{let[e,s]=(0,n.useState)("fr");(0,r.useRouter)();let[a,i]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{localStorage.getItem("cookieConsent")||i(!0)},[]),a)?(0,t.jsx)("div",{className:"fixed bottom-0 left-0 right-0 bg-white border-t border-gray-200 shadow-lg z-50",children:(0,t.jsx)("div",{className:"max-w-7xl mx-auto px-4 py-4",children:(0,t.jsxs)("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 text-sm text-gray-600",children:["We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.",(0,t.jsxs)("div",{className:"mt-2 md:mt-0 md:inline-block md:ml-2",children:[(0,t.jsx)(l(),{href:"en"===e?"/en/privacy-policy":"/privacy-policy",className:"text-primary hover:text-primary-dark",children:"Privacy Policy"})," • ",(0,t.jsx)(l(),{href:"en"===e?"/en/cookie-policy":"/cookie-policy",className:"text-primary hover:text-primary-dark",children:"Cookie Policy"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("button",{onClick:()=>{localStorage.setItem("cookieConsent","true"),i(!1)},className:"bg-primary text-white px-6 py-2 rounded-full hover:bg-primary-dark transition-colors",children:"Accept"}),(0,t.jsx)("button",{onClick:()=>i(!1),className:"text-gray-500 hover:text-gray-700","aria-label":"Close",children:(0,t.jsx)("span",{className:"w-5 h-5 flex items-center justify-center text-xl font-bold",children:"\xd7"})})]})]})})}):null};var d=a(23042),m=a(35667),u=a(54869),h=a(96985),x=a(11340),p=a(78572),g=a(65390),f=a(67396),y=a(69976),b=a(41378),v=a(62212),j=a(12347),N=a(33274),w=a(25037),A=a(71449),S=a(37581),C=a(72671),k=a(26124),I=a(17057),D=a(59116),P=a(43846),E=a(30822),M=a(96108),L=a(25135),T=a(45450),R=a(10797),U=a(70672),O=a(28447),F=a(99239),z=a(79516),J=a(6314),B=a(92577),W=a(19544),_=a(61334),V=a(82585);function G(){var e,s;let{data:a}=(0,i.useSession)(),{stopImpersonation:r,isImpersonating:n}=(0,V.y)();if(!(null==a||null==(e=a.user)?void 0:e.isImpersonating)||!(null==a||null==(s=a.user)?void 0:s.originalUser))return null;let o=async()=>{try{await r()}catch(e){alert("Failed to stop impersonation. Forcing sign out."),(0,i.signOut)({callbackUrl:"/auth/login"}),window.location.href="/auth/login"}};return(0,t.jsxs)("div",{className:"bg-red-600 text-white p-4 flex items-center justify-between z-50",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("b",{children:"Impersonation Mode:"})," You are impersonating another user."]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("button",{onClick:o,className:"bg-white text-red-700 px-4 py-2 rounded font-bold hover:bg-red-100 border border-red-700",title:"Stop Impersonation",children:"\uD83D\uDEAB Stop Impersonation"}),(0,t.jsx)("button",{onClick:()=>{(0,i.signOut)({callbackUrl:"/auth/login"}),window.location.href="/auth/login"},className:"bg-white text-gray-700 px-4 py-2 rounded font-bold hover:bg-gray-100 border border-gray-400",title:"Force Sign Out (if stuck)",children:"Force Sign Out"})]})]})}let Y=()=>{var e,s,a,r,n;let{data:o,status:l}=(0,i.useSession)();return"loading"===l?(0,t.jsx)("div",{className:"text-sm text-gray-500",children:"Loading session..."}):o?(0,t.jsxs)("div",{className:"text-xs text-gray-400 p-2 bg-gray-100 rounded",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Status:"})," ",l]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"User ID:"})," ",null==(e=o.user)?void 0:e.id]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Email:"})," ",null==(s=o.user)?void 0:s.email]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Role:"})," ",null==(a=o.user)?void 0:a.role]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Name:"})," ",null==(r=o.user)?void 0:r.name]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("strong",{children:"Is Impersonating:"})," ",(null==(n=o.user)?void 0:n.isImpersonating)?"Yes":"No"]})]}):(0,t.jsx)("div",{className:"text-sm text-red-500",children:"No session found"})};var H=a(54587),q=a.n(H),K=a(7446),Q=a(33654);let X=e=>{switch(e){case"SUPERADMIN":return"\uD83D\uDC51";case"ADMIN":return"⚡";case"LAWYER":return"\uD83D\uDC68‍\uD83D\uDCBC";case"CLIENT":default:return"\uD83D\uDC64";case"JURIST":return"\uD83D\uDCDA";case"JUDGE":return"⚖️";case"MEDIATOR":return"\uD83E\uDD1D";case"CONSULTANT":return"\uD83D\uDCBC";case"INVESTIGATOR":return"\uD83D\uDD0D";case"EXPERT_WITNESS":return"\uD83C\uDF93";case"SUPPORT_STAFF":return"\uD83D\uDEE0️";case"STUDENT":return"\uD83C\uDF92";case"NOTARY":return"\uD83D\uDCDC"}},$=e=>{switch(e){case"SUPERADMIN":return"bg-purple-100 text-purple-800";case"ADMIN":return"bg-red-100 text-red-800";case"LAWYER":return"bg-blue-100 text-blue-800";case"CLIENT":return"bg-green-100 text-green-800";case"JURIST":return"bg-indigo-100 text-indigo-800";case"JUDGE":return"bg-yellow-100 text-yellow-800";case"MEDIATOR":return"bg-pink-100 text-pink-800";case"CONSULTANT":return"bg-orange-100 text-orange-800";case"INVESTIGATOR":return"bg-teal-100 text-teal-800";case"EXPERT_WITNESS":return"bg-cyan-100 text-cyan-800";case"SUPPORT_STAFF":default:return"bg-gray-100 text-gray-800";case"STUDENT":return"bg-emerald-100 text-emerald-800";case"NOTARY":return"bg-amber-100 text-amber-800"}};function Z(e){let{isOpen:s,onClose:a}=e,[r,i]=(0,n.useState)([]),[o,l]=(0,n.useState)(!1),[c,d]=(0,n.useState)(""),[m,u]=(0,n.useState)("all"),{impersonateUser:h}=(0,V.y)(),[x,p]=(0,n.useState)(null);(0,n.useEffect)(()=>{s&&f()},[s]);let f=async()=>{try{l(!0);let e=await fetch("/api/admin/users");if(console.log("API Response status:",e.status),console.log("API Response ok:",e.ok),!e.ok){let s=await e.text();throw console.error("API Error response:",s),Error("Failed to fetch users: ".concat(e.status," - ").concat(s))}let s=await e.json();i(s)}catch(e){console.error("Error fetching users:",e),p(e instanceof Error?e.message:"Failed to load users")}finally{l(!1)}},y=async e=>{try{console.log("\uD83D\uDD04 Impersonation modal - Starting impersonation for user:",e),await h(e.id,e.name)?(console.log("\uD83D\uDD04 Impersonation modal - Success, closing modal"),a()):console.error("\uD83D\uDD04 Impersonation modal - Failed to impersonate user")}catch(e){console.error("\uD83D\uDD04 Impersonation modal - Error during impersonation:",e)}},b=r.filter(e=>{let s=e.name.toLowerCase().includes(c.toLowerCase())||e.email.toLowerCase().includes(c.toLowerCase())||e.role.toLowerCase().includes(c.toLowerCase()),a="all"===m||e.role===m;return s&&a}),v=Array.from(new Set(r.map(e=>e.role))).sort();return s?(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,t.jsxs)("div",{className:"bg-white rounded-xl shadow-2xl max-w-4xl w-full mx-4 max-h-[80vh] flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Impersonate User"}),(0,t.jsx)("p",{className:"text-gray-600 mt-1",children:"Select a user to impersonate their account"})]}),(0,t.jsx)("button",{onClick:a,className:"text-gray-400 hover:text-gray-600 transition-colors",children:(0,t.jsx)("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,t.jsx)("div",{className:"p-6 border-b border-gray-200 bg-gray-50",children:(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(z.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400 w-4 h-4"}),(0,t.jsx)("input",{type:"text",placeholder:"Search users by name, email, or role...",value:c,onChange:e=>d(e.target.value),className:"w-full pl-10 pr-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),(0,t.jsx)("div",{children:(0,t.jsxs)("select",{value:m,onChange:e=>u(e.target.value),className:"w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[(0,t.jsx)("option",{value:"all",children:"All Roles"}),v.map(e=>(0,t.jsxs)("option",{value:e,children:[X(e)," ",e]},e))]})})]})}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto p-6",children:o?(0,t.jsxs)("div",{className:"flex items-center justify-center py-12",children:[(0,t.jsx)(K.A,{className:"w-8 h-8 animate-spin text-blue-600"}),(0,t.jsx)("span",{className:"ml-2 text-gray-600",children:"Loading users..."})]}):0===b.length?(0,t.jsxs)("div",{className:"text-center py-12",children:[(0,t.jsx)(C.A,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),(0,t.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No users found"}),(0,t.jsx)("p",{className:"text-gray-500",children:"Try adjusting your search or filters."})]}):(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:b.map(e=>(0,t.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>y(e),children:[(0,t.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:e.image?(0,t.jsx)(q(),{src:e.image,alt:e.name,width:48,height:48,className:"rounded-full"}):(0,t.jsx)("div",{className:"w-12 h-12 bg-gray-200 rounded-full flex items-center justify-center",children:(0,t.jsx)(C.A,{className:"w-6 h-6 text-gray-500"})})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center space-x-2 mb-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900 truncate",children:e.name}),(0,t.jsxs)("span",{className:"px-2 py-1 rounded-full text-xs font-medium ".concat($(e.role)),children:[X(e.role)," ",e.role]})]}),(0,t.jsxs)("div",{className:"flex items-center text-xs text-gray-500 mb-2",children:[(0,t.jsx)(j.A,{className:"w-3 h-3 mr-1"}),(0,t.jsx)("span",{className:"truncate",children:e.email})]}),(0,t.jsxs)("div",{className:"flex items-center text-xs text-gray-500 mb-2",children:[(0,t.jsx)(Q.A,{className:"w-3 h-3 mr-1"}),(0,t.jsxs)("span",{children:["Joined ",new Date(e.createdAt).toLocaleDateString()]})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4 text-xs text-gray-500",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(g.A,{className:"w-3 h-3 mr-1"}),(0,t.jsxs)("span",{children:[e.stats.registrations," apps"]})]}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(L.A,{className:"w-3 h-3 mr-1"}),(0,t.jsxs)("span",{children:[e.stats.cases," cases"]})]})]})]})]}),(0,t.jsx)("div",{className:"mt-3 pt-3 border-t border-gray-100",children:(0,t.jsx)("button",{className:"w-full bg-blue-600 hover:bg-blue-700 text-white text-sm font-medium py-2 px-3 rounded-md transition-colors",children:"Impersonate"})})]},e.id))})}),(0,t.jsx)("div",{className:"p-6 border-t border-gray-200 bg-gray-50",children:(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[(0,t.jsxs)("div",{className:"text-sm text-gray-600",children:[b.length," user",1!==b.length?"s":""," found"]}),(0,t.jsx)("button",{onClick:a,className:"px-4 py-2 bg-gray-300 hover:bg-gray-400 text-gray-800 rounded-md transition-colors",children:"Cancel"})]})})]})}):null}var ee=a(42341),es=a(47297);let ea=e=>{var s;let{isOpen:a,onClose:r}=e,{data:o}=(0,i.useSession)(),[l,c]=(0,n.useState)({showFriends:!0,showEmail:!1,showPhone:!1,showLocation:!1,allowMessages:!0,showOnlineStatus:!0}),[u,h]=(0,n.useState)(!1),[x,p]=(0,n.useState)("");(0,n.useEffect)(()=>{var e;a&&(null==o||null==(e=o.user)?void 0:e.id)&&g()},[a,null==o||null==(s=o.user)?void 0:s.id]);let g=async()=>{try{var e,s,a,t,r,n,i;let l=await fetch("/api/users/".concat(null==o||null==(e=o.user)?void 0:e.id));if(l.ok){let e=await l.json();c({showFriends:null==(s=e.showFriends)||s,showEmail:null!=(a=e.showEmail)&&a,showPhone:null!=(t=e.showPhone)&&t,showLocation:null!=(r=e.showLocation)&&r,allowMessages:null==(n=e.allowMessages)||n,showOnlineStatus:null==(i=e.showOnlineStatus)||i})}}catch(e){console.error("Error fetching privacy settings:",e)}},y=async()=>{var e;if(null==o||null==(e=o.user)?void 0:e.id){h(!0),p("");try{(await fetch("/api/users/".concat(o.user.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).ok?(p("Privacy settings updated successfully!"),setTimeout(()=>p(""),3e3)):p("Failed to update privacy settings. Please try again.")}catch(e){console.error("Error updating privacy settings:",e),p("An error occurred. Please try again.")}finally{h(!1)}}},b=e=>{c(s=>({...s,[e]:!s[e]}))},v=[{key:"showFriends",label:"Show Friends List",description:"Allow others to see your friends and connections",icon:f.A,category:"Profile Visibility"},{key:"showEmail",label:"Show Email Address",description:"Display your email address on your profile",icon:ee.A,category:"Contact Information"},{key:"showPhone",label:"Show Phone Number",description:"Display your phone number on your profile",icon:ee.A,category:"Contact Information"},{key:"showLocation",label:"Show Location",description:"Display your location on your profile",icon:ee.A,category:"Profile Visibility"},{key:"allowMessages",label:"Allow Direct Messages",description:"Let other users send you private messages",icon:F.A,category:"Communication"},{key:"showOnlineStatus",label:"Show Online Status",description:"Display when you are online",icon:ee.A,category:"Profile Visibility"}].reduce((e,s)=>(e[s.category]||(e[s.category]=[]),e[s.category].push(s),e),{});return(0,t.jsx)(d.N,{children:a&&(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:(0,t.jsxs)(m.P.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-white rounded-xl shadow-2xl max-w-2xl w-full max-h-[90vh] overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"p-2 bg-blue-100 rounded-lg",children:(0,t.jsx)(A.A,{className:"h-6 w-6 text-blue-600"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h2",{className:"text-xl font-semibold text-gray-900",children:"Privacy Settings"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Control who can see your information"})]})]}),(0,t.jsx)("button",{onClick:r,className:"p-2 hover:bg-gray-100 rounded-lg transition-colors",children:(0,t.jsx)(U.A,{className:"h-5 w-5 text-gray-500"})})]}),(0,t.jsxs)("div",{className:"p-6 overflow-y-auto max-h-[60vh]",children:[x&&(0,t.jsx)("div",{className:"mb-4 p-3 rounded-lg text-sm ".concat(x.includes("successfully")?"bg-green-50 text-green-700 border border-green-200":"bg-red-50 text-red-700 border border-red-200"),children:x}),(0,t.jsx)("div",{className:"space-y-6",children:Object.entries(v).map(e=>{let[s,a]=e;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("h3",{className:"text-lg font-medium text-gray-900 mb-3 flex items-center gap-2",children:[(0,t.jsx)(es.A,{className:"h-5 w-5 text-gray-600"}),s]}),(0,t.jsx)("div",{className:"space-y-3",children:a.map(e=>{let s=e.icon;return(0,t.jsxs)("div",{className:"flex items-center justify-between p-4 border border-gray-200 rounded-lg hover:bg-gray-50 transition-colors",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3 flex-1",children:[(0,t.jsx)("div",{className:"p-2 bg-gray-100 rounded-lg",children:(0,t.jsx)(s,{className:"h-4 w-4 text-gray-600"})}),(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("h4",{className:"font-medium text-gray-900",children:e.label}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:e.description})]})]}),(0,t.jsx)("button",{onClick:()=>b(e.key),className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(l[e.key]?"bg-blue-600":"bg-gray-200"),children:(0,t.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(l[e.key]?"translate-x-6":"translate-x-1")})})]},e.key)})})]},s)})})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200 bg-gray-50",children:[(0,t.jsx)("button",{onClick:r,className:"px-4 py-2 text-gray-700 bg-white border border-gray-300 rounded-lg hover:bg-gray-50 transition-colors",children:"Cancel"}),(0,t.jsx)("button",{onClick:y,disabled:u,className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2",children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})})};var et=a(20710),er=a(86739);let en=e=>{let{userId:s,userRole:a}=e,i=(0,r.useRouter)(),[o,l]=(0,n.useState)(null),[c,d]=(0,n.useState)(!0),[m,u]=(0,n.useState)(!1);(0,n.useEffect)(()=>{h()},[s]);let h=async()=>{try{d(!0);let e=await fetch("/api/user/financial-summary");if(e.ok){let s=await e.json();l({pendingPayments:s.pendingPayments||0,overdueInvoices:s.overdueInvoices||0,totalSpent:s.totalSpent||0,thisMonthSpent:s.thisMonthSpent||0})}}catch(e){console.error("Error fetching payment info:",e)}finally{d(!1)}},x=function(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"CAD";return new Intl.NumberFormat("en-CA",{style:"currency",currency:s}).format(e)},p=o&&(o.pendingPayments>0||o.overdueInvoices>0);return c?(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)("button",{className:"p-2 rounded-full hover:bg-white/20 transition flex items-center",children:(0,t.jsx)(D.A,{className:"h-5 w-5 text-white"})})}):(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsxs)("button",{onClick:()=>u(!m),className:"p-2 rounded-full hover:bg-white/20 transition flex items-center relative ".concat(p?"text-yellow-400":"text-white"),children:[(0,t.jsx)(D.A,{className:"h-5 w-5"}),p&&(0,t.jsx)("span",{className:"absolute -top-1 -right-1 w-3 h-3 bg-red-500 rounded-full animate-pulse"})]}),m&&(0,t.jsx)("div",{className:"absolute right-0 mt-2 w-64 bg-white shadow-lg rounded-lg border border-gray-200 z-50",children:(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Payments"}),(0,t.jsx)("button",{onClick:()=>{u(!1),i.push("/user/payments")},className:"text-xs text-blue-600 hover:text-blue-800",children:"View All"})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-lg font-bold text-gray-900",children:x((null==o?void 0:o.totalSpent)||0)}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Total Spent"})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-lg font-bold text-gray-900",children:x((null==o?void 0:o.thisMonthSpent)||0)}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"This Month"})]})]}),p&&(0,t.jsxs)("div",{className:"space-y-2 mb-3",children:[(null==o?void 0:o.pendingPayments)>0&&(0,t.jsxs)("div",{className:"flex items-center p-2 bg-yellow-50 rounded text-xs",children:[(0,t.jsx)(et.A,{className:"h-3 w-3 text-yellow-600 mr-2"}),(0,t.jsxs)("span",{className:"text-yellow-800",children:[o.pendingPayments," pending payment",o.pendingPayments>1?"s":""]})]}),(null==o?void 0:o.overdueInvoices)>0&&(0,t.jsxs)("div",{className:"flex items-center p-2 bg-red-50 rounded text-xs",children:[(0,t.jsx)(er.A,{className:"h-3 w-3 text-red-600 mr-2"}),(0,t.jsxs)("span",{className:"text-red-800",children:[o.overdueInvoices," overdue invoice",o.overdueInvoices>1?"s":""]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("button",{onClick:()=>{u(!1),i.push("/user/payments")},className:"w-full flex items-center p-2 text-sm text-gray-700 hover:bg-gray-50 rounded transition-colors",children:[(0,t.jsx)(ee.A,{className:"h-4 w-4 mr-2"}),"View Payments"]}),(0,t.jsxs)("button",{onClick:()=>{u(!1),i.push("/user/subscription")},className:"w-full flex items-center p-2 text-sm text-gray-700 hover:bg-gray-50 rounded transition-colors",children:[(0,t.jsx)(P.A,{className:"h-4 w-4 mr-2"}),"Subscription"]}),(0,t.jsxs)("button",{onClick:()=>{u(!1),i.push("/user/payments?tab=methods")},className:"w-full flex items-center p-2 text-sm text-gray-700 hover:bg-gray-50 rounded transition-colors",children:[(0,t.jsx)(P.A,{className:"h-4 w-4 mr-2"}),"Payment Methods"]})]})]})})]})};var ei=a(38500);let eo=()=>{var e;let[s,a]=(0,n.useState)("fr"),{data:r}=(0,i.useSession)();return(0,t.jsxs)("footer",{className:"bg-gradient-to-b from-primary to-orange-600 text-white pt-8 pb-4 px-4 mt-12",children:[(0,t.jsxs)("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row md:justify-between md:items-start gap-8",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center md:items-start mb-6 md:mb-0",children:[(0,t.jsx)(q(),{src:"/images/Logo_w.png",alt:"Libert\xe9 M\xeame en Prison Logo",width:80,height:80,className:"mb-2"}),(0,t.jsx)("span",{className:"font-bold text-lg",children:"LIBERT\xc9 M\xcaME EN PRISON"})]}),(0,t.jsxs)("div",{className:"flex-1 grid grid-cols-2 md:grid-cols-4 gap-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold mb-2",children:"General"}),(0,t.jsxs)("ul",{className:"space-y-1",children:[(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"/",className:"hover:underline",children:"Home"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/about":"/about",className:"hover:underline",children:"About"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/who":"/who",className:"hover:underline",children:"Who"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/contact":"/contact",className:"hover:underline",children:"''Contact''"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/faq":"/faq",className:"hover:underline",children:"FAQ"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/resources":"/resources",className:"hover:underline",children:"Resources"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/class-action":"/class-action",className:"hover:underline",children:"Class Action"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/legal-notice":"/legal-notice",className:"hover:underline",children:"Legal Basis"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold mb-2",children:"Policies"}),(0,t.jsxs)("ul",{className:"space-y-1",children:[(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/privacy-policy":"/privacy-policy",className:"hover:underline",children:"Privacy Policy"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/cookie-policy":"/cookie-policy",className:"hover:underline",children:"Cookie Policy"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/terms":"/terms",className:"hover:underline",children:"Terms"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/accessibility":"/accessibility",className:"hover:underline",children:"Accessibility"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold mb-2",children:"Account"}),(0,t.jsxs)("ul",{className:"space-y-1",children:[!r&&(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/auth/login":"/auth/login",className:"hover:underline",children:"Login"})}),!r&&(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/auth/signup":"/auth/signup",className:"hover:underline",children:"Signup"})}),r&&(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/user/dashboard":"/user/dashboard",className:"hover:underline",children:"Dashboard"})}),(null==r||null==(e=r.user)?void 0:e.role)==="ADMIN"&&(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/admin":"/admin",className:"hover:underline",children:"Admin"})})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"font-semibold mb-2",children:"\uD83D\uDCB0 Financial"}),(0,t.jsxs)("ul",{className:"space-y-1",children:[r&&(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/financial-dashboard":"/financial-dashboard",className:"hover:underline",children:"\uD83D\uDCB0 Financial Dashboard"})}),r&&(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/payment-demo":"/payment-demo",className:"hover:underline",children:"\uD83D\uDCB3 Payment Demo"})}),r&&(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/society-dashboard":"/society-dashboard",className:"hover:underline",children:"⭐ Society Progress"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/profiles":"/profiles",className:"hover:underline",children:"\uD83D\uDC65 Our Team"})}),(0,t.jsx)("li",{children:(0,t.jsx)(l(),{href:"en"===s?"/en/live-cases":"/live-cases",className:"hover:underline",children:"\uD83D\uDCCB Live Cases"})})]})]})]})]}),(0,t.jsxs)("div",{className:"mt-8 border-t border-white/20 pt-4 text-center text-xs text-white/70",children:["\xa9 ",new Date().getFullYear()," Libert\xe9 M\xeame en Cellule. All rights reserved.",(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsx)("span",{className:"text-yellow-300",children:"\uD83D\uDCB3"})," Secure payments powered by Stripe |",(0,t.jsx)("span",{className:"text-blue-300",children:" \uD83D\uDD12"})," Escrow protection for all transactions |",(0,t.jsx)("span",{className:"text-green-300",children:" ⭐"})," Society member benefits available"]})]})]})},el=e=>{var s,a,o,H,K,Q,X,$;let{children:ee}=e,es=(0,r.useRouter)(),{data:et,status:er}=(0,i.useSession)(),[el,ec]=(0,n.useState)(!1),[ed,em]=(0,n.useState)(!1),{theme:eu}=(0,u.D)(),[eh,ex]=(0,n.useState)(!1),{stopImpersonation:ep}=(0,V.y)(),[eg,ef]=(0,n.useState)(null),[ey,eb]=(0,n.useState)({}),[ev,ej]=(0,n.useState)(!1),[eN,ew]=(0,n.useState)(!1),eA=(0,n.useRef)(null),[eS,eC]=(0,n.useState)([]),[ek,eI]=(0,n.useState)(0),[eD,eP]=(0,n.useState)(!1),eE=(0,n.useRef)(null),[eM,eL]=(0,n.useState)(!1),[eT,eR]=(0,n.useState)("fr"),[eU,eO]=(0,n.useState)(!1);(0,n.useEffect)(()=>{em(!0),"authenticated"===er&&fetch("/api/user/business-profile").then(e=>e.ok?e.json():null).then(e=>{e&&e.id&&ef(e.id)})},[er]),(0,n.useEffect)(()=>{let e=e=>{eA.current&&!eA.current.contains(e.target)&&ew(!1)};return eN&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[eN]);let eF=[{name:"Home",href:"/",icon:x.A},{name:"About",href:"/about",icon:p.A},{name:"Bordeaux Case",href:"/class-action",icon:g.A},{name:"\uD83C\uDFDB️ Judicial Directory",href:"/judicial-directory",icon:f.A},{name:"⚖️ Law Firms",href:"/business-profiles",icon:y.A},{name:"\uD83D\uDC65 Society Members",href:"/profiles",icon:f.A},{name:"Justice Roles",href:"/justice-roles",icon:f.A},{name:"Legal Basis",href:"/resources",icon:b.A},{name:"FAQ",href:"/faq",icon:v.A},{name:"Contact",href:"/contact",icon:j.A},{name:"Join Our Team",href:"/join",icon:N.A},{name:"Group Chat",href:"/group-chat",icon:w.A},{name:"\uD83C\uDFDB️ Society Demo",href:"/society-demo",icon:f.A},{name:"\uD83C\uDFDB️ Society Access",href:"/society-access",icon:f.A},{name:"\uD83D\uDCCB Class Action",href:"/class-action",icon:g.A},{name:"⚖️ Legal Notice",href:"/legal-notice",icon:g.A},{name:"\uD83D\uDD27 Additional Capabilities",href:"/additional-capabilities",icon:A.A},{name:"\uD83D\uDCC5 Calendar Demo",href:"/calendar-demo",icon:S.A},{name:"⚖️ Legal Suite",href:"/legal-suite",icon:b.A},{name:"\uD83D\uDCCA Dashboard",href:"/dashboard",icon:S.A},{name:"♿ Accessibility",href:"/accessibility",icon:p.A},{name:"\uD83D\uDC65 Who We Are",href:"/who",icon:f.A},{name:"\uD83D\uDD12 Privacy Policy",href:"/privacy-policy",icon:g.A},{name:"\uD83C\uDF6A Cookie Policy",href:"/cookie-policy",icon:g.A},{name:"\uD83D\uDCC4 Terms",href:"/terms",icon:g.A}],ez=[{name:"Dashboard",href:"/client/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"My Cases",href:"/user/cases",icon:g.A},{name:"My Documents",href:"/documents",icon:g.A},{name:"Messages",href:"/messages",icon:w.A},{name:"My Profile",href:"/user/profile",icon:C.A},{name:"Unified Profile",href:"/profile/unified",icon:A.A},{name:"Applications",href:"/user/applications",icon:g.A},{name:"Subscription Plans",href:"/user/subscription",icon:k.A}],eJ=[{name:"Lawyer Dashboard",href:"/lawyer/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"\uD83D\uDCCA Case Analytics",href:"/analytics/cases",icon:S.A},{name:"My Clients",href:"/lawyer/clients",icon:f.A},{name:"My Cases",href:"/lawyer/cases",icon:g.A},{name:"Team Management",href:"/lawyer/team",icon:f.A},{name:"Business Profile",href:"/user/business-profile",icon:y.A},{name:"Business Analytics",href:"/user/business-analytics",icon:S.A}],eB=[{name:"Jurist Dashboard",href:"/jurist/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Legal Research",href:"/jurist/research",icon:g.A},{name:"Scholarly Publications",href:"/jurist/publications",icon:g.A},{name:"Theory Development",href:"/jurist/theory",icon:S.A},{name:"Academic Collaboration",href:"/jurist/collaboration",icon:f.A}],eW=[{name:"Judge Dashboard",href:"/judge/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Case Oversight",href:"/judge/cases",icon:g.A},{name:"Court Administration",href:"/judge/administration",icon:b.A},{name:"Judicial Tools",href:"/judge/tools",icon:A.A}],e_=[{name:"Mediator Dashboard",href:"/mediator/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Active Mediations",href:"/mediator/cases",icon:g.A},{name:"Settlement Tracking",href:"/mediator/settlements",icon:S.A},{name:"Mediation Tools",href:"/mediator/tools",icon:A.A}],eV=[{name:"Consultant Dashboard",href:"/consultant/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Client Advisory",href:"/consultant/clients",icon:f.A},{name:"Strategic Planning",href:"/consultant/planning",icon:S.A},{name:"Expert Network",href:"/consultant/network",icon:f.A}],eG=[{name:"Investigator Dashboard",href:"/investigator/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Active Investigations",href:"/investigator/cases",icon:g.A},{name:"Evidence Tracking",href:"/investigator/evidence",icon:g.A},{name:"Investigation Tools",href:"/investigator/tools",icon:A.A}],eY=[{name:"Expert Dashboard",href:"/expert/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Expert Testimony",href:"/expert/testimony",icon:g.A},{name:"Case Collaboration",href:"/expert/cases",icon:f.A},{name:"Credential Management",href:"/expert/credentials",icon:A.A}],eH=[{name:"Support Dashboard",href:"/support/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Task Management",href:"/support/tasks",icon:g.A},{name:"Document Processing",href:"/support/documents",icon:g.A},{name:"Team Collaboration",href:"/support/team",icon:f.A}],eq=[{name:"Student Dashboard",href:"/student/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Educational Resources",href:"/student/resources",icon:g.A},{name:"Mentorship Programs",href:"/student/mentorship",icon:f.A},{name:"Practical Experience",href:"/student/experience",icon:S.A}],eK=[{name:"Notary Dashboard",href:"/notary/dashboard",icon:S.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"Notarial Services",href:"/notary/services",icon:g.A},{name:"Document Authentication",href:"/notary/authentication",icon:g.A},{name:"Record Keeping",href:"/notary/records",icon:g.A}],eQ=[{name:"Admin Dashboard",href:"/admin/dashboard",icon:C.A},{name:"\uD83D\uDCCB Case Management",href:"/admin/cases",icon:g.A},{name:"\uD83D\uDCCA Case Analytics",href:"/analytics/cases",icon:S.A},{name:"Case Assignments",href:"/admin/case-assignments",icon:b.A},{name:"Analytics Dashboard",href:"/admin/analytics-dashboard",icon:S.A},{name:"Manage Users",href:"/admin/users",icon:C.A},{name:"\uD83D\uDCE2 Public Notifications",href:"/admin/notifications",icon:g.A},{name:"\uD83D\uDCE7 Newsletter Management",href:"/admin/newsletter",icon:j.A},{name:"⚙️ Admin Options",href:"/admin/options",icon:g.A},{name:"\uD83C\uDFE2 Business Profiles",href:"/admin/business-profiles",icon:y.A},{name:"\uD83E\uDD16 System Automation",href:"/admin/system-automation",icon:A.A},{name:"\uD83D\uDCC1 Cases Directory",href:"/admin/cases",icon:g.A},{name:"\uD83D\uDCE7 Newsletter Templates",href:"/admin/newsletter/templates",icon:j.A},{name:"\uD83D\uDCDD Registration Management",href:"/admin/registrations",icon:g.A},{name:"\uD83D\uDCC4 Application Management",href:"/admin/applications",icon:g.A},{name:"\uD83C\uDFDB️ Barreau Scraper",href:"/admin/barreau-scraper",icon:I.A},{name:"✅ V\xe9rifications Manuelles",href:"/admin/manual-verifications",icon:g.A}],eX=[{name:"\uD83D\uDC51 Super Admin Dashboard",href:"/admin/super",icon:k.A},{name:"\uD83D\uDC65 All User Dashboards",href:"/user/dashboard",icon:C.A},{name:"⚖️ All Lawyer Dashboards",href:"/lawyer/dashboard",icon:b.A},{name:"\uD83D\uDCDA All Jurist Dashboards",href:"/jurist/dashboard",icon:g.A},{name:"\uD83C\uDFDB️ All Judge Dashboards",href:"/judge/dashboard",icon:C.A},{name:"\uD83E\uDD1D All Mediator Dashboards",href:"/mediator/dashboard",icon:f.A},{name:"\uD83D\uDCBC All Consultant Dashboards",href:"/consultant/dashboard",icon:A.A},{name:"\uD83D\uDD0D All Investigator Dashboards",href:"/investigator/dashboard",icon:g.A},{name:"\uD83C\uDFAF All Expert Dashboards",href:"/expert/dashboard",icon:k.A},{name:"\uD83D\uDEE0️ All Support Dashboards",href:"/support/dashboard",icon:A.A},{name:"\uD83C\uDF93 All Student Dashboards",href:"/student/dashboard",icon:C.A},{name:"\uD83D\uDCDC All Notary Dashboards",href:"/notary/dashboard",icon:g.A},{name:"\uD83C\uDFE2 All Client Dashboards",href:"/client/dashboard",icon:y.A}],e$=[{label:"Public",key:"public",items:eF}];if("authenticated"===er&&et){e$.push({label:"\uD83E\uDDD1‍\uD83D\uDCBC Client",key:"client",items:ez});let e="SUPERADMIN"===et.user.role;console.log("Current user role:",et.user.role),console.log("Role type:",typeof et.user.role),console.log("Role comparison with SUPERADMIN:","SUPERADMIN"===et.user.role),console.log("Show all roles:",e),console.log("Full session user object:",et.user),(e||"LAWYER"===et.user.role)&&e$.push({label:"⚖️ Lawyer",key:"lawyer",items:eJ}),(e||"JURIST"===et.user.role)&&e$.push({label:"\uD83D\uDCDA Jurist",key:"jurist",items:eB}),(e||"JUDGE"===et.user.role)&&e$.push({label:"\uD83D\uDC69‍⚖️ Judge",key:"judge",items:eW}),(e||"MEDIATOR"===et.user.role)&&e$.push({label:"\uD83D\uDD4A️ Mediator",key:"mediator",items:e_}),(e||"LEGAL_CONSULTANT"===et.user.role)&&e$.push({label:"\uD83D\uDCBC Consultant",key:"consultant",items:eV}),(e||"INVESTIGATOR"===et.user.role)&&e$.push({label:"\uD83D\uDD75️ Investigator",key:"investigator",items:eG}),(e||"EXPERT_WITNESS"===et.user.role)&&e$.push({label:"\uD83C\uDFAF Expert Witness",key:"expert",items:eY}),(e||["SECRETARY","ASSISTANT","CLERK","COURT_CLERK","PARALEGAL"].includes(et.user.role))&&e$.push({label:"\uD83D\uDEE0️ Support Staff",key:"support",items:eH}),(e||["LAW_STUDENT","LEGAL_INTERN"].includes(et.user.role))&&e$.push({label:"\uD83C\uDF93 Student",key:"student",items:eq}),(e||"NOTARY"===et.user.role)&&e$.push({label:"\uD83D\uDCDC Notary",key:"notary",items:eK}),(e||"ADMIN"===et.user.role||"SUPERADMIN"===et.user.role)&&e$.push({label:"\uD83D\uDEE1️ Admin",key:"admin",items:eQ}),"SUPERADMIN"===et.user.role&&e$.push({label:"\uD83D\uDC51 SUPER ADMIN",key:"super-admin",items:eX}),console.log("Final grouped navigation:",e$.map(e=>({label:e.label,key:e.key,itemCount:e.items.length})))}let eZ=[{name:"\uD83D\uDCB0 Financial Dashboard",href:"/financial-dashboard",icon:D.A},{name:"\uD83D\uDCB3 Payment Demo",href:"/payment-demo",icon:P.A},{name:"\uD83C\uDFDB️ Society Dashboard",href:"/society-dashboard",icon:f.A},{name:"\uD83D\uDCC4 Documents",href:"/documents",icon:g.A}];eg&&eZ.push({name:" Business Profile",href:"/business/".concat(eg),icon:y.A},{name:"\uD83D\uDCCA Business Analytics",href:"/user/business-analytics",icon:S.A}),eZ.push({name:"Manage Business Profile",href:"/user/business-profile",icon:A.A},{name:"Subscription Plans",href:"/user/subscription",icon:k.A},{name:"My Profile",href:"/user/profile",icon:C.A},{name:"My Applications",href:"/user/dashboard",icon:g.A}),et&&et.user&&"SUPERADMIN"===et.user.role&&eZ.push({name:"\uD83D\uDC51 Super Admin",href:"/admin/super",icon:k.A}),eZ.push({name:"⚖️ Hire Lawyer",href:"/hire/case-selection",icon:b.A},{name:"\uD83D\uDCAC Book Consultation",href:"/hire/consultation",icon:w.A},{name:"\uD83D\uDD0D Debug Session",href:"/api/debug-session",icon:A.A});let e0="authenticated"===er&&et&&["CLIENT","USER","ADMIN","SUPERADMIN"].includes(et.user.role),e2=new Date,e1=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e2.getDay()],e5=["January","February","March","April","May","June","July","August","September","October","November","December"][e2.getMonth()],e4=e2.getDate(),e3=e2.getFullYear(),e6="".concat(e1,", ").concat(e5," ").concat(e4).concat((e=>["th","st","nd","rd"][e%10>3||e%100-e%10==10?0:e%10])(e4),", ").concat(e3," A.D."),e8=async()=>{var e,s;try{if(null==et||null==(e=et.user)?void 0:e.isImpersonating){console.log("User is impersonating, stopping impersonation instead of logout"),await ep(),ec(!1);return}console.log("Normal logout"),(0,i.signOut)({redirect:!1}).then(()=>{es.push("/"),ec(!1)})}catch(e){if(console.error("Error during logout/stop impersonation:",e),null==et||null==(s=et.user)?void 0:s.isImpersonating){console.log("Stop impersonation failed, redirecting to admin dashboard"),window.location.href="/admin/dashboard",ec(!1);return}(0,i.signOut)({redirect:!1}).then(()=>{es.push("/"),ec(!1)})}},e7=async()=>{let e=await fetch("/api/notifications");if(e.ok){let s=await e.json();eC(s),eI(s.filter(e=>!e.isRead).length)}};(0,n.useEffect)(()=>{e7();let e=setInterval(e7,15e3);return()=>clearInterval(e)},[]),(0,n.useEffect)(()=>{let e=()=>{e7()};return window.addEventListener("notification-updated",e),()=>window.removeEventListener("notification-updated",e)},[]),(0,n.useEffect)(()=>{let e=e=>{eE.current&&!eE.current.contains(e.target)&&eP(!1)};return eD&&document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[eD]);let e9=async()=>{let e=eS.filter(e=>!e.isRead).map(e=>e.id);e.length>0&&(await fetch("/api/notifications",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e})}),e7())};if(!ed||"loading"===er)return null;let se=e=>{let{label:s,sectionKey:a,children:r}=e;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("button",{className:"flex items-center w-full px-2 py-2 text-left font-semibold text-white hover:bg-white/10 rounded-lg transition-colors mb-1",onClick:()=>eb(e=>({...e,[a]:!e[a]})),"aria-expanded":!!ey[a],children:[ey[a]?(0,t.jsx)(E.A,{className:"h-4 w-4 mr-2"}):(0,t.jsx)(M.A,{className:"h-4 w-4 mr-2"}),s]}),(0,t.jsx)("div",{className:ey[a]?"block":"hidden",children:r})]})},ss=[{label:"Home",href:"/",icon:x.A},{label:"Cases",href:"/live-cases",icon:L.A},{label:"Messages",href:"/messages",icon:T.A},{label:"Groups",href:"/groups",icon:f.A},{label:"Marketplace",href:"/marketplace",icon:R.A},{label:"Documents",href:"/documents",icon:g.A,pdf:!0}];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(h.Ay,{type:"organization",data:(0,h.pu)()}),(0,t.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,t.jsx)("button",{onClick:()=>ec(!el),className:"lg:hidden fixed top-4 right-4 z-50 p-2 rounded-full bg-primary text-white shadow-lg hover:bg-primary-dark transition-colors",children:el?(0,t.jsx)(U.A,{className:"h-6 w-6"}):(0,t.jsx)(O.A,{className:"h-6 w-6"})}),(0,t.jsx)(d.N,{children:el&&(0,t.jsxs)(m.P.div,{initial:{opacity:0,x:-300},animate:{opacity:1,x:0},exit:{opacity:0,x:-300},transition:{duration:.2},className:"lg:hidden fixed inset-0 z-40",children:[(0,t.jsx)("div",{className:"fixed inset-0 bg-gray-600 bg-opacity-75",onClick:()=>ec(!1)}),(0,t.jsx)("div",{className:"fixed inset-y-0 left-0 max-w-xs w-full bg-gradient-to-b from-primary to-primary-dark shadow-xl",children:(0,t.jsxs)("div",{className:"h-full flex flex-col py-6 px-4",children:[(0,t.jsx)("div",{className:"flex items-center justify-center mb-8",children:(0,t.jsx)(l(),{href:"/",onClick:()=>ec(!1),children:(0,t.jsx)("img",{src:"/images/Logo_w.png",alt:"Logo",className:"max-w-full h-auto wave"})})}),(0,t.jsx)(Y,{}),(0,t.jsxs)("nav",{className:"flex-1 space-y-2",children:[e$.map(e=>"public"===e.key?e.items.map((s,a)=>(0,t.jsxs)(l(),{href:s.href,onClick:()=>ec(!1),className:"flex items-center space-x-2 p-2 rounded-lg text-white hover:bg-white/10 transition-colors",children:[(0,t.jsx)(s.icon,{className:"h-5 w-5"}),(0,t.jsx)("span",{children:s.name})]},"string"==typeof s.name?s.name:"nav-item-".concat(e.key,"-").concat(a))):(0,t.jsx)(se,{label:e.label,sectionKey:e.key,children:e.items.map((s,a)=>(0,t.jsxs)(l(),{href:s.href,onClick:()=>ec(!1),className:"flex items-center space-x-2 p-2 rounded-lg text-white hover:bg-white/10 transition-colors ml-4",children:[(0,t.jsx)(s.icon,{className:"h-5 w-5"}),(0,t.jsx)("span",{children:s.name})]},"string"==typeof s.name?s.name:"nav-item-".concat(e.key,"-").concat(a)))},e.key)),eZ.map((e,s)=>(0,t.jsxs)(l(),{href:e.href,onClick:()=>ec(!1),className:"flex items-center space-x-2 p-2 rounded-lg text-white hover:bg-white/10 transition-colors",children:[(0,t.jsx)(e.icon,{className:"h-5 w-5"}),(0,t.jsx)("span",{children:e.name})]},"string"==typeof e.name?e.name:"addon-item-".concat(s))),et?(0,t.jsxs)("button",{onClick:e8,className:"w-full flex items-center space-x-2 p-2 rounded-lg text-white hover:bg-white/10 transition-colors",children:[(0,t.jsx)(F.A,{className:"h-5 w-5"}),(0,t.jsx)("span",{children:(null==(s=et.user)?void 0:s.isImpersonating)?"Stop Impersonating":"Logout"})]}):(0,t.jsxs)(l(),{href:"en"===eT?"/en/auth/login":"/auth/login",onClick:()=>ec(!1),className:"flex items-center space-x-2 p-2 rounded-lg text-white hover:bg-white/10 transition-colors",children:[(0,t.jsx)(F.A,{className:"h-5 w-5"}),(0,t.jsx)("span",{children:"Login"})]})]})]})})]})}),(0,t.jsx)("aside",{className:"hidden lg:block fixed inset-y-0 left-0 w-64 bg-gradient-to-b from-primary to-primary-dark text-white shadow-lg",children:(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsx)("div",{className:"flex items-center justify-center p-4",children:(0,t.jsx)(l(),{href:"/",children:(0,t.jsx)("img",{src:"/images/Logo_w.png",alt:"Logo",className:"max-w-full h-auto wave"})})}),(0,t.jsx)("div",{className:"px-4 pb-2",children:(0,t.jsx)(Y,{})}),(0,t.jsxs)("nav",{className:"flex-1 px-4 space-y-2 overflow-y-auto",children:[e$.map(e=>"public"===e.key?e.items.map((s,a)=>(0,t.jsxs)(l(),{href:s.href,className:"flex items-center space-x-3 p-3 rounded-lg hover:bg-white/10 transition-colors",children:[(0,t.jsx)(s.icon,{className:"h-5 w-5 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:s.name})]},"string"==typeof s.name?s.name:"nav-item-".concat(e.key,"-").concat(a))):(0,t.jsx)(se,{label:e.label,sectionKey:e.key,children:e.items.map((s,a)=>(0,t.jsxs)(l(),{href:s.href,className:"flex items-center space-x-3 p-3 rounded-lg hover:bg-white/10 transition-colors ml-4",children:[(0,t.jsx)(s.icon,{className:"h-5 w-5 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:s.name})]},"string"==typeof s.name?s.name:"nav-item-".concat(e.key,"-").concat(a)))},e.key)),(0,t.jsx)("div",{className:"mt-4 border-t border-white/10 pt-2",children:eZ.map((e,s)=>(0,t.jsxs)(l(),{href:e.href,className:"flex items-center space-x-3 p-3 rounded-lg hover:bg-white/10 transition-colors",children:[(0,t.jsx)(e.icon,{className:"h-5 w-5 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name})]},"string"==typeof e.name?e.name:"addon-item-".concat(s)))}),et?(0,t.jsxs)("button",{onClick:e8,className:"w-full flex items-center space-x-3 p-3 rounded-lg hover:bg-white/10 transition-colors",children:[(0,t.jsx)(F.A,{className:"h-5 w-5 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:(null==(a=et.user)?void 0:a.isImpersonating)?"Stop Impersonating":"Logout"})]}):(0,t.jsxs)(l(),{href:"en"===eT?"/en/auth/login":"/auth/login",className:"flex items-center space-x-3 p-3 rounded-lg hover:bg-white/10 transition-colors",children:[(0,t.jsx)(F.A,{className:"h-5 w-5 flex-shrink-0"}),(0,t.jsx)("span",{className:"text-sm font-medium",children:"Login"})]})]}),(0,t.jsx)("div",{className:"p-4 border-t border-white/10",children:(0,t.jsxs)("div",{className:"text-xs text-white/60 text-center",children:["\xa9 ",new Date().getFullYear()," Libert\xe9 M\xeame en Cellule"]})}),e0&&(0,t.jsx)("button",{onClick:()=>window.location.href="/hire/new-case",className:"fixed bottom-8 left-8 z-50 flex items-center px-5 py-3 bg-blue-600 text-white rounded-full shadow-lg hover:bg-blue-700 transition-colors text-lg font-semibold",style:{boxShadow:"0 4px 24px rgba(0,0,0,0.15)"},children:"+ New Case"})]})}),(0,t.jsxs)("main",{className:"lg:pl-64 flex flex-col min-h-screen",children:[(0,t.jsx)(G,{}),(0,t.jsxs)("header",{className:"sticky top-0 z-50 w-full h-14 bg-primary flex items-center px-2 md:px-6 justify-between border-b border-gray-200 shadow",children:[(0,t.jsx)("div",{className:"flex items-center gap-2 min-w-0",children:(0,t.jsxs)("div",{className:"relative hidden md:block",children:[(0,t.jsx)(z.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,t.jsx)("input",{type:"text",placeholder:"Search professionals, cases, documents...",onClick:()=>es.push("/search"),className:"bg-white/80 rounded-full pl-10 pr-4 py-1 focus:outline-none text-sm w-64 cursor-pointer",readOnly:!0})]})}),(0,t.jsx)("nav",{className:"flex gap-6 md:gap-8",children:ss.map(e=>{let{label:s,href:a,icon:r,pdf:n}=e;return(0,t.jsxs)(l(),{href:a,className:"relative flex flex-col items-center group transition-colors duration-150 px-2 py-1 rounded-lg\n                  ".concat(n?"hover:bg-red-50":"hover:bg-white/20","\n                "),title:s,children:[(0,t.jsx)(r,{size:26,className:"transition-colors duration-150\n                    ".concat(n?"text-white group-hover:text-red-500":"text-white group-hover:text-primary-light","\n                  ")}),(0,t.jsx)("span",{className:"sr-only",children:s})]},s)})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 md:gap-3",children:[(0,t.jsx)("button",{className:"p-2 rounded-full hover:bg-white/20 transition relative",children:(0,t.jsx)(J.A,{size:22,className:"text-white"})}),(0,t.jsxs)("button",{className:"p-2 rounded-full hover:bg-white/20 transition relative",children:[(0,t.jsx)(T.A,{size:22,className:"text-white"}),(0,t.jsx)("span",{className:"absolute -top-1 -right-1 bg-blue-500 text-white text-xs rounded-full px-1.5",children:"2"})]}),(0,t.jsxs)("div",{className:"relative",ref:eE,children:[(0,t.jsxs)("button",{onClick:()=>eP(e=>!e),className:"p-2 rounded-full hover:bg-white/20 transition flex items-center relative",title:"Notifications",children:[(0,t.jsx)(B.A,{size:22,className:"text-white"}),ek>0&&(0,t.jsx)(m.P.div,{initial:{scale:0},animate:{scale:1},className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center font-medium",children:ek>99?"99+":ek})]}),(0,t.jsx)(d.N,{children:eD&&(0,t.jsx)(m.P.div,{initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},className:"absolute right-0 mt-2 w-80 bg-white shadow-lg rounded-lg border border-gray-200 z-50",children:(0,t.jsxs)("div",{className:"p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:"Notifications"}),ek>0&&(0,t.jsx)("button",{onClick:e9,className:"text-xs text-blue-600 hover:text-blue-800",children:"Mark all as read"})]}),(0,t.jsx)("div",{className:"max-h-64 overflow-y-auto space-y-2",children:0===eS.length?(0,t.jsx)("div",{className:"text-center py-4 text-gray-500 text-sm",children:"No notifications"}):eS.map((e,s)=>(0,t.jsxs)("div",{className:"flex items-start space-x-3 p-2 rounded-lg ".concat(e.isRead?"hover:bg-gray-50":"bg-blue-50"),children:[(0,t.jsxs)("div",{className:"flex-shrink-0 mt-1",children:["message"===e.type&&(0,t.jsx)(w.A,{className:"h-5 w-5 text-blue-500"}),"case"===e.type&&(0,t.jsx)(g.A,{className:"h-5 w-5 text-green-500"}),"payment"===e.type&&(0,t.jsx)(D.A,{className:"h-5 w-5 text-yellow-500"}),"reaction"===e.type&&(0,t.jsx)(W.A,{className:"h-5 w-5 text-green-500"}),"report"===e.type&&(0,t.jsx)(_.A,{className:"h-5 w-5 text-red-500"})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"font-medium text-sm ".concat(e.isRead?"text-gray-700":"text-gray-900"),children:e.title}),(0,t.jsx)("div",{className:"text-xs text-gray-500 truncate",children:e.message}),(0,t.jsx)("div",{className:"text-xs text-gray-400 mt-0.5",children:(0,ei.m)(new Date(e.createdAt),{addSuffix:!0})})]}),!e.isRead&&(0,t.jsx)("span",{className:"mt-1 w-2 h-2 bg-yellow-400 rounded-full"})]},s))}),(0,t.jsx)("div",{className:"px-4 py-2 border-t border-gray-100 bg-gray-50 text-right",children:(0,t.jsx)(l(),{href:"en"===eT?"/en/notifications":"/notifications",className:"text-xs text-blue-600 hover:underline",children:"View all notifications"})})]})})})]}),et&&(0,t.jsx)(en,{userId:(null==(o=et.user)?void 0:o.id)||"",userRole:(null==(H=et.user)?void 0:H.role)||"USER"}),et&&(0,t.jsx)("button",{onClick:()=>eL(!0),className:"p-2 rounded-full hover:bg-white/20 transition",title:"Privacy Settings",children:(0,t.jsx)(A.A,{size:22,className:"text-white"})}),(0,t.jsxs)("div",{className:"relative",ref:eA,children:[(0,t.jsx)("button",{onClick:()=>ew(!eN),className:"p-1 rounded-full hover:bg-white/20 transition flex items-center",children:(null==et||null==(K=et.user)?void 0:K.image)?(0,t.jsx)(q(),{src:et.user.image,alt:"Profile",width:32,height:32,className:"rounded-full border"}):(0,t.jsx)(C.A,{size:28,className:"rounded-full border text-white"})}),eN&&(0,t.jsx)("div",{className:"flex flex-col absolute right-0 mt-2 w-44 bg-white shadow-lg rounded-xl py-2 z-50 border border-gray-100",onMouseEnter:()=>{window.profileMenuTimeout&&(clearTimeout(window.profileMenuTimeout),window.profileMenuTimeout=null)},onMouseLeave:()=>{window.profileMenuTimeout=setTimeout(()=>ew(!1),300)},children:et?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"px-4 py-2 border-b border-gray-100",children:[(0,t.jsx)("div",{className:"font-semibold text-gray-800 text-sm truncate",children:(null==(Q=et.user)?void 0:Q.name)||"User"}),(0,t.jsx)("div",{className:"text-xs text-gray-500 truncate",children:null==(X=et.user)?void 0:X.email})]}),(0,t.jsx)(l(),{href:"en"===eT?"/en/user/profile":"/user/profile",className:"px-4 py-2 text-sm text-gray-700 hover:bg-gray-50",children:"Profile"}),(0,t.jsx)(l(),{href:"en"===eT?"/en/user/dashboard":"/user/dashboard",className:"px-4 py-2 text-sm text-gray-700 hover:bg-gray-50",children:"Dashboard"}),(0,t.jsxs)(l(),{href:"en"===eT?"/en/user/payments":"/user/payments",className:"px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 flex items-center",children:[(0,t.jsx)(D.A,{className:"h-4 w-4 mr-2"}),"Payments & Billing"]}),(0,t.jsxs)(l(),{href:"en"===eT?"/en/user/subscription":"/user/subscription",className:"px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 flex items-center",children:[(0,t.jsx)(P.A,{className:"h-4 w-4 mr-2"}),"Subscription"]}),(null==($=et.user)?void 0:$.role)==="SUPERADMIN"&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{onClick:()=>ej(!0),className:"px-4 py-2 text-sm text-blue-600 hover:bg-blue-50 text-left flex items-center",children:[(0,t.jsx)("span",{className:"mr-2",children:"\uD83D\uDC64"}),"Impersonate User"]}),(0,t.jsx)("div",{className:"border-t border-gray-100 my-1"}),[{label:"Client",nav:ez},{label:"Lawyer",nav:eJ},{label:"Jurist",nav:eB},{label:"Judge",nav:eW},{label:"Mediator",nav:e_},{label:"Consultant",nav:eV},{label:"Investigator",nav:eG},{label:"Expert Witness",nav:eY},{label:"Support Staff",nav:eH},{label:"Student",nav:eq},{label:"Notary",nav:eK},{label:"Admin",nav:eQ}].map(e=>{var s;let{label:a,nav:r}=e,n=(null==(s=r[0])?void 0:s.icon)||C.A;return(0,t.jsxs)("div",{className:"relative group",children:[(0,t.jsxs)("button",{className:"w-full px-4 py-2 text-sm text-purple-700 hover:bg-purple-50 text-left flex items-center justify-between",onClick:()=>eb(e=>({...e,[a]:!e[a]})),onMouseEnter:()=>eb(e=>({...e,[a]:!0})),onMouseLeave:()=>eb(e=>({...e,[a]:!1})),children:[(0,t.jsx)(n,{className:"h-4 w-4 mr-2"}),a,(0,t.jsx)("span",{className:"ml-auto",children:"◀"})]}),ey[a]&&(0,t.jsx)("div",{className:"absolute right-full top-0 mt-0 mr-1 w-56 bg-white shadow-lg rounded-xl py-2 z-50 border border-gray-100",onMouseEnter:()=>eb(e=>({...e,[a]:!0})),onMouseLeave:()=>eb(e=>({...e,[a]:!1})),children:r.map(e=>(0,t.jsxs)(l(),{href:e.href,className:"px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 flex items-center",children:[(0,t.jsx)(e.icon,{className:"h-4 w-4 mr-2"}),e.name]},e.href))})]},a)})]}),(0,t.jsx)("button",{onClick:()=>(0,i.signOut)({callbackUrl:"/"}),className:"px-4 py-2 text-sm text-red-600 hover:bg-red-50 text-left",children:"Sign out"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"px-4 py-2 border-b border-gray-100",children:[(0,t.jsx)("div",{className:"font-semibold text-gray-800 text-sm",children:"Guest User"}),(0,t.jsx)("div",{className:"text-xs text-gray-500",children:"Not signed in"})]}),(0,t.jsx)(l(),{href:"en"===eT?"/en/auth/login":"/auth/login",className:"px-4 py-2 text-sm text-blue-600 hover:bg-blue-50 text-left",children:"Sign in"}),(0,t.jsx)(l(),{href:"en"===eT?"/en/auth/signup":"/auth/signup",className:"px-4 py-2 text-sm text-green-600 hover:bg-green-50 text-left",children:"Create Account"})]})})]})]}),(0,t.jsx)("div",{className:"md:hidden ml-2",children:(0,t.jsx)("button",{className:"p-2 rounded-full hover:bg-white/20 transition",children:(0,t.jsx)(O.A,{size:24,className:"text-white"})})})]}),eh&&(0,t.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:()=>ex(!1),children:(0,t.jsxs)("div",{className:"bg-white rounded-lg p-6 max-w-md w-full mx-4",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:"flex justify-between items-center mb-4",children:[(0,t.jsx)("h3",{className:"text-lg font-semibold",children:"Today's Date & Notes"}),(0,t.jsx)("button",{onClick:()=>ex(!1),className:"text-gray-500 hover:text-gray-700",children:"✕"})]}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)("p",{className:"text-gray-600 text-sm",children:e6})}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Notes for today:"}),(0,t.jsx)("textarea",{placeholder:"Add your notes here...",className:"w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-transparent",rows:4,defaultValue:localStorage.getItem("notes-".concat(e2.toDateString()))||"",onChange:e=>{localStorage.setItem("notes-".concat(e2.toDateString()),e.target.value)}})]}),(0,t.jsx)("div",{className:"flex justify-end gap-2",children:(0,t.jsx)("button",{onClick:()=>ex(!1),className:"px-4 py-2 bg-gray-200 text-gray-800 rounded-md hover:bg-gray-300 transition-colors",children:"Close"})})]})}),(0,t.jsx)("div",{className:"flex-1 w-full",children:ee}),(0,t.jsx)(c,{}),(0,t.jsx)(Y,{})]}),(0,t.jsx)(eo,{}),(0,t.jsx)(Z,{isOpen:ev,onClose:()=>ej(!1)}),(0,t.jsx)(ea,{isOpen:eM,onClose:()=>eL(!1)})]})]})}},82585:(e,s,a)=>{a.d(s,{y:()=>o});var t=a(14232),r=a(10553),n=a(97685),i=a(89099);function o(){var e,s,a,o,l,c,d;let{data:m,update:u}=(0,r.useSession)(),[h,x]=(0,t.useState)(!1),p=(0,i.useRouter)();return(0,t.useEffect)(()=>{var e,s,a,t,r;console.log("\uD83D\uDD0D useImpersonation - Session state changed:",{hasSession:!!m,userId:null==m||null==(e=m.user)?void 0:e.id,email:null==m||null==(s=m.user)?void 0:s.email,role:null==m||null==(a=m.user)?void 0:a.role,isImpersonating:null==m||null==(t=m.user)?void 0:t.isImpersonating,originalUser:null==m||null==(r=m.user)?void 0:r.originalUser,isImpersonatingState:h})},[m,h]),{impersonateUser:async(e,s)=>{if(!(null==m?void 0:m.user))return n.oR.error("Not authenticated"),!1;let a=m.user.isImpersonating&&m.user.originalUser?m.user.originalUser.role:m.user.role;if(console.log("\uD83D\uDD0D Impersonation check:",{effectiveRole:a,currentRole:m.user.role,isImpersonating:m.user.isImpersonating,originalUser:m.user.originalUser}),"SUPERADMIN"!==a&&"ADMIN"!==a)return n.oR.error("Only Super Admins and Admins can impersonate users"),!1;if(m.user.isImpersonating)return n.oR.error("Already impersonating a user. Please stop current impersonation first."),!1;x(!0);try{let t;console.log("\uD83D\uDD04 Starting impersonation request for userId:",e),console.log("\uD83D\uDD04 Effective role for impersonation:",a),console.log("\uD83D\uDD04 Current session:",{userId:m.user.id,email:m.user.email,role:m.user.role,isImpersonating:m.user.isImpersonating});let r=await fetch("/api/admin/impersonate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})});if(console.log("\uD83D\uDCCA Response received:",{status:r.status,statusText:r.statusText,ok:r.ok}),!r.ok){let e="Failed to impersonate user",s="";try{let a=await r.json();e=a.error||a.message||e,s=a.details||""}catch(s){console.error("Failed to parse error response:",s);try{let s=await r.text();console.error("Raw error response:",s),e="Server error (".concat(r.status,"): ").concat(s||"Unknown error")}catch(s){console.error("Failed to read response as text:",s),e="Server error (".concat(r.status,"): Unable to read response")}}return console.error("❌ Impersonation failed:",{status:r.status,errorMessage:e,errorDetails:s}),429===r.status?n.oR.error("Rate limit exceeded. Please wait a moment and try again."):403===r.status?n.oR.error("Access denied. You may not have permission to impersonate this user."):404===r.status?n.oR.error("User not found."):n.oR.error(e),!1}try{t=await r.json(),console.log("✅ Impersonation success data:",t)}catch(e){return console.error("Failed to parse success response:",e),n.oR.error("Invalid response from server"),!1}return n.oR.success("\uD83D\uDD04 Impersonation initiated for ".concat(s),{duration:3e3,icon:"\uD83D\uDC64"}),console.log("\uD83D\uDD04 Forcing session update..."),await u({trigger:"update"}),console.log("\uD83D\uDD04 Waiting for session to update..."),await new Promise(e=>setTimeout(e,1500)),console.log("\uD83D\uDD04 Reloading page to ensure session consistency..."),window.location.href=t.redirectUrl,!0}catch(e){return console.error("❌ Impersonation error:",e),e instanceof TypeError&&e.message.includes("fetch")?n.oR.error("Network error. Please check your connection and try again."):n.oR.error(e instanceof Error?e.message:"Failed to impersonate user"),!1}finally{x(!1)}},stopImpersonation:async()=>{try{var e,s,a;console.log("\uD83D\uDD04 stopImpersonation - Starting..."),console.log("\uD83D\uDD04 Current session state:",{isImpersonating:null==m||null==(e=m.user)?void 0:e.isImpersonating,originalUser:null==m||null==(s=m.user)?void 0:s.originalUser});let t=await fetch("/api/admin/stop-impersonation",{method:"POST",headers:{"Content-Type":"application/json"}});console.log("\uD83D\uDCCA Stop impersonation response:",{status:t.status,statusText:t.statusText,ok:t.ok});let r=await t.json();if(t.ok)console.log("✅ stopImpersonation - API success:",r),n.oR.success("\uD83D\uDD04 Impersonation stopped successfully",{duration:2e3,icon:"\uD83D\uDC64"}),console.log("\uD83D\uDD04 stopImpersonation - Updating session..."),await u({trigger:"update"}),console.log("\uD83D\uDD04 stopImpersonation - Waiting for session to update..."),await new Promise(e=>setTimeout(e,1500)),console.log("\uD83D\uDD04 stopImpersonation - Reloading page to ensure session consistency..."),window.location.href="/admin/dashboard";else{if(console.error("❌ stopImpersonation - API error:",r),"Not currently impersonating"===r.error||(null==(a=r.error)?void 0:a.includes("not impersonating"))){console.log("ℹ️ stopImpersonation - User is not currently impersonating, redirecting to admin dashboard"),(0,n.oR)("Not currently impersonating any user"),p.push("/admin/dashboard");return}n.oR.error(r.error||"Failed to stop impersonation"),console.warn("⚠️ stopImpersonation - Non-critical error, forcing hard reload"),window.location.href="/admin/dashboard"}}catch(e){console.error("❌ stopImpersonation - Error:",e),n.oR.error("Network error while stopping impersonation"),console.warn("⚠️ stopImpersonation - Network error, forcing hard reload"),window.location.href="/admin/dashboard"}},isImpersonating:h,isCurrentlyImpersonating:(null==m||null==(e=m.user)?void 0:e.isImpersonating)||!1,originalUser:(null==m||null==(s=m.user)?void 0:s.originalUser)||null,canImpersonate:!(null==m||null==(a=m.user)?void 0:a.isImpersonating)&&!h,debugInfo:{sessionExists:!!m,userRole:null==m||null==(o=m.user)?void 0:o.role,isImpersonating:null==m||null==(l=m.user)?void 0:l.isImpersonating,originalUserRole:null==m||null==(d=m.user)||null==(c=d.originalUser)?void 0:c.role}}}},96985:(e,s,a)=>{a.d(s,{Ay:()=>h,Ei:()=>o,F6:()=>i,JF:()=>u,L8:()=>d,Xz:()=>c,aM:()=>m,pu:()=>l});var t=a(37876),r=a(77328),n=a.n(r);let i=e=>{var s,a;let t="https://lavocat.ca";return{"@context":"https://schema.org","@type":"LegalCase",name:e.title||"Legal Case",description:e.description||e.summary||"Legal case details and information",url:"".concat(t,"/public/cases/").concat(e.id),dateCreated:e.createdAt,dateModified:e.updatedAt,datePublished:e.createdAt,author:e.client?{"@type":"Person",name:e.client.name,url:e.client.username?"".concat(t,"/profile/").concat(e.client.username):void 0}:e.lawyer?{"@type":"Person",name:e.lawyer.name,url:e.lawyer.username?"".concat(t,"/profile/").concat(e.lawyer.username):void 0}:void 0,publisher:{"@type":"Organization",name:"Libert\xe9 M\xeame en Prison",url:t,logo:{"@type":"ImageObject",url:"".concat(t,"/images/logo.png")}},mainEntityOfPage:{"@type":"WebPage","@id":"".concat(t,"/public/cases/").concat(e.id)},image:(null==(s=e.client)?void 0:s.profileImage)?{"@type":"ImageObject",url:e.client.profileImage.startsWith("http")?e.client.profileImage:"".concat(t).concat(e.client.profileImage),width:1200,height:630}:void 0,category:e.category,legalArea:e.legalArea,jurisdiction:e.jurisdiction,court:e.court,status:e.status,urgencyLevel:e.urgencyLevel,riskLevel:e.riskLevel,estimatedValue:e.estimatedValue,tags:e.tags,commentCount:(null==(a=e._count)?void 0:a.comments)||0,viewCount:e.viewCount||0,supporterCount:e.supporterCount||0}},o=e=>{let s="https://lavocat.ca";return{"@context":"https://schema.org","@type":"Person",name:e.name,url:"".concat(s,"/profile/").concat(e.username),image:e.profilePicture?e.profilePicture.startsWith("http")?e.profilePicture:"".concat(s).concat(e.profilePicture):void 0,description:e.bio,jobTitle:e.title||"Lawyer",worksFor:{"@type":"Organization",name:"Libert\xe9 M\xeame en Prison",url:s},address:e.officeLocation?{"@type":"PostalAddress",addressLocality:e.officeLocation}:void 0,telephone:e.workPhone,email:e.email,sameAs:[e.linkedinUrl,e.websiteUrl].filter(Boolean),knowsAbout:[e.specialization,"Legal Services","Law"].filter(Boolean),hasCredential:e.education?[{"@type":"EducationalOccupationalCredential",name:e.education,credentialCategory:"Educational Credential"}]:void 0,award:e.isVerified?["Verified Lawyer"]:void 0,aggregateRating:e.averageRating?{"@type":"AggregateRating",ratingValue:e.averageRating,reviewCount:e.totalCases||0,bestRating:5}:void 0,priceRange:e.hourlyRate?"$".concat(e.hourlyRate,"/hour"):void 0,areaServed:e.officeLocation?[{"@type":"Place",name:e.officeLocation}]:void 0,availableService:[{"@type":"Service",name:"Legal Consultation",description:"Professional legal consultation and representation services"}]}},l=()=>{let e="https://lavocat.ca";return{"@context":"https://schema.org","@type":"Organization",name:"Libert\xe9 M\xeame en Prison",url:e,logo:{"@type":"ImageObject",url:"".concat(e,"/images/logo.png"),width:180,height:180},description:"A comprehensive legal marketplace connecting clients with qualified legal professionals. Browse cases, find lawyers, and access legal services.",contactPoint:[{"@type":"ContactPoint",contactType:"customer service",email:"support@libertememeenprison.com"}],sameAs:["https://twitter.com/LiberteMemeEnPrison","https://linkedin.com/company/libertememeenprison"],serviceArea:[{"@type":"Place",name:"Global"}]}},c=()=>{let e="https://lavocat.ca";return{"@context":"https://schema.org","@type":"WebSite",name:"Libert\xe9 M\xeame en Prison",url:e,description:"A comprehensive legal marketplace connecting clients with qualified legal professionals",publisher:{"@type":"Organization",name:"Libert\xe9 M\xeame en Prison",url:e},potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:"".concat(e,"/search?q={search_term_string}")},"query-input":"required name=search_term_string"}}},d=e=>({"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:e.map((e,s)=>({"@type":"ListItem",position:s+1,name:e.name,item:e.url.startsWith("http")?e.url:"".concat("https://lavocat.ca").concat(e.url)}))}),m=e=>({"@context":"https://schema.org","@type":"FAQPage",mainEntity:e.map(e=>({"@type":"Question",name:e.question,acceptedAnswer:{"@type":"Answer",text:e.answer}}))}),u=e=>{var s,a;let t="https://lavocat.ca";return{"@context":"https://schema.org","@type":"HowTo",name:e.name,description:e.description,image:e.image?{"@type":"ImageObject",url:e.image.startsWith("http")?e.image:"".concat(t).concat(e.image)}:void 0,totalTime:e.totalTime,estimatedCost:e.estimatedCost?{"@type":"MonetaryAmount",currency:e.estimatedCost.currency,value:e.estimatedCost.value}:void 0,supply:null==(s=e.supply)?void 0:s.map(e=>({"@type":"HowToSupply",name:e})),tool:null==(a=e.tool)?void 0:a.map(e=>({"@type":"HowToTool",name:e})),step:e.steps.map((e,s)=>({"@type":"HowToStep",name:e.name,text:e.text,url:e.url?e.url.startsWith("http")?e.url:"".concat(t).concat(e.url):void 0,image:e.image?{"@type":"ImageObject",url:e.image.startsWith("http")?e.image:"".concat(t).concat(e.image)}:void 0}))}},h=e=>{let{type:s,data:a}=e;return(0,t.jsx)(n(),{children:(0,t.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(a,null,2)}})})}}}]);

CasperSecurity Mini