"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4584],{VgLc:function(e,t,a){a.d(t,{H:function(){return Heading}});var n=a("ubET"),r=a("q1tI"),i=a("8vDj"),o=a("lhAG");let Heading=e=>{var{as:t,tag:a,color:l,fontWeight:s,dataEventCategory:c,dataEventAction:d,dataEventLabel:p}=e,m=(0,n.a)(e,["as","tag","color","fontWeight","dataEventCategory","dataEventAction","dataEventLabel"]);let u=(0,i.rZ)();return r.createElement(o.T,Object.assign({as:t||a,color:l||u.colors.gray[8],"data-event-category":c,"data-event-action":d,"data-event-label":p,weight:"semibold"===s?"semiBold":"bold",size:a,"data-size":a,"data-font-weight":s||void 0},m))}},veQL:function(e,t,a){a.d(t,{D:function(){return DatePicker}});var n=a("ubET"),r=a("q1tI"),i=a("8vDj"),o=a("gHhT"),l=a("catb"),s=a("rvDO"),c=a("x9hL"),d=a("WcvC"),p=a("hKh/"),m=a("yNk5");let DatePicker=e=>{var t,{value:a,fullWidth:u=!0}=e,g=(0,n.a)(e,["value","fullWidth"]);let h=(0,i.rZ)(),f="mb"===h.other.template,x=null===(t=s.I[m.env.UNIFY_LOCALE||p.L.Vietnam])||void 0===t?void 0:t.dateFormat;return r.createElement(l.a,Object.assign({locale:d.M[m.env.UNIFY_LOCALE||p.L.Vietnam],valueFormat:x,size:"md",clearable:!1,popoverProps:u?{styles:{dropdown:{minWidth:"100%",display:"flex",justifyContent:"center",alignItems:"center"}}}:{},styles:{root:{position:"relative"},rightSection:{pointerEvents:"none",cursor:"default"}},rightSection:r.createElement(o.E,{src:c.C.getAssetPath(f?"MB-calendar.svg":"OutlineCalendar.svg"),width:18,height:18}),value:a,placeholder:x},g,{className:`input-control ${(null==g?void 0:g.className)||""}`}))}},I12S:function(e,t,a){a.d(t,{I:function(){return InputCommentBar},P:function(){return PopupDanger},S:function(){return SharePopup},a:function(){return PopupFrame},b:function(){return SubmitReportForm},c:function(){return j},d:function(){return getPostFormData},e:function(){return editPost},f:function(){return createPost},g:function(){return getDefaultFailNoti},h:function(){return deletePost},i:function(){return M},j:function(){return deleteComment},k:function(){return decodeCommentBody},l:function(){return likeUnlikeComment},m:function(){return likeUnlikePost},u:function(){return useImagePicker}});var n=a("q1tI"),r=a("kqU0"),i=a("VgLc"),o=a("lhAG"),l=a("nm4t"),s=a("i8i4"),c=a("Hcm0"),d=a("rBCA"),p=a("iBNF"),m=a("ubET"),u=a("1WGw"),g=a("RF7b"),h=a("O4+M"),f=a("990U"),x=a("IQVP"),b=a("elhQ"),v=a("uPjh"),y=a("vec8"),w=a("rRTB"),E=a("Lzv+"),k=a("t/pd"),N=a("fKfj"),C=a("VHG+"),T=a("UPG7"),_=a("/pFO");let useImagePicker=(e,t)=>{let[a,r]=(0,n.useState)(e||[]),i=(0,n.useMemo)(()=>(e||a).map(e=>"string"==typeof e?e:URL.createObjectURL(e)),[e,a]);return{onSelectImages:n=>{let i=n.target.files;if(i){if(t&&e){let n=e||a;t(n.concat(Array.from(i)))}else r(a=>{let n=e||a;return t&&t(n.concat(Array.from(i))),n.concat(Array.from(i))})}},onRemoveImage:a=>{t&&e?(e.splice(a,1),t(e.slice())):r(n=>{let r=e||n;return r.splice(a,1),t&&t(r.slice()),r.slice()})},onRemoveAllImages:()=>{t?t([]):r([])},imageSrcs:i,imageFiles:e||a}},getDefaultFailNoti=e=>({message:e("notification.failure"),type:"danger"}),likeUnlikePost=({id:e,locale:t})=>(0,m._)(void 0,void 0,void 0,function*(){if(!e)return;let a=yield(0,c.e)((0,c.f)(x.yy.POST.LIKE,{id:e,_locale:t}),"GET");return a}),deletePost=({id:e,locale:t})=>(0,m._)(void 0,void 0,void 0,function*(){if(!e)return;let a=yield(0,c.e)((0,c.f)(x.yy.POST.DELETE,{id:e,_locale:t}),"DELETE");return a}),getPostFormData=({title:e,description:t,communityId:a,imageFiles:n,previewUrl:r,topicIds:i,locale:o,sanitizeFunction:s,categoryCommunityId:c,categoryTopicIds:d,introUrl:p,bannerUrl:u,scheduleTime:g,isAnonymous:h,isAskDoctor:x})=>(0,m._)(void 0,void 0,void 0,function*(){let m=new FormData,v=(0,b.k)(t),y=(0,b.k)(e),w=(0,b.j)(v);if(m.append("title",y),m.append("description",(0,b.l)(v,s)),c?m.append("category_community",String(c)):a&&m.append("community_id",String(a)),m.append("is_anonymous",h?"1":"0"),m.append("is_question",x?"1":"0"),(null==r?void 0:r.title)&&m.append("preview_title",r.title),(null==r?void 0:r.description)&&m.append("preview_description",r.description),(null==r?void 0:r.url)&&m.append("preview_link",(0,l.c)(r.url)),(null==r?void 0:r.image)&&m.append("preview_image",(0,l.c)(r.image)),null==i||i.forEach(e=>{m.append("topics[]",String(e||""))}),null==d||d.forEach(e=>{m.append("category_topics[]",String(e||""))}),null==n?void 0:n.length){let e=yield Promise.all(n.map((e,t)=>new Promise(a=>{setTimeout(()=>{a((0,b.u)(e,o))},2e3*t)})));null==e||e.filter(Boolean).slice(0,f.M).forEach((e,t)=>{m.append(`images[${t}]`,e)})}else m.append("images","");return null==w||w.forEach(e=>{m.append("mention_ids[]",e)}),m.append("intro_url",p||""),m.append("banner",u||""),g&&(m.append("post_type","scheduled"),m.append("schedule_datetime",g)),m}),createPost=({locale:e,formData:t,isArticleComment:a})=>(0,m._)(void 0,void 0,void 0,function*(){let n=yield(0,c.e)((0,c.f)(a?x.yy.POST.CREATE_ARTICLE_COMMENT:x.yy.POST.CREATE,{_locale:e}),"POST",{data:t});return n}),editPost=({id:e,locale:t,formData:a})=>(0,m._)(void 0,void 0,void 0,function*(){let n=yield(0,c.e)((0,c.f)(x.yy.POST.UPDATE,{id:e,_locale:t}),"POST",{data:a});return n}),reportPost=({id:e,reason:t,locale:a})=>{let n=new FormData;return n.append("reason",t),(0,c.e)((0,c.f)(x.yy.POST.REPORT,{_locale:a,id:e}),"POST",{data:n})},z=d.Z.div` [data-type='confirm'] { max-width: 468px; /* height: 486px; */ padding: 0; .popup-content { display: flex; flex-direction: column; padding: 0; .close-button { top: 16px; right: 16px; width: 24px; height: 24px; z-index: 5; } .header { display: flex; height: 56px; align-items: center; padding: 16px 56px 16px 32px; border-bottom: 1px solid ${p.r.colors.neutral100}; font-weight: 900; width: 100%; justify-content: space-between; } .content { overflow: auto; flex: 1; .topic-list-wrapper { padding: 1rem; } } } } > div&[data-open='true'] { z-index: 250; &:last-child { z-index: 200; } } ${e=>e.isExpand&&` & > div[data-open] { width: 100%; height: 100%; max-width: none; max-height: none; } `} ${e=>e.hasFullscreen&&` & > div[data-open] { transition: all 0.5s ease-in-out, width 0s, height 0s; } `} `,S=d.Z.div` cursor: pointer; display: flex; align-items: center; `,PopupFrame=({className:e,style:t,closeIcon:a,heading:r="",children:o,isOpen:l=!1,hasFullscreen:s=!1,disableClickOutside:c=!1,initExpand:d=!1,onExpandChange:p,onClose:m=()=>null})=>{let[u,g]=(0,n.useState)(d);return n.createElement(z,{className:e,style:t,isExpand:u,hasFullscreen:s},n.createElement(C.P,{type:"confirm",onClose:m,isOpen:l,closeIcon:a||n.createElement("img",{src:T.C,loading:"lazy"}),enableAnimation:!s,disableClickOutside:c},n.createElement("div",{className:"header"},n.createElement(i.H,{tag:"h5"},r),s&&n.createElement(S,{onClick:()=>{null==p||p(),g(!u)}},n.createElement(N.Z,{size:14,isExpand:u}))),n.createElement("div",{className:"content"},"function"==typeof o?o(u):o)))};var j="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='25' fill='none'%3e%3cpath fill='%23262626' d='M12 22.984c5.523 0 10-4.477 10-10s-4.477-10-10-10-10 4.478-10 10 4.477 10 10 10'/%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m14.828 10.156-5.657 5.657M9.172 10.156l5.657 5.657'/%3e%3c/svg%3e";let F=d.Z.div` [data-type='confirm'] { width: min(360px, 100%); height: auto; &[data-open='false'] { top: calc(-100% - 500px); } } z-index: 600; .header { display: none !important; } .confirm-dialog { position: relative; overflow: auto; width: 100%; padding-top: 44px; background: #fff; border-radius: ${p.r.borderRadius}; .confirm-content { display: flex; flex-direction: column; align-items: center; padding: 0 16px 16px; text-align: center; .title { margin-bottom: 8px; font-size: 24px; line-height: 32px; word-break: break-word; overflow-wrap: break-word; } .desc { margin-bottom: 24px; color: ${p.r.colors.gray500}; font-size: 18px; line-height: 24px; text-align: center; word-break: break-word; overflow-wrap: break-word; } .btn-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; button { margin: 0 4px 0.5rem; } } } } .thumbnail-container { width: 80px; height: 80px; margin-bottom: 32px; .thumbnail { width: 100%; height: 100%; } &.is-icon { display: flex; align-items: center; justify-content: center; background: #e0e9fc; border-radius: 1rem; .thumbnail { width: 40px; height: 40px; } } } &[data-is-marrybaby='true'] { .popup-frame { > div:first-child { overflow: hidden; border-radius: 1rem; &[data-open='true'] { ${l.M.mbDown} { top: 100%; transform: translate(-50%, -100%); max-width: unset; width: 100%; background: unset; overflow: unset; } } } .popup-content { .close-button { ${l.M.mbDown} { display: none; } } .confirm-dialog { ${l.M.mbDown} { background: unset; position: relative; overflow-x: hidden; &::before { content: ''; width: 200%; background: #fff; position: absolute; left: 50%; top: 0; transform: translateX(-50%); z-index: -1; height: 100%; border-top-left-radius: 100%; border-top-right-radius: 100%; } } .confirm-content { padding: 0 40px 40px; ${l.M.mbDown} { padding-left: 1.5rem; padding-right: 1.5rem; } .btn-group { width: 100%; justify-content: space-between; button { flex: 1; margin: 0; &:first-child { margin-right: 0.5rem; } } } } } } .thumbnail-container { ${l.M.mbDown} { display: none; } &.is-icon { background: #ffeaf1; border-radius: 24px; } &.is-mobile { position: absolute; top: 0; left: 50%; display: none; width: 48px; height: 48px; transform: translate(-50%, -50%); &.is-icon { border-radius: 1rem; .thumbnail { width: 24px; height: 24px; } } ${l.M.mbDown} { display: flex; } } } } } `,PopupDanger=({className:e,isMarryBaby:t,style:a,title:d,description:p,acceptText:m,cancelText:u,onAccept:g,onCancel:h,thumbnail:f,isThumbnailIcon:x,onClose:b,acceptBtnTracking:v,acceptBtnProps:y,cancelBtnProps:w})=>{let{data:{env:{isMarryBaby:E}}}=(0,n.useContext)(c.T),k="boolean"==typeof t?t:E,[N,C]=(0,n.useState)(!1);return((0,n.useEffect)(()=>((0,l.t)(!0),setTimeout(()=>C(!0),0),()=>(0,l.t)(!1)),[]),"undefined"==typeof window)?null:s.createPortal(n.createElement(F,{"data-is-marrybaby":k,className:e,style:a,"data-open":N},n.createElement(PopupFrame,{className:"popup-frame",isOpen:N,onClose:b},n.createElement("div",{className:"confirm-dialog",onClick:e=>e.stopPropagation()},n.createElement("div",{className:"confirm-content"},f&&n.createElement("div",{className:`thumbnail-container ${x?"is-icon":""}`},n.createElement("img",{className:"thumbnail",src:f,loading:"lazy"})),n.createElement(i.H,{className:"title",tag:"h2"},d),n.createElement(o.T,{className:"desc",size:"lg"},p),n.createElement("div",{className:"btn-group"},n.createElement(r.B,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",color:"tertiary",onClick:()=>{null==g||g(),null==b||b()}},y,v),m),n.createElement(r.B,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",onClick:()=>{null==h||h(),null==b||b()}},w),u)))),k&&f&&n.createElement("div",{className:`thumbnail-container is-mobile ${x?"is-icon":""}`},n.createElement("img",{className:"thumbnail",src:f,loading:"lazy"})))),(0,l.a)())},O=d.Z.div` padding: 1rem; border-top: 1px solid #f2f2f2; &[data-is-reply='true'] { padding-right: 0; padding-left: 0; border-top: 1px solid #e4e8ec; margin-right: 1rem; margin-left: 1rem; } .error-text { padding: 1rem; color: ${p.r.colors.red700}; } .reply-to-container { display: flex; justify-content: space-between; padding-bottom: 0.75rem; margin-top: -0.25rem; .icon-close-comment { width: 16px; height: 16px; cursor: pointer; } a { text-decoration: none; } } .input-container { display: flex; align-items: center; .avatar-wrapper { display: flex; flex-shrink: 0; align-items: center; margin-right: 0.5rem; &.avatar-wrapper-reply { width: 32px; height: 32px; .avatar { width: 32px; height: 32px; } } } .input-wrapper { margin-right: 0.5rem; &[data-has-error] { .as-input { border-color: ${p.r.colors.red700}; } } .as-input { .textarea { width: 100%; max-height: 225px; min-height: 75px; .ql-toolbar { padding: 0; } .ql-editor { padding-left: 0; padding-right: 0; } .quill { height: 0; } } width: 100%; padding: 12px 16px; border: solid 1px ${p.r.colors.gray200}; border-radius: ${p.r.borderRadius}; &:active, &:focus { border-color: ${p.r.colors.primaryBase}; box-shadow: 0px 0px 2px 2px ${p.r.colors.primary200}; } &:disabled { background-color: ${p.r.colors.gray100}; cursor: not-allowed; } span { &[data-error='true'] { color: red; text-decoration: underline; } } } &[data-has-action-icon] { .as-input { padding: 12px 48px 12px 16px; } } &[data-has-display-icon] { .as-input { padding: 12px 16px 12px 48px; } } &[data-has-action-icon][data-has-display-icon] { .as-input { padding: 12px 48px; } } &[data-size='lg'] { .as-input { font-size: 16px; font-weight: ${p.r.sizes.fwRegular}; ${l.M.mbDown} { font-size: 22px; line-height: 1.2; } ${l.M.mbUp} { font-size: 26px; line-height: 1.2; } } } &[data-size='md'] { .as-input { font-weight: ${p.r.sizes.fwRegular}; line-height: 22px; ${l.M.mbDown} { font-size: 14px; line-height: 1.2; } ${l.M.mbUp} { font-size: 16px; line-height: 1.2; } } } &[data-size='sm'] { .as-input { font-weight: ${p.r.sizes.fwRegular}; line-height: 20px; ${l.M.mbDown} { font-size: 13px; line-height: 1.5; } ${l.M.mbUp} { font-size: 13px; line-height: 1.5; } } } } .images-input-label { height: 100%; cursor: pointer; .icon-images-input { width: 24px; height: 24px; vertical-align: middle; } } .send-button { display: flex; width: 40px; height: 40px; flex-shrink: 0; align-items: center; justify-content: center; padding: 0; border: none; &.send-button-post { background: ${p.r.colors.neutral100}; border-radius: 50%; } .icon-enter { width: 20px; height: 20px; vertical-align: middle; } &[data-is-loading='true'] { > div { display: flex; align-items: center; justify-content: center; } } } } .preview-images-container { margin-top: 1rem; .image-src-wrapper { position: relative; width: 100%; padding-top: 66.67%; &:not(:last-child) { margin-bottom: 1rem; } .preview-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; } .icon-close-circle { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; cursor: pointer; } } } `,P=(0,n.createContext)({}),getCommentFormBody=({postId:e,message:t,photos:a,link:n,locale:r,sanitizeFunction:i,replyingUserId:o,replyingUserName:l,replyingId:s})=>(0,m._)(void 0,void 0,void 0,function*(){let c=new FormData,d=(0,b.l)(t.replace(/(\ )+/g," "),i),p=(0,b.j)(d);if(a&&a.length>0){let e=yield Promise.all(null==a?void 0:a.map(e=>(0,b.u)(e,r)));e.filter(Boolean).slice(0,f.M).forEach(e=>{c.append("images[]",e)})}return n&&c.append("link",n),null==p||p.forEach(e=>{c.append("mention_ids[]",e)}),c.append("post_id",e),s&&c.append("parent_id",s),o&&(p.unshift(o),d=`[mention+id="${o}"+name="${(l||"").replace('"',"'")}"]${d}`,c.append("parent_user_id",String(o))),c.append("content",d),c.append("content",d),c}),submitComment=(e,t)=>(0,m._)(void 0,void 0,void 0,function*(){return(0,c.e)((0,c.f)(x.yy.COMMENT.CREATE,{_locale:t}),"POST",{data:e})}),decodeCommentBody=e=>{try{let t=e.match(/\[@([^\]]+)\]/),a=t?t[0].replace("[@","").replace("]",""):"",n=e.replace(/\[@([^\]]+)\]/,"");return{text:n.trim(),replyingTo:a}}catch(e){}return{text:""}},submitReply=(e,t)=>(0,m._)(void 0,void 0,void 0,function*(){return(0,c.e)((0,c.f)(x.yy.COMMENT.REPLY,{_locale:t}),"POST",{data:e})}),likeUnlikeComment=({commentId:e,setLike:t=!1,locale:a})=>(0,m._)(void 0,void 0,void 0,function*(){return(0,c.e)((0,c.f)(t?x.yy.COMMENT.LIKE:x.yy.COMMENT.UNLIKE,{_locale:a,id:e}),"GET")}),deleteComment=({id:e,locale:t})=>(0,c.e)((0,c.f)(x.yy.COMMENT.DELETE,{_locale:t,id:e}),"DELETE"),InputCommentBar=({isReply:e,className:t,onClose:a,replyToName:i,style:l,replyingId:s,replyingUser:d,onPostSuccess:p,post:x,isMarryBaby:b})=>{let{action:{pushNotifications:k,sanitizeFunction:N},data:{userInfo:C,locale:T,env:{isMarryBaby:_}}}=(0,n.useContext)(c.T),{t:z}=(0,g.u)(),{onSelectImages:S,onRemoveImage:F,imageSrcs:I,onRemoveAllImages:D,imageFiles:M}=useImagePicker(),[B,$]=(0,n.useState)(""),{trigger:R}=(0,n.useContext)(P),[W,H]=(0,n.useState)(!1),L=(0,n.useRef)(null),A=(0,n.useRef)(null),U=(0,n.useRef)(null),[G,V]=(0,n.useState)([]),[Z,q]=(0,n.useState)([]),[K,Y]=(0,n.useState)(null);return(0,n.useEffect)(()=>{var e;null===(e=U.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{var e;null===(e=A.current)||void 0===e||e.focus()},400)},[R]),n.createElement(O,{"data-is-reply":e,className:t,style:l},e&&n.createElement("div",{className:"reply-to-container"},n.createElement(o.T,{size:"p4"},n.createElement("span",{dangerouslySetInnerHTML:{__html:z("inputComment.replyTo",{name:`@${i||""}`})}})),n.createElement("img",{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='17' fill='none'%3e%3ccircle cx='8' cy='8.5' r='6.667' fill='white' stroke='%23404040'/%3e%3cpath stroke='%23404040' stroke-linecap='round' stroke-linejoin='round' d='m10 6.5-4 4M6 6.5l4 4'/%3e%3c/svg%3e",className:"icon-close-comment",onClick:()=>a&&a(),loading:"lazy"})),n.createElement("div",{className:"input-container",ref:U},n.createElement(w.U,{className:`avatar-wrapper ${e?"avatar-wrapper-reply":""}`,avatar:(null==C?void 0:C.id)?C.avatar:f.D,username:(null==C?void 0:C.name)||(null==C?void 0:C.username)}),n.createElement("input",{ref:L,onChange:S,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),n.createElement(u.I,{value:B,name:"input",size:"md",className:"input-wrapper",displayIcon:n.createElement("img",{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3e%3cpath stroke='%232D87F3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M10.754 4.854H4.492a1.79 1.79 0 0 0-1.789 1.789v12.524a1.79 1.79 0 0 0 1.79 1.789h12.523a1.79 1.79 0 0 0 1.79-1.79v-6.261'/%3e%3cpath stroke='%232D87F3' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' d='M17.463 3.512a1.898 1.898 0 0 1 2.684 2.684l-8.498 8.498-3.579.895.895-3.579z'/%3e%3c/svg%3e",loading:"lazy"}),CustomInput:n.createElement("div",{className:"as-input"},n.createElement(E.R,{className:"textarea",html:B,onChange:$,onImagePickerClick:()=>{var e;return null===(e=L.current)||void 0===e?void 0:e.click()},bannedWords:Z,onPreviewUrlChange:Y,onInvalidUrlsChange:V,setEditorRef:e=>A.current=e,isReplying:e}))}),n.createElement(r.B,{theme:("boolean"==typeof b?b:_)?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:()=>(0,m._)(void 0,void 0,void 0,function*(){var t,n,r,i,o,l,c,m,u;if((null==x?void 0:x.id)&&!W){H(!0);try{let g=yield getCommentFormBody(Object.assign({message:B,photos:M,postId:String(x.id),link:null==K?void 0:K.url,sanitizeFunction:N,locale:T},e&&s?{replyingUserId:String((null==d?void 0:d.id)||(null===(t=null==x?void 0:x.author)||void 0===t?void 0:t.id)||""),replyingId:s,replyingUserName:(null==d?void 0:d.name)||(null==d?void 0:d.username)||""}:{})),f=yield e&&s?submitReply(g,T):submitComment(g,T),b=null==f?void 0:f.data;(null==b?void 0:b.id)&&!(null===(r=null===(n=null==f?void 0:f.messages)||void 0===n?void 0:n.moderation)||void 0===r?void 0:r.type)?(e=>{$(""),D(),a&&a();let t=(0,h.g)(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),p&&p(t)})(f):(null===(o=null===(i=null==f?void 0:f.messages)||void 0===i?void 0:i.moderation)||void 0===o?void 0:o.type)==="banned"?(k({title:z("notification.comment.blocked.title"),message:z("notification.comment.blocked.message"),type:"danger"}),f.messages.moderation.words&&q(f.messages.moderation.words)):(null===(c=null===(l=null==f?void 0:f.messages)||void 0===l?void 0:l.moderation)||void 0===c?void 0:c.type)==="suspect"?(k({title:z("notification.comment.suspect.title"),message:z("notification.comment.suspect.message"),type:"warning"}),$(""),D(),a&&a()):(null===(m=null==f?void 0:f.messages)||void 0===m?void 0:m.find(e=>{var t;return!!(null===(t=null==e?void 0:e.includes)||void 0===t?void 0:t.call(e,"suspend"))}))?(k({message:z("notification.suspend.message"),type:"warning"}),$(""),D(),a&&a()):k({title:"",message:(null===(u=null==f?void 0:f.messages)||void 0===u?void 0:u[0])||z("notification.comment.somethingWrong"),type:"danger"})}catch(e){k({title:"",message:z("notification.comment.somethingWrong"),type:"danger"})}H(!1)}}),isLoading:W,isDisabled:!!(null==G?void 0:G.length)||W||!B||(null==B?void 0:B.length)<2||!B.trim()},n.createElement("img",{src:"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='20' height='21' fill='none'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m7.5 9.734-3.75 3.75 3.75 3.75'/%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M16.25 4.734v5.569c0 .843-.33 1.653-.915 2.25a3.1 3.1 0 0 1-2.21.931H3.75'/%3e%3c/svg%3e",className:"icon-enter",loading:"lazy"}))),(null==G?void 0:G.length)?n.createElement("div",{className:"error-text"},z("notification.limitUrlDomain")):null,(!I||0===I.length)&&K&&n.createElement("div",{className:"link-preview-wrapper"},K.isFetching?n.createElement(y.L,null):n.createElement(n.Fragment,null,n.createElement(v.C,{title:K.title,url:K.url||"#",image:K.image,noRefetch:!0}),n.createElement("img",{src:j,className:"icon-close",onClick:()=>Y(null),loading:"lazy"}))),I&&I.length>0&&n.createElement("div",{className:"preview-images-container"},I.map((e,t)=>n.createElement("div",{key:t,className:"image-src-wrapper"},n.createElement("img",{className:"preview-image",src:e,loading:"lazy"}),n.createElement("img",{src:j,className:"icon-close-circle",onClick:()=>F(t),loading:"lazy"})))))},SharePopup=({trackingCategory:e,className:t,style:a,url:r,text:i,onClose:o})=>{let{data:{env:{isMarryBaby:s}}}=(0,n.useContext)(c.T),{t:d}=(0,g.u)(),[p,m]=(0,n.useState)(!1);return(0,n.useEffect)(()=>((0,l.t)(!0),setTimeout(()=>m(!0),0),()=>(0,l.t)(!1)),[]),n.createElement(k.h,null,n.createElement(I,{"data-is-marrybaby":s,className:t,style:a},n.createElement(PopupFrame,{className:"share-popup",isOpen:p,onClose:o,heading:d("bottomBar.share")},p&&n.createElement(_.r,{trackingCategory:e,shareUrl:r||("undefined"!=typeof window?window.location.href:""),title:i}))))},I=d.Z.div` .share-popup { > div:first-child { height: unset; } } .custom-share__header { display: flex; flex-wrap: no-wrap; align-items: center; padding: 1rem; border-bottom: 1px solid ${p.r.colors.neutral100}; margin-bottom: 16px; .custom-share__header-image { width: 38px; height: 38px; flex-shrink: 0; & > img { width: 100%; height: 100%; object-fit: cover; object-position: center; } } .custom-share__header-info { flex: 1; padding: 0 8px; word-break: break-word; [data-tag='h4'] { margin-bottom: 8px; font-size: 14px; font-weight: bold; line-height: 14px; } [data-size='md'] { color: #a5a5a5; font-size: 14px; line-height: 14px; } } } &[data-is-marrybaby='true'] { .share-popup { > div:first-child { overflow: hidden; border-radius: 1rem; &[data-open='true'] { ${l.M.mbDown} { max-width: unset; width: 100%; top: 100%; transform: translate(-50%, -100%); border-bottom-left-radius: 0; border-bottom-right-radius: 0; } } } .close-button { display: block; } .popup-content { .header { display: block; padding: 1rem; background-color: rgb(243, 243, 243); } .content { padding-bottom: 1rem; } } .share-mb-text { margin: 1rem 1rem 0.5rem; } } } `,D=d.Z.div` padding: 0 8px; margin-top: 18px; .report-list { margin-bottom: 18px; .report-item { display: flex; align-items: center; margin-bottom: 10px; font-weight: 600; & > img { width: 12px; height: 12px; margin-right: 8px; } .__label { font-size: 14px; } } } .report-submit { width: 100%; } &[data-is-marrybaby='true'] { padding: 0 1rem 1rem; } `;var M="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none'%3e%3cpath stroke='%23737373' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12M8 5v3M8 11h.007'/%3e%3c/svg%3e";let SubmitReportForm=({className:e,style:t,reason:a,reasonText:i,onClose:l,postId:s})=>{let{data:{locale:d,env:{isMarryBaby:u}},action:{pushNotifications:h}}=(0,n.useContext)(c.T),{t:f}=(0,g.u)(),[x,b]=(0,n.useState)(!1);return n.createElement(D,{"data-is-marrybaby":u,className:e,style:t},n.createElement("ul",{className:"report-list"},n.createElement("li",{className:"report-item"},n.createElement("img",{src:M,loading:"lazy"}),n.createElement(o.T,{className:"__label",color:p.r.colors.gray800,size:"p4"},i))),n.createElement(r.B,{theme:u?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:x,onClick:()=>(0,m._)(void 0,void 0,void 0,function*(){if(s&&!x){b(!0);try{let e=yield reportPost({id:s,reason:a,locale:d});(null==e?void 0:e.status)===1&&(h({message:"Post reported",type:"success"}),l&&l())}catch(e){}b(!1)}})},f("submit")))}},GyZF:function(e,t,a){a.d(t,{H:function(){return HealthToolFormWrapper}});var n=a("ubET"),r=a("q1tI"),i=a("/npG"),o=a("mYVa"),l=a("Eso5"),s=a("aDCK"),c=a("9n+W"),d=a("8vDj"),p=a("SPK5"),m=a("2wr/"),u=a("lhAG"),g=a("krdG"),h=a("RF7b"),f=a("yVya"),x=a("iBNF"),b=(0,i.k)(()=>({root:{justifyContent:"flex-start"},group:{display:"flex",alignItems:"stretch",gap:(0,o.h)(8)},item:{flex:"1 1 0px"},icon:{flexShrink:0}}));let v=(0,r.createContext)({}),y=(0,i.k)(()=>({root:{display:"flex",flexDirection:"column",gap:(0,o.h)(8),paddingLeft:16,paddingRight:16,"&:last-child":{paddingBottom:16}}}));var w=(0,i.k)((e,{formLayout:t})=>({root:{display:"flex",flexDirection:"column",gap:(0,o.h)("inline"===t?8:16),borderRadius:"inherit",".mantine-Input-input::placeholder, .mantine-Input-input[data-invalid]::placeholder":{color:"#8C8C8C"},[e.fn.smallerThan("sm")]:Object.assign({"input, .mantine-DatePickerInput-input":{fontSize:(0,o.h)(14)}},"default"===t&&{gap:8})},control:{width:(0,o.h)(180),flexShrink:1,"&.error":{"button, input":{borderColor:e.colors.red[7]}}}}));let E=(0,i.k)((e,{formLayout:t})=>{let a="mb"===e.other.template;return{root:Object.assign(Object.assign({minWidth:(0,o.h)(180)},"inline"===t&&{alignSelf:"flex-end",marginTop:(0,o.h)(16)}),"default"===t&&Object.assign({},a&&{alignSelf:"center"}))}}),k=(0,i.k)(e=>({root:{color:e.colors.gray[6],whiteSpace:"nowrap",paddingRight:(0,o.h)(16)}}));var N=(0,i.k)(()=>({root:{display:"flex",gap:(0,o.h)(8),border:"1px solid #EAEAEC",borderRadius:(0,o.h)(16),padding:"10px 16px 12px 16px",flex:"1 1 0px",".mantine-Input-input":{border:0,paddingLeft:0,height:"22px",borderRadius:0,"&:focus":{outline:0,boxShadow:"none"}}},info:{display:"flex",flexDirection:"column",gap:0,flex:"1 1 0px"},label:{color:"#7C7C8F",fontWeight:"normal"},content:{},rightSection:{display:"flex",alignItems:"center",textTransform:"lowercase",color:"#3E3F58"}})),C=(0,i.k)((e,{width:t,direction:a})=>{let n="mb"===e.other.template;return{root:{display:"flex",flexDirection:"column",gap:(0,o.h)(8)},row:{display:"flex",flexDirection:a,alignItems:"stretch",justifyContent:"space-between",gap:(0,o.h)(16),minHeight:(0,o.h)(40)},labelWrapper:Object.assign({flex:"1 1 0px",display:"flex",alignItems:"center"},"row"===a&&{borderBottom:`1px solid ${e.colors.neutral[1]}`}),label:{fontSize:(0,o.h)(14),lineHeight:(0,o.h)(22),color:e.colors.gray[6]},content:{display:"flex",alignItems:"center",gap:(0,o.h)(8),input:{backgroundColor:"#fff"}},control:{width:"number"==typeof t?(0,o.h)(t):t,flexShrink:1,input:Object.assign({},n&&{borderRadius:(0,o.h)(12)}),"&.error":{"button, input":{borderColor:e.colors.red[7]}}},error:{color:"red",textAlign:"right"}}});let T=(0,i.k)(()=>({root:{color:"red",textAlign:"right",width:"auto"}}));var _=(0,i.k)(e=>{let t="mb"===e.other.template;return{root:{label:Object.assign({},t&&{color:x.r.mbColors.midGray,fontSize:(0,o.h)(12),fontWeight:"normal"})}}});let HealthToolFormWrapper=e=>{var{children:t,formLayout:a,styles:i,classNames:o,className:s,component:c="form"}=e,d=(0,n.a)(e,["children","formLayout","styles","classNames","className","component"]);let p=a||"default",{classes:m,cx:u}=w({formLayout:p},{name:"HealthToolFormWrapper",styles:i,classNames:o});return r.createElement(v.Provider,{value:{formLayout:p}},r.createElement(l.x,Object.assign({component:c,className:u(s,m.root)},d),t))};HealthToolFormWrapper.Control=e=>{var{className:t,styles:a,classNames:i}=e,o=(0,n.a)(e,["className","styles","classNames"]);let{classes:s,cx:c}=_(void 0,{name:"HealthToolFormWrapper__Control",styles:a,classNames:i});return r.createElement(l.x,Object.assign({className:c(t,s.root)},o))},HealthToolFormWrapper.BorderInlineControl=({label:e,children:t,styles:a,classNames:n,direction:i="row",width:o=180,errorMess:s})=>{let{classes:c}=C({width:o,direction:i},{name:"HealthToolFormWrapper__BorderInlineControl",styles:a,classNames:n});return r.createElement(l.x,{className:c.root},r.createElement(l.x,{className:c.row},r.createElement(l.x,{className:c.labelWrapper},e&&r.createElement("label",{className:c.label,htmlFor:"gender"},e)),r.createElement(l.x,{className:c.content},(0,f.Z)(t).map((e,t)=>r.createElement(l.x,{key:t,className:c.control},e)))),s&&r.createElement(u.T,{size:"p4",className:c.error},s))},HealthToolFormWrapper.BorderBoxControl=e=>{var{label:t,rightSection:a,children:i,styles:o,className:s,classNames:c}=e,d=(0,n.a)(e,["label","rightSection","children","styles","className","classNames"]);let{classes:p,cx:m}=N(void 0,{name:"HealthToolFormWrapper__BorderBoxControl",styles:o,classNames:c});return r.createElement(l.x,Object.assign({className:m(p.root,s)},d),r.createElement(l.x,{className:p.info},t&&r.createElement(u.T,{size:"n1",as:"label",className:p.label},t),r.createElement(l.x,{className:p.content},r.isValidElement(i)?r.cloneElement(i,Object.assign(Object.assign({},i.props),{size:"sm",error:null})):null)),a&&r.createElement(l.x,{className:p.rightSection},"string"==typeof a?r.createElement(u.T,{size:"p4"},a):r.isValidElement(a)?r.cloneElement(a,{size:24}):null))},HealthToolFormWrapper.Error=e=>{var{styles:t,classNames:a,className:i}=e,o=(0,n.a)(e,["styles","classNames","className"]);let{classes:l,cx:s}=T(void 0,{name:"HealthToolFormWrapper__UnitText",styles:t,classNames:a});return r.createElement(u.T,Object.assign({size:"p4",className:s(i,l.root)},o))},HealthToolFormWrapper.FormRow=e=>{var{styles:t,classNames:a,className:i,children:o}=e,s=(0,n.a)(e,["styles","classNames","className","children"]);let{classes:c,cx:d}=y(void 0,{name:"HealthToolFormWrapper__FormRow",styles:t,classNames:a});return r.createElement(l.x,Object.assign({className:d(i,c.root)},s),o)},HealthToolFormWrapper.Submit=e=>{var{styles:t,classNames:a,className:i}=e,o=(0,n.a)(e,["styles","classNames","className"]);let{formLayout:l}=(0,r.useContext)(v),{classes:s,cx:c}=E({formLayout:l},{name:"HealthToolFormWrapper__SubmitBtn",styles:t,classNames:a});return r.createElement(g.B,Object.assign({className:c("submit-btn",i,s.root)},o,{variant:"primary",size:"md"}))},HealthToolFormWrapper.Unit=e=>{var{styles:t,classNames:a,className:i}=e,o=(0,n.a)(e,["styles","classNames","className"]);let{classes:l,cx:s}=k(void 0,{name:"HealthToolFormWrapper__UnitText",styles:t,classNames:a});return r.createElement(u.T,Object.assign({size:"p4",className:s(i,l.root)},o))},HealthToolFormWrapper.Switching=e=>{var{label:t}=e,a=(0,n.a)(e,["label"]);let{t:i}=(0,h.u)(),l=(0,d.rZ)(),s="mb"===l.other.template;return r.createElement(p.k,{gap:(0,o.h)(4),sx:()=>({justifyContent:"space-between",alignItems:"center"})},t&&r.createElement(u.T,{size:s?"p4":"s4",color:"gray.6"},t),r.createElement(m.r,Object.assign({labelPosition:"left",onLabel:i("switchBtn.yes"),offLabel:i("switchBtn.no")},a,{styles:e=>({trackLabel:{fontSize:(0,o.h)(12)},track:{cursor:"pointer"},body:{[e.fn.largerThan("sm")]:{flexDirection:"column",alignItems:"flex-start"},[e.fn.smallerThan("sm")]:{justifyContent:"space-between"}},labelWrapper:{[e.fn.smallerThan("sm")]:{display:"flex",justifyContent:"center"}}})})))},HealthToolFormWrapper.ChipGroup=e=>{var{data:t=[],label:a,isMobile:i,layout:d="horizonal",classNames:p,styles:m}=e,g=(0,n.a)(e,["data","label","isMobile","layout","classNames","styles"]);let{classes:h,theme:f}=b(void 0,{name:"ChipGroup",classNames:p,styles:m}),x="mb"===f.other.template,v=i?48:x?32:"vertical"===d?32:18;return r.createElement(l.x,null,r.createElement(s.I.Wrapper,{label:a&&r.createElement(u.T,{size:"p3",weight:"semiBold"},a)},r.createElement(c.A.Group,Object.assign({},g),r.createElement(l.x,{className:h.group},t.map((e,t)=>r.createElement(c.A,{className:h.item,key:t,value:String(e.value),styles:{iconWrapper:{display:"none"},label:{width:"100%",borderRadius:(0,o.h)(x?12:8),padding:0,border:`1px solid ${x?"#EAEAEC":f.colors.neutral[2]}`,height:"100%","&[data-checked]":{padding:0,backgroundColor:x?"#FFE9F1":f.colors.blue[0],border:`1px solid ${x?"#F5B4CB":f.colors.blue[1]}`},[f.fn.smallerThan("sm")]:{alignItems:"flex-start"}}}},r.createElement(l.x,{sx:Object.assign(Object.assign(Object.assign({width:"100%",display:"flex",gap:(0,o.h)(x?2:8),padding:"8px 16px 8px 12px",justifyContent:"center",alignItems:"center"},x&&{flexDirection:"column"}),"vertical"===d&&{flexDirection:"column",padding:"16px 8px 8px"}),{[f.fn.smallerThan("sm")]:{flexDirection:"column",padding:"16px 8px 8px"}})},r.isValidElement(e.icon)?r.cloneElement(e.icon,{size:v,isMarryBaby:x,className:h.icon}):null,r.createElement(u.T,{size:"p4",styles:{root:Object.assign(Object.assign({},x&&{textAlign:"center"}),{whiteSpace:"normal",[f.fn.smallerThan("sm")]:{fontSize:(0,o.h)(12),lineHeight:(0,o.h)(18),textAlign:"center"}})}},e.label))))))))}}}]);