"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3929],{v4q6:function(e,t,r){r.d(t,{B:function(){return BabyGrowthForm}});var a=r("Kz+G"),n=r("q1tI"),i=r("/npG"),o=r("mYVa"),l=r("8vDj"),s=r("iuhU"),c=r("cChf"),d=r("ZFu2"),p=r("H1c6"),m=r("3tAZ"),u=r("pMur"),h=r("iBNF"),g=r("FUIV"),b=r("w8hz"),f=r("Esnh"),w=r("+aod"),y=r("sO5b"),v=r("NbaP"),x=r("fkrl");let E=(0,n.createContext)({}),DefaultForm=e=>{let{t,locale:r}=(0,g.u)(),{classes:a={}}=(0,n.useContext)(b.C),{form:i,currentUrl:o,submitProps:l}=(0,n.useContext)(E),s={placeholder:"DD/MM/YYYY",popoverProps:{withinPortal:!0}};return n.createElement(w.H,Object.assign({formLayout:"default"},e),n.createElement(w.H.FormRow,null,n.createElement(w.H.Control,null,n.createElement(y.G,Object.assign({isBaby:!0,genderValue:{male:"boy",female:"girl"}},i.getInputProps("gender"),{error:null}))),i.errors.gender&&n.createElement(w.H.Error,null,i.errors.gender)),n.createElement(w.H.FormRow,null,n.createElement(p.I.Wrapper,{label:n.createElement(u.T,{size:"p2",weight:"semiBold"},t("babyGrowth.input.birthday"))},n.createElement(m.D,Object.assign({},s,{maxDate:new Date},i.getInputProps("birthday"),{error:null,onChange:e=>{e&&i.validateField("measurementDate"),i.getInputProps("birthday").onChange(e)}}))),i.errors.birthday&&n.createElement(w.H.Error,null,i.errors.birthday)),n.createElement(w.H.FormRow,null,n.createElement(p.I.Number,Object.assign({label:n.createElement(u.T,{size:"p2",weight:"semiBold"},t("babyGrowth.height"),n.createElement(u.T,{size:"p2",weight:"semiBold",color:h.r.colors.gray300,as:"span"},` (${t("babyGrowth.cm")})`))},i.getInputProps("height"),{placeholder:t("babyGrowth.height"),min:f.I.height.min,max:f.I.height.max,onChange:e=>{i.setFieldValue("height",e),i.setFieldValue("checkMesureVal",!i.values.checkMesureVal)}}))),n.createElement(w.H.FormRow,null,n.createElement(p.I.Number,Object.assign({label:n.createElement(u.T,{size:"p2",weight:"semiBold"},t("babyGrowth.weight"),n.createElement(u.T,{size:"p2",weight:"semiBold",color:h.r.colors.gray300,as:"span"},` (${t("babyGrowth.kg")})`))},i.getInputProps("weight"),{placeholder:t("babyGrowth.weight"),min:f.I.weight.min,max:f.I.weight.max,onChange:e=>{i.setFieldValue("weight",e),i.setFieldValue("checkMesureVal",!i.values.checkMesureVal)}}))),r!==v.L.Vietnam&&n.createElement(w.H.FormRow,null,n.createElement(p.I.Number,Object.assign({label:n.createElement(u.T,{size:"p2",weight:"semiBold"},t("babyGrowth.head"),n.createElement(u.T,{size:"p2",weight:"semiBold",color:h.r.colors.gray300,as:"span"},` (${t("babyGrowth.cm")})`))},i.getInputProps("head"),{placeholder:t("babyGrowth.head"),onChange:e=>{i.setFieldValue("head",e),i.setFieldValue("checkMesureVal",!i.values.checkMesureVal)}}))),i.errors.checkMesureVal&&n.createElement(w.H.Error,null,i.errors.checkMesureVal),n.createElement(w.H.FormRow,null,n.createElement(p.I.Wrapper,{label:n.createElement(u.T,{size:"p2",weight:"semiBold"},t("babyGrowth.input.measurementDate"))},n.createElement(m.D,Object.assign({},s,{defaultValue:new Date},i.getInputProps("measurementDate"),{maxDate:new Date,error:null}))),i.errors.measurementDate&&n.createElement(w.H.Error,null,i.errors.measurementDate)),n.createElement(w.H.FormRow,{className:a.submitWrapper},n.createElement(w.H.Submit,Object.assign({className:a.submitBtn,type:"submit","data-event-category":"Health Tool","data-event-action":"Baby Growth","data-event-label":o},l),t("babyGrowth.input.submit"))))};var k=(0,i.k)(e=>({root:{display:"flex",flexDirection:"column",gap:(0,o.h)(8)},bmiVal:{display:"inline-block"},unitText:{color:e.colors.gray[6]},submitBtn:{}}));let localizeNumberFormat=(e,t=2)=>Intl.NumberFormat(void 0,{maximumFractionDigits:t}).format(e),bmiCalculate=(e=0,t=0)=>{try{if(e&&t){let r=Number(t)/Math.pow(Number(e)/100,2);if(isNaN(r))return 0;return Number(localizeNumberFormat(r))}}catch(e){}return 0},InlineForm=e=>{var{styles:t,classNames:r}=e,i=(0,a._)(e,["styles","classNames"]);let{t:o,locale:c}=(0,g.u)(),{form:d,currentUrl:h,submitProps:x}=(0,n.useContext)(E),{classes:C={}}=(0,n.useContext)(b.C),I=(0,l.rZ)(),{classes:N}=k(void 0,{name:"BabyGrowthForm__InlineForm",styles:t,classNames:r}),P={placeholder:"DD/MM/YYYY",popoverProps:{withinPortal:!0}};return n.createElement(w.H,Object.assign({formLayout:"inline"},i),n.createElement(w.H.FormRow,null,n.createElement(w.H.BorderInlineControl,{label:o("tools.selectBabyGender")},n.createElement(y.G,Object.assign({type:"radio",hideLabel:!0,isBaby:!0,genderValue:{male:"boy",female:"girl"}},d.getInputProps("gender")))),d.errors.gender&&n.createElement(w.H.Error,null,d.errors.gender)),n.createElement(w.H.FormRow,null,n.createElement(w.H.BorderInlineControl,{label:o("babyGrowth.input.birthday")},n.createElement(m.D,Object.assign({},P,{maxDate:new Date},d.getInputProps("birthday"),{error:null,onChange:e=>{e&&d.validateField("measurementDate"),d.getInputProps("birthday").onChange(e)}}))),d.errors.birthday&&n.createElement(w.H.Error,null,d.errors.birthday)),n.createElement(w.H.FormRow,null,n.createElement(w.H.BorderInlineControl,{label:"BMI",styles:{control:{"&:first-child":{width:"auto"}}}},n.createElement(u.T,{size:"p3"},n.createElement("span",{className:N.bmiVal},d.getInputProps("height").value&&d.getInputProps("weight").value&&bmiCalculate(Number(d.getInputProps("height").value),Number(d.getInputProps("weight").value))),"(",o("babyGrowth.kg.m2"),")"),n.createElement(p.I.Number,Object.assign({},d.getInputProps("height"),{placeholder:o("babyGrowth.height"),min:f.I.height.min,max:f.I.height.max,onChange:e=>{d.setFieldValue("height",e),d.setFieldValue("checkMesureVal",!d.values.checkMesureVal)},rightSection:n.createElement(w.H.Unit,null,o("babyGrowth.cm"))})),n.createElement(p.I.Number,Object.assign({},d.getInputProps("weight"),{placeholder:o("babyGrowth.weight"),min:f.I.weight.min,max:f.I.weight.max,onChange:e=>{d.setFieldValue("weight",e),d.setFieldValue("checkMesureVal",!d.values.checkMesureVal)},rightSection:n.createElement(w.H.Unit,null,o("babyGrowth.kg"))}))),("mb"===I.other.template||c!==v.L.Vietnam)&&n.createElement(w.H.BorderInlineControl,{label:o("babyGrowth.head")},n.createElement(p.I.Number,Object.assign({},d.getInputProps("head"),{placeholder:o("babyGrowth.head"),onChange:e=>{d.setFieldValue("head",e),d.setFieldValue("checkMesureVal",!d.values.checkMesureVal)},rightSection:n.createElement(w.H.Unit,null,o("babyGrowth.cm"))}))),d.errors.checkMesureVal&&n.createElement(w.H.Error,null,d.errors.checkMesureVal)),n.createElement(w.H.FormRow,null,n.createElement(w.H.BorderInlineControl,{label:o("babyGrowth.input.measurementDate")},n.createElement(m.D,Object.assign({},P,{maxDate:new Date},d.getInputProps("measurementDate"),{error:null}))),d.errors.measurementDate&&n.createElement(w.H.Error,null,d.errors.measurementDate)),n.createElement(w.H.FormRow,{className:C.submitWrapper},n.createElement(w.H.Submit,Object.assign({type:"submit","data-event-category":"Health Tool","data-event-action":"Baby Growth","data-event-label":h,className:(0,s.default)(N.submitBtn,C.submitBtn)},x),o("babyGrowth.input.submit"))))},MbLayout=e=>{var t=(0,a._)(e,[]);let{t:r}=(0,g.u)(),{form:i,currentUrl:o,submitProps:l}=(0,n.useContext)(E),s={placeholder:"DD/MM/YYYY",popoverProps:{withinPortal:!0}};return n.createElement(w.H,Object.assign({formLayout:"default"},t),n.createElement(w.H.FormRow,null,n.createElement(w.H.Control,null,n.createElement(y.G,Object.assign({isBaby:!0,genderValue:{male:"boy",female:"girl"}},i.getInputProps("gender"),{error:null}))),i.errors.gender&&n.createElement(w.H.Error,null,i.errors.gender)),n.createElement(w.H.BorderBoxControl,{label:r("babyGrowth.input.birthday"),rightSection:n.createElement(x.Z,null)},n.createElement(m.D,Object.assign({},s,{maxDate:new Date},i.getInputProps("birthday"),{error:null,rightSection:null,onChange:e=>{e&&i.validateField("measurementDate"),i.getInputProps("birthday").onChange(e)}}))),i.errors.birthday&&n.createElement(w.H.Error,null,i.errors.birthday),n.createElement(w.H.BorderBoxControl,{label:r("babyGrowth.height"),rightSection:r("babyGrowth.cm")},n.createElement(p.I.Number,Object.assign({},i.getInputProps("height"),{placeholder:r("tools.inputPlaceholder",{content:"160"}),min:f.I.height.min,max:f.I.height.max,onChange:e=>{i.setFieldValue("height",e),i.setFieldValue("checkMesureVal",!i.values.checkMesureVal)}}))),i.errors.height&&n.createElement(w.H.Error,null,i.errors.height),n.createElement(w.H.BorderBoxControl,{label:r("babyGrowth.weight"),rightSection:r("babyGrowth.kg")},n.createElement(p.I.Number,Object.assign({},i.getInputProps("weight"),{placeholder:r("tools.inputPlaceholder",{content:"50"}),min:f.I.weight.min,max:f.I.weight.max,onChange:e=>{i.setFieldValue("weight",e),i.setFieldValue("checkMesureVal",!i.values.checkMesureVal)}}))),i.errors.weight&&n.createElement(w.H.Error,null,i.errors.weight),n.createElement(w.H.BorderBoxControl,{label:r("babyGrowth.head"),rightSection:r("babyGrowth.cm")},n.createElement(p.I.Number,Object.assign({},i.getInputProps("head"),{placeholder:r("tools.inputPlaceholder",{content:"50"}),onChange:e=>{i.setFieldValue("head",e),i.setFieldValue("checkMesureVal",!i.values.checkMesureVal)}}))),i.errors.checkMesureVal&&n.createElement(w.H.Error,null,i.errors.checkMesureVal),n.createElement(w.H.BorderBoxControl,{label:r("babyGrowth.input.measurementDate"),rightSection:n.createElement(x.Z,null)},n.createElement(p.I.Wrapper,null,n.createElement(m.D,Object.assign({},s,{defaultValue:new Date},i.getInputProps("measurementDate"),{maxDate:new Date,rightSection:null,error:null})))),i.errors.measurementDate&&n.createElement(w.H.Error,null,i.errors.measurementDate),n.createElement(w.H.Submit,Object.assign({type:"submit","data-event-category":"Health Tool","data-event-action":"Baby Growth","data-event-label":o},l),r("babyGrowth.input.submit")))},BabyGrowthForm=e=>{var{onSubmit:t,formLayout:r="default",submitProps:i,currentUrl:o}=e,s=(0,a._)(e,["onSubmit","formLayout","submitProps","currentUrl"]);let{t:p}=(0,g.u)(),m=(0,l.rZ)(),u=(0,c.c)({initialValues:{measurementDate:new Date},validate:{gender:(0,d.U)(p("validation.error.requiredField")),birthday:(0,d.U)(p("validation.error.requiredField")),measurementDate:(e,t)=>t.birthday?t.birthday instanceof Date&&e instanceof Date&&t.birthday.getTime()<=e.getTime()?null:p("babyGrowth.error.measurementDateLowerThanBirthday",{name:""}):null,checkMesureVal:(e,t)=>void 0===t.head&&void 0===t.height&&void 0===t.weight||t.head||t.height||t.weight?null:p("babyGrowth.error.atLeastOneOf")},validateInputOnChange:["checkMesureVal"]}),h=Object.assign({onSubmit:u.onSubmit(e=>null==t?void 0:t(Object.assign(Object.assign({},e),{bmi:bmiCalculate(Number(u.getInputProps("height").value),Number(u.getInputProps("weight").value)).toString()})))},s);return n.createElement(E.Provider,{value:{submitProps:i,currentUrl:o,form:u}},"default"===r?"mb"===m.other.template?n.createElement(MbLayout,Object.assign({formLayout:r},h)):n.createElement(DefaultForm,Object.assign({},h)):n.createElement(InlineForm,Object.assign({},h)))}},"9dv4":function(e,t,r){r.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 $},d:function(){return getPostFormData},e:function(){return editPost},f:function(){return createPost},g:function(){return getDefaultFailNoti},h:function(){return deletePost},i:function(){return j},j:function(){return deleteComment},k:function(){return decodeCommentBody},l:function(){return likeUnlikeComment},m:function(){return likeUnlikePost},u:function(){return useImagePicker}});var a=r("q1tI"),n=r("LB4I"),i=r("sfOR"),o=r("pMur"),l=r("JIuZ"),s=r("i8i4"),c=r("7m0Y"),d=r("rBCA"),p=r("iBNF"),m=r("Kz+G"),u=r("s/gR"),h=r("FUIV"),g=r("0aZv"),b=r("xPje"),f=r("IQVP"),w=r("2RCU"),y=r("jq6R"),v=r("hJjf"),x=r("z9Ho"),E=r("FK1Y"),k=r("t/pd"),C=r("fKfj"),I=r("o6WS"),N=r("LPsQ"),P=r("/pFO");let useImagePicker=(e,t)=>{let[r,n]=(0,a.useState)(e||[]),i=(0,a.useMemo)(()=>(e||r).map(e=>"string"==typeof e?e:URL.createObjectURL(e)),[e,r]);return{onSelectImages:a=>{let i=a.target.files;if(i){if(t&&e){let a=e||r;t(a.concat(Array.from(i)))}else n(r=>{let a=e||r;return t&&t(a.concat(Array.from(i))),a.concat(Array.from(i))})}},onRemoveImage:r=>{t&&e?(e.splice(r,1),t(e.slice())):n(a=>{let n=e||a;return n.splice(r,1),t&&t(n.slice()),n.slice()})},onRemoveAllImages:()=>{t?t([]):n([])},imageSrcs:i,imageFiles:e||r}},getDefaultFailNoti=e=>({message:e("notification.failure"),type:"danger"}),likeUnlikePost=({id:e,locale:t})=>(0,m.a)(void 0,void 0,void 0,function*(){if(!e)return;let r=yield(0,c.e)((0,c.f)(f.yy.POST.LIKE,{id:e,_locale:t}),"GET");return r}),deletePost=({id:e,locale:t})=>(0,m.a)(void 0,void 0,void 0,function*(){if(!e)return;let r=yield(0,c.e)((0,c.f)(f.yy.POST.DELETE,{id:e,_locale:t}),"DELETE");return r}),getPostFormData=({title:e,description:t,communityId:r,imageFiles:a,previewUrl:n,topicIds:i,locale:o,sanitizeFunction:s,categoryCommunityId:c,categoryTopicIds:d,introUrl:p,bannerUrl:u,scheduleTime:h,isAnonymous:g,isAskDoctor:f})=>(0,m.a)(void 0,void 0,void 0,function*(){let m=new FormData,y=(0,w.j)(t),v=(0,w.j)(e),x=(0,w.i)(y);if(m.append("title",v),m.append("description",(0,w.k)(y,s)),c?m.append("category_community",String(c)):r&&m.append("community_id",String(r)),m.append("is_anonymous",g?"1":"0"),m.append("is_question",f?"1":"0"),(null==n?void 0:n.title)&&m.append("preview_title",n.title),(null==n?void 0:n.description)&&m.append("preview_description",n.description),(null==n?void 0:n.url)&&m.append("preview_link",(0,l.c)(n.url)),(null==n?void 0:n.image)&&m.append("preview_image",(0,l.c)(n.image)),null==i||i.forEach(e=>{m.append("topics[]",String(e||""))}),null==d||d.forEach(e=>{m.append("category_topics[]",String(e||""))}),null==a?void 0:a.length){let e=yield Promise.all(a.map((e,t)=>new Promise(r=>{setTimeout(()=>{r((0,w.u)(e,o))},2e3*t)})));null==e||e.filter(Boolean).slice(0,b.M).forEach((e,t)=>{m.append(`images[${t}]`,e)})}else m.append("images","");return null==x||x.forEach(e=>{m.append("mention_ids[]",e)}),m.append("intro_url",p||""),m.append("banner",u||""),h&&(m.append("post_type","scheduled"),m.append("schedule_datetime",h)),m}),createPost=({locale:e,formData:t,isArticleComment:r})=>(0,m.a)(void 0,void 0,void 0,function*(){let a=yield(0,c.e)((0,c.f)(r?f.yy.POST.CREATE_ARTICLE_COMMENT:f.yy.POST.CREATE,{_locale:e}),"POST",{data:t});return a}),editPost=({id:e,locale:t,formData:r})=>(0,m.a)(void 0,void 0,void 0,function*(){let a=yield(0,c.e)((0,c.f)(f.yy.POST.UPDATE,{id:e,_locale:t}),"POST",{data:r});return a}),reportPost=({id:e,reason:t,locale:r})=>{let a=new FormData;return a.append("reason",t),(0,c.e)((0,c.f)(f.yy.POST.REPORT,{_locale:r,id:e}),"POST",{data:a})},M=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:r,heading:n="",children:o,isOpen:l=!1,hasFullscreen:s=!1,disableClickOutside:c=!1,initExpand:d=!1,onExpandChange:p,onClose:m=()=>null})=>{let[u,h]=(0,a.useState)(d);return a.createElement(M,{className:e,style:t,isExpand:u,hasFullscreen:s},a.createElement(I.P,{type:"confirm",onClose:m,isOpen:l,closeIcon:r||a.createElement("img",{src:N.C,loading:"lazy"}),enableAnimation:!s,disableClickOutside:c},a.createElement("div",{className:"header"},a.createElement(i.H,{tag:"h5"},n),s&&a.createElement(S,{onClick:()=>{null==p||p(),h(!u)}},a.createElement(C.Z,{size:14,isExpand:u}))),a.createElement("div",{className:"content"},"function"==typeof o?o(u):o)))};var $="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 z=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:r,title:d,description:p,acceptText:m,cancelText:u,onAccept:h,onCancel:g,thumbnail:b,isThumbnailIcon:f,onClose:w,acceptBtnTracking:y,acceptBtnProps:v,cancelBtnProps:x})=>{let{data:{env:{isMarryBaby:E}}}=(0,a.useContext)(c.T),k="boolean"==typeof t?t:E,[C,I]=(0,a.useState)(!1);return((0,a.useEffect)(()=>((0,l.t)(!0),setTimeout(()=>I(!0),0),()=>(0,l.t)(!1)),[]),"undefined"==typeof window)?null:s.createPortal(a.createElement(z,{"data-is-marrybaby":k,className:e,style:r,"data-open":C},a.createElement(PopupFrame,{className:"popup-frame",isOpen:C,onClose:w},a.createElement("div",{className:"confirm-dialog",onClick:e=>e.stopPropagation()},a.createElement("div",{className:"confirm-content"},b&&a.createElement("div",{className:`thumbnail-container ${f?"is-icon":""}`},a.createElement("img",{className:"thumbnail",src:b,loading:"lazy"})),a.createElement(i.H,{className:"title",tag:"h2"},d),a.createElement(o.T,{className:"desc",size:"lg"},p),a.createElement("div",{className:"btn-group"},a.createElement(n.B,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",color:"tertiary",onClick:()=>{null==h||h(),null==w||w()}},v,y),m),a.createElement(n.B,Object.assign({theme:k?"marryBaby":"helloSites",size:"md",onClick:()=>{null==g||g(),null==w||w()}},x),u)))),k&&b&&a.createElement("div",{className:`thumbnail-container is-mobile ${f?"is-icon":""}`},a.createElement("img",{className:"thumbnail",src:b,loading:"lazy"})))),(0,l.a)())},F=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; } } } `,D=(0,a.createContext)({}),getCommentFormBody=({postId:e,message:t,photos:r,link:a,locale:n,sanitizeFunction:i,replyingUserId:o,replyingUserName:l,replyingId:s})=>(0,m.a)(void 0,void 0,void 0,function*(){let c=new FormData,d=(0,w.k)(t.replace(/(\ )+/g," "),i),p=(0,w.i)(d);if(r&&r.length>0){let e=yield Promise.all(null==r?void 0:r.map(e=>(0,w.u)(e,n)));e.filter(Boolean).slice(0,b.M).forEach(e=>{c.append("images[]",e)})}return a&&c.append("link",a),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.a)(void 0,void 0,void 0,function*(){return(0,c.e)((0,c.f)(f.yy.COMMENT.CREATE,{_locale:t}),"POST",{data:e})}),decodeCommentBody=e=>{try{let t=e.match(/\[@([^\]]+)\]/),r=t?t[0].replace("[@","").replace("]",""):"",a=e.replace(/\[@([^\]]+)\]/,"");return{text:a.trim(),replyingTo:r}}catch(e){}return{text:""}},submitReply=(e,t)=>(0,m.a)(void 0,void 0,void 0,function*(){return(0,c.e)((0,c.f)(f.yy.COMMENT.REPLY,{_locale:t}),"POST",{data:e})}),likeUnlikeComment=({commentId:e,setLike:t=!1,locale:r})=>(0,m.a)(void 0,void 0,void 0,function*(){return(0,c.e)((0,c.f)(t?f.yy.COMMENT.LIKE:f.yy.COMMENT.UNLIKE,{_locale:r,id:e}),"GET")}),deleteComment=({id:e,locale:t})=>(0,c.e)((0,c.f)(f.yy.COMMENT.DELETE,{_locale:t,id:e}),"DELETE"),InputCommentBar=({isReply:e,className:t,onClose:r,replyToName:i,style:l,replyingId:s,replyingUser:d,onPostSuccess:p,post:f,isMarryBaby:w})=>{let{action:{pushNotifications:k,sanitizeFunction:C},data:{userInfo:I,locale:N,env:{isMarryBaby:P}}}=(0,a.useContext)(c.T),{t:M}=(0,h.u)(),{onSelectImages:S,onRemoveImage:z,imageSrcs:O,onRemoveAllImages:B,imageFiles:j}=useImagePicker(),[_,T]=(0,a.useState)(""),{trigger:H}=(0,a.useContext)(D),[L,V]=(0,a.useState)(!1),R=(0,a.useRef)(null),G=(0,a.useRef)(null),U=(0,a.useRef)(null),[Z,A]=(0,a.useState)([]),[W,q]=(0,a.useState)([]),[Y,J]=(0,a.useState)(null);return(0,a.useEffect)(()=>{var e;null===(e=U.current)||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{var e;null===(e=G.current)||void 0===e||e.focus()},400)},[H]),a.createElement(F,{"data-is-reply":e,className:t,style:l},e&&a.createElement("div",{className:"reply-to-container"},a.createElement(o.T,{size:"p4"},a.createElement("span",{dangerouslySetInnerHTML:{__html:M("inputComment.replyTo",{name:`@${i||""}`})}})),a.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:()=>r&&r(),loading:"lazy"})),a.createElement("div",{className:"input-container",ref:U},a.createElement(x.U,{className:`avatar-wrapper ${e?"avatar-wrapper-reply":""}`,avatar:(null==I?void 0:I.id)?I.avatar:b.D,username:(null==I?void 0:I.name)||(null==I?void 0:I.username)}),a.createElement("input",{ref:R,onChange:S,type:"file",multiple:!0,accept:"image/png,image/jpeg",name:"images",style:{display:"none"}}),a.createElement(u.I,{value:_,name:"input",size:"md",className:"input-wrapper",displayIcon:a.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:a.createElement("div",{className:"as-input"},a.createElement(E.R,{className:"textarea",html:_,onChange:T,onImagePickerClick:()=>{var e;return null===(e=R.current)||void 0===e?void 0:e.click()},bannedWords:W,onPreviewUrlChange:J,onInvalidUrlsChange:A,setEditorRef:e=>G.current=e,isReplying:e}))}),a.createElement(n.B,{theme:("boolean"==typeof w?w:P)?"marryBaby":"helloSites",className:"send-button",size:"sm",onClick:()=>(0,m.a)(void 0,void 0,void 0,function*(){var t,a,n,i,o,l,c,m,u;if((null==f?void 0:f.id)&&!L){V(!0);try{let h=yield getCommentFormBody(Object.assign({message:_,photos:j,postId:String(f.id),link:null==Y?void 0:Y.url,sanitizeFunction:C,locale:N},e&&s?{replyingUserId:String((null==d?void 0:d.id)||(null===(t=null==f?void 0:f.author)||void 0===t?void 0:t.id)||""),replyingId:s,replyingUserName:(null==d?void 0:d.name)||(null==d?void 0:d.username)||""}:{})),b=yield e&&s?submitReply(h,N):submitComment(h,N),w=null==b?void 0:b.data;(null==w?void 0:w.id)&&!(null===(n=null===(a=null==b?void 0:b.messages)||void 0===a?void 0:a.moderation)||void 0===n?void 0:n.type)?(e=>{T(""),B(),r&&r();let t=(0,g.g)(e.data);"string"==typeof t.images&&(t.images=JSON.parse(t.images)),p&&p(t)})(b):(null===(o=null===(i=null==b?void 0:b.messages)||void 0===i?void 0:i.moderation)||void 0===o?void 0:o.type)==="banned"?(k({title:M("notification.comment.blocked.title"),message:M("notification.comment.blocked.message"),type:"danger"}),b.messages.moderation.words&&q(b.messages.moderation.words)):(null===(c=null===(l=null==b?void 0:b.messages)||void 0===l?void 0:l.moderation)||void 0===c?void 0:c.type)==="suspect"?(k({title:M("notification.comment.suspect.title"),message:M("notification.comment.suspect.message"),type:"warning"}),T(""),B(),r&&r()):(null===(m=null==b?void 0:b.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:M("notification.suspend.message"),type:"warning"}),T(""),B(),r&&r()):k({title:"",message:(null===(u=null==b?void 0:b.messages)||void 0===u?void 0:u[0])||M("notification.comment.somethingWrong"),type:"danger"})}catch(e){k({title:"",message:M("notification.comment.somethingWrong"),type:"danger"})}V(!1)}}),isLoading:L,isDisabled:!!(null==Z?void 0:Z.length)||L||!_||(null==_?void 0:_.length)<2||!_.trim()},a.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==Z?void 0:Z.length)?a.createElement("div",{className:"error-text"},M("notification.limitUrlDomain")):null,(!O||0===O.length)&&Y&&a.createElement("div",{className:"link-preview-wrapper"},Y.isFetching?a.createElement(v.L,null):a.createElement(a.Fragment,null,a.createElement(y.C,{title:Y.title,url:Y.url||"#",image:Y.image,noRefetch:!0}),a.createElement("img",{src:$,className:"icon-close",onClick:()=>J(null),loading:"lazy"}))),O&&O.length>0&&a.createElement("div",{className:"preview-images-container"},O.map((e,t)=>a.createElement("div",{key:t,className:"image-src-wrapper"},a.createElement("img",{className:"preview-image",src:e,loading:"lazy"}),a.createElement("img",{src:$,className:"icon-close-circle",onClick:()=>z(t),loading:"lazy"})))))},SharePopup=({trackingCategory:e,className:t,style:r,url:n,text:i,onClose:o})=>{let{data:{env:{isMarryBaby:s}}}=(0,a.useContext)(c.T),{t:d}=(0,h.u)(),[p,m]=(0,a.useState)(!1);return(0,a.useEffect)(()=>((0,l.t)(!0),setTimeout(()=>m(!0),0),()=>(0,l.t)(!1)),[]),a.createElement(k.h,null,a.createElement(O,{"data-is-marrybaby":s,className:t,style:r},a.createElement(PopupFrame,{className:"share-popup",isOpen:p,onClose:o,heading:d("bottomBar.share")},p&&a.createElement(P.r,{trackingCategory:e,shareUrl:n||("undefined"!=typeof window?window.location.href:""),title:i}))))},O=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; } } } `,B=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 j="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:r,reasonText:i,onClose:l,postId:s})=>{let{data:{locale:d,env:{isMarryBaby:u}},action:{pushNotifications:g}}=(0,a.useContext)(c.T),{t:b}=(0,h.u)(),[f,w]=(0,a.useState)(!1);return a.createElement(B,{"data-is-marrybaby":u,className:e,style:t},a.createElement("ul",{className:"report-list"},a.createElement("li",{className:"report-item"},a.createElement("img",{src:j,loading:"lazy"}),a.createElement(o.T,{className:"__label",color:p.r.colors.gray800,size:"p4"},i))),a.createElement(n.B,{theme:u?"marryBaby":"helloSites",className:"report-submit",size:"lg",color:"primary",isLoading:f,onClick:()=>(0,m.a)(void 0,void 0,void 0,function*(){if(s&&!f){w(!0);try{let e=yield reportPost({id:s,reason:r,locale:d});(null==e?void 0:e.status)===1&&(g({message:"Post reported",type:"success"}),l&&l())}catch(e){}w(!1)}})},b("submit")))}},o6WS:function(e,t,r){r.d(t,{P:function(){return Popup}});var a=r("q1tI"),n=r("rBCA"),i=r("JIuZ"),o=r("iBNF");let l=n.Z.div` position: fixed; left: 50%; padding: 0 16px 32px; background-color: ${o.r.colors.white}; border-radius: ${o.r.borderRadius}; box-shadow: 0px 4px 8px ${o.r.colors.gray200}; transform: translate(-50%, -50%); transition: all 0.5s ease-in-out; visibility: hidden; &[data-open='true'] { z-index: 400; top: 50%; opacity: 1; visibility: visible; } &[data-open='false'] { top: -50%; } &[data-type='lead'] { width: 332px; height: 460px; div { top: -15px; right: -15px; } } &[data-type='form'] { width: 496px; height: 548px; ${i.M.mbDown} { width: 340px; } } &[data-type='confirm'] { ${i.M.mbDown} { width: calc(100% - 32px); } ${i.M.mbUp} { width: 100%; max-width: 407px; } } .popup-content { position: relative; z-index: 111; height: 100%; padding: 16px; } .close-button { position: absolute; top: 16px; right: 0; cursor: pointer; img { width: 100%; height: 100%; border-radius: 50%; } } `,s=n.Z.div` position: fixed; z-index: 110; top: 0; left: 0; width: 100%; height: 100%; align-items: center; background: rgba(38, 38, 38, 0.3); &[data-open='false'] { display: none; } `,Popup=({type:e="lead",closeIcon:t,isOpen:r=!0,onClose:n,children:i,className:o="",enableAnimation:c=!0,disableClickOutside:d=!1})=>a.createElement(a.Fragment,null,a.createElement(l,{"data-open":r,"data-type":e,"data-animation":c},a.createElement("div",{className:`${o||""} popup-content`},!!t&&a.createElement("div",{className:"close-button",onClick:n},t),i)),a.createElement(s,{"data-open":r,onClick:()=>{d||n()}}))},dZV3:function(e,t,r){r.d(t,{C:function(){return Checkbox},I:function(){return ImageWrapV2},P:function(){return Pagination},S:function(){return E},a:function(){return w},b:function(){return SearchInput},c:function(){return Search2}});var a=r("q1tI"),n=r("rBCA"),i=r("JIuZ"),o=r("iBNF"),l=r("Kz+G"),s=r("s/gR"),c=r("xrdX"),d=r("FUIV"),p=r("H1c6"),m=r("l6P8");let Search2=e=>a.createElement("svg",Object.assign({width:"1em",height:"1em",viewBox:"0 0 24 25",fill:"none"},e),a.createElement("path",{d:"M11 18.957C14.866 18.957 18 15.823 18 11.957C18 8.09104 14.866 4.95703 11 4.95703C7.13401 4.95703 4 8.09104 4 11.957C4 15.823 7.13401 18.957 11 18.957Z",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),a.createElement("path",{d:"M20 20.957L16 16.957",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),u=n.Z.div` display: flex; cursor: pointer; &[data-theme='marryBaby'] { input { width: 20px; height: 20px; border: 1.3px solid ${o.r.mbColors.midGray}; border-radius: 9px; cursor: inherit; transition: border-color 0.4s, box-shadow 0.4s; &:hover, &:active { border-color: ${o.r.mbColors.cobalt}; box-shadow: 0 0 2px 2px ${o.r.mbColors.cobalt}; } &:focus-visible { border: 2px solid ${o.r.mbColors.cobalt}; } &:checked { border: 0; background: ${o.r.mbColors.cobalt} url("data:image/svg+xml,%3Csvg width='9' height='7' viewBox='0 0 9 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 4L3.45455 6L8 1' stroke='white' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A") no-repeat center center; } } label { max-width: 15rem; margin-left: 8px; width: calc(100% - 24px); cursor: inherit; font-weight: 600; font-size: 12px; line-height: 20px; letter-spacing: -0.2px; color: ${o.r.mbColors.gray}; } } input { width: 20px; height: 20px; border: solid 1px ${o.r.colors.gray500}; border-radius: 2px; cursor: inherit; transition: border-color 0.4s, box-shadow 0.4s; &:hover, &:active { border-color: ${o.r.colors.primaryBase}; box-shadow: 0 0 2px 2px ${o.r.colors.primary200}; } &:focus-visible { border: 2px solid ${o.r.colors.primaryActive}; } &:checked { border: 0; background: ${o.r.colors.primaryBase} url("data:image/svg+xml,%3Csvg width='12' height='9' viewBox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 1L4.125 8L1 4.81819' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A") no-repeat center center; } } label { max-width: 15rem; margin-left: 8px; font-weight: ${o.r.sizes.fwRegular}; width: calc(100% - 24px); cursor: inherit; ${i.M.mbDown} { font-size: 14px; line-height: 24px; } ${i.M.mbUp} { font-size: 16px; line-height: 22px; } } &[data-is-rectangle] > input { position: relative; width: unset; height: unset; padding: 5px 12px; border: 1px solid ${o.r.colors.neutral100}; border-radius: 32px; &::after { color: ${o.r.colors.gray800}; content: attr(data-label-text); font-size: 13px; } &:checked { border-color: ${o.r.colors.primary50}; &::after { color: ${o.r.colors.primaryBase}; } } &:checked { background: ${o.r.colors.primary50}; } } &[data-disabled] { color: ${o.r.colors.gray300}; cursor: not-allowed; input { border-color: ${o.r.colors.gray300}; &:hover { border-color: ${o.r.colors.gray300}; box-shadow: none; } } } `,Checkbox=({label:e,name:t,checked:r,className:n,isDisabled:i,onChange:o,value:l,isRectangle:s,inputDataTestId:c,siteType:d})=>a.createElement(u,{className:n,"data-disabled":i||void 0,"data-is-rectangle":s||void 0,"data-label-text":e,"data-theme":d},a.createElement("input",{type:"checkbox",checked:r,name:t,onChange:()=>o(l,!r),disabled:i,value:l,id:`${t}-${l}`,"data-label-text":e,"data-testid":c}),!s&&a.createElement("label",{htmlFor:`${t}-${l}`},e)),h=n.Z.div` display: flex; align-items: center; justify-content: space-between; user-select: none; li { transition: all 0.3s ease; } [data-page-active] { background: ${o.r.colors.primaryBase}; color: ${o.r.colors.white}; > a { color: ${o.r.colors.white}; } } `,g=n.Z.div` display: flex; width: 32px; height: 32px; box-sizing: border-box; align-items: center; justify-content: center; border: 1px solid ${o.r.colors.gray200}; margin: 0 2px; border-radius: 4px; color: ${o.r.colors.gray800}; cursor: pointer; font-size: 14px; font-weight: ${o.r.sizes.fwBold}; &[data-last-page] { border: none; background-color: ${o.r.colors.gray100}; cursor: not-allowed; pointer-events: none; svg { path { stroke: ${o.r.colors.gray300}; } } } `,b=n.Z.li` display: flex; width: 32px; height: 32px; align-items: center; justify-content: center; margin: 0 2px; border-radius: 4px; color: ${o.r.colors.gray800}; cursor: pointer; font-size: 14px; font-weight: ${o.r.sizes.fwBold}; > a { color: ${o.r.colors.gray800}; text-decoration: unset; display: block; width: 100%; height: 100%; line-height: 32px; text-align: center; } `,RenderPagiWithDots=({pagesAmount:e,activePage:t,handlePageChange:r,handleClick:n,href:o,queryPageName:l="page"})=>{let s=[...Array(e)].map((e,t)=>t+1),[c,d]=(0,a.useState)(t<=4?s.slice(0,5):t>=s.length-3?s.slice(s.length-5,s.length):s.slice(t-2,t+1));return(0,a.useEffect)(()=>{t<=4?d(s.slice(0,5)):t>=s.length-3?d(s.slice(s.length-5,s.length)):d(s.slice(t-2,t+1))},[t]),a.createElement(a.Fragment,null,t>4&&a.createElement(a.Fragment,null,a.createElement(b,{onClick:()=>r(1)},o?a.createElement("a",{href:o,onClick:n},1):1),a.createElement(b,null,"...")),c.map(e=>a.createElement(b,{key:`pagination+${e}`,"data-page-active":e===t||void 0,onClick:()=>r(e)},o?a.createElement("a",{href:(0,i.f)(o,e,l),onClick:n},e):e)),tr(s.length)},o?a.createElement("a",{href:(0,i.f)(o,s.length,l),onClick:n},s.length):s.length)))},Pagination=({className:e,pagesAmount:t,currentPage:r,onChange:n,onClick:o,style:l,href:s,queryPageName:c="page"})=>{let d=[...Array(t)].map((e,t)=>t+1),[p,m]=(0,a.useState)(r),u=(0,a.useMemo)(()=>s&&s.endsWith("&page=")?s.replace("&page=",""):s,[s]),f=t-1,handlePageChange=e=>{e<=t&&e>0&&(m(e),n(e))},handleClick=e=>{o&&o(e)};return(0,a.useEffect)(()=>{m(r)},[r]),a.createElement(h,{className:e,style:l},a.createElement(g,{className:"prev-page",onClick:()=>handlePageChange(p-1),"data-last-page":1===p||void 0},u?a.createElement("a",{href:(0,i.f)(u,p,c),onClick:handleClick},a.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},a.createElement("path",{d:"M5.5 9L1.5 5L5.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))):a.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},a.createElement("path",{d:"M5.5 9L1.5 5L5.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))),d.length>8?a.createElement(RenderPagiWithDots,{pagesAmount:t,activePage:p,handlePageChange:handlePageChange,handleClick:handleClick,href:u,queryPageName:c}):d.map(e=>a.createElement(b,{key:`pagination+${e}`,"data-page-active":e===p||void 0,onClick:()=>handlePageChange(e)},u?a.createElement("a",{href:(0,i.f)(u,e,c),onClick:handleClick},e):e)),a.createElement(g,{className:"next-page",onClick:()=>handlePageChange(p+1),"data-last-page":p===f+1||void 0},u?a.createElement("a",{href:(0,i.f)(u,p,c),onClick:handleClick},a.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},a.createElement("path",{d:"M1.5 9L5.5 5L1.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))):a.createElement("svg",{width:"7",height:"10",viewBox:"0 0 7 10",fill:"none"},a.createElement("path",{d:"M1.5 9L5.5 5L1.5 1",stroke:"#2D87F3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}))))},f=n.Z.div` position: relative; width: 100%; &[data-has-error] { input { border-color: ${o.r.colors.red700}; } } input { width: 100%; padding: 12px 16px; border: solid 1px ${o.r.colors.gray200}; border-radius: ${o.r.borderRadius}; &:active, &:focus, .focused & { border-color: ${o.r.colors.primaryBase}; box-shadow: 0px 0px 2px 2px ${o.r.colors.primary200}; } &:disabled { background-color: ${o.r.colors.gray100}; cursor: not-allowed; } } &[data-has-action-icon] { input { padding: 12px 48px 12px 16px; } } &[data-has-display-icon] { input { padding: 12px 16px 12px 48px; } } &[data-has-action-icon][data-has-display-icon] { input { padding: 12px 48px; } } &[data-size='lg'] { input { font-size: 16px; font-weight: ${o.r.sizes.fwRegular}; ${i.M.mbDown} { font-size: 22px; line-height: 1.2; } ${i.M.mbUp} { font-size: 26px; line-height: 1.2; } } } &[data-size='md'] { input { font-weight: ${o.r.sizes.fwRegular}; ${i.M.mbDown} { font-size: 14px; line-height: 1.2; } ${i.M.mbUp} { font-size: 16px; line-height: 1.2; } } } &[data-size='sm'] { input { font-weight: ${o.r.sizes.fwRegular}; ${i.M.mbDown} { font-size: 13px; line-height: 1.5; } ${i.M.mbUp} { font-size: 13px; line-height: 1.5; } } } `,w=a.forwardRef((e,t)=>{var{name:r,errorMessage:n,autoComplete:i="off",defaultValue:o,actionIcon:c,displayIcon:d,isDeleteAction:p,onActionClick:m,label:u,placeholder:h,className:g,onChange:b,onKeyPress:w,isDisabled:y,CustomInput:v,size:x,style:E,autoFocus:k,type:C="text",isNumerousKeyboard:I=!1,onFocus:N,enterKeyHint:P,nativeOnChange:M}=e,S=(0,l._)(e,["name","errorMessage","autoComplete","defaultValue","actionIcon","displayIcon","isDeleteAction","onActionClick","label","placeholder","className","onChange","onKeyPress","isDisabled","CustomInput","size","style","autoFocus","type","isNumerousKeyboard","onFocus","enterKeyHint","nativeOnChange"]);let[$,z]=(0,a.useState)(o),handleOnChange=e=>{z(e),b(e)};return a.createElement(f,{"data-size":x,className:g,"data-has-action-icon":!!c||void 0,"data-has-display-icon":!!d||void 0,"data-has-error":n&&n.length>0||void 0,style:E},u&&a.createElement(s.L,{size:"label2",htmlFor:r,className:"inputLabel"},u),a.createElement("div",{style:{position:"relative"}},v||a.createElement("input",Object.assign({id:r,name:r,placeholder:h,onChange:null!=M?M:e=>handleOnChange(e.target.value),onKeyPress:w,type:C,"aria-label":C,disabled:y,value:$,autoComplete:i,ref:t,autoFocus:k,inputMode:I||"number"===C?"numeric":C,pattern:I?"[0-9]*":".*",onFocus:N,enterKeyHint:P},S)),d&&a.createElement(s.S,{className:"displayIcon"},d),c&&a.createElement(s.a,{className:"actionIcon",onClick:()=>{var e;p&&(z(""),null===(e=t.current)||void 0===e||e.focus()),m&&m()}},c)),n&&n.length>0&&a.createElement(s.b,{className:"errorLabel"},n))});w.displayName="PureInput";let y=[320,420,640,750,828,1080,1200,1440,1920,2048],defaultLoader=({src:e,width:t,quality:r,locale:a})=>{try{let n="undefined"!=typeof window?window.location.origin:c.v[a]?`https://${c.v[a]}`:"";if(!n)return e;let i=new URL(e,n);return i.searchParams.set("w",String(t)),i.searchParams.set("q",String(null!=r?r:75)),i.toString()}catch(t){return e}},ImageWrapV2=e=>{var{alt:t,backupSrc:r,src:n,placeholderSrc:i,style:o,ref:s,unoptimized:c=!1,quality:p,sizes:m,width:u}=e,h=(0,l._)(e,["alt","backupSrc","src","placeholderSrc","style","ref","unoptimized","quality","sizes","width"]);let[g,b]=(0,a.useState)(!1),{locale:f="vi-VN"}=(0,d.u)(),w=(0,a.useMemo)(()=>c?[]:function(e){if(e.sizes)return y;if(e.width){let t=Math.max(1,Math.round(e.width));return Array.from(new Set([t,Math.min(2*t,2048)])).sort((e,t)=>e-t)}return y}({sizes:m,width:u}),[m,u,c]),x=(0,a.useMemo)(()=>{if(!c)return w.map(e=>`${defaultLoader({src:n,width:e,quality:p,locale:f})} ${e}w`).join(", ")},[c,w,n,p]),E=(0,a.useMemo)(()=>{if(c)return n;let e=w.length?w[w.length-1]:null!=u?u:1920;return defaultLoader({src:n,width:e,quality:p,locale:f})},[c,w,n,p,u]);return a.createElement(v,Object.assign({loading:"lazy",alt:t,srcSet:x,onError:()=>!g&&b(!0),src:g?r||E:E||r,style:Object.assign(Object.assign({},i?{backgroundImage:`url(${i})`}:{}),o),"data-has-placeholder":!!i,sizes:m,ref:s},h))},v=n.Z.img` &[data-has-placeholder='true'] { background-position: center; background-repeat: no-repeat; background-size: cover; } `,x=(0,n.Z)(p.I)` box-shadow: 0px 0px 1px 0px #0000000a, 0px 2px 8px 0px #0000000a, 0px 10px 16px 0px #0000000a; border-radius: 0.75rem; overflow: hidden; input.mantine-Input-input { border: none; font-size: 0.8125rem; line-height: 1.25rem; } .close-icon-wrapper { display: none; background-color: ${o.r.colors.gray400}; border-radius: 100%; cursor: pointer; width: 20px; height: 20px; padding: 2px; svg { pointer-events: none; } &[data-is-disabled='true'] { opacity: 0.2; cursor: not-allowed; pointer-events: none; } } input.mantine-Input-input:focus ~ .mantine-Input-rightSection .close-icon-wrapper, input.mantine-Input-input:not(:placeholder-shown) ~ .mantine-Input-rightSection .close-icon-wrapper { display: flex; } `,E=(0,n.Z)(Search2)` color: ${o.r.colors.primaryBase}; width: 20px; height: 20px; `,SearchInput=e=>{let{loading:t,disabled:r,placeholder:n,value:i,onChange:o,icon:s=a.createElement(E,null),className:c,style:d,enableClear:p}=e,u=(0,l._)(e,["loading","disabled","placeholder","value","onChange","icon","className","style","enableClear"]);return a.createElement(x,Object.assign({disabled:t||r,size:"lg",value:i,onChangeRaw:e=>{o(e.currentTarget.value)},type:"text",placeholder:n,className:c,icon:s,style:d,rightSection:p?a.createElement("div",{className:"close-icon-wrapper",onClick:()=>{o("")},"data-is-disabled":!i},a.createElement(m.C,{fill:"white",width:"100%",height:"100%"})):void 0},u,{"data-event-label":i}))}},gTxM:function(e,t,r){r.d(t,{T:function(){return w},a:function(){return h},b:function(){return getUserIdFromCookie},c:function(){return checkUntilFinished},d:function(){return getSubotCookieId},e:function(){return getUserInfoFromCookie},f:function(){return getWindowId},g:function(){return getHelloSitesUrl},h:function(){return checkMobile},i:function(){return clickAndOpenInNewTab},j:function(){return formatUrlWithEncrypedGa},k:function(){return isFakeEmail},l:function(){return getHhgIdFromCookie},o:function(){return overrideParamsByQuery},s:function(){return ssoIntents}});var a=r("+7X0"),n=r("7t6O"),i=r("JIJ2"),o=r("hHL7"),l=r("GOBr"),s=r("xrdX"),c=Object.prototype.toString,d=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,p=/^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/,m=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,u=/^[\u0020-\u003A\u003D-\u007E]*$/;function startIndex(e,t,r){do{var a=e.charCodeAt(t);if(32!==a&&9!==a)return t}while(++tr;){var a=e.charCodeAt(--t);if(32!==a&&9!==a)return t+1}return r}function decode(e){return -1!==e.indexOf("%")?decodeURIComponent(e):e}var h={parse:function(e,t){if("string"!=typeof e)throw TypeError("argument str must be a string");var r={},a=e.length;if(a<2)return r;var n=t&&t.decode||decode,i=0,o=0,l=0;do{if(-1===(o=e.indexOf("=",i)))break;if(-1===(l=e.indexOf(";",i)))l=a;else if(o>l){i=e.lastIndexOf(";",o-1)+1;continue}var s=startIndex(e,i,o),c=endIndex(e,o,s),d=e.slice(s,c);if(!r.hasOwnProperty(d)){var p=startIndex(e,o+1,l),m=endIndex(e,l,p);34===e.charCodeAt(p)&&34===e.charCodeAt(m-1)&&(p++,m--);var u=e.slice(p,m);r[d]=function(e,t){try{return t(e)}catch(t){return e}}(u,n)}i=l+1}while(i{let r=Object.keys(t);return r.map(r=>{let a=t[r];if("source"===r){e.is_new="first_login"===a;return}if(b.includes(r)){if(g.includes(r)){try{e[r]=JSON.parse(a)}catch(e){}return}if("account_id"===r||"current_score"===r||"bot_id"===r){e[r]=parseInt(a);return}e[r]=a}}),e},ssoIntents=e=>[{id:(0,o.Z)(),label:JSON.stringify({title:"",description:""}),type:n.N.SSO_INTENT,url:""},{id:(0,o.Z)(),label:JSON.stringify({title:e({id:"subot.myHealth.title",defaultMessage:"My Health"}),description:e({id:"subot.myHealth.description",defaultMessage:"Personal identifiers (like your name) will always be removed to protect your privacy. "})}),type:n.N.SSO_INTENT,url:"/images/subot/my-health.svg"},{id:(0,o.Z)(),label:JSON.stringify({title:e({id:"subot.saveData.title",defaultMessage:"Save Data"}),description:e({id:"subot.saveData.description",defaultMessage:"Hellobacsi would like to learn from your data to provide better healthcare for you"})}),type:n.N.SSO_INTENT,url:"/images/subot/file-storage.svg"},{id:(0,o.Z)(),label:JSON.stringify({title:e({id:"subot.productYourIdentifiers.title",defaultMessage:"Protect your identifiers"}),description:e({id:"subot.productYourIdentifiers.description",defaultMessage:"Personal identifiers (like your name) will always be removed to protect your privacy. "})}),type:n.N.SSO_INTENT,url:"/images/subot/shield.svg"}];function checkUntilFinished(e){let t=e.condition,r=e.finished,a=e.timeout||3e3,n=new Date().getTime(),i=setInterval(()=>{let e=new Date().getTime();(e-n>a||t())&&(clearInterval(i),r())},300)}let getHhgIdFromCookie=e=>{let t=h.parse(e||""),r=t["hhg-id"];return r||i.Z.get("hhg-id")||""},getSubotCookieId=e=>{if(e)return i.Z.set("hhg-id",e),e;let t=getHhgIdFromCookie();if(t)return t;let r=(0,o.Z)();return i.Z.set("hhg-id",r),r},getUserIdFromCookie=e=>{let t=h.parse(e||""),r=t[a.B],n=r||i.Z.get(a.B)||"";try{let e=n.split(".")[1],t=e.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r).sub}catch(e){return""}},getUserInfoFromCookie=e=>{let t=h.parse(e||""),r=t[a.B],n=r||i.Z.get(a.B)||"";try{let e=n.split(".")[1],t=e.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join("")),a=JSON.parse(r);return{email:a.email,id:a.sub}}catch(e){return{email:"",id:0}}},f=(0,o.Z)(),getWindowId=()=>f,getHelloSitesUrl=(e,t)=>{let r=!t&&"undefined"!=typeof window&&("localhost"===window.location.hostname||"127.0.0.1"===window.location.hostname);return r?"http://localhost":`https://${l.y?"":"discover."}${s.v[e]}`},checkMobile=e=>{let t=e||("undefined"==typeof navigator?"":navigator.userAgent);return!!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substring(0,4)))},clickAndOpenInNewTab=e=>{let t=document.createElement("a");t.href=e,t.target="_blank",t.click()},w=30,isFakeEmail=e=>(null==e?void 0:e.endsWith("@hhg.com"))||(null==e?void 0:e.endsWith("@facebook.com"));function formatUrlWithEncrypedGa(e="",t=""){if(!e.startsWith("https://")||!t)return"";let r=new URL(e),a=r.searchParams;return a.get("hhgclid")?(a.delete("hhgclid"),a.set("hhgclid",t),`${r.origin}${r.pathname}?${a.toString()}`):e}}}]);