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/server/chunks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.ca/private_html/.next/server/chunks/776.js
"use strict";exports.id=776,exports.ids=[776],exports.modules={1050:(e,t,s)=>{s.d(t,{A:()=>w});var a=s(8732),r=s(82015),l=s(22863),i=s(13213),n=s(5453),o=s(40128),c=s(74498),d=s(66399),m=s(7670),x=s(30703),u=s(36708),p=s(87637),h=s(57341),g=s(99421),b=s(65653),y=s(36205);let f=(e,t)=>{let s="h-6 w-6";switch(e){case"milestone":return"completed"===t?(0,a.jsx)(i.A,{className:`${s} text-green-500`}):(0,a.jsx)(n.A,{className:`${s} text-blue-500`});case"update":return(0,a.jsx)(o.A,{className:`${s} text-purple-500`});case"deadline":return"overdue"===t?(0,a.jsx)(c.A,{className:`${s} text-red-500`}):(0,a.jsx)(d.A,{className:`${s} text-orange-500`});case"achievement":return(0,a.jsx)(m.A,{className:`${s} text-yellow-500`});case"warning":return(0,a.jsx)(c.A,{className:`${s} text-red-500`});default:return(0,a.jsx)(x.A,{className:`${s} text-gray-500`})}},j=e=>{switch(e){case"completed":return"border-green-500 bg-green-50";case"pending":return"border-yellow-500 bg-yellow-50";case"upcoming":return"border-blue-500 bg-blue-50";case"overdue":return"border-red-500 bg-red-50";default:return"border-gray-300 bg-gray-50"}},N=e=>{switch(e){case"completed":return"Completed";case"pending":return"In Progress";case"upcoming":return"Upcoming";case"overdue":return"Overdue";default:return"Unknown"}},w=({caseData:e,className:t=""})=>{let[s,n]=(0,r.useState)(new Set),[o,c]=(0,r.useState)("all"),m=e=>{if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t},w=(()=>{let t=[];if(!e)return t;if(e.createdAt&&t.push({id:"case-created",title:"Case Created",description:`Case "${e.title||"Untitled Case"}" was created and made public`,date:e.createdAt,type:"milestone",status:"completed",metadata:{participants:[e.creator?.name||"Unknown"]}}),e.applicationDeadline){let s=m(e.applicationDeadline);if(s){let a=new Date;t.push({id:"application-deadline",title:"Application Deadline",description:"Last day to submit applications for this case",date:e.applicationDeadline,type:"deadline",status:s<a?"overdue":"upcoming",metadata:{participants:["All Applicants"]}})}}if(e.filingDate){let s=m(e.filingDate);if(s){let a=new Date;t.push({id:"case-filed",title:"Case Filed",description:"Legal case was officially filed with the court",date:e.filingDate,type:"milestone",status:s<a?"completed":"upcoming",metadata:{location:e.court||"Court",participants:[e.leadLawyer?.name||"Lead Lawyer"]}})}}if(e.caseUpdates&&Array.isArray(e.caseUpdates)&&e.caseUpdates.forEach((e,s)=>{e&&e.id&&e.createdAt&&t.push({id:`update-${e.id}`,title:e.title||"Case Update",description:e.description,date:e.createdAt,type:"update",status:"completed",metadata:{participants:[e.author?.name||"Unknown"]}})}),e.expectedDuration&&e.createdAt){let s=m(e.createdAt);if(s&&"number"==typeof e.expectedDuration){let a=new Date(s.getTime()+24*e.expectedDuration*36e5),r=a<new Date?"overdue":"upcoming";t.push({id:"expected-completion",title:"Expected Completion",description:`Estimated completion date based on ${e.expectedDuration} days duration`,date:a.toISOString(),type:"milestone",status:r,metadata:{participants:[e.leadLawyer?.name||"Lead Lawyer"]}})}}return e._count?.registrations&&e._count.registrations>=5&&t.push({id:"high-interest",title:"High Interest Achieved",description:"Case has received significant interest from the community",date:new Date().toISOString(),type:"achievement",status:"completed",metadata:{participants:["Community"]}}),e._count?.supporters&&e._count.supporters>=10&&t.push({id:"community-support",title:"Strong Community Support",description:"Case has gained strong community backing",date:new Date().toISOString(),type:"achievement",status:"completed",metadata:{participants:["Supporters"]}}),t.sort((e,t)=>{let s=m(e.date),a=m(t.date);return s&&a?s.getTime()-a.getTime():0})})(),v="all"===o?w:w.filter(e=>e.type===o),A=e=>{let t=new Set(s);t.has(e)?t.delete(e):t.add(e),n(t)},C=()=>0===w.length?0:Math.round(w.filter(e=>"completed"===e.status).length/w.length*100),k=e=>{let t=m(e);if(!t)return"Invalid Date";try{return(0,l.GP)(t,"MMM d, yyyy")}catch{return"Invalid Date"}},S=e=>{let t=m(e);if(!t)return"Invalid Date";try{return(0,l.GP)(t,"PPP")}catch{return"Invalid Date"}},D=e=>{let t=m(e);if(!t)return"Invalid Time";try{return(0,l.GP)(t,"p")}catch{return"Invalid Time"}};return(0,a.jsxs)("div",{className:`bg-white rounded-xl shadow-sm border border-gray-200 p-8 ${t}`,children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-gradient-to-br from-blue-500 to-purple-600 rounded-lg flex items-center justify-center",children:(0,a.jsx)(u.A,{className:"h-5 w-5 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Case Timeline"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Track the progress and key milestones"})]})]}),(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Overall Progress"}),(0,a.jsxs)("span",{className:"text-sm font-bold text-blue-600",children:[C(),"%"]})]}),(0,a.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-3",children:(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-500 to-purple-600 h-3 rounded-full transition-all duration-1000 ease-out",style:{width:`${C()}%`}})}),(0,a.jsxs)("div",{className:"flex justify-between text-xs text-gray-500 mt-2",children:[(0,a.jsxs)("span",{children:[w.filter(e=>"completed"===e.status).length," completed"]}),(0,a.jsxs)("span",{children:[w.filter(e=>"pending"===e.status).length," in progress"]}),(0,a.jsxs)("span",{children:[w.filter(e=>"upcoming"===e.status).length," upcoming"]})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mb-6",children:[{key:"all",label:"All Events",count:w.length},{key:"milestone",label:"Milestones",count:w.filter(e=>"milestone"===e.type).length},{key:"update",label:"Updates",count:w.filter(e=>"update"===e.type).length},{key:"deadline",label:"Deadlines",count:w.filter(e=>"deadline"===e.type).length},{key:"achievement",label:"Achievements",count:w.filter(e=>"achievement"===e.type).length}].map(e=>(0,a.jsxs)("button",{onClick:()=>c(e.key),className:`px-4 py-2 rounded-lg text-sm font-medium transition-colors ${o===e.key?"bg-blue-600 text-white":"bg-gray-100 text-gray-700 hover:bg-gray-200"}`,children:[e.label," (",e.count,")"]},e.key))}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:"absolute left-6 top-0 bottom-0 w-0.5 bg-gray-200"}),(0,a.jsx)("div",{className:"space-y-6",children:v.map((e,t)=>{let r=s.has(e.id);return v.length,(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("div",{className:`absolute left-6 w-4 h-4 rounded-full border-2 transform -translate-x-1/2 -translate-y-1/2 ${"completed"===e.status?"bg-green-500 border-green-500":"pending"===e.status?"bg-yellow-500 border-yellow-500":"overdue"===e.status?"bg-red-500 border-red-500":"bg-blue-500 border-blue-500"}`,children:"completed"===e.status&&(0,a.jsx)(i.A,{className:"w-4 h-4 text-white"})}),(0,a.jsxs)("div",{className:`ml-12 p-4 rounded-lg border transition-all duration-200 hover:shadow-md ${j(e.status)} ${r?"shadow-md":""}`,children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3 flex-1",children:[(0,a.jsx)("div",{className:"flex-shrink-0 mt-1",children:f(e.type,e.status)}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900",children:e.title}),(0,a.jsx)("span",{className:`px-2 py-1 text-xs font-medium rounded-full ${"completed"===e.status?"bg-green-100 text-green-800":"pending"===e.status?"bg-yellow-100 text-yellow-800":"overdue"===e.status?"bg-red-100 text-red-800":"bg-blue-100 text-blue-800"}`,children:N(e.status)})]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-2",children:k(e.date)}),e.description&&(0,a.jsx)("p",{className:"text-gray-700 mb-3",children:e.description}),e.metadata&&(0,a.jsxs)("div",{className:"space-y-2",children:[e.metadata.participants&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,a.jsx)(p.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:e.metadata.participants.join(", ")})]}),e.metadata.location&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,a.jsx)(h.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:e.metadata.location})]}),e.metadata.amount&&(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[(0,a.jsx)(g.A,{className:"h-4 w-4"}),(0,a.jsxs)("span",{children:["$",e.metadata.amount.toLocaleString()]})]})]})]})]}),(0,a.jsx)("button",{onClick:()=>A(e.id),className:"flex-shrink-0 p-1 hover:bg-gray-100 rounded transition-colors",children:r?(0,a.jsx)(b.A,{className:"h-4 w-4 text-gray-500"}):(0,a.jsx)(y.A,{className:"h-4 w-4 text-gray-500"})})]}),r&&(0,a.jsx)("div",{className:"mt-4 pt-4 border-t border-gray-200",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-medium text-gray-900 mb-2",children:"Event Details"}),(0,a.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Type:"}),(0,a.jsx)("span",{className:"ml-2 text-gray-600 capitalize",children:e.type})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Date:"}),(0,a.jsx)("span",{className:"ml-2 text-gray-600",children:S(e.date)})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Time:"}),(0,a.jsx)("span",{className:"ml-2 text-gray-600",children:D(e.date)})]})]})]}),e.metadata&&(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"font-medium text-gray-900 mb-2",children:"Additional Info"}),(0,a.jsx)("div",{className:"space-y-2 text-sm",children:e.metadata.documents&&e.metadata.documents.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Documents:"}),(0,a.jsx)("div",{className:"mt-1 space-y-1",children:e.metadata.documents.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2 text-blue-600 hover:text-blue-800",children:[(0,a.jsx)(x.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{className:"text-xs",children:e})]},t))})]})})]})]})})]})]},e.id)})}),(0,a.jsx)("div",{className:"absolute left-6 bottom-0 w-4 h-4 rounded-full bg-gray-300 transform -translate-x-1/2 translate-y-1/2"})]}),0===v.length&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(d.A,{className:"h-12 w-12 text-gray-300 mx-auto mb-4"}),(0,a.jsx)("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No events found"}),(0,a.jsx)("p",{className:"text-gray-500",children:"Try selecting a different filter or check back later for updates."})]})]})}},6545:(e,t,s)=>{s.d(t,{A:()=>i});var a=s(8732);s(82015);var r=s(82439),l=s(92251);let i=({rating:e,totalRatings:t=0,size:s="sm",showBreakdown:i=!1,breakdown:n})=>{let o=e??0,c={sm:{star:"h-3 w-3",text:"text-xs"},md:{star:"h-4 w-4",text:"text-sm"},lg:{star:"h-5 w-5",text:"text-base"}},d=(e,t)=>{let s=[],i=Math.floor(e);for(let e=0;e<i;e++)s.push((0,a.jsx)(r.A,{className:`${t} fill-yellow-400 text-yellow-400`},e));e%1>=.5&&s.push((0,a.jsx)(l.A,{className:`${t} fill-yellow-400 text-yellow-400`},"half"));let n=5-Math.ceil(e);for(let e=0;e<n;e++)s.push((0,a.jsx)(r.A,{className:`${t} text-gray-300`},`empty-${e}`));return s};return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"flex items-center gap-1",children:d(o,c[s].star)}),(0,a.jsx)("span",{className:`${c[s].text} font-medium text-gray-700`,children:o.toFixed(1)}),t>0&&(0,a.jsxs)("span",{className:`${c[s].text} text-gray-500`,children:["(",t," review",1!==t?"s":"",")"]})]}),i&&n&&(0,a.jsx)("div",{className:"space-y-1",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"Boldness:"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[d(n.boldness||0,"h-3 w-3"),(0,a.jsx)("span",{className:"text-gray-700 ml-1",children:(n.boldness||0).toFixed(1)})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"Transparency:"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[d(n.transparency||0,"h-3 w-3"),(0,a.jsx)("span",{className:"text-gray-700 ml-1",children:(n.transparency||0).toFixed(1)})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"Communication:"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[d(n.communication||0,"h-3 w-3"),(0,a.jsx)("span",{className:"text-gray-700 ml-1",children:(n.communication||0).toFixed(1)})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-gray-600",children:"Results:"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[d(n.results||0,"h-3 w-3"),(0,a.jsx)("span",{className:"text-gray-700 ml-1",children:(n.results||0).toFixed(1)})]})]})]})})]})}},14044:(e,t,s)=>{s.d(t,{y:()=>r});var a=s(82015);let r=()=>{let[e,t]=(0,a.useState)(!1),[s,r]=(0,a.useState)(null);(0,a.useEffect)(()=>{},[]);let l=(0,a.useCallback)(async e=>{t(!0),r(null);try{let t=`https://www.facebook.com/dialog/share?app_id=your_facebook_app_id_here&display=popup&href=${encodeURIComponent(e.url)}`+(Array.isArray(e.hashtags)&&e.hashtags[0]?`&hashtag=%23${e.hashtags[0]}`:"")+`&redirect_uri=${encodeURIComponent(window.location.href)}`;window.open(t,"_blank","width=600,height=400")}catch(e){r("Failed to share to Facebook"),console.error("Facebook share error:",e)}finally{t(!1)}},[]),i=(0,a.useCallback)(async e=>{t(!0),r(null);try{let t=`${e.title}

${e.description}`,s=Array.isArray(e.hashtags)?e.hashtags.join(","):"";window.open(`https://twitter.com/intent/tweet?text=${encodeURIComponent(t)}&url=${encodeURIComponent(e.url)}&hashtags=${encodeURIComponent(s)}`,"_blank","width=600,height=400")}catch(e){r("Failed to share to Twitter"),console.error("Twitter share error:",e)}finally{t(!1)}},[]),n=(0,a.useCallback)(async e=>{t(!0),r(null);try{window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(e.url)}&title=${encodeURIComponent(e.title)}&summary=${encodeURIComponent(e.description)}`,"_blank","width=600,height=400")}catch(e){r("Failed to share to LinkedIn"),console.error("LinkedIn share error:",e)}finally{t(!1)}},[]);return{shareToFacebook:l,shareToTwitter:i,shareToLinkedIn:n,shareToWhatsApp:(0,a.useCallback)(async e=>{t(!0),r(null);try{let t=`${e.title}

${e.description}

${e.url}`;/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)?window.open(`whatsapp://send?text=${encodeURIComponent(t)}`):window.open(`https://wa.me/?text=${encodeURIComponent(t)}`,"_blank","width=600,height=400")}catch(e){r("Failed to share to WhatsApp"),console.error("WhatsApp share error:",e)}finally{t(!1)}},[]),copyToClipboard:(0,a.useCallback)(async e=>{t(!0),r(null);try{let t=`${e.title}

${e.description}

${e.url}`;if(navigator.clipboard)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}r(null)}catch(e){r("Failed to copy to clipboard"),console.error("Clipboard error:",e)}finally{t(!1)}},[]),isSharing:e,shareError:s}}},15418:(e,t,s)=>{s.d(t,{A:()=>n});var a=s(8732),r=s(4722),l=s(19918),i=s.n(l);function n({children:e}){let{data:t,status:s}=(0,r.useSession)();return"loading"===s?(0,a.jsx)("div",{children:"Chargement..."}):t?(0,a.jsx)(a.Fragment,{children:e}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center p-6 border rounded-md bg-white shadow-md mt-4",children:[(0,a.jsx)("p",{className:"mb-4 text-gray-700",children:"Vous devez \xeatre connect\xe9 pour acc\xe9der \xe0 cette fonctionnalit\xe9."}),(0,a.jsx)(i(),{href:"/auth/login",children:(0,a.jsx)("button",{className:"btn btn-primary",children:"Se connecter"})})]})}s(82015)},27206:(e,t,s)=>{s.a(e,async(e,a)=>{try{s.d(t,{A:()=>y});var r=s(8732),l=s(82015),i=s(63220),n=s(42311),o=s(74824),c=s(51781),d=s(39461),m=s(97089),x=s(97684),u=s(71335),p=s(45057),h=s(14044),g=s(42893),b=e([i,g]);[i,g]=b.then?(await b)():b;let y=({url:e,title:t,description:s,image:a,hashtags:b=[],className:y="",variant:f="default"})=>{let[j,N]=(0,l.useState)(!1),[w,v]=(0,l.useState)(!1),{shareToFacebook:A,shareToTwitter:C,shareToLinkedIn:k,shareToWhatsApp:S,copyToClipboard:D,isSharing:E,shareError:$}=(0,h.y)(),T={url:e,title:t,description:s,image:a,hashtags:b},I=async e=>{try{switch(e){case"facebook":await A(T),g.default.success("Shared to Facebook!");break;case"twitter":await C(T),g.default.success("Shared to Twitter!");break;case"linkedin":await k(T),g.default.success("Shared to LinkedIn!");break;case"whatsapp":await S(T),g.default.success("Shared to WhatsApp!");break;case"copy":await D(T),v(!0),g.default.success("Link copied to clipboard!"),setTimeout(()=>v(!1),2e3)}}catch(t){g.default.error(`Failed to share to ${e}`),console.error(`Share error for ${e}:`,t)}N(!1)},P=[{platform:"facebook",label:"Facebook",icon:n.A,color:"text-blue-600",bgColor:"hover:bg-blue-50",action:()=>I("facebook")},{platform:"twitter",label:"Twitter",icon:o.A,color:"text-blue-400",bgColor:"hover:bg-blue-50",action:()=>I("twitter")},{platform:"linkedin",label:"LinkedIn",icon:c.A,color:"text-blue-700",bgColor:"hover:bg-blue-50",action:()=>I("linkedin")},{platform:"whatsapp",label:"WhatsApp",icon:d.A,color:"text-green-600",bgColor:"hover:bg-green-50",action:()=>I("whatsapp")},{platform:"copy",label:w?"Copied!":"Copy Link",icon:w?m.A:x.A,color:w?"text-green-600":"text-gray-600",bgColor:w?"bg-green-50":"hover:bg-gray-50",action:()=>I("copy")}];return(0,r.jsxs)("div",{className:`relative ${y}`,children:[(0,r.jsxs)("button",{onClick:()=>N(!j),className:(()=>{switch(f){case"minimal":return"p-2 text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-full transition-colors";case"floating":return"fixed bottom-6 right-6 p-4 bg-blue-600 text-white rounded-full shadow-lg hover:bg-blue-700 transition-colors z-50";default:return"flex items-center gap-2 px-4 py-2 bg-white/20 hover:bg-white/30 text-white rounded-lg transition-colors"}})(),disabled:E,children:[E?(0,r.jsx)(u.A,{className:"h-4 w-4 animate-spin"}):(0,r.jsx)(p.A,{className:"h-4 w-4"}),"minimal"!==f&&"floating"!==f&&(0,r.jsx)("span",{children:"Share"})]}),(0,r.jsx)(i.AnimatePresence,{children:j&&(0,r.jsx)(i.motion.div,{initial:{opacity:0,scale:.95,y:-10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:-10},transition:{duration:.15},className:(()=>{switch(f){case"minimal":default:return"absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 p-2 min-w-[200px] z-50";case"floating":return"absolute bottom-full right-0 mb-2 bg-white rounded-lg shadow-lg border border-gray-200 p-2 min-w-[200px] z-50"}})(),children:(0,r.jsx)("div",{className:"space-y-1",children:P.map(e=>{let t=e.icon;return(0,r.jsxs)("button",{onClick:e.action,disabled:E,className:`w-full flex items-center gap-3 px-3 py-2 text-sm rounded-md transition-colors ${e.bgColor} ${e.color} disabled:opacity-50 disabled:cursor-not-allowed`,children:[(0,r.jsx)(t,{className:"h-4 w-4"}),(0,r.jsx)("span",{children:e.label}),E&&"facebook"===e.platform&&(0,r.jsx)(u.A,{className:"h-3 w-3 animate-spin ml-auto"})]},e.platform)})})})}),$&&(0,r.jsx)("div",{className:"absolute top-full left-0 mt-2 bg-red-50 border border-red-200 text-red-700 px-3 py-2 rounded-md text-sm max-w-xs",children:$}),j&&(0,r.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>N(!1)})]})};a()}catch(e){a(e)}})},40613:(e,t,s)=>{s.a(e,async(e,a)=>{try{s.d(t,{A:()=>y});var r=s(8732),l=s(82015),i=s.n(l),n=s(4722),o=s(63220),c=s(42893),d=s(5057),m=s(20925),x=s(19918),u=s.n(x),p=s(15418),h=s(51833),g=s(18804),b=e([o,c,m]);[o,c,m]=b.then?(await b)():b;let y=({caseId:e,initialComments:t=[],onCommentAdded:s,mode:a="public",allowAttachments:x=!0,allowReactions:b=!0,allowReplies:y=!0,maxRepliesDepth:f=3,apiEndpoint:j})=>{let{data:N}=(0,n.useSession)(),[w,v]=(0,l.useState)(t),[A,C]=(0,l.useState)(!1),[k,S]=(0,l.useState)(!1),[D,E]=(0,l.useState)(""),[$,T]=(0,l.useState)(null),[I,P]=(0,l.useState)({}),[R,L]=(0,l.useState)(null),[M,U]=(0,l.useState)(""),[F,z]=(0,l.useState)(new Set),[B,_]=(0,l.useState)(new Set),[O,W]=(0,l.useState)("newest"),[V,G]=(0,l.useState)("all"),[J,q]=(0,l.useState)(""),[H,Y]=(0,l.useState)(!1),[K,Q]=(0,l.useState)([]),[X,Z]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(1),[es,ea]=(0,l.useState)(!0),[er,el]=(0,l.useState)(!1),[ei,en]=(0,l.useState)(null),[eo,ec]=(0,l.useState)(!1),ed=(0,l.useRef)(null),em=(0,l.useRef)(null),ex=(0,l.useRef)({}),eu=()=>j||`/api/live-cases/${e}/comments`,ep=e=>({...e,reactions:e.reactions??[],attachments:e.attachments??[],replies:(e.replies??[]).map(e=>({...e,reactions:e.reactions??[],attachments:e.attachments??[],_count:{replies:e._count?.replies||e.replies?.length||0,likedBy:e._count?.likedBy||0,reactions:e._count?.reactions||e.reactions?.length||0}})),_count:{replies:e._count?.replies||e.replies?.length||0,likedBy:e._count?.likedBy||0,reactions:e._count?.reactions||e.reactions?.length||0}});(0,l.useEffect)(()=>{eh(!0)},[e,O,V,J]);let eh=async(e=!1)=>{try{e&&(et(1),v([]),ea(!0)),C(!0);let t=new URLSearchParams({page:e?"1":String(ee),limit:String(20),sortBy:O,filterBy:V,search:J}),s=await fetch(`${eu()}?${t}`);if(s.ok){let t=(await s.json()).comments.map(ep);e?v(e=>eD([...t,...e])):v(e=>eD([...t,...e])),ea(20===t.length)}else console.error("Failed to fetch comments:",s.status),e&&v([])}catch(t){console.error("Error fetching comments:",t),e&&v([])}finally{C(!1),el(!1)}},eg=async()=>{if(D.trim()&&!X){Z(!0);try{let e;if(K.length>0){let t=new FormData;t.append("content",D),K.forEach(e=>{e.file&&t.append("attachments",e.file)}),e=await fetch(eu(),{method:"POST",body:t})}else e=await fetch(eu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:D})});if(!e.ok)throw Error("Failed to post comment");let t=await e.json();v(e=>eD([ep(t.comment),...e])),E(""),K.forEach(e=>{e.url&&e.url.startsWith("blob:")&&URL.revokeObjectURL(e.url)}),Q([]),s&&s(),eh(),c.toast.success("Comment posted!")}catch(e){c.toast.error("Failed to post comment")}finally{Z(!1)}}};(0,l.useCallback)(async e=>{if(!N)return void c.toast.error("Please login to reply");if(!I[e]||!I[e].trim())return void c.toast.error("Please enter a reply");try{let t=await fetch(eu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:I[e].trim(),parentId:e})});if(t.ok){let s=await t.json();v(t=>(function e(t,s,a){return t.map(t=>t.id===s?{...t,replies:[...t.replies,a],_count:{...t._count,replies:t._count.replies+1}}:{...t,replies:e(t.replies,s,a)})})(t,e,ep(s.comment))),P(t=>({...t,[e]:""})),T(null),c.toast.success("Reply added successfully! \uD83D\uDCAC")}else c.toast.error("Failed to add reply")}catch(e){console.error("Error adding reply:",e),c.toast.error("Error adding reply")}},[N,I,e]);let eb=(e,t)=>{let s=N?.user?.id;return(e.reactions||[]).some(e=>e.reactionType===t&&e.user.id===s)},ey=(e,t)=>(e.reactions||[]).filter(e=>e.reactionType===t).length,ef=(0,l.useCallback)(async(e,t)=>{if(!N)return void c.toast.error("Please login to react to comments");let s=N.user.id,a=!0;v(r=>r.map(r=>{let l;if(r.id!==e)return r;let i=r.reactions||[];return i.some(e=>e.reactionType===t&&e.user.id===s)?(l=i.filter(e=>e.reactionType!==t||e.user.id!==s),a=!1):l=[...i,{id:`temp-${Date.now()}`,reactionType:t,user:{id:s,name:N.user.name||""}}],{...r,reactions:l}}));try{if(!(await fetch(`${eu()}/${e}/reactions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reactionType:t})})).ok)throw Error("Failed to update reaction")}catch(r){v(r=>r.map(r=>{if(r.id!==e)return r;let l=r.reactions||[];return a?{...r,reactions:l.filter(e=>e.reactionType!==t||e.user.id!==s)}:{...r,reactions:[...l,{id:`temp-${Date.now()}`,reactionType:t,user:{id:s,name:N.user.name||""}}]}})),c.toast.error("Failed to update reaction")}},[N,eu,v]),ej=async e=>{let t=Array.from(e.target.files||[]),s=["image/jpeg","image/png","image/gif","application/pdf","text/plain"];for(let e of t){if(e.size>5242880){c.toast.error(`${e.name} is too large. Maximum size is 5MB.`);continue}if(!s.includes(e.type)){c.toast.error(`${e.name} is not a supported file type.`);continue}Q(t=>[...t,{id:Date.now().toString()+Math.random().toString(36).substr(2,9),name:e.name,url:URL.createObjectURL(e),type:e.type,size:e.size,file:e}]),c.toast.success(`${e.name} added!`)}},eN=e=>{Q(t=>{let s=t.filter((t,s)=>s!==e);return t[e]?.url&&t[e].url.startsWith("blob:")&&URL.revokeObjectURL(t[e].url),s})},ew=[...w.filter(e=>"all"===V||e.user.role.toUpperCase()===V.toUpperCase())].sort((e,t)=>{switch(O){case"oldest":return new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime();case"mostLiked":return t.likes-e.likes;case"mostReplies":return t._count.replies-e._count.replies;default:return new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime()}}),ev=({comment:e,depth:t,onReply:s,onEdit:a,onDelete:l,onReact:i,isReplying:n,isEditing:o,parentId:x})=>{let u={SUPERADMIN:"bg-gradient-to-r from-purple-500 to-pink-500 text-white",ADMIN:"bg-gradient-to-r from-blue-500 to-blue-700 text-white",LAWYER:"bg-gradient-to-r from-green-500 to-green-700 text-white",CLIENT:"bg-gradient-to-r from-yellow-400 to-yellow-600 text-white",USER:"bg-gray-200 text-gray-800"},p=e.user.profilePicture?(0,r.jsx)("img",{src:e.user.profilePicture,alt:e.user.name,className:"h-10 w-10 rounded-full object-cover border-2 border-white shadow"}):(0,r.jsx)("div",{className:`h-10 w-10 rounded-full flex items-center justify-center font-bold text-lg ${u[e.user.role]||"bg-gray-200 text-gray-800"}`,children:e.user.name?.[0]||"?"});return(0,r.jsxs)("div",{className:`relative group bg-white rounded-xl shadow-md p-4 mb-4 ${t>0?"ml-8 border-l-4 border-blue-100":""}`,tabIndex:0,"aria-label":`Comment by ${e.user.name}`,children:[(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[p,(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("span",{className:"font-semibold text-gray-900",children:e.user.name}),(0,r.jsx)("span",{className:`text-xs px-2 py-1 rounded-full ml-1 ${u[e.user.role]||"bg-gray-200 text-gray-800"}`,children:e.user.role}),e.user.isVerified&&(0,r.jsx)(h.CheckCircle,{className:"h-4 w-4 text-blue-500 ml-1"}),(0,r.jsx)("span",{className:"text-xs text-gray-500 ml-2",children:(0,d.m)(new Date(e.createdAt),{addSuffix:!0})}),e.isEdited&&(0,r.jsx)("span",{className:"text-xs text-gray-400 ml-1",children:"(edited)"}),e.isPinned&&(0,r.jsx)(h.Star,{className:"h-4 w-4 text-yellow-400 ml-1"})]}),o?(0,r.jsx)("div",{className:"mt-3 p-4 bg-gray-50 rounded-lg border border-gray-200",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-semibold text-sm",children:N?.user?.image?(0,r.jsx)("img",{src:N.user.image,alt:N.user.name||"User",className:"w-8 h-8 rounded-full object-cover"}):(0,r.jsx)(h.UserCircle,{className:"h-4 w-4"})})}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("textarea",{className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",rows:3,value:M,onChange:e=>U(e.target.value),"aria-label":"Edit comment input",placeholder:"Edit your comment..."}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-sm font-medium transition-colors",onClick:async()=>{if(M.trim()){Z(!0);try{if(!(await fetch(`${eu()}/${e.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:M,attachments:e.attachments})})).ok)throw Error("Failed to edit comment");L(null),U(""),await eh(),c.toast.success("Comment updated!")}catch(e){c.toast.error("Failed to update comment")}finally{Z(!1)}}},disabled:X||!M.trim(),"aria-label":"Save edited comment",children:X?"Saving...":"Save Changes"}),(0,r.jsx)("button",{type:"button",className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 text-sm font-medium transition-colors",onClick:()=>{L(null),U("")},disabled:X,"aria-label":"Cancel editing",children:"Cancel"})]})]})]})}):(0,r.jsx)("div",{className:"prose prose-sm max-w-none text-gray-800 mb-2",dangerouslySetInnerHTML:{__html:m.default.sanitize(e.content)}}),e.attachments&&e.attachments.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 mb-2",children:[(0,r.jsxs)("div",{className:"w-full text-xs text-gray-500 mb-1",children:["\uD83D\uDCCE Attachments (",e.attachments.length,"):"]}),e.attachments.map(e=>{let t=e.type.startsWith("image/"),s="application/pdf"===e.type,a="application/vnd.openxmlformats-officedocument.wordprocessingml.document"===e.type||"application/msword"===e.type;return(0,r.jsx)("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded-lg border",children:t?(0,r.jsxs)("div",{className:"flex flex-col items-center",children:[(0,r.jsxs)("div",{className:"relative cursor-pointer group",onClick:()=>{en({url:e.url,name:e.name}),ec(!0)},children:[(0,r.jsx)("img",{src:e.url,alt:e.name,className:"h-24 w-24 object-cover rounded border-2 border-gray-200 shadow-sm transition-transform group-hover:scale-105",onError:t=>{console.error("Image failed to load:",e.url),t.currentTarget.style.display="none"}}),(0,r.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-0 group-hover:bg-opacity-20 transition-all duration-200 rounded flex items-center justify-center",children:(0,r.jsx)(h.MagnifyingGlassPlus,{className:"h-6 w-6 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200"})})]}),(0,r.jsx)("span",{className:"text-xs text-gray-600 mt-1",children:e.name})]}):s?(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("svg",{width:"32",height:"32",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("rect",{width:"24",height:"24",rx:"4",fill:"#E53E3E"}),(0,r.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"#fff",fontSize:"12",fontWeight:"bold",children:"PDF"})]}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.name}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]})]})]}):a?(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("svg",{width:"32",height:"32",fill:"none",viewBox:"0 0 24 24",children:[(0,r.jsx)("rect",{width:"24",height:"24",rx:"4",fill:"#3182CE"}),(0,r.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"#fff",fontSize:"12",fontWeight:"bold",children:"DOC"})]}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.name}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]})]})]}):(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(h.Paperclip,{className:"h-6 w-6 text-gray-500"}),(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.name}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]})]})]})},e.id)})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500 mt-1",children:[e$.slice(0,3).map(t=>{let s=ey(e,t.type),a=(e.reactions||[]).filter(e=>e.reactionType===t.type).map(e=>e.user);return(0,r.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginRight:8},children:[(0,r.jsx)("button",{type:"button","aria-label":t.label,onClick:()=>i(e.id,t.type),className:`focus:outline-none transition-colors ${eb(e,t.type)?"font-bold":""}`,style:{textDecoration:"none"},children:(0,r.jsx)("span",{style:{fontSize:22,filter:eb(e,t.type)?"drop-shadow(0 0 2px "+t.color+")":"none"},children:t.emoji})}),s>0&&(0,r.jsx)(eI,{users:a})]},t.type)}),eT.slice(0,2).map(t=>{let s=t.icon,a=ey(e,t.type),l=(e.reactions||[]).filter(e=>e.reactionType===t.type).map(e=>e.user);return s?(0,r.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginRight:8},children:[(0,r.jsx)("button",{type:"button","aria-label":t.label,onClick:()=>i(e.id,t.type),className:`focus:outline-none transition-colors ${eb(e,t.type)?"font-bold":""}`,style:{textDecoration:"none"},children:(0,r.jsx)(s,{size:22,color:t.color,weight:eb(e,t.type)?"fill":"regular"})}),a>0&&(0,r.jsx)(eI,{users:l})]},t.type):null}),(0,r.jsx)(eP,{onReact:i,comment:e})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-3 pt-2 border-t border-gray-100",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>s(e.id),className:"flex items-center gap-1 text-xs text-gray-500 hover:text-blue-600 transition-colors",disabled:n,children:[(0,r.jsx)(h.ChatsCircle,{className:"h-3 w-3"}),"Reply"]}),(N?.user?.id===e.user.id||N?.user?.role==="ADMIN"||N?.user?.role==="SUPERADMIN")&&(0,r.jsxs)("button",{type:"button",onClick:()=>a(e.id),className:"flex items-center gap-1 text-xs text-gray-500 hover:text-blue-600 transition-colors",disabled:o,children:[(0,r.jsx)(h.PencilSimple,{className:"h-3 w-3"}),"Edit"]}),(N?.user?.id===e.user.id||N?.user?.role==="ADMIN"||N?.user?.role==="SUPERADMIN")&&(0,r.jsxs)("button",{type:"button",onClick:()=>{confirm("Are you sure you want to delete this comment?")&&l(e.id)},className:"flex items-center gap-1 text-xs text-gray-500 hover:text-red-600 transition-colors",children:[(0,r.jsx)(h.Trash,{className:"h-3 w-3"}),"Delete"]}),N?.user?.id!==e.user.id&&(0,r.jsxs)("button",{type:"button",onClick:()=>eS(e.id),className:"flex items-center gap-1 text-xs text-gray-500 hover:text-orange-600 transition-colors",children:[(0,r.jsx)(h.Flag,{className:"h-3 w-3"}),"Report"]})]}),n&&!e.isDeleted&&(0,r.jsx)("div",{className:"mt-3 p-4 bg-gray-50 rounded-lg border border-gray-200",children:(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("div",{className:"w-8 h-8 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-semibold text-sm",children:N?.user?.image?(0,r.jsx)("img",{src:N.user.image,alt:N.user.name||"User",className:"w-8 h-8 rounded-full object-cover"}):(0,r.jsx)(h.UserCircle,{className:"h-4 w-4"})})}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("input",{type:"text",ref:t=>{ex.current[e.id]=t},className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",placeholder:"Write your reply...",defaultValue:"","aria-label":"Reply input"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{type:"button",className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 text-sm font-medium transition-colors",onClick:async()=>{let t=ex.current[e.id],s=t?.value||"";if(s.trim()){Z(!0);try{if(!(await fetch(eu(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s.trim(),parentId:e.id})})).ok)throw Error("Failed to post reply");t&&(t.value=""),T(null),await eh(),c.toast.success("Reply posted!")}catch(e){c.toast.error("Failed to post reply")}finally{Z(!1)}}},disabled:X,"aria-label":"Post reply",children:X?"Posting...":"Post Reply"}),(0,r.jsx)("button",{type:"button",className:"px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 text-sm font-medium transition-colors",onClick:()=>{T(null),P(t=>({...t,[e.id]:""}))},disabled:X,"aria-label":"Cancel reply",children:"Cancel"})]})]})]})})]})]}),Array.isArray(e.replies)&&e.replies.length>0&&(0,r.jsx)("div",{className:"mt-4 space-y-3",children:e.replies?.map(s=>(0,r.jsx)(ev,{comment:s,depth:t+1,onReply:e=>{T(e),P({[e]:""})},onEdit:e=>{L(e),U(s.content)},onDelete:t=>{confirm("Are you sure you want to delete this reply?")&&ek(e.id,s.id)},onReact:(e,t)=>ef(e,t),isReplying:$===s.id,isEditing:R===s.id,parentId:e.id},s.id))})]})};function eA(e,t){return e.filter(e=>e.id!==t).map(e=>({...e,replies:eA(e.replies,t)}))}(0,l.useEffect)(()=>{ee>1&&eh()},[ee]);let eC=async e=>{Z(!0);try{if(!(await fetch(`${eu()}?commentId=${e}`,{method:"DELETE"})).ok)throw Error("Failed to delete comment");v(t=>eA(t,e)),c.toast.success("Comment deleted!"),eh()}catch(e){c.toast.error("Failed to delete comment")}finally{Z(!1)}},ek=async(e,t)=>{Z(!0);try{if(!(await fetch(`${eu()}?commentId=${t}`,{method:"DELETE"})).ok)throw Error("Failed to delete reply");v(e=>eA(e,t)),c.toast.success("Reply deleted!"),eh()}catch(e){c.toast.error("Failed to delete reply")}finally{Z(!1)}},eS=async e=>{if(!N)return void c.toast.error("Please login to report comments");try{(await fetch(`${eu()}/${e}/report`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:N.user?.id})})).ok?(c.toast.success("Comment reported!"),eh()):c.toast.error("Failed to report comment")}catch(e){console.error("Error reporting comment:",e),c.toast.error("Error reporting comment")}};function eD(e){let t=new Set,s=[];for(let a of e)t.has(a.id)||(t.add(a.id),s.push(a));return s}let eE=[{type:"like",emoji:"\uD83D\uDC4D",color:"#22c55e",label:"Like"},{type:"love",emoji:"❤️",color:"#ef4444",label:"Love"},{type:"laugh",emoji:"\uD83D\uDE02",color:"#fbbf24",label:"Laugh"},{type:"wow",emoji:"\uD83D\uDE2E",color:"#3b82f6",label:"Wow"},{type:"sad",emoji:"\uD83D\uDE22",color:"#3b82f6",label:"Sad"},{type:"angry",emoji:"\uD83D\uDE20",color:"#dc2626",label:"Angry"},{type:"dislike",emoji:"\uD83D\uDC4E",color:"#6b7280",label:"Dislike"},{type:"star",emoji:"⭐",color:"#facc15",label:"Star"},{type:"justice",icon:h.Scales,color:"#14b8a6",label:"Justice"},{type:"gavel",icon:g.A,color:"#6b7280",label:"Gavel"},{type:"shield",icon:h.Shield,color:"#dc2626",label:"Protection"},{type:"party",emoji:"\uD83C\uDF89",color:"#a21caf",label:"Party"},{type:"celebrate",emoji:"\uD83E\uDD73",color:"#a21caf",label:"Celebrate"},{type:"think",emoji:"\uD83E\uDD14",color:"#38bdf8",label:"Think"},{type:"pray",emoji:"\uD83D\uDE4F",color:"#2563eb",label:"Pray"},{type:"clap",emoji:"\uD83D\uDC4F",color:"#22c55e",label:"Clap"},{type:"trophy",icon:h.Trophy,color:"#eab308",label:"Victory"},{type:"handshake",icon:h.Handshake,color:"#2563eb",label:"Agreement"},{type:"money",icon:h.CurrencyDollar,color:"#22c55e",label:"Money"},{type:"shield-check",icon:h.ShieldCheck,color:"#22c55e",label:"Verified"},{type:"medal",icon:h.Medal,color:"#eab308",label:"Achievement"},{type:"crown",icon:h.Crown,color:"#facc15",label:"Authority"},{type:"sword",icon:h.Sword,color:"#dc2626",label:"Justice"},{type:"target",icon:h.Target,color:"#ef4444",label:"Target"},{type:"check",icon:h.CheckCircle,color:"#22c55e",label:"Approved"},{type:"document",icon:h.FileText,color:"#3b82f6",label:"Document"},{type:"scroll",icon:h.Scroll,color:"#8b5cf6",label:"Legal"},{type:"court",icon:h.Buildings,color:"#6b7280",label:"Court"},{type:"graduation",icon:h.GraduationCap,color:"#2563eb",label:"Expert"}],e$=eE.filter(e=>e.emoji),eT=eE.filter(e=>e.icon),eI=({users:e})=>{let[t,s]=i().useState(!1),a=i().useRef(null),l=()=>{a.current&&(clearTimeout(a.current),a.current=null),s(!0)},n=()=>{a.current=setTimeout(()=>{s(!1)},300)};return i().useEffect(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,r.jsxs)("span",{style:{position:"relative",display:"inline-block"},children:[(0,r.jsxs)("span",{style:{cursor:"pointer",textDecoration:"underline",color:"#2563eb",padding:"2px 4px",borderRadius:"4px",transition:"background-color 0.2s ease"},onClick:()=>s(e=>!e),onMouseEnter:l,onMouseLeave:n,onMouseOver:e=>{e.currentTarget.style.backgroundColor="#f0f9ff"},onMouseOut:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[e.length," \uD83D\uDC65"]}),t&&(0,r.jsx)("div",{style:{position:"absolute",top:"100%",left:0,background:"white",border:"1px solid #e5e7eb",borderRadius:8,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:100,minWidth:180,padding:12,marginTop:4},onMouseEnter:l,onMouseLeave:n,children:e.map(e=>(0,r.jsxs)("div",{style:{display:"flex",alignItems:"center",marginBottom:8,padding:"4px 8px",borderRadius:"4px",transition:"background-color 0.2s ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f3f4f6"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[e.profilePicture&&(0,r.jsx)("img",{src:e.profilePicture,alt:e.name,style:{width:24,height:24,borderRadius:"50%",marginRight:10}}),(0,r.jsx)(u(),{href:e.username?`/profile/${e.username}`:`/profiles/${e.id}`,style:{color:"#2563eb",textDecoration:"none",fontWeight:500,fontSize:"14px",padding:"4px 0",display:"block",width:"100%"},className:"hover:text-blue-700 hover:underline transition-colors",onClick:t=>{t.stopPropagation(),setTimeout(()=>{window.location.href=e.username?`/profile/${e.username}`:`/profiles/${e.id}`},50)},children:e.name})]},e.id))})]})},eP=({onReact:e,comment:t})=>{let[s,a]=i().useState(!1),[l,n]=i().useState("bottom"),o=i().useRef(null),c=i().useRef(null);return i().useEffect(()=>{let e=e=>{c.current&&!c.current.contains(e.target)&&o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,r.jsxs)("span",{style:{position:"relative",display:"inline-block"},children:[(0,r.jsxs)("button",{ref:o,type:"button",style:{background:"none",border:"none",cursor:"pointer",color:"#6b7280",fontSize:18,padding:4,marginLeft:4,borderRadius:"4px",transition:"background-color 0.2s ease"},"aria-label":"Add Reaction",onClick:()=>{if(!s&&o.current){let e=o.current.getBoundingClientRect(),t=window.innerHeight-e.bottom,s=e.top;n(t<300&&s>t?"top":"bottom")}a(e=>!e)},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f3f4f6"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[(0,r.jsx)("span",{style:{fontSize:18,marginRight:2},children:"+"}),(0,r.jsx)("span",{role:"img","aria-label":"Add Reaction",children:"\uD83D\uDE42"})]}),s&&(0,r.jsxs)("div",{ref:c,style:{position:"absolute",["bottom"===l?"top":"bottom"]:"100%",left:"bottom"===l?0:"auto",right:"top"===l?0:"auto",background:"white",border:"1px solid #e5e7eb",borderRadius:8,boxShadow:"0 4px 12px rgba(0,0,0,0.15)",zIndex:1e3,minWidth:280,maxWidth:320,padding:12,marginTop:4*("bottom"===l),marginBottom:4*("top"===l),display:"flex",flexDirection:"column",gap:8},children:[(0,r.jsx)("div",{style:{marginBottom:8,borderBottom:"1px solid #eee",paddingBottom:4,fontWeight:600,color:"#888",fontSize:"14px"},children:"\uD83D\uDE0A Fun Reactions"}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:6,marginBottom:12},children:eE.filter(e=>e.emoji).map(s=>(0,r.jsxs)("button",{type:"button",style:{background:eb(t,s.type)?s.color:"white",color:eb(t,s.type)?"white":"#374151",border:"1px solid #e5e7eb",borderRadius:8,padding:"8px 6px",cursor:"pointer",fontWeight:eb(t,s.type)?700:400,fontSize:20,minHeight:"40px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexDirection:"column",gap:2},onClick:()=>{e(t.id,s.type),a(!1)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.05)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.1)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)",e.currentTarget.style.boxShadow="none"},"aria-label":s.label,children:[(0,r.jsx)("span",{style:{filter:eb(t,s.type)?"drop-shadow(0 0 2px "+s.color+")":"none",fontSize:"18px"},children:s.emoji}),(0,r.jsx)("span",{style:{fontSize:"10px",fontWeight:500,color:eb(t,s.type)?"white":"#6b7280"},children:s.label})]},s.type))}),(0,r.jsx)("div",{style:{marginBottom:8,borderBottom:"1px solid #eee",paddingBottom:4,fontWeight:600,color:"#888",fontSize:"14px"},children:"⚖️ Justice & Law"}),(0,r.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:6},children:eE.filter(e=>e.icon).map(s=>{let l=s.icon;return l?(0,r.jsxs)("button",{type:"button",style:{background:eb(t,s.type)?s.color:"white",color:eb(t,s.type)?"white":"#374151",border:"1px solid #e5e7eb",borderRadius:8,padding:"8px 6px",cursor:"pointer",fontWeight:eb(t,s.type)?700:400,display:"flex",alignItems:"center",justifyContent:"center",gap:4,minHeight:"40px",transition:"all 0.2s ease",flexDirection:"column"},onClick:()=>{e(t.id,s.type),a(!1)},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.05)",e.currentTarget.style.boxShadow="0 2px 8px rgba(0,0,0,0.1)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)",e.currentTarget.style.boxShadow="none"},"aria-label":s.label,children:[(0,r.jsx)(l,{size:16,color:eb(t,s.type)?"white":s.color,weight:eb(t,s.type)?"fill":"regular"}),(0,r.jsx)("span",{style:{fontSize:"10px",fontWeight:500,color:eb(t,s.type)?"white":"#6b7280"},children:s.label})]},s.type):null})})]})]})},eR=i().memo(ev);return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsxs)("h3",{className:"text-lg font-semibold text-gray-900 flex items-center gap-2",children:[(0,r.jsx)(h.ChatCircle,{className:"h-5 w-5 text-blue-600"}),"Comments & Discussion"]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,r.jsx)(h.UserCircle,{className:"h-4 w-4"}),w.length," comments"]})]}),(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsxs)("button",{type:"button",onClick:()=>Y(!H),className:"flex items-center gap-1 px-3 py-1 text-sm text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-lg transition-colors",children:[(0,r.jsx)(h.MagnifyingGlassPlus,{className:"h-4 w-4"}),"Filters"]})})]}),(0,r.jsx)(o.AnimatePresence,{children:H&&(0,r.jsx)(o.motion.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"border-t border-gray-200 pt-4 space-y-4",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Sort by"}),(0,r.jsxs)("select",{value:O,onChange:e=>W(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",children:[(0,r.jsx)("option",{value:"newest",children:"Newest first"}),(0,r.jsx)("option",{value:"oldest",children:"Oldest first"}),(0,r.jsx)("option",{value:"mostLiked",children:"Most liked"}),(0,r.jsx)("option",{value:"mostReplies",children:"Most replies"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Filter by"}),(0,r.jsxs)("select",{value:V,onChange:e=>G(e.target.value),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm",children:[(0,r.jsx)("option",{value:"all",children:"All users"}),(0,r.jsx)("option",{value:"lawyers",children:"Lawyers only"}),(0,r.jsx)("option",{value:"clients",children:"Clients only"}),(0,r.jsx)("option",{value:"admins",children:"Admins only"})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Search"}),(0,r.jsx)("input",{type:"text",value:J,onChange:e=>q(e.target.value),placeholder:"Search comments...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm"})]})]})})})]}),(0,r.jsx)(p.A,{children:(0,r.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[(0,r.jsxs)("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[(0,r.jsx)(h.ChatsCircle,{className:"h-5 w-5 text-blue-600"}),"Join the Discussion"]}),(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("div",{className:"w-10 h-10 bg-gradient-to-br from-blue-500 to-purple-600 rounded-full flex items-center justify-center text-white font-semibold",children:N?.user?.image?(0,r.jsx)("img",{src:N.user.image,alt:N.user.name||"User",className:"w-10 h-10 rounded-full object-cover"}):(0,r.jsx)(h.UserCircle,{className:"h-5 w-5"})})}),(0,r.jsxs)("div",{className:"flex-1 space-y-3",children:[(0,r.jsx)("form",{onSubmit:e=>e.preventDefault(),role:"form","aria-label":"Add a comment",children:(0,r.jsx)("textarea",{ref:ed,value:D,onChange:e=>E(e.target.value),onKeyDown:e=>{"Enter"===e.key&&e.ctrlKey&&(e.preventDefault(),eg())},placeholder:"Share your thoughts on this case... (Ctrl+Enter to submit)",className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none",rows:4,"aria-label":"Comment input"})}),x&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("input",{ref:em,type:"file",multiple:!0,onChange:ej,className:"hidden",accept:"image/*,.pdf,.txt"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>em.current?.click(),className:"flex items-center gap-1 px-3 py-1 text-sm text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded-lg transition-colors",children:[(0,r.jsx)(h.Paperclip,{className:"h-4 w-4"}),"Attach files"]}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"Max 5MB per file"})]}),K.length>0&&(0,r.jsx)("div",{className:"space-y-2",children:K.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded-lg",children:[(0,r.jsx)(h.Paperclip,{className:"h-4 w-4 text-gray-500"}),(0,r.jsx)("span",{className:"text-sm text-gray-700 flex-1",children:e.name}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]}),(0,r.jsx)("button",{type:"button",onClick:()=>eN(t),className:"text-red-500 hover:text-red-700",children:(0,r.jsx)(h.XCircle,{className:"h-4 w-4"})})]},t))})]}),(0,r.jsxs)("div",{className:"flex justify-between items-center",children:[(0,r.jsxs)("span",{className:"text-sm text-gray-500",children:[D.length,"/1000 characters"]}),(0,r.jsx)("button",{type:"button",onClick:eg,disabled:!D.trim()||X,className:"flex items-center gap-2 px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:X?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Posting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(h.PaperPlaneRight,{className:"h-4 w-4"}),"Post Comment"]})})]})]})]})]})}),(0,r.jsx)("div",{className:"space-y-4",children:A?(0,r.jsxs)("div",{className:"text-center py-12",children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),(0,r.jsx)("p",{className:"text-gray-500 mt-2",children:"Loading comments..."})]}):0===ew.length?(0,r.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg",children:[(0,r.jsx)(h.ChatsCircle,{className:"h-12 w-12 text-gray-400 mx-auto mb-3"}),(0,r.jsx)("p",{className:"text-gray-500",children:"No comments yet. Be the first to share your thoughts!"})]}):(0,r.jsxs)("div",{className:"space-y-4",children:[ew.map(e=>(0,r.jsx)(eR,{comment:e,depth:0,onReply:e=>{T(e),P({[e]:""})},onEdit:t=>{L(t),U(e.content)},onDelete:e=>{confirm("Are you sure you want to delete this comment?")&&eC(e)},onReact:ef,isReplying:$===e.id,isEditing:R===e.id},e.id)),es&&!A&&(0,r.jsx)("div",{className:"text-center mt-4",children:(0,r.jsx)("button",{type:"button",className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",onClick:()=>{el(!0),et(e=>e+1)},disabled:er,children:er?"Loading...":"Load More"})})]})})]})};a()}catch(e){a(e)}})},52989:(e,t,s)=>{s.a(e,async(e,a)=>{try{s.d(t,{A:()=>j});var r=s(8732),l=s(82015),i=s(4722),n=s(63220),o=s(22863),c=s(40128),d=s(99622),m=s(85056),x=s(49048),u=s(9741),p=s(87637),h=s(13838),g=s(66596),b=s(75281),y=s(14940),f=e([n]);n=(f.then?(await f)():f)[0];let j=({caseId:e,caseTitle:t,caseOwner:s,className:a=""})=>{let{data:f}=(0,i.useSession)(),{ws:j,connected:N,joinCaseChat:w,leaveCaseChat:v,sendCaseTyping:A,userPresence:C,typingUsers:k}=(0,y.h)(),[S,D]=(0,l.useState)(!1),[E,$]=(0,l.useState)(!1),[T,I]=(0,l.useState)([]),[P,R]=(0,l.useState)(""),[L,M]=(0,l.useState)(!1),[U,F]=(0,l.useState)("public"),[z,B]=(0,l.useState)(!1),[_,O]=(0,l.useState)(!1),[W,V]=(0,l.useState)(!1),[G,J]=(0,l.useState)(null),q=(0,l.useRef)(null),H=(0,l.useRef)(null);(0,l.useRef)(null),(0,l.useEffect)(()=>(N&&e&&(w(e),I(e=>[{id:`system-${Date.now()}`,content:`Welcome to the live chat for "${t}"! 👋`,senderId:"system",senderName:"System",senderRole:"system",timestamp:Date.now(),type:"system",isPublic:!0}])),()=>{N&&e&&v(e)}),[N,e,t,w,v]),(0,l.useEffect)(()=>{if(!j)return;let t=t=>{try{let s=JSON.parse(t.data);switch(s.type){case"CASE_MESSAGE":s.data.caseId===e&&(I(e=>[...e,{id:s.data.id,content:s.data.content,senderId:s.data.senderId,senderName:s.data.senderName,senderAvatar:s.data.senderAvatar,senderRole:s.data.senderRole,timestamp:s.data.timestamp,type:"message",isPublic:s.data.isPublic,reactions:s.data.reactions||{}}]),z||s.data.senderId===f?.user?.id||X());break;case"CASE_TYPING":s.data.caseId;break;case"CASE_USER_JOINED":s.data.caseId===e&&I(e=>[...e,{id:`join-${Date.now()}`,content:`${s.data.userName} joined the chat`,senderId:"system",senderName:"System",senderRole:"system",timestamp:Date.now(),type:"system",isPublic:!0}]);break;case"CASE_USER_LEFT":s.data.caseId===e&&I(e=>[...e,{id:`leave-${Date.now()}`,content:`${s.data.userName} left the chat`,senderId:"system",senderName:"System",senderRole:"system",timestamp:Date.now(),type:"system",isPublic:!0}])}}catch(e){console.error("Error parsing WebSocket message:",e)}};return j.addEventListener("message",t),()=>j.removeEventListener("message",t)},[j,e,f?.user?.id,z]),(0,l.useEffect)(()=>{q.current&&S&&q.current.scrollIntoView({behavior:"smooth"})},[T,S]);let Y=(0,l.useCallback)(t=>{t!=t&&(M(t),A(e,t))},[e,A,L]),K=async()=>{if(!P.trim()||!f?.user?.id)return;let t={caseId:e,content:P.trim(),senderId:f.user.id,senderName:f.user.name||"Anonymous",senderAvatar:f.user.image,senderRole:f.user.role||"USER",timestamp:Date.now(),isPublic:"public"===U};try{j?.send(JSON.stringify({type:"CASE_MESSAGE",data:t})),I(e=>[...e,{id:`temp-${Date.now()}`,content:P.trim(),senderId:f.user.id,senderName:f.user.name||"Anonymous",senderAvatar:f.user.image||void 0,senderRole:f.user.role||"USER",timestamp:Date.now(),type:"message",isPublic:"public"===U}]),R(""),Y(!1)}catch(e){console.error("Error sending message:",e),J("Failed to send message")}},Q=e=>{R({interested:"I'm interested in this case! \uD83E\uDD14",question:"I have a question about this case.",support:"I support this case! ❤️",apply:"I'd like to apply for this case! \uD83D\uDCDD"}[e]||e)},X=()=>{let e=new(window.AudioContext||window.webkitAudioContext),t=e.createOscillator(),s=e.createGain();t.connect(s),s.connect(e.destination),t.frequency.setValueAtTime(800,e.currentTime),t.frequency.setValueAtTime(600,e.currentTime+.1),s.gain.setValueAtTime(.1,e.currentTime),s.gain.exponentialRampToValueAtTime(.01,e.currentTime+.2),t.start(e.currentTime),t.stop(e.currentTime+.2)},Z=()=>(k.get(`case_${e}`)||[]).filter(e=>e.userId!==f?.user?.id);return f?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.AnimatePresence,{children:!S&&(0,r.jsx)(n.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},onClick:()=>D(!0),className:`fixed bottom-6 right-6 z-50 bg-gradient-to-r from-blue-600 to-purple-600 text-white p-4 rounded-full shadow-2xl hover:shadow-3xl transition-all duration-300 hover:scale-110 ${a}`,children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(c.A,{className:"w-6 h-6"}),T.length>1&&(0,r.jsx)(n.motion.div,{initial:{scale:0},animate:{scale:1},className:"absolute -top-2 -right-2 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center",children:T.length-1})]})})}),(0,r.jsx)(n.AnimatePresence,{children:S&&(0,r.jsxs)(n.motion.div,{initial:{opacity:0,scale:.8,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.8,y:20},className:`fixed bottom-6 right-6 z-50 w-96 h-[500px] bg-white rounded-2xl shadow-2xl border border-gray-200 overflow-hidden ${a}`,children:[(0,r.jsxs)("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-white/20 rounded-full flex items-center justify-center",children:(0,r.jsx)(c.A,{className:"w-4 h-4"})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"font-semibold text-sm",children:"Live Chat"}),(0,r.jsx)("p",{className:"text-xs text-blue-100",children:t})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>B(!z),className:"p-1 hover:bg-white/20 rounded transition-colors",children:z?(0,r.jsx)(d.A,{className:"w-4 h-4"}):(0,r.jsx)(m.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{onClick:()=>O(!_),className:"p-1 hover:bg-white/20 rounded transition-colors",children:(0,r.jsx)(x.A,{className:"w-4 h-4"})}),(0,r.jsx)("button",{onClick:()=>$(!E),className:"p-1 hover:bg-white/20 rounded transition-colors",children:(0,r.jsx)(u.A,{className:"w-4 h-4"})})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-2 text-xs text-blue-100",children:[(0,r.jsx)(p.A,{className:"w-3 h-3"}),(0,r.jsxs)("span",{children:[Array.from(C.values()).filter(e=>"online"===e.status).length," online"]}),N&&(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsx)("div",{className:"w-2 h-2 bg-green-400 rounded-full animate-pulse"}),(0,r.jsx)("span",{children:"Live"})]})]})]}),(0,r.jsx)(n.AnimatePresence,{children:!E&&(0,r.jsxs)(n.motion.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},className:"flex flex-col h-full",children:[(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[T.map(e=>(0,r.jsx)(n.motion.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:`flex ${e.senderId===f.user?.id?"justify-end":"justify-start"}`,children:(0,r.jsx)("div",{className:`max-w-[80%] ${e.senderId===f.user?.id?"order-2":"order-1"}`,children:"system"===e.type?(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("span",{className:"inline-block bg-gray-100 text-gray-600 text-xs px-3 py-1 rounded-full",children:e.content})}):(0,r.jsxs)("div",{className:`rounded-2xl px-4 py-2 ${e.senderId===f.user?.id?"bg-blue-600 text-white":"bg-gray-100 text-gray-800"}`,children:[e.senderId!==f.user?.id&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("div",{className:"w-6 h-6 bg-gray-300 rounded-full flex items-center justify-center",children:e.senderAvatar?(0,r.jsx)("img",{src:e.senderAvatar,alt:e.senderName,className:"w-6 h-6 rounded-full object-cover"}):(0,r.jsx)(h.A,{className:"w-3 h-3 text-gray-600"})}),(0,r.jsx)("span",{className:"text-xs font-medium",children:e.senderName}),"LAWYER"===e.senderRole&&(0,r.jsx)(g.A,{className:"w-3 h-3 text-blue-500"})]}),(0,r.jsx)("p",{className:"text-sm",children:e.content}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,r.jsx)("span",{className:"text-xs opacity-70",children:(0,o.GP)(e.timestamp,"HH:mm")}),e.isPublic&&(0,r.jsx)("span",{className:"text-xs opacity-70",children:"Public"})]})]})})},e.id)),Z().length>0&&(0,r.jsxs)(n.motion.div,{initial:{opacity:0},animate:{opacity:1},className:"flex items-center gap-2 text-gray-500 text-sm",children:[(0,r.jsxs)("div",{className:"flex space-x-1",children:[(0,r.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce"}),(0,r.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,r.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),(0,r.jsxs)("span",{children:[Z().map(e=>e.userName).join(", ")," typing..."]})]}),(0,r.jsx)("div",{ref:q})]}),(0,r.jsx)("div",{className:"px-4 py-2 border-t border-gray-100",children:(0,r.jsx)("div",{className:"flex gap-2 mb-2",children:["interested","question","support","apply"].map(e=>(0,r.jsx)("button",{onClick:()=>Q(e),className:"px-3 py-1 text-xs bg-gray-100 hover:bg-gray-200 rounded-full transition-colors capitalize",children:e},e))})}),(0,r.jsxs)("div",{className:"p-4 border-t border-gray-100",children:[(0,r.jsxs)("div",{className:"flex items-end gap-2",children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)("textarea",{ref:H,value:P,onChange:e=>{R(e.target.value),Y(e.target.value.length>0)},onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),K())},placeholder:"Type your message...",className:"w-full p-3 border border-gray-200 rounded-lg resize-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",rows:1,maxLength:500})}),(0,r.jsx)("button",{onClick:K,disabled:!P.trim(),className:"p-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:(0,r.jsx)(b.A,{className:"w-4 h-4"})})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{onClick:()=>F("public"),className:`px-3 py-1 text-xs rounded-full transition-colors ${"public"===U?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-600"}`,children:"Public"}),(0,r.jsx)("button",{onClick:()=>F("private"),className:`px-3 py-1 text-xs rounded-full transition-colors ${"private"===U?"bg-purple-100 text-purple-700":"bg-gray-100 text-gray-600"}`,children:"Private"})]}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:[P.length,"/500"]})]})]})]})})]})})]}):null};a()}catch(e){a(e)}})},70776:(e,t,s)=>{s.a(e,async(e,a)=>{try{s.d(t,{A:()=>H});var r=s(8732),l=s(82015),i=s.n(l),n=s(22863),o=s(13213),c=s(66399),d=s(84904),m=s(74498),x=s(81680),u=s(30703),p=s(57341),h=s(27290),g=s(5453),b=s(87637),y=s(43623),f=s(47864),j=s(18467),N=s(5120),w=s(13838),v=s(39461),A=s(41919),C=s(57340),k=s(93923),S=s(6159),D=s(99421),E=s(39548),$=s(40128),T=s(63106),I=s(58509),P=s(66596),R=s(7670),L=s(81991),M=s(75974),U=s(6545),F=s(40613),z=s(1050),B=s(52989),_=s(19918),O=s.n(_),W=s(27206),V=e([F,B,W]);[F,B,W]=V.then?(await V)():V;let G=e=>{switch(e){case"urgent":return"bg-red-100 text-red-800 border-red-200";case"high":return"bg-orange-100 text-orange-800 border-orange-200";case"medium":return"bg-blue-100 text-blue-800 border-blue-200";default:return"bg-gray-100 text-gray-800 border-gray-200"}},J=e=>{switch(e){case"active":return"bg-green-100 text-green-800";case"pending":return"bg-yellow-100 text-yellow-800";case"closed":return"bg-gray-100 text-gray-800";default:return"bg-blue-100 text-blue-800"}},q=e=>{switch(e){case"active":return(0,r.jsx)(o.A,{className:"h-5 w-5 text-green-500"});case"pending":return(0,r.jsx)(c.A,{className:"h-5 w-5 text-yellow-500"});case"closed":return(0,r.jsx)(d.A,{className:"h-5 w-5 text-gray-500"});case"suspended":return(0,r.jsx)(m.A,{className:"h-5 w-5 text-red-500"});default:return(0,r.jsx)(c.A,{className:"h-5 w-5 text-gray-400"})}},H=({caseData:e,currentUser:t,mode:a,onEdit:_,onManageTeam:V,onViewApplications:H})=>{let[Y,K]=i().useState(null),[Q,X]=i().useState(!1),[Z,ee]=i().useState(""),[et,es]=i().useState(!1),[ea,er]=i().useState(!1),[el,ei]=i().useState(null),[en,eo]=i().useState(null),[ec,ed]=i().useState(!1),em=s(44233).useRouter?s(44233).useRouter():null,[ex,eu]=(0,l.useState)(!1),[ep,eh]=(0,l.useState)(!1),[eg,eb]=(0,l.useState)(null),[ey,ef]=(0,l.useState)(""),[ej,eN]=(0,l.useState)(!1),[ew,ev]=(0,l.useState)(null),[eA,eC]=(0,l.useState)([]),[ek,eS]=(0,l.useState)(null),eD=(0,l.useRef)(null);if(ek)return(0,r.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,r.jsxs)("div",{className:"text-center max-w-md mx-auto",children:[(0,r.jsxs)("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4",children:[(0,r.jsx)("h1",{className:"text-xl font-bold mb-2",children:"Component Error"}),(0,r.jsx)("p",{className:"text-sm",children:ek})]}),(0,r.jsx)("button",{onClick:()=>eS(null),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Try Again"})]})});let eE=t?.role==="LAWYER",e$=t?.isVerifiedLawyer||t?.verificationStatus==="VERIFIED_BARREAU";i().useEffect(()=>{(async()=>{if(t&&e?.id){X(!0);try{let t=await fetch(`/api/user/registrations?caseId=${e.id}`);if(t.ok){let e=await t.json();e&&e.length>0?K(e[0]):K(null)}}catch(e){console.error("Error fetching user application:",e),eS("Failed to load application data")}finally{X(!1)}}})()},[t,e?.id]),i().useEffect(()=>{try{e?.isAcceptingApplications?Y&&"PENDING"===Y.status?ee("Continue your application for this case."):Y&&"SUBMITTED"===Y.status?ee("View your submitted application for this case."):ee("Start a new application for this case."):ee("This case is not accepting applications at this time.")}catch(e){console.error("Error setting button tooltip:",e)}},[Y,e]);let eT=()=>{if(!e?.requiredDocuments)return[];try{if(Array.isArray(e.requiredDocuments))return e.requiredDocuments;if("string"==typeof e.requiredDocuments){let t=JSON.parse(e.requiredDocuments);return Array.isArray(t)?t:[]}return[]}catch(e){return console.error("Error parsing required documents:",e),[]}},eI=async()=>{if(window.confirm("Are you sure you want to delete this case? This action cannot be undone."))try{let t=await fetch(`/api/cases/${e.id}`,{method:"DELETE"});if(t.ok)alert("Case deleted successfully."),em?em.push("/"):(window.history.pushState({},"","/"),window.dispatchEvent(new PopStateEvent("popstate")));else{let e=await t.text();alert("Failed to delete case: "+e)}}catch(e){alert("Error deleting case.")}},eP=()=>e?.status?"closed"===e.status?100:"active"===e.status?75:25*("pending"===e.status):0,eR=async()=>{if(el&&e?.id){ed(!0);try{let t=new FormData;t.append("file",el);let s=await fetch("/api/upload",{method:"POST",body:t});if(!s.ok)throw Error("Failed to upload logo");let a=await s.json();if((await fetch(`/api/cases/${e.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({logoUrl:a.url})})).ok)e.logoUrl=a.url,er(!1),ei(null),eo(null),window.location.reload();else throw Error("Failed to update case")}catch(e){console.error("Error updating logo:",e),alert("Failed to update logo. Please try again.")}finally{ed(!1)}}},eL=t?.id===e?.createdBy,eM=async s=>{if(s.preventDefault(),ew&&t){if(ew.size>0xa00000)return void eb("File size must be less than 10MB");if(!["image/jpeg","image/png","image/gif","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/plain","application/zip","application/x-rar-compressed"].includes(ew.type))return void eb("File type not allowed. Please upload images, PDFs, documents, or archives.");eh(!0),eb(null);try{let t=new FormData;t.append("file",ew),t.append("description",ey),t.append("public",String(ej));let s=await fetch(`/api/cases/${e.id}/upload`,{method:"POST",body:t});if(!s.ok){let e=await s.json();throw Error(e.error||"Failed to upload document")}eu(!1),ev(null),ef(""),eN(!1);let a=await fetch(`/api/cases/${e.id}/documents?publicOnly=true`);if(a.ok){let e=await a.json();eC(e.documents||[])}}catch(e){eb(e.message||"Upload failed")}finally{eh(!1)}}};i().useEffect(()=>{(async()=>{if(e?.id)try{let t=await fetch(`/api/cases/${e.id}/documents?publicOnly=true`);if(t.ok){let e=await t.json();eC(e.documents||[])}}catch{}})()},[e?.id,ex]);let eU=async t=>{if(confirm("Are you sure you want to delete this document?"))try{let s=await fetch(`/api/cases/${e.id}/documents/${t}`,{method:"DELETE"});if(s.ok)eC(e=>e.filter(e=>e.id!==t)),alert("Document deleted successfully");else{let e=await s.json();alert(e.error||"Failed to delete document")}}catch(e){console.error("Error deleting document:",e),alert("Failed to delete document")}};return(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-indigo-50",children:[(0,r.jsxs)("div",{className:"relative bg-gradient-to-br from-red-600 to-orange-600 text-white",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-black/10"}),(0,r.jsxs)("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[(0,r.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,r.jsxs)("button",{onClick:()=>{"admin"===a?em?.push("/admin/case-management"):em?.back()||window.history.back()},className:"flex items-center gap-2 text-white/80 hover:text-white transition-colors",children:[(0,r.jsx)(x.A,{className:"h-5 w-5"}),"admin"===a?"Back to Case Management":"Back to Cases"]})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 items-start",children:[(0,r.jsxs)("div",{className:"lg:col-span-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,r.jsxs)("div",{className:"flex-shrink-0 relative group",children:[e.logoUrl?(0,r.jsx)("img",{src:e.logoUrl,alt:`${e.title} Logo`,className:"w-24 h-24 rounded-xl object-contain border-2 border-white/30 shadow-lg"}):(0,r.jsx)("div",{className:"w-24 h-24 rounded-xl bg-gradient-to-br from-white/20 to-white/10 border-2 border-white/30 flex items-center justify-center shadow-lg",children:(0,r.jsx)(u.A,{className:"w-12 h-12 text-white"})}),eL&&(0,r.jsx)("div",{className:"absolute inset-0 bg-black/50 rounded-xl opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex items-center justify-center",children:(0,r.jsx)("button",{onClick:()=>er(!0),className:"text-white text-xs font-medium hover:text-red-200 transition-colors",children:"Change Logo"})})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[q(e.status),(0,r.jsx)("h1",{className:"text-4xl font-bold drop-shadow-lg",children:e.title})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mb-6",children:[e.caseNumber&&(0,r.jsxs)("span",{className:"text-red-100 bg-white/20 px-3 py-1 rounded-full text-sm font-medium",children:["#",e.caseNumber]}),(0,r.jsxs)("span",{className:`text-xs px-3 py-1 rounded-full border border-white/30 bg-white/10 ${G(e.priority||"medium")}`,children:[(e.priority||"MEDIUM").toUpperCase()," PRIORITY"]}),(0,r.jsx)("span",{className:`text-xs px-3 py-1 rounded-full bg-white/20 ${J(e.status||"pending")}`,children:(e.status||"PENDING").toUpperCase()})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-6 text-red-100 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(p.A,{className:"h-4 w-4"}),e.jurisdiction]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(h.A,{className:"h-4 w-4"}),e.views||0," views"]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(g.A,{className:"h-4 w-4"}),e.createdAt?(0,n.GP)(new Date(e.createdAt),"MMM d, yyyy"):"Unknown"]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(b.A,{className:"h-4 w-4"}),e._count?.registrations||0," applications"]})]}),e.summary&&(0,r.jsx)("div",{className:"mt-6 p-4 bg-white/10 rounded-lg border border-white/20",children:(0,r.jsx)("p",{className:"text-red-50 leading-relaxed",children:e.summary})})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(W.A,{url:"",title:e.title,description:e.summary||e.description||"",hashtags:e.tags||[],className:"flex-1"}),(0,r.jsx)("button",{onClick:()=>{es(!et)},className:`px-4 py-2 rounded-lg transition-colors ${et?"bg-yellow-500 hover:bg-yellow-600 text-white":"bg-white/20 hover:bg-white/30 text-white"}`,children:(0,r.jsx)(y.A,{className:`h-4 w-4 ${et?"fill-current":""}`})})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-3 mt-4",children:[e.isAcceptingApplications&&(0,r.jsx)("button",{onClick:()=>{Y?em?.push(`/user/applications/${Y.id}`):em?.push(`/cases/${e.id}/apply`)},className:"bg-white text-red-600 rounded-lg font-bold shadow-lg hover:scale-105 transition-all duration-200 px-6 py-3 text-center",title:Z,children:Y?"Continue Application":"Apply Now"}),"admin"===a&&(0,r.jsxs)("div",{className:"flex gap-2",children:[_&&(0,r.jsxs)("button",{onClick:_,className:"bg-white/20 hover:bg-white/30 text-white rounded-lg transition-colors px-4 py-2 flex items-center gap-2",children:[(0,r.jsx)(f.A,{className:"h-4 w-4"}),"Edit"]}),V&&(0,r.jsxs)("button",{onClick:V,className:"bg-white/20 hover:bg-white/30 text-white rounded-lg transition-colors px-4 py-2 flex items-center gap-2",children:[(0,r.jsx)(b.A,{className:"h-4 w-4"}),"Team"]}),(0,r.jsxs)(O(),{href:`/cases/${e.id}/showcase`,className:"bg-white/20 hover:bg-white/30 text-white rounded-lg transition-colors px-4 py-2 flex items-center gap-2",children:[(0,r.jsx)(j.A,{className:"h-4 w-4"}),"View Showcase"]})]}),(0,r.jsxs)(O(),{href:`/cases/${e.id}/showcase`,className:"bg-white/20 hover:bg-white/30 text-white rounded-lg transition-colors px-4 py-2 flex items-center gap-2",children:[(0,r.jsx)(j.A,{className:"h-4 w-4"}),"View Beautiful Profile"]})]})]})]})]})]}),(0,r.jsx)("div",{className:"bg-white border-b border-gray-200 shadow-sm",children:(0,r.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsx)("span",{className:"text-sm font-bold text-gray-800",children:"Case Progress"}),(0,r.jsxs)("span",{className:"text-sm font-semibold text-red-600",children:[eP(),"% Complete"]})]}),(0,r.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-3 shadow-inner",children:(0,r.jsx)("div",{className:"bg-gradient-to-r from-red-500 to-orange-500 h-3 rounded-full transition-all duration-700 ease-out shadow-lg",style:{width:`${eP()}%`}})}),(0,r.jsxs)("div",{className:"flex justify-between mt-2 text-xs text-gray-500",children:[(0,r.jsx)("span",{children:"Started"}),(0,r.jsx)("span",{children:"In Progress"}),(0,r.jsx)("span",{children:"Completed"})]})]})}),(0,r.jsx)("div",{className:"bg-white border-b border-gray-200",children:(0,r.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[(0,r.jsx)("div",{className:"bg-gradient-to-br from-red-50 to-orange-50 rounded-xl p-6 border border-red-200 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-red-600",children:"Total Applications"}),(0,r.jsx)("p",{className:"text-2xl font-bold text-red-700",children:e._count?.registrations||0})]}),(0,r.jsx)("div",{className:"w-12 h-12 bg-red-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(b.A,{className:"h-6 w-6 text-red-600"})})]})}),(0,r.jsx)("div",{className:"bg-gradient-to-br from-blue-50 to-indigo-50 rounded-xl p-6 border border-blue-200 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-blue-600",children:"Case Views"}),(0,r.jsx)("p",{className:"text-2xl font-bold text-blue-700",children:e.views||0})]}),(0,r.jsx)("div",{className:"w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(h.A,{className:"h-6 w-6 text-blue-600"})})]})}),(0,r.jsx)("div",{className:"bg-gradient-to-br from-green-50 to-emerald-50 rounded-xl p-6 border border-green-200 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-green-600",children:"Priority Level"}),(0,r.jsx)("p",{className:"text-2xl font-bold text-green-700",children:(e.priority||"MEDIUM").toUpperCase()})]}),(0,r.jsx)("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(N.A,{className:"h-6 w-6 text-green-600"})})]})}),(0,r.jsx)("div",{className:"bg-gradient-to-br from-purple-50 to-pink-50 rounded-xl p-6 border border-purple-200 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-purple-600",children:"Status"}),(0,r.jsx)("p",{className:"text-2xl font-bold text-purple-700",children:(e.status||"PENDING").toUpperCase()})]}),(0,r.jsx)("div",{className:"w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(o.A,{className:"h-6 w-6 text-purple-600"})})]})})]})})}),(0,r.jsx)("div",{className:"sticky top-16 z-40 bg-white border-b border-gray-200 shadow-lg",children:(0,r.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,r.jsxs)("div",{className:"flex items-center space-x-6 overflow-x-auto py-4",children:[(0,r.jsxs)("button",{onClick:()=>document.getElementById("overview")?.scrollIntoView({behavior:"smooth"}),className:"flex items-center gap-2 px-4 py-3 text-gray-700 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all duration-200 whitespace-nowrap font-semibold border-b-2 border-transparent hover:border-red-600",children:[(0,r.jsx)(u.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"text-sm",children:"Overview"})]}),(0,r.jsxs)("button",{onClick:()=>document.getElementById("lawyer")?.scrollIntoView({behavior:"smooth"}),className:"flex items-center gap-2 px-4 py-3 text-gray-700 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all duration-200 whitespace-nowrap font-semibold border-b-2 border-transparent hover:border-red-600",children:[(0,r.jsx)(w.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"text-sm",children:"Lead Lawyer"})]}),(0,r.jsxs)("button",{onClick:()=>document.getElementById("updates")?.scrollIntoView({behavior:"smooth"}),className:"flex items-center gap-2 px-4 py-3 text-gray-700 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all duration-200 whitespace-nowrap font-semibold border-b-2 border-transparent hover:border-red-600",children:[(0,r.jsx)(c.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"text-sm",children:"Updates"})]}),(0,r.jsxs)("button",{onClick:()=>document.getElementById("documents")?.scrollIntoView({behavior:"smooth"}),className:"flex items-center gap-2 px-4 py-3 text-gray-700 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all duration-200 whitespace-nowrap font-semibold border-b-2 border-transparent hover:border-red-600",children:[(0,r.jsx)(u.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"text-sm",children:"Documents"})]}),(0,r.jsxs)("button",{onClick:()=>document.getElementById("comments")?.scrollIntoView({behavior:"smooth"}),className:"flex items-center gap-2 px-4 py-3 text-gray-700 hover:text-red-600 hover:bg-red-50 rounded-lg transition-all duration-200 whitespace-nowrap font-semibold border-b-2 border-transparent hover:border-red-600",children:[(0,r.jsx)(v.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"text-sm",children:"Comments & Discussion"})]})]})})}),eE&&!e$&&(0,r.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-6",children:(0,r.jsx)("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-r-lg",children:(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)(m.A,{className:"h-5 w-5 text-yellow-400 mr-3 mt-0.5"}),(0,r.jsx)("div",{children:(0,r.jsxs)("p",{className:"text-sm text-yellow-800",children:[(0,r.jsx)("strong",{children:"Account Not Verified:"})," You must complete Barreau verification to accept cases, upload files, or message clients. Sensitive actions are disabled until you are verified."]})})]})})}),t&&(0,r.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-6",children:(0,r.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 rounded-xl p-6 text-white",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-lg font-semibold mb-1",children:"Ready to Apply?"}),(0,r.jsx)("p",{className:"text-blue-100 text-sm",children:"Join this case and make a difference"})]}),(0,r.jsx)("div",{className:"flex items-center gap-3",children:Q?(0,r.jsxs)("button",{className:"px-6 py-3 rounded-lg bg-white/20 text-white flex items-center",disabled:!0,children:[(0,r.jsxs)("svg",{className:"animate-spin h-5 w-5 mr-2",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Checking..."]}):e.isAcceptingApplications?Y?"PENDING"===Y.status?(0,r.jsxs)(O(),{href:`/user/registrations/${Y.id}`,className:"px-6 py-3 rounded-lg bg-yellow-500 text-white font-semibold hover:bg-yellow-600 transition-colors flex items-center",title:Z,children:[(0,r.jsx)(C.A,{className:"h-4 w-4 mr-2"})," Continue My Application"]}):(0,r.jsxs)(O(),{href:`/user/registrations/${Y.id}`,className:"px-6 py-3 rounded-lg bg-green-600 text-white font-semibold hover:bg-green-700 transition-colors flex items-center",title:Z,children:[(0,r.jsx)(h.A,{className:"h-4 w-4 mr-2"})," View My Application"]}):(0,r.jsxs)(O(),{href:`/user/registrations/new?caseId=${e.id}`,className:"px-6 py-3 rounded-lg bg-white text-blue-600 font-semibold hover:bg-gray-100 transition-colors flex items-center",title:Z,children:[(0,r.jsx)(A.A,{className:"h-4 w-4 mr-2"})," Apply Now"]}):(0,r.jsxs)("button",{className:"px-6 py-3 rounded-lg bg-white/20 text-white cursor-not-allowed",disabled:!0,title:Z,children:[(0,r.jsx)(A.A,{className:"h-4 w-4 mr-2 inline"})," Apply Now"]})})]})})}),(0,r.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[(0,r.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,r.jsxs)("div",{id:"overview",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(u.A,{className:"h-5 w-5 text-blue-600"})}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Case Overview"})]}),(0,r.jsx)("p",{className:"text-gray-700 leading-relaxed text-lg mb-6",children:e.description}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(k.A,{className:"h-5 w-5 text-blue-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-medium text-gray-900",children:"Case Type:"}),(0,r.jsx)("span",{className:"ml-2 text-gray-600 capitalize",children:e.caseType.replace("_"," ")})]})]}),e.court&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(S.A,{className:"h-5 w-5 text-blue-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-medium text-gray-900",children:"Court:"}),(0,r.jsx)("span",{className:"ml-2 text-gray-600",children:e.court})]})]})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[e.budget&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(D.A,{className:"h-5 w-5 text-green-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-medium text-gray-900",children:"Budget:"}),(0,r.jsxs)("span",{className:"ml-2 text-gray-600",children:["$",e.budget.toLocaleString()," CAD"]})]})]}),e.applicationDeadline&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(g.A,{className:"h-5 w-5 text-orange-600"}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"font-medium text-gray-900",children:"Deadline:"}),(0,r.jsx)("span",{className:"ml-2 text-gray-600",children:(0,n.GP)(new Date(e.applicationDeadline),"PPP")})]})]})]})]}),(0,r.jsxs)("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 rounded-lg",children:[(0,r.jsx)(o.A,{className:`h-5 w-5 mr-3 ${e.isAcceptingApplications?"text-green-500":"text-gray-400"}`}),(0,r.jsx)("span",{className:"text-sm text-gray-700",children:e.isAcceptingApplications?"Accepting Applications":"Not Accepting Applications"})]}),(0,r.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 rounded-lg",children:[(0,r.jsx)(o.A,{className:`h-5 w-5 mr-3 ${e.requiresApproval?"text-blue-500":"text-gray-400"}`}),(0,r.jsx)("span",{className:"text-sm text-gray-700",children:e.requiresApproval?"Requires Approval":"Auto-Approval"})]})]})]}),(0,r.jsxs)("div",{id:"lawyer",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(w.A,{className:"h-5 w-5 text-purple-600"})}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Lead Lawyer"})]}),(0,r.jsxs)("div",{className:"flex items-start gap-6",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:e.leadLawyer?.profilePicture?(0,r.jsx)("img",{src:e.leadLawyer.profilePicture,alt:e.leadLawyer.name,className:"h-20 w-20 rounded-full object-cover border-4 border-purple-100"}):(0,r.jsx)("div",{className:"h-20 w-20 rounded-full bg-gradient-to-br from-purple-500 to-blue-600 flex items-center justify-center text-white text-2xl font-bold border-4 border-purple-100",children:e.leadLawyer?.name?.charAt(0)})}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,r.jsx)("h3",{className:"text-xl font-bold text-gray-900",children:e.leadLawyer?.name}),e.leadLawyer?.isVerified&&(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[(0,r.jsx)(E.A,{className:"h-3 w-3"}),"Verified"]}),e.leadLawyer?.proBono&&(0,r.jsx)("span",{className:"px-3 py-1 text-xs bg-green-100 text-green-800 rounded-full font-medium",children:"Pro Bono"})]}),e.leadLawyer?.title&&(0,r.jsx)("p",{className:"text-lg text-gray-600 mb-2",children:e.leadLawyer.title}),e.leadLawyer?.specialization&&(0,r.jsx)("p",{className:"text-gray-600 mb-3",children:e.leadLawyer.specialization}),(0,r.jsx)(U.A,{rating:e.leadLawyer?.averageRating,size:"md"}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"Success Rate:"}),(0,r.jsxs)("span",{className:"font-semibold text-gray-900",children:[e.leadLawyer?.wonCases,"/",e.leadLawyer?.totalCases," cases won"]})]}),e.leadLawyer?.hourlyRate&&(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"Rate:"}),(0,r.jsxs)("span",{className:"font-semibold text-gray-900",children:["$",e.leadLawyer.hourlyRate,"/hr"]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[e.leadLawyer?.yearsOfExperience&&(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"Experience:"}),(0,r.jsxs)("span",{className:"font-semibold text-gray-900",children:[e.leadLawyer.yearsOfExperience," years"]})]}),e.leadLawyer?.officeLocation&&(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm text-gray-600",children:"Location:"}),(0,r.jsxs)("span",{className:"font-semibold text-gray-900 flex items-center gap-1",children:[(0,r.jsx)(p.A,{className:"h-3 w-3"}),e.leadLawyer.officeLocation]})]})]})]}),e.leadLawyer?.bio&&(0,r.jsx)("p",{className:"text-gray-700 mt-4 leading-relaxed",children:e.leadLawyer.bio})]})]})]}),(0,r.jsx)(z.A,{caseData:e}),eT().length>0&&(0,r.jsxs)("div",{id:"documents",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(u.A,{className:"h-5 w-5 text-green-600"})}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Required Documents"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:eT().map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 rounded-lg",children:[(0,r.jsx)(o.A,{className:"h-5 w-5 text-green-500 mr-3"}),(0,r.jsx)("span",{className:"text-gray-700 font-medium",children:e})]},t))})]}),(0,r.jsxs)("div",{id:"updates",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-10 h-10 bg-orange-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(c.A,{className:"h-5 w-5 text-orange-600"})}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Recent Updates"})]}),e.caseUpdates?.length===0?(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)(c.A,{className:"h-12 w-12 text-gray-300 mx-auto mb-4"}),(0,r.jsx)("p",{className:"text-gray-500",children:"No updates yet"})]}):(0,r.jsx)("div",{className:"space-y-4",children:e.caseUpdates?.slice(0,5).map(e=>(0,r.jsxs)("div",{className:"border-l-4 border-blue-200 pl-6 py-4 hover:bg-gray-50 rounded-r-lg transition-colors",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsx)("h3",{className:"font-semibold text-gray-900",children:e.title}),(0,r.jsx)("span",{className:"text-sm text-gray-500 bg-gray-100 px-2 py-1 rounded-full",children:(0,n.GP)(new Date(e.createdAt),"MMM d, yyyy")})]}),e.description&&(0,r.jsx)("p",{className:"text-gray-600 mb-2",children:e.description}),(0,r.jsxs)("div",{className:"flex items-center text-sm text-gray-500",children:[(0,r.jsx)(w.A,{className:"h-4 w-4 mr-1"}),e.author?.name,(0,r.jsx)("span",{className:"mx-2",children:"•"}),(0,r.jsx)("span",{className:"capitalize",children:e.updateType}),e.isPublic&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"mx-2",children:"•"}),(0,r.jsx)("span",{className:"text-green-600 font-medium",children:"Public"})]})]})]},e.id))})]}),(0,r.jsxs)("div",{id:"comments",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-10 h-10 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)($.A,{className:"h-5 w-5 text-indigo-600"})}),(0,r.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Comments & Discussion"})]}),(0,r.jsx)(F.A,{caseId:e.id,mode:a,allowAttachments:!0,allowReactions:!0,allowReplies:!0,apiEndpoint:`/api/live-cases/${e.id}/comments`})]})]}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-blue-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(T.A,{className:"h-4 w-4 text-blue-600"})}),(0,r.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Quick Stats"})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-blue-50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(b.A,{className:"h-5 w-5 text-blue-600 mr-3"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Applications"})]}),(0,r.jsx)("span",{className:"font-bold text-blue-600 text-lg",children:e._count?.registrations||0})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-red-50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(I.A,{className:"h-5 w-5 text-red-600 mr-3"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Supporters"})]}),(0,r.jsx)("span",{className:"font-bold text-red-600 text-lg",children:e._count?.supporters||0})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-green-50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(D.A,{className:"h-5 w-5 text-green-600 mr-3"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Offers"})]}),(0,r.jsx)("span",{className:"font-bold text-green-600 text-lg",children:e._count?.offers||0})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-purple-50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)($.A,{className:"h-5 w-5 text-purple-600 mr-3"}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Comments"})]}),(0,r.jsx)("span",{className:"font-bold text-purple-600 text-lg",children:e._count?.comments||0})]})]})]}),"admin"===a&&(0,r.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-yellow-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(P.A,{className:"h-4 w-4 text-yellow-600"})}),(0,r.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Admin Tools"})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("button",{onClick:_,className:"w-full flex items-center justify-center px-4 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium",children:[(0,r.jsx)(f.A,{className:"h-4 w-4 mr-2"}),"Edit Case"]}),(0,r.jsxs)("button",{onClick:H,className:"w-full flex items-center justify-center px-4 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors font-medium",children:[(0,r.jsx)(b.A,{className:"h-4 w-4 mr-2"}),"View Applications"]}),(0,r.jsxs)("button",{onClick:V,className:"w-full flex items-center justify-center px-4 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors font-medium",children:[(0,r.jsx)(N.A,{className:"h-4 w-4 mr-2"}),"Manage Team"]})]})]}),"public"===a&&t&&e.creator?.id===t.id&&(0,r.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-orange-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(R.A,{className:"h-4 w-4 text-orange-600"})}),(0,r.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Your Case Tools"})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("button",{onClick:_,className:"w-full flex items-center justify-center px-4 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors font-medium",children:[(0,r.jsx)(f.A,{className:"h-4 w-4 mr-2"}),"Edit Case"]}),(0,r.jsxs)("button",{onClick:eI,className:"w-full flex items-center justify-center px-4 py-3 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors font-medium",children:[(0,r.jsx)(L.A,{className:"h-4 w-4 mr-2"}),"Delete Case"]})]})]}),(0,r.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-gray-100 rounded-lg flex items-center justify-center",children:(0,r.jsx)(M.A,{className:"h-4 w-4 text-gray-600"})}),(0,r.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Case Information"})]}),(0,r.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,r.jsx)("span",{className:"font-medium text-gray-700",children:"Created:"}),(0,r.jsx)("span",{className:"text-gray-600",children:(0,n.GP)(new Date(e.createdAt),"MMM d, yyyy")})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,r.jsx)("span",{className:"font-medium text-gray-700",children:"Last Updated:"}),(0,r.jsx)("span",{className:"text-gray-600",children:(0,n.GP)(new Date(e.updatedAt),"MMM d, yyyy")})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,r.jsx)("span",{className:"font-medium text-gray-700",children:"Created By:"}),(0,r.jsx)("span",{className:"text-gray-600",children:e.creator?.name})]}),e.firmName&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,r.jsx)("span",{className:"font-medium text-gray-700",children:"Firm:"}),(0,r.jsx)("span",{className:"text-gray-600",children:e.firmName})]}),e.expectedDuration&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,r.jsx)("span",{className:"font-medium text-gray-700",children:"Expected Duration:"}),(0,r.jsxs)("span",{className:"text-gray-600",children:[e.expectedDuration," days"]})]}),e.filingDate&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,r.jsx)("span",{className:"font-medium text-gray-700",children:"Filing Date:"}),(0,r.jsx)("span",{className:"text-gray-600",children:(0,n.GP)(new Date(e.filingDate),"MMM d, yyyy")})]})]})]})]})]})}),"public"===a&&t&&(0,r.jsx)(B.A,{caseId:e.id,caseTitle:e.title,caseOwner:{id:e.creator?.id||"",name:e.creator?.name||"Unknown",avatar:e.creator?.image,role:e.creator?.role||"USER"}}),ea&&(0,r.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,r.jsxs)("div",{className:"bg-white rounded-xl p-6 max-w-md w-full mx-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Change Case Logo"}),(0,r.jsx)("button",{onClick:()=>{er(!1),ei(null),eo(null)},className:"text-gray-400 hover:text-gray-600",children:(0,r.jsx)(d.A,{className:"h-5 w-5"})})]}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"flex justify-center",children:en?(0,r.jsx)("img",{src:en,alt:"Logo Preview",className:"w-24 h-24 rounded-lg object-cover border-2 border-gray-200"}):(0,r.jsx)("div",{className:"w-24 h-24 rounded-lg bg-gray-100 border-2 border-dashed border-gray-300 flex items-center justify-center",children:(0,r.jsx)(u.A,{className:"w-8 h-8 text-gray-400"})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Select New Logo"}),(0,r.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{let t=e.target.files?.[0];t&&(ei(t),eo(URL.createObjectURL(t)))},className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Supported formats: JPG, PNG, GIF. Max size: 5MB"})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,r.jsx)("button",{onClick:()=>{er(!1),ei(null),eo(null)},className:"flex-1 px-4 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors",children:"Cancel"}),(0,r.jsx)("button",{onClick:eR,disabled:!el||ec,className:"flex-1 px-4 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 justify-center",children:ec?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2",viewBox:"0 0 24 24",children:[(0,r.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,r.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Uploading..."]}):"Update Logo"})]})]})]})}),ex&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-40",children:(0,r.jsxs)("form",{className:"bg-white rounded-lg shadow-lg p-6 w-full max-w-md flex flex-col gap-4",onSubmit:eM,children:[(0,r.jsx)("h3",{className:"text-lg font-bold mb-2",children:"Upload Document"}),(0,r.jsx)("input",{type:"file",accept:".pdf,.doc,.docx,.txt,.jpg,.jpeg,.png,.mp3,.mp4,.wav,.avi,.mov,.mkv",ref:eD,onChange:e=>ev(e.target.files?.[0]||null),required:!0,className:"border rounded px-3 py-2"}),(0,r.jsx)("textarea",{placeholder:"Description (optional)",value:ey,onChange:e=>ef(e.target.value),className:"border rounded px-3 py-2"}),(0,r.jsxs)("label",{className:"flex items-center gap-2",children:[(0,r.jsx)("input",{type:"checkbox",checked:ej,onChange:e=>eN(e.target.checked)}),(0,r.jsx)("span",{children:"Make this document public"})]}),eg&&(0,r.jsx)("div",{className:"text-red-600 text-sm",children:eg}),(0,r.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,r.jsx)("button",{type:"submit",disabled:ep,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded font-semibold",children:ep?"Uploading...":"Upload"}),(0,r.jsx)("button",{type:"button",onClick:()=>eu(!1),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 px-4 py-2 rounded font-semibold",children:"Cancel"})]})]})}),(0,r.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("h2",{className:"text-2xl font-bold text-gray-800 flex items-center gap-2",children:[(0,r.jsx)(u.A,{className:"h-6 w-6 text-blue-600"})," Documents"]}),t&&(0,r.jsx)("button",{onClick:()=>eu(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg font-semibold shadow",children:"Upload Document"})]}),0===eA.length?(0,r.jsx)("div",{className:"text-gray-500",children:"No public documents yet."}):(0,r.jsx)("div",{className:"space-y-6",children:Object.entries(eA.reduce((e,t)=>{let s=t.user?.id||"unknown";return e[s]||(e[s]=[]),e[s].push(t),e},{})).sort(([t],[s])=>t===e.createdBy?-1:+(s===e.createdBy)).map(([s,a])=>(0,r.jsxs)("div",{className:"border rounded-lg p-4 bg-white/80",children:[(0,r.jsxs)("div",{className:"font-semibold text-blue-700 mb-2 flex items-center gap-2",children:[a.length>0&&a[0]?.user?.profilePicture&&(0,r.jsx)("img",{src:a[0]?.user?.profilePicture,alt:a[0]?.user?.name,className:"w-7 h-7 rounded-full object-cover"}),a.length>0&&a[0]?.user?.name||"Unknown User",s===e.createdBy&&(0,r.jsx)("span",{className:"ml-2 px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs",children:"Creator"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:a.map(e=>(0,r.jsxs)("div",{className:"border rounded p-3 bg-white flex flex-col gap-2 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.type?.includes("pdf")?(0,r.jsx)(u.A,{className:"h-5 w-5 text-red-600"}):e.type?.includes("image")?(0,r.jsx)("img",{src:e.url,alt:e.name,className:"h-8 w-8 object-cover rounded"}):e.type?.includes("audio")?(0,r.jsx)("span",{className:"inline-block bg-blue-100 text-blue-700 rounded px-2 py-1 text-xs",children:"AUDIO"}):e.type?.includes("video")?(0,r.jsx)("span",{className:"inline-block bg-purple-100 text-purple-700 rounded px-2 py-1 text-xs",children:"VIDEO"}):(0,r.jsx)(u.A,{className:"h-5 w-5 text-gray-400"}),(0,r.jsx)("span",{className:"font-medium text-gray-800 truncate",title:e.name,children:e.name})]}),e.description&&(0,r.jsx)("div",{className:"text-xs text-gray-600",children:e.description}),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[(0,r.jsx)("span",{children:e.type}),(0,r.jsxs)("span",{children:[(e.fileSize/1024).toFixed(1)," KB"]}),(0,r.jsx)("span",{children:e.createdAt?(0,n.GP)(new Date(e.createdAt),"MMM d, yyyy"):""})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm font-semibold",children:"View / Download"}),(t?.id===e.userId||t?.role==="ADMIN"||t?.role==="SUPERADMIN")&&(0,r.jsx)("button",{onClick:()=>eU(e.id),className:"text-red-600 hover:text-red-800 text-sm font-semibold",title:"Delete document",children:"Delete"})]})]},e.id))})]},s))})]})]})};a()}catch(e){a(e)}})}};

CasperSecurity Mini