1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7773],{47773:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return eg}});var o=n(57437),r=n(2265);let s=(0,r.createContext)({comments:[],setComments:()=>{},pagination:void 0,setPagination:()=>{},commentsCount:0,setCommentsCount:()=>{},commentError:"",setCommentError:()=>{},lastOpenedFormTime:0,setLastOpenedFormTime:()=>{},theme:""});function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return e.map(e=>{let n=[...e.replies];return n.length>t&&(n.length=t),{...e,replies:n}})}var i=n(44909);let l=null,c=e=>{let{limit:t=5,page:n=1,postId:o,order:r="desc"}=e,s=encodeURIComponent("post_id:".concat(o,"+status:-deleted"));l&&n>1&&(s=encodeURIComponent("post_id:".concat(o,"+created_at:<=").concat(l,"+status:-deleted"))),l=null!=l?l:new Date().toISOString();let a="asc"===r?encodeURIComponent("created_at ASC, id ASC"):encodeURIComponent("created_at DESC, id DESC"),c=(0,i.Ky)({type:"members",resource:"comments",params:"?limit=".concat(t,"&filter=").concat(s,"&page=").concat(n,"&order=").concat(a)});return(0,i.$f)({url:c,method:"GET",headers:{"Content-Type":"application/json"}}).then(function(e){if(e.ok)return e.json();throw Error("Failed to fetch comments")})},m=e=>{let{comment:t}=e,n=(0,i.Ky)({type:"members",resource:"comments"});return(0,i.$f)({url:n,method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:[t]})}).then(function(e){if(e.ok)return e.json();if("Too Many Requests"===e.statusText)throw Error("Too Many Requests");throw Error("Failed to add comment")})},u=e=>{let{comment:t}=e,n=(0,i.Ky)({type:"members",resource:"comments/".concat(t.id)});return(0,i.$f)({url:n,method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:[t]})}).then(function(e){if(e.ok)return e.json();throw Error("Failed to edit comment")})},d=e=>{let{commentId:t}=e,n=(0,i.Ky)({type:"members",resource:"comments/".concat(t,"/like")});return(0,i.$f)({url:n,method:"POST",headers:{"Content-Type":"application/json"}}).then(function(e){if(e.ok)return"Success";throw Error("Failed to like comment")})},p=e=>{let{comment:t}=e,n=(0,i.Ky)({type:"members",resource:"comments/".concat(t.id,"/like")});return(0,i.$f)({url:n,method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:[t]})}).then(function(e){if(e.ok)return"Success";throw Error("Failed to unlike comment")})},C=e=>{let{comment:t}=e,n=(0,i.Ky)({type:"members",resource:"comments/".concat(t.id,"/report")});return(0,i.$f)({url:n,method:"POST",headers:{"Content-Type":"application/json"}}).then(function(e){if(e.ok)return"Success";throw Error("Failed to report comment")})};var _=n(22496),h=n(12072);async function f(e){let{state:t,postId:n,limit:o,repliesLimit:r=3,order:s="desc"}=e,i=1;t.pagination&&t.pagination.page&&(i=t.pagination.page+1);let l=await c({page:i,postId:n,limit:o,order:s}),m=a(l.comments,r),u=[...t.comments,...m],d=l.meta.pagination;t.setComments(u),t.setPagination(d)}async function x(e){let{state:t,comment:n}=e;try{return n=(await m({comment:n})).comments[0],{commentError:"",comments:[n,...t.comments],commentsCount:(null==t?void 0:t.commentsCount)+1}}catch(e){if((null==e?void 0:e.message)==="Too Many Requests")return{commentError:"It is forbidden to post more than 3 comments within 1 hour"};return{}}}async function v(e){let{state:t,data:{reply:n,parent:o}}=e;try{let e=n;e.parent_id=o.id,e=(await m({comment:e})).comments[0];let r=t.comments.map(t=>t.id===o.id?{...o,replies:[...o.replies,e],count:{...o.count,replies:o.count.replies+1}}:t);t.setCommentError(""),t.setComments(r)}catch(e){(null==e?void 0:e.message)==="Too Many Requests"&&t.setCommentError("It is forbidden to post more than 3 comments within 1 hour")}}async function y(e){let{state:t,commentId:n}=e;await d({commentId:n});let o=t.comments.map(e=>{let t=e.replies.map(e=>e.id===n?{...e,liked:!0,count:{...e.count,likes:e.count.likes+1}}:e);return e.id===n?{...e,liked:!0,replies:t,count:{...e.count,likes:e.count.likes+1}}:{...e,replies:t}});t.setComments(o)}
1async function g(e){let{comment:t}=e;return await C({comment:t}),{}}async function j(e){let{state:t,comment:n}=e;await p({comment:n});let o=t.comments.map(e=>{let t=e.replies.map(e=>e.id===n.id?{...e,liked:!1,count:{...e.count,likes:e.count.likes-1}}:e);return e.id===n.id?{...e,liked:!1,replies:t,count:{...e.count,likes:e.count.likes-1}}:{...e,replies:t}});t.setComments(o)}async function w(e){let{state:t,commentId:n,isReply:o}=e;await u({comment:{id:n,status:"deleted"}});let r=t.comments.map(e=>{let t=e.replies.map(e=>e.id===n?{...e,status:"deleted"}:e);return e.id===n?{...e,status:"deleted",replies:t}:{...e,replies:t}});if(t.setComments(r),!o){let e=t.commentsCount-1;t.setCommentsCount(e)}}async function b(e){let{state:t,data:{comment:n,parent:o}}=e;n=(await u({comment:n})).comments[0];let r=t.comments.map(e=>o&&o.id===e.id?{...e,replies:e.replies.map(e=>e.id===n.id?n:e)}:e.id===n.id?n:e);t.setComments(r)}function k(e){let{state:t,time:n}=e;t.setLastOpenedFormTime(n)}var N=n(78454),R=n(24833),E=n(47068),M=n(6416),T=n.n(M),S=(0,r.memo)(function(e){let{mode:t,postId:n,parentComment:a,replyToComment:i,editComment:l,editParent:c,onClose:m,onSuccess:u}=e,d=(0,r.useContext)(s),p=(0,h.CG)(e=>e.profile.profile),C=(0,r.useRef)(null),[_,f]=(0,r.useState)(()=>{if("reply"===t){var e,n;let t=i||a,o=(null==t?void 0:null===(e=t.member)||void 0===e?void 0:e.name)||(null==t?void 0:null===(n=t.member)||void 0===n?void 0:n.firstname)||"";return"".concat(o,", ")}return"edit"===t&&(null==l?void 0:l.html)?function(e){if("undefined"==typeof document)return e.replace(/<[^>]+>/g,"");let t=document.createElement("div");return t.innerHTML=e,t.textContent||""}(l.html):""}),[y,g]=(0,r.useState)(!1),[j,w]=(0,r.useState)("");(0,r.useEffect)(()=>{var e;if("create"===t)return;let n=null===(e=C.current)||void 0===e?void 0:e.querySelector("textarea");n&&(n.focus(),n.setSelectionRange(n.value.length,n.value.length))},[t]);let k=async()=>{let e=_.trim();if(!e)return;let o=function(e){let t=e.split("\n").filter(e=>e.trim());return 0===t.length?"":t.map(e=>"<p>".concat(e,"</p>")).join("")}(e);if(o){g(!0),w("");try{if("create"===t){let e=await x({state:d,comment:{post_id:n,status:"published",html:o}});if(null==e?void 0:e.commentError){w(e.commentError);return}(null==e?void 0:e.comments)!==void 0?(d.setComments(e.comments),d.setCommentsCount(e.commentsCount),f(""),null==u||u()):w("Failed to submit comment. Please try again.")}else if("reply"===t&&a){if(await v({state:d,data:{reply:{post_id:n,status:"published",html:o},parent:a}}),d.commentError){w(d.commentError);return}null==m||m(),null==u||u()}else"edit"===t&&l&&(await b({state:d,data:{comment:{id:l.id,html:o},parent:null!=c?c:null}}),null==m||m(),null==u||u())}catch(e){w("Failed to submit comment. Please try again.")}finally{g(!1)}}};if(!p)return null;let M=p.name||p.firstname||"";return(0,o.jsxs)("div",{className:T().wrapper,children:[(0,o.jsx)("div",{className:T().avatar,children:(0,o.jsx)(N.default,{name:M,src:p.avatar_image||p.avatar||"",size:"create"===t?40:32,quality:60})}),(0,o.jsxs)("div",{ref:C,className:T().form,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"Enter"===e.key&&(e.preventDefault(),k()),"Escape"===e.key&&(null==m||m())},children:[(0,o.jsx)(E.g,{id:"comment-form-".concat(t),value:_,inputA
1ction:e=>f(e||""),placeholder:"create"===t?"Write your comment...":void 0,errorMsg:j||null,className:T().textarea}),(0,o.jsxs)("div",{className:T().buttonsRow,children:[(0,o.jsx)(R.default,{text:"reply"===t?"Reply":"edit"===t?"Save":"Send",type:R.l.PRIMARY,size:R.n.DEFAULT,isLoading:y,onClick:k,disable:!_.trim()}),"create"!==t&&(0,o.jsx)("button",{type:"button",onClick:m,className:T().cancelBtn,children:"Cancel"})]})]})]})}),L=n(56800),I=n.n(L),F=n(33714),O=n(61857),B=n.n(O),D=(0,r.memo)(function(e){let{commentsCount:t,order:n,onOrderChange:r,className:s}=e;return(0,o.jsxs)("div",{className:I()(B().wrapper,s),children:[(0,o.jsxs)("button",{type:"button",onClick:()=>{r("desc"===n?"asc":"desc")},"aria-label":"desc"===n?"Newest":"Oldest",className:B().sortBtn,children:[(0,o.jsx)("span",{children:"desc"===n?"Newest":"Oldest"}),(0,o.jsx)("span",{className:I()(B().arrow,{[B().arrowUp]:"desc"!==n}),children:(0,o.jsx)(F.Z,{})})]}),(0,o.jsxs)("div",{className:B().countGroup,children:[(0,o.jsx)("span",{className:B().countLabel,children:"Comments:"}),(0,o.jsx)("span",{className:B().countValue,children:t})]})]})});function A(e){return"published"===e.status}var W=n(59237),H=n(87307),P=n.n(H),U=(0,r.memo)(function(e){let{isOwnComment:t,onEdit:n,onDelete:s,onReport:a,onClose:i}=e,l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&i()},t=e=>{"Escape"===e.key&&i()},n=setTimeout(()=>{document.addEventListener("pointerdown",e),document.addEventListener("keydown",t)},0);return()=>{clearTimeout(n),document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[i]),(0,o.jsx)("div",{ref:l,className:P().menu,children:t?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",onClick:()=>{n(),i()},className:P().menuItem,children:"Edit"}),(0,o.jsx)("button",{type:"button",onClick:()=>{s(),i()},className:"".concat(P().menuItem," ").concat(P().destructive),children:"Delete"})]}):(0,o.jsx)("button",{type:"button",onClick:()=>{a(),i()},className:P().menuItem,children:"Report"})})}),G=n(83200),K=n.n(G);function z(e){let{filled:t}=e;return(0,o.jsx)("svg",{width:"17",height:"15",viewBox:"0 0 17 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:K().icon,children:t?(0,o.jsx)("path",{d:"M8.16442 14.2822C7.95397 14.2822 7.74949 14.2451 7.55096 14.171C7.35244 14.0969 7.16517 13.9804 6.98915 13.8216L5.75 12.6866C4.24276 11.3493 2.90762 10.0325 1.74458 8.73619C0.581527 7.43984 0 6.01646 0 4.46604C0 3.194 0.431618 2.13165 1.29485 1.279C2.15808 0.426333 3.23265 0 4.51858 0C5.22028 0 5.88543 0.141834 6.51404 0.4255C7.14267 0.709167 7.69279 1.12213 8.16442 1.6644C8.66381 1.12213 9.22087 0.709167 9.8356 0.4255C10.4503 0.141834 11.1086 0 11.8102 0C13.0962 0 14.1733 0.426333 15.0415 1.279C15.9097 2.13165 16.3438 3.194 16.3438 4.46604C16.3438 6.01646 15.7598 7.43984 14.5917 8.73619C13.4237 10.0325 12.0861 11.351 10.5788 12.6916L9.34467 13.8265C9.16864 13.9854 8.98053 14.101 8.78035 14.1735C8.58017 14.2459 8.37486 14.2822 8.16442 14.2822Z",fill:"currentColor"}):(0,o.jsx)("path",{d:"M8.16442 14.2822C7.95397 14.2822 7.74949 14.2451 7.55096 14.171C7.35244 14.0969 7.16517 13.9804 6.98915 13.8216L5.75 12.6866C4.24276 11.3493 2.90762 10.0325 1.74458 8.73619C0.581527 7.43984 0 6.01646 0 4.46604C0 3.1939 0.430576 2.13153 1.29173 1.27892C2.15287 0.426306 3.22849 0 4.51858 0C5.22301 0 5.88885 0.141834 6.5161 0.4255C7.14335 0.709167 7.69279 1.12213 8.16442 1.6644C8.66381 1.12213 9.22198 0.709167 9.83894 0.4255C10.4559 0.141834 11.1108 0 11.8036 0C13.0952 0 14.1748 0.426306 15.0424 1.27892C15.91 2.13153 16.3438 3.1939 16.3438 4.46604C16.3438 6.01646 15.7598 7.43984 14.5917 8.73619C13.4237 10.0325 12.0861 11.351 10.5788 12.6916L9.34467 13.8265C9.16864 13.9854 8.98053 14.101 8.78035 14.1735C8.58017 14.2459 8.37486 14.2822 8.16442 14.2822ZM7.42121 3.49096C7.10781 2.94143 6.69861 2.51042 6.19363 2.19792C5.68864 1.88542 5.13074 1.72917 4.51994 1.72917C3.72258 1.72917 3.05811 1.98725 2.52654 2.50342C1.99497 3.01957 1.72919 3.67651 1.72919 4.47423C1.72919 5.17073 1.97669 5.90428 2.47169 6.67487C2.9667 7.44547 3.55795 8.19892 4.24544 8.93523C4.93294 9.67153 5.64107 10.3562 6.36983 10.9892C7.09858 11.6222 7.69678 12.1451 8.16442 12.558C8.63332 12.1413 9.23283 11.6166 9.96296 10.9839C10.6931 10.3512 11.4026 9.66691 12.0914 8.93094C12.7802 8.19498 13.3729 7.44309 13.8696 6.67527C14.3663 5.90747 14.6146 5.17378 14.6146 4.47423C14.6146 3.67651 14.3477 3.01957 13.814 2.50342C13.2803 1.98725 12.6132 1.72917 11.8126 1.72917C11.1993 1.72917 10.6375 1.88542 10.1273 2.19792C9.61701 2.51042 9.20517 2.94143 8.89177 3.49096C8.81802 3.63981 8.71524 3.74797 8.58342 3.81546C8.45161 3.88293 8.31161 3.91667 8.16342 3.91667C8.01522 3.91667 7.87269 3.88293 7.73583 3.81546C7.59897 3.74797 7.4941 3.63981 7.42121 3.49096Z",fill:"currentColor"})})}function Z(){return(0,o.jsx)("svg",{width:"14",height:"11",viewBox:"0 0 14 11",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:K().icon,children:(0,o.jsx)("path",{d:"M2.96196 5.0625L4.80933 6.90988C4.98204 7.
108258 5.06922 7.28624 5.07088 7.52083C5.07254 7.75543 4.98702 7.9624 4.81431 8.14175C4.6416 8.31114 4.43795 8.39501 4.20335 8.39335C3.96874 8.39169 3.76509 8.3045 3.5924 8.13179L0.264042 4.80344C0.0880138 4.63247 0 4.43189 0 4.20171C0 3.97153 0.0880138 3.76842 0.264042 3.5924L3.5924 0.264042C3.76842 0.0880141 3.97406 0 4.20931 0C4.44456 0 4.64623 0.0880141 4.81431 0.264042C4.98702 0.432111 5.07337 0.633778 5.07337 0.869041C5.07337 1.10429 4.98702 1.30827 4.81431 1.48098L2.96196 3.33333H9.88269C11.0193 3.33333 11.9892 3.73496 12.7924 4.53821C13.5957 5.34146 13.9973 6.31136 13.9973 7.44792V9.75271C13.9973 9.99511 13.9142 10.1998 13.748 10.3668C13.5819 10.5338 13.3782 10.6173 13.1371 10.6173C12.8959 10.6173 12.6908 10.5338 12.5217 10.3668C12.3526 10.1998 12.2681 9.99511 12.2681 9.75271V7.44792C12.2681 6.78336 12.0367 6.21965 11.5738 5.75679C11.111 5.29393 10.5472 5.0625 9.88269 5.0625H2.96196Z",fill:"currentColor"})})}function q(){return(0,o.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:K().icon,children:[(0,o.jsx)("circle",{cx:"4.5",cy:"10",r:"1.5",fill:"currentColor"}),(0,o.jsx)("circle",{cx:"10",cy:"10",r:"1.5",fill:"currentColor"}),(0,o.jsx)("circle",{cx:"15.5",cy:"10",r:"1.5",fill:"currentColor"})]})}var Y=(0,r.memo)(function(e){let{isLiked:t,likeCount:n,isLiking:r=!1,onLikeClick:s,onReplyClick:a,isMenuOpen:i,onMoreClick:l,onMenuClose:c,isOwnComment:m,onEdit:u,onDelete:d,onReport:p}=e;return(0,o.jsxs)("div",{className:K().wrapper,children:[(0,o.jsxs)("button",{type:"button",onClick:s,disabled:r,"aria-label":t?"Unlike comment":"Like comment",className:I()(K().actionBtn,{[K().active]:t}),children:[(0,o.jsx)(z,{filled:t}),(0,o.jsx)("span",{children:n})]}),(0,o.jsxs)("button",{type:"button",onClick:a,"aria-label":"Reply to comment",className:K().actionBtn,children:[(0,o.jsx)(Z,{}),(0,o.jsx)("span",{children:"Reply"})]}),(0,o.jsxs)("div",{className:K().menuWrapper,children:[(0,o.jsx)("button",{type:"button",onClick:l,"aria-label":"Comment actions","aria-expanded":i,className:I()(K().actionBtn,K().moreBtn,{[K().active]:i}),children:(0,o.jsx)(q,{})}),i&&(0,o.jsx)(U,{isOwnComment:m,onEdit:u,onDelete:d,onReport:p,onClose:c})]})]})}),J=n(14085),V=n.n(J),Q=(0,r.memo)(function(e){let{html:t}=e,[n,s]=(0,r.useState)(!1),[a,i]=(0,r.useState)(!1),l=(0,r.useRef)(null),c=(0,r.useCallback)(e=>{e&&(l.current=e,i(e.scrollHeight>e.clientHeight))},[]);return t?(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{ref:c,className:I()(V().text,{[V().clamped]:!n}),dangerouslySetInnerHTML:{__html:t}}),(a||n)&&(0,o.jsx)("button",{type:"button",className:V().readMoreBtn,onClick:()=>s(e=>!e),children:n?"Collapse":"Read more"})]}):null}),$=n(11786),X=n.n($),ee=(0,r.memo)(function(e){let{comment:t,isReply:n=!1,children:r,actions:s}=e,{member:a,html:i,created_at:l,edited_at:c}=t,m=(null==a?void 0:a.name)||(null==a?void 0:a.firstname)||"Anonymous",u=function(e){let t=new Date(e),n=new Date,o=Math.round((n.getTime()-t.getTime())/1e3);if(o<5)return"Just now";if(o<60)return"".concat(o," seconds ago");if((o/=60)<60)return 1===Math.floor(o)?"One minute ago":"".concat(Math.floor(o)," minutes ago");let r=new Date(n.getFullYear(),n.getMonth(),n.getDate()-1);return t.getFullYear()===r.getFullYear()&&t.getMonth()===r.getMonth()&&t.getDate()===r.getDate()?"Yesterday":(o/=60)<24?1===Math.floor(o)?"One hour ago":"".concat(Math.floor(o)," hours ago"):(o/=24)<7?1===Math.floor(o)?"One day ago":"".concat(Math.floor(o)," days ago"):1===Math.floor(o/=7)?"One week ago":"".concat(Math.floor(o)," weeks ago")}(new Date(c||l));return(0,o.jsxs)("div",{className:X().wrapper,children:[(0,o.jsx)("div",{className:X().avatar,children:(0,o.jsx)(N.default,{name:m,src:(null==a?void 0:a.avatar)||"",size:n?32:40,quality:60})}),(0,o.jsxs)("div",{className:X().content,children:[(0,o.jsxs)("div",{className:X().bubble,children:[(0,o.jsxs)("div",{className:X().meta,children:[(0,o.jsx)("span",{className:X().author,children:m}),(0,o.jsx)("span",{className:X().dot,children:"â¢"}),(0,o.jsx)("span",{className:X().time,children:u})]}),(0,o.jsxs)("div",{className:X().body,children:[(0,o.jsx)(Q,{html:i}),s&&(0,o.jsx)("div",{className:X().actions,children:s})]})]}),r]})]})}),et=(0,r.memo)(function(e){var t,n,a,i;
1let{comment:l,isReply:c=!1,postId:m,parent:u,onReport:d}=e,p=(0,r.useContext)(s),C=(0,h.TL)(),f=(0,h.CG)(e=>e.profile.profile),[x,v]=(0,r.useState)(!1),[g,b]=(0,r.useState)(!1),[N,R]=(0,r.useState)(!1),[E,M]=(0,r.useState)(l.liked),[T,L]=(0,r.useState)(null!==(i=null===(t=l.count)||void 0===t?void 0:t.likes)&&void 0!==i?i:0),[I,F]=(0,r.useState)(!1),O=(0,r.useRef)(0),B=!!f&&f.id===(null===(n=l.member)||void 0===n?void 0:n.id);(0,r.useEffect)(()=>{var e,t;M(l.liked),L(null!==(t=null===(e=l.count)||void 0===e?void 0:e.likes)&&void 0!==t?t:0)},[l.liked,null===(a=l.count)||void 0===a?void 0:a.likes]),(0,r.useEffect)(()=>{p.lastOpenedFormTime>O.current&&0!==O.current&&(v(!1),b(!1))},[p.lastOpenedFormTime]);let D=(0,r.useCallback)(()=>{if(!f){C((0,W.Rz)("signin")),C((0,W.rs)(!0));return}O.current=Date.now(),k({state:p,time:O.current}),v(!1),R(!1),b(!0)},[p,f,C]),H=(0,r.useCallback)(()=>{O.current=Date.now(),k({state:p,time:O.current}),b(!1),R(!1),v(!0)},[p]),P=(0,r.useCallback)(()=>b(!1),[]),U=(0,r.useCallback)(()=>v(!1),[]),G=(0,r.useCallback)(()=>R(e=>!e),[]),K=(0,r.useCallback)(()=>R(!1),[]),z=(0,r.useCallback)(()=>{R(!1),null==d||d(l)},[l,d]),Z=(0,r.useCallback)(async()=>{if(!f){C((0,W.Rz)("signin")),C((0,W.rs)(!0));return}if(B){C((0,_.Wv)({type:_.tx.LIKE_OWN_COMMENT}));return}if(!I){M(!E),L(E?T-1:T+1),F(!0);try{E?await j({state:p,comment:l}):await y({state:p,commentId:l.id})}catch(e){M(E),L(T),C((0,_.Wv)({type:_.tx.ERROR,description:"Failed to update like."}))}finally{F(!1)}}},[l,I,E,T,B,f,p,C]),q=(0,r.useCallback)(async()=>{try{await w({state:p,commentId:l.id,isReply:c})}catch(e){C((0,_.Wv)({type:_.tx.ERROR,description:"Failed to delete comment."}))}},[l.id,c,p,C]);if(!A(l))return null;if(x)return(0,o.jsx)(S,{mode:"edit",postId:m,editComment:l,editParent:u,onClose:U});let J=(l.replies||[]).filter(A),V=(0,o.jsx)(Y,{isReply:c,isLiked:E,likeCount:T,isLiking:I,onLikeClick:Z,onReplyClick:D,isMenuOpen:N,onMoreClick:G,onMenuClose:K,isOwnComment:B,onEdit:H,onDelete:q,onReport:z});return(0,o.jsxs)(ee,{comment:l,isReply:c,actions:V,children:[J.length>0&&(0,o.jsx)(er,{comments:l.replies,isReply:!0,postId:m,parent:l,onReport:d}),g&&(0,o.jsx)(S,{mode:"reply",postId:m,parentComment:c&&u?u:l,replyToComment:c?l:void 0,onClose:P})]})}),en=n(2213),eo=n.n(en),er=(0,r.memo)(function(e){let{comments:t,isReply:n=!1,postId:r,parent:s,onReport:a}=e,i=t.filter(A);return 0===i.length?null:(0,o.jsx)("div",{className:eo().list,children:i.map(e=>(0,o.jsx)(et,{comment:e,isReply:n,postId:r,parent:s,onReport:a},e.id))})}),es=n(24462),ea=n.n(es),ei=(0,r.memo)(function(e){let{onLoadMore:t,isLoading:n=!1,type:r="comments",hiddenCount:s}=e;return(0,o.jsx)(R.default,{text:n?"Loading...":"replies"===r?s?"Show ".concat(s," more replies"):"Show replies":"Load more",icon:(0,o.jsx)(F.Z,{}),type:R.l.STANDART,size:R.n.DEFAULT,onClick:t,disable:n,isFullFill:!0,className:ea().loadMoreBtn})}),el=n(9860),ec=n.n(el),em=(0,r.memo)(function(e){let{className:t}=e;return(0,o.jsx)("div",{className:I()(ec().wrapper,t),children:(0,o.jsx)("p",{className:ec().message,children:"No comments yet. Be the first to leave feedback!"})})}),eu=n(19722),ed=n.n(eu),ep=(0,r.memo)(function(e){let{className:t}=e,n=(0,h.TL)();return(0,o.jsxs)("div",{className:I()(ed().wrapper,t),children:[(0,o.jsxs)("div",{className:ed().textGroup,children:[(0,o.jsx)("h3",{className:ed().title,children:"Join the discussion"}),(0,o.jsx)("p",{className:ed().description,children:"Create an account to start commenting"})]}),(0,o.jsx)(R.default,{text:"Sign up",type:R.l.PRIMARY,onClick:()=>{n((0,W.Rz)("signup")),n((0,W.rs)(!0))}}),(0,o.jsxs)("p",{className:ed().signInRow,children:["Already registered?"," ",(0,o.jsx)("button",{type:"button",onClick:()=>{n((0,W.Rz)("signin")),n((0,W.rs)(!0))},className:ed().signInLink,children:"Sign in"})]})]})}),eC=n(76588),e_=n(15358),eh=n.n(e_);function ef(e){let{comment:t,onClose:n}=e,s=(0,h.TL)(),[a,i]=(0,r.useState)(!1),l=async()=>{i(!0);try{await g({comment:t}),s((0,_.Wv)({type:_.tx.REPORT_COMMENT})),n()}catch(e){s((0,_.Wv)({type:_.tx.ERROR,description:"Failed to send report. Please try again."}))}finally{i(!1)}};return(0,o.jsxs)(eC.Z,{show:!0,onClose:n,className:eh().modal,children:[(0,o.jsx)("h3",{className:eh().title,children:"Report comment"}),(0,o.jsx)("p",{className:eh().description,children:"Are you sure you want to report this comment? Our team will review it as soon as possible."}),(0,o.jsxs)("div",{className:eh().footer,children:[(0,o.jsx)("button",{type:"button",onClick:n,disabled:a,className:eh().cancelBtn,children:"Cancel"}),(0,o.jsx)(R.default,{text:"Report",type:R.l.RED,isLoading:a,onClick:l})]})]})}var ex=n(55235),ev=n.n(ex);function ey(e){let{postId:t,order:n,onOrderChange:a}=e,i=(0,h.TL)(),l=(0,r.useContext)(s),{comments:c,commentsCount:m,pagination:u}=l,d=(0,h.CG)(e=>e.profile.profile),[p,C]=(0,r.useState)(!1),[x,v]=(0,r.useState)(null),y=!!u&&u.page<u.pages,g=(0,r.useCallback)(async()=>
1{if(!p){C(!0);try{await f({state:l,postId:t,limit:10,repliesLimit:3,order:n})}catch(e){i((0,_.Wv)({type:_.tx.ERROR,description:"Failed to load more comments. Please try again."}))}finally{C(!1)}}},[p,l,t,n,i]),j=0===m,w=(0,r.useCallback)(()=>v(null),[]);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:ev().wrapper,children:[d?(0,o.jsx)(S,{mode:"create",postId:t}):(0,o.jsx)(ep,{}),j?(0,o.jsx)(em,{}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(D,{commentsCount:m,order:n,onOrderChange:a}),(0,o.jsx)(er,{comments:c,postId:t,onReport:v}),y&&(0,o.jsx)(ei,{onLoadMore:g,isLoading:p})]})]}),x&&(0,o.jsx)(ef,{comment:x,onClose:w})]})}function eg(e){let{postId:t}=e,n=(0,h.TL)(),[i,l]=(0,r.useState)([]),[m,u]=(0,r.useState)(void 0),[d,p]=(0,r.useState)(0),[C,f]=(0,r.useState)(""),[x,v]=(0,r.useState)(0),[y,g]=(0,r.useState)("desc"),j=(0,r.useRef)(!1),w=(0,r.useCallback)(async e=>{try{var o,r,s,i,m;let n=await c({limit:10,page:1,postId:t,order:e});p(null!==(i=null===(r=n.meta)||void 0===r?void 0:null===(o=r.pagination)||void 0===o?void 0:o.total)&&void 0!==i?i:0);let d=a(null!==(m=n.comments)&&void 0!==m?m:[],3);l(d),u(null===(s=n.meta)||void 0===s?void 0:s.pagination)}catch(e){n((0,_.Wv)({type:_.tx.ERROR,description:"Failed to load comments. Please try again."}))}},[t,n]);(0,r.useEffect)(()=>{j.current||(j.current=!0,w(y))},[w,y]);let b=(0,r.useCallback)(e=>{g(e),w(e)},[w]);return(0,o.jsx)(s.Provider,{value:{comments:i,setComments:l,pagination:m,setPagination:u,commentsCount:d,setCommentsCount:p,commentError:C,setCommentError:f,lastOpenedFormTime:x,setLastOpenedFormTime:v},children:(0,o.jsx)(ey,{postId:t,order:y,onOrderChange:b})})}},47068:function(e,t,n){"use strict";n.d(t,{g:function(){return l}});var o=n(57437),r=n(70462),s=n.n(r),a=n(56800),i=n.n(a);let l=e=>{let{id:t="",label:n,value:r="",placeholder:a="",isDisable:l=!1,isOptional:c=!1,errorMsg:m="",hint:u="",className:d="",inputAction:p,onFocus:C}=e;return(0,o.jsxs)("div",{className:i()(s().wrapInput,d),children:[n&&(0,o.jsxs)("label",{htmlFor:t||n,className:s().label,children:[n," ",c&&(0,o.jsx)("span",{children:"(optional)"})]}),(0,o.jsx)("textarea",{id:t,className:i()(s().input,{[s().inputError]:m}),disabled:l,value:r||"",placeholder:a,onInput:e=>{p(e.target.value)},onFocus:()=>void 0!==C&&C()}),m&&(0,o.jsx)("span",{className:s().errorMsg,children:m}),u&&(0,o.jsx)("span",{className:s().hint,children:u})]})}},6416:function(e){e.exports={wrapper:"CommentForm_wrapper___5GAP",avatar:"CommentForm_avatar__03R0a",form:"CommentForm_form__xOakc",textarea:"CommentForm_textarea___4v_9",buttonsRow:"CommentForm_buttonsRow__QAzWk",cancelBtn:"CommentForm_cancelBtn__QCET2"}},83200:function(e){e.exports={wrapper:"CommentActions_wrapper__aeo_X",icon:"CommentActions_icon__hAsGU",actionBtn:"CommentActions_actionBtn__y_mFy",active:"CommentActions_active__ZFpMq",moreBtn:"CommentActions_moreBtn__Qq1AU",menuWrapper:"CommentActions_menuWrapper__gIWWk"}},11786:function(e){e.exports={wrapper:"CommentItem_wrapper__iKYWa",avatar:"CommentItem_avatar__C7cHF",content:"CommentItem_content__ml5yS",bubble:"CommentItem_bubble__YC32I",meta:"CommentItem_meta__MkSMD",author:"CommentItem_author__vtqJQ",dot:"CommentItem_dot__Nx3H_",time:"CommentItem_time__h4lRZ",body:"CommentItem_body__10ykp",actions:"CommentItem_actions__r6wVx"}},14085:function(e){e.exports={text:"CommentText_text__TuES1",clamped:"CommentText_clamped__arSK8",readMoreBtn:"CommentText_readMoreBtn__YG0a7"}},87307:function(e){e.exports={menu:"CommentMenu_menu__H3OM8",menuItem:"CommentMenu_menuItem__zdCF3",destructive:"CommentMenu_destructive__nrAJp"}},55235:function(e){e.exports={wrapper:"Comments_wrapper___YbQ1"}},61857:function(e){e.exports={wrapper:"CommentsHeader_wrapper__9d2n_",sortBtn:"CommentsHeader_sortBtn__Z_V7d",arrow:"CommentsHeader_arrow__vZXiX",arrowUp:"CommentsHeader_arrowUp__9WNrY",countGroup:"CommentsHeader_countGroup__f7866",countLabel:"CommentsHeader_countLabel___nJUb",countValue:"CommentsHeader_countValue__A_b5g"}},2213:function(e){e.exports={list:"CommentsList_list__ylCrW"}},24462:function(e){e.exports={loadMoreBtn:"LoadMoreComments_loadMoreBtn__vE8jr"}},9860:function(e){e.exports={wrapper:"EmptyComments_wrapper__NTlKD",message:"EmptyComments_message__RSMFR"}},19722:function(e){e.exports={wrapper:"NotLoggedCard_wrapper__tjyjT",textGroup:"NotLoggedCard_textGroup__Kk3zs",title:"NotLoggedCard_title__9gZS3",description:"NotLoggedCard_description__bRw_D",signInRow:"NotLoggedCard_signInRow__N
1xh8J",signInLink:"NotLoggedCard_signInLink__ewctV"}},15358:function(e){e.exports={modal:"ReportModal_modal__XnUp3",title:"ReportModal_title___yRNz",description:"ReportModal_description__Gb_0R",footer:"ReportModal_footer__gQR8w",cancelBtn:"ReportModal_cancelBtn__7q_om"}},70462:function(e){e.exports={wrapInput:"Textarea_wrapInput__iEQdg",label:"Textarea_label__vSj1h",input:"Textarea_input__2wG6u",inputError:"Textarea_inputError__padEU",errorMsg:"Textarea_errorMsg__EvoHL",hint:"Textarea_hint__1kicC"}}}]);
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.