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.quebec/public_html/_next/static/chunks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/gositeme/domains/lavocat.quebec/public_html/_next/static/chunks/6862-4946c8ddfa66dcfb.js
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6862],{86862:(e,t,s)=>{s.d(t,{A:()=>e_});var a=s(37876),l=s(14232),r=s(13075),n=s(498),i=s(20710),o=s(3609),c=s(55851),d=s(22885),m=s(65390),x=s(99652),u=s(42341),p=s(33654),h=s(67396),g=s(13796),b=s(70641),y=s(89142),f=s(65805),j=s(72671),v=s(45450),N=s(65104),w=s(12377),A=s(41378),k=s(69976),C=s(59116),S=s(67347),D=s(25037),E=s(47137),R=s(760),I=s(47297),T=s(96153),P=s(71354),L=s(769),M=s(26124),U=s(1774);let F=e=>{let{rating:t,totalRatings:s=0,size:l="sm",showBreakdown:r=!1,breakdown:n}=e,i=null!=t?t:0,o={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"}},c=(e,t)=>{let s=[],l=Math.floor(e);for(let e=0;e<l;e++)s.push((0,a.jsx)(M.A,{className:"".concat(t," fill-yellow-400 text-yellow-400")},e));e%1>=.5&&s.push((0,a.jsx)(U.A,{className:"".concat(t," fill-yellow-400 text-yellow-400")},"half"));let r=5-Math.ceil(e);for(let e=0;e<r;e++)s.push((0,a.jsx)(M.A,{className:"".concat(t," text-gray-300")},"empty-".concat(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:c(i,o[l].star)}),(0,a.jsx)("span",{className:"".concat(o[l].text," font-medium text-gray-700"),children:i.toFixed(1)}),s>0&&(0,a.jsxs)("span",{className:"".concat(o[l].text," text-gray-500"),children:["(",s," review",1!==s?"s":"",")"]})]}),r&&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:[c(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:[c(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:[c(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:[c(n.results||0,"h-3 w-3"),(0,a.jsx)("span",{className:"text-gray-700 ml-1",children:(n.results||0).toFixed(1)})]})]})]})})]})};var B=s(10553),_=s(23042),z=s(67421),O=s(97685),W=s(38500),V=s(34608),G=s(48230),J=s.n(G);function q(e){let{children:t}=e,{data:s,status:l}=(0,B.useSession)();return"loading"===l?(0,a.jsx)("div",{children:"Chargement..."}):s?(0,a.jsx)(a.Fragment,{children:t}):(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)(J(),{href:"/auth/login",children:(0,a.jsx)("button",{className:"btn btn-primary",children:"Se connecter"})})]})}var H=s(74817),K=s(82457),Y=s(63670),$=s(75790),X=s(2977),Q=s(72702),Z=s(9506),ee=s(24815),et=s(46691),es=s(13790),ea=s(33252),el=s(89035),er=s(57624),en=s(55240),ei=s(61174),eo=s(11022),ec=s(7306),ed=s(92076),em=s(46936),ex=s(26712),eu=s(97272),ep=s(74332),eh=s(22461),eg=s(68383),eb=s(6365),ey=s(64323),ef=s(25135);let ej=e=>{var t;let{caseId:s,initialComments:r=[],onCommentAdded:n,mode:i="public",allowAttachments:o=!0,allowReactions:c=!0,allowReplies:d=!0,maxRepliesDepth:m=3,apiEndpoint:x}=e,{data:u}=(0,B.useSession)(),[p,h]=(0,l.useState)(r),[g,b]=(0,l.useState)(!1),[y,f]=(0,l.useState)(!1),[j,v]=(0,l.useState)(""),[N,w]=(0,l.useState)(null),[A,k]=(0,l.useState)({}),[C,S]=(0,l.useState)(null),[D,E]=(0,l.useState)(""),[R,I]=(0,l.useState)(new Set),[T,P]=(0,l.useState)(new Set),[L,M]=(0,l.useState)("newest"),[U,F]=(0,l.useState)("all"),[G,ej]=(0,l.useState)(""),[ev,eN]=(0,l.useState)(!1),[ew,eA]=(0,l.useState)([]),[ek,eC]=(0,l.useState)(!1),[eS,eD]=(0,l.useState)(1),[eE,eR]=(0,l.useState)(!0),[eI,eT]=(0,l.useState)(!1),[eP,eL]=(0,l.useState)(null),[eM,eU]=(0,l.useState)(!1),eF=(0,l.useRef)(null),eB=(0,l.useRef)(null),e_=(0,l.useRef)({}),ez=()=>x||"/api/live-cases/".concat(s,"/comments"),eO=e=>{var t,s,a,l,r,n,i,o;return{...e,reactions:null!=(n=e.reactions)?n:[],attachments:null!=(i=e.attachments)?i:[],replies:(null!=(o=e.replies)?o:[]).map(e=>{var t,s,a,l,r,n,i;return{...e,reactions:null!=(n=e.reactions)?n:[],attachments:null!=(i=e.attachments)?i:[],_count:{replies:(null==(t=e._count)?void 0:t.replies)||(null==(s=e.replies)?void 0:s.length)||0,likedBy:(null==(a=e._count)?void 0:a.likedBy)||0,reactions:(null==(l=e._count)?void 0:l.reactions)||(null==(r=e.reactions)?void 0:r.length)||0}}}),_count:{replies:(null==(t=e._count)?void 0:t.replies)||(null==(s=e.replies)?void 0:s.length)||0,likedBy:(null==(a=e._count)?void 0:a.likedBy)||0,reactions:(null==(l=e._count)?void 0:l.reactions)||(null==(r=e.reactions)?void 0:r.length)||0}}};(0,l.useEffect)(()=>{eW(!0)},[s,L,U,G]);let eW=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&(eD(1),h([]),eR(!0)),b(!0);let t=new URLSearchParams({page:e?"1":String(eS),limit:String(20),sortBy:L,filterBy:U,search:G}),s=await fetch("".concat(ez(),"?").concat(t));if(s.ok){let t=(await s.json()).comments.map(eO);e?h(e=>e2([...t,...e])):h(e=>e2([...t,...e])),eR(20===t.length)}else console.error("Failed to fetch comments:",s.status),e&&h([])}catch(t){console.error("Error fetching comments:",t),e&&h([])}finally{b(!1),eT(!1)}},eV=async()=>{if(j.trim()&&!ek){eC(!0);try{let e;if(ew.length>0){let t=new FormData;t.append("content",j),ew.forEach(e=>{e.file&&t.append("attachments",e.file)}),e=await fetch(ez(),{method:"POST",body:t})}else e=await fetch(ez(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:j})});if(!e.ok)throw Error("Failed to post comment");let t=await e.json();h(e=>e2([eO(t.comment),...e])),v(""),ew.forEach(e=>{e.url&&e.url.startsWith("blob:")&&URL.revokeObjectURL(e.url)}),eA([]),n&&n(),eW(),O.oR.success("Comment posted!")}catch(e){O.oR.error("Failed to post comment")}finally{eC(!1)}}};(0,l.useCallback)(async e=>{if(!u)return void O.oR.error("Please login to reply");if(!A[e]||!A[e].trim())return void O.oR.error("Please enter a reply");try{let t=await fetch(ez(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:A[e].trim(),parentId:e})});if(t.ok){let s=await t.json();h(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,eO(s.comment))),k(t=>({...t,[e]:""})),w(null),O.oR.success("Reply added successfully! \uD83D\uDCAC")}else O.oR.error("Failed to add reply")}catch(e){console.error("Error adding reply:",e),O.oR.error("Error adding reply")}},[u,A,s]);let eG=(e,t)=>{var s;let a=null==u||null==(s=u.user)?void 0:s.id;return(e.reactions||[]).some(e=>e.reactionType===t&&e.user.id===a)},eJ=(e,t)=>(e.reactions||[]).filter(e=>e.reactionType===t).length,eq=(0,l.useCallback)(async(e,t)=>{if(!u)return void O.oR.error("Please login to react to comments");let s=u.user.id,a=!0;h(l=>l.map(l=>{let r;if(l.id!==e)return l;let n=l.reactions||[];return n.some(e=>e.reactionType===t&&e.user.id===s)?(r=n.filter(e=>e.reactionType!==t||e.user.id!==s),a=!1):r=[...n,{id:"temp-".concat(Date.now()),reactionType:t,user:{id:s,name:u.user.name||""}}],{...l,reactions:r}}));try{if(!(await fetch("".concat(ez(),"/").concat(e,"/reactions"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reactionType:t})})).ok)throw Error("Failed to update reaction")}catch(l){h(l=>l.map(l=>{if(l.id!==e)return l;let r=l.reactions||[];return a?{...l,reactions:r.filter(e=>e.reactionType!==t||e.user.id!==s)}:{...l,reactions:[...r,{id:"temp-".concat(Date.now()),reactionType:t,user:{id:s,name:u.user.name||""}}]}})),O.oR.error("Failed to update reaction")}},[u,ez,h]),eH=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){O.oR.error("".concat(e.name," is too large. Maximum size is 5MB."));continue}if(!s.includes(e.type)){O.oR.error("".concat(e.name," is not a supported file type."));continue}eA(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}]),O.oR.success("".concat(e.name," added!"))}},eK=e=>{eA(t=>{var s;let a=t.filter((t,s)=>s!==e);return(null==(s=t[e])?void 0:s.url)&&t[e].url.startsWith("blob:")&&URL.revokeObjectURL(t[e].url),a})},eY=[...p.filter(e=>"all"===U||e.user.role.toUpperCase()===U.toUpperCase())].sort((e,t)=>{switch(L){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()}}),e$=e=>{var t,s,l,r,n,i,o,c,d,m,x;let{comment:p,depth:h,onReply:g,onEdit:b,onDelete:y,onReact:f,isReplying:j,isEditing:v,parentId:A}=e,R={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"},I=p.user.profilePicture?(0,a.jsx)("img",{src:p.user.profilePicture,alt:p.user.name,className:"h-10 w-10 rounded-full object-cover border-2 border-white shadow"}):(0,a.jsx)("div",{className:"h-10 w-10 rounded-full flex items-center justify-center font-bold text-lg ".concat(R[p.user.role]||"bg-gray-200 text-gray-800"),children:(null==(t=p.user.name)?void 0:t[0])||"?"});return(0,a.jsxs)("div",{className:"relative group bg-white rounded-xl shadow-md p-4 mb-4 ".concat(h>0?"ml-8 border-l-4 border-blue-100":""),tabIndex:0,"aria-label":"Comment by ".concat(p.user.name),children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[I,(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"font-semibold text-gray-900",children:p.user.name}),(0,a.jsx)("span",{className:"text-xs px-2 py-1 rounded-full ml-1 ".concat(R[p.user.role]||"bg-gray-200 text-gray-800"),children:p.user.role}),p.user.isVerified&&(0,a.jsx)(H.A,{className:"h-4 w-4 text-blue-500 ml-1"}),(0,a.jsx)("span",{className:"text-xs text-gray-500 ml-2",children:(0,W.m)(new Date(p.createdAt),{addSuffix:!0})}),p.isEdited&&(0,a.jsx)("span",{className:"text-xs text-gray-400 ml-1",children:"(edited)"}),p.isPinned&&(0,a.jsx)(K.A,{className:"h-4 w-4 text-yellow-400 ml-1"})]}),v?(0,a.jsx)("div",{className:"mt-3 p-4 bg-gray-50 rounded-lg border border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.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:(null==u||null==(s=u.user)?void 0:s.image)?(0,a.jsx)("img",{src:u.user.image,alt:u.user.name||"User",className:"w-8 h-8 rounded-full object-cover"}):(0,a.jsx)(Y.A,{className:"h-4 w-4"})})}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.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:D,onChange:e=>E(e.target.value),"aria-label":"Edit comment input",placeholder:"Edit your comment..."}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.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(D.trim()){eC(!0);try{if(!(await fetch("".concat(ez(),"/").concat(p.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:D,attachments:p.attachments})})).ok)throw Error("Failed to edit comment");S(null),E(""),await eW(),O.oR.success("Comment updated!")}catch(e){O.oR.error("Failed to update comment")}finally{eC(!1)}}},disabled:ek||!D.trim(),"aria-label":"Save edited comment",children:ek?"Saving...":"Save Changes"}),(0,a.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:()=>{S(null),E("")},disabled:ek,"aria-label":"Cancel editing",children:"Cancel"})]})]})]})}):(0,a.jsx)("div",{className:"prose prose-sm max-w-none text-gray-800 mb-2",dangerouslySetInnerHTML:{__html:V.default.sanitize(p.content)}}),p.attachments&&p.attachments.length>0&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 mb-2",children:[(0,a.jsxs)("div",{className:"w-full text-xs text-gray-500 mb-1",children:["\uD83D\uDCCE Attachments (",p.attachments.length,"):"]}),p.attachments.map(e=>{let t=e.type.startsWith("image/"),s="application/pdf"===e.type,l="application/vnd.openxmlformats-officedocument.wordprocessingml.document"===e.type||"application/msword"===e.type;return(0,a.jsx)("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded-lg border",children:t?(0,a.jsxs)("div",{className:"flex flex-col items-center",children:[(0,a.jsxs)("div",{className:"relative cursor-pointer group",onClick:()=>{eL({url:e.url,name:e.name}),eU(!0)},children:[(0,a.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,a.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,a.jsx)($.A,{className:"h-6 w-6 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200"})})]}),(0,a.jsx)("span",{className:"text-xs text-gray-600 mt-1",children:e.name})]}):s?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{width:"32",height:"32",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("rect",{width:"24",height:"24",rx:"4",fill:"#E53E3E"}),(0,a.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"#fff",fontSize:"12",fontWeight:"bold",children:"PDF"})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]})]})]}):l?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("svg",{width:"32",height:"32",fill:"none",viewBox:"0 0 24 24",children:[(0,a.jsx)("rect",{width:"24",height:"24",rx:"4",fill:"#3182CE"}),(0,a.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fill:"#fff",fontSize:"12",fontWeight:"bold",children:"DOC"})]}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]})]})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(X.A,{className:"h-6 w-6 text-gray-500"}),(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]})]})]})},e.id)})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500 mt-1",children:[e4.slice(0,3).map(e=>{let t=eJ(p,e.type),s=(p.reactions||[]).filter(t=>t.reactionType===e.type).map(e=>e.user);return(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginRight:8},children:[(0,a.jsx)("button",{type:"button","aria-label":e.label,onClick:()=>f(p.id,e.type),className:"focus:outline-none transition-colors ".concat(eG(p,e.type)?"font-bold":""),style:{textDecoration:"none"},children:(0,a.jsx)("span",{style:{fontSize:22,filter:eG(p,e.type)?"drop-shadow(0 0 2px "+e.color+")":"none"},children:e.emoji})}),t>0&&(0,a.jsx)(e5,{users:s})]},e.type)}),e6.slice(0,2).map(e=>{let t=e.icon,s=eJ(p,e.type),l=(p.reactions||[]).filter(t=>t.reactionType===e.type).map(e=>e.user);return t?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,marginRight:8},children:[(0,a.jsx)("button",{type:"button","aria-label":e.label,onClick:()=>f(p.id,e.type),className:"focus:outline-none transition-colors ".concat(eG(p,e.type)?"font-bold":""),style:{textDecoration:"none"},children:(0,a.jsx)(t,{size:22,color:e.color,weight:eG(p,e.type)?"fill":"regular"})}),s>0&&(0,a.jsx)(e5,{users:l})]},e.type):null}),(0,a.jsx)(e3,{onReact:f,comment:p})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-3 pt-2 border-t border-gray-100",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>g(p.id),className:"flex items-center gap-1 text-xs text-gray-500 hover:text-blue-600 transition-colors",disabled:j,children:[(0,a.jsx)(Q.A,{className:"h-3 w-3"}),"Reply"]}),((null==u||null==(l=u.user)?void 0:l.id)===p.user.id||(null==u||null==(r=u.user)?void 0:r.role)==="ADMIN"||(null==u||null==(n=u.user)?void 0:n.role)==="SUPERADMIN")&&(0,a.jsxs)("button",{type:"button",onClick:()=>b(p.id),className:"flex items-center gap-1 text-xs text-gray-500 hover:text-blue-600 transition-colors",disabled:v,children:[(0,a.jsx)(Z.A,{className:"h-3 w-3"}),"Edit"]}),((null==u||null==(i=u.user)?void 0:i.id)===p.user.id||(null==u||null==(o=u.user)?void 0:o.role)==="ADMIN"||(null==u||null==(c=u.user)?void 0:c.role)==="SUPERADMIN")&&(0,a.jsxs)("button",{type:"button",onClick:()=>{confirm("Are you sure you want to delete this comment?")&&y(p.id)},className:"flex items-center gap-1 text-xs text-gray-500 hover:text-red-600 transition-colors",children:[(0,a.jsx)(ee.A,{className:"h-3 w-3"}),"Delete"]}),(null==u||null==(d=u.user)?void 0:d.id)!==p.user.id&&(0,a.jsxs)("button",{type:"button",onClick:()=>e0(p.id),className:"flex items-center gap-1 text-xs text-gray-500 hover:text-orange-600 transition-colors",children:[(0,a.jsx)(et.A,{className:"h-3 w-3"}),"Report"]})]}),j&&!p.isDeleted&&(0,a.jsx)("div",{className:"mt-3 p-4 bg-gray-50 rounded-lg border border-gray-200",children:(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.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:(null==u||null==(m=u.user)?void 0:m.image)?(0,a.jsx)("img",{src:u.user.image,alt:u.user.name||"User",className:"w-8 h-8 rounded-full object-cover"}):(0,a.jsx)(Y.A,{className:"h-4 w-4"})})}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsx)("input",{type:"text",ref:e=>{e_.current[p.id]=e},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,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.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 e=e_.current[p.id],t=(null==e?void 0:e.value)||"";if(t.trim()){eC(!0);try{if(!(await fetch(ez(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t.trim(),parentId:p.id})})).ok)throw Error("Failed to post reply");e&&(e.value=""),w(null),await eW(),O.oR.success("Reply posted!")}catch(e){O.oR.error("Failed to post reply")}finally{eC(!1)}}},disabled:ek,"aria-label":"Post reply",children:ek?"Posting...":"Post Reply"}),(0,a.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:()=>{w(null),k(e=>({...e,[p.id]:""}))},disabled:ek,"aria-label":"Cancel reply",children:"Cancel"})]})]})]})})]})]}),Array.isArray(p.replies)&&p.replies.length>0&&(0,a.jsx)("div",{className:"mt-4 space-y-3",children:null==(x=p.replies)?void 0:x.map(e=>(0,a.jsx)(e$,{comment:e,depth:h+1,onReply:e=>{w(e),k({[e]:""})},onEdit:t=>{S(t),E(e.content)},onDelete:t=>{confirm("Are you sure you want to delete this reply?")&&eZ(p.id,e.id)},onReact:(e,t)=>eq(e,t),isReplying:N===e.id,isEditing:C===e.id,parentId:p.id},e.id))})]})};function eX(e,t){return e.filter(e=>e.id!==t).map(e=>({...e,replies:eX(e.replies,t)}))}(0,l.useEffect)(()=>{eS>1&&eW()},[eS]);let eQ=async e=>{eC(!0);try{if(!(await fetch("".concat(ez(),"?commentId=").concat(e),{method:"DELETE"})).ok)throw Error("Failed to delete comment");h(t=>eX(t,e)),O.oR.success("Comment deleted!"),eW()}catch(e){O.oR.error("Failed to delete comment")}finally{eC(!1)}},eZ=async(e,t)=>{eC(!0);try{if(!(await fetch("".concat(ez(),"?commentId=").concat(t),{method:"DELETE"})).ok)throw Error("Failed to delete reply");h(e=>eX(e,t)),O.oR.success("Reply deleted!"),eW()}catch(e){O.oR.error("Failed to delete reply")}finally{eC(!1)}},e0=async e=>{if(!u)return void O.oR.error("Please login to report comments");try{var t;(await fetch("".concat(ez(),"/").concat(e,"/report"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:null==(t=u.user)?void 0:t.id})})).ok?(O.oR.success("Comment reported!"),eW()):O.oR.error("Failed to report comment")}catch(e){console.error("Error reporting comment:",e),O.oR.error("Error reporting comment")}};function e2(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 e1=[{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:es.A,color:"#14b8a6",label:"Justice"},{type:"gavel",icon:ef.A,color:"#6b7280",label:"Gavel"},{type:"shield",icon:ea.A,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:el.A,color:"#eab308",label:"Victory"},{type:"handshake",icon:er.A,color:"#2563eb",label:"Agreement"},{type:"money",icon:en.A,color:"#22c55e",label:"Money"},{type:"shield-check",icon:ei.A,color:"#22c55e",label:"Verified"},{type:"medal",icon:eo.A,color:"#eab308",label:"Achievement"},{type:"crown",icon:ec.A,color:"#facc15",label:"Authority"},{type:"sword",icon:ed.A,color:"#dc2626",label:"Justice"},{type:"target",icon:em.A,color:"#ef4444",label:"Target"},{type:"check",icon:H.A,color:"#22c55e",label:"Approved"},{type:"document",icon:ex.A,color:"#3b82f6",label:"Document"},{type:"scroll",icon:eu.A,color:"#8b5cf6",label:"Legal"},{type:"court",icon:ep.A,color:"#6b7280",label:"Court"},{type:"graduation",icon:eh.A,color:"#2563eb",label:"Expert"}],e4=e1.filter(e=>e.emoji),e6=e1.filter(e=>e.icon),e5=e=>{let{users:t}=e,[s,r]=l.useState(!1),n=l.useRef(null),i=()=>{n.current&&(clearTimeout(n.current),n.current=null),r(!0)},o=()=>{n.current=setTimeout(()=>{r(!1)},300)};return l.useEffect(()=>()=>{n.current&&clearTimeout(n.current)},[]),(0,a.jsxs)("span",{style:{position:"relative",display:"inline-block"},children:[(0,a.jsxs)("span",{style:{cursor:"pointer",textDecoration:"underline",color:"#2563eb",padding:"2px 4px",borderRadius:"4px",transition:"background-color 0.2s ease"},onClick:()=>r(e=>!e),onMouseEnter:i,onMouseLeave:o,onMouseOver:e=>{e.currentTarget.style.backgroundColor="#f0f9ff"},onMouseOut:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[t.length," \uD83D\uDC65"]}),s&&(0,a.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:i,onMouseLeave:o,children:t.map(e=>(0,a.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,a.jsx)("img",{src:e.profilePicture,alt:e.name,style:{width:24,height:24,borderRadius:"50%",marginRight:10}}),(0,a.jsx)(J(),{href:e.username?"/profile/".concat(e.username):"/profiles/".concat(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/".concat(e.username):"/profiles/".concat(e.id)},50)},children:e.name})]},e.id))})]})},e3=e=>{let{onReact:t,comment:s}=e,[r,n]=l.useState(!1),[i,o]=l.useState("bottom"),c=l.useRef(null),d=l.useRef(null);return l.useEffect(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&c.current&&!c.current.contains(e.target)&&n(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,a.jsxs)("span",{style:{position:"relative",display:"inline-block"},children:[(0,a.jsxs)("button",{ref:c,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(!r&&c.current){let e=c.current.getBoundingClientRect(),t=window.innerHeight-e.bottom,s=e.top;o(t<300&&s>t?"top":"bottom")}n(e=>!e)},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f3f4f6"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},children:[(0,a.jsx)("span",{style:{fontSize:18,marginRight:2},children:"+"}),(0,a.jsx)("span",{role:"img","aria-label":"Add Reaction",children:"\uD83D\uDE42"})]}),r&&(0,a.jsxs)("div",{ref:d,style:{position:"absolute",["bottom"===i?"top":"bottom"]:"100%",left:"bottom"===i?0:"auto",right:"top"===i?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"===i),marginBottom:4*("top"===i),display:"flex",flexDirection:"column",gap:8},children:[(0,a.jsx)("div",{style:{marginBottom:8,borderBottom:"1px solid #eee",paddingBottom:4,fontWeight:600,color:"#888",fontSize:"14px"},children:"\uD83D\uDE0A Fun Reactions"}),(0,a.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:6,marginBottom:12},children:e1.filter(e=>e.emoji).map(e=>(0,a.jsxs)("button",{type:"button",style:{background:eG(s,e.type)?e.color:"white",color:eG(s,e.type)?"white":"#374151",border:"1px solid #e5e7eb",borderRadius:8,padding:"8px 6px",cursor:"pointer",fontWeight:eG(s,e.type)?700:400,fontSize:20,minHeight:"40px",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",flexDirection:"column",gap:2},onClick:()=>{t(s.id,e.type),n(!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":e.label,children:[(0,a.jsx)("span",{style:{filter:eG(s,e.type)?"drop-shadow(0 0 2px "+e.color+")":"none",fontSize:"18px"},children:e.emoji}),(0,a.jsx)("span",{style:{fontSize:"10px",fontWeight:500,color:eG(s,e.type)?"white":"#6b7280"},children:e.label})]},e.type))}),(0,a.jsx)("div",{style:{marginBottom:8,borderBottom:"1px solid #eee",paddingBottom:4,fontWeight:600,color:"#888",fontSize:"14px"},children:"⚖️ Justice & Law"}),(0,a.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:6},children:e1.filter(e=>e.icon).map(e=>{let l=e.icon;return l?(0,a.jsxs)("button",{type:"button",style:{background:eG(s,e.type)?e.color:"white",color:eG(s,e.type)?"white":"#374151",border:"1px solid #e5e7eb",borderRadius:8,padding:"8px 6px",cursor:"pointer",fontWeight:eG(s,e.type)?700:400,display:"flex",alignItems:"center",justifyContent:"center",gap:4,minHeight:"40px",transition:"all 0.2s ease",flexDirection:"column"},onClick:()=>{t(s.id,e.type),n(!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":e.label,children:[(0,a.jsx)(l,{size:16,color:eG(s,e.type)?"white":e.color,weight:eG(s,e.type)?"fill":"regular"}),(0,a.jsx)("span",{style:{fontSize:"10px",fontWeight:500,color:eG(s,e.type)?"white":"#6b7280"},children:e.label})]},e.type):null})})]})]})},e8=l.memo(e$);return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-gray-900 flex items-center gap-2",children:[(0,a.jsx)(eg.A,{className:"h-5 w-5 text-blue-600"}),"Comments & Discussion"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:[(0,a.jsx)(Y.A,{className:"h-4 w-4"}),p.length," comments"]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2",children:(0,a.jsxs)("button",{type:"button",onClick:()=>eN(!ev),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,a.jsx)($.A,{className:"h-4 w-4"}),"Filters"]})})]}),(0,a.jsx)(_.N,{children:ev&&(0,a.jsx)(z.P.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,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Sort by"}),(0,a.jsxs)("select",{value:L,onChange:e=>M(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,a.jsx)("option",{value:"newest",children:"Newest first"}),(0,a.jsx)("option",{value:"oldest",children:"Oldest first"}),(0,a.jsx)("option",{value:"mostLiked",children:"Most liked"}),(0,a.jsx)("option",{value:"mostReplies",children:"Most replies"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Filter by"}),(0,a.jsxs)("select",{value:U,onChange:e=>F(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,a.jsx)("option",{value:"all",children:"All users"}),(0,a.jsx)("option",{value:"lawyers",children:"Lawyers only"}),(0,a.jsx)("option",{value:"clients",children:"Clients only"}),(0,a.jsx)("option",{value:"admins",children:"Admins only"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Search"}),(0,a.jsx)("input",{type:"text",value:G,onChange:e=>ej(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,a.jsx)(q,{children:(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-gray-200 p-6",children:[(0,a.jsxs)("h3",{className:"text-lg font-semibold text-gray-900 mb-4 flex items-center gap-2",children:[(0,a.jsx)(Q.A,{className:"h-5 w-5 text-blue-600"}),"Join the Discussion"]}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.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:(null==u||null==(t=u.user)?void 0:t.image)?(0,a.jsx)("img",{src:u.user.image,alt:u.user.name||"User",className:"w-10 h-10 rounded-full object-cover"}):(0,a.jsx)(Y.A,{className:"h-5 w-5"})})}),(0,a.jsxs)("div",{className:"flex-1 space-y-3",children:[(0,a.jsx)("form",{onSubmit:e=>e.preventDefault(),role:"form","aria-label":"Add a comment",children:(0,a.jsx)("textarea",{ref:eF,value:j,onChange:e=>v(e.target.value),onKeyDown:e=>{"Enter"===e.key&&e.ctrlKey&&(e.preventDefault(),eV())},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"})}),o&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("input",{ref:eB,type:"file",multiple:!0,onChange:eH,className:"hidden",accept:"image/*,.pdf,.txt"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{var e;return null==(e=eB.current)?void 0:e.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,a.jsx)(X.A,{className:"h-4 w-4"}),"Attach files"]}),(0,a.jsx)("span",{className:"text-xs text-gray-500",children:"Max 5MB per file"})]}),ew.length>0&&(0,a.jsx)("div",{className:"space-y-2",children:ew.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-gray-50 rounded-lg",children:[(0,a.jsx)(X.A,{className:"h-4 w-4 text-gray-500"}),(0,a.jsx)("span",{className:"text-sm text-gray-700 flex-1",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:["(",(e.size/1024/1024).toFixed(2)," MB)"]}),(0,a.jsx)("button",{type:"button",onClick:()=>eK(t),className:"text-red-500 hover:text-red-700",children:(0,a.jsx)(eb.A,{className:"h-4 w-4"})})]},t))})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsxs)("span",{className:"text-sm text-gray-500",children:[j.length,"/1000 characters"]}),(0,a.jsx)("button",{type:"button",onClick:eV,disabled:!j.trim()||ek,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:ek?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),"Posting..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ey.A,{className:"h-4 w-4"}),"Post Comment"]})})]})]})]})]})}),(0,a.jsx)("div",{className:"space-y-4",children:g?(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600 mx-auto"}),(0,a.jsx)("p",{className:"text-gray-500 mt-2",children:"Loading comments..."})]}):0===eY.length?(0,a.jsxs)("div",{className:"text-center py-12 bg-gray-50 rounded-lg",children:[(0,a.jsx)(Q.A,{className:"h-12 w-12 text-gray-400 mx-auto mb-3"}),(0,a.jsx)("p",{className:"text-gray-500",children:"No comments yet. Be the first to share your thoughts!"})]}):(0,a.jsxs)("div",{className:"space-y-4",children:[eY.map(e=>(0,a.jsx)(e8,{comment:e,depth:0,onReply:e=>{w(e),k({[e]:""})},onEdit:t=>{S(t),E(e.content)},onDelete:e=>{confirm("Are you sure you want to delete this comment?")&&eQ(e)},onReact:eq,isReplying:N===e.id,isEditing:C===e.id},e.id)),eE&&!g&&(0,a.jsx)("div",{className:"text-center mt-4",children:(0,a.jsx)("button",{type:"button",className:"px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",onClick:()=>{eT(!0),eD(e=>e+1)},disabled:eI,children:eI?"Loading...":"Load More"})})]})})]})};var ev=s(22467),eN=s(30822),ew=s(96108);let eA=(e,t)=>{let s="h-6 w-6";switch(e){case"milestone":return"completed"===t?(0,a.jsx)(n.A,{className:"".concat(s," text-green-500")}):(0,a.jsx)(p.A,{className:"".concat(s," text-blue-500")});case"update":return(0,a.jsx)(D.A,{className:"".concat(s," text-purple-500")});case"deadline":return"overdue"===t?(0,a.jsx)(c.A,{className:"".concat(s," text-red-500")}):(0,a.jsx)(i.A,{className:"".concat(s," text-orange-500")});case"achievement":return(0,a.jsx)(T.A,{className:"".concat(s," text-yellow-500")});case"warning":return(0,a.jsx)(c.A,{className:"".concat(s," text-red-500")});default:return(0,a.jsx)(m.A,{className:"".concat(s," text-gray-500")})}},ek=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"}},eC=e=>{switch(e){case"completed":return"Completed";case"pending":return"In Progress";case"upcoming":return"Upcoming";case"overdue":return"Overdue";default:return"Unknown"}},eS=e=>{let{caseData:t,className:s=""}=e,[o,c]=(0,l.useState)(new Set),[d,u]=(0,l.useState)("all"),p=e=>{if(!e)return null;let t=new Date(e);return isNaN(t.getTime())?null:t},g=(()=>{var e,s,a,l,r;let n=[];if(!t)return n;if(t.createdAt&&n.push({id:"case-created",title:"Case Created",description:'Case "'.concat(t.title||"Untitled Case",'" was created and made public'),date:t.createdAt,type:"milestone",status:"completed",metadata:{participants:[(null==(a=t.creator)?void 0:a.name)||"Unknown"]}}),t.applicationDeadline){let e=p(t.applicationDeadline);if(e){let s=new Date;n.push({id:"application-deadline",title:"Application Deadline",description:"Last day to submit applications for this case",date:t.applicationDeadline,type:"deadline",status:e<s?"overdue":"upcoming",metadata:{participants:["All Applicants"]}})}}if(t.filingDate){let e=p(t.filingDate);if(e){let s=new Date;n.push({id:"case-filed",title:"Case Filed",description:"Legal case was officially filed with the court",date:t.filingDate,type:"milestone",status:e<s?"completed":"upcoming",metadata:{location:t.court||"Court",participants:[(null==(l=t.leadLawyer)?void 0:l.name)||"Lead Lawyer"]}})}}if(t.caseUpdates&&Array.isArray(t.caseUpdates)&&t.caseUpdates.forEach((e,t)=>{if(e&&e.id&&e.createdAt){var s;n.push({id:"update-".concat(e.id),title:e.title||"Case Update",description:e.description,date:e.createdAt,type:"update",status:"completed",metadata:{participants:[(null==(s=e.author)?void 0:s.name)||"Unknown"]}})}}),t.expectedDuration&&t.createdAt){let e=p(t.createdAt);if(e&&"number"==typeof t.expectedDuration){let s=new Date(e.getTime()+24*t.expectedDuration*36e5),a=s<new Date?"overdue":"upcoming";n.push({id:"expected-completion",title:"Expected Completion",description:"Estimated completion date based on ".concat(t.expectedDuration," days duration"),date:s.toISOString(),type:"milestone",status:a,metadata:{participants:[(null==(r=t.leadLawyer)?void 0:r.name)||"Lead Lawyer"]}})}}return(null==(e=t._count)?void 0:e.registrations)&&t._count.registrations>=5&&n.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"]}}),(null==(s=t._count)?void 0:s.supporters)&&t._count.supporters>=10&&n.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"]}}),n.sort((e,t)=>{let s=p(e.date),a=p(t.date);return s&&a?s.getTime()-a.getTime():0})})(),b="all"===d?g:g.filter(e=>e.type===d),y=e=>{let t=new Set(o);t.has(e)?t.delete(e):t.add(e),c(t)},f=()=>0===g.length?0:Math.round(g.filter(e=>"completed"===e.status).length/g.length*100),j=e=>{let t=p(e);if(!t)return"Invalid Date";try{return(0,r.GP)(t,"MMM d, yyyy")}catch(e){return"Invalid Date"}},v=e=>{let t=p(e);if(!t)return"Invalid Date";try{return(0,r.GP)(t,"PPP")}catch(e){return"Invalid Date"}},N=e=>{let t=p(e);if(!t)return"Invalid Time";try{return(0,r.GP)(t,"p")}catch(e){return"Invalid Time"}};return(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8 ".concat(s),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)(ev.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:[f(),"%"]})]}),(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:"".concat(f(),"%")}})}),(0,a.jsxs)("div",{className:"flex justify-between text-xs text-gray-500 mt-2",children:[(0,a.jsxs)("span",{children:[g.filter(e=>"completed"===e.status).length," completed"]}),(0,a.jsxs)("span",{children:[g.filter(e=>"pending"===e.status).length," in progress"]}),(0,a.jsxs)("span",{children:[g.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:g.length},{key:"milestone",label:"Milestones",count:g.filter(e=>"milestone"===e.type).length},{key:"update",label:"Updates",count:g.filter(e=>"update"===e.type).length},{key:"deadline",label:"Deadlines",count:g.filter(e=>"deadline"===e.type).length},{key:"achievement",label:"Achievements",count:g.filter(e=>"achievement"===e.type).length}].map(e=>(0,a.jsxs)("button",{onClick:()=>u(e.key),className:"px-4 py-2 rounded-lg text-sm font-medium transition-colors ".concat(d===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:b.map((e,t)=>{let s=o.has(e.id);return b.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 ".concat("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)(n.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 ".concat(ek(e.status)," ").concat(s?"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:eA(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 ".concat("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:eC(e.status)})]}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-2",children:j(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)(h.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)(x.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)(C.A,{className:"h-4 w-4"}),(0,a.jsxs)("span",{children:["$",e.metadata.amount.toLocaleString()]})]})]})]})]}),(0,a.jsx)("button",{onClick:()=>y(e.id),className:"flex-shrink-0 p-1 hover:bg-gray-100 rounded transition-colors",children:s?(0,a.jsx)(eN.A,{className:"h-4 w-4 text-gray-500"}):(0,a.jsx)(ew.A,{className:"h-4 w-4 text-gray-500"})})]}),s&&(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:v(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:N(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)(m.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===b.length&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(i.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."})]})]})};var eD=s(92891),eE=s(96829),eR=s(71449),eI=s(70672),eT=s(70026),eP=s(64545);let eL=e=>{var t;let{caseId:s,caseTitle:n,caseOwner:i,className:o=""}=e,{data:c}=(0,B.useSession)(),{ws:d,connected:m,joinCaseChat:x,leaveCaseChat:u,sendCaseTyping:p,userPresence:g,typingUsers:b}=(0,eP.h)(),[y,f]=(0,l.useState)(!1),[v,N]=(0,l.useState)(!1),[w,A]=(0,l.useState)([]),[k,C]=(0,l.useState)(""),[S,E]=(0,l.useState)(!1),[R,T]=(0,l.useState)("public"),[P,L]=(0,l.useState)(!1),[M,U]=(0,l.useState)(!1),[F,O]=(0,l.useState)(!1),[W,V]=(0,l.useState)(null),G=(0,l.useRef)(null),J=(0,l.useRef)(null);(0,l.useRef)(null),(0,l.useEffect)(()=>(m&&s&&(x(s),A(e=>[{id:"system-".concat(Date.now()),content:'Welcome to the live chat for "'.concat(n,'"! \uD83D\uDC4B'),senderId:"system",senderName:"System",senderRole:"system",timestamp:Date.now(),type:"system",isPublic:!0}])),()=>{m&&s&&u(s)}),[m,s,n,x,u]),(0,l.useEffect)(()=>{if(!d)return;let e=e=>{try{let a=JSON.parse(e.data);switch(a.type){case"CASE_MESSAGE":if(a.data.caseId===s){var t;A(e=>[...e,{id:a.data.id,content:a.data.content,senderId:a.data.senderId,senderName:a.data.senderName,senderAvatar:a.data.senderAvatar,senderRole:a.data.senderRole,timestamp:a.data.timestamp,type:"message",isPublic:a.data.isPublic,reactions:a.data.reactions||{}}]),P||a.data.senderId===(null==c||null==(t=c.user)?void 0:t.id)||Y()}break;case"CASE_TYPING":a.data.caseId;break;case"CASE_USER_JOINED":a.data.caseId===s&&A(e=>[...e,{id:"join-".concat(Date.now()),content:"".concat(a.data.userName," joined the chat"),senderId:"system",senderName:"System",senderRole:"system",timestamp:Date.now(),type:"system",isPublic:!0}]);break;case"CASE_USER_LEFT":a.data.caseId===s&&A(e=>[...e,{id:"leave-".concat(Date.now()),content:"".concat(a.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 d.addEventListener("message",e),()=>d.removeEventListener("message",e)},[d,s,null==c||null==(t=c.user)?void 0:t.id,P]),(0,l.useEffect)(()=>{G.current&&y&&G.current.scrollIntoView({behavior:"smooth"})},[w,y]);let q=(0,l.useCallback)(e=>{e!=e&&(E(e),p(s,e))},[s,p,S]),H=async()=>{var e;if(!k.trim()||!(null==c||null==(e=c.user)?void 0:e.id))return;let t={caseId:s,content:k.trim(),senderId:c.user.id,senderName:c.user.name||"Anonymous",senderAvatar:c.user.image,senderRole:c.user.role||"USER",timestamp:Date.now(),isPublic:"public"===R};try{null==d||d.send(JSON.stringify({type:"CASE_MESSAGE",data:t})),A(e=>[...e,{id:"temp-".concat(Date.now()),content:k.trim(),senderId:c.user.id,senderName:c.user.name||"Anonymous",senderAvatar:c.user.image||void 0,senderRole:c.user.role||"USER",timestamp:Date.now(),type:"message",isPublic:"public"===R}]),C(""),q(!1)}catch(e){console.error("Error sending message:",e),V("Failed to send message")}},K=e=>{C({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)},Y=()=>{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)},$=()=>(b.get("case_".concat(s))||[]).filter(e=>{var t;return e.userId!==(null==c||null==(t=c.user)?void 0:t.id)});return c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(_.N,{children:!y&&(0,a.jsx)(z.P.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},onClick:()=>f(!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 ".concat(o),children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(D.A,{className:"w-6 h-6"}),w.length>1&&(0,a.jsx)(z.P.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:w.length-1})]})})}),(0,a.jsx)(_.N,{children:y&&(0,a.jsxs)(z.P.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 ".concat(o),children:[(0,a.jsxs)("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-white/20 rounded-full flex items-center justify-center",children:(0,a.jsx)(D.A,{className:"w-4 h-4"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-semibold text-sm",children:"Live Chat"}),(0,a.jsx)("p",{className:"text-xs text-blue-100",children:n})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>L(!P),className:"p-1 hover:bg-white/20 rounded transition-colors",children:P?(0,a.jsx)(eD.A,{className:"w-4 h-4"}):(0,a.jsx)(eE.A,{className:"w-4 h-4"})}),(0,a.jsx)("button",{onClick:()=>U(!M),className:"p-1 hover:bg-white/20 rounded transition-colors",children:(0,a.jsx)(eR.A,{className:"w-4 h-4"})}),(0,a.jsx)("button",{onClick:()=>N(!v),className:"p-1 hover:bg-white/20 rounded transition-colors",children:(0,a.jsx)(eI.A,{className:"w-4 h-4"})})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2 text-xs text-blue-100",children:[(0,a.jsx)(h.A,{className:"w-3 h-3"}),(0,a.jsxs)("span",{children:[Array.from(g.values()).filter(e=>"online"===e.status).length," online"]}),m&&(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-green-400 rounded-full animate-pulse"}),(0,a.jsx)("span",{children:"Live"})]})]})]}),(0,a.jsx)(_.N,{children:!v&&(0,a.jsxs)(z.P.div,{initial:{height:0},animate:{height:"auto"},exit:{height:0},className:"flex flex-col h-full",children:[(0,a.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[w.map(e=>{var t,s,l,n;return(0,a.jsx)(z.P.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex ".concat(e.senderId===(null==(t=c.user)?void 0:t.id)?"justify-end":"justify-start"),children:(0,a.jsx)("div",{className:"max-w-[80%] ".concat(e.senderId===(null==(s=c.user)?void 0:s.id)?"order-2":"order-1"),children:"system"===e.type?(0,a.jsx)("div",{className:"text-center",children:(0,a.jsx)("span",{className:"inline-block bg-gray-100 text-gray-600 text-xs px-3 py-1 rounded-full",children:e.content})}):(0,a.jsxs)("div",{className:"rounded-2xl px-4 py-2 ".concat(e.senderId===(null==(l=c.user)?void 0:l.id)?"bg-blue-600 text-white":"bg-gray-100 text-gray-800"),children:[e.senderId!==(null==(n=c.user)?void 0:n.id)&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("div",{className:"w-6 h-6 bg-gray-300 rounded-full flex items-center justify-center",children:e.senderAvatar?(0,a.jsx)("img",{src:e.senderAvatar,alt:e.senderName,className:"w-6 h-6 rounded-full object-cover"}):(0,a.jsx)(j.A,{className:"w-3 h-3 text-gray-600"})}),(0,a.jsx)("span",{className:"text-xs font-medium",children:e.senderName}),"LAWYER"===e.senderRole&&(0,a.jsx)(I.A,{className:"w-3 h-3 text-blue-500"})]}),(0,a.jsx)("p",{className:"text-sm",children:e.content}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsx)("span",{className:"text-xs opacity-70",children:(0,r.GP)(e.timestamp,"HH:mm")}),e.isPublic&&(0,a.jsx)("span",{className:"text-xs opacity-70",children:"Public"})]})]})})},e.id)}),$().length>0&&(0,a.jsxs)(z.P.div,{initial:{opacity:0},animate:{opacity:1},className:"flex items-center gap-2 text-gray-500 text-sm",children:[(0,a.jsxs)("div",{className:"flex space-x-1",children:[(0,a.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce"}),(0,a.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),(0,a.jsx)("div",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),(0,a.jsxs)("span",{children:[$().map(e=>e.userName).join(", ")," typing..."]})]}),(0,a.jsx)("div",{ref:G})]}),(0,a.jsx)("div",{className:"px-4 py-2 border-t border-gray-100",children:(0,a.jsx)("div",{className:"flex gap-2 mb-2",children:["interested","question","support","apply"].map(e=>(0,a.jsx)("button",{onClick:()=>K(e),className:"px-3 py-1 text-xs bg-gray-100 hover:bg-gray-200 rounded-full transition-colors capitalize",children:e},e))})}),(0,a.jsxs)("div",{className:"p-4 border-t border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-end gap-2",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)("textarea",{ref:J,value:k,onChange:e=>{C(e.target.value),q(e.target.value.length>0)},onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),H())},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,a.jsx)("button",{onClick:H,disabled:!k.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,a.jsx)(eT.A,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>T("public"),className:"px-3 py-1 text-xs rounded-full transition-colors ".concat("public"===R?"bg-blue-100 text-blue-700":"bg-gray-100 text-gray-600"),children:"Public"}),(0,a.jsx)("button",{onClick:()=>T("private"),className:"px-3 py-1 text-xs rounded-full transition-colors ".concat("private"===R?"bg-purple-100 text-purple-700":"bg-gray-100 text-gray-600"),children:"Private"})]}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:[k.length,"/500"]})]})]})]})})]})})]}):null};var eM=s(99986);let eU=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"}},eF=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"}},eB=e=>{switch(e){case"active":return(0,a.jsx)(n.A,{className:"h-5 w-5 text-green-500"});case"pending":return(0,a.jsx)(i.A,{className:"h-5 w-5 text-yellow-500"});case"closed":return(0,a.jsx)(o.A,{className:"h-5 w-5 text-gray-500"});case"suspended":return(0,a.jsx)(c.A,{className:"h-5 w-5 text-red-500"});default:return(0,a.jsx)(i.A,{className:"h-5 w-5 text-gray-400"})}},e_=e=>{var t,M,U,B,_,z,O,W,V,G,q,H,K,Y,$,X,Q,Z,ee,et,es,ea,el,er,en,ei,eo,ec,ed;let{caseData:em,currentUser:ex,mode:eu,onEdit:ep,onManageTeam:eh,onViewApplications:eg}=e,[eb,ey]=l.useState(null),[ef,ev]=l.useState(!1),[eN,ew]=l.useState(""),[eA,ek]=l.useState(!1),[eC,eD]=l.useState(!1),[eE,eR]=l.useState(null),[eI,eT]=l.useState(null),[eP,e_]=l.useState(!1),ez=s(89099).useRouter?s(89099).useRouter():null,[eO,eW]=(0,l.useState)(!1),[eV,eG]=(0,l.useState)(!1),[eJ,eq]=(0,l.useState)(null),[eH,eK]=(0,l.useState)(""),[eY,e$]=(0,l.useState)(!1),[eX,eQ]=(0,l.useState)(null),[eZ,e0]=(0,l.useState)([]),[e2,e1]=(0,l.useState)(null),e4=(0,l.useRef)(null);if(e2)return(0,a.jsx)("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:(0,a.jsxs)("div",{className:"text-center max-w-md mx-auto",children:[(0,a.jsxs)("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4",children:[(0,a.jsx)("h1",{className:"text-xl font-bold mb-2",children:"Component Error"}),(0,a.jsx)("p",{className:"text-sm",children:e2})]}),(0,a.jsx)("button",{onClick:()=>e1(null),className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Try Again"})]})});let e6=(null==ex?void 0:ex.role)==="LAWYER",e5=(null==ex?void 0:ex.isVerifiedLawyer)||(null==ex?void 0:ex.verificationStatus)==="VERIFIED_BARREAU";l.useEffect(()=>{(async()=>{if(ex&&(null==em?void 0:em.id)){ev(!0);try{let e=await fetch("/api/user/registrations?caseId=".concat(em.id));if(e.ok){let t=await e.json();t&&t.length>0?ey(t[0]):ey(null)}}catch(e){console.error("Error fetching user application:",e),e1("Failed to load application data")}finally{ev(!1)}}})()},[ex,null==em?void 0:em.id]),l.useEffect(()=>{try{(null==em?void 0:em.isAcceptingApplications)?eb&&"PENDING"===eb.status?ew("Continue your application for this case."):eb&&"SUBMITTED"===eb.status?ew("View your submitted application for this case."):ew("Start a new application for this case."):ew("This case is not accepting applications at this time.")}catch(e){console.error("Error setting button tooltip:",e)}},[eb,em]);let e3=()=>{if(!(null==em?void 0:em.requiredDocuments))return[];try{if(Array.isArray(em.requiredDocuments))return em.requiredDocuments;if("string"==typeof em.requiredDocuments){let e=JSON.parse(em.requiredDocuments);return Array.isArray(e)?e:[]}return[]}catch(e){return console.error("Error parsing required documents:",e),[]}},e8=async()=>{if(window.confirm("Are you sure you want to delete this case? This action cannot be undone."))try{let e=await fetch("/api/cases/".concat(em.id),{method:"DELETE"});if(e.ok)alert("Case deleted successfully."),ez?ez.push("/"):(window.history.pushState({},"","/"),window.dispatchEvent(new PopStateEvent("popstate")));else{let t=await e.text();alert("Failed to delete case: "+t)}}catch(e){alert("Error deleting case.")}},e7=()=>(null==em?void 0:em.status)?"closed"===em.status?100:"active"===em.status?75:25*("pending"===em.status):0,e9=async()=>{if(eE&&(null==em?void 0:em.id)){e_(!0);try{let e=new FormData;e.append("file",eE);let t=await fetch("/api/upload",{method:"POST",body:e});if(!t.ok)throw Error("Failed to upload logo");let s=await t.json();if((await fetch("/api/cases/".concat(em.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({logoUrl:s.url})})).ok)em.logoUrl=s.url,eD(!1),eR(null),eT(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{e_(!1)}}},te=(null==ex?void 0:ex.id)===(null==em?void 0:em.createdBy),tt=async e=>{if(e.preventDefault(),eX&&ex){if(eX.size>0xa00000)return void eq("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(eX.type))return void eq("File type not allowed. Please upload images, PDFs, documents, or archives.");eG(!0),eq(null);try{let e=new FormData;e.append("file",eX),e.append("description",eH),e.append("public",String(eY));let t=await fetch("/api/cases/".concat(em.id,"/upload"),{method:"POST",body:e});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to upload document")}eW(!1),eQ(null),eK(""),e$(!1);let s=await fetch("/api/cases/".concat(em.id,"/documents?publicOnly=true"));if(s.ok){let e=await s.json();e0(e.documents||[])}}catch(e){eq(e.message||"Upload failed")}finally{eG(!1)}}};l.useEffect(()=>{(async()=>{if(null==em?void 0:em.id)try{let e=await fetch("/api/cases/".concat(em.id,"/documents?publicOnly=true"));if(e.ok){let t=await e.json();e0(t.documents||[])}}catch(e){}})()},[null==em?void 0:em.id,eO]);let ts=async e=>{if(confirm("Are you sure you want to delete this document?"))try{let t=await fetch("/api/cases/".concat(em.id,"/documents/").concat(e),{method:"DELETE"});if(t.ok)e0(t=>t.filter(t=>t.id!==e)),alert("Document deleted successfully");else{let e=await t.json();alert(e.error||"Failed to delete document")}}catch(e){console.error("Error deleting document:",e),alert("Failed to delete document")}};return(0,a.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-blue-50 via-white to-indigo-50",children:[(0,a.jsxs)("div",{className:"relative bg-gradient-to-br from-red-600 to-orange-600 text-white",children:[(0,a.jsx)("div",{className:"absolute inset-0 bg-black/10"}),(0,a.jsxs)("div",{className:"relative max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12",children:[(0,a.jsx)("div",{className:"flex items-center gap-4 mb-6",children:(0,a.jsxs)("button",{onClick:()=>{"admin"===eu?null==ez||ez.push("/admin/case-management"):(null==ez?void 0:ez.back())||window.history.back()},className:"flex items-center gap-2 text-white/80 hover:text-white transition-colors",children:[(0,a.jsx)(d.A,{className:"h-5 w-5"}),"admin"===eu?"Back to Case Management":"Back to Cases"]})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 items-start",children:[(0,a.jsxs)("div",{className:"lg:col-span-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4 mb-6",children:[(0,a.jsxs)("div",{className:"flex-shrink-0 relative group",children:[em.logoUrl?(0,a.jsx)("img",{src:em.logoUrl,alt:"".concat(em.title," Logo"),className:"w-24 h-24 rounded-xl object-contain border-2 border-white/30 shadow-lg"}):(0,a.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,a.jsx)(m.A,{className:"w-12 h-12 text-white"})}),te&&(0,a.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,a.jsx)("button",{onClick:()=>eD(!0),className:"text-white text-xs font-medium hover:text-red-200 transition-colors",children:"Change Logo"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[eB(em.status),(0,a.jsx)("h1",{className:"text-4xl font-bold drop-shadow-lg",children:em.title})]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-4 mb-6",children:[em.caseNumber&&(0,a.jsxs)("span",{className:"text-red-100 bg-white/20 px-3 py-1 rounded-full text-sm font-medium",children:["#",em.caseNumber]}),(0,a.jsxs)("span",{className:"text-xs px-3 py-1 rounded-full border border-white/30 bg-white/10 ".concat(eU(em.priority||"medium")),children:[(em.priority||"MEDIUM").toUpperCase()," PRIORITY"]}),(0,a.jsx)("span",{className:"text-xs px-3 py-1 rounded-full bg-white/20 ".concat(eF(em.status||"pending")),children:(em.status||"PENDING").toUpperCase()})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-6 text-red-100 text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(x.A,{className:"h-4 w-4"}),em.jurisdiction]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(u.A,{className:"h-4 w-4"}),em.views||0," views"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(p.A,{className:"h-4 w-4"}),em.createdAt?(0,r.GP)(new Date(em.createdAt),"MMM d, yyyy"):"Unknown"]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(h.A,{className:"h-4 w-4"}),(null==(t=em._count)?void 0:t.registrations)||0," applications"]})]}),em.summary&&(0,a.jsx)("div",{className:"mt-6 p-4 bg-white/10 rounded-lg border border-white/20",children:(0,a.jsx)("p",{className:"text-red-50 leading-relaxed",children:em.summary})})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(eM.A,{url:window.location.href,title:em.title,description:em.summary||em.description||"",hashtags:em.tags||[],className:"flex-1"}),(0,a.jsx)("button",{onClick:()=>{ek(!eA)},className:"px-4 py-2 rounded-lg transition-colors ".concat(eA?"bg-yellow-500 hover:bg-yellow-600 text-white":"bg-white/20 hover:bg-white/30 text-white"),children:(0,a.jsx)(g.A,{className:"h-4 w-4 ".concat(eA?"fill-current":"")})})]}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 mt-4",children:[em.isAcceptingApplications&&(0,a.jsx)("button",{onClick:()=>{eb?null==ez||ez.push("/user/applications/".concat(eb.id)):null==ez||ez.push("/cases/".concat(em.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:eN,children:eb?"Continue Application":"Apply Now"}),"admin"===eu&&(0,a.jsxs)("div",{className:"flex gap-2",children:[ep&&(0,a.jsxs)("button",{onClick:ep,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,a.jsx)(b.A,{className:"h-4 w-4"}),"Edit"]}),eh&&(0,a.jsxs)("button",{onClick:eh,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,a.jsx)(h.A,{className:"h-4 w-4"}),"Team"]}),(0,a.jsxs)(J(),{href:"/cases/".concat(em.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,a.jsx)(y.A,{className:"h-4 w-4"}),"View Showcase"]})]}),(0,a.jsxs)(J(),{href:"/cases/".concat(em.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,a.jsx)(y.A,{className:"h-4 w-4"}),"View Beautiful Profile"]})]})]})]})]})]}),(0,a.jsx)("div",{className:"bg-white border-b border-gray-200 shadow-sm",children:(0,a.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsx)("span",{className:"text-sm font-bold text-gray-800",children:"Case Progress"}),(0,a.jsxs)("span",{className:"text-sm font-semibold text-red-600",children:[e7(),"% Complete"]})]}),(0,a.jsx)("div",{className:"w-full bg-gray-200 rounded-full h-3 shadow-inner",children:(0,a.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:"".concat(e7(),"%")}})}),(0,a.jsxs)("div",{className:"flex justify-between mt-2 text-xs text-gray-500",children:[(0,a.jsx)("span",{children:"Started"}),(0,a.jsx)("span",{children:"In Progress"}),(0,a.jsx)("span",{children:"Completed"})]})]})}),(0,a.jsx)("div",{className:"bg-white border-b border-gray-200",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[(0,a.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,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-red-600",children:"Total Applications"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-red-700",children:(null==(M=em._count)?void 0:M.registrations)||0})]}),(0,a.jsx)("div",{className:"w-12 h-12 bg-red-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(h.A,{className:"h-6 w-6 text-red-600"})})]})}),(0,a.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,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-blue-600",children:"Case Views"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-blue-700",children:em.views||0})]}),(0,a.jsx)("div",{className:"w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(u.A,{className:"h-6 w-6 text-blue-600"})})]})}),(0,a.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,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-green-600",children:"Priority Level"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-green-700",children:(em.priority||"MEDIUM").toUpperCase()})]}),(0,a.jsx)("div",{className:"w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(f.A,{className:"h-6 w-6 text-green-600"})})]})}),(0,a.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,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-purple-600",children:"Status"}),(0,a.jsx)("p",{className:"text-2xl font-bold text-purple-700",children:(em.status||"PENDING").toUpperCase()})]}),(0,a.jsx)("div",{className:"w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(n.A,{className:"h-6 w-6 text-purple-600"})})]})})]})})}),(0,a.jsx)("div",{className:"sticky top-16 z-40 bg-white border-b border-gray-200 shadow-lg",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,a.jsxs)("div",{className:"flex items-center space-x-6 overflow-x-auto py-4",children:[(0,a.jsxs)("button",{onClick:()=>{var e;return null==(e=document.getElementById("overview"))?void 0:e.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,a.jsx)(m.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm",children:"Overview"})]}),(0,a.jsxs)("button",{onClick:()=>{var e;return null==(e=document.getElementById("lawyer"))?void 0:e.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,a.jsx)(j.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm",children:"Lead Lawyer"})]}),(0,a.jsxs)("button",{onClick:()=>{var e;return null==(e=document.getElementById("updates"))?void 0:e.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,a.jsx)(i.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm",children:"Updates"})]}),(0,a.jsxs)("button",{onClick:()=>{var e;return null==(e=document.getElementById("documents"))?void 0:e.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,a.jsx)(m.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm",children:"Documents"})]}),(0,a.jsxs)("button",{onClick:()=>{var e;return null==(e=document.getElementById("comments"))?void 0:e.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,a.jsx)(v.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"text-sm",children:"Comments & Discussion"})]})]})})}),e6&&!e5&&(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-6",children:(0,a.jsx)("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-r-lg",children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)(c.A,{className:"h-5 w-5 text-yellow-400 mr-3 mt-0.5"}),(0,a.jsx)("div",{children:(0,a.jsxs)("p",{className:"text-sm text-yellow-800",children:[(0,a.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."]})})]})})}),ex&&(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 mt-6",children:(0,a.jsx)("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 rounded-xl p-6 text-white",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-1",children:"Ready to Apply?"}),(0,a.jsx)("p",{className:"text-blue-100 text-sm",children:"Join this case and make a difference"})]}),(0,a.jsx)("div",{className:"flex items-center gap-3",children:ef?(0,a.jsxs)("button",{className:"px-6 py-3 rounded-lg bg-white/20 text-white flex items-center",disabled:!0,children:[(0,a.jsxs)("svg",{className:"animate-spin h-5 w-5 mr-2",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Checking..."]}):em.isAcceptingApplications?eb?"PENDING"===eb.status?(0,a.jsxs)(J(),{href:"/user/registrations/".concat(eb.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:eN,children:[(0,a.jsx)(w.A,{className:"h-4 w-4 mr-2"})," Continue My Application"]}):(0,a.jsxs)(J(),{href:"/user/registrations/".concat(eb.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:eN,children:[(0,a.jsx)(u.A,{className:"h-4 w-4 mr-2"})," View My Application"]}):(0,a.jsxs)(J(),{href:"/user/registrations/new?caseId=".concat(em.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:eN,children:[(0,a.jsx)(N.A,{className:"h-4 w-4 mr-2"})," Apply Now"]}):(0,a.jsxs)("button",{className:"px-6 py-3 rounded-lg bg-white/20 text-white cursor-not-allowed",disabled:!0,title:eN,children:[(0,a.jsx)(N.A,{className:"h-4 w-4 mr-2 inline"})," Apply Now"]})})]})})}),(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,a.jsxs)("div",{id:"overview",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-blue-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(m.A,{className:"h-5 w-5 text-blue-600"})}),(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Case Overview"})]}),(0,a.jsx)("p",{className:"text-gray-700 leading-relaxed text-lg mb-6",children:em.description}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(A.A,{className:"h-5 w-5 text-blue-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-900",children:"Case Type:"}),(0,a.jsx)("span",{className:"ml-2 text-gray-600 capitalize",children:em.caseType.replace("_"," ")})]})]}),em.court&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(k.A,{className:"h-5 w-5 text-blue-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-900",children:"Court:"}),(0,a.jsx)("span",{className:"ml-2 text-gray-600",children:em.court})]})]})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[em.budget&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(C.A,{className:"h-5 w-5 text-green-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-900",children:"Budget:"}),(0,a.jsxs)("span",{className:"ml-2 text-gray-600",children:["$",em.budget.toLocaleString()," CAD"]})]})]}),em.applicationDeadline&&(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(p.A,{className:"h-5 w-5 text-orange-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-medium text-gray-900",children:"Deadline:"}),(0,a.jsx)("span",{className:"ml-2 text-gray-600",children:(0,r.GP)(new Date(em.applicationDeadline),"PPP")})]})]})]})]}),(0,a.jsxs)("div",{className:"mt-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 rounded-lg",children:[(0,a.jsx)(n.A,{className:"h-5 w-5 mr-3 ".concat(em.isAcceptingApplications?"text-green-500":"text-gray-400")}),(0,a.jsx)("span",{className:"text-sm text-gray-700",children:em.isAcceptingApplications?"Accepting Applications":"Not Accepting Applications"})]}),(0,a.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 rounded-lg",children:[(0,a.jsx)(n.A,{className:"h-5 w-5 mr-3 ".concat(em.requiresApproval?"text-blue-500":"text-gray-400")}),(0,a.jsx)("span",{className:"text-sm text-gray-700",children:em.requiresApproval?"Requires Approval":"Auto-Approval"})]})]})]}),(0,a.jsxs)("div",{id:"lawyer",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-purple-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(j.A,{className:"h-5 w-5 text-purple-600"})}),(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Lead Lawyer"})]}),(0,a.jsxs)("div",{className:"flex items-start gap-6",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(null==(U=em.leadLawyer)?void 0:U.profilePicture)?(0,a.jsx)("img",{src:em.leadLawyer.profilePicture,alt:em.leadLawyer.name,className:"h-20 w-20 rounded-full object-cover border-4 border-purple-100"}):(0,a.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:null==(_=em.leadLawyer)||null==(B=_.name)?void 0:B.charAt(0)})}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,a.jsx)("h3",{className:"text-xl font-bold text-gray-900",children:null==(z=em.leadLawyer)?void 0:z.name}),(null==(O=em.leadLawyer)?void 0:O.isVerified)&&(0,a.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,a.jsx)(S.A,{className:"h-3 w-3"}),"Verified"]}),(null==(W=em.leadLawyer)?void 0:W.proBono)&&(0,a.jsx)("span",{className:"px-3 py-1 text-xs bg-green-100 text-green-800 rounded-full font-medium",children:"Pro Bono"})]}),(null==(V=em.leadLawyer)?void 0:V.title)&&(0,a.jsx)("p",{className:"text-lg text-gray-600 mb-2",children:em.leadLawyer.title}),(null==(G=em.leadLawyer)?void 0:G.specialization)&&(0,a.jsx)("p",{className:"text-gray-600 mb-3",children:em.leadLawyer.specialization}),(0,a.jsx)(F,{rating:null==(q=em.leadLawyer)?void 0:q.averageRating,size:"md"}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600",children:"Success Rate:"}),(0,a.jsxs)("span",{className:"font-semibold text-gray-900",children:[null==(H=em.leadLawyer)?void 0:H.wonCases,"/",null==(K=em.leadLawyer)?void 0:K.totalCases," cases won"]})]}),(null==(Y=em.leadLawyer)?void 0:Y.hourlyRate)&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600",children:"Rate:"}),(0,a.jsxs)("span",{className:"font-semibold text-gray-900",children:["$",em.leadLawyer.hourlyRate,"/hr"]})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(null==($=em.leadLawyer)?void 0:$.yearsOfExperience)&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600",children:"Experience:"}),(0,a.jsxs)("span",{className:"font-semibold text-gray-900",children:[em.leadLawyer.yearsOfExperience," years"]})]}),(null==(X=em.leadLawyer)?void 0:X.officeLocation)&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-gray-600",children:"Location:"}),(0,a.jsxs)("span",{className:"font-semibold text-gray-900 flex items-center gap-1",children:[(0,a.jsx)(x.A,{className:"h-3 w-3"}),em.leadLawyer.officeLocation]})]})]})]}),(null==(Q=em.leadLawyer)?void 0:Q.bio)&&(0,a.jsx)("p",{className:"text-gray-700 mt-4 leading-relaxed",children:em.leadLawyer.bio})]})]})]}),(0,a.jsx)(eS,{caseData:em}),e3().length>0&&(0,a.jsxs)("div",{id:"documents",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-green-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(m.A,{className:"h-5 w-5 text-green-600"})}),(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Required Documents"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:e3().map((e,t)=>(0,a.jsxs)("div",{className:"flex items-center p-3 bg-gray-50 rounded-lg",children:[(0,a.jsx)(n.A,{className:"h-5 w-5 text-green-500 mr-3"}),(0,a.jsx)("span",{className:"text-gray-700 font-medium",children:e})]},t))})]}),(0,a.jsxs)("div",{id:"updates",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-orange-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(i.A,{className:"h-5 w-5 text-orange-600"})}),(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Recent Updates"})]}),(null==(Z=em.caseUpdates)?void 0:Z.length)===0?(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)(i.A,{className:"h-12 w-12 text-gray-300 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-500",children:"No updates yet"})]}):(0,a.jsx)("div",{className:"space-y-4",children:null==(ee=em.caseUpdates)?void 0:ee.slice(0,5).map(e=>{var t;return(0,a.jsxs)("div",{className:"border-l-4 border-blue-200 pl-6 py-4 hover:bg-gray-50 rounded-r-lg transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("h3",{className:"font-semibold text-gray-900",children:e.title}),(0,a.jsx)("span",{className:"text-sm text-gray-500 bg-gray-100 px-2 py-1 rounded-full",children:(0,r.GP)(new Date(e.createdAt),"MMM d, yyyy")})]}),e.description&&(0,a.jsx)("p",{className:"text-gray-600 mb-2",children:e.description}),(0,a.jsxs)("div",{className:"flex items-center text-sm text-gray-500",children:[(0,a.jsx)(j.A,{className:"h-4 w-4 mr-1"}),null==(t=e.author)?void 0:t.name,(0,a.jsx)("span",{className:"mx-2",children:"•"}),(0,a.jsx)("span",{className:"capitalize",children:e.updateType}),e.isPublic&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"mx-2",children:"•"}),(0,a.jsx)("span",{className:"text-green-600 font-medium",children:"Public"})]})]})]},e.id)})})]}),(0,a.jsxs)("div",{id:"comments",className:"bg-white rounded-xl shadow-sm border border-gray-200 p-8",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-indigo-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(D.A,{className:"h-5 w-5 text-indigo-600"})}),(0,a.jsx)("h2",{className:"text-2xl font-bold text-gray-900",children:"Comments & Discussion"})]}),(0,a.jsx)(ej,{caseId:em.id,mode:eu,allowAttachments:!0,allowReactions:!0,allowReplies:!0,apiEndpoint:"/api/live-cases/".concat(em.id,"/comments")})]})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-blue-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(E.A,{className:"h-4 w-4 text-blue-600"})}),(0,a.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Quick Stats"})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-blue-50 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(h.A,{className:"h-5 w-5 text-blue-600 mr-3"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Applications"})]}),(0,a.jsx)("span",{className:"font-bold text-blue-600 text-lg",children:(null==(et=em._count)?void 0:et.registrations)||0})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-red-50 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(R.A,{className:"h-5 w-5 text-red-600 mr-3"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Supporters"})]}),(0,a.jsx)("span",{className:"font-bold text-red-600 text-lg",children:(null==(es=em._count)?void 0:es.supporters)||0})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-green-50 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(C.A,{className:"h-5 w-5 text-green-600 mr-3"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Offers"})]}),(0,a.jsx)("span",{className:"font-bold text-green-600 text-lg",children:(null==(ea=em._count)?void 0:ea.offers)||0})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-purple-50 rounded-lg",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(D.A,{className:"h-5 w-5 text-purple-600 mr-3"}),(0,a.jsx)("span",{className:"text-sm font-medium text-gray-700",children:"Comments"})]}),(0,a.jsx)("span",{className:"font-bold text-purple-600 text-lg",children:(null==(el=em._count)?void 0:el.comments)||0})]})]})]}),"admin"===eu&&(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-yellow-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(I.A,{className:"h-4 w-4 text-yellow-600"})}),(0,a.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Admin Tools"})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("button",{onClick:ep,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,a.jsx)(b.A,{className:"h-4 w-4 mr-2"}),"Edit Case"]}),(0,a.jsxs)("button",{onClick:eg,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,a.jsx)(h.A,{className:"h-4 w-4 mr-2"}),"View Applications"]}),(0,a.jsxs)("button",{onClick:eh,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,a.jsx)(f.A,{className:"h-4 w-4 mr-2"}),"Manage Team"]})]})]}),"public"===eu&&ex&&(null==(er=em.creator)?void 0:er.id)===ex.id&&(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-orange-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(T.A,{className:"h-4 w-4 text-orange-600"})}),(0,a.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Your Case Tools"})]}),(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("button",{onClick:ep,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,a.jsx)(b.A,{className:"h-4 w-4 mr-2"}),"Edit Case"]}),(0,a.jsxs)("button",{onClick:e8,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,a.jsx)(P.A,{className:"h-4 w-4 mr-2"}),"Delete Case"]})]})]}),(0,a.jsxs)("div",{className:"bg-white rounded-xl shadow-sm border border-gray-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-6",children:[(0,a.jsx)("div",{className:"w-8 h-8 bg-gray-100 rounded-lg flex items-center justify-center",children:(0,a.jsx)(L.A,{className:"h-4 w-4 text-gray-600"})}),(0,a.jsx)("h3",{className:"text-lg font-bold text-gray-900",children:"Case Information"})]}),(0,a.jsxs)("div",{className:"space-y-4 text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Created:"}),(0,a.jsx)("span",{className:"text-gray-600",children:(0,r.GP)(new Date(em.createdAt),"MMM d, yyyy")})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Last Updated:"}),(0,a.jsx)("span",{className:"text-gray-600",children:(0,r.GP)(new Date(em.updatedAt),"MMM d, yyyy")})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Created By:"}),(0,a.jsx)("span",{className:"text-gray-600",children:null==(en=em.creator)?void 0:en.name})]}),em.firmName&&(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Firm:"}),(0,a.jsx)("span",{className:"text-gray-600",children:em.firmName})]}),em.expectedDuration&&(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Expected Duration:"}),(0,a.jsxs)("span",{className:"text-gray-600",children:[em.expectedDuration," days"]})]}),em.filingDate&&(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-gray-50 rounded",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:"Filing Date:"}),(0,a.jsx)("span",{className:"text-gray-600",children:(0,r.GP)(new Date(em.filingDate),"MMM d, yyyy")})]})]})]})]})]})}),"public"===eu&&ex&&(0,a.jsx)(eL,{caseId:em.id,caseTitle:em.title,caseOwner:{id:(null==(ei=em.creator)?void 0:ei.id)||"",name:(null==(eo=em.creator)?void 0:eo.name)||"Unknown",avatar:null==(ec=em.creator)?void 0:ec.image,role:(null==(ed=em.creator)?void 0:ed.role)||"USER"}}),eC&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-xl p-6 max-w-md w-full mx-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900",children:"Change Case Logo"}),(0,a.jsx)("button",{onClick:()=>{eD(!1),eR(null),eT(null)},className:"text-gray-400 hover:text-gray-600",children:(0,a.jsx)(o.A,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"flex justify-center",children:eI?(0,a.jsx)("img",{src:eI,alt:"Logo Preview",className:"w-24 h-24 rounded-lg object-cover border-2 border-gray-200"}):(0,a.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,a.jsx)(m.A,{className:"w-8 h-8 text-gray-400"})})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Select New Logo"}),(0,a.jsx)("input",{type:"file",accept:"image/*",onChange:e=>{var t;let s=null==(t=e.target.files)?void 0:t[0];s&&(eR(s),eT(URL.createObjectURL(s)))},className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"}),(0,a.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Supported formats: JPG, PNG, GIF. Max size: 5MB"})]}),(0,a.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,a.jsx)("button",{onClick:()=>{eD(!1),eR(null),eT(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,a.jsx)("button",{onClick:e9,disabled:!eE||eP,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:eP?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("svg",{className:"animate-spin h-4 w-4 mr-2",viewBox:"0 0 24 24",children:[(0,a.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,a.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),"Uploading..."]}):"Update Logo"})]})]})]})}),eO&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black bg-opacity-40",children:(0,a.jsxs)("form",{className:"bg-white rounded-lg shadow-lg p-6 w-full max-w-md flex flex-col gap-4",onSubmit:tt,children:[(0,a.jsx)("h3",{className:"text-lg font-bold mb-2",children:"Upload Document"}),(0,a.jsx)("input",{type:"file",accept:".pdf,.doc,.docx,.txt,.jpg,.jpeg,.png,.mp3,.mp4,.wav,.avi,.mov,.mkv",ref:e4,onChange:e=>{var t;return eQ((null==(t=e.target.files)?void 0:t[0])||null)},required:!0,className:"border rounded px-3 py-2"}),(0,a.jsx)("textarea",{placeholder:"Description (optional)",value:eH,onChange:e=>eK(e.target.value),className:"border rounded px-3 py-2"}),(0,a.jsxs)("label",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{type:"checkbox",checked:eY,onChange:e=>e$(e.target.checked)}),(0,a.jsx)("span",{children:"Make this document public"})]}),eJ&&(0,a.jsx)("div",{className:"text-red-600 text-sm",children:eJ}),(0,a.jsxs)("div",{className:"flex gap-2 mt-2",children:[(0,a.jsx)("button",{type:"submit",disabled:eV,className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded font-semibold",children:eV?"Uploading...":"Upload"}),(0,a.jsx)("button",{type:"button",onClick:()=>eW(!1),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 px-4 py-2 rounded font-semibold",children:"Cancel"})]})]})}),(0,a.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-2xl font-bold text-gray-800 flex items-center gap-2",children:[(0,a.jsx)(m.A,{className:"h-6 w-6 text-blue-600"})," Documents"]}),ex&&(0,a.jsx)("button",{onClick:()=>eW(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg font-semibold shadow",children:"Upload Document"})]}),0===eZ.length?(0,a.jsx)("div",{className:"text-gray-500",children:"No public documents yet."}):(0,a.jsx)("div",{className:"space-y-6",children:Object.entries(eZ.reduce((e,t)=>{var s;let a=(null==(s=t.user)?void 0:s.id)||"unknown";return e[a]||(e[a]=[]),e[a].push(t),e},{})).sort((e,t)=>{let[s]=e,[a]=t;return s===em.createdBy?-1:+(a===em.createdBy)}).map(e=>{var t,s,l,n,i,o,c,d;let[x,u]=e;return(0,a.jsxs)("div",{className:"border rounded-lg p-4 bg-white/80",children:[(0,a.jsxs)("div",{className:"font-semibold text-blue-700 mb-2 flex items-center gap-2",children:[u.length>0&&(null==(s=u[0])||null==(t=s.user)?void 0:t.profilePicture)&&(0,a.jsx)("img",{src:null==(n=u[0])||null==(l=n.user)?void 0:l.profilePicture,alt:null==(o=u[0])||null==(i=o.user)?void 0:i.name,className:"w-7 h-7 rounded-full object-cover"}),u.length>0&&(null==(d=u[0])||null==(c=d.user)?void 0:c.name)||"Unknown User",x===em.createdBy&&(0,a.jsx)("span",{className:"ml-2 px-2 py-1 bg-blue-100 text-blue-700 rounded text-xs",children:"Creator"})]}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:u.map(e=>{var t,s,l,n;return(0,a.jsxs)("div",{className:"border rounded p-3 bg-white flex flex-col gap-2 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(null==(t=e.type)?void 0:t.includes("pdf"))?(0,a.jsx)(m.A,{className:"h-5 w-5 text-red-600"}):(null==(s=e.type)?void 0:s.includes("image"))?(0,a.jsx)("img",{src:e.url,alt:e.name,className:"h-8 w-8 object-cover rounded"}):(null==(l=e.type)?void 0:l.includes("audio"))?(0,a.jsx)("span",{className:"inline-block bg-blue-100 text-blue-700 rounded px-2 py-1 text-xs",children:"AUDIO"}):(null==(n=e.type)?void 0:n.includes("video"))?(0,a.jsx)("span",{className:"inline-block bg-purple-100 text-purple-700 rounded px-2 py-1 text-xs",children:"VIDEO"}):(0,a.jsx)(m.A,{className:"h-5 w-5 text-gray-400"}),(0,a.jsx)("span",{className:"font-medium text-gray-800 truncate",title:e.name,children:e.name})]}),e.description&&(0,a.jsx)("div",{className:"text-xs text-gray-600",children:e.description}),(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[(0,a.jsx)("span",{children:e.type}),(0,a.jsxs)("span",{children:[(e.fileSize/1024).toFixed(1)," KB"]}),(0,a.jsx)("span",{children:e.createdAt?(0,r.GP)(new Date(e.createdAt),"MMM d, yyyy"):""})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline text-sm font-semibold",children:"View / Download"}),((null==ex?void 0:ex.id)===e.userId||(null==ex?void 0:ex.role)==="ADMIN"||(null==ex?void 0:ex.role)==="SUPERADMIN")&&(0,a.jsx)("button",{onClick:()=>ts(e.id),className:"text-red-600 hover:text-red-800 text-sm font-semibold",title:"Delete document",children:"Delete"})]})]},e.id)})})]},x)})})]})]})}},99986:(e,t,s)=>{s.d(t,{A:()=>y});var a=s(37876),l=s(14232),r=s(23042),n=s(67421),i=s(78272),o=s(78239),c=s(39458),d=s(45450),m=s(33276),x=s(70801),u=s(7446),p=s(5612),h=s(65364);let g=()=>{let[e,t]=(0,l.useState)(!1),[s,a]=(0,l.useState)(null);(0,l.useEffect)(()=>{if(!window.FB){let e=document.createElement("script");return e.src="https://connect.facebook.net/en_US/sdk.js",e.async=!0,e.defer=!0,e.crossOrigin="anonymous",window.fbAsyncInit=()=>{window.FB.init({appId:h.env.NEXT_PUBLIC_FACEBOOK_APP_ID||"your-facebook-app-id",cookie:!0,xfbml:!0,version:"v18.0"})},document.head.appendChild(e),()=>{document.head.removeChild(e)}}},[]);let r=(0,l.useCallback)(async e=>{t(!0),a(null);try{let t="https://www.facebook.com/dialog/share?"+"app_id=".concat(h.env.NEXT_PUBLIC_FACEBOOK_APP_ID)+"&display=popup"+"&href=".concat(encodeURIComponent(e.url))+(Array.isArray(e.hashtags)&&e.hashtags[0]?"&hashtag=%23".concat(e.hashtags[0]):"")+"&redirect_uri=".concat(encodeURIComponent(window.location.href));window.open(t,"_blank","width=600,height=400")}catch(e){a("Failed to share to Facebook"),console.error("Facebook share error:",e)}finally{t(!1)}},[]),n=(0,l.useCallback)(async e=>{t(!0),a(null);try{let t="".concat(e.title,"\n\n").concat(e.description),s=Array.isArray(e.hashtags)?e.hashtags.join(","):"";window.open("https://twitter.com/intent/tweet?text=".concat(encodeURIComponent(t),"&url=").concat(encodeURIComponent(e.url),"&hashtags=").concat(encodeURIComponent(s)),"_blank","width=600,height=400")}catch(e){a("Failed to share to Twitter"),console.error("Twitter share error:",e)}finally{t(!1)}},[]),i=(0,l.useCallback)(async e=>{t(!0),a(null);try{window.open("https://www.linkedin.com/sharing/share-offsite/?url=".concat(encodeURIComponent(e.url),"&title=").concat(encodeURIComponent(e.title),"&summary=").concat(encodeURIComponent(e.description)),"_blank","width=600,height=400")}catch(e){a("Failed to share to LinkedIn"),console.error("LinkedIn share error:",e)}finally{t(!1)}},[]);return{shareToFacebook:r,shareToTwitter:n,shareToLinkedIn:i,shareToWhatsApp:(0,l.useCallback)(async e=>{t(!0),a(null);try{let t="".concat(e.title,"\n\n").concat(e.description,"\n\n").concat(e.url);/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)?window.open("whatsapp://send?text=".concat(encodeURIComponent(t))):window.open("https://wa.me/?text=".concat(encodeURIComponent(t)),"_blank","width=600,height=400")}catch(e){a("Failed to share to WhatsApp"),console.error("WhatsApp share error:",e)}finally{t(!1)}},[]),copyToClipboard:(0,l.useCallback)(async e=>{t(!0),a(null);try{let t="".concat(e.title,"\n\n").concat(e.description,"\n\n").concat(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)}a(null)}catch(e){a("Failed to copy to clipboard"),console.error("Clipboard error:",e)}finally{t(!1)}},[]),isSharing:e,shareError:s}};var b=s(97685);let y=e=>{let{url:t,title:s,description:h,image:y,hashtags:f=[],className:j="",variant:v="default"}=e,[N,w]=(0,l.useState)(!1),[A,k]=(0,l.useState)(!1),{shareToFacebook:C,shareToTwitter:S,shareToLinkedIn:D,shareToWhatsApp:E,copyToClipboard:R,isSharing:I,shareError:T}=g(),P={url:t,title:s,description:h,image:y,hashtags:f},L=async e=>{try{switch(e){case"facebook":await C(P),b.Ay.success("Shared to Facebook!");break;case"twitter":await S(P),b.Ay.success("Shared to Twitter!");break;case"linkedin":await D(P),b.Ay.success("Shared to LinkedIn!");break;case"whatsapp":await E(P),b.Ay.success("Shared to WhatsApp!");break;case"copy":await R(P),k(!0),b.Ay.success("Link copied to clipboard!"),setTimeout(()=>k(!1),2e3)}}catch(t){b.Ay.error("Failed to share to ".concat(e)),console.error("Share error for ".concat(e,":"),t)}w(!1)},M=[{platform:"facebook",label:"Facebook",icon:i.A,color:"text-blue-600",bgColor:"hover:bg-blue-50",action:()=>L("facebook")},{platform:"twitter",label:"Twitter",icon:o.A,color:"text-blue-400",bgColor:"hover:bg-blue-50",action:()=>L("twitter")},{platform:"linkedin",label:"LinkedIn",icon:c.A,color:"text-blue-700",bgColor:"hover:bg-blue-50",action:()=>L("linkedin")},{platform:"whatsapp",label:"WhatsApp",icon:d.A,color:"text-green-600",bgColor:"hover:bg-green-50",action:()=>L("whatsapp")},{platform:"copy",label:A?"Copied!":"Copy Link",icon:A?m.A:x.A,color:A?"text-green-600":"text-gray-600",bgColor:A?"bg-green-50":"hover:bg-gray-50",action:()=>L("copy")}];return(0,a.jsxs)("div",{className:"relative ".concat(j),children:[(0,a.jsxs)("button",{onClick:()=>w(!N),className:(()=>{switch(v){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:I,children:[I?(0,a.jsx)(u.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(p.A,{className:"h-4 w-4"}),"minimal"!==v&&"floating"!==v&&(0,a.jsx)("span",{children:"Share"})]}),(0,a.jsx)(r.N,{children:N&&(0,a.jsx)(n.P.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(v){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,a.jsx)("div",{className:"space-y-1",children:M.map(e=>{let t=e.icon;return(0,a.jsxs)("button",{onClick:e.action,disabled:I,className:"w-full flex items-center gap-3 px-3 py-2 text-sm rounded-md transition-colors ".concat(e.bgColor," ").concat(e.color," disabled:opacity-50 disabled:cursor-not-allowed"),children:[(0,a.jsx)(t,{className:"h-4 w-4"}),(0,a.jsx)("span",{children:e.label}),I&&"facebook"===e.platform&&(0,a.jsx)(u.A,{className:"h-3 w-3 animate-spin ml-auto"})]},e.platform)})})})}),T&&(0,a.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:T}),N&&(0,a.jsx)("div",{className:"fixed inset-0 z-40",onClick:()=>w(!1)})]})}}}]);

CasperSecurity Mini