PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/chats-699e29613cf325c9.js

js lidomatrip.com collected 2026-09-25 07:11:53 UTC 10,658 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7044],{51568:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/chats",function(){return n(70341)}])},70341:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return S},default:function(){return E}});var r=n(85893),a=n(26042),i=n(69396),s=n(10253),l=n(36305),c=n(67294),d=n(11163),o=n(85945),u=n(36492),m=n(70530),x=n(91879),f=n(31138),h=n(89987),p=n(47416),g=n(83888),v=n(41664),y=n.n(v),b=n(68220),j=n(63871),_=n(34051),N=n(79121),w=n(25675),F=n.n(w),k=n(56050),Z=function(e){var t=e.items,n=e.selectedId,a=e.onSelect,i=(0,N.A)(),s=function(e){var t;return"SUPPORT"===e.type?null:(0,N.d)(i,null===(t=e.peer)||void 0===t?void 0:t.id)};return 0===t.length?(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-24 py-40 text-center",children:[(0,r.jsx)("span",{className:"flex h-64 w-64 items-center justify-center rounded-full bg-gray-F8F8F8",children:(0,r.jsx)("i",{"aria-hidden":"true",className:"icon-message text-28 text-gray-CACFD3"})}),(0,r.jsx)("p",{className:"mt-16 text-14 leading-24 font-m text-black",children:"هنوز چتی ندارید"}),(0,r.jsx)("p",{className:"mt-4 text-12 leading-20 font-r text-gray-77828F",children:"با ثبت اولین رزرو، چت با میزبان همین‌جا باز می‌شود."})]}):(0,r.jsx)("ul",{className:"flex flex-col gap-y-8 py-4",children:t.map(function(e,t){var i,l,c,d,o,u,m=e.id===n,x="SUPPORT"===e.type,f=x?e.subject||"پشتیبانی لیدوماتریپ":(null===(i=e.peer)||void 0===i?void 0:i.name)||"کاربر لیدوماتریپ";return(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",onClick:function(){return a(e.id)},"aria-current":m?"true":void 0,className:"flex w-full items-start gap-x-12 rounded-16 border-1 border-solid px-14 py-12 text-right transition-[background-color,border-color,transform] duration-150 ease-out active:scale-[0.99] ".concat(m?"border-primary-main bg-primary-light bg-opacity-40":e.unread_count>0?"border-gray-F0F0F0 bg-white shadow-[0_1px_3px_rgba(24,39,58,0.06)]":"border-gray-F0F0F0 bg-white hover:bg-gray-F8F8F8"),children:[(0,r.jsxs)("span",{className:"relative shrink-0",children:[(0,r.jsx)("span",{className:"flex h-46 w-46 items-center justify-center overflow-hidden rounded-full bg-gray-F8F8F8 ring-1 ring-white",children:x?(0,r.jsx)("i",{"aria-hidden":"true",className:"icon-OnlineContact text-20 text-primary-dark"}):(null===(l=e.peer)||void 0===l?void 0:l.avatar)||(null===(c=e.residence)||void 0===c?void 0:c.image)||s(e)?(0,r.jsx)(F(),{src:(null===(d=e.peer)||void 0===d?void 0:d.avatar)||(null===(o=e.residence)||void 0===o?void 0:o.image)||(null===(u=s(e))||void 0===u?void 0:u.url),alt:"",width:46,height:46,className:"h-full w-full object-cover"}):(0,r.jsx)("i",{"aria-hidden":"true",className:"icon-Profile text-20 text-gray-A9B1BC"})}),e.unread_count>0&&(0,r.jsx)("span",{"aria-hidden":"true",className:"absolute -left-1 -top-1 h-12 w-12 rounded-full border-2 border-solid border-white bg-primary-main"})]}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("span",{className:"flex items-center justify-between gap-x-8",children:[(0,r.jsx)("span",{className:"truncate text-14 leading-22 ".concat(e.unread_count>0?"font-b text-black":"font-m text-black"),children:f}),(0,r.jsx)("span",{className:"shrink-0 text-11 leading-16 font-r text-gray-A9B1BC",children:(0,k.vs)(e.last_message_at)})]}),e.residence&&!x&&(0,r.jsx)("span",{className:"mt-3 block truncate text-11 leading-18 font-r text-gray-A9B1BC",children:e.residence.name}),(0,r.jsxs)("span",{className:"mt-6 flex items-center justify-between gap-x-8",children:[(0,r.jsx)("span",{className:"truncate text-12 leading-20 ".concat(e.unread_count>0?"font-m text-black":"font-r text-gray-77828F"),children:e.last_message||"…"}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-x-6",children:[e.is_muted&&(0,r.jsx)("i",{"aria-hidden":"true",title:"بی‌صدا",className:"icon-BellFill text-14 text-gray-CACFD3"}),e.unread_count>0&&(0,r.jsxs)("span",{className:"flex h-20 min-w-[20px] items-center justify-center rounded-full bg-primary-main px-6 text-11 leading-16 font-b text-black",children:[e.unread_count.toLocaleStr
1ing("fa-IR"),(0,r.jsx)("span",{className:"sr-only",children:" پیام خوانده‌نشده"})]})]})]})]})]})},e.id)})})},C=function(){var e,t,n,v,N,w=(0,d.useRouter)(),F=(0,o.NL)(),k=(0,x.Gr)(),C=null!==(v=null==k?void 0:k.id)&&void 0!==v?v:0,S=(0,f.a)("(min-width: 1024px)"),E=(0,s.Z)((0,c.useState)(!1),2),I=E[0],P=E[1],L=(t=(e=(0,s.Z)((0,c.useState)(null),2))[0],n=e[1],(0,c.useEffect)(function(){var e=window.visualViewport,t=function(){return n(Math.round(e?e.height:window.innerHeight))};return(t(),e)?(e.addEventListener("resize",t),e.addEventListener("scroll",t),function(){e.removeEventListener("resize",t),e.removeEventListener("scroll",t)}):(window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)})},[]),t),B=(0,s.Z)((0,c.useState)("all"),2),O=B[0],q=B[1],T=(0,s.Z)((0,c.useState)(null),2),A=T[0],z=T[1],D="string"==typeof w.query.c?w.query.c:null,Q=(0,c.useCallback)(function(e){var t=(0,a.Z)({},w.query);e?t.c=e:delete t.c,w.push({pathname:w.pathname,query:t},void 0,{shallow:!0})},[w]),R=(0,u.a)({queryKey:["conversations","all"],queryFn:function(){return(0,m.uv)({take:50})},refetchInterval:!!I&&15e3}),U=R.data,K=R.isLoading,H=(0,c.useMemo)(function(){return null!==(N=null==U?void 0:U.items)&&void 0!==N?N:[]},[U]),M=(0,c.useCallback)(function(e){var t,n=null===(t=e.data)||void 0===t?void 0:t.conversation_id;if(n){if("message"===e.type){var r=e.data.message;F.setQueryData(["messages",n],function(e){return e?e.items.some(function(e){return e.id===r.id||!!e.client_nonce&&e.client_nonce===r.client_nonce})?(0,i.Z)((0,a.Z)({},e),{items:e.items.map(function(e){return e.client_nonce&&e.client_nonce===r.client_nonce?r:e})}):(0,i.Z)((0,a.Z)({},e),{items:(0,l.Z)(e.items).concat([r])}):e}),F.invalidateQueries({queryKey:["conversations"]}),r.sender_id!==C&&F.invalidateQueries({queryKey:["chat-unread"]});return}if("read"===e.type){F.setQueryData(["conversation",n],function(t){return t&&e.data.reader_id!==C?(0,i.Z)((0,a.Z)({},t),{peer_last_read_message_id:e.data.last_read_message_id}):t});return}if("typing"===e.type){z({conversationId:n,userId:e.data.user_id});return}"message-deleted"===e.type&&F.setQueryData(["messages",n],function(t){return t?(0,i.Z)((0,a.Z)({},t),{items:t.items.map(function(t){return t.id===e.data.message_id?(0,i.Z)((0,a.Z)({},t),{deleted:!0,body:""}):t})}):t})}},[C,F]);(0,h.Q)(!!C,M,P),(0,c.useEffect)(function(){if(A){var e=setTimeout(function(){return z(null)},4e3);return function(){return clearTimeout(e)}}},[A]);var X=H.filter(function(e){return"SUPPORT"===e.type}),Y=H.filter(function(e){return"SUPPORT"!==e.type}),G=X.reduce(function(e,t){return e+t.unread_count},0),V=!!D;return(0,r.jsxs)("div",{className:"pb-40 md:pb-0",children:[(S||!V)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.Z,{title:"چت",icon:(0,r.jsx)("i",{"aria-hidden":"true",className:"icon-message text-24"}),containerClassname:"mb-16"}),(0,r.jsx)("div",{className:"mb-16 md:mb-24",children:(0,r.jsx)(g.Z,{activeIndex:"support"===O?1:0,onChange:function(e){q(1===e?"support":"all"),Q(null)},data:[{tabLabel:Y.length?"".concat((null==k?void 0:k.is_host)?"مهمانان":"همه"," (").concat((0,b.YS)(Y.length),")"):(null==k?void 0:k.is_host)?"مهمانان":"همه",tabIndex:0},{tabLabel:(0,r.jsxs)("span",{className:"flex items-center gap-x-6",children:["پشتیبانی",G>0&&(0,r.jsx)("span",{className:"flex h-18 min-w-[18px] items-center justify-center rounded-full bg-primary-main px-4 text-10 leading-14 font-b text-black",children:(0,b.YS)(G)})]}),tabIndex:1}]})})]}),(0,r.jsxs)("div",{style:V&&!S&&L?{height:L-(L<window.innerHeight-80?0:59)}:void 0,className:"grid grid-cols-1 ".concat(V&&!S?"fixed inset-x-0 top-0 z-6 h-[100dvh]":"h-[calc(100dvh-252px)]"," overflow-hidden bg-white md:static md:z-auto md:h-[calc(100vh-280px)] md:min-h-[420px] md:rounded-24 md:border-1 md:border-solid md:border-gray-F0F0F0 md:shadow-[0_1px_3px_rgba(24,39,58,0.05)] md:grid-cols-[360px_1fr]"),children:[(S||!V)&&(0,r.jsx)("div",{className:"min-h-0 overflow-y-auto md:border-l-1 md:border-solid md:border-gray-F0F0F0",children:K?(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)(j.O,{})}):(0,r.jsx)(r.Fragment,{children:"support"===O&&0===X.length?(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center px-24 py-40 text-center",children:[(0,r.jsx)("span",{className:"flex h-64 w-64 items-center justify-center rounded-full bg-gray-F8F8F8",children:(0,r.jsx)("i",{"aria-hidden":"true",className:"icon-OnlineContact text-28 text-primary-main"})}),(0,r.jsx)("p",{className:"mt-16 text-14 leading-24 font-m text-black",children:"هنوز گفتگویی با پشتیبانی ندارید"}),(0,r.jsx)("p",{className:"mt-4 text-12 leading-20 font-r text-gray-77828F",children:"اگر سوالی دارید، از همین‌جا شروع کنید."}),(0,r.jsx)(y(),{href:"/support",prefetch:!1,className:"mt-16 inline-flex h-40 items-center rounded-10 bg-primary-main px-16 text-13 leading-20 font-m text-black transition-transform active:scale-[0.97]",children:"چت با پشتیبانی"})]}):(0,r.jsx)(Z,{items:"support"===O?X:Y,selectedId:D,onSelect:Q})})}),V?(0,r.jsx)(_.Z,{conversationId:D,meId:C,isDesktop:S,typingFrom:(null==A?void 0:A.conversationId)===D?A.userId:null,onBack:function(){return Q(null)}},D):S&&(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center bg-gray-F8F8F8 px-24 text-center",children:[(0,r.jsx)("span",{className:"flex h-72 w-72 items-center justify-center rounded-full bg-white shadow-[0_1px_3px_rgba(24,39,58,0.06)]",children:(0,r.jsx)("i",{"aria-hidden":"true",className:"icon-message text-32 text-primary-main"})}),(0,r.jsx)("p",{className:"mt-16 text-15 leading-24 font-b text-black",children:"یک چت را از فهرست انتخاب کنید"}),(0,r.jsx)("p",{className:"mt-4 text-12 leading-20 font-r text-gray-77828F",children:"پیام‌های شما با میزبان‌ها و پشتیبانی همین‌جا جمع می‌شود."})]})]}),I&&(0,r.jsx)("p",{className:"mt-8 text-center text-11 leading-18 font-r text-gray-A9B1BC",children:"اتصال زنده برقرار نشد؛ پیام‌ها هر چند ثانیه به‌روز می‌شوند."})]})},S=!0,E=function(){return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(C,{})})}}},function(e){e.O(0,[8220,3776,9774,2888,179],function(){return e(e.s=51568)}),_N_E=e.O()}]);

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.