1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[374],{374:function(e,t,r){r.d(t,{Z:function(){return U}});var n=r(2781),s=r.n(n),a=r(4637),l=r(59496),i=r(60499),o=r(39947),c=r(78149),d=r(47936),u=r(23598),x=r.n(u),f=r(41351),h=r(7821),m=r(6481),p=r(33003),g=r(19803),v=r.n(g),y=r(68268),b={src:"/_next/static/media/No Message illustration.883647b6.png",height:230,width:301,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAGCAMAAADJ2y/JAAAAXVBMVEWKov+DtPxhnf9Ymf3E0Pa81PWexv9lofrX6f/D3P+x0f12rv/d7v3G3v6Fs/f7fqDY5/yZiMxuo/iawP3NmMbru9TI3/9cov+It/7/iqbl9/+hyP9xr//JueX4p8L+5h+8AAAAGnRSTlMBexX88kKtMpA1/sH30aL88w/8yUic+wv8a+6st/gAAAAJcEhZcwAACxMAAAsTAQCanBgAAAA5SURBVHicBcEHAoAgDACxQ0ZB3Lgo6v+faQJIPOoKKTr95h38oKd7xwSl3b0unis/dmsTICYEI90PQdMCUPAjhugAAAAASUVORK5CYII="},j=function(e){var t=e.className,r=e.text;(0,y.$G)("common").t;return(0,a.jsxs)("div",{className:v()("flex flex-col items-center",t),children:[(0,a.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,a.jsx)(i.E,{src:b,alt:"text-no-result-found",className:"h-full w-full object-contain"})}),(0,a.jsx)("h3",{className:"my-7 w-full text-center text-xl font-semibold text-body",children:r})]})},w={src:"/_next/static/media/select_a_user.21711030.png",height:257,width:240,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAICAMAAAAC2hU0AAAAZlBMVEXh4ffy8vr//8y9wMDz8/T+/vz////d3vDv8fry8vqIi7bKzOH////////39/mtrrX09PXV1+rW1uOpq9vb3PPo6PeqrOqkpO7O0enFxuLb3OXo6Pf8/f6+wchUXWnt7P/u7/OrrPNq8Vt9AAAAGXRSTlP+twU2fdMS/dH7/fpLluX+xvyE+upmf5uv3fyGAAAAAAlwSFlzAAALEwAACxMBAJqcGAAAAEFJREFUeJwFwQcCgCAMBLBjFnCDqyz1/580gbR6dVrBTnPdqkEkXwIb7FzepXlQbzkz4e6JgAEqfMDjIM/rEGL8AWWrAzXd61tEAAAAAElFTkSuQmCC"},N=function(e){var t=e.className,r=e.text,n=(0,y.$G)("common").t;return(0,a.jsxs)("div",{className:v()("flex flex-col items-center",t),children:[(0,a.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,a.jsx)(i.E,{src:w,alt:n(r||"text-no-result-found"),className:"h-full w-full object-contain"})}),r&&(0,a.jsx)("h3",{className:"my-7 w-full text-center text-xl font-semibold text-body",children:n(r)})]})},k=r(93282);function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function C(e,t,r,n,s,a,l){try{var i=e[a](l),o=i.value}catch(c){return void r(c)}i.done?t(o):Promise.resolve(o).then(n,s)}function M(e){return function(){var t=this,r=arguments;return new Promise((function(n,s){var a=e.apply(t,r);function l(e){C(a,n,s,l,i,"next",e)}function i(e){C(a,n,s,l,i,"throw",e)}l(void 0)}))}}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,s,a=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(o){i=!0,s=o}finally{try{l||null==r.return||r.return()}finally{if(i)throw s}}return a}}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var E=["\ud83d\udc4d","\u2764\ufe0f","\ud83d\ude02","\ud83d\ude2e","\ud83d\ude22","\ud83d\ude4f"];function U(e){var t,r=e.user,n=(0,y.$G)("common").t,u=r.id.toString(),g=L((0,h.KO)(m.I),2),v=g[0],b=g[1];v&&r.id.toString()===(null===(t=v.id)||void 0===t?void 0:t.toString())&&b(null);var w=(0,k.rk)(),A=w.mutate,C=w.isLoading,U=(0,d.lU)(),B=U.chatUsers,I=U.isLoading,P=U.refetch,O=(0,d.p3)().mutate,z=(0,l.useState)(v||""),T=z[0],D=z[1],X=(0,l.useState)([]),W=X[0],V=X[1],F=(0,l.useState)(""),J=F[0],R=F[1],q=(0,l.useState)(null),_=q[0],G=q[1],H=(0,l.useState)(null),K=H[0],Y=H[1],Q=(0,l.useState)(null),Z=Q[0],$=Q[1],ee=(0,l.useState)(null),te=ee[0],re=ee[1],ne=(0,l.useState)(!1),se=ne[0],ae=ne[1],le=(0,l.useState)(!1),ie=le[0],oe=le[1],ce=(0,l.useState)(null),de=ce[0],ue=ce[1];(0,l.useEffect)((function(){if(T){var e=(0,o.IO)((0,o.hJ)(c.db,"users",r.id.toString(),"chatUsers",T.id.toString(),"messages"),(0,o.Xo)("createdAt","desc"),(0,o.b9)(50)),t=(0,o.cf)(e,(function(e){P(),V(e.docs.reverse().map((function(e){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"===typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}
1)))),n.forEach((function(t){S(e,t,r[t])}))}return e}({id:e.id},e.data())})))}));return function(){t()}}}),[T]);var xe=function(e){if(!(null===e||void 0===e?void 0:e.lastMessageTime))return!0;var t=x()(e.lastMessageTime),r=x()();return!t.isSame(r,"day")},fe=function(){var e=M(s().mark((function e(){var t,n,a,l,i,o,c,x,f;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=J,!de){e.next=4;break}return be(t),e.abrupt("return");case 4:if(!K){e.next=12;break}if(n=K,R(""),Y(null),""===t.trim()){e.next=11;break}return e.next=11,(0,d.Hd)(u,T.id,n.messageId,t);case 11:return e.abrupt("return");case 12:if(c=_?{messageId:null!==(a=_.messageId)&&void 0!==a?a:"",messageBody:null!==(l=_.messageBody)&&void 0!==l?l:"",type:null!==(i=_.type)&&void 0!==i?i:"text",srcUserId:null!==(o=_.srcUserId)&&void 0!==o?o:""}:null,R(""),G(null),"",x=B.find((function(e){return e.id==T.id})),f=xe(x),e.prev=19,!r||!T||""===t.trim()){e.next=25;break}return e.next=23,(0,d.Xq)(r.id,T.id,t,"text","",c);case 23:e.sent&&f&&O({userId:null===T||void 0===T?void 0:T.id});case 25:e.next=29;break;case 27:e.prev=27,e.t0=e.catch(19);case 29:case"end":return e.stop()}}),e,null,[[19,27]])})));return function(){return e.apply(this,arguments)}}(),he=function(){var e=M(s().mark((function e(t){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:D(t),me();case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),me=function(){var e=M(s().mark((function e(){var t,n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(null===r||void 0===r?void 0:r.id)||!(null===T||void 0===T?void 0:T.id)){e.next=4;break}return t=(0,o.IO)((0,o.hJ)(c.db,"users",r.id.toString(),"chatUsers",T.id.toString(),"messages"),(0,o.Xo)("createdAt","desc"),(0,o.b9)(1)),n=(0,o.cf)(t,(function(e){try{if(e.docs.length&&e.docs[0].data().srcUserId!==r.id.toString()){var t=(0,o.JU)(c.db,"users",r.id.toString(),"chatUsers",T.id.toString(),"messages",e.docs[0].id);(0,o.r7)(t,{seen:!0}).then((function(){n(),P()})).catch((function(e){console.error("Error updating document:",e)}))}else n()}catch(s){console.error("Error updating document:",s),n()}})),e.abrupt("return",(function(){return n()}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,l.useEffect)((function(){var e=document.getElementById("message-container");e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}),[W]),(0,l.useEffect)((function(){var e=function(){$(null),re(null),ae(!1)};return document.addEventListener("click",e),function(){return document.removeEventListener("click",e)}}),[]);var pe,ge=l.useRef(null),ve=function(){var e=M(s().mark((function e(t,n,a){var l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(R(""),l=xe(r),e.prev=2,!r||!T||""===t.trim()){e.next=8;break}return e.next=6,(0,d.Xq)(r.id,T.id,t,n,a);case 6:e.sent&&l&&O({userId:null===T||void 0===T?void 0:T.id});case 8:e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t,r,n){return e.apply(this,arguments)}}(),ye=function(){(null===de||void 0===de?void 0:de.previewUrl)&&URL.revokeObjectURL(de.previewUrl),ue(null)},be=function(e){if(de){var t=de.file,n=de.fileType;ye(),R(""),A([t],{onSuccess:function(){var t=M(s().mark((function t(a){var l;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!a){t.next=7;break}return l=a.data,t.next=4,ve(a.data,n,l);case 4:if(""===e.trim()){t.next=7;break}return t.next=7,(0,d.Xq)(r.id,T.id,e,"text","");case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})}},je=function(){var e=M(s().mark((function e(t,r){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return re(null),e.next=3,(0,d.Pi)(u,T.id,t.messageId,r);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),we=function(){var e=M(s().mark((function e(t){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $(null),e.next=3,(0,d.D0)(u,T.id,t.id);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ne=function(){var e=M(s().mark((function e(t){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return $(null),e.next=3,(0,d.TZ)(u,T.id,t.messageId);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ke=function(){var e=M(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(oe(!1),null===T||void 0===T?void 0:T.id){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,(0,d.hB)(u,T.id);case 5:D(""),V([]),P();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Ae=function(e){$(null),Y(null),G(e)},Ce=function(e){return e&&e.includes("https://")&&e.split("/").length&&e.split("/")[e.split("/").length-1]},Me=function(e){return e?"text"===e.type?e.messageBody:"image"===e.type?"\ud83d\udcf7 Photo":"video"===e.type?"\ud83c\udfa5 Video":"audio"===e.type?"\ud83c\udfa7 Audio":"\ud83d\udcce Attachment":""},Se=function(e){if(e.deleted)return(0,a.jsx)("span",{className:"italic opacity-70",children:n("messageDeleted")});switch(e.type){case"text":return(0,a.jsx)("span",{className:"whitespace-pre-wrap break-words",children:e.messageBody});
1case"image":return(0,a.jsx)("img",{src:e.fileUrl,alt:e.messageBody,className:"block h-auto w-[200px] max-w-full rounded-lg"});case"video":return(0,a.jsx)("video",{controls:!0,className:"block h-auto max-w-full rounded-lg",children:(0,a.jsx)("source",{src:e.fileUrl,type:"video/mp4"})});case"audio":return(0,a.jsx)("audio",{controls:!0,className:"block h-auto max-w-full",children:(0,a.jsx)("source",{src:e.fileUrl,type:"audio/mpeg"})});case"pdf":case"document":return(0,a.jsxs)("a",{href:e.fileUrl,target:"_blank",rel:"noopener noreferrer",download:Ce(e.messageBody)||!0,className:"flex items-center gap-2 underline",children:[(0,a.jsx)("svg",{className:"h-5 w-5 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),(0,a.jsx)("span",{className:"truncate",children:Ce(e.messageBody)}),(0,a.jsx)("svg",{className:"h-4 w-4 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})]});default:return null}},Le=function(e){var t,r=null!==(t=e.reactions)&&void 0!==t?t:{},n=Object.values(r);if(!n.length)return null;var s,l={};return n.forEach((function(e){return l[e]=(null!==(s=l[e])&&void 0!==s?s:0)+1})),(0,a.jsx)("div",{className:"-mt-1 flex w-fit items-center gap-0.5 rounded-full border border-gray-200 bg-white px-1.5 py-0.5 text-xs shadow-sm",children:Object.entries(l).map((function(e){var t=L(e,2),r=t[0],n=t[1];return(0,a.jsxs)("span",{children:[r,n>1?n:""]},r)}))})},Ee=function(e){var t=e.message,r=e.isMine,s=e.canDeleteForEveryone,l=te===t.id,i=Z===t.id;return(0,a.jsxs)("div",{className:"relative flex items-center gap-0.5 opacity-0 transition group-hover:opacity-100",onClick:function(e){return e.stopPropagation()},children:[(0,a.jsx)("button",{type:"button",className:"rounded-full p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",onClick:function(){$(null),re(l?null:t.id)},title:n("react"),children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.828 14.828a4 4 0 01-5.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),(0,a.jsx)("button",{type:"button",className:"rounded-full p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",onClick:function(){return Ae(t)},title:n("reply"),children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 10h10a8 8 0 018 8v2M3 10l6 6m-6-6l6-6"})})}),(0,a.jsx)("button",{type:"button",className:"rounded-full p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600",onClick:function(){re(null),$(i?null:t.id)},title:n("more"),children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{d:"M6 10a2 2 0 11-4 0 2 2 0 014 0zM12 10a2 2 0 11-4 0 2 2 0 014 0zM16 12a2 2 0 100-4 2 2 0 000 4z"})})}),l&&(0,a.jsx)("div",{className:"absolute bottom-9 z-20 flex items-center gap-1 rounded-full border border-gray-200 bg-white px-2 py-1 shadow-lg ".concat(r?"right-0":"left-0"),children:E.map((function(e){return(0,a.jsx)("button",{type:"button",className:"text-lg transition hover:scale-125",onClick:function(){return je(t,e)},children:e},e)}))}),i&&(0,a.jsxs)("div",{className:"absolute top-9 z-20 w-44 overflow-hidden rounded-lg border border-gray-200 bg-white py-1 text-sm shadow-lg ".concat(r?"right-0":"left-0"),children:[(0,a.jsx)("button",{type:"button",className:"block w-full px-4 py-2 text-left hover:bg-gray-100",onClick:function(){return Ae(t)},children:n("reply")}),r&&"text"===t.type&&(0,a.jsx)("button",{type:"button",className:"block w-full px-4 py-2 text-left hover:bg-gray-100",onClick:function(){return function(e){var t;$(null),G(null),Y(e),R(null!==(t=e.messageBody)&&void 0!==t?t:"")}(t)},children:n("edit")}),(0,a.jsx)("button",{type:"button",className:"block w-full px-4 py-2 text-left text-red-600 hover:bg-gray-100",onClick:function(){return we(t)},children:n("deleteForMe")}),s&&(0,a.jsx)("button",{type:"button",className:"block w-full px-4 py-2 text-left text-red-600 hover:bg-gray-100",onClick:function(){return Ne(t)},children:n("deleteForEveryone")})]})]})},Ue=function(e){var t=e.message,r=t.srcUserId===u,s=r&&!t.deleted&&!!t.messageId;return(0,a.jsx)("li",{className:"flex ".concat(r?"justify-end":"justify-start"),children:(0,a.jsxs)("div",{className:"group relative flex max-w-[75%] flex-col ".concat(r?"items-end":"items-start"),children:[t.replyTo&&(0,a.jsx)("div",{className:"mb-1 max-w-full rounded-lg border-l-4 px-3 py-1 text-xs ".concat(r?"border-[#000066]/40 bg-[#000066]/10 text-gray-600":"border-[#000066] bg-gray-100 text-gray-600"),children:(0,a.jsx)("p",{className:"truncate opacity-80",children:Me(t.replyTo)})}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[r&&!t.deleted&&(0,a.jsx)(Ee,{message:t,isMine:r,canDeleteForEveryone:s}),(0,a.jsx)("div",{className:"relative rounded-2xl px-4 py-2 text-sm shadow-sm ".concat(r?"rounded-br-md bg-[#000066] text-white":"rounded-bl-md border border-gray-200 bg-white text-gray-800"),children:Se(t)}),!r&&!t.deleted&&(0,a.jsx)(Ee,{message:t,isMine:r,canDeleteForEveryone:s})]}),Le(t),(0,a.jsxs)("span",{className:"mt-0.5 text-[11px] text-gray-400 ".concat(r?"text-right":"text-left"),children:[x()(t.createdAt).format("DD.MM.YYYY hh:mm a"),t.edited&&!t.deleted?" \xb7 ".concat(n("edited")):"",r&&!t.deleted&&t.seen?" \xb7 Seen":""]})]})})};return(0,a.jsxs)("div",{className:"container mx-auto overflow-hidden rounded-xl border border-gray-200 bg-white shadow-md",children:[(0,a.jsxs)("div",{className:"min-w-full lg:grid lg:grid-cols-3",children:[(0,a.jsxs)("div",{className:"border-r border-gray-200 bg-gray-50 lg:col-span-1",children:[(0,a.jsx)("div",{className:"border-b border-gray-200 px-4 py-4",children:(0,a.jsx)("h2",{className:"text-lg font-bold text-gray-800",children:n("message")})}),(0,a.jsx)("ul",{className:"h-[calc(100vh-300px)] overflow-auto",children:I?(0,a.jsx)("div",{className:"p-4 text-center text-sm text-gray-400",children:n("text-loading")}):(0,a.jsxs)(a.Fragment,{children:[v&&!B.find((function(e){var t;return e.id.toString()===(null===(t=v.id)||void 0===t?void 0:t.toString())}))&&(0,a.jsxs)("li",{onClick:function(){return he(v)},className:"flex cursor-pointer items-center gap-3 border-b border-gray-100 px-4 py-3 transition hover:bg-white",children:[(0,a.jsx)(i.E,{src:null!==(pe=null===v||void 0===v?void 0:v.profile_photo)&&void 0!==pe?pe:f.Pb,alt:"receiver photo",width:44,height:44,className:"h-11 w-11 rounded-full object-cover"}),(0,a.jsx)("span",{className:"font-semibold text-gray-700",children:v.name})]},v.id),(null===B||void 0===B?void 0:B.length)>0&&B.map((function(e){var t=(null===T||void 0===T?void 0:T.id)===(null===e||void 0===e?void 0:e.id),r="boolean"===typeof e.seen&&!1===e.seen;return(0,a.jsxs)("li",{onClick:function(){return he(e)},className:"flex cursor-pointer items-center gap-3 border-b border-gray-100 px-4 py-3 transition hover:bg-white ".concat(t?"bg-white":""),children:[(0,a.jsx)(i.E,{src:(null===e||void 0===e?void 0:e.profile_photo)?(0,p.J)(null===e||void 0===e?void 0:e.profile_photo):f.Pb,alt:"user photo",width:44,height:44,className:"h-11 w-11 rounded-full object-cover"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"truncate font-semibold text-gray-800",children:e.name}),(0,a.jsx)("span",{className:"shrink-0 text-[11px] text-gray-400",children:e.lastMessageTime?x()(e.lastMessageTime).format("MMM D"):""})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"truncate text-sm ".concat(r?"font-semibold text-gray-800":"text-gray-500"),children:(null===e||void 0===e?void 0:e.type)&&["pdf","image","video","audio"].includes(e.type)?"\ud83d\udcce Attachment":e.lastMessage}),r&&(0,a.jsx)("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full bg-[#000066]"})]})]})]},e.id)}))]})})]}),(0,a.jsx)("div",{className:"lg:col-span-2",children:T?(0,a.jsxs)("div",{className:"flex h-[calc(100vh-236px)] w-full flex-col",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 border-b border-gray-200 px-5 py-3",onClick:me,children:[(0,a.jsx)(i.E,{src:(null===T||void 0===T?void 0:T.profile_photo)?(0,p.J)(null===T||void 0===T?void 0:T.profile_photo):f.Pb,alt:"receiver photo",width:40,height:40,className:"h-10 w-10 rounded-full object-cover"}),(0,a.jsx)("span",{className:"font-bold text-gray-800",children:null===T||void 0===T?void 0:T.name}),(0,a.jsxs)("div",{className:"relative ml-auto",onClick:function(e){return e.stopPropagation()},children:[(0,a.jsx)("button",{type:"button",className:"rounded-full p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600",onClick:function(){return ae((function(e){return!e}))},title:n("more"),children:(0,a.jsx)("svg",{className:"h-5 w-5",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"})})}),se&&(0,a.jsx)("div",{className:"absolute right-0 top-11 z-20 w-52 overflow-hidden rounded-lg border border-gray-200 bg-white py-1 text-sm shadow-lg",children:(0,a.jsx)("button",{type:"button",className:"block w-full px-4 py-2 text-left text-red-600 hover:bg-gray-100",onClick:function(){ae(!1),(null===T||void 0===T?void 0:T.id)&&oe(!0)},children:n("deleteChatHistory")})})]})]}),(0,a.jsx)("div",{className:"relative flex-1 overflow-y-auto bg-gray-50 p-5",id:"message-container",onClick:me,children:W.length>0?(0,a.jsx)("ul",{className:"space-y-3",children:W.map((function(e){return(0,a.jsx)(Ue,{message:e},e.id)}))}):(0,a.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,a.jsx)("span",{className:"text-gray-400",children:n("no-messages")})})}),K&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-gray-200 bg-gray-50 px-5 py-2",children:[(0,a.jsxs)("div",{className:"min-w-0 border-l-4 border-[#000066] pl-3",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-[#000066]",children:n("editingMessage")}),(0,a.jsx)("p",{className:"truncate text-sm text-gray-500",children:K.messageBody})]}),(0,a.jsx)("button",{type:"button",onClick:function(){Y(null),R("")},className:"rounded-full p-1 text-gray-400 hover:bg-gray-200",children:(0,a.jsx)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),_&&!K&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-gray-200 bg-gray-50 px-5 py-2",children:[(0,a.jsxs)("div",{className:"min-w-0 border-l-4 border-[#000066] pl-3",children:[(0,a.jsxs)("p",{className:"text-xs font-semibold text-[#000066]",children:[n("replyingTo")," ",_.srcUserId===u?n("you"):null===T||void 0===T?void 0:T.name]}),(0,a.jsx)("p",{className:"truncate text-sm text-gray-500",children:Me(_)})]}),(0,a.jsx)("button",{type:"button",onClick:function(){return G(null)},className:"rounded-full p-1 text-gray-400 hover:bg-gray-200",children:(0,a.jsx)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),de&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-gray-200 bg-gray-50 px-5 py-2",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:["image"===de.fileType?(0,a.jsx)("img",{src:de.previewUrl,alt:de.name,className:"h-12 w-12 rounded-lg object-cover"}):(0,a.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg bg-gray-200 text-gray-500",children:(0,a.jsx)("svg",{className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate text-sm font-medium text-gray-700",children:de.n
1ame}),(0,a.jsx)("p",{className:"text-xs capitalize text-gray-400",children:C?n("text-loading"):de.fileType})]})]}),(0,a.jsx)("button",{type:"button",onClick:ye,className:"rounded-full p-1 text-gray-400 hover:bg-gray-200",children:(0,a.jsx)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),(0,a.jsxs)("div",{className:"flex w-full items-center gap-2 border-t border-gray-200 px-4 py-3",children:[(0,a.jsx)("button",{type:"button",className:"rounded-full p-2 text-gray-400 hover:bg-gray-100 hover:text-gray-600",onClick:function(){var e;return null===(e=ge.current)||void 0===e?void 0:e.click()},children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:"2",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l7-7a4 4 0 10-5.656-5.656L4.929 10.344a6 6 0 108.485 8.485L17 13"})})}),(0,a.jsx)("input",{type:"file",ref:ge,className:"hidden",accept:"application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, text/plain, application/pdf, image/*",onChange:function(e){var t=e.target.files[0];if(t){var r="document";t.type.startsWith("image/")?r="image":t.type.startsWith("video/")?r="video":t.type.startsWith("audio/")?r="audio":"application/pdf"===t.type&&(r="pdf"),ue({file:t,fileType:r,name:t.name,previewUrl:"image"===r?URL.createObjectURL(t):""}),e.target.value=""}}}),(0,a.jsx)("input",{value:J,onChange:function(e){return R(e.target.value)},type:"text",placeholder:n("typeMessage"),className:"block w-full rounded-full border-0 bg-gray-100 px-4 py-3 outline-none focus:text-gray-700 focus:ring-2 focus:ring-[#000066]/30",name:"message",onKeyDown:function(e){"Enter"===e.key&&fe()}}),(0,a.jsx)("button",{type:"button",className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-[#000066] text-white transition hover:bg-[#000088] disabled:opacity-40",onClick:fe,disabled:C||""===J.trim()&&!de,children:(0,a.jsx)("svg",{className:"h-5 w-5 origin-center rotate-90 transform",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.jsx)("path",{d:"M10.894 2.553a1 1 0 00-1.788 0l-7 14a1 1 0 001.169 1.409l5-1.429A1 1 0 009 15.571V11a1 1 0 112 0v4.571a1 1 0 00.725.962l5 1.428a1 1 0 001.17-1.408l-7-14z"})})})]})]}):(null===B||void 0===B?void 0:B.length)>0?(0,a.jsx)("div",{className:"flex h-[calc(100vh-236px)] w-full items-center justify-center",children:(0,a.jsx)(N,{text:n("selectUserToChat"),className:"w-12/12 mx-auto mt-10"})}):(0,a.jsx)("div",{className:"flex h-[calc(100vh-236px)] w-full items-center justify-center",children:(0,a.jsx)(j,{text:n("no-conversation"),className:"w-12/12 mx-auto mt-10"})})})]}),ie&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",onClick:function(){return oe(!1)},children:(0,a.jsxs)("div",{className:"w-full max-w-sm rounded-xl bg-white p-6 shadow-xl",onClick:function(e){return e.stopPropagation()},children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-800",children:n("deleteChatHistory")}),(0,a.jsx)("p",{className:"mt-2 text-sm text-gray-500",children:n("deleteChatHistoryConfirm")}),(0,a.jsxs)("div",{className:"mt-6 flex justify-end gap-3",children:[(0,a.jsx)("button",{type:"button",className:"rounded-lg border border-gray-300 px-5 py-2 text-sm font-medium text-gray-700 transition hover:bg-gray-100",onClick:function(){return oe(!1)},children:n("text-cancel")}),(0,a.jsx)("button",{type:"button",className:"rounded-lg bg-red-600 px-5 py-2 text-sm font-medium text-white transition hover:bg-red-700",onClick:ke,children:n("yes")})]})]})})]})}},6481:function(e,t,r){r.d(t,{I:function(){return n}});var n=(0,r(7821).cn)(null)},33003:function(e,t,r){function n(e){return e&&-1!==e.indexOf("http://:")?e.replace("http://:","http://"):e||""}r.d(t,{J:function(){return n}})}}]);
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.