(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4694],{40875:function(e,t,n){"use strict";n.d(t,{R:function(){return m}});var o=n(85893),i=n(32680),r=n(48560),s=n(75529),a=n(2566),l=n(86896),d=n(24169),c=n(4266),u=n(26381),p=n(95983),m=function(e){var t=e.isBanner,n=(0,l.Z)().formatMessage,m=(0,u.h)(),v=m.locale,f=m.asPath,h=n({id:"common.chatWithMe",defaultMessage:"Chat with me"}),g=(0,c.d)();return-1!==p.$x.indexOf(p.Vi.NEXT_PUBLIC_DEPLOY_LOCALE||"")?t?(0,o.jsx)(r.A,{href:p.nw,children:(0,o.jsx)("img",{src:i.C.getAssetPath(g?"ai/chat_with_me_banner_mobile.jpg":"ai/chat_with_me_banner.jpg"),alt:h,style:{maxWidth:"100%"},"data-event-category":"Together","data-event-action":"Chat With Me","data-event-label":(0,d.Ow)(v,f)})}):(0,o.jsx)(r.B,{"data-event-category":"Together","data-event-action":"Chat With Me","data-event-label":(0,d.Ow)(v,f),leftIcon:(0,o.jsx)("img",{src:i.C.getAssetPath("ai/chat-icon.svg"),alt:h,style:{width:g?(0,a.h)(16):(0,a.h)(18),objectFit:"cover",aspectRatio:4.5}}),onClick:function(){return window.location.href=p.nw},styles:{root:{height:(0,a.h)(32),paddingLeft:(0,a.h)(8),paddingRight:(0,a.h)(8)},leftIcon:{marginRight:(0,a.h)(8)}},children:(0,o.jsx)(s.T,{size:g?"s5":"s4",color:"white",weight:"semiBold",children:h})}):null}},37125:function(e,t,n){"use strict";n.d(t,{t:function(){return c},E:function(){return u}});var o=n(26265),i=n(85893),r=n(15393),s=n(26381),a=n(95983);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function d(e){for(var t=1;t div{&:not(:last-child){position:relative;margin-right:22px;&::after{position:absolute;top:50%;left:calc(100% + 0.5rem);color:#9495a0;content:'\u2022';font-size:14px;transform:translateY(-50%);}}}}}"],(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.mbColors.lightGray})):""),s.ZP.img.withConfig({displayName:"indexstyled__StyledLeftIcon",componentId:"sc-15vdhb7-1"})(["width:1.5rem;height:1.5rem;margin-right:2px;",""],i.fn?(0,s.iv)(["margin-right:5px;"]):""),s.ZP.img.withConfig({displayName:"indexstyled__StyledRightIcon",componentId:"sc-15vdhb7-2"})(["width:1rem;height:1rem;margin-right:0.5rem;"]),(0,s.ZP)(r.T).withConfig({displayName:"indexstyled__StyledText",componentId:"sc-15vdhb7-3"})(["display:flex;align-items:center;"]);!function(e){e[e.post=1]="post",e[e.reply=2]="reply"}(o||(o={}))},80143:function(e,t,n){"use strict";var o=n(26265),i=n(85893),r=n(38347);n(67294);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t span{display:flex;align-items:center;}&:hover{background:transparent !important;}}&.label-pinned{border-radius:6px 6px 0 0;.label-sort-pin-icon{width:16px;height:16px;vertical-align:middle;}}",""],(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.neutral50}),(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.white}),r.fn&&(0,a.iv)(["padding:0.75rem 1rem;border-radius:16px 16px 0px 0px;&[data-color='white']{border-bottom:none;}&[data-color='gray']{background:#f3f3f3;}.popover-menu__btn{width:unset;}&.label-pinned{border-bottom:none;background:#fff9eb;border-radius:1rem 1rem 0 0;.label-sort-pin-icon{margin-right:8px;}.label-sort-pin-heading{color:#fb8c00;}}&.label-sorting{","{padding-bottom:1.5rem;margin-bottom:-0.75rem;}}"],s.M.mbUp)),d=function(e){var t=e.label,n=e.rightLabel,s=e.onClick,a=e.color,d=e.className,c=e.style;return(0,o.jsxs)(l,{"data-color":a,onClick:s,className:d,style:c,children:[(0,o.jsx)(i.T,{className:"label-sort-pin-heading",size:r.fn?"p4":"p3",type:"bold",children:t}),n]})}},11850:function(e,t,n){"use strict";n.d(t,{V:function(){return f}});var o=n(26265),i=n(85893),r=n(38347),s=n(48560);n(67294);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t div{display:flex;align-items:center;justify-content:center;}}}}.mantine-Accordion-content{& > div > div{justify-content:space-between;}}"],c,u,p,u,p,r.M.mbUp,u,p,(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.red700}),r.M.mbDown,(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.red700}),r.M.mbUp,r.M.mbDown,null===(o=s.t.neutral)||void 0===o?void 0:o[1],r.M.mbDown,r.M.mbDown,r.M.mbDown,(function(e){return e.color}),(function(e){return e.shadowColor}),(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.gray100}),(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.sizes.fwRegular}),r.M.mbDown,r.M.mbUp,(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.sizes.fwRegular}),r.M.mbDown,r.M.mbUp,(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.sizes.fwRegular}),r.M.mbDown,r.M.mbUp,r.M.mbDown,m,r.M.mbDown,null===(i=s.t.neutral)||void 0===i?void 0:i[1],r.M.mbUp,d,r.M.mbDown,v,r.M.mbUp,d,(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.neutral100})),h=a.ZP.div.withConfig({displayName:"indexstyled__StyledInputCommentPost",componentId:"sc-113z62q-7"})(["position:relative;.card-textbox-overlay{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;cursor:pointer;}& > div{cursor:pointer;*{pointer-events:none;}}"]),g=a.ZP.div.withConfig({displayName:"indexstyled__StyledMarryBabyInputCommentPostUI",componentId:"sc-113z62q-8"})(["padding:1rem;background:white;margin-bottom:8px;border:1px solid rgb(243,243,243);margin-bottom:8px;box-shadow:rgba(0,0,0,0.08) 0px 1px 3px;border-radius:24px;.upper-container{display:flex;align-items:center;padding-bottom:1rem;border-bottom:1px solid #fafafa;.avatar-wrapper{width:40px;height:40px;margin-right:1rem;}}.action-container{display:flex;align-items:center;justify-content:center;padding-top:1rem;.image-picker-icon,.video-picker-icon{width:24px;height:24px;margin-right:0.5rem;}.image-picker-wrapper,.video-picker-wrapper{display:flex;flex:1;align-items:center;justify-content:center;}}"]),y=(a.ZP.div.withConfig({displayName:"indexstyled__StyledEditorArea",componentId:"sc-113z62q-9"})([""]),a.ZP.div.withConfig({displayName:"indexstyled__StyledRichTextWRapper",componentId:"sc-113z62q-10"})([""])),x=a.ZP.div.withConfig({displayName:"indexstyled__StyledActions",componentId:"sc-113z62q-11"})(["display:flex;"])},85955:function(e,t,n){"use strict";n.d(t,{z:function(){return se}});var o=n(85893),i=n(809),r=n.n(i),s=n(26265),a=n(92447),l=n(67294),d=n(11024),c=n(55482),u=n(46784),p=n(93692),m=n(94599),v=n(48560),f=n(5152),h=n(11163),g=n(86896),y=n(25559),x=n(2810),b=n(38347);function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function C(e){for(var t=1;t0,f=null===n||void 0===n?void 0:n.author;(null===f||void 0===f?void 0:f.name)||null===f||void 0===f||f.username,(null===f||void 0===f?void 0:f.username)||null===f||void 0===f||f.name,null===f||void 0===f||f.avatar,null===n||void 0===n||n.isAnonymous,null===f||void 0===f||f.email,null===n||void 0===n||n.createdTime,null===n||void 0===n||n.community,null===f||void 0===f||f.id;return(0,o.jsx)(A,V(V({},i),{},{children:(0,o.jsx)(B,{children:(0,o.jsxs)(U,{children:[(0,o.jsxs)(W,{"data-has-thumb":v,children:[(0,o.jsx)(D.T,{as:"h4",size:"s3",weight:"bold",children:null===n||void 0===n?void 0:n.title}),(0,o.jsx)(z,{children:(0,o.jsx)(p.q,{trackingCategory:O.UN,url:"",className:"post-content-wrapper",description:null===n||void 0===n?void 0:n.description,disableShortenContent:!1,mentions:null===n||void 0===n?void 0:n.mentions,maxChars:400})})]}),v&&(0,o.jsx)(H,{className:"cursor-pointer",onClick:function(){return r((function(){window.location.href=m}))},children:(0,o.jsx)(p.v,{images:n.photos})})]})})}))},G=L.ZP.div.withConfig({displayName:"indexstyled__StyledFormWrapper",componentId:"sc-1m5cyo6-0"})(["padding:16px;max-width:936px;margin:0 auto;"]),q=(L.ZP.div.withConfig({displayName:"indexstyled__StyledNote",componentId:"sc-1m5cyo6-1"})(["font-size:14px;margin-bottom:20px;"]),(0,L.ZP)(p.n).withConfig({displayName:"indexstyled__StyledPopupFrame",componentId:"sc-1m5cyo6-2"})(["[data-type='confirm']{overflow-y:auto;max-width:none;max-height:none;width:100vw;height:100%;.popup-content{.header{padding-left:16px;}}","{transition:all 0.3s ease-in-out 0s;&[data-open='true']{z-index:500;}}}"],M.M.mbDown));function Q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function X(e){for(var t=1;t ../../molecules/editor"]}}),oe=(0,f.default)((function(){return Promise.all([n.e(9774),n.e(2937),n.e(7127),n.e(8007),n.e(4447),n.e(2286)]).then(n.bind(n,4447)).then((function(e){return e.RichTextProvider.Editor}))}),{loading:function(){return null},ssr:!1,loadableGenerated:{webpack:function(){return[4447]},modules:["../components/molecules/inputCommentBar/index.tsx -> ../../molecules/editor"]}}),ie=(0,f.default)((function(){return Promise.all([n.e(9774),n.e(2937),n.e(7127),n.e(8007),n.e(4447),n.e(2286)]).then(n.bind(n,4447)).then((function(e){return e.RichTextProvider.PreviewCard}))}),{loading:function(){return null},ssr:!1,loadableGenerated:{webpack:function(){return[4447]},modules:["../components/molecules/inputCommentBar/index.tsx -> ../../molecules/editor"]}}),re=(0,f.default)((function(){return Promise.all([n.e(9774),n.e(2937),n.e(7127),n.e(8007),n.e(4447),n.e(2286)]).then(n.bind(n,4447)).then((function(e){return e.RichTextProvider.Error}))}),{loading:function(){return null},ssr:!1,loadableGenerated:{webpack:function(){return[4447]},modules:["../components/molecules/inputCommentBar/index.tsx -> ../../molecules/editor"]}}),se=(0,l.forwardRef)((function(e,t){var n=e.isReply,i=e.className,s=e.onClose,f=e.replyToName,b=e.style,w=e.replyingId,C=e.replyingUser,M=e.onPostSuccess,E=(e.onPopupClose,e.isMainCmt,e.post),D=e.btnProps,Z=e.isEdit,T=e.commentId,R=void 0===T?"":T,L=e.expandPopupProps,A=e.imageFiles,B=e.isMobile,U=e.value,z=void 0===U?"":U,W=e.showFullEditor,H=e.btnLabel,F=e.headerTitle,V=e.avatarProps,Y=e.isAdmin,G=e.showSourceList,q=e.sourceList,Q=e.colLeftWidth,X=e.isAnonymous,ee=e.showCountChar,se=e.hideReplyMentionsInText,ae=e.hideAnomyous,le=e.hasCreatePost,de=O.Vi.NEXT_PUBLIC_SSO,ce=(0,g.Z)().formatMessage,ue=(0,h.useRouter)().locale,pe=void 0===ue?"vi-VN":ue,me=(0,l.useState)(z),ve=me[0],fe=me[1],he=(0,l.useContext)(S.I),ge=he.pushNotifications,ye=he.state.userInfo,xe=(0,l.useContext)(P.gj).trigger,be=(0,l.useState)(!1),we=be[0],Ce=be[1],je=(0,l.useState)(q||[]),Pe=je[0],Oe=je[1],Se=(0,l.useState)(!1),ke=Se[0],_e=Se[1],Ne=(0,l.useState)(X),Ie=Ne[0],Me=Ne[1],Ee=(0,l.useRef)(null),De=(0,l.useRef)(null),Ze=(0,l.useState)([]),Te=Ze[0],Re=Ze[1],Le=(0,l.useState)(A||[]),Ae=Le[0],Be=Le[1],Ue=(0,l.useState)(!1),ze=Ue[0],We=Ue[1],He=(0,l.useState)(null),Fe=He[0],Ve=He[1],Ye=(0,l.useState)(!1),Ge=Ye[0],qe=Ye[1],Qe=$(void 0,{name:"InputCommentBar"}).theme,Xe=Qe.colors,Je=function(){var e=(0,a.Z)(r().mark((function e(){var t,o,i,a,l,d,c,u,p,m,v,f,h,g;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!G||!ke){e.next=3;break}return _e(!0),e.abrupt("return",!1);case 3:if(_e(!1),null!==E&&void 0!==E&&E.id&&!we){e.next=6;break}return e.abrupt("return");case 6:return Ce(!0),e.prev=7,a=function(e){fe(""),s&&s();var t=(0,y.ec)(e.data);"string"===typeof t.images&&(t.images=JSON.parse(t.images)),qe(!1),null===M||void 0===M||M(t)},e.next=11,Promise.all(Ae.map((function(e,t){return new Promise((function(n){return setTimeout((function(){return n((0,N.tx)(e,pe))}),2e3*t)}))})));case 11:return l=e.sent,Be(l),e.next=15,(0,_._Y)(te({message:ve,photos:Ae,postId:E.id,link:null===Fe||void 0===Fe?void 0:Fe.url,locale:pe,isAdmin:Y,type:G?"chatbot":void 0,sourceList:Pe,isAnonymous:Ie,hideReplyMentionsInText:se},n&&w?{replyingUserId:String((null===C||void 0===C?void 0:C.id)||(null===E||void 0===E||null===(t=E.author)||void 0===t?void 0:t.id)||""),replyingId:w,replyingUserName:(null===C||void 0===C?void 0:C.name)||(null===C||void 0===C?void 0:C.username)||""}:{}));case 15:return d=e.sent,e.next=18,Z?(0,_.uA)(R,d,pe,Y):n&&w?(0,_.Xi)(d,pe):(0,_.rd)(d,pe);case 18:c=e.sent,null===(u=null===c||void 0===c?void 0:c.data)||void 0===u||!u.id||null!==c&&void 0!==c&&null!==(o=c.messages)&&void 0!==o&&null!==(i=o.moderation)&&void 0!==i&&i.type?"banned"===(null===c||void 0===c||null===(p=c.messages)||void 0===p||null===(m=p.moderation)||void 0===m?void 0:m.type)?(ge({title:ce({id:"notification.comment.blocked.title"}),message:ce({id:"notification.comment.blocked.message"}),type:"danger"}),c.messages.moderation.words&&Re(c.messages.moderation.words)):"suspect"===(null===c||void 0===c||null===(v=c.messages)||void 0===v||null===(f=v.moderation)||void 0===f?void 0:f.type)?(ge({title:ce({id:"notification.comment.suspect.title"}),message:ce({id:"notification.comment.suspect.message"}),type:"warning"}),fe(""),s&&s()):null!==c&&void 0!==c&&null!==(h=c.messages)&&void 0!==h&&h.find((function(e){var t;return!(null===e||void 0===e||null===(t=e.includes)||void 0===t||!t.call(e,"suspend"))}))?(ge({message:ce({id:"notification.suspend.message"}),type:"warning"}),fe(""),s&&s()):ge({title:"",message:(null===c||void 0===c||null===(g=c.messages)||void 0===g?void 0:g[0])||ce({id:"notification.comment.somethingWrong"}),type:"danger"}):a(c),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(7),console.error(e.t0),ge({title:"",message:ce({id:"notification.comment.somethingWrong"}),type:"danger"});case 27:Ce(!1);case 28:case"end":return e.stop()}}),e,null,[[7,23]])})));return function(){return e.apply(this,arguments)}}(),Ke=function(){var e;null===(e=Ee.current)||void 0===e||e.focus()},$e=function(e){fe(e)};(0,l.useImperativeHandle)(t,(function(){return{focusEditor:Ke,setValue:$e}})),(0,l.useEffect)((function(){Ke()}),[xe]),(0,l.useEffect)((function(){fe(z)}),[z]),(0,l.useEffect)((function(){_e((Pe||[]).filter((function(e){return""===e})).length>0)}),[Pe]),(0,l.useEffect)((function(){return function(){return qe(!1)}}),[]);var et=Z||n,tt=H||(Z?"Update":ce(n?{id:"cardReactions.reply"}:{id:"cardReactions.comment"})),nt={loading:!B&&we,isDisabled:ke||ze||we||!ve||(null===ve||void 0===ve?void 0:ve.length)<2||!ve.trim()},ot=Z?ce(n?{id:"inputComment.updateReply",defaultMessage:"Edit reply"}:{id:"inputComment.updateComment",defaultMessage:"Edit comment"}):ce({id:"inputComment.replyTo"},{name:'@'.concat(f||"","")}),it=(0,o.jsx)(ne,{imageFiles:Ae,value:ve,onChange:fe,onImageFilesChange:Be,bannedWords:Te,onPreviewUrlChange:Ve,isReplying:n,hasEmbbedSocialLink:!1,hasExpandToolbar:!1,hasExpandPopup:!W,hasCreatePost:le,onInitEditor:function(e){return Ee.current=e},onInvalidVal:We,children:(0,o.jsxs)(K.XQ,{"data-is-input-style":!W,"data-is-reply":n,className:i,style:b,color:Qe.fn.primaryColor(),shadowColor:Xe[Qe.primaryColor][2],children:[et&&!W&&(0,o.jsxs)(K.N0,{children:[(0,o.jsx)(K.VJ,{style:Q?{width:Q}:{},children:"\xa0"}),(0,o.jsx)(K.tb,{children:(0,o.jsxs)("div",{className:"reply-to-container",children:[(0,o.jsx)(d.T,{size:"p4",children:(0,o.jsx)("span",{dangerouslySetInnerHTML:{__html:F||ot}})}),(0,o.jsx)("img",{src:(0,k.k3)("/svg/icon-close-circle-line.svg"),className:"icon-close-comment",onClick:function(){return s&&s()},alt:""})]})})]}),(0,o.jsxs)("div",{className:"input-container",ref:De,children:[!W&&(0,o.jsx)("a",{href:de+x.D9.GET_PROFILE,children:(0,o.jsx)(m.U,te({className:"avatar-wrapper ".concat(n?"avatar-wrapper-reply":""),avatar:null!==ye&&void 0!==ye&&ye.id?ye.avatar:O.DP,username:(null===ye||void 0===ye?void 0:ye.name)||(null===ye||void 0===ye?void 0:ye.username)},V))}),(0,o.jsx)(c.I,{value:ve,name:"input",size:"md",className:"input-wrapper",CustomInput:(0,o.jsxs)("div",{className:"as-input",children:[(0,o.jsx)(K.Tl,{children:(0,o.jsx)(oe,{className:"textarea",toolbarStyle:te(te({},!W&&{borderBottom:0}),W&&{borderTopLeftRadius:6,borderTopRightRadius:6,border:"1px solid ".concat(u.t.colors.gray200)}),textareaStyle:te({},W&&{border:"1px solid ".concat(u.t.colors.gray200),borderTop:0,minHeight:155}),expandPopupHandler:function(){return qe(!Ge)}})}),ee&&(0,o.jsx)(I.k,{}),G&&(0,o.jsx)(p.H,{style:{marginTop:"20px"},editMode:Z,listUrl:q,onListChange:function(e){return Oe(e||[])}}),ke&&(0,o.jsx)(d.T,{size:"p4",color:u.t.colors.red500,children:"Please fill source"}),(0,o.jsx)(K.Vb,{style:te({},W&&{marginTop:"10px"}),children:(0,o.jsxs)(K.lj,{style:te({},W&&{display:"flex",justifyContent:"space-between",width:"100%"}),children:[ae?(0,o.jsx)("div",{}):(0,o.jsx)(v.d,{defaultChecked:X,size:"sm",label:ce({id:"inputComment.anonymous",defaultMessage:"Anonymous"}),onChange:function(e){return Me(null===e||void 0===e?void 0:e.currentTarget.checked)},styles:function(){return{input:{padding:"0 !important"}}}}),(0,o.jsx)(K.Kj,te(te(te({className:"send-button",size:"sm",onClick:Je},nt),D),{},{variant:!W&&B?"transparent":"primary",leftIcon:!W&&B&&(0,o.jsx)(j,{className:"icon-enter m-icon",color:Qe.fn.primaryColor()}),children:!B&&(0,o.jsx)(K.Mw,{children:tt})}))]})})]})})]}),(0,o.jsx)(re,{}),(0,o.jsx)(ie,{})]})});return(0,o.jsxs)(o.Fragment,{children:[it,Ge&&(0,o.jsx)(J,te({heading:ot,onClose:function(){qe(!1)},onPostSuccess:M,imageFiles:Ae,btnLabel:tt,value:ve,bannedWords:Te,post:E,isMobile:B,isEdit:Z,isReply:n,commentId:R},L))]})}))},51079:function(e,t,n){"use strict";n.d(t,{U:function(){return C}});var o=n(85893),i=n(26265),r=n(38347),s=n(67294),a=n(48201),l=n(93692),d=n(86896),c=n(24169),u=n(21124),p=n(4266),m=n(26381),v=n(95983),f=n(50572),h=n(5886),g=n(91256),y=g.ZP.div.withConfig({displayName:"indexstyled__StyledUtility",componentId:"sc-1y2rzak-0"})(["display:flex;align-items:center;"]),x=g.ZP.div.withConfig({displayName:"indexstyled__StyledWrapper",componentId:"sc-1y2rzak-1"})(["& > div{display:flex;align-items:center;justify-content:space-between;}.popover{.popover-menu__btn{display:flex;width:1rem;height:1rem;align-items:center;justify-content:center;padding:0;background:transparent;&:hover{background-color:transparent;}.popover-menu__content{&.--position-bottom{&.--align-end{&::before{right:12.5px;}}}}}}"]);(0,g.ZP)(l.f).withConfig({displayName:"indexstyled__StyledCardAuthor",componentId:"sc-1y2rzak-2"})(["padding:0;.expert-wrapper{display:flex;align-items:center;}&.with-popover{padding-right:1.6rem;}"]);function b(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function w(e){for(var t=1;t img{width:12px;height:12px;margin-right:8px;}.__label{font-size:14px;}}}.report-submit{width:100%;}",""],E.fn?(0,G.iv)(["padding:0 1rem 1rem;"]):""),Q=function(e){var t=e.className,n=e.style,o=e.reason,s=e.reasonText,a=e.onClose,d=e.postId,c=(0,P.Z)().formatMessage,u=(0,I.Jn)(),p=u.loading,m=u.onReportPost;return(0,l.jsxs)(q,{className:t,style:n,children:[(0,l.jsx)("ul",{className:"report-list",children:(0,l.jsxs)("li",{className:"report-item",children:[(0,l.jsx)("img",{src:"./svg/icon-alert-circle.svg"}),(0,l.jsx)(F.T,{className:"__label",color:V.t.colors.gray800,size:"p4",children:s})]})}),(0,l.jsx)(Y.j,{className:"report-submit",size:"lg",color:"primary",loading:p,onClick:(0,r.Z)(i().mark((function e(){var t;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,m({id:d,reason:o});case 4:null!==(t=e.sent)&&void 0!==t&&t.data&&a&&a();case 6:case"end":return e.stop()}}),e)}))),children:c({id:"submit"})})]})},X=n(18833),J=n(31474),K=function(e){var t=e.url,n=e.authorEmail,o=e.onDeletePost,s=e.shareUrl,a=e.post,d=e.className,u=void 0===d?"":d,m=(e.popoverClassName,e.isMobile),v=(0,P.Z)().formatMessage,f=(0,j.useRouter)().locale,h=void 0===f?"vi-VN":f,g=(0,c.useContext)(Z.I),y=g.state,x=g.pushNotifications,b=y.userInfo,w=(0,c.useState)(!1),C=w[0],O=w[1],_=(0,c.useState)(!1),N=_[0],D=_[1],R=(0,c.useState)(!1),L=R[0],B=R[1],z=(0,M.h0)().authActionWrapper,F=(0,I.fw)(),V=F.loading,Y=(F.onFollowUnfollowPost,(0,I.ZL)().onDeletePost),G=(0,c.useContext)(X.nj).dispatch,q=n&&(null===b||void 0===b?void 0:b.email)&&n===String(null===b||void 0===b?void 0:b.email);return(0,l.jsxs)(l.Fragment,{children:[L&&(0,l.jsx)(H.T,{isMobile:m,onClose:function(){return B(!1)},editPost:a}),(0,l.jsxs)("div",{className:u,onClick:function(e){e.preventDefault(),e.stopPropagation()},children:[N&&(0,l.jsx)(p.S,{url:s,trackingCategory:E.UN,text:null===a||void 0===a?void 0:a.title,onClose:function(){return D(!1)}}),C&&(0,l.jsx)(p.P,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:v({id:"popup.deletePost.title"}),description:v({id:"popup.deletePost.description"}),acceptText:v({id:"popup.deletePost.accept"}),cancelText:v({id:"popup.deletePost.cancel"}),onAccept:(0,r.Z)(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==a&&void 0!==a&&a.id){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,Y(a.id);case 4:e.sent&&o&&o();case 6:case"end":return e.stop()}}),e)}))),onClose:function(){return O(!1)}}),(0,l.jsx)(A.p,{shadow:"lg",position:"bottom-end",width:320,styles:{dropdown:{padding:"0.5rem",border:0,boxShadow:"rgba(0, 0, 0, 0.1) 3px 3px 20px",borderRadius:"8px"}},children:function(e){var n=e.opened,o=e.open,s=e.close;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(A.p.Target,{children:(0,l.jsx)("div",{onClick:n?s:o,children:(0,l.jsx)(A.B,{unstyled:!0,styles:{root:{cursor:"pointer"}},loading:V,leftIcon:(0,l.jsx)(W.Z,{})})})}),(0,l.jsx)(A.p.Dropdown,{children:(0,l.jsx)(U.m,{data:q?{isShowheader:!1,type:"list",list:[{icon:(0,T.k3)("/svg/icon-share-on-media.svg"),label:v({id:"morePopover.share"}),dataEventCategory:E.UN,dataEventAction:"Share Text Click",dataEventLabel:t,onClick:function(){return D(!0)}},{icon:(0,T.k3)("/svg/icon-tab-edit-2.svg"),label:v({id:"actionPopover.edit"}),onClick:function(){z((function(){a&&B(!0)}))}},{icon:(0,T.k3)("/svg/icon-trash-bin.svg"),label:v({id:"actionPopover.delete"}),onClick:function(){z((function(){O(!0)}))}}]}:{isShowheader:!1,type:"list",list:[{icon:(0,T.k3)("/svg/icon-share-on-media.svg"),label:v({id:"morePopover.share"}),dataEventCategory:E.UN,dataEventAction:"Share Text Click",dataEventLabel:t,onClick:function(){return D(!0)}},{icon:null!==a&&void 0!==a&&a.bookmarked?(0,T.k3)("/svg/icon-bookmark-fill.svg"):(0,T.k3)("/svg/icon-bookmark.svg"),label:null!==a&&void 0!==a&&a.bookmarked?v({id:"morePopover.unsavePost"}):v({id:"morePopover.savePost"}),dataEventCategory:E.UN,dataEventAction:"Save Post Click",dataEventLabel:t,onClick:function(){z((0,r.Z)(i().mark((function e(){var t,n;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==b&&void 0!==b&&b.id&&null!==a&&void 0!==a&&a.id){e.next=2;break}return e.abrupt("return");case 2:if(null===a||void 0===a||!a.bookmarked){e.next=9;break}return e.next=5,(0,k.cA)((0,k.cN)(S.yy.BOOKMARK.DELETE,{_locale:h}),"DELETE",{data:{post_id:String(a.id)}});case 5:1===(null===(t=e.sent)||void 0===t?void 0:t.status)?(x({title:"",message:"Removed saved post",type:"success",displayIcon:(0,T.k3)("/svg/icon-bookmark.svg")}),G({type:J.t.update,payload:{id:a.id,data:{bookmarked:!1}}})):x({title:"",message:"Remove failed",type:"danger",displayIcon:(0,T.k3)("/svg/icon-bookmark.svg")}),e.next=13;break;case 9:return e.next=11,(0,k.cA)((0,k.cN)(S.yy.BOOKMARK.CREATE,{_locale:h}),"POST",{data:{user_id:b._togetherUserId||b.id,post_id:a.id}});case 11:1===(null===(n=e.sent)||void 0===n?void 0:n.status)?(x({title:"",message:"Post saved",type:"success",displayIcon:(0,T.k3)("/svg/icon-bookmark-fill.svg")}),G({type:J.t.update,payload:{id:a.id,data:{bookmarked:!0}}})):x({title:"",message:"Post saved failed",type:"danger",displayIcon:(0,T.k3)("/svg/icon-bookmark.svg")});case 13:case"end":return e.stop()}}),e)}))),{action:"save-post"})}},{icon:(0,T.k3)("/svg/icon-alert-circle.svg"),label:v({id:"morePopover.report"}),subTree:{title:v({id:"morePopover.report.title"}),description:v({id:"morePopover.report.description"}),isShowheader:!0,type:"list",list:Object.keys(E.$4).map((function(e){return{label:E.$4[e].label,reason:E.$4[e].reportReasonText,reasonValue:e}})).map((function(e){return{label:v({id:e.label}),subTree:{title:v({id:"morePopover.reportSubmit.title"}),description:v({id:"morePopover.reportSubmit.description"}),isShowheader:!0,type:"jsx",jsxRenderer:function(t){return(0,l.jsx)(Q,{reason:e.reasonValue,reasonText:v({id:e.reason}),postId:null===a||void 0===a?void 0:a.id,onClose:function(){return t&&t(!1)}})}}}}))},dataEventCategory:E.UN,dataEventAction:"Report Post",dataEventLabel:t}]}})})]})}})]})]})},$=n(42010),ee=n(89814),te=n(51079),ne=G.ZP.div.withConfig({displayName:"indexstyled__StyledPin",componentId:"sc-hxidb5-0"})(["display:flex;align-items:center;justify-content:center;width:24px;height:24px;background-color:",";border-radius:50%;"],(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.yellow50})),oe=G.ZP.div.withConfig({displayName:"indexstyled__StyledInnerPadding",componentId:"sc-hxidb5-1"})(["padding:16px;display:flex;flex-direction:column;gap:16px;"]),ie=(0,G.ZP)(te.U).withConfig({displayName:"indexstyled__StyledCardAuthorWrapper",componentId:"sc-hxidb5-2"})(["margin:0;"]),re=(0,G.ZP)(p.b).withConfig({displayName:"indexstyled__StyledCardReactions",componentId:"sc-hxidb5-3"})([""]),se=((0,G.ZP)(u.H).withConfig({displayName:"indexstyled__StyledHeading",componentId:"sc-hxidb5-4"})(["margin-bottom:16px;"]),G.ZP.div.withConfig({displayName:"indexstyled__StyledSocialPreview",componentId:"sc-hxidb5-5"})(["&:empty{margin-top:0;}",""],(function(e){return e.isDisable&&(0,G.iv)(["&,img{filter:grayscale(1);}"])}))),ae=(0,G.ZP)(p.c).withConfig({displayName:"indexstyled__StyledTagTopic",componentId:"sc-hxidb5-6"})([".tag-link-item{border:0;background:",";}"],(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.neutral50})),le=G.ZP.div.withConfig({displayName:"indexstyled__StyledTagList",componentId:"sc-hxidb5-7"})(["padding:0 16px;"]),de=(0,G.ZP)(p.q).withConfig({displayName:"indexstyled__StyledPostContent",componentId:"sc-hxidb5-8"})(["padding:0 !important;"]),ce=G.ZP.div.withConfig({displayName:"indexstyled__StyledCardReplyWrapper",componentId:"sc-hxidb5-9"})(["padding:0 16px 16px 16px;&:hover{cursor:pointer;}"]),ue=((0,G.ZP)($.B).withConfig({displayName:"indexstyled__StyledMoreLink",componentId:"sc-hxidb5-10"})([""]),G.ZP.div.withConfig({displayName:"indexstyled__StyledInputCommentBar",componentId:"sc-hxidb5-11"})(["margin-top:16px;"])),pe=G.ZP.div.withConfig({displayName:"indexstyled__StyledCardPost",componentId:"sc-hxidb5-12"})(["&.flat-top{border-top-left-radius:0;border-top-right-radius:0;}.post-pin{padding:0.5rem 1rem;border-radius:6px 6px 0 0;}.post-content-title{margin-bottom:16px;}.post-content-link-wrapper{color:inherit;}.post-topics{padding:0;}.most-engaging-wrapper{padding:0 16px;cursor:pointer;.author-avatar-wrapper{width:2rem;height:2rem;font-size:1rem;}.see-more-comments{width:100%;padding:0 1rem 1rem;text-align:unset;}}&[data-most-engaging='true']{border:none;","{margin:1rem;border:1px solid #e4e8ec;}}.top-divider{border-color:#e4e8ec;}.image-preview-wrapper{&[data-sensitive='true']{& > div:first-child{margin-left:16px;margin-right:16px;}}}.link-info-container{padding:0.5rem 1rem;background:#f4faff;}.link-image-wrapper{position:relative;overflow:hidden;width:100%;padding-top:56.25%;&.fetching{background:lightgray;}.loading-spinner{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);}.link-image{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:cover;object-position:center;}}"],ee.M.mbDown),me=G.ZP.div.withConfig({displayName:"indexstyled__StyledWrapper",componentId:"sc-hxidb5-13"})(["background:white;border-radius:inherit;"]),ve=G.ZP.div.withConfig({displayName:"indexstyled__StyledPostContentWrapper",componentId:"sc-hxidb5-14"})(["position:relative;"]),fe=G.ZP.div.withConfig({displayName:"indexstyled__StyledPostContentLinkWrapper",componentId:"sc-hxidb5-15"})([""]),he=G.ZP.a.withConfig({displayName:"indexstyled__StyledLinkOverlay",componentId:"sc-hxidb5-16"})(["position:absolute;top:0;left:0;right:0;bottom:0;"]),ge=(0,G.ZP)(p.A).withConfig({displayName:"indexstyled__StyledSkipQuestionOfExpertBtn",componentId:"sc-hxidb5-17"})(["display:inline-block;font-size:12px;line-height:18px;font-weight:600;border:1px solid ",";padding:3px 8px;border-radius:2px;margin-right:5px;cursor:pointer;"],V.t.colors.neutral200),ye=G.ZP.div.withConfig({displayName:"indexstyled__StyledEventInfo",componentId:"sc-hxidb5-18"})(["padding:16px;background:",";display:flex;flex-direction:column;gap:8px;align-items:flex-start;","{padding:16px 24px;flex-direction:row;justify-content:space-between;align-items:center;}"],(function(e){return e.bgColor}),ee.M.mbUp),xe=G.ZP.div.withConfig({displayName:"indexstyled__StyledEventHeader",componentId:"sc-hxidb5-19"})([""]),be=G.ZP.div.withConfig({displayName:"indexstyled__StyledEventDateBox",componentId:"sc-hxidb5-20"})(["background:white;border-radius:8px;padding:5px 12px;white-space:nowrap;","{border-radius:4px;.event-date{display:flex;gap:12px;}}.event-row{display:flex;justify-content:space-between;gap:8px;","{}}"],ee.M.mbDown,ee.M.mbUp),we=G.ZP.div.withConfig({displayName:"indexstyled__StyledEventDateWrapper",componentId:"sc-hxidb5-21"})(["","{order:2;}"],ee.M.mbUp),Ce=G.ZP.div.withConfig({displayName:"indexstyled__StyledEventDateBoxDetail",componentId:"sc-hxidb5-22"})(["border:1px solid ",";border-radius:4px;display:inline-block;padding:3px 8px;margin:12px 0 11px;align-self:flex-start;.event-date{display:flex;gap:12px;}.event-row{display:flex;gap:4px;}"],V.t.colors.neutral100),je=(G.ZP.div.withConfig({displayName:"indexstyled__StyledExpiredTag",componentId:"sc-hxidb5-23"})([""]),G.ZP.div.withConfig({displayName:"indexstyled__StyledHeadingOnDetail",componentId:"sc-hxidb5-24"})(["line-height:32px;h1{display:inline-block;margin-right:8px;}"])),Pe=G.ZP.a.withConfig({displayName:"indexstyled__StyledMiniGamePostContent",componentId:"sc-hxidb5-25"})(["text-decoration:none;color:inherit;*{pointer-events:none;}"]),Oe=(0,n(44036).k)((function(e){return{expiredTag:{background:e.colors.red[0],borderRadius:"4px",padding:"5px 12px",whiteSpace:"nowrap"}}}));function Se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ke(e){for(var t=1;t0?(0,l.jsx)(ae,{topics:w,className:"post-topics",shortenedStyle:!0,locale:We}):null},"tag-topic"),Rt=(0,l.jsx)(de,{trackingCategory:E.UN,url:bt,className:"post-content-wrapper",description:V,disableShortenContent:te,mentions:null===_e||void 0===_e?void 0:_e.mentions,"data-testid":"Content of the Post",maxChars:null!==_e&&void 0!==_e&&_e.isMinigame?350:1e3,onClickCreatePostLink:function(){vt((function(){Ye({type:D.H.SHOW_CREATE_NEW_POST_POPUP,payload:!0})}),{action:"create-post"})}},String((null===qe||void 0===qe?void 0:qe.id)||(null===_e||void 0===_e?void 0:_e.id))),Lt={post:_e,onSkip:function(){Ye({type:D.H.DECREASE_QUESTION_FOR_EXPERT}),kt(!1)}};return(0,l.jsxs)(M.Mv,{defaultParams:null!==B&&void 0!==B&&B.slug?{_joinCommunityIds:[B.id],_joinTopicIds:null===w||void 0===w?void 0:w.map((function(e){return e.id})),_location:"/".concat(B.slug,"/").concat(O)}:void 0,children:[at&&(0,l.jsx)(p.S,{url:bt,trackingCategory:E.UN,avatar:E.YS,text:f,onClose:function(){return lt(!1)}}),(0,l.jsxs)(me,ke(ke({className:r,style:a},Le),{},{children:[(0,l.jsxs)(pe,{children:[(0,l.jsxs)(oe,{children:[(0,l.jsxs)(ie,{authorProps:{isAnonymous:null===_e||void 0===_e?void 0:_e.isAnonymous,avatar:jt,name:wt,username:Ct,url:(null===A||void 0===A?void 0:A.email)===(null===qe||void 0===qe?void 0:qe.email)?Ae+S.D9.GET_PROFILE:"",email:null===A||void 0===A?void 0:A.email,timeText:null===_e||void 0===_e?void 0:_e.createdTime,time:(null===_e||void 0===_e?void 0:_e.scheduleDate)||(null===_e||void 0===_e?void 0:_e.createdDate)||W,community:B,className:"post-author with-popover",role:Pt,title:null===A||void 0===A?void 0:A.title,userId:null===A||void 0===A?void 0:A.id,expertId:null===_e||void 0===_e||null===(o=_e.author)||void 0===o?void 0:o.partnerId,organisation:null===A||void 0===A?void 0:A.organisation,specialty:null===A||void 0===A?void 0:A.specialty,doctorId:null===A||void 0===A?void 0:A.doctorId,hospitalId:null===A||void 0===A?void 0:A.hospitalId,dataEventCategory:E.UN,dataEventAction:"Writer Profile Click",dataEventLabel:(0,k.Ow)(We,He),"data-testid":"name",showDetailPopup:!0},children:[b&&(0,l.jsx)(ne,{children:(0,l.jsx)("img",{alt:"",className:"label-sort-pin-icon",src:(0,T.k3)("/svg/icon-pin-yellow.svg")})}),(null===_e||void 0===_e?void 0:_e.id)&&(null===(i=_e.author)||void 0===i?void 0:i.id)&&Xe&&(0,l.jsx)(z,{authorId:_e.author.id}),(0,l.jsx)(K,{url:bt,authorEmail:String(null===A||void 0===A?void 0:A.email),onDeletePost:Se,shareUrl:bt,post:_e,isMobile:De,className:"popover"})]}),St&&(0,l.jsx)("div",{children:(0,l.jsx)(ge,ke({},Lt))}),!(null!==_e&&void 0!==_e&&_e.isMinigame)&&(0,l.jsxs)(ve,{children:[(0,l.jsxs)(fe,{className:"post-content-link-wrapper",children:[Mt,Rt]}),Ze&&!ee&&(0,l.jsx)(he,ke(ke({href:bt},{"data-even-category":E.UN,"data-even-action":"Click Post","data-event-label":bt}),{},{onClick:function(e){Qe||(e.preventDefault(),vt((function(){return window.location.href=bt})))}}))]})]}),!(null!==_e&&void 0!==_e&&_e.isMinigame)&&Tt,(0,l.jsxs)("div",{children:[Dt,(null===_e||void 0===_e?void 0:_e.isMinigame)&&Re&&(0,l.jsxs)(oe,{children:[!It&&(0,l.jsx)(Ce,{children:Zt}),(0,l.jsxs)(je,{children:[Mt," ",It&&Et]}),Rt]}),(null===_e||void 0===_e?void 0:_e.isMinigame)&&!Re&&(0,l.jsxs)(Pe,ke(ke({href:bt},{"data-even-category":E.UN,"data-even-action":"Click Post","data-event-label":bt}),{},{onClick:function(e){Qe||(e.preventDefault(),vt((function(){return window.location.href=bt})))},children:[(0,l.jsxs)(ye,{bgColor:et[Ke.primaryColor][0],children:[(0,l.jsx)(we,{children:It?Et:_e.eventStart&&_e.eventEnd&&(0,l.jsx)(be,{children:Zt})}),(0,l.jsx)(xe,{children:Mt})]}),(0,l.jsx)(oe,{children:Rt}),Tt]}))]}),(0,l.jsxs)(oe,{children:[(0,l.jsx)(re,{trackingCategory:E.UN,trackingLabel:bt,type:R.w.post,viewCount:We!==v.L.Malaysia?G:void 0,loveCount:Y,replyCount:Q,hasShare:!1,className:"post-reaction ".concat(null!==H&&void 0!==H&&H.length||null!==F&&void 0!==F&&F.url?"hide-top-border":""),liked:ht?!q:q,onCommentClick:function(){vt((function(){X?X():rt((function(e){return!e}))}),null!==B&&void 0!==B&&B.slug?{_location:"/".concat(B.slug,"/").concat(O),action:"comment"}:{action:"comment"})},onCommentCountClick:function(){vt((function(){E.fn?rt(!0):J?J():window.location.href=xt}),{action:"comment"})},onShareClick:function(){lt(!0)},onLikeClick:function(){return x&>({id:x,isLike:!q})}}),(0,l.jsx)("div",{ref:nt,children:it&&(0,l.jsx)(ue,{children:(0,l.jsx)(_.z,{ref:tt,isMobile:De,isMainCmt:!Me,onClose:function(){return rt(!1)},onPostSuccess:function(e){null===$||void 0===$||$(e),rt(!1)},post:_e,btnProps:{dataEventCategory:E.UN,dataEventAction:"Submit Comment",dataEventLabel:bt},expandPopupProps:{heading:Be({id:"cardReactions.comment",defaultMessage:"Comment"}),note:Be({id:"cardPost.inputComment.note",defaultMessage:"Comment on {title}"},{title:"#".concat(null===_e||void 0===_e?void 0:_e.title,"")})},hasCreatePost:"moderator"===(null===qe||void 0===qe?void 0:qe.role)})})})]})]}),null===ct||void 0===ct?void 0:ct.map((function(e,t){return(0,l.jsx)(ce,{className:"most-engaging-wrapper",children:(0,l.jsx)(L.M,{isMobile:De,post:_e,isAnonymous:null===e||void 0===e?void 0:e.isAnonymous,comment:e,onDeleteComment:function(){Ie&&Ie(e)},onOpenEditInput:function(){mt(!0)},onEditCommentSuccess:function(e){var n=(0,s.Z)(ct);n[t]=e,ut(n),mt(!1)},className:"most-engaging-comment",type:"most-engaging",goToUrl:"/".concat((null===B||void 0===B?void 0:B.slug)||"_","/").concat(O)})},e.id)})),Ee]}))]})},Ne=function(e){var t=e.id,n=e.post,o=e.isMobile,s=(0,d.Z)(e,["id","post","isMobile"]),a=(0,j.useRouter)().locale,u=void 0===a?"vi-VN":a,p=(0,c.useState)([]),m=p[0],v=p[1],f=(0,c.useState)((null===n||void 0===n?void 0:n.commentCount)||0),h=f[0],g=f[1];(0,c.useEffect)((function(){(0,r.Z)(i().mark((function e(){var n,o,r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t||!h){e.next=5;break}return e.next=3,(0,k.Jl)((0,k.cN)(S.yy.COMMENT.LIST,{postId:t,_locale:u,sort:"DESC",sortByExpert:1,withoutReply:1}),"GET");case 3:r=e.sent,v((null===r||void 0===r||null===(n=r.data)||void 0===n||null===(o=n.comments)||void 0===o?void 0:o.map(O.ec))||[]);case 5:case"end":return e.stop()}}),e)})))()}),[t,u,h]);return(0,l.jsx)(_e,ke({id:t,commentCount:h,isReplied:null===n||void 0===n?void 0:n.commented,onPostCommentSuccess:function(){g(h+1)},displayComment:m,onDeleteComment:function(){g(h-1)},post:n,isMobile:o,titleAs:"h5"},s))}},33270:function(e,t,n){"use strict";n.d(t,{M:function(){return we}});var o=n(85893),i=n(809),r=n.n(i),s=n(92447),a=n(28140),l=n(26265),d=n(32292),c=n(67294),u=n(46784),p=n(93692),m=n(48560),v=n(75529),f=n(39333),h=n(88547),g=n(31040),y=n(19827),x=n(91938),b=n(2566),w=n(91759),C=n(5152),j=n(86896),P=n(2810),O=n(91720),S=n(24169),k=n(62714),_=n(40875),N=n(68558),I=n(85955),M=n(21124),E=n(26381),D=n(95983),Z=n(50572),T=n(5886),R=n(74467),L=n(13199),A=n(11163),B=n(38987),U=n(22028),z=n(43196),W=function(e){var t=e.onDeleteComment,n=e.commentId,i=e.className,a=void 0===i?"":i,l=e.popoverClassName,d=void 0===l?"":l,u=e.onEditComment,v=(0,A.useRouter)().locale,f=void 0===v?"vi-VN":v,h=(0,j.Z)().formatMessage,g=(0,c.useContext)(T.I).pushNotifications,y=(0,c.useState)(!1),x=y[0],b=y[1],w=(0,M.h0)().authActionWrapper;return(0,o.jsxs)("div",{className:a,onClick:function(e){e.preventDefault(),e.stopPropagation()},children:[x&&(0,o.jsx)(p.P,{thumbnail:"./svg/delete.svg",isThumbnailIcon:!0,title:h({id:"popup.deleteComment.title"}),description:h({id:"popup.deleteComment.description"}),acceptText:h({id:"popup.deletePost.accept"}),cancelText:h({id:"popup.deletePost.cancel"}),onAccept:(0,s.Z)(r().mark((function e(){var o,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,R.YF)({id:n,locale:f});case 4:1===(null===(o=e.sent)||void 0===o?void 0:o.status)?(null===t||void 0===t||t(),g({title:"",message:h({id:"notification.success"}),type:"success"})):g({title:"",message:h({id:(null===o||void 0===o||null===(i=o.messages)||void 0===i?void 0:i[0])||"notification.failure"}),type:"danger"});case 6:case"end":return e.stop()}}),e)}))),onClose:function(){return b(!1)}}),(0,o.jsx)("div",{className:d,children:(0,o.jsx)(m.p,{shadow:"lg",position:"bottom-end",width:320,styles:{dropdown:{padding:"0.5rem",border:0,boxShadow:"rgba(0, 0, 0, 0.1) 3px 3px 20px",borderRadius:"8px"}},children:function(e){var t=e.opened,n=e.open,i=e.close;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m.p.Target,{children:(0,o.jsx)("div",{onClick:t?i:n,children:(0,o.jsx)(m.B,{unstyled:!0,styles:{root:{cursor:"pointer"}},leftIcon:(0,o.jsx)(B.Z,{})})})}),(0,o.jsx)(m.p.Dropdown,{children:(0,o.jsx)(U.m,{data:{isShowheader:!1,type:"list",list:[{icon:(0,z.k3)("/svg/icon-tab-edit-2.svg"),label:h({id:"actionPopover.edit"}),onClick:function(){w((function(){null===u||void 0===u||u()}))}},{icon:"./svg/icon-trash-bin.svg",label:h({id:"actionPopover.delete"}),onClick:function(){w((function(){b(!0)}))}}]}})})]})}})})]})},H=n(48337),F=n(48566),V=n(32680),Y=n(92206),G=n(9713),q=n(25559),Q=(0,n(44036).k)((function(e){return{root:(0,l.Z)({display:"flex",flexDirection:"column",gap:"8px",padding:"20px 0 0"},e.fn.largerThan("md"),{padding:"32px 0 0"}),successBox:{display:"flex",flexDirection:"column",alignItems:"center"},successContent:{display:"flex",flexDirection:"column",alignItems:"center",gap:"24px",marginTop:"-5px"},successBtn:{minWidth:"165px"},submitActions:(0,l.Z)({},e.fn.largerThan("md"),{marginTop:"20px",display:"flex",justifyContent:"flex-end"}),submitBtn:(0,l.Z)({width:"100%"},e.fn.largerThan("md"),{minWidth:"100px",width:"auto"})}}));function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function J(e){for(var t=1;t ../../organisms/cardReply/verifyActions"]}}),we=function e(t){var n,i,l,C,A,B,U,z,H,F,V,Y,G,q,Q,X,J,$,ee,te,ne,ye=t.className,we=t.style,Ce=t.comment,je=t.type,Pe=void 0===je?"comment":je,Oe=t.level,Se=void 0===Oe?0:Oe,ke=t.replyingId,_e=t.isCommentDetail,Ne=t.onPostCommentSuccess,Ie=t.onEditCommentSuccess,Me=t.onOpenEditInput,Ee=t.post,De=t.onDeleteComment,Ze=t.onDeleteReply,Te=t.refetchComment,Re=t.isMobile,Le=t.goToUrl,Ae=t.showCurlBorder,Be=t.borderColor,Ue=void 0===Be?u.t.colors.neutral100:Be,ze=t.onOpposeSuccess,We=t.maxChars,He=void 0===We?200:We,Fe=t.disableShortenContent,Ve=(t.isAnonymous,t.enableEndorse),Ye=void 0===Ve||Ve,Ge=t.hasCreatePost,qe=t.hasBindCreatePost,Qe=(0,y.rZ)(),Xe=D.Vi.NEXT_PUBLIC_SSO,Je=(0,j.Z)().formatMessage,Ke=(0,c.useState)(Ce||null),$e=Ke[0],et=Ke[1],tt=(0,c.useState)(!1),nt=tt[0],ot=tt[1],it=(0,c.useState)(!1),rt=it[0],st=it[1],at=(0,c.useState)(!1),lt=at[0],dt=at[1],ct=(0,w.q)(!1),ut=(0,d.Z)(ct,2),pt=ut[0],mt=ut[1],vt=mt.open,ft=mt.close,ht=(0,c.useState)(null===$e||void 0===$e?void 0:$e.isFeedback),gt=ht[0],yt=ht[1],xt=(0,c.useRef)(null),bt=(0,c.useRef)(null);(0,c.useEffect)((function(){et(Ce),yt(null===Ce||void 0===Ce?void 0:Ce.isFeedback)}),[Ce]),(0,c.useEffect)((function(){lt&&(null===Me||void 0===Me||Me())}),[lt]),(0,c.useEffect)((function(){rt&&xt.current&&xt.current.getBoundingClientRect().bottom>window.innerHeight&&setTimeout((function(){return xt.current&&wt(null===xt||void 0===xt?void 0:xt.current)}),100)}),[rt]),(0,c.useEffect)((function(){lt&&bt.current&&bt.current.getBoundingClientRect().bottom>window.innerHeight&&setTimeout((function(){return bt.current&&wt(null===bt||void 0===bt?void 0:bt.current)}),100)}),[lt]);var wt=function(e){return xt&&window.scrollTo({top:window.scrollY+e.getBoundingClientRect().bottom+30-window.innerHeight,behavior:"smooth"})},Ct=$e.id,jt=$e.countLikes,Pt=$e.content,Ot=$e.replies,St=$e.images,kt=void 0===St?[]:St,_t=$e.author,Nt=$e.liked,It=$e.link,Mt=$e.mentionedUser,Et=$e.mentions,Dt=(0,R.yD)(Pt),Zt=Dt.text,Tt=Dt.replyingTo,Rt=(0,E.h)(),Lt=Rt.locale,At=(Rt.asPath,(0,c.useContext)(T.I)),Bt=At.state,Ut=At.dispatch,zt=Bt.userInfo,Wt=Bt.isLoggedIn,Ht=null===Ee||void 0===Ee||null===(n=Ee.community)||void 0===n?void 0:n.slug,Ft="/".concat(Ht,"/").concat(null===Ee||void 0===Ee?void 0:Ee.slug,"/"),Vt=(0,S.Rm)(Lt),Yt=(0,M.h0)(Ht?{_joinCommunityIds:[null===Ee||void 0===Ee||null===(i=Ee.community)||void 0===i?void 0:i.id],_joinTopicIds:null===Ee||void 0===Ee||null===(l=Ee.topics)||void 0===l?void 0:l.map((function(e){return e.id})),_location:Ft}:void 0).authActionWrapper,Gt=(0,c.useRef)(null),qt=(0,c.useState)(4),Qt=qt[0],Xt=qt[1],Jt=!(null===zt||void 0===zt||!zt.id)&&Ot.some((function(e){return e.author.id===zt.id})),Kt=!!Le&&"".concat((0,S.mg)(Lt)).concat(D.GW).concat(Le,"/"),$t=function(e){et((function(t){if(!t.replies.find((function(t){return t.id===e.id}))){t.replies.unshift(e);var n=xe(xe({},t),{},{replies:t.replies.slice(),countReplies:t.countReplies+1});return null===Te||void 0===Te||Te(n),n}return t}))},en=(0,c.useMemo)((function(){return"comment"===Pe&&Ot&&0!=Ot.length?Ot.sort((function(e,t){var n=new Date(e.createdAt).getTime(),o=new Date(t.createdAt).getTime();return n>o?-1:n@'.concat((null===_t||void 0===_t?void 0:_t.name)||"","")})},hasCreatePost:Ge},"input-comment-"+$e.id)}),fn=(0,o.jsx)(ie,{children:(0,o.jsx)(I.z,{colLeftWidth:Re?34:void 0,isMobile:Re,ref:Gt,onClose:function(){return dt(!1)},onPostSuccess:function(e){dt(!1),Ie&&Ie(e)},onPopupClose:function(){return dt(!1)},post:Ee,isEdit:!0,isReply:!!Se,commentId:null===$e||void 0===$e?void 0:$e.id,imageFiles:(null===$e||void 0===$e?void 0:$e.images)||[],isAnonymous:null===$e||void 0===$e?void 0:$e.isAnonymous,hideReplyMentionsInText:(null===$e||void 0===$e?void 0:$e.isAnonymous)||on,hasCreatePost:Ge},"edit-"+(null===$e||void 0===$e?void 0:$e.id))}),hn=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(h.Z,{size:20,isMarryBaby:D.fn,isSolid:Wt?Nt:jt>0,color:D.fn?u.t.mbColors.pink:u.t.colors.red800}),(0,o.jsx)("span",{className:"count-txt",children:jt})]}),gn={trackingCategory:D.UN,trackingLabel:(0,S.mg)(Lt)+Ft,type:k.w.reply,loveCount:jt,replyCount:tn,className:"post-reaction",liked:Nt,isReplied:!Jt,hasShare:!1,onCommentClick:function(){return Yt((function(){st((function(e){return!e}))}),{action:"reply-comment"})},onCommentCountClick:function(){return Yt((function(){st(!0)}),{action:"reply-comment"})},onLikeClick:function(){return Yt((0,s.Z)(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,R.DX)({commentId:Ct,setLike:!Nt,locale:Lt});case 2:1===e.sent.status&&et((function(e){return xe(xe({},e),{},{liked:!Nt,countLikes:e.countLikes+(Nt?-1:1)})}));case 4:case"end":return e.stop()}}),e)}))),{action:"like-comment"})}};return(0,o.jsxs)(M.Mv,{defaultParams:Ht?{_joinCommunityIds:[null===Ee||void 0===Ee||null===(z=Ee.community)||void 0===z?void 0:z.id],_joinTopicIds:null===Ee||void 0===Ee||null===(H=Ee.topics)||void 0===H?void 0:H.map((function(e){return e.id})),_location:"/".concat(Ht,"/").concat(null===Ee||void 0===Ee?void 0:Ee.slug)}:void 0,children:[(0,o.jsxs)(ve,{borderColor:mn,"data-is-expert-card":un,className:ye,style:we,"data-is-reply":!!Se,children:[(0,o.jsxs)(ue,{borderColor:mn,isParent:Ot.length>0,hasEditOpen:lt,children:[lt?(0,o.jsx)(fe,{borderColor:mn,ref:bt,children:fn}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(me,{borderColor:mn,"data-show-curl-border":Ae,className:"".concat(pn?"bot-card":""),authorProps:{isAnonymous:(null===$e||void 0===$e?void 0:$e.isAnonymous)||Boolean(on),avatar:sn,name:rn,username:an,className:"post-author ".concat(nn?"with-popover":""," ").concat(un?"expert-card":"user-card"),userType:null===_t||void 0===_t?void 0:_t.type,title:null===_t||void 0===_t?void 0:_t.title,userId:null===_t||void 0===_t?void 0:_t.id,role:null===_t||void 0===_t?void 0:_t.role,expertId:null===_t||void 0===_t?void 0:_t.partnerId,organisation:null===_t||void 0===_t?void 0:_t.organisation,specialty:null===_t||void 0===_t?void 0:_t.specialty,doctorId:null===_t||void 0===_t?void 0:_t.doctorId,hospitalId:null===_t||void 0===_t?void 0:_t.hospitalId,url:(null===_t||void 0===_t?void 0:_t.email)===(null===zt||void 0===zt?void 0:zt.email)?Xe+P.D9.GET_PROFILE:"",showDetailPopup:!0,hideBackground:"chatbot"===(null===_t||void 0===_t?void 0:_t.type),authActionWrapper:Yt,avatarProps:{size:Re?24:40},badgeIconSize:null!==$e&&void 0!==$e&&$e.isAnonymous||Boolean(on)?1:Re?12:15},style:{marginBottom:un||pn?"8px":0},children:[pn&&(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},onClick:function(e){Kt&&(e.preventDefault(),e.stopPropagation(),Yt((function(){"most-engaging"===Pe&&(window.location.href=Kt)})))},children:pn&&(0,o.jsx)(x.x,{onClick:function(e){return e.stopPropagation()},children:(0,o.jsx)(_.R,{})})}),nn&&(0,o.jsx)(W,{onDeleteComment:function(){return null===De||void 0===De?void 0:De($e)},className:"popover",commentId:$e.id,onEditComment:function(){return cn($e.id)}})]}),(0,o.jsx)(fe,{borderColor:mn,"data-is-expert-card":un,children:(0,o.jsxs)(pe,{children:[Ye&&(0,o.jsxs)(ge,{children:["expert"===(null===zt||void 0===zt?void 0:zt.role)&&null!==Ee&&void 0!==Ee&&Ee.isAskDoctor&&pn?(0,o.jsx)(be,{disabled:Boolean(Kt),comment:$e,onEndorseSuccess:function(e){et((function(t){return xe(xe({},t),{},{isVerify:1,userVerify:e})}))},onOpposeSuccess:ze}):null,pn&&(Boolean(null===$e||void 0===$e?void 0:$e.isVerify)&&!Boolean(null===$e||void 0===$e?void 0:$e.isOppose)?(0,o.jsx)(p.V,{title:null===$e||void 0===$e||null===(F=$e.userVerify)||void 0===F?void 0:F.title,name:null===$e||void 0===$e||null===(V=$e.userVerify)||void 0===V?void 0:V.name,userId:null===$e||void 0===$e||null===(Y=$e.userVerify)||void 0===Y?void 0:Y.id,role:null===$e||void 0===$e||null===(G=$e.userVerify)||void 0===G?void 0:G.role,avatar:null===$e||void 0===$e||null===(q=$e.userVerify)||void 0===q?void 0:q.avatar}):(0,o.jsx)("div",{style:{height:"10px"}}))]}),(0,o.jsx)(re,{className:"post-content-wrapper",replyingTo:Tt,mentionedUser:Mt,description:Zt,mentions:ln,onClick:function(e){Kt&&(e.preventDefault(),e.stopPropagation(),Yt((function(){return window.location.href=Kt})))},maxChars:He,disableShortenContent:Fe,onClickCreatePostLink:function(){qe&&Yt((function(){Ut({type:Z.H.SHOW_CREATE_NEW_POST_POPUP,payload:!0})}),{action:"create-post"})}},String((null===zt||void 0===zt?void 0:zt.id)||(null===Ee||void 0===Ee?void 0:Ee.id))),pn&&(null===Ee||void 0===Ee||null===(Q=Ee.sponsor)||void 0===Q?void 0:Q.id)&&(0,o.jsxs)(x.x,{sx:{display:"inline-flex",alignItems:"center",gap:(0,b.h)(8),background:null===(X=m.t.neutral)||void 0===X?void 0:X[0],padding:"0 ".concat((0,b.h)(8)),margin:"18px 0 8px",img:{height:(0,b.h)(36)}},children:[(0,o.jsx)(g.Z,{color:Qe.colors.blue[6],size:18}),null!==Ee&&void 0!==Ee&&null!==(J=Ee.sponsor)&&void 0!==J&&J.logo?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.T,{size:"n1",children:Je({id:"cardReply.sponsoredBy",defaultMessage:"Sponsored By"})}),(0,o.jsx)("img",{src:null===Ee||void 0===Ee||null===($=Ee.sponsor)||void 0===$?void 0:$.logo,alt:null===Ee||void 0===Ee||null===(ee=Ee.sponsor)||void 0===ee?void 0:ee.name})]}):(0,o.jsx)(v.T,{size:"n1",sx:{display:"inline-block",padding:"".concat((0,b.h)(5)," 0")},children:Je({id:"cardReply.sponsoredContent",defaultMessage:"Sponsored Post"})})]}),(0,o.jsxs)(se,{children:[kt&&kt.length>0?(0,o.jsx)("div",{className:"image-preview-wrapper","data-is-reply":!0,children:(0,o.jsx)(p.v,{images:kt,authorName:null===_t||void 0===_t?void 0:_t.username,isSensitive:Boolean(null===$e||void 0===$e?void 0:$e.isSensitive),alt:null===Ee||void 0===Ee?void 0:Ee.title})},"image-preview"):null,kt&&0!==kt.length||!It?null:(0,o.jsx)("div",{className:"link-preview-wrapper","data-is-reply":!0,children:(0,o.jsx)(p.C,{url:It})},"link-preview")]}),pn&&(0,o.jsx)(x.x,{sx:{height:"10px"}}),(0,o.jsx)(ae,xe(xe({},gn),{},{children:(0,o.jsxs)(le,{children:[(0,o.jsxs)("div",{className:"actions",children:[(0,o.jsx)("div",{className:"time-item reaction-item",children:null===$e||void 0===$e?void 0:$e.createdTime}),(0,o.jsx)(ae.LikeWrapper,{className:"reaction-item ".concat(Nt?"liked":""),children:Je({id:"mobileBar.like",defaultMessage:"Like"})}),(!pn||pn&&(null===Ee||void 0===Ee||null===(te=Ee.sponsor)||void 0===te?void 0:te.id))&&(0,o.jsx)(ae.CommentWrapper,{className:"reaction-item",children:Je({id:"cardReactions.reply",defaultMessage:"Reply"})}),pn&&!gt&&(0,o.jsx)(x.x,{className:"reaction-item",onClick:function(){Yt((function(){return null===vt||void 0===vt?void 0:vt()}))},sx:{cursor:"pointer"},children:Je({id:"cardReply.feedbackBtn",defaultMessage:"Feedback"})})]}),jt>0&&(0,o.jsx)("div",{className:"count-heart",children:hn})]})})),pn?(0,o.jsx)(he,{collapseSource:!_e,listUrl:null===$e||void 0===$e?void 0:$e.source,categorySlug:null===$e||void 0===$e?void 0:$e.categorySlug,isMarryBaby:D.fn}):null]})})]}),(0,o.jsxs)("div",{className:"comment-reply-wrapper",children:[nt&&(0,o.jsx)(N.g,{}),rt&&(0,o.jsx)(fe,{ref:xt,isParent:Ot.length>0,borderColor:mn,className:"input-wrapper",children:vn}),null===en||void 0===en||null===(ne=en.slice(0,Qt))||void 0===ne?void 0:ne.map((function(t,n){return(0,o.jsx)(de,{"data-is-last-item":n===(null===en||void 0===en?void 0:en.slice(0,Qt).length)-1,isLastItem:n===(null===en||void 0===en?void 0:en.slice(0,Qt).length)-1,children:(0,o.jsx)(e,{borderColor:un?u.t.colors.blue100:u.t.colors.neutral100,showCurlBorder:!0,isMobile:Re,comment:t,type:"reply",className:"comment-reply-item",level:Se+1,replyingId:Ct,onPostCommentSuccess:function(e){null===Ne||void 0===Ne||Ne(e),$t(e)},post:Ee,hasShare:!1,onDeleteComment:function(){var e=xe(xe({},$e),{},{replies:$e.replies.filter((function(e){return e.id!==t.id})),countReplies:$e.countReplies-1});et(e),null===Ze||void 0===Ze||Ze()},onEditCommentSuccess:function(e){var t=null===$e||void 0===$e?void 0:$e.replies.findIndex((function(t){return t.id==e.id})),n=(0,a.Z)(null===$e||void 0===$e?void 0:$e.replies);n[t]=e,et((function(e){return xe(xe({},e),{},{replies:n})}))},showInputCommentOutside:!0,disableShortenContent:!0,hasCreatePost:Ge,hasBindCreatePost:qe})},String(t.id)+n)}))]})]}),tn>Qt&&(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(ce,xe({className:"more-cmt",text:Je({id:"comment.seeMoreReplies"},{count:tn-Qt}),onClick:function(){return Xt((function(e){return e+4}))}},dn))})]}),(0,o.jsx)(f.M,{opened:pt,onClose:ft,title:Je({id:"botFeedback.modal.heading",defaultMessage:"How can we improve it ?"}),transitionProps:{transition:"fade",duration:200},withCloseButton:!0,target:D.Hh,children:(0,o.jsx)(K,{id:null===$e||void 0===$e?void 0:$e.id,onDone:function(){ft(),yt(!0)}})})]})}},20367:function(e,t,n){"use strict";n.d(t,{t:function(){return ae}});var o=n(85893),i=n(26265),r=n(38347),s=n(11163),a=n(86896),l=n(24169),d=n(37125),c=n(65557),u=n(67294),p=n(48560),m=n(13199),v=n(91256),f=v.ZP.div.withConfig({displayName:"indexstyled__StyledWrapper",componentId:"sc-5xqvvz-0"})([""]);v.ZP.div.withConfig({displayName:"indexstyled__StyledLess",componentId:"sc-5xqvvz-1"})(["margin-top:5px;color:",";&:hover{cursor:pointer;}"],(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.primaryBase}));function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function g(e){for(var t=1;t/g)||[]).length-1),r=(t||"").slice(0,o<40?40:o),a=(0,m.Nw)(r.replace(/(<|<\/)( +|[a-zA-Z]*)$/gi,"")),l=a.length div":{flexDirection:"column",rowGap:e.spacing.xs},div:{marginLeft:0,textAlign:"center"}}},item:{display:"flex",flexDirection:"column",alignItems:"center",width:"33%",cursor:"pointer"},info:{display:"flex",flexDirection:"column",gap:"4px","*":{pointerEvents:"none"}},ourGuide:{}}})),E=n(4266),D=n(95983),Z=v.ZP.div.withConfig({displayName:"indexstyled__StyledWrapper",componentId:"sc-1woxv6l-0"})(["padding-top:16px;margin-bottom:24px;&:last-child{border-bottom:0;margin-bottom:0;}"]),T=v.ZP.div.withConfig({displayName:"indexstyled__StyledHeading",componentId:"sc-1woxv6l-1"})(["font-size:14px;line-height:22px;color:",";"],(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.gray400})),R=v.ZP.div.withConfig({displayName:"indexstyled__StyledDesc",componentId:"sc-1woxv6l-2"})(["font-size:14px;line-height:22px;margin-top:16px;color:",";"],(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.gray800})),L=v.ZP.div.withConfig({displayName:"indexstyled__StyledContent",componentId:"sc-1woxv6l-3"})(["margin-top:16px;"]);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function B(e){for(var t=1;t0?(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{className:P(y.root,t),children:[(0,o.jsxs)("div",{className:y.header,children:[(0,o.jsx)("div",{className:y.thumbnail,children:(0,o.jsx)("img",{className:y.image,alt:"top contributor",src:C.C.getAssetPath("comment-1.svg")})}),(0,o.jsx)(x.H,{as:"h4",tag:"h5",className:y.heading,children:m({id:"topContributor.heading",defaultMessage:"Top Contributors"})})]}),(0,o.jsx)("div",{className:y.list,children:f.map((function(e){return(0,o.jsx)("div",{className:y.item,children:(0,o.jsx)(S.U,{authorProps:{showDetailPopup:!0,avatar:e.avatar,avatarProps:{size:56},name:e.name||e.userName,username:e.userName,userId:e.id,children:(0,o.jsxs)("div",{className:y.info,"data-event-category":"Together","data-event-action":"Standout Member Click","data-event-label":(0,l.Ow)(d,c),children:[(0,o.jsx)(j.T,{size:"s4",weight:"bold",children:e.name}),(0,o.jsx)(j.T,{size:"n1",color:"#595959",children:m({id:"topContributor.countActivities",defaultMessage:"{number} activities"},{number:(0,b.a)(e.postsCount+e.commentsCount)})})]}),dataEventCategory:"Together",dataEventAction:"Standout Member Click",dataEventLabel:(0,l.Ow)(d,c)}})},String(e.id))}))}),r&&(0,o.jsx)("div",{className:y.ourGuide,children:(0,o.jsxs)(j.T,{size:"n1",children:[m({id:"topContributor.ourGuide",defaultMessage:"Our guide recommend for new member."})," ",(0,o.jsx)(p.A,{target:"_blank",href:(0,w.g)(d)+(0,_.k3)("/guideline"),"data-event-category":"Together","data-event-action":"Guide Recommend Click","data-event-label":(0,w.g)(d)+(0,_.k3)("/guideline"),children:m({id:"topContributor.readNow",defaultMessage:"Read now"})})]})})]})}):r?(0,o.jsx)(N.g,{style:{margin:"20px 0"}}):null},ae.FeedBlock=c.B,ae.NewQuestionNoti=function(e){var t=(0,J.Z)({},e),n=(0,k.h)(),i=n.locale,r=n.asPath,s=(0,u.useContext)(te.I).state.userInfo,d=(0,a.Z)().formatMessage,c=(0,u.useContext)(te.I),p=c.state,m=p.questionForExpert,v=void 0===m?0:m,f=p.questionForExpertLoading,h=c.dispatch;return D.MN.includes(D.Vi.NEXT_PUBLIC_DEPLOY_LOCALE||"")&&D.vA.includes((null===s||void 0===s?void 0:s.role)||"")?f||null===f?(0,o.jsx)(K.g,{}):(0,o.jsxs)(ne,ie(ie({},t),{},{"data-event-category":"Together","data-event-action":"Your Question Click","data-event-label":(0,l.Ow)(i,r),onClick:function(){h({type:ee.H.SHOW_QUESTION_FOR_EXPERT_POPUP,payload:!0})},children:[(0,o.jsx)($.C,{disableDot:0===v}),(0,o.jsx)("span",{children:d({id:"newQuestionNoti.content",defaultMessage:"You have {number} Questions"},{number:v})})]})):null},ae.Container=function(e){var t=e.children,n=(0,r.Z)(e,["children"]);return(0,o.jsx)(H,se(se({className:"main-container"},n),{},{children:t}))},ae.LeftCol=function(e){var t=e.children,n=(0,r.Z)(e,["children"]);return(0,o.jsx)(Y,se(se({},n),{},{children:t}))},ae.RightCol=function(e){var t=e.children,n=(0,r.Z)(e,["children"]);return(0,o.jsx)(G,se(se({className:"home-right"},n),{},{children:t}))},ae.AboutIntro=function(e){var t=e.description,n=void 0===t?"":t,i=(0,a.Z)().formatMessage,r=(0,s.useRouter)(),d=r.locale,c=void 0===d?"vi-VN":d,u=r.asPath;return(0,o.jsx)(q,{title:i({id:"aboutThisGroup"}),description:(0,o.jsx)(y,{description:n||"",length:120,showMoreBtnProps:{"data-event-category":D.UN,"data-event-action":"See More Topic Info","data-event-label":(0,l.Ow)(c,u)}})})},ae.ForumIntro=function(e){var t=e.selectedCommunity,n=e.topicsBySelectedCommunity,i=e.communities,r=e.selectedTopic,s=e.adSlug,l=e.adUnitPath,c=e.postId,u=(0,a.Z)().formatMessage,p=(0,E.d)();return(0,o.jsxs)(q,{className:"list-forums",title:u({id:"cardList.findYourCommunities"}),description:u({id:"cardList.description",defaultMessage:"Explore our range of communities based on the health topics that matter to you the most."}),children:[s&&l&&(0,o.jsx)(d.t,{adUnitPath:l,size:[[300,250],[300,600]],divId:"div-gpt-ad-post-topbanner-".concat(p?"mobile":"desktop"),pos:["TopBanner"],style:{margin:"1rem auto"},customTargetings:{content_id:c||""}},String(p)),(0,o.jsx)(X.I,{communities:i,selectedCommunity:t,topicsBySelectedCommunity:n,selectedTopic:r,showActiveTopic:!0})]})},ae.Section=U,ae.Row=function(e){var t=e.children,n=(0,r.Z)(e,["children"]);return(0,o.jsx)(F,se(se({},n),{},{children:t}))},ae.WideCol=function(e){var t=e.children,n=(0,r.Z)(e,["children"]);return(0,o.jsx)(V,se(se({},n),{},{children:t}))}},81036:function(e,t,n){"use strict";n.d(t,{gj:function(){return st},ZP:function(){return lt}});var o,i=n(85893),r=n(28140),s=n(809),a=n.n(s),l=n(26265),d=n(92447),c=n(32292),u=n(67294),p=n(15393),m=n(48560),v=n(91938),f=n(2566),h=n(27484),g=n.n(h),y=n(15020),x=n(36380),b=n.n(x),w=n(45578),C=n.n(w),j=n(11163),P=n(86896),O=n(25559),S=n(2810),k=n(24169),_=n(37125),N=n(40875),I=n(75529),M=n(22028),E=n(26381),D=n(95983),Z=n(61023);!function(e){e.latest="latest",e.oldest="oldest",e.popular="popular",e.experts="experts"}(o||(o={}));var T=function(e){var t=e.onChange,n=e.className,o=e.style,r=e.leftLabel,s=e.rightLabel,a=e.color,l=e.value,d=e.choices,c=(0,u.useState)(),p=c[0],v=c[1];return(0,u.useEffect)((function(){v(l)}),[l]),(0,i.jsx)(Z.v,{label:r,rightLabel:(0,i.jsx)(m.p,{shadow:"lg",position:"bottom-end",width:250,styles:{dropdown:{padding:"0.5rem",border:0,boxShadow:"rgba(0, 0, 0, 0.1) 3px 3px 20px",borderRadius:"8px"}},children:function(e){var n=e.opened,o=e.open,r=e.close;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(m.p.Target,{children:(0,i.jsx)("div",{onClick:n?r:o,children:(0,i.jsxs)("div",{style:{display:"flex"},children:[(0,i.jsx)(I.T,{style:{display:"flex",alignItems:"center",fontWeight:"normal",marginRight:12},size:"p4",children:s}),(0,i.jsx)("img",{alt:"",src:D.fn?"./svg/marrybaby/sortBy.svg":"./svg/icon-sort-arrow.svg",style:{width:16,height:16,alignSelf:"center"}})]})})}),(0,i.jsx)(m.p.Dropdown,{children:(0,i.jsx)(M.m,{data:{isShowheader:!1,type:"list",list:null===d||void 0===d?void 0:d.map((function(e){return{label:e.label||"",onClick:function(){return t&&t(String(e.value))},selected:e.value===p,className:"bold-item"}}))}})})]})}}),color:a||"gray",className:n,style:o})},R=function(){var e=(0,E.h)().locale,t=(0,P.Z)().formatMessage;return function(e){var t=(0,u.useState)(o.latest),n=t[0];return{setSortChoiceValue:t[1],selectedSortChoice:null===e||void 0===e?void 0:e.find((function(e){return e.value===n})),sortedChoices:e}}([{label:t({id:"choicePopover.latest"}),value:o.latest},{label:t({id:"choicePopover.oldest"}),value:o.oldest}].concat((0,r.Z)(D.nd.includes(e)?[{label:t({id:"choicePopover.expertsComment"}),value:o.experts}]:[])))},L=n(11850),A=n(23932),B=n(33270),U=n(3905),z=n(1821),W=n(13195),H=n(21124),F=n(48253),V=n(50572),Y=n(5886),G=n(50017),q=n(63792),Q=n(43196),X=n(14153),J=n(73963),K=n(18833),$=n(31474),ee=n(20367),te=n(89814),ne=n(46784),oe=n(91256),ie=n(38347),re=n(32951),se=n(36808),ae=n.n(se),le=n(4866),de=n(44036),ce=(0,de.k)((function(){return{bar:{transitionDuration:"0ms",background:ne.t.colors.neutral300},root:{maxWidth:"calc(100% - 16px)",marginLeft:0,marginRight:0,height:(0,f.h)(4),background:"transparent",position:"relative","&:before":{position:"absolute",content:'""',top:0,left:0,right:0,bottom:0,background:"#fff",opacity:.25}}}}));function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}var pe=function(e){var t=e.embla,n=e.styles,o=(0,ie.Z)(e,["embla","styles"]),r=ce(void 0,{name:"CarouselProgressBar",styles:n}).classes,s=(0,u.useState)(0),a=s[0],d=s[1],c=(0,u.useCallback)((function(){if(t){var e=Math.max(0,Math.min(1,t.scrollProgress()));d(100*e)}}),[t,d]);return(0,u.useEffect)((function(){t&&(t.on("scroll",c),c())}),[t]),(0,i.jsx)(le.E,function(e){for(var t=1;t0,w=null===n||void 0===n?void 0:n.author,C=(null===w||void 0===w?void 0:w.name)||(null===w||void 0===w?void 0:w.username)||"",P=(null===w||void 0===w?void 0:w.username)||(null===w||void 0===w?void 0:w.name)||"",O=null===w||void 0===w?void 0:w.avatar,S={isAnonymous:null===n||void 0===n?void 0:n.isAnonymous,avatar:O,name:C,username:P,email:null===w||void 0===w?void 0:w.email,timeText:null===n||void 0===n?void 0:n.createdTime,community:null===n||void 0===n?void 0:n.community,showDetailPopup:!0,userId:null===w||void 0===w?void 0:w.id,profileModalProps:{zIndex:1e3}};return(0,i.jsxs)(Ue,Je(Je({},o),{},{children:[(0,i.jsx)(ze,{children:(0,i.jsx)(Ge,Je({},S))}),(0,i.jsxs)(We,{children:[(0,i.jsxs)(He,{children:[(0,i.jsxs)(Ve,{"data-has-thumb":b,children:[(0,i.jsx)(Re.T,{as:"h4",size:"s3",type:"bold",children:null===n||void 0===n?void 0:n.title}),(0,i.jsxs)(Fe,{children:[(0,i.jsx)(Le.q,{trackingCategory:D.UN,url:"",className:"post-content-wrapper",description:null===n||void 0===n?void 0:n.description,disableShortenContent:!1,mentions:null===n||void 0===n?void 0:n.mentions,maxChars:b?100:150}),(0,i.jsx)(Qe,Je(Je({href:x},{"data-event-category":D.UN,"data-event-action":"Click Post","data-event-label":x}),{},{onClick:function(e){r||(e.preventDefault(),s((function(){window.location.href=x})))}}))]})]}),b&&(0,i.jsx)(Ye,{className:"cursor-pointer",onClick:function(){return s((function(){window.location.href=x}))},children:(0,i.jsx)(Le.v,{images:n.photos})})]}),(0,i.jsx)(qe,{trackingCategory:D.UN,trackingLabel:x,type:Be.w.post,viewCount:d!==Ae.L.Malaysia?n.totalView:void 0,loveCount:f,replyCount:null===n||void 0===n?void 0:n.commentCount,className:"post-reaction",liked:p,hasShare:!1,onCommentClick:function(){s((function(){window.location.href=x}))},onLikeClick:function(){g&&a({id:g,isLike:!p,onCallback:function(e){m(e),h(e?f+1:f-1)}})}})]})]}))};function $e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function et(e){for(var t=1;t0&&S({ids:B,isJoin:!0,communityIds:[l.id],hideSuccessMessage:!0})};(0,u.useEffect)((function(){b&&"true"===ae().get(D.Z)&&((null===l||void 0===l?void 0:l.id)&&O({ids:[l.id],isJoin:!0,callbackFn:Z}),ae().remove(D.Z))}),[b]);var T={controls:{padding:0,left:"-15px",right:"-15px",top:"calc(50% - 35px)"},control:{width:"30px",height:"30px",border:"1px solid ".concat(ne.t.colors.neutral200),background:"white",opacity:1,boxShadow:"none",svg:{position:"absolute",width:"20px",height:"20px"}}},R="".concat((0,Q.k3)("/".concat((null===l||void 0===l?void 0:l.slug)||"_","/").concat((null===a||void 0===a?void 0:a.slug)||""))),L="".concat((0,k.mg)(h)).concat(R),A={type:"onlyButton",community:l,joinRequestLabelBtn:p({id:"actionPopover.joinCommunity",defaultMessage:"Join Community"}),onCallback:Z,authRedirect:"/".concat((null===l||void 0===l?void 0:l.slug)||"_","/").concat((null===t||void 0===t?void 0:t.slug)||""),onClickBtnCallback:function(){return!b&&ae().set(D.Z,"true")},"data-event-category":D.UN,"data-event-action":"Join Community","data-event-label":"".concat((0,k.mg)(h)).concat(g)},B=(0,u.useMemo)((function(){return s.map((function(e){return String(e.id)}))}),[]),U=0===N.length?(0,i.jsx)(we,et(et({},A),{},{btnProps:{variant:d?"secondary":"ghost",leftIcon:(0,i.jsx)(re.Z,{size:18,color:"currentColor"}),styles:{root:{paddingRight:0},leftIcon:{marginRight:(0,f.h)(5)}}}})):(0,i.jsx)(Pe,et(et({variant:d?"secondary":"ghost",leftIcon:(0,i.jsx)(re.Z,{size:18,color:"currentColor"}),onClick:function(){w({type:V.H.SHOW_CREATE_NEW_POST_POPUP,payload:!0})},styles:{root:{paddingRight:0},leftIcon:{marginRight:(0,f.h)(5)}}},{dataEventCategory:D.UN,dataEventAction:"Join Discussion",dataEventLabel:"".concat((0,k.mg)(h)).concat(g)}),{},{children:p({id:"relevantPostList.startDisCussion",defaultMessage:"Join discussion"})}));return o.length>0?(0,i.jsxs)(he,et(et({},c),{},{children:[(0,i.jsxs)(ge,{children:[(0,i.jsx)(ye,{size:"s1",children:p({id:"relevantPostList.heading",defaultMessage:"Related posts"})}),(0,i.jsx)(Ce,{children:U})]}),(0,i.jsxs)(xe,{children:[(0,i.jsxs)(be,{slideSize:d?"85%":"40%",align:"start",slideGap:"8px",getEmblaApi:E,withIndicators:!d&&o.length>1,styles:function(){return et(et({},T),{},{indicators:{position:"static",marginTop:"24px"},indicator:{width:8,height:8,borderRadius:"50%",border:"1px solid ".concat(ne.t.colors.neutral100),boxShadow:"none",background:"#fff",opacity:1,"&[data-active]":{borderColor:D.fn?ne.t.mbColors.pink:ne.t.colors.primaryBase,background:D.fn?ne.t.mbColors.pink:ne.t.colors.primaryBase}}})},children:[o.map((function(e){return(0,i.jsx)(be.Slide,{children:(0,i.jsx)(Ke,{className:"post-card-item",post:e})},e.id)})),(0,i.jsx)(be.Slide,{children:(0,i.jsx)("a",{href:L,children:(0,i.jsx)(Te,{className:"post-card-item"})})})]}),(0,i.jsx)(je,{children:U}),d&&(0,i.jsx)(pe,{embla:M,styles:{bar:{background:"#C3CBD4"},root:{background:"#fff",marginTop:(0,f.h)(20)}}})]})]})):null})).withConfig({displayName:"indexstyled__StyleRelevantPostListOutside",componentId:"sc-mxysjv-3"})(["","{margin-bottom:24px;}"],te.M.mbUp));function it(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function rt(e){for(var t=1;t0&&Ge(ne)}),[ne]),(0,u.useEffect)((function(){Te({type:G.m.updateMultiple,payload:{dataArr:de}})}),[de]),(0,u.useEffect)((function(){Te({type:q.Q.updateMultiple,payload:{dataArr:le}})}),[le]),(0,u.useEffect)((function(){We&&Te({type:$.t.update,payload:{data:te}})}),[te]),(0,u.useEffect)((function(){if(pe&&Ie&&"like"===pt){for(var e=[],t=0,n=Object.entries(Ae);t0&&Ue({ids:s,names:r,isJoin:!0,communityIds:[he]}),(null===te||void 0===te||!te.isLiked)&&ze({id:We||"",isLike:!0})}}),[pe]);var He=We&&Le[We]||te,Fe=(0,u.useRef)(null),Ve=(0,u.useState)(ne&&ne.length>0?ne:oe),Ye=Ve[0],Ge=Ve[1],qe=(0,u.useState)((null===He||void 0===He?void 0:He.commentCount)||0),Qe=qe[0],Xe=qe[1],Je=(0,u.useState)(ie||{current:1,last:1,total_items:0}),Ke=Je[0],$e=Je[1],et=(0,F.g)(J),it=(0,E.h)(),at=it.locale,lt=it.asPath,dt=it.query,ct=dt.topicPostSlug,ut=dt.communitySlug,pt=dt.postAction;(0,u.useEffect)((function(){var e=window.location.hash;if(e){var t="#oldest"===e?"oldest":"latest";ye(t),mt({page:1,sortValue:t,isRefetch:!0})}}),[lt]),(0,u.useEffect)((function(){He.community.slug&&He.slug&&"".concat(He.community.slug,"/").concat(He.slug)!=="".concat(ut,"/").concat(ct)&&it.replace("./".concat(He.community.slug,"/").concat(He.slug).concat(it.asPath.split("?")[1]?"?".concat(it.asPath.split("?")[1]):""))}),[He.community.slug,He.slug]);var mt=function(){var e=(0,d.Z)(a().mark((function e(t){var n,i,r,s,l,d,c,u,p,m,v;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Oe){e.next=2;break}return e.abrupt("return");case 2:if(Se(!0),e.prev=3,i=(n=t||{}).page,r=void 0===i?1:i,s=n.isRefetch,l=n.sortValue,d=l===o.experts?{filterByExpert:1}:l===o.oldest?{sort:"oldest"}:l===o.latest?{sort:"newest"}:{},null===He||void 0===He||!He.id){e.next=13;break}return e.next=9,(0,k.Jl)((0,k.cN)(S.yy.COMMENT.LIST,rt({postId:String(He.id),_locale:at,page:r},d)),"GET");case 9:m=e.sent,v=(null===m||void 0===m||null===(c=m.data)||void 0===c||null===(u=c.comments)||void 0===u?void 0:u.map(O.ec))||[],Ge((function(e){return C()(s?v:e.concat(v),"id")})),$e((null===m||void 0===m||null===(p=m.data)||void 0===p?void 0:p.pagination)||{current:1,last:1,total_items:0});case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),console.error(e.t0);case 18:Se(!1);case 19:case"end":return e.stop()}}),e,null,[[3,15]])})));return function(t){return e.apply(this,arguments)}}(),vt=function(){var e=(0,d.Z)(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ge((function(e){return e.unshift(t),e.slice()})),$e((function(e){return rt(rt({},e),{},{total_items:e.total_items+1})})),Te({type:$.t.update,payload:{id:He.id,data:{commented:!0}}}),Xe((function(e){return e+1}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ft=function(){var e=(0,d.Z)(a().mark((function e(t){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Ge((function(e){var n=e.findIndex((function(e){return e.id===t.id}));return e.splice(n,1,t),e.slice()}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ht=(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(nt,{className:"comment-list",children:[Ye&&Ye.length>0?Ye.map((function(e){return(0,i.jsx)(B.M,{isMobile:et,className:"post-comment",comment:e,post:He,disableShortenContent:!0,isAnonymous:e.isAnonymous,isCommentDetail:!0,onPostCommentSuccess:function(){Xe((function(e){return e+1}))},onDeleteReply:function(){Xe((function(e){return e-1}))},onDeleteComment:function(t){Ge((function(t){return t.filter((function(t){return t.id!==e.id}))})),$e((function(e){return rt(rt({},e),{},{total_items:e.total_items-1})})),Xe((function(e){return e-1-((null===t||void 0===t?void 0:t.replies)||[]).length}))},onEditCommentSuccess:function(e){Ge((function(t){var n=(0,r.Z)(t);return n[t.findIndex((function(t){return t.id===e.id}))]=e,n}))},onOpposeSuccess:function(){Ge((function(t){return t.filter((function(t){return t.id!==e.id}))})),$e((function(e){return rt(rt({},e),{},{total_items:e.total_items-1})})),Xe((function(e){return e-1}))},refetchComment:ft,hasCreatePost:"moderator"===(null===Ne||void 0===Ne?void 0:Ne.role),hasBindCreatePost:!0},e.id)})):null,(null===Ke||void 0===Ke?void 0:Ke.current)<(null===Ke||void 0===Ke?void 0:Ke.last)?(0,i.jsx)(L.V,{className:"more-cmt",onClick:function(){return mt({page:(null===Ke||void 0===Ke?void 0:Ke.current)+1,sortValue:null===xe||void 0===xe?void 0:xe.value})},text:fe({id:"comment.seeMoreComments"},{count:(null===Ke||void 0===Ke?void 0:Ke.total_items)-Ye.length})}):null]})}),gt=(0,u.useRef)(null),yt=(0,u.useRef)(null),xt=(null===(n=D.GK[at])||void 0===n?void 0:n[ut])||"",bt=(0,X.od)({countryAdTag:(0,X.Em)(at,{isMobile:et}),slug:xt}),wt={isMobile:et,post:He,community:null===He||void 0===He?void 0:He.community,topics:null===He||void 0===He?void 0:He.topics,topic:null===He||void 0===He||null===(s=He.topics)||void 0===s?void 0:s[0],topicId:null===He||void 0===He||null===(l=He.topics)||void 0===l||null===(h=l[0])||void 0===h?void 0:h.id},Ct=(0,u.useMemo)((function(){return(0,y.ZP)(He.metaSchema||"")}),[He]);return(0,i.jsx)(U.x,{ssrMenuContent:se,title:He.title||fe({id:"home.seoTitle"}),description:b()(He.description||"").slice(0,147)||fe({id:"home.seoDescription"}),image:(null===He||void 0===He||null===(g=He.photos)||void 0===g?void 0:g[0])||(null===He||void 0===He||null===(x=He.previewUrl)||void 0===x?void 0:x.image)||D.CX[at].HOMEPAGE_IMAGE,SEOData:{isIndexable:!0,hasNoAmp:!0,schemaData:"string"!==typeof Ct&&!Array.isArray(Ct)&&(0,u.isValidElement)(Ct)?Ct.props.dangerouslySetInnerHTML.__html:fe({id:"home.seoSchema"})},footerMenu:re,sitewideBanner:ae,onCreatePostClickOnBottomBar:function(){return Me({type:V.H.SHOW_CREATE_NEW_POST_POPUP,payload:!0})},isCommunitySticky:!0,isCommunityPage:!0,communities:de,communityId:null===He||void 0===He||null===(w=He.community)||void 0===w?void 0:w.id,topics:le,defaultCommunity:He.community,onPostSuccess:function(e,t){var n,o="".concat((0,k.mg)(at)).concat((0,Q.k3)("/".concat((null===t||void 0===t||null===(n=t.community)||void 0===n?void 0:n.slug)||"_","/").concat((null===t||void 0===t?void 0:t.slug)||"")));ve(o)},showCreatePostSticky:!0,children:(0,i.jsx)(H.Mv,{defaultParams:null!==(j=He.community)&&void 0!==j&&j.slug?{_joinCommunityIds:[null===He||void 0===He||null===(I=He.community)||void 0===I?void 0:I.id],_joinTopicIds:null===He||void 0===He||null===(M=He.topics)||void 0===M?void 0:M.map((function(e){return e.id}))}:void 0,children:(0,i.jsxs)(st.Provider,{value:{trigger:Ce,onTrigger:function(){return je(!Ce)}},children:[(0,i.jsx)(tt,{hasTopBackground:!0,children:(0,i.jsxs)(ee.t.Container,{children:[(0,i.jsx)(ee.t.Row,{children:(0,i.jsx)(m.l,{className:"breadcrumb",styles:{control:{width:30,padding:"0 !important",background:"transparent !important","&[data-inactive]":{width:0},marginTop:"-1px"},viewport:{marginRight:"20px"}},children:[{label:fe({id:"breadcrumb.helloTogether"}),value:(0,Q.k3)("/")},{label:He.community.name,value:He.community.isHidden?(0,Q.k3)("/".concat(ut,"/").concat(ct)):(0,Q.k3)("/".concat(ut))},{label:He.title||"Post",value:(0,Q.k3)("/".concat(ut,"/").concat(ct))}].map((function(e){return(0,i.jsx)(m.l.Item,rt(rt({href:e.value},e),{},{children:e.label}),e.value)}))})}),(0,i.jsx)(ee.t.Row,{children:(0,i.jsx)(v.x,{sx:{width:"100%"},children:(0,i.jsx)(ot,rt({posts:me},wt))})}),(0,i.jsxs)(ee.t.Row,{className:"main-content",children:[(0,i.jsx)(ee.t.LeftCol,{children:(0,i.jsxs)("div",{ref:gt,children:[(0,i.jsx)(A.o,{isMobile:et,className:"main-post",disableCardLink:!0,title:He.title,id:He.id,slug:He.slug,community:He.community,author:He.author,postDate:He.createdDate,topics:He.topics,photos:He.photos,previewUrl:He.previewUrl,description:He.description,commentCount:Qe,viewCount:He.totalView,loveCount:He.likeCount,onCommentCountClick:function(){var e;return null===(e=Fe.current)||void 0===e?void 0:e.scrollIntoView()},isReplied:!Boolean(He.commented),isLiked:He.isLiked,onDeletePost:function(){return it.push("/")},post:He,disableShortenContent:!0,onPostCommentSuccess:vt,InlineCommentsComponent:D.fn?ht:void 0,showInputComment:Ie,showSkipQuestionBtn:!0,isDetail:!0}),!D.fn&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{className:"sort-container",ref:Fe,children:(0,i.jsx)(T,{color:"white",value:(null===xe||void 0===xe?void 0:xe.value)||"",onChange:function(e){e!==(null===xe||void 0===xe?void 0:xe.value)&&(ye(e),mt({page:1,sortValue:e,isRefetch:!0}),window.location.hash="#"+e)},className:"label-sorting",leftLabel:et?(null===xe||void 0===xe?void 0:xe.label)||"":fe({id:"comment.count"},{count:Qe}),rightLabel:et?fe({id:"choicePopover.sort"}):(null===xe||void 0===xe?void 0:xe.label)||"",choices:be})}),ht]}),et&&xt&&(0,i.jsx)(p.U,{adUnitPath:bt,size:[[300,250],[300,600]],divId:"div-gpt-ad-post-MidBanner1-".concat(et?"mobile":"desktop"),pos:["MidBanner1"],style:{margin:"1rem auto"}},String(et))]})}),(0,i.jsx)(ee.t.RightCol,{children:(0,i.jsxs)("div",{ref:yt,style:{paddingTop:(0,f.h)(20)},children:[(0,i.jsx)(N.R,{isBanner:!0}),!et&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:{height:"16px"}}),(0,i.jsx)(ee.t.NewQuestionNoti,{})]}),(0,i.jsx)(ee.t.TopContributor,{communityId:String(null===He||void 0===He||null===(Z=He.community)||void 0===Z?void 0:Z.id),hasGuidelineList:ue}),!et&&(0,i.jsx)(ee.t.ForumIntro,{communities:de,topicsBySelectedCommunity:Object.keys(Ae).length>0?Object.keys(Ae).map((function(e){return Ae[e]})):le,selectedCommunity:null===He||void 0===He?void 0:He.community,adSlug:xt,adUnitPath:bt,postId:null===He||void 0===He?void 0:He.id}),!et&&xt&&(0,i.jsx)(p.U,{adUnitPath:bt,size:[[300,250],[300,600]],divId:"div-gpt-ad-post-MidBanner1-".concat(et?"mobile":"desktop"),pos:["MidBanner1"],style:{margin:"1rem auto"},customTargetings:{content_id:He.id||""}},String(et))]})})]})]})}),xt&&(0,i.jsx)(_.E,{className:"article-bottom-ad",isMobile:et,adUnitPath:bt})]})})})},lt=function(e){var t=e.post,n=e.communities,o=e.topics,r=e.commentsPagination,s=e.hasGuidelineList,l=e.hotDiscussPosts,p=(0,u.useContext)(Y.I).state.userInfo,m=(0,j.useRouter)().locale,v=void 0===m?"vi-VN":m,f=(0,u.useState)(t),h=f[0],y=f[1],x=(0,u.useState)(n),b=x[0],w=x[1],C=(0,u.useState)(o),P=C[0],_=C[1],N=(0,u.useState)(),I=N[0],M=N[1],E=(0,u.useState)([]),D=E[0],Z=E[1],T=(0,u.useState)(r),R=T[0],L=T[1],A=(0,u.useState)([]),B=A[0],U=A[1],z=(0,u.useState)(!1),W=z[0],H=z[1],F=(0,u.useState)(s),V=F[0],G=F[1],q=(0,u.useState)(l),Q=(q[0],q[1]),X=function(){var e=(0,d.Z)(a().mark((function e(){var n,o,i,r,s,l,d,u,m,f,h,x,b,C,j,P,N,I,E,D,T,R,A,B;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("undefined"===typeof p){e.next=30;break}return h=new Date,x=g()().format("YYYY-MM-DD"),b=new Date(h.getTime()).setDate(h.getDate()-60),C=g()(b).format("YYYY-MM-DD"),e.next=7,Promise.all([(0,k.Jl)((0,k.cN)(S.yy.POST.DETAIL_BY_ID_OR_SLUG,{idSlug:String(t.id),_locale:v,metaSchema:1}),"GET"),(0,k.Jl)((0,k.cN)(S.yy.COMMENT.LIST,{postId:String(t.id),_locale:v,sort:"newest"}),"GET"),(0,k.Jl)((0,k.cN)(S.yy.TOPIC.LIST,{communityId:t.community.id,_locale:v}),"GET"),(0,k.Jl)((0,k.cN)(S.yy.COMMUNITY.LIST,{_locale:v}),"GET"),(0,k.t9)((0,k.cN)(S.yy.GUIDELINE.LIST,{_locale:v}),"GET"),(0,k.t9)((0,k.cN)(S.yy.COMMUNITY.GET_HOT_DISCUSSION,{communityId:String(t.community.id),pageSize:5,startDate:C,endDate:x,postId:String(t.id),_locale:v}),"GET")]);case 7:return j=e.sent,P=(0,c.Z)(j,6),N=P[0],I=P[1],E=P[2],D=P[3],T=P[4],R=P[5],e.next=17,(0,J.Q)(v);case 17:A=e.sent,M(A),y((0,O.W1)((null===N||void 0===N?void 0:N.data)||{})),L((null===I||void 0===I||null===(n=I.data)||void 0===n?void 0:n.pagination)||null),B=(null===I||void 0===I||null===(o=I.data)||void 0===o||null===(i=o.comments)||void 0===i?void 0:i.map(O.ec))||[],Z(B||[]),_(null===E||void 0===E||null===(r=E.data)||void 0===r||null===(s=r.topics)||void 0===s?void 0:s.map(O.UA)),w(((null===D||void 0===D||null===(l=D.data)||void 0===l?void 0:l.communities)||[]).map(O.yf)),G(((null===T||void 0===T||null===(d=T.data)||void 0===d||null===(u=d.guidelines)||void 0===u||null===(m=u[0])||void 0===m?void 0:m.post)||[]).length>0),H(!0),Q(((null===R||void 0===R||null===(f=R.data)||void 0===f?void 0:f.posts)||[]).map(O.W1)),e.next=31;break;case 30:setTimeout(K.current,1e3);case 31:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),K=(0,u.useRef)(X);return K.current=X,(0,u.useEffect)((function(){setTimeout(K.current,500)}),[null===t||void 0===t?void 0:t.id]),(0,u.useEffect)((function(){"undefined"!==typeof p&&(0,d.Z)(a().mark((function e(){var t,n,o,i;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(["expert"===(null===p||void 0===p?void 0:p.role)&&(null===h||void 0===h?void 0:h.isAskDoctor)&&(0,k.t9)((0,k.cN)(S.yy.COMMENT.LIST_OPPOSE_REASONS,{_locale:v}),"get")]);case 2:n=e.sent,o=(0,c.Z)(n,1),i=o[0],U(((null===i||void 0===i||null===(t=i.data)||void 0===t?void 0:t.reasons)||[]).map(O.Aw));case 6:case"end":return e.stop()}}),e)})))()}),[p]),(0,i.jsx)(at,rt(rt(rt({},e),I),{},{post:h,communities:b,topics:P,comments:D,commentsPagination:R,opposeReasons:B,hasGuidelineList:V,refetchAlready:W}))}},14153:function(e,t,n){"use strict";n.d(t,{od:function(){return s},Em:function(){return a}});n(68929);var o={"vi-VN":"HelloBacsi","id-ID":"HelloSehat","ms-MY":"HelloDoktor","km-KH":"HelloKrupet","en-PH":"HelloDoctorPH","th-TH":"HelloKhunmor","my-MM":"HelloSayarwon","zh-TW":"HelloYishi","hi-IN":"HelloSwasthya"},i="Mobile",r="Desktop",s=function(e){var t=e.countryAdTag,n=e.slug;return"/21682272649/".concat(t,"/").concat(t,"_Community/").concat(n)},a=function(e,t){var n=t.isMobile;return o[e]+(n?i:r)}},74467:function(e,t,n){"use strict";n.d(t,{_Y:function(){return c},rd:function(){return u},uA:function(){return p},yD:function(){return m},Xi:function(){return v},DX:function(){return f},YF:function(){return h}});var o=n(809),i=n.n(o),r=n(92447),s=n(2810),a=n(24169),l=n(95983),d=n(13199),c=function(){var e=(0,r.Z)(i().mark((function e(t){var n,o,r,s,a,c,u,p,m,v,f,h,g,y,x,b,w;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.postId,o=t.message,r=t.photos,s=t.link,a=t.locale,c=t.replyingUserId,u=t.replyingUserName,p=t.replyingId,m=t.isAdmin,v=t.sourceList,f=t.type,h=t.isAnonymous,g=void 0!==h&&h,y=t.hideReplyMentionsInText,x=new FormData,b=(0,d.dM)(o.replace(/(\ )+/g," ")),w=(0,d.Dc)(b),!(r&&r.length>0)){e.next=9;break}return e.next=7,Promise.all(null===r||void 0===r?void 0:r.map((function(e){return(0,d.tx)(e,a,m)})));case 7:e.sent.filter(Boolean).slice(0,l.O_).forEach((function(e){x.append("images[]",e)}));case 9:return s&&x.append("link",s),null===w||void 0===w||w.forEach((function(e){x.append("mention_ids[]",e)})),x.append("post_id",n),p&&x.append("parent_id",p),c&&(w.unshift(c),y||(b='[mention+id="'.concat(c,'"+name="').concat((u||"").replace('"',"'"),'"]').concat(b)),x.append("parent_user_id",String(c))),null===v||void 0===v||v.forEach((function(e){x.append("sources[]",e)})),f&&x.append("type",f),x.append("is_anonymous",String(Number(g))),x.append("content",b),e.abrupt("return",x);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u=function(){var e=(0,r.Z)(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,a.cA)((0,a.cN)(s.yy.COMMENT.CREATE,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}}));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),p=function(){var e=(0,r.Z)(i().mark((function e(t,n,o,r){var l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=r?a.Cl:a.cA,e.abrupt("return",l((0,a.cN)(r?s.qf.COMMENT.UPDATE:s.yy.COMMENT.UPDATE,{_locale:o,id:t}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}}));case 2:case"end":return e.stop()}}),e)})));return function(t,n,o,i){return e.apply(this,arguments)}}(),m=function(e){try{var t=e.match(/\[@([^\]]+)\]/),n=t?t[0].replace("[@","").replace("]",""):"";return{text:e.replace(/\[@([^\]]+)\]/,"").trim(),replyingTo:n}}catch(o){console.error(o)}return{text:""}},v=function(){var e=(0,r.Z)(i().mark((function e(t,n){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,a.cA)((0,a.cN)(s.yy.COMMENT.REPLY,{_locale:n}),"POST",{data:t,headers:{"Content-Type":"multipart/form-data"}}));case 1:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),f=function(){var e=(0,r.Z)(i().mark((function e(t){var n,o,r,l;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commentId,o=t.setLike,r=void 0!==o&&o,l=t.locale,e.abrupt("return",(0,a.cA)((0,a.cN)(r?s.yy.COMMENT.LIKE:s.yy.COMMENT.UNLIKE,{_locale:l,id:n}),"GET"));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),h=function(e){var t=e.id,n=e.locale;return(0,a.cA)((0,a.cN)(s.yy.COMMENT.DELETE,{_locale:n,id:t}),"DELETE")}},73963:function(e,t,n){"use strict";n.d(t,{Q:function(){return u}});var o=n(809),i=n.n(o),r=n(26265),s=n(92447),a=n(92351),l=n(95983);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function c(e){for(var t=1;t