(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3824],{8346:function(e,t,n){"use strict";n.d(t,{N:function(){return i},w:function(){return c}});var r=n(91256),o=n(95983),i=r.ZP.div.withConfig({displayName:"indexstyled__StyledLoading",componentId:"sc-4vozm6-0"})(["display:flex;align-items:center;justify-content:center;padding:1em;button{position:relative;}"]),a=(0,r.F4)(["0%{transfrom:rotate(0deg);}100%{transform:rotate(360deg);}"]),c=r.ZP.div.withConfig({displayName:"indexstyled__StyledLoadingCard",componentId:"sc-4vozm6-1"})(["display:flex;width:fit-content;width:-moz-fit-content;flex-direction:column;align-items:center;justify-content:center;padding:1rem 2rem;background:white;border-radius:6px;box-shadow:-1px 1px 2px rgba(67,70,74,0.0001),-2px 2px 5px rgba(67,86,100,0.123689);.loading-spinner{width:24px;height:24px;margin-bottom:0.5rem;animation:"," 1.2s linear infinite;}",""],a,o.fn&&(0,r.iv)(["box-shadow:none;"]))},68558:function(e,t,n){"use strict";n.d(t,{g:function(){return c}});var r=n(85893),o=n(57849),i=n(86896),a=n(8346),c=function(e){var t=e.className,n=e.size,c=void 0===n?"md":n,s=(0,i.Z)().formatMessage;return(0,r.jsx)(a.N,{className:t,children:(0,r.jsx)(o.B,{size:c,color:"transparent",isLoading:!0,style:{fontWeight:"normal"},children:s({id:"loading"})})})}},56521:function(e,t,n){"use strict";n.d(t,{Vd:function(){return u},vM:function(){return p},dS:function(){return f},fB:function(){return m},G9:function(){return h},SL:function(){return x},yS:function(){return g},VL:function(){return v},U8:function(){return b},BD:function(){return y},fm:function(){return w},ie:function(){return k},B8:function(){return _},AP:function(){return S},lz:function(){return j}});var r=n(36308),o=n(10917),i=n(45897),a=n(74128),c=n(16114),s=n(27124),l=n(91256),d=n(95983),u=l.ZP.div.withConfig({displayName:"indexstyled__StyledFormWrapper",componentId:"sc-4ohwi-0"})(["width:100%;display:flex;flex-direction:column;height:100%;"]),p=l.ZP.div.withConfig({displayName:"indexstyled__StyleActionFooter",componentId:"sc-4ohwi-1"})(["display:flex;padding:16px 24px 24px 24px;justify-content:space-between;align-items:center;box-shadow:0px -2px 10px 0px rgba(0,0,0,0.08);","{padding:8px 16px 12px 16px;gap:12px;flex-direction:column;justify-content:flex-start;align-items:flex-start;}"],r.M.mbDown),f=l.ZP.div.withConfig({displayName:"indexstyled__StyledFormGroup",componentId:"sc-4ohwi-2"})(["flex:1;margin-top:16px;overflow-y:auto;&[data-is-fullscreen='false']{-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}}","{flex:1 1 0%;}"],r.M.mbDown),m=l.ZP.div.withConfig({displayName:"indexstyled__StyledFormGroupInner",componentId:"sc-4ohwi-3"})(["max-width:680px;margin:0 auto;padding:0 24px;","{padding:0 16px;}.swich-input-group{padding:12px 16px;border-radius:8px;background:",";&.askdoctor-switch{background:",";}.switch-label{display:flex;align-items:center;}.mantine-Switch-labelWrapper{flex-grow:1;}.mantine-Checkbox-body{display:flex;width:100%;align-items:center;justify-content:space-between;}.mantine-Switch-track{margin-bottom:0;}.label-txt{font-weight:normal;font-size:14px;color:",";margin-left:","px;}}"],r.M.mbDown,o.r.colors.neutral50,d.fn?o.r.mbColors.tonePink:o.r.colors.blue50,o.r.colors.gray800,d.fn?10:14),h=l.ZP.div.withConfig({displayName:"indexstyled__StyledCreateNewPost",componentId:"sc-4ohwi-4"})(["position:relative;display:flex;height:100%;flex-direction:column;.input-group{margin-bottom:16px;","{margin-bottom:16px;}input:focus,textarea:focus,[contenteditable='true']{outline:none;}label{margin-bottom:5px;color:",";font-size:13px;font-weight:bold;}.input-group-label{margin-bottom:5px;color:",";font-size:13px;font-weight:bold;}.input-notification{display:flex;& > img{width:16px;height:16px;margin-top:1.5px;margin-right:8px;}}.input-click{> *{pointer-events:none;}}.tag-list{}}.submit-btn{width:fit-content;","{width:100%;}}"],r.M.mbDown,(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.gray600}),(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.gray600}),r.M.mbDown),x=(0,l.ZP)(i.a).withConfig({displayName:"indexstyled__StyledPopupFrame",componentId:"sc-4ohwi-5"})(["> div[data-type='confirm']{max-width:504px;border-radius:16px;","{max-width:100vw;width:100vw;height:100%;transition:all 0.3s ease-in-out 0s;border-radius:0;&[data-open='true']{z-index:500;}}height:90vh;overflow-y:auto;.popup-content{.header{padding:16px 60px 16px 24px;height:auto;","{padding:12px 24px 12px 24px;}h5{font-size:16px;font-weight:600;line-height:24px;","{width:100%;}}}.close-button{right:24px;top:18px;","{display:none;}}}}"],r.M.mbDown,r.M.mbDown,r.M.mbDown,r.M.mbDown),g=l.ZP.div.withConfig({displayName:"indexstyled__StyledIsQuestionWrapper",componentId:"sc-4ohwi-6"})(["padding:10px 16px;border-top:none;border-radius:12px;background:",";display:flex;flex-direction:column;gap:8px;&.has-error{border:1px solid ",";}&.error-description{border:1px solid ",";border-top:none;}"],o.r.colors.neutral50,o.r.colors.red600,o.r.colors.red600),v=l.ZP.div.withConfig({displayName:"indexstyled__StyledQuestionWrapperContainer",componentId:"sc-4ohwi-7"})(["padding:8px 8px;border:1px solid ",";border-top:none;border-radius:0 0 8px 8px;&.has-error{border:1px solid ",";}&.error-description{border:1px solid ",";border-top:none;}.error-choice-question{color:",";font-size:12px;font-weight:400;line-height:22px;letter-spacing:-0.2px;}"],o.r.colors.gray200,o.r.colors.red600,o.r.colors.red600,o.r.colors.red600),b=l.ZP.div.withConfig({displayName:"indexstyled__StyledIsQuestion",componentId:"sc-4ohwi-8"})(["display:flex;width:100%;align-items:center;justify-content:space-between;border-radius:8px;background:",";gap:12px;&.has-error{border:1px solid ",";}&.error-description{border:1px solid ",";border-top:none;}.switch-label{display:flex;align-items:center;gap:12px;.wrapper-text{.label-txt{color:",";font-size:14px;font-weight:600;line-height:22px;}.description-txt{color:",";font-size:12px;font-weight:400;line-height:18px;}}}.switch-btn{.mantine-Switch-track{margin:0;min-width:40px;width:40px;}.mantine-Switch-labelWrapper{display:none;}}button{height:40px;&:hover,&.primary{border-radius:4px;border:1px solid ",";background:",";color:",";}}"],o.r.colors.neutral50,o.r.colors.red600,o.r.colors.red600,o.r.colors.gray800,o.r.colors.gray700,o.r.colors.blue100,o.r.colors.blue50,o.r.colors.primaryBase),y=l.ZP.div.withConfig({displayName:"indexstyled__StyledError",componentId:"sc-4ohwi-9"})(["margin-bottom:12px;.mantine-Text-root{color:",";font-size:12px;font-weight:400;line-height:18px;display:block;}svg{margin-right:5px;}svg,span{vertical-align:middle;}"],o.r.colors.red600),w=l.ZP.div.withConfig({displayName:"indexstyled__StylePostAction",componentId:"sc-4ohwi-10"})(["display:flex;gap:12px;.avatar{width:40px;height:40px;border-radius:100%;background:",";img{border-radius:100%;}.author-avatar{.col-left{display:none;}}}.post-action-form{display:flex;flex-direction:column;gap:4px;}.post-action-by{color:",";font-size:16px;font-weight:600;line-height:24px;}.post-action-result{display:flex;position:relative;}.dropdown-post-action{background:"," !important;border-radius:2px;border:1px solid "," !important;border-radius:8px;> div{padding:3px 4px 3px 8px;}span{flex:1;color:",";font-size:12px;font-weight:600;line-height:18px;}ul{width:130px;li{img{flex:0 0 16px;width:16px;}}}}"],o.r.colors.neutral100,o.r.colors.gray800,o.r.colors.white,o.r.colors.neutral200,o.r.colors.gray600),k=((0,l.ZP)(c.Z).withConfig({displayName:"indexstyled__StyleDropdown",componentId:"sc-4ohwi-11"})(["color:red;.dropdown-post-action{width:200px;}"]),(0,l.ZP)(s.Z).withConfig({displayName:"indexstyled__StyleMenu",componentId:"sc-4ohwi-12"})(["border-radius:4px;padding:4px;border:1px solid ",";background:",";box-shadow:0px 10px 16px 0px rgba(0,0,0,0.04),0px 2px 8px 0px rgba(0,0,0,0.04),0px 0px 1px 0px rgba(0,0,0,0.04);.ant-dropdown-menu-item{display:flex;align-items:center;height:32px;padding:4px 16px;gap:8px;.ant-dropdown-menu-title-content{flex:1;color:",";font-size:12px;font-weight:400;line-height:18px;}}"],o.r.colors.gray100,o.r.colors.white,o.r.colors.gray700),l.ZP.div.withConfig({displayName:"indexstyled__StyleSessionRow",componentId:"sc-4ohwi-13"})(["display:inline-flex;gap:8px;align-items:center;cursor:pointer;.session-title{color:",";font-size:14px;font-weight:600;line-height:22px;flex:1;}"],o.r.colors.gray600)),_=l.ZP.div.withConfig({displayName:"indexstyled__StyleHeadingPopupWrapper",componentId:"sc-4ohwi-14"})(["display:flex;gap:12px;justify-content:space-between;.btn-close{cursor:pointer;display:flex;justify-content:center;align-items:center;}"]),S=l.ZP.div.withConfig({displayName:"indexstyled__StyleHeadingPopup",componentId:"sc-4ohwi-15"})(["display:flex;gap:12px;color:",";font-size:18px;font-weight:600;line-height:28px;letter-spacing:-0.4px;","{justify-content:center;flex:1;}"],o.r.colors.gray800,r.M.mbDown),j=(0,l.ZP)(a.s).withConfig({displayName:"indexstyled__StyleSwitchButton",componentId:"sc-4ohwi-16"})(["gap:8px;&.mantine-SegmentedControl-root{background-color:transparent;padding:0px;}.mantine-SegmentedControl-indicator{display:none;}.mantine-SegmentedControl-label{margin-bottom:0px !important;display:flex;padding:5px 12px;justify-content:center;align-items:center;gap:8px;height:32px;border:1px solid ",";}.mantine-SegmentedControl-control{color:",";font-size:14px;font-style:normal;font-weight:600;line-height:22px;border-radius:8px;background:",";border-width:0 !important;}.mantine-SegmentedControl-controlActive{border-radius:8px;background:",";.mantine-SegmentedControl-label{color:",";border:1px solid ",";}}"],o.r.colors.neutral100,o.r.colors.gray800,o.r.colors.white,o.r.colors.blue50,o.r.colors.primaryBase,o.r.colors.blue50)},88902:function(e,t,n){"use strict";var r;n.d(t,{S:function(){return r},m:function(){return o}}),function(e){e.title="create-post-title-field",e.description="create-post-description-field",e.photos="create-post-photos-field"}(r||(r={}));var o=["title","description","photos"]},13011:function(e,t,n){"use strict";n.d(t,{g:function(){return i},s:function(){return a}});var r=n(10917),o=n(91256),i=o.ZP.div.withConfig({displayName:"indexstyled__StyledCreatePostTitle",componentId:"sc-2oizzo-0"})(["input:focus,textarea:focus,[contenteditable='true']{outline:none;}input{&::placeholder{font-size:16px;}}.title-input{overflow:hidden;width:100%;padding:12px 16px;border:solid 1px #d9d9d9;border-radius:6px;font-size:16px;line-height:1.2;white-space:nowrap;:focus{border-color:",";box-shadow:0px 0px 2px 2px ",";}br{display:none;}*{display:inline;white-space:nowrap;}mocka{padding:2px 6px;border-radius:1rem;&[data-error='true']{background-color:#ffeeee;color:red;text-decoration:underline;font-style:bold;}}ol,ul{padding-left:1rem;}}label{display:block;margin-bottom:5px;color:",";font-size:13px;font-weight:bold;}.count-string{color:",";font-size:14px;text-align:right;font-weight:400;line-height:22px;letter-spacing:-0.2px;text-transform:lowercase;}.has-input-error{input{border:1px solid ",";}.title-input{border:1px solid ",";}}"],(function(e){return e.color}),(function(e){return e.colorShadow}),(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.gray600}),(function(e){var t;return null===(t=e.theme)||void 0===t?void 0:t.colors.gray400}),r.r.colors.red600,r.r.colors.red600),a=o.ZP.div.withConfig({displayName:"indexstyled__StyleWrapperTitle",componentId:"sc-2oizzo-1"})(["display:flex;justify-content:space-between;align-items:center;margin-bottom:2px;.field-label{color:",";font-size:14px;font-weight:600;line-height:22px;}"],r.r.colors.gray600)},2460:function(e,t,n){"use strict";n.d(t,{Y:function(){return g}});var r=n(85893),o=n(67294),i=n(37699),a=n(10917),c=n(83129),s=n(23279),l=n.n(s),d=n(86896),u=n(13199),p=n(56521),f=n(88902),m=n(13011),h=(0,n(44036).k)((function(e){return{root:{}}})),x=function(e,t){if(!t)return e;var n=t.limit,r=t.bannedWords,o=void 0===r?[]:r,i="number"===typeof n&&n>=0?e.substring(0,n):e;return(0,u.on)(i,o)},g=function(e){var t=e.className,n=e.style,s=e.bannedWords,g=void 0===s?[]:s,v=e.value,b=e.placeholder,y=void 0===b?"":b,w=e.error,k=e.onChange,_=h(void 0,{name:"CreatePostTitle"}).theme,S=_.colors,j=(0,d.Z)().formatMessage,C=(0,o.useState)(""),N=C[0],P=C[1],D=(0,o.useRef)(null);(0,o.useEffect)((function(){if(D.current){var e=function(e){var t;e.preventDefault();var n=null===(t=e.clipboardData)||void 0===t?void 0:t.getData("text/plain");document.execCommand("insertHTML",!1,n)},t=D.current;return t.addEventListener("paste",e),function(){return t.removeEventListener("paste",e)}}}),[D]);var T=(null===g||void 0===g?void 0:g.join(","))||"";(0,o.useEffect)((function(){if(T){var e,t=null===(e=D.current)||void 0===e?void 0:e.innerText;if(t){var n=(0,u.on)(t,g);n!==t&&(k&&k(n),P(n))}}}),[T]);var Z=(0,o.useCallback)(l()((function(e){if(e){var t=x(e,{limit:120,bannedWords:g});k&&k(t),P(t)}}),300),[]);return(0,r.jsxs)(m.g,{className:t,style:n,color:_.fn.primaryColor(),colorShadow:S[_.primaryColor][2],children:[(0,r.jsxs)(m.s,{children:[(0,r.jsx)(c.T,{size:"p4",className:"field-label",children:j({id:"createPost.title"})}),(0,r.jsxs)(c.T,{size:"p4",className:"count-string",children:["".concat(null===v||void 0===v?void 0:v.length,"/").concat(120),"\xa0",j({id:"character"})]})]}),(0,r.jsx)(i.I,{name:"title",value:v||N,size:"md",placeholder:y,onChange:function(e){if(e!==(v||N)){var t=x(e,{bannedWords:g});k&&k(t),P(t),Z(e)}},"data-testid":"Title Text box",className:"".concat(f.S.title," ").concat(w&&null!==w&&void 0!==w&&w.title?"has-input-error":"")}),w&&(null===w||void 0===w?void 0:w.title)&&(0,r.jsx)(p.BD,{style:{margin:"4px 0 0"},children:(0,r.jsx)(c.T,{size:"p5",as:"span",color:a.r.colors.red600,children:w.title})})]})}},75653:function(e,t,n){"use strict";n.d(t,{w:function(){return Z}});var r=n(85893),o=n(26265),i=n(67294),a=n(28140),c=n(809),s=n.n(c),l=n(92447),d=n(32763),u=n(83129),p=n(67128),f=n(86315),m=n(93178),h=n(42874),x=n(31040),g=n(70027),v=n(96486),b=n(86896),y=n(25559),w=n(2810),k=n(24169),_=n(68558),S=n(4266),j=n(26381),C=n(95983),N=(0,n(44036).k)((function(e){return{root:{display:"flex",flexDirection:"column",gap:"1.5rem",padding:"0.5rem 0 1rem"},header:{display:"flex",flexWrap:"wrap",gap:"0.25rem"},icon:{marginTop:"1px"},group:{display:"flex",flexDirection:"column",gap:"0.5rem"},list:{display:"flex",flexWrap:"wrap",gap:"0.5rem"},dropdown:(0,o.Z)({paddingBottom:"58px",zIndex:100,background:"#fff",position:"relative",borderRadius:"8px"},e.fn.smallerThan("sm"),{borderRadius:"8px 8px 0 0"}),backdrop:{zIndex:10,position:"fixed",top:0,left:0,right:0,bottom:0,opacity:.3,background:"#000"},dropdownInner:{maxHeight:"230px",overflowY:"auto"},dropdownContainer:{display:"flex",flexDirection:"column"},item:{"&.month-topic":{textTransform:"capitalize"}},btnWrapper:{position:"absolute",right:"16px",bottom:"8px",left:"16px"},dropdownHeader:{padding:"16px",borderBottom:"1px solid ".concat(e.colors.gray[1]),color:e.colors.gray[8],fontSize:"16px",fontWeight:600,lineHeight:"24px",display:"flex",justifyContent:"space-between"}}}));function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function D(e){for(var t=1;t0&&(0,r.jsxs)("div",{className:L.group,children:[(0,r.jsxs)("div",{className:L.header,children:[(0,r.jsx)(x.Z,{className:L.icon,isSolid:!0,size:16,color:W.colors.gray[4]}),(0,r.jsx)(u.T,{size:"n1",color:W.colors.gray[6],children:I({id:"createPost.popup.guideSelectMonthTopics",defaultMessage:"Choose topics about your baby's birth month"})})]}),(0,r.jsxs)("div",{className:L.list,style:n,children:[ae({data:F.filter((function(e){return 0!==(null===e||void 0===e?void 0:e.dueDateMonth)})),hasClose:!0,contentType:"both"}),(0,r.jsx)("div",{style:{width:"100%"}}),Object.keys(oe).map((function(e){var t=(0,v.sortBy)(oe[e]||[],["dueDateYear"]);return(0,r.jsx)(p.o,{width:A?"100%":350,withArrow:!A,shadow:"md",returnFocus:!0,onOpen:function(){q(e),X(F.filter((function(t){return String(t.dueDateMonth)===e&&0!==t.dueDateMonth})))},onClose:function(){q(void 0),X([])},styles:{dropdown:A?{padding:"0",bottom:0,top:"auto !important",borderRadius:"8px 8px 0 0",border:"none"}:{padding:"0"}},children:function(n){var o=n.open,i=n.close;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.o.Target,{children:(0,r.jsx)("div",{children:(0,r.jsx)(d.B,{variant:"tertiary",skipHover:!0,size:"sm",radius:"xl",className:"tag-item",styles:function(){return{root:{padding:"5px 12px"},label:{fontSize:"13px",lineHeight:"22px",fontWeight:"normal",textTransform:"capitalize"}}},onClick:o,children:T(e,z)})})}),(0,r.jsxs)(p.o.Dropdown,{children:[A&&(0,r.jsx)("div",{className:L.backdrop,onClick:i}),(0,r.jsxs)("div",{className:L.dropdown,children:[(0,r.jsxs)("div",{className:L.dropdownHeader,children:[(0,r.jsx)("div",{children:I({id:"createPost.popup.monthTopic.year",defaultMessage:"Year"})}),A&&(0,r.jsx)("div",{onClick:i,children:(0,r.jsx)("img",{alt:"public-icon",src:"./svg/closeLight.svg",style:{width:"16px",height:"16px",objectFit:"contain",marginLeft:"auto"}})})]}),(0,r.jsx)("div",{className:L.dropdownInner,children:(0,r.jsx)("div",{className:L.dropdownContainer,children:ae({data:t,contentType:"year",isYearTag:!0,isTemp:!0})})}),(0,r.jsx)("div",{className:L.btnWrapper,children:(0,r.jsx)(d.B,{fullWidth:!0,size:"lg",onClick:function(){U([].concat((0,a.Z)(F.filter((function(e){return e.dueDateMonth!=G}))),(0,a.Z)(J))),null===i||void 0===i||i()},children:I({id:"createPost.popup.selectMonthTopicBtn",defaultMessage:"Select"})})})]})]})]})}},e)}))]})]}),(C||ee)&&(0,r.jsx)(_.g,{className:"topic-spinner"})]})}},1821:function(e,t,n){"use strict";n.d(t,{XR:function(){return j},ZL:function(){return N},rJ:function(){return P},qb:function(){return D},dq:function(){return T},fw:function(){return O},Jn:function(){return z}});var r=n(809),o=n.n(r),i=n(92447),a=n(67294),c=n(36380),s=n.n(c),l=n(30381),d=n.n(l),u=n(11163),p=n(86896),f=n(2810),m=n(24169),h=n(95983),x=n(5886),g=n(18833),v=n(31474),b=n(43196),y=n(98218),w=n(13199),k=n(25559),_=n(21124),S=function(){var e=(0,i.Z)(o().mark((function e(t){var n,r,i,a,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.id,r=t.locale,i=t.isLike,a=t.dispatch,n){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,(0,m.cA)((0,m.cN)(f.yy.POST.LIKE,{id:n,_locale:r}),"GET");case 5:return 1===(null===(c=e.sent)||void 0===c?void 0:c.status)&&a&&a({type:v.t.update,payload:{id:n,data:function(e){return{isLiked:i,likeCount:i?"number"===typeof(null===e||void 0===e?void 0:e.likeCount)?e.likeCount+1:1:"number"===typeof(null===e||void 0===e?void 0:e.likeCount)?e.likeCount-1:1}},ignoreNotFound:!0}}),e.abrupt("return",c);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),j=function(e){var t=(0,u.useRouter)().locale,n=void 0===t?"vi-VN":t,r=(0,a.useContext)(g.nj).dispatch,c=(0,a.useState)(!1),s=c[0],l=c[1],d=(0,p.Z)().formatMessage,f=(0,a.useContext)(x.I).pushNotifications,m=(0,_.h0)().authActionWrapper;return{loading:s,onLikeUnlike:function(t){var a=t.id,c=t.isLike,u=void 0!==c&&c,p=t.onCallback;return((null===e||void 0===e?void 0:e.authActionWrapper)||m)((0,i.Z)(o().mark((function e(){var t,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}return e.abrupt("return",t);case 2:return l(!0),e.prev=3,e.next=6,S({id:a,locale:n,isLike:u,dispatch:r});case 6:t=e.sent,1!==(null===(i=t)||void 0===i?void 0:i.status)?f((0,y.ti)(d)):null===p||void 0===p||p(u),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(3),f((0,y.ti)(d));case 13:return l(!1),e.abrupt("return",t);case 15:case"end":return e.stop()}}),e,null,[[3,10]])}))),{action:"like"})}}},C=function(){var e=(0,i.Z)(o().mark((function e(t){var n,r,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.id,r=t.locale,i=t.dispatch,n){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,(0,m.cA)((0,m.cN)(f.yy.POST.DELETE,{id:n,_locale:r}),"DELETE");case 5:return 1===(null===(a=e.sent)||void 0===a?void 0:a.status)&&i&&i({type:v.t.remove,payload:{id:n}}),e.abrupt("return",a);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),N=function(){var e=(0,u.useRouter)().locale,t=void 0===e?"vi-VN":e,n=(0,a.useContext)(g.nj).dispatch,r=(0,_.h0)().authActionWrapper,c=(0,a.useContext)(x.I).pushNotifications,s=(0,a.useState)(!1),l=s[0],d=s[1],f=(0,p.Z)().formatMessage;return{loading:l,onDeletePost:function(e){return r((0,i.Z)(o().mark((function r(){var i,a;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!l){r.next=2;break}return r.abrupt("return",i);case 2:return d(!0),r.prev=3,r.next=6,C({id:e,locale:t,dispatch:n});case 6:i=r.sent,1===(null===(a=i)||void 0===a?void 0:a.status)?c({title:"",message:f({id:"notification.post.delete"}),type:"success"}):c((0,y.ti)(f)),r.next=13;break;case 10:r.prev=10,r.t0=r.catch(3),c((0,y.ti)(f));case 13:return d(!1),r.abrupt("return",i);case 15:case"end":return r.stop()}}),r,null,[[3,10]])}))))}}},P=function(){var e=(0,i.Z)(o().mark((function e(t){var n,r,i,a,c,l,u,p,f,m,x,g,v,y,k,_,S,j,C,N,P,D,T,Z,O,M,z;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.title,r=t.description,i=t.communityId,a=t.communityIds,c=t.imageFiles,l=t.previewUrl,u=t.topicIds,p=t.locale,f=t.isAnonymous,m=t.isAskDoctor,x=t.introUrl,g=t.bannerUrl,v=t.scheduleTime,y=t.isAdmin,k=t.isMinigame,_=t.eventStart,S=t.eventEnd,j=t.sponsorId,C=t.seoImage,N=t.seoTitle,P=t.seoDescription,D=new FormData,T=(0,w.bu)(r),Z=(0,w.bu)(n),O=(0,w.Dc)(T),M=s()((0,w.dM)(r)).split(" ").filter(Boolean).slice(0,10).join(" "),D.append("title",(null===Z||void 0===Z?void 0:Z.trim())||M),D.append("description",(0,w.dM)(T)),i&&D.append("community_id",i),null===a||void 0===a||a.forEach((function(e){D.append("community_ids[]",String(e||""))})),D.append("is_anonymous",f?"1":"0"),D.append("is_question",m?"1":"0"),(null===l||void 0===l?void 0:l.title)&&D.append("preview_title",l.title),(null===l||void 0===l?void 0:l.description)&&D.append("preview_description",l.description),(null===l||void 0===l?void 0:l.url)&&D.append("preview_link",(0,b.R1)(l.url)),(null===l||void 0===l?void 0:l.image)&&D.append("preview_image",(0,b.R1)(l.image)),null===u||void 0===u||u.forEach((function(e){D.append("topics[]",String(e||""))})),j&&D.append("sponsor_id",j),D.append("seo_image",C||""),D.append("seo_title",N||""),D.append("seo_description",P||""),null===c||void 0===c||!c.length){e.next=28;break}return e.next=24,Promise.all(c.map((function(e,t){return new Promise((function(n){setTimeout((function(){n((0,w.tx)(e,p,y))}),2e3*t)}))})));case 24:null===(z=e.sent)||void 0===z||z.filter(Boolean).slice(0,h.O_).forEach((function(e,t){D.append("images[".concat(t,"]"),e)})),e.next=29;break;case 28:D.append("images","");case 29:return null===O||void 0===O||O.forEach((function(e){D.append("mention_ids[]",e)})),D.append("intro_url",x||""),D.append("banner",g||""),v&&(D.append("post_type","scheduled"),D.append("schedule_datetime",d()(v,"YYYY-MM-DD HH:mm:ss").toISOString())),k&&(D.append("event_type","mini_game"),_&&D.append("event_start",d()("".concat(_," 00:00:00"),"YYYY-MM-DD HH:mm:ss").toISOString()),S&&D.append("event_end",d()("".concat(S," 23:59:59"),"YYYY-MM-DD HH:mm:ss").toISOString())),e.abrupt("return",D);case 35:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),D=function(){var e=(0,i.Z)(o().mark((function e(t){var n,r,i,a,c,s,l,d;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.formData,r=t.locale,i=t.dispatch,e.next=3,(0,m.cA)((0,m.cN)(f.yy.POST.CREATE,{_locale:r}),"POST",{data:n,headers:{"Content-Type":"multipart/form-data"}});case 3:if(a=e.sent,null===(c=null===a||void 0===a?void 0:a.data)||void 0===c||!c.slug||!i){e.next=10;break}return e.next=8,(0,m.cA)((0,m.cN)(f.yy.POST.DETAIL_BY_ID_OR_SLUG,{idSlug:c.slug,_locale:r}),"GET");case 8:null!==(l=e.sent)&&void 0!==l&&null!==(s=l.data)&&void 0!==s&&s.id&&(d=(0,k.W1)(l.data)).id&&i({type:v.t.update,payload:{data:d}});case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),T=function(){var e=(0,i.Z)(o().mark((function e(t){var n,r,i,a,c,s,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.id,r=t.formData,i=t.locale,a=t.dispatch,e.next=3,(0,m.cA)((0,m.cN)(f.yy.POST.UPDATE,{id:n,_locale:i}),"POST",{data:r});case 3:return c=e.sent,null!==(s=null===c||void 0===c?void 0:c.data)&&void 0!==s&&s.id&&a&&(l=(0,k.W1)(s),a({type:v.t.update,payload:{data:l}})),e.abrupt("return",c);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Z=function(e){var t=e.id,n=e.locale;e.followValue;return(0,m.cA)((0,m.cN)(f.yy.POST.FOLLOW,{id:t,_locale:n}),"GET")},O=function(){var e=(0,p.Z)().formatMessage,t=(0,u.useRouter)().locale,n=void 0===t?"vi-VN":t,r=(0,a.useContext)(x.I).pushNotifications,c=(0,a.useState)(!1),s=c[0],l=c[1],d=(0,_.h0)().authActionWrapper;return{loading:s,onFollowUnfollowPost:function(t){var a=t.id,c=t.followValue;return d((0,i.Z)(o().mark((function t(){var i;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!s){t.next=2;break}return t.abrupt("return",i);case 2:return l(!0),t.prev=3,t.next=6,Z({id:a,locale:n,followValue:c});case 6:(i=t.sent)&&r({message:c?"Notification on":"Notification off",type:c?"success":"danger",displayIcon:c?(0,b.k3)("/svg/icon-bell-on.svg"):(0,b.k3)("/svg/icon-bell-off.svg")}),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(3),r((0,y.ti)(e));case 13:return l(!1),t.abrupt("return",i);case 15:case"end":return t.stop()}}),t,null,[[3,10]])}))))}}},M=function(e){var t=e.id,n=e.reason,r=e.locale,o=new FormData;return o.append("reason",n),(0,m.cA)((0,m.cN)(f.yy.POST.REPORT,{_locale:r,id:t}),"POST",{data:o})},z=function(){var e=(0,p.Z)().formatMessage,t=(0,u.useRouter)().locale,n=void 0===t?"vi-VN":t,r=(0,a.useContext)(x.I).pushNotifications,c=(0,a.useState)(!1),s=c[0],l=c[1],d=(0,_.h0)().authActionWrapper;return{loading:s,onReportPost:function(t){var a=t.id,c=t.reason;return d((0,i.Z)(o().mark((function t(){var i,d;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!s){t.next=2;break}return t.abrupt("return",i);case 2:return l(!0),t.prev=3,t.next=6,M({id:a,locale:n,reason:c});case 6:i=t.sent,1===(null===(d=i)||void 0===d?void 0:d.status)&&r({message:"Post reported",type:"success"}),t.next=13;break;case 10:t.prev=10,t.t0=t.catch(3),r((0,y.ti)(e));case 13:return l(!1),t.abrupt("return",i);case 15:case"end":return t.stop()}}),t,null,[[3,10]])}))),{action:"report-post"})}}}},3055:function(e,t,n){"use strict";n.d(t,{g:function(){return r.g}});var r=n(48253)},48253:function(e,t,n){"use strict";n.d(t,{g:function(){return a}});var r=n(67294),o=function(){return window.innerWidth<768},i=function(){return window.innerWidth>=768&&window.innerWidth<1112},a=function(e){var t=(0,r.useState)(e),n=t[0],a=t[1],c=function(){var e=(0,r.useState)(o()),t=e[0],n=e[1],a=(0,r.useState)(i()),c=a[0],s=a[1];return(0,r.useEffect)((function(){var e=function(){n(o()),s(i())};return window.addEventListener("resize",e),function(){window.removeEventListener("resize",e)}}),[]),{isMobile:t,isLargeMobile:c}}().isMobile;return(0,r.useEffect)((function(){a(c)}),[c,e]),n}},4266:function(e,t,n){"use strict";n.d(t,{d:function(){return a}});var r=n(67294),o=n(3055),i=n(5886),a=function(){var e=(0,r.useContext)(i.I).state.isMobileSsr;return(0,o.g)(e)}},13199:function(e,t,n){"use strict";n.d(t,{Nw:function(){return m},rz:function(){return C},Tn:function(){return N},f0:function(){return P},Dc:function(){return D},a7:function(){return T},hr:function(){return Z},I:function(){return O},eh:function(){return M},bu:function(){return z},TV:function(){return I},dM:function(){return A},aD:function(){return E},el:function(){return W},on:function(){return L},vs:function(){return B},Uo:function(){return R},XW:function(){return Y},IA:function(){return H},tx:function(){return $}});var r=n(809),o=n.n(r),i=n(26265),a=n(92447),c=n(28140),s=n(29238),l=n.n(s),d=n(2810),u=n(24169);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function f(e){for(var t=1;t]*)data-url="true"[^<>]*>(.*?)<\/mocka>/gim,x=/((?:=")|(?:data-url="true">)|)(https?:\/\/(www\.)?(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))/gim,g=/\[a\+href="/([^<"]+)"(?:\+text=\"([^<"]+)")?\]/gim,v=/]*data-id="([^<"]+)"[^>]*>([^<]+)<\/mention>/gim,b=/]*data-id="([^<"]+)" [^\>]*data-name="([^<"]+)"[^>]*>([^<]+)<\/mention>/gim,y=/\[mention\+id="([^<"]+)"([^\]]*)\]/gim,w=/^(https?:\/\/(www\.)?(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))$/gim,k=/^((https?:\/\/)?(www\.)?(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$]))$/gim,_=/]*href="/([^>"]+)"[^>]*>([^<]+)<\/a>/gim,S=/]*data-bad-word="[^\"]*" [^\>]*data-error="true"[^\>]*>(.*?)<\/mocka>/gim,j=function(e){var t=e.url,n=e.text,r=e.method,o=n.indexOf(n.trimStart()),i=n.trimEnd().length,a=n.substring(0,o),c=n.substring(o,i),s=n.substring(i);return"edit"===r?"".concat(a,'').concat(c,"").concat(s):"display"===r&&(t.startsWith("http://")||t.startsWith("https://"))?"".concat(a,'').concat(c,"").concat(s):n},C=function(e,t){return e.replace(g,(function(e,n,r){return j({text:r||n,url:n,method:t})})).replace(_,(function(e,n,r){return j({text:r||n,url:n,method:t})}))},N=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.replace(y,(function(e,n,r){var o=t.find((function(e){return String(e.id)===n}));if(!o){if(!r)return"";var i="";return r.replace(/\+name="([^<"]+)"/i,(function(e,t){return i=t,e})),'').concat(i,"")}return'').concat(o.name,"")}))},P=30,D=function(e,t){var n=[];return e.replace(v,(function(e,t,r){return n.push(t),e})).replace(y,(function(e,t,r){return n.push(t),e})),t?n:Array.from(new Set(n)).slice(0,P)},T=function(e){var t;return[].concat((0,c.Z)(function(e){var t=[];return e.replace(/(\&)+/g,"&").replace(x,(function(e,n,r){return'="'!==n&&'data-url="true">'!==n&&t.push(r),e})),t}(e)),(0,c.Z)((null===(t=e.match(h))||void 0===t?void 0:t.map((function(e){var t,n,r=null===(t=e.match(/data-href="/([^"]*)"/im))||void 0===t?void 0:t[1],o=null===(n=e.match(/>(.*?)<\/mocka>/im))||void 0===n?void 0:n[1];return r||o})))||[])).filter((function(e){return!!e}))},Z=function(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")};var O=function(e){var t,n,r;return null===(t=e.replace(/(\ )+/g," "))||void 0===t||null===(n=t.replace(/(\&)+/g,"&"))||void 0===n||null===(r=n.replace(/(\u200c|‌)+/g,""))||void 0===r?void 0:r.replace(h,(function(e,t,n){var r,o=null===(r=t.match(/data-href="/([^"]*)"/im))||void 0===r?void 0:r[1];return!o||o===n||n.match(w)?n:o?'').concat(n,""):'').concat(n,"")})).replace(x,(function(e,t,n){if('="'!==t&&'data-url="true">'!==t){var r=new URL(n).href;return j({text:r,url:r,method:"edit"})}return e})).replace(_,(function(e,t,n){return j({text:n||t,url:t,method:"edit"})}))},M=function(e){return e.replace(S,(function(e,t){var n=document.createElement("div");n.innerHTML=e;var r=n.firstChild;return(null===r||void 0===r?void 0:r.innerText)!==(null===r||void 0===r?void 0:r.getAttribute("data-bad-word"))?t:e}))},z=function(e){return e.replace(S,"$1")},I=function(e){return e.replace(/]*>(.+)<\/font>/gim,(function(e,t){return t.replace(/]*>(.+)<\/u>/gim,"$1")}))},A=function(e){return function(e){var t;return m(null===(t=e.replace(/(\ )+/g," ").replace(/(\&)+/g,"&"))||void 0===t?void 0:t.replace(/(\u200c|‌)+/g,"").replace(x,(function(e,t,n){return'="'!==t&&'data-url="true">'!==t?'').concat(n,""):e})).replace(h,(function(e,t,n){var r,o=null===(r=t.match(/data-href="/([^"]*)"/im))||void 0===r?void 0:r[1];return o?'').concat(n,""):'').concat(n,"")})))}(function(e){return e.replace(v,(function(e,t,n){return'[mention+id="'.concat(t,'"+name="').concat(n,'"]')}))}(z(e)))},E=["hellobacsi.com","hellosehat.com","hellodoktor.com","hellokrupet.com","hellodoctor.com.ph","hellokhunmor.com","hellosayarwon.com","helloyishi.com.tw","helloswasthya.com","marrybaby.vn","hellohealth.questionpro.com","hellobacsivn.page.link","hellohealthquiz.typeform.com"].concat((0,c.Z)([])),W=function(e){return e.match(k)?e.startsWith("https://")||e.startsWith("http://")?e:"https://".concat(e):""},L=function(e,t){var n=t.filter(Boolean);return e&&n.length>0?z(e).replace(new RegExp("\\b(".concat(n.map((function(e){return Z(e)})).join("|"),")\\b"),"gi"),(function(e,t){var n=document.createElement("mocka");return n.setAttribute("data-bad-word",t),n.setAttribute("data-error","true"),n.innerText=t,"".concat(n.outerHTML)})):e},B=function(e){return e.replace(b,(function(e,t,n,r){if(r!==n){var o=n.split(" "),i=o.findIndex((function(e,t){var n=o.slice(0,t+1).join(" ");return!r.startsWith(n)}));if(0===i)return"@".concat(r);var a=(i<0?o:o.slice(0,i)).join(" "),c=r.slice(a.length).trim();return console.log(i,a,c),'').concat(a," ").concat(c," ")}return e}))},R=function(e){var t;if(!e.includes("youtu"))return"";return(null===(t=/(.*?)(^|\/|v=)([a-z0-9_-]{11})(.*)?/gim.exec(e))||void 0===t?void 0:t[3])||""},Y=function(e){var t="";return e.replace(/(?:https?:\/\/)?(?:www.|web.|m.)?facebook.com\/(?:video.php|photo.php|watch)?\/?\?v=(\d+)|\S+\/videos\/((\S+)\/(\d+)|(\d+))\/?/gim,(function(){for(var e=arguments.length,n=new Array(e),r=0;r2)return t[2]},$=function(e,t,r,i,c){return"string"===typeof e?Promise.resolve(e):(0,a.Z)(o().mark((function a(){var s,l,p,m,h,x,g,v;return o().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(l=/image/i.test(e.type),p=l?"image":"video",m=new FormData,!l){o.next=17;break}if(!e.type.startsWith("image/gif")){o.next=8;break}m.append(p,e),o.next=15;break;case 8:return o.next=10,n.e(1741).then(n.bind(n,41741));case 10:return h=o.sent,o.next=13,h.default(e,{maxSizeMB:.4,maxWidthOrHeight:1536,useWebWorker:!0});case 13:x=o.sent,m.append(p,x);case 15:o.next=18;break;case 17:m.append(p,e);case 18:return g=r?u.Cl:u.cA,o.next=21,g((0,u.cN)(l?r?d.qf.COMMENT.IMAGE_UPLOAD:d.yy.COMMENT.IMAGE_UPLOAD:d.qf.VIDEO_UPLOAD,{_locale:t}),"POST",f({data:m,timeout:i||3e4},c));case 21:return v=o.sent,o.abrupt("return",(null===v||void 0===v||null===(s=v.data)||void 0===s?void 0:s[p])||"");case 23:case"end":return o.stop()}}),a)})))()}}}]);