1import{j as e,u as xe,r as i,F as pe,b as N,A as Ie,J as H,h as V,i as ve,l as F,W as _,av as Pe,I as ke,aF as Ce,n as Oe,aH as Te,L as Me,aI as le,ba as ne,al as ie}from"./index-DXw5IyQz.js";import{S as Ue}from"./scroll-area-DP_04AgL.js";import{S as oe}from"./separator-C5h-Ftoo.js";import{C as q,u as ce,F as Ae,P as Se}from"./FileMessageBubble-B3KpUqPO.js";import{P as de,i as De}from"./PhotoGrid-BQqiotGP.js";import{I as Ee,i as Le}from"./isToday-Bum1QFLy.js";import{f as J}from"./timestamp-utils-D3fEe_HZ.js";import{I as me}from"./info-D32EcuXd.js";import{M as Re}from"./maximize-2-YIH5AM3W.js";import{S as ze}from"./send-DyoKc_iB.js";import{f as he}from"./format-Co3WRPUI.js";import{n as $e}from"./nl-BBnlNZVY.js";import"./api-qYiE87cU.js";import"./eye-BneA9b0F.js";import"./image-CUF_npZZ.js";import"./download-_Wn09zp8.js";import"./constructNow-C2JZsSDB.js";const Be=({id:d,content:o,timestamp:f,isCurrentUser:p,senderName:j,projectId:S,senderProfileImage:h,senderProfileImageOriginal:T,senderProfileImageZoom:P,senderProfileImageX:k,senderProfileImageY:w})=>{const C=J(f),r=j?j.split(" ").map(L=>L[0]).join("").toUpperCase().substring(0,2):"?",M=p?"bg-primary text-primary-foreground ml-auto":"bg-muted";return e.jsxs("div",{className:`flex mb-4 ${p?"flex-row-reverse":"flex-row"}`,children:[e.jsx("div",{className:`flex-shrink-0 ${p?"ml-3":"mr-3"}`,children:e.jsx(_,{size:"sm",profileImage:h,profileImageOriginal:T,profileImageZoom:P,profileImageX:k,profileImageY:w,alt:j||"Profiel",fallback:r,className:"w-10 h-10 md:w-12 md:h-12"})}),e.jsxs("div",{className:`flex flex-col max-w-[85%] md:max-w-[70%] lg:max-w-[60%] xl:max-w-[50%] ${p?"items-end":"items-start"}`,children:[e.jsx("div",{className:`rounded-lg px-3 py-1.5 sm:px-3 sm:py-2 ${M}`,children:e.jsx("p",{className:"text-sm sm:text-sm whitespace-pre-wrap break-words",children:o})}),e.jsx("div",{className:"flex items-center mt-0.5 justify-start",children:e.jsxs("span",{className:"text-[9px] sm:text-xs text-muted-foreground",children:[j||"Onbekend"," ⢠",C]})})]})]})},Ge=({date:d})=>{let o;try{const f=new Date(d.getTime()+72e5);Le(f)?o="Vandaag":De(f)?o="Gisteren":o=he(f,"d MMMM yyyy",{locale:$e})}catch(f){console.error("Fout bij formatteren datum in separator:",f),o="Onbekende datum"}return e.jsxs("div",{className:"flex items-center justify-center my-2 sm:my-3",children:[e.jsx(oe,{className:"flex-grow mr-2"}),e.jsx(Oe,{variant:"outline",className:"text-[10px] sm:text-xs font-normal py-1 px-3 whitespace-nowrap",children:o}),e.jsx(oe,{className:"flex-grow ml-2"})]})};function fe({projectId:d,projectTitle:o,isFullscreen:f=!1,onExitFullscreen:p}){return e.jsx(q,{projectId:d,children:e.jsx(Xe,{projectTitle:o,isFullscreen:f,onExitFullscreen:p})})}function Xe({projectTitle:d,isFullscreen:o=!1,onExitFullscreen:f}){const{messages:p,sendMessage:j,markAsRead:S,isConnected:h,deleteMessage:T,refreshMessages:P,addOptimisticMessage:k,updateOptimisticMessage:w,removeOptimisticMessage:C}=ce(),{user:r}=xe(),[M,L]=i.useState(""),[R,K]=i.useState(!1),[ue,z]=i.useState(!1),[ge,W]=i.useState([]),[je,$]=i.useState(!1),[we,Q]=i.useState(0),O=i.useRef(null),B=i.useRef(null),G=i.useRef(0),X=i.useRef(!1),D=i.useRef(null),ee=i.useRef(null),[Y,Z]=i.useState(!1),ye=i.useRef(window.innerHeight);i.useEffect(()=>{const t=window.innerWidth<=768||/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),a=!!window.Capacitor;if(!t&&!a)return;if(a){const{Keyboard:n}=window.Capacitor.Plugins||{};if(n){const l=n.addListener("keyboardDidShow",m=>{Z(!0)}),s=n.addListener("keyboardDidHide",()=>{Z(!1)});return()=>{l==null||l.remove(),s==null||s.remove()}}}const c=()=>{const n=window.innerHeight,m=ye.current-n>150;m!==Y&&Z(m)};return window.addEventListener("resize",c),window.visualViewport&&window.visualViewport.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),window.visualViewport&&window.visualViewport.removeEventListener("resize",c)}},[Y]);const{projectId:u}=ce(),{data:se}=pe({queryKey:[`/api/projects/${u}/team-members`],enabled:!!u}),te=Array.isArray(se)?se:[],U={};p.forEach(t=>{try{let a;try{a=t.sentAt?new Date(t.sentAt):new Date,isNaN(a.getTime())&&(a=new Date)}catch{console.error("Ongeldige datum in bericht:",t.sentAt),a=new Date}const c=he(a,"yyyy-MM-dd");U[c]||(U[c]=[]),U[c].push(t)}catch(a){console.error("Fout bij verwerken bericht voor datumgroep:",a,t)}});const I=i.useCallback(()=>
1{if(O.current){const t=O.current.querySelector("[data-radix-scroll-area-viewport]");t&&(t.scrollTop=t.scrollHeight)}},[]),re=i.useCallback(()=>{if(O.current){const t=O.current.querySelector("[data-radix-scroll-area-viewport]");if(t)return t.scrollTop>=t.scrollHeight-t.clientHeight-50}return!0},[]),be=i.useCallback(async t=>{const a=t.target.files;if(!(!a||a.length===0||!u||!r)){for(let c=0;c<a.length;c++){const n=a[c],l=`temp-${Date.now()}-${c}`;let s="DOCUMENT",m=null;n.type.startsWith("image/")&&(s="IMAGE",m=URL.createObjectURL(n));const x=new Date,b={id:l,projectId:u,senderId:r.id,content:n.name,sentAt:x,readAt:null,type:s,senderName:r.name||"Jij",senderRole:r.role||"USER",senderProfileImage:r.profileImage,senderProfileImageOriginal:r.profileImageOriginal,senderProfileImageZoom:r.profileImageZoom,senderProfileImageX:r.profileImageX,senderProfileImageY:r.profileImageY,fileName:n.name,fileUrl:m||"uploading",fileType:n.type,fileSize:n.size,thumbnailUrl:m||"uploading",isOptimistic:!0,uploadProgress:0,_localOnly:!0};console.log("â Adding optimistic message:",b),k(b),setTimeout(()=>I(),100);try{const v=new FormData;v.append("files",n),w(l,{uploadProgress:25}),console.log("ð¤ Starting background upload for",n.name);const y=sessionStorage.getItem("auth_token")||localStorage.getItem("auth_token");console.log("ð JWT token being sent:",y?"Token exists":"No token found"),console.log("ð Uploading to URL:",`/api/chat-upload/project/${u}`);const g=await fetch(`/api/chat-upload/project/${u}`,{method:"POST",body:v,headers:{Authorization:`Bearer ${y}`}});if(w(l,{uploadProgress:75}),!g.ok){const E=await g.text();throw console.error("ð¥ Upload response error:",{status:g.status,statusText:g.statusText,errorText:E}),new Error(`Upload failed: ${g.status} ${g.statusText} - ${E}`)}const A=await g.json();w(l,{uploadProgress:100}),setTimeout(()=>{console.log("ðï¸ Removing optimistic message"),C(l),m&&URL.revokeObjectURL(m),P()},500)}catch(v){console.error("â Upload failed:",v),w(l,{uploadProgress:-1,content:`Upload failed: ${n.name}`}),setTimeout(()=>{C(l),m&&URL.revokeObjectURL(m)},3e3)}}t.target&&(t.target.value="")}},[u,r,k,w,C,I,P]);i.useEffect(()=>{if(O.current){const t=O.current.querySelector("[data-radix-scroll-area-viewport]");if(t){const a=()=>{D.current&&clearTimeout(D.current),X.current=!0,D.current=setTimeout(()=>{X.current=!1},1e3)};return t.addEventListener("scroll",a),()=>{t.removeEventListener("scroll",a),D.current&&clearTimeout(D.current)}}}},[]),i.useEffect(()=>{const t=p.length,a=G.current,c=t>a,n=re();c&&(n||!X.current)?setTimeout(()=>{I()},100):t===a&&n&&setTimeout(()=>{I()},50),G.current=t},[p,re,I]),i.useEffect(()=>{p.length>0&&G.current===0&&requestAnimationFrame(()=>{I()})},[p,I]),i.useEffect(()=>{u!==void 0&&h&&S(u)},[u,h,S,p.length]);const ae=async t=>{if(t.preventDefault(),!(!M.trim()||u===void 0||!r||R))try{K(!0),await j(u,M.trim(),"TEXT"),L(""),setTimeout(()=>{I()},200),B.current&&B.current.focus()}catch(a){console.error("Fout bij versturen bericht:",a)}finally{K(!1)}},Ne=t=>{t.key==="Enter"&&!t.shiftKey&&ae(t)};return i.useEffect(()=>{if(o){document.body.classList.add("chat-fullscreen-active"),document.documentElement.classList.add("chat-fullscreen-active");const t=/iPad|iPhone|iPod/.test(navigator.userAgent),a=window.Capacitor;(t||a)&&document.body.classList.add("ios-chat-fullscreen")}else document.body.classList.remove("chat-fullscreen-active"),document.documentElement.classList.remove("chat-fullscreen-active"),document.body.classList.remove("ios-chat-fullscreen");return()=>{document.body.classList.remove("chat-fullscreen-active"),document.documentElement.classList.remove("chat-fullscreen-active"),document.body.classList.remove("ios-chat-fullscreen")}},[o]),e.jsxs("div",{className:o?"fixed inset-0 z-[50] bg-white flex flex-col chat-fullscreen-container":"w-full h-full flex flex-col","data-chat-container":"true",children:[o&&e.jsxs("div",{className:"flex-shrink-0 px-2 py-3 sm:px-4 sm:py-4 flex !flex-row items-center border-b",style:{paddingTop:"calc(0.75rem + env(safe-area-inset-top, 0px))",height:"calc(4rem + env(safe-area-inset-top, 0px))",background:"linear-gradient(135deg, #2354C7 0%, #3B82F6 100%)"},children:[f&&e.jsxs(N,{variant:"ghost",size:"sm",className:"mr-2 h-8 w-8 p-0 rounded-full text-white hover:bg-[#ff0083]",onClick:f,children:[e.jsx(Ie,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Terug"})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",minHeight:"24px"},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center"},children:e.jsx(H,{size:20,className:"text-white"})}),e.jsx("span",{className:"text-base sm:text-xl font-semibold text-white",children:"Projectdeelnemer
1s"}),d&&e.jsxs("span",{className:"text-xs sm:text-base text-purple-100 ml-2",children:["⢠Project: ",d]})]}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsxs(N,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-full text-white hover:bg-[#ff0083]",onClick:()=>z(!0),children:[e.jsx(me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Projectdeelnemers"})]})})]}),e.jsxs(V,{className:`w-full flex flex-col border-0 shadow-none overflow-hidden ${o?"flex-1":"h-full"}`,children:[!o&&e.jsxs(ve,{className:"px-2 py-3 sm:px-4 sm:py-4 shrink-0 flex !flex-row items-center",style:{background:"linear-gradient(135deg, #2354C7 0%, #3B82F6 100%)"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"row",alignItems:"center",gap:"8px",minHeight:"24px"},children:[e.jsx("div",{style:{display:"inline-flex",alignItems:"center"},children:e.jsx(H,{size:20,className:"text-white"})}),e.jsx("span",{className:"text-base sm:text-xl font-semibold text-white",children:"Projectdeelnemers"}),d&&e.jsxs("span",{className:"text-xs sm:text-base text-purple-100 ml-2",children:["⢠Project: ",d]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs(N,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-full text-white hover:bg-[#ff0083]",onClick:()=>z(!0),children:[e.jsx(me,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Projectdeelnemers"})]}),f&&e.jsxs(N,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 rounded-full text-white hover:bg-[#ff0083]",onClick:()=>{f()},children:[e.jsx(Re,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Volledig scherm"})]})]})]}),e.jsx(Ue,{ref:O,className:"flex-1 px-1 sm:px-4 overflow-auto",children:e.jsxs(F,{className:"pt-0 pb-40 sm:pb-6 min-h-full flex flex-col",children:[e.jsx("div",{className:"flex-1 min-h-0"}),Object.keys(U).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-[150px] sm:h-[200px] text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1 sm:mb-2",children:"Nog geen berichten."}),e.jsx("p",{className:"text-[10px] sm:text-sm text-muted-foreground",children:"Stuur een bericht om de conversatie te starten."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex-grow"}),Object.keys(U).sort().map(t=>{const a=U[t],c=new Date(t),n=[];let l=null;return a.forEach((s,m)=>{const x=s.type==="IMAGE";s.type==="DOCUMENT"||s.fileName,x?l&&l.type==="photo_group"&&l.senderId===s.senderId&&l.senderName===s.senderName?(l.images.push({id:s.id,url:s.fileUrl||s.thumbnailUrl||"",fileName:s.fileName||"Afbeelding"}),l.lastTimestamp=s.sentAt):(l&&n.push(l),l={type:"photo_group",id:`photo_group_${s.id}`,senderId:s.senderId,senderName:s.senderName,senderProfileImage:s.senderProfileImage,senderProfileImageOriginal:s.senderProfileImageOriginal,senderProfileImageZoom:s.senderProfileImageZoom,senderProfileImageX:s.senderProfileImageX,senderProfileImageY:s.senderProfileImageY,timestamp:s.sentAt,lastTimestamp:s.sentAt,images:[{id:s.id,url:s.fileUrl||s.thumbnailUrl||"",fileName:s.fileName||"Afbeelding"}]}):(l&&(n.push(l),l=null),n.push(s))}),l&&n.push(l),e.jsxs("div",{children:[e.jsx(Ge,{date:c}),n.map(s=>{if(s.type==="photo_group"){const m=s.senderId===(r==null?void 0:r.id),x=s.senderName||(m?(r==null?void 0:r.name)||"Jij":"Onbekend"),b=J(s.lastTimestamp),v=x?x.split(" ").map(y=>y[0]).join("").toUpperCase().substring(0,2):"?";return e.jsxs("div",{className:`flex items-start mb-2 ${m?"flex-row-reverse":""} -mx-2`,children:[e.jsx(_,{size:"sm",profileImage:s.senderProfileImage,profileImageOriginal:s.senderProfileImageOriginal,profileImageZoom:s.senderProfileImageZoom,profileImageX:s.senderProfileImageX,profileImageY:s.senderProfileImageY,alt:x,fallback:v,className:`${m?"-mr-2":"-ml-2"} mt-0.5 sm:mt-0.5 sm:mx-0`}),e.jsxs("div",{className:`max-w-[92%] sm:max-w-[75%] md:max-w-[70%] ${m?"mr-1":"ml-1"}`,children:[e.jsx(de,{images:s.images.map(y=>y.url),onOpenGallery:y=>{const g=s.images.map((A,E)=>({id:A.id||E,url:A.url,fileName:A.fileName||A.filename,alt:A.alt||`Afbeelding ${E+1}`}));W(g),Q(y),$(!0)},className:"mb-2"}),e.jsx("div",{className:"flex items-center mt-0.5 justify-start",children:e.jsxs("span",{className:"text-[9px] sm:text-xs text-muted-foreground",children:[x," ⢠",b]})})]})]},s.id)}else if((s.type==="DOCUMENT"||s.fileName)&&s.type!=="IMAGE")try{return e.jsx(Ae,{fileName:s.fileName||"Bestand",fileUrl:s.fileUrl||"",fileType:s.fileType||"application/octet-stream",fileSize:s.fileSize||0,thumbnailUrl:s.thumbnailUrl,message:s.message||s.content,timestamp:s.sentAt,isCurrentUser:s.senderId===(r==null?void 0:r.id),senderName:s.senderName||(s.senderId===(r==null?void 0:r.id)?(r==null?void 0:r.name)||"Jij":"Onbekend"),senderProfileImage:s.senderProfileImage,senderProfileImageOriginal:s.senderProfileImageOriginal,senderProfileImageZoom:s.senderProfileImageZoom,senderProfileImageX:s.senderProfileImageX,senderProfileImageY:s.senderProfileImageY,isOptimistic:s.isOptimistic||!1,uploadProgress:s.uploadProgress||100},s.id)}catch(x){return console.error("â FileMessageBubble render error for message",s.id,":",x),e.jsxs("div",{className:"p-4 bg-red-100 border border-red-300 rounded-lg",children:[e.jsxs("p",{className:"text-red-700",children:["Error rendering file message: ",x instanceof Error?x.message:"Unknown error"]}),e.jsxs("p",{className:"text-sm text-red-600",children:["Message ID: ",s.id]})]},s.id)}else if(s.type==="IMAGE"){const x=s.senderId===(r==null?void 0:r.id),b=s.senderName||(x?(r==null?void 0:r.name)||"Jij":"Onbekend"),v=J(s.sentAt),y=b?b.split(" ").map(g=>g[0]).join("").toUpperCase().substring(0,2):"?";return e.jsxs("div",{className:`flex items-start mb-2 ${x?"flex-row-reverse":""} -mx-2`,children:[e.jsx(_,{size:"sm",profileImage:s.senderProfileImage,profileImageOriginal:s.senderProfileImageOriginal,profileImageZoom:s.senderProfileImageZoom,profileImageX:s.senderProfileImageX,profileImageY:s.senderProfileImageY,alt:b,fallback:y,className:`${x?"-mr-2":"-ml-2"} mt-0.5 sm:mt-0.5 sm:mx-0`}),e.jsxs("div",{className:`max-w-[92%] sm:max-w-[75%] md:max-w-[70%] ${x?"mr-1":"ml-1"}`,children:[e.jsx(de,{images:[s.fileUrl||s.thumbnailUrl||""],onOpenGallery:g=>{W([{id:s.id,url:s.fileUrl||s.thumbnailUrl||"",fileName:s.fileName||"Afbeelding",alt:s.fileName||"Afbeelding"}]),Q(0),$(!0)},className:"mb-2"}),e.jsx("div",{className:"flex items-center mt-0.5 justify-start",children:e.jsxs("span",{className:"text-[9px] sm:text-xs text-muted-foreground",children:[b," ⢠",v]})})]})]},s.id)}else return e.jsx(Be,{id:s.id,projectId:u||0,content:s.message||s.content,timestamp:s.sentAt,isCurrentUser:s.senderId===(r==null?void 0:r.id),senderName:s.senderName||(s.senderId===(r==null?void 0:r.id)?(r==null?void 0:r.name)||"Jij":"Onbekend"),senderProfileImage:s.senderProfileImage,senderProfileImageOriginal:s.senderProfileImageOriginal,senderProfileImageZoom:s.senderProfileImageZoom,senderProfileImageX:s.senderProfileImageX,senderProfileImageY:s.senderProfileImageY},s.id)})]},t)})]})]})}),e.jsx(Pe,{className:"p-2 py-3 sm:p-4 sm:py-5 border-t flex-shrink-0 bg-white",style:{paddingBottom:Y?"0px":o?"calc(1rem + env(safe-area-inset-bottom, 0px))":void 0},children:e.jsxs("form",{onSubmit:ae,className:"flex w-full gap-1 sm:gap-3",children:[e.jsx("input",{ref:ee,type:"file",multiple:!0,accept:"image/*,video/*,audio/*,.pdf,.doc,.docx,.txt,.zip,.rar",onChange:be,style:{display:"none"}}),e.jsx(N,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 sm:h-14 sm:w-14 p-0 sm:p-2 shrink-0",disabled:R||!h,onClick:()=>{var t;return(t=ee.current)==null?void 0:t.click()},children:e.jsx(Se,{className:"h-4 w-4 sm:h-5 sm:w-5"})}),e.jsx(ke,{ref:B,value:M,onChange:t=>L(t.target.value),onKeyDown:Ne,placeholder:"Typ een bericht...",disabled:R||!h,className:"flex-1 h-9 sm:h-14 text-sm sm:text-base px-3 py-2 sm:px-4 sm:py-3"}),e.jsx(N,{type:"submit",size:"icon",className:"h-9 w-9 sm:h-14 sm:w-14 p-0 sm:p-2",disabled:!M.trim()||R||!h,children:e.jsx(ze,{className:"h-4 w-4 sm:h-5 sm:w-5"})})]})})]}),e.jsx(Ee,{images:ge,isOpen:je,onClose:()=>$(!1),initialIndex:we}),ue&&e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:()=>z(!1),children:e.jsxs("div",{className:"bg-white rounded-lg p-6 max-w-md w-full max-h-[80vh] overflow-y-auto",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Projectdeelnemer
1s"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>z(!1),className:"h-8 w-8 p-0",children:e.jsx(Ce,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"space-y-3",children:te.length>0?te.map(t=>{var a;return e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-gray-50",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-pink-100 flex items-center justify-center",children:e.jsx("span",{className:"text-sm font-medium text-pink-700",children:((a=t.name)==null?void 0:a.split(" ").map(c=>c[0]).join("").toUpperCase())||"?"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium text-gray-900 truncate",children:t.name||"Onbekende naam"}),t.phone&&e.jsx("p",{className:"text-sm text-gray-500 truncate",children:t.phone})]})]},t.id)}):e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx(H,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"Geen projectdeelnemers gevonden"})]})})]})})]})}function ns(){const{user:d,isLoading:o}=xe(),f=Te(),p=f.projectId?parseInt(f.projectId):void 0,{data:j,isLoading:S}=pe({queryKey:["api/projects"],enabled:!p&&(d==null?void 0:d.role)==="CUSTOMER",select:T=>{const P=Array.isArray(T)?T:Object.values(T);if(P.length!==0)return P.sort((k,w)=>{const C=k.startDate?new Date(k.startDate).getTime():0;return(w.startDate?new Date(w.startDate).getTime():0)-C})[0]}}),h=p||(j==null?void 0:j.id);return o||S&&(d==null?void 0:d.role)==="CUSTOMER"?e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsx(Me,{className:"h-8 w-8 animate-spin text-primary"})}):d?d.role==="CUSTOMER"?e.jsxs(e.Fragment,{children:[e.jsx(le,{}),e.jsx("main",{className:"flex-1 pt-[64px] pb-16 bg-[#f8f9fa]",children:h?e.jsx(q,{projectId:h,children:e.jsx(fe,{projectId:h})}):e.jsx(V,{className:"flex-1 m-4 lg:m-6 flex items-center justify-center",children:e.jsxs(F,{className:"flex flex-col items-center p-12 text-center",children:[e.jsx(ne,{className:"h-16 w-16 text-gray-300 mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:"Chat"}),e.jsx("p",{className:"text-gray-500 mb-6 max-w-md",children:"U heeft momenteel geen actieve projecten om over te chatten."}),e.jsx(N,{asChild:!0,children:e.jsx(ie,{href:"/",children:"Ga naar Dashboard"})})]})})})]}):e.jsxs("div",{className:"flex flex-col min-h-screen bg-[#f8f9fa]",children:[e.jsx(le,{}),e.jsx("div",{className:"flex-1 flex flex-col pb-20",children:e.jsx("div",{className:"flex-1 flex flex-col h-[calc(100vh-64px)]",children:h?e.jsx(q,{projectId:h,children:e.jsx(fe,{projectId:h})}):e.jsx(V,{className:"flex-1 m-4 lg:m-6 flex items-center justify-center",children:e.jsxs(F,{className:"flex flex-col items-center p-12 text-center",children:[e.jsx(ne,{className:"h-16 w-16 text-gray-300 mb-4"}),e.jsx("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:"Chat"}),e.jsx("p",{className:"text-gray-500 mb-6 max-w-md",children:"Selecteer een project om de chat te starten. Communiceer direct met schilders of klanten over uw projecten."}),e.jsx(N,{asChild:!0,children:e.jsx(ie,{href:"/projects",children:"Ga naar projecten"})})]})})})})]}):null}export{ns as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.