"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3564],{zPS3:function(e,t,a){a.d(t,{q:function(){return AppIntroCards}});var n=a("BGKE"),i=a("OAL+"),l=a("Eso5"),r=a("vVd/"),o=(0,a("/npG").k)(()=>({item:{height:"100%"}})),s=a("SjA+"),d=a("hXNO");let AppIntroCards=e=>{let{data:t=[],isSingleLayout:a,...c}=e,{classes:u,theme:h}=o(void 0,{name:"AppIntroCards"}),g=(0,d.d)();return a||1===t.length?(0,n.tZ)(i.K,{spacing:24,...c,children:t.map((e,t)=>(0,n.tZ)(r.Z.WideLayout,{thumbnail:e.banner,...e,sx:()=>({position:"sticky",top:36+(t+1)*20,[h.fn.largerThan("sm")]:{top:110+(t+1)*20}})},t))}):(0,n.tZ)(l.x,{...c,children:(0,n.tZ)(s.Y,{showFullSlide:!g,disableCarousel:g,lengthToCarouselDesktop:4,lengthToCarouselMobile:2,lazyLoad:!0,carouselSetting:{loop:!1},children:(0,n.tZ)(s.Y.Slider,{styles:e=>({listing:{[e.fn.smallerThan("sm")]:{flexDirection:"column"}}}),children:t.map((e,a)=>(0,n.tZ)(r.Z.VerticalLayout,{className:u.item,ratio:2===t.length?1.65:void 0,...e,thumbnail:e.banner},a))})})})}},otlE:function(e,t,a){a.d(t,{j:function(){return AppIntroHeroBanner}});var n=a("BGKE"),i=a("q1tI"),l=a("owZr"),r=a("SPK5"),o=a("RZSM"),s=a("Eso5"),d=a("BThO"),c=a("Q7Fe"),u=a("ESJO"),h=a("zruX"),g=a("OWiU"),m=a("mU93"),p=a("hXNO"),f=a("AeFk"),b=a("/npG"),v=a("mYVa"),y=a("HC7W");let w=(0,f.F4)({"0%":{transform:"translateY(-4px)"},"50%":{transform:"translateY(4px)"},"100%":{transform:"translateY(-4px)"}});(0,f.F4)({"0%":{transform:"scale(1)",opacity:1},"50%":{transform:"scale(1.2)",opacity:0},"100%":{transform:"scale(1.2)",opacity:0}});let x=(0,f.F4)({"0%":{transform:"rotate(0)"},"100%":{transform:"rotate(360deg)"}});(0,f.F4)({"0%":{transform:"scale(1.2)",opacity:0},"50%":{transform:"scale(1)",opacity:1},"100%":{transform:"scale(1)",opacity:1}});var T=(0,b.k)(e=>({root:{display:"flex",flexDirection:"column",gap:40,[e.fn.largerThan("sm")]:{gap:80}},banner:{position:"relative",backgroundImage:"url(".concat(l.C.getAssetPath("appIntro/hero-bg-mobile.jpg"),")"),backgroundSize:"cover",padding:"32px 0 16px",[e.fn.largerThan("sm")]:{backgroundImage:"url(".concat(l.C.getAssetPath("appIntro/hero-bg.jpg"),")"),padding:"16px 0 36px"}},inner:{display:"flex",flexDirection:"column",gap:8},body:{[e.fn.largerThan("sm")]:{position:"relative","&:before":{content:'""',display:"block",paddingBottom:"calc(50% - 80px)",height:0}}},bodyInner:{display:"flex",alignItems:"center",justifyContent:"space-between",[e.fn.smallerThan("sm")]:{flexDirection:"column",gap:16},[e.fn.largerThan("sm")]:{gap:24,position:"absolute",top:0,left:0,right:0,bottom:0}},heading:{fontSize:72,fontWeight:500,lineHeight:(0,v.h)(86),[e.fn.smallerThan("sm")]:{fontSize:32,lineHeight:(0,v.h)(42),textAlign:"center"}},thumbnail:{maxHeight:640,[e.fn.smallerThan("sm")]:{maxHeight:340}},info:{display:"flex",flexDirection:"column",alignItems:"center",gap:16,[e.fn.largerThan("sm")]:{alignItems:"flex-start",width:"55%",gap:24}},logoNav:{[e.fn.smallerThan("sm")]:{display:"none"}},logo:{width:40},logoHead:{fontSize:14,fontWeight:600},nav:{[e.fn.smallerThan("sm")]:{display:"none"}},heroDesc:{fontSize:22,lineHeight:(0,v.h)(34),[e.fn.largerThan("sm")]:{fontSize:32,lineHeight:(0,v.h)(42)}},bannerImageFrame:{[e.fn.largerThan("sm")]:{width:"45%",flexGrow:1}},bannerImageFrameInner:{[e.fn.largerThan("sm")]:{position:"relative","&:before":{content:'""',height:0,paddingBottom:"100%",display:"block"}}},bannerImageFrameInnerInner:{[e.fn.largerThan("sm")]:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"flex-end",alignItems:"center",img:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}}},scrollToNext:{position:"absolute",bottom:32,left:0,right:0,zIndex:1,[e.fn.largerThan("sm")]:{bottom:24}},scrollToNextBtn:{cursor:"pointer",width:88,color:e.fn.primaryColor(),borderRadius:"100%",backgroundColor:"transparent",transition:"all 0.3s ease",[e.fn.smallerThan("sm")]:{backgroundColor:"rgba(255, 255, 255, 0.5)",backdropFilter:"blur(8px)"},[e.fn.largerThan("sm")]:{width:112}},scrollToNextFrame:{[e.fn.smallerThan("sm")]:{borderRadius:"100%",border:"1px solid #fff",top:"20px !important",left:"20px !important",right:"20px !important",bottom:"20px !important",width:"auto !important",height:"auto !important"}},scrollToNextThumb:{[e.fn.largerThan("sm")]:{width:100},"&:hover":{[".".concat((0,y.A)("scrollToNextLogo"))]:{animationPlayState:"paused"},[".".concat((0,y.A)("scrollToNextIcon"))]:{animation:"".concat(w," 0.8s infinite")}}},scrollToNextLogo:{ref:(0,y.A)("scrollToNextLogo"),animation:"".concat(x," 8s linear infinite"),[e.fn.smallerThan("sm")]:{top:"4px !important",left:"4px !important",width:"calc(100% - 8px)!important",height:"calc(100% - 8px)!important"}},scrollToNextIcon:{ref:(0,y.A)("scrollToNextIcon")}}));let AppIntroHeroBanner=e=>{let{title:t,banner:a,headerDescription:f,innerClass:b="",descInnerClass:v="",onNavClick:y,logo:w,styles:x,className:C,classNames:B,...I}=e,{classes:Z,cx:S}=T(void 0,{name:"AppIntroHeroBanner",styles:x,classNames:B}),{navigating:k}=(0,i.useContext)(m.F),A=(0,p.d)();return(0,n.BX)("div",{className:S(C,Z.root),...I,children:[(0,n.BX)("div",{className:Z.banner,children:[(0,n.BX)("div",{className:S(b,Z.inner),children:[!A&&(0,n.tZ)(h.i,{navigating:k,onNavClick:y,selectedSection:"tong-quan",logo:w,className:Z.nav}),(0,n.tZ)("div",{className:Z.body,children:(0,n.BX)("div",{className:Z.bodyInner,children:[(0,n.BX)("div",{className:Z.info,children:[t&&(0,n.tZ)("h1",{className:Z.heading,children:t}),(0,n.tZ)(u.O,{url:null==w?void 0:w.url})]}),a&&(0,n.tZ)("div",{className:Z.bannerImageFrame,children:(0,n.tZ)("div",{className:Z.bannerImageFrameInner,children:(0,n.tZ)("div",{className:Z.bannerImageFrameInnerInner,children:(0,n.tZ)("img",{loading:"lazy",src:a,className:Z.thumbnail,alt:t})})})})]})})]}),(0,n.tZ)(r.k,{justify:"center",className:Z.scrollToNext,children:(0,n.tZ)("button",{onClick:()=>(0,g.rE)({hash:"hero-description",isMobile:A}),className:Z.scrollToNextBtn,children:(0,n.BX)(o.o,{ratio:1,className:Z.scrollToNextThumb,children:[(0,n.tZ)("img",{src:l.C.getAssetPath("appIntro/circle-logo.svg"),alt:"Health app qrcode",loading:"lazy",className:Z.scrollToNextLogo}),(0,n.tZ)(r.k,{align:"center",justify:"center",className:Z.scrollToNextFrame,children:(0,n.tZ)(d.Z,{color:"currentColor",className:Z.scrollToNextIcon,size:A?28:32})})]})})})]}),f&&(0,n.tZ)(s.x,{className:Z.heroDesc,"data-hashtag":"hero-description","data-gap":40,children:(0,n.tZ)(c.G,{className:S(v,Z.inner),content:f})})]})}},WVri:function(e,t,a){a.d(t,{I:function(){return r},P:function(){return l}});var n=a("rBCA"),i=a("HMwR");let l=10,r=(0,n.Z)("div",{target:"e4vjzg90"})("position:sticky;bottom:unset;left:unset;z-index:",l,";--fallback:9rem;--distance-from-header:20px;top:calc(\n var(--header-height,var(--fallback)) + var(--distance-from-header)\n );width:40px;margin-left:-104px;background:transparent;display:flex;flex-direction:column;align-items:center;.icon-disabled{opacity:0.2;}.share-popup-line:first-child{display:none;}",i.M.mbDown,"{display:none;}")},WHHL:function(e,t,a){a.r(t);var n=a("BGKE"),i=a("q1tI"),l=a("iBNF"),r=a("mGnJ"),o=a("/kWL"),s=a("90i8"),d=a("v8Gc"),c=a("Eso5"),u=a("Vvt1"),h=a.n(u),g=a("a5vB"),m=a("CJtR"),p=a("vKIh"),f=a("Xf0B"),b=a("p9sL"),v=a("raAP"),y=a("P5LW"),w=a("rIrU"),x=a("CF0j"),T=a("tjQ2"),C=a("WVri"),B=a("sKr0");let I=h()(()=>Promise.all([a.e(5231),a.e(7797),a.e(5454),a.e(5481),a.e(2354),a.e(9803),a.e(5349),a.e(4148),a.e(2509),a.e(1533),a.e(1108),a.e(9124),a.e(4190),a.e(5464),a.e(8261),a.e(8841),a.e(9353),a.e(7730),a.e(3929),a.e(7884),a.e(137),a.e(4414),a.e(4001),a.e(7613),a.e(8098),a.e(3416),a.e(2500),a.e(1570),a.e(3506),a.e(1413),a.e(2138),a.e(9467),a.e(4467),a.e(6966),a.e(5243),a.e(8132),a.e(1375),a.e(4561),a.e(1448),a.e(5465),a.e(1217),a.e(5480),a.e(731),a.e(2050),a.e(2008),a.e(8469),a.e(8214),a.e(1482),a.e(6817),a.e(467),a.e(5951),a.e(9357),a.e(747),a.e(5675),a.e(6753),a.e(4802),a.e(3046),a.e(5745),a.e(3437),a.e(252),a.e(6839),a.e(9424),a.e(5702),a.e(8922),a.e(6399),a.e(553),a.e(2902),a.e(4969),a.e(3257),a.e(6611),a.e(7538),a.e(6894),a.e(5341),a.e(4846),a.e(2233),a.e(1058),a.e(5638),a.e(3295),a.e(1538),a.e(6629),a.e(7152),a.e(5684),a.e(2574),a.e(2513),a.e(5238),a.e(7644),a.e(6962),a.e(4050),a.e(6638),a.e(7741),a.e(1137),a.e(2433),a.e(9689),a.e(5385),a.e(3564),a.e(3158),a.e(8320),a.e(5641),a.e(7454),a.e(7004),a.e(4758),a.e(6219),a.e(17),a.e(8990),a.e(4067),a.e(9487),a.e(9083),a.e(1520),a.e(270),a.e(7596),a.e(8217),a.e(7543),a.e(2835),a.e(2507),a.e(6885),a.e(7859),a.e(5970),a.e(2730),a.e(6287),a.e(7682),a.e(1551),a.e(4870),a.e(9922),a.e(3133),a.e(612),a.e(2002),a.e(1880),a.e(7471),a.e(7165),a.e(8854),a.e(5451),a.e(8612)]).then(a.bind(a,"/Vif")).then(e=>e.ArticleAudioPlayer),{loadableGenerated:{webpack:()=>["/Vif"]}});t.default=e=>{let{articleUrl:t,onAskDoctorClick:a,turnOffComment:u=!1}=e,{locale:h}=(0,y.h)(),Z=(0,v.U)();(0,f.Z)();let{totalComment:S,currentArticle:k}=(0,T.WM)(e=>({currentArticle:e.currentArticle,totalComment:e.totalComment,cycleFontSize:e.cycleFontSize}),g.X),A=(0,b.P)(e=>e.isNavSponsor,g.X),E=(0,i.useMemo)(()=>(0,m.UC)(h),[h]),N=(0,i.useMemo)(()=>r.c.includes(h),[h]);return(0,i.useEffect)(()=>{let e=document.querySelector("footer");if(e)return e.classList.add("js-with-article-act-btn-group"),()=>{e.classList.remove("js-with-article-act-btn-group")}},[]),(0,n.BX)(C.I,{className:"action-bar","data-is-nav-sponsor":A,children:[x.NB.includes(h)&&(0,n.tZ)(c.x,{sx:{paddingBottom:8},children:(0,n.tZ)(p.Z,{size:"md",children:(0,n.tZ)(p.Z.IconChart,{dataTracking:{dataEventCategory:"AQI",dataEventAction:"AQI icon click",dataEventLabel:"AQI open pop-up"}})})}),N&&!u&&(0,n.BX)(c.x,{className:"w-10 h-10 p-2 relative cursor-pointer rounded-lg hover:bg-gray100","data-event-category":"Comments","data-event-action":"Icon Click","data-event-label":Z,onClick:a,children:[(0,n.tZ)(s.Z,{}),Number(S)>0&&(0,n.tZ)(o.T,{size:"p4",className:"absolute top-2 left-8",color:l.r.colors.gray600,children:S})]}),(0,n.tZ)(I,{articleId:null==k?void 0:k.id,articleContent:null==k?void 0:k.postContent,articleEnableAudio:null==k?void 0:k.enableAudio,articleTurnOffArticleVoice:null==k?void 0:k.turnOffArticleVoice,isPremium:null==k?void 0:k.isPremium,isSidebar:!0}),w.y.includes(h)&&(0,n.BX)(c.x,{component:"a",href:E+w.Rn,"data-event-category":"Chatbot AI","data-event-action":"Open","data-event-label":"Article action",className:"w-10 h-10 py-2 relative cursor-pointer flex justify-center items-end rounded-lg hover:bg-gray100 pointer-event-child-none",children:[(0,n.tZ)(d.Z,{size:24,color:"#2F8AF2"}),(0,n.tZ)(o.T,{size:"p5",className:"!text-[10px]",weight:"halfBold",as:"span",color:"#49A8EA",translate:"no",children:"AI"})]}),(0,n.tZ)(c.x,{className:"h-[1px] w-6 bg-gray200 my-4 mx-auto share-popup-line"}),(0,n.tZ)(B.n.AsideNav,{shareUrl:t,isRevamp:!0,iconSize:24})]})}},VQ39:function(e,t,a){a.d(t,{P:function(){return m}});var n=a("BGKE"),i=a("q1tI"),l=a("/kWL"),r=a("OAL+"),o=a("vaps"),s=a("YFqc"),d=a.n(s),c=a("CJtR"),u=a("P5LW"),h=a("rIrU"),g=(0,a("/npG").k)((e,t)=>{let{colNum:a}=t;return{root:{gap:16,[e.fn.largerThan("sm")]:{gap:32}},header:{backgroundColor:e.colors.neutral[1],padding:12},table:{border:"1px solid ".concat(e.colors.neutral[1]),width:a>3?140*a:"100%",[e.fn.largerThan("sm")]:{width:"100%"},td:{padding:12,verticalAlign:"top",[e.fn.smallerThan("sm")]:{...a>3&&{width:140}}},tr:{"&:nth-child(even)":{backgroundColor:e.colors.neutral[0]}}},tableWrapper:{[e.fn.smallerThan("sm")]:{paddingBottom:8}},itemTxt:{color:e.fn.primaryColor()},menu:{position:"fixed",top:0,left:0,right:0,bottom:0}}});let m=i.memo(e=>{let{data:t=[],colNum:a=4,articleId:s,className:m,styles:p,classNames:f,...b}=e,{locale:v,router:y}=(0,u.h)(),{query:{slug:w=[]}}=y,x=("string"==typeof w?[w]:w).join("/"),T="".concat((0,c.UC)(v)).concat(h.sb,"/").concat(x,"/"),{classes:C,cx:B}=g({colNum:a},{name:"ArticleDictionaryTable",styles:p,classNames:f}),I=(0,i.useCallback)(e=>Array(Math.ceil(e.length/a)).fill("").map((t,i)=>(0,n.tZ)("tr",{children:Array(a).fill("").map((t,r)=>(0,n.tZ)("td",{children:(()=>{var t,o;let c=r+a*i,u="#".concat((null==e?void 0:null===(t=e[c])||void 0===t?void 0:t.h3Id)||"","-").concat(s),h=(null==e?void 0:null===(o=e[c])||void 0===o?void 0:o.h3Title)||"";return(0,n.tZ)(d(),{prefetch:!1,href:u,"data-event-category":"View dictionary","data-event-action":h,"data-event-label":"".concat(T).concat(u),children:(0,n.tZ)(l.T,{size:"p4",className:C.itemTxt,children:h})})})()},String(r)))},String(i))),[t]);return t.length>0?(0,n.tZ)(r.K,{className:B(C.root,m),...b,children:t.map((e,t)=>e.h3SubH2.length>0?(0,n.BX)("div",{children:[(0,n.tZ)("div",{className:C.header,children:(0,n.tZ)(d(),{prefetch:!1,href:"#".concat(e.h2Id||"","-").concat(s),"data-event-category":"View dictionary","data-event-action":e.h2Title,"data-event-label":"".concat(T,"#").concat(e.h2Id||""),children:(0,n.tZ)(l.T,{size:"s4",children:e.h2Title})})}),(0,n.tZ)(o.x,{type:"auto",scrollbarSize:6,children:(0,n.tZ)("div",{className:C.tableWrapper,children:(0,n.tZ)("table",{className:C.table,children:(0,n.tZ)("tbody",{children:I(e.h3SubH2)})})})})]},t):null)}):null})},RGkz:function(e,t,a){a.d(t,{B8:function(){return o},Bw:function(){return r},N0:function(){return d},__:function(){return s}});var n=a("rBCA"),i=a("HMwR"),l=a("iBNF");let r=(0,n.Z)("div",{target:"e1aq6oee0"})(i.M.mbDown,"{padding-top:20px;}"),o=(0,n.Z)("form",{target:"e1aq6oee1"})("display:flex;flex-direction:column;gap:16px;"),s=(0,n.Z)("div",{target:"e1aq6oee2"})("display:flex;flex-direction:column;gap:6px;.error-input input{border:1px solid ",l.r.colors.red700,";}"),d=(0,n.Z)("div",{target:"e1aq6oee3"})("display:flex;width:100%;align-items:center;justify-content:space-between;gap:16px;> div{width:100%;}")},oTsI:function(e,t,a){a.d(t,{Z:function(){return babyGrowthForm}});var n=a("BGKE"),i=a("q1tI"),l=a("AFO6"),r=a("iBNF"),o=a("UFTh"),s=a("pkib"),d=a("FNss"),c=a("/kWL"),u=a("ndOt"),h=a("g8xC"),g=a("4tGp"),m=a("SPK5"),p=a("mYVa"),f=a("cChf"),b=a("Tabs"),v=a("Iblh"),y=a("Wgwc"),w=a.n(y),x=a("p46w"),T=a.n(x),C=a("E+oP"),B=a.n(C),I=a("Ut4T"),Z=a("cr+I"),S=a("dDsW"),k=a("oQBk"),A=a("xIXX"),E=a("CJtR"),N=a("g/tz"),M=a("W+DG"),L=a("w99c"),_=a("YFSc"),D=a("0VOb"),P=a("raAP"),V=a("hXNO"),R=a("P5LW"),z=a("rIrU"),O=a("r2Jg"),G=a("8vdq"),F=a("Uygi"),W=a("rEaw"),H=a("o0qI"),q=a("XP6q"),Y=a("JiVP"),X=a("REO7"),U=a("Uu9E"),K=a("9O6x"),j=a("Vitr"),Q=a("+DyL"),J=a("LOL7"),$=a("DA0W"),ee=a("q0An"),et=a("em2k");ee.kM(ee.Ry,"atLeastOneOf",function(e,t){return this.test({name:"atLeastOneOf",message:t({id:z.ENV.DEPLOY_LOCALE===W.MV.Vietnam?F.c.BABY_GROWTH.AT_LEAST_ONE_OF_VN:F.c.BABY_GROWTH.AT_LEAST_ONE_OF,defaultMessage:"Must have at least one of these fields: ${keys}"}),exclusive:!0,params:{keys:e.join(", ")},test:t=>null==t||e.some(e=>null!=t[e]&&"undefined"!=t[e])})}),ee.kM(ee.Z_,"valIncludesStr",function(e,t){return this.test({name:"valIncludesStr",message:t({id:"additionalQuestion.inputErr.otherAnswerRequire",defaultMessage:"Please fill your other answer"}),exclusive:!1,test:t=>!t.includes(e)})}),ee.kM(ee.nK,"requireBabyNameIfCheckForYourKid",function(e){return this.test({name:"requireBabyNameIfCheckForYourKid",message:e({id:"tools.inputErr.requireKidNames",defaultMessage:"Please fill your kid's answer"}),exclusive:!1,test:(e,t)=>!t.parent.isMyself||!!e})});let generateSchema=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a={};return t.map(t=>{a[t]=ee.Z_().valIncludesStr(M.C,e)}),ee.Ry().shape({gender:ee.Z_().required(e({id:"tools.inputErr.requireBabyGender",defaultMessage:"Please fill your baby gender"})),birthday:ee.hT().required(e({id:F.c.BABY_GROWTH.BIRTHDAY_REQUIRED,defaultMessage:"Birthday is required"})).test({name:"ageIsLowerThanNineteen",test:(t,a)=>{let n=(0,et.F)(t||new Date,a.parent.measurementDate);return!(n.year>z.FO)||a.createError({message:e({id:F.c.BABY_GROWTH.INVALID_AGE,defaultMessage:""},{name:a.parent.name})})}}),height:ee.Z_(),weight:ee.Z_(),head:ee.Z_(),measurementDate:ee.hT().required().default(new Date).max(w()().add(1,"day"),e({id:F.c.BABY_GROWTH.INVALID_MEASUREMENT_DATE,defaultMessage:"Measurement day is not valid."})).test("measurementDateTest","",(t,a)=>!w()(t).isBefore(a.parent.birthday)||a.createError({message:e({id:F.c.BABY_GROWTH.MEASUREMENT_DATE_LOWER_THAN_BIRTHDAY,defaultMessage:"The measurement date must be less than {name} ’s birthday."},{name:a.parent.name||e({id:"babyGrowth.emptyName",defaultMessage:"your baby"})})})),...a}).atLeastOneOf(["height","weight","head"],e)},generateGender=e=>"male"===e?W.Y0.Boy:W.Y0.Girl,ea=(0,i.forwardRef)(function(e,t){let{gender:a,label:i,...l}=e;return(0,n.tZ)("div",{ref:t,...l,children:(0,n.BX)($.Z,{noWrap:!0,children:[generateGender(a)===W.Y0.Boy?(0,n.tZ)(Q.Z,{size:24}):(0,n.tZ)(J.Z,{size:24}),(0,n.tZ)(j.T,{size:"p2",color:r.r.colors.gray800,children:i})]})})});var en=a("RGkz"),babyGrowthForm=e=>{let{}=e,t=(0,P.U)(),{query:a,asPath:y}=(0,I.useRouter)(),x=a.source,C=x&&x.includes("baby-growth"),{state:{babyLists:j,babyGrowthContent:Q},dispatch:J}=(0,i.useContext)(Y.p),{state:{isLoggedIn:$,userInfo:ee}}=(0,i.useContext)(H.I),et=(0,V.d)(),{formatMessage:ei}=(0,S.Z)(),{locale:el,router:{push:er}}=(0,R.h)(),{getHealthToolLink:eo}=(0,l.u)(el),[es,{open:ed,close:ec}]=(0,v.q)(!1),[eu,eh]=(0,i.useState)(!1),[eg,em]=(0,i.useState)(""),[ep,ef]=(0,i.useState)(null),eb=(null==Q?void 0:Q.listQuestions)||[];(0,i.useEffect)(()=>{$&&ed()},[$]);let ev=(0,i.useMemo)(()=>generateSchema(ei,eb.map(e=>G.S0+e.question.id)),[eb]),ey=(0,f.c)({initialValues:{isMyself:!1,measurementDate:new Date,isSubmitted:!1},validate:(0,b.X)(ev)}),ew=ey.values.weight,ex=ey.values.height,eT=ey.values.head,eC=(0,i.useMemo)(()=>ey.values.isSubmitted&&(!ew&&!ex&&!eT||0===ew&&0===ex&&0===eT),[ey.values.isSubmitted,ew,ex,eT]);(0,i.useEffect)(()=>{eC&&(0,D.c)({type:"danger",message:ei({id:z.ENV.DEPLOY_LOCALE===W.MV.Vietnam?F.c.BABY_GROWTH.AT_LEAST_ONE_OF_VN:F.c.BABY_GROWTH.AT_LEAST_ONE_OF,defaultMessage:"Must have at least one of these fields: Weight, Height, Head Circumference (Head)."}),title:ei({id:"babyGrowth.error.title",defaultMessage:"Invalid data"})})},[eC]),(0,i.useEffect)(()=>{let e=(0,U.T)(ex,ew);ey.setFieldValue("bmi",e)},[ew,ex]);let eB=(0,i.useMemo)(()=>(j||[]).map(e=>({label:e.name,value:e.name,...e})),[j]);(0,i.useEffect)(()=>{(async()=>{try{if($){let e=await (0,A.cA)((0,E.W4)(k.y.BABY_VACCINE.GET_HEALTH_TOOL_BABY_VACCINE_LIST),"GET",{});(null==e?void 0:e.data)&&J({type:q.e.UPDATE_BABY_LIST,payload:((null==e?void 0:e.data.items)||[]).map(e=>{let t=(0,g.u)(e);return{...t.profile,additionalQuestions:t.additionalQuestions}})})}}catch(e){}})(),ey.setFieldValue("isMyself",$)},[$]);let onSubmit=async e=>{if(ey.setFieldValue("isSubmitted",!0),0===e.weight&&0===e.height&&0===e.head)return;if($&&ey.validateField("parentBirthday"),T().set(O.Tx,JSON.stringify({...e,...$&&{parentBirthday:ey.getInputProps("parentBirthday").value||(null==ee?void 0:ee.birthday)}})),!$){(0,N.p0)(Z.stringifyUrl({url:"".concat(window.location.origin).concat(z.sb).concat(eo(G.QO.BABY_GROWTH)),query:{joincommunity:1}}),"baby-growth");return}let t={...e,name:(null==ep?void 0:ep.name)||e.name||""},a=[...(null==ep?void 0:ep.additionalQuestions)||[]];eb.map(t=>{let n=a.findIndex(e=>e.question.id===t.question.id),i=(e[G.S0+t.question.id]||"").split(",").filter(Boolean),l={};t.answers.map(e=>{l[e.id]=e});let r=[],o=[];i.map(e=>{l[e]?r.push({id:l[e].id,value:l[e].answer}):o.push(e)}).filter(Boolean);let s=[...r,...o.length>0?[{id:0,value:null==o?void 0:o[0]}]:[]].filter(Boolean),d={question:{id:Number(t.question.id),value:t.question.question},answers:s};-1!==n?d.answers.length>0?a[n]=d:a.splice(n,1):d.answers.length>0&&a.push(d)});let[n]=await Promise.all([(0,A.cA)((0,E.W4)(k.y.BABY_VACCINE.GET_HEALTH_TOOL_BABY_VACCINE_LIST),"POST",{data:{type:Number(!e.isMyself),is_myself:e.isMyself,name:e.name||"a",gender:e.gender===W.Y0.Boy,dob:w()(e.birthday).format(z.yJ),...a.length>0&&{additional_questions:a}}}),(null==ee?void 0:ee.id)&&(null==e?void 0:e.parentBirthday)&&await (0,K.eZ)({userInfo:ee,data:{birthday:e.parentBirthday}})]),{data:{profile:i}}=n;J({type:X.K.CURRENT_BABY,payload:ep||i}),await J({type:q.e.SUBMIT,payload:t}),er("".concat(y.split("?")[0],"/result?joincommunity=1"))},onError=e=>{ey.setFieldValue("isSubmitted",!0),Object.values(e).forEach(e=>(0,D.c)({type:"danger",message:e||"",title:ei({id:"babyGrowth.error.title",defaultMessage:"Invalid data"})}))};return(0,i.useEffect)(()=>{if($){if(C){let e=JSON.parse(T().get(O.Tx)||"{}");if(B()(e))return;ey.setValues({gender:e.gender,height:e.height,weight:e.weight,head:e.head,bmi:e.bmi,birthday:w()(e.birthday).toDate(),measurementDate:w()(e.measurementDate).toDate()})}if(ep){let{dob:e,gender:t,name:a}=ep;ey.setValues({name:a,birthday:w()(e).toDate(),gender:generateGender(t),isMyself:!0}),C&&ey.onSubmit(onSubmit,onError)()}}},[$,ep,C]),(0,i.useEffect)(()=>{eB.find(e=>e.name===ey.values.name)?eh(!0):(ef(null),eh(!1))},[ey.values.name]),(0,i.useEffect)(()=>{if(ep){if($){let{dob:e,gender:t,name:a,additionalQuestions:n}=ep,i={};eb.map(e=>{i[G.S0+e.question.id]=""}),n.map(e=>{i[G.S0+e.question.id]=(e.answers||[]).map(e=>0===e.id?e.value:e.id).join(",")});let l={name:a,birthday:w()(e).toDate(),gender:generateGender(t),...i};ey.setValues(l),eh(!0)}else eh(!1)}},[ep,$]),(0,n.BX)(n.HY,{children:[C&&$&&(0,n.tZ)(s.dW,{currentProfileId:"new",babyProfiles:j,onAddMeasurement:e=>{if("new"===e){ey.onSubmit(onSubmit,onError)();return}ef(()=>{var t;return(null===(t=j||[])||void 0===t?void 0:t.find(t=>Number(null==t?void 0:t.id)===e))||null})},open:es,onClose:ec,isMobile:et,newBabyValue:ey.getInputProps("name").value||"",onNewBabyValueChange:ey.getInputProps("name").onChange,onSwitchProfile:ef}),(0,n.tZ)(en.Bw,{children:(0,n.BX)(en.B8,{onSubmit:ey.onSubmit(onSubmit,onError),children:[$&&(0,n.BX)(m.k,{gap:(0,p.h)(24),sx:e=>({[e.fn.smallerThan("sm")]:{flexDirection:"column"},[e.fn.largerThan("sm")]:{"& > div":{width:"100%",flexGrow:1}}}),children:[(0,n.tZ)(en.__,{children:(0,n.tZ)(L.u,{...ey.getInputProps("parentBirthday")})}),(0,n.tZ)(en.__,{children:(0,n.tZ)(_.X,{...ey.getInputProps("isMyself"),checked:ey.getInputProps("isMyself").value,withAsterisk:!0,label:ei({id:"tools.checkYourKidsInput.label",defaultMessage:"Are you checking for your kid?"}),sx:e=>({[e.fn.smallerThan("sm")]:{display:"flex",justifyContent:"space-between"}})})})]}),!C&&$&&(0,n.tZ)(en.__,{children:(0,n.tZ)(d.S,{keepSearch:!0,label:(0,n.BX)(c.T,{size:"s4",as:"label",children:[ei({id:"babyGrowth.input.babyName",defaultMessage:"Input baby name or select"})," ",(0,n.tZ)(c.T,{as:"span",size:"n1",color:r.r.colors.gray400,children:ei({id:"babyGrowth.optional",defaultMessage:"(optional)"})})]}),id:"baby-name",placeholder:ei({id:"babyGrowth.placeholder.babyName",defaultMessage:"Input baby’s name"}),data:eB,itemComponent:ea,searchable:!0,onSearchChange:em,searchValue:eg,filter:(e,t)=>(t.label||"").toLowerCase().includes(e.toLowerCase().trim()),onItemSubmit:e=>{"string"!=typeof e&&ef(e)},...ey.getInputProps("name"),error:!!ey.getInputProps("name").error})}),(0,n.tZ)(o.G,{isBaby:!0,withAsterisk:!0,availableValue:eu&&ey.getInputProps("gender").value,genderValue:{male:W.Y0.Boy,female:W.Y0.Girl},labelTextProps:{size:"s4"},...ey.getInputProps("gender")}),(0,n.tZ)(en.__,{children:(0,n.tZ)(u.D,{withAsterisk:!0,label:(0,n.tZ)(c.T,{as:"label",size:"s4",children:ei({id:"babyGrowth.input.birthday",defaultMessage:"Baby birthday"})}),...ey.getInputProps("birthday"),onChange:eu?()=>null:ey.getInputProps("birthday").onChange,excludeDate:e=>w()(e).isAfter(w()()),disabled:eu,error:!!ey.getInputProps("birthday").error})}),(0,n.BX)(en.N0,{children:[(0,n.tZ)(en.__,{children:(0,n.tZ)(d.I.Number,{...ey.getInputProps("height"),label:(0,n.BX)(c.T,{size:"s4",as:"label",children:[ei({id:"babyGrowth.height",defaultMessage:"Height"})," ",(0,n.tZ)(c.T,{as:"span",size:"n1",color:r.r.colors.gray400,children:ei({id:"babyGrowth.cm",defaultMessage:"(cm)"})})]}),precision:1,inputMode:"decimal",min:0,error:eC})}),(0,n.tZ)(en.__,{children:(0,n.tZ)(d.I.Number,{...ey.getInputProps("weight"),label:(0,n.BX)(c.T,{size:"s4",as:"label",children:[ei({id:"babyGrowth.weight",defaultMessage:"Weight"})," ",(0,n.tZ)(c.T,{as:"span",size:"n1",color:r.r.colors.gray400,children:ei({id:"babyGrowth.kg",defaultMessage:"kg"})})]}),precision:1,inputMode:"decimal",min:0,error:eC})})]}),(0,n.BX)(en.N0,{children:[el!==W.MV.Vietnam&&(0,n.tZ)(d.I.Number,{...ey.getInputProps("head"),label:(0,n.BX)(c.T,{size:"s4",as:"label",children:[ei({id:"babyGrowth.headCircumference",defaultMessage:"Head Circumference"})," ",(0,n.tZ)(c.T,{as:"span",size:"n1",color:r.r.colors.gray400,children:ei({id:"babyGrowth.cm",defaultMessage:"cm"})})]}),precision:1,inputMode:"decimal",min:0,error:eC}),(0,n.tZ)(d.I.Number,{...ey.getInputProps("bmi"),label:(0,n.BX)(c.T,{size:"s4",as:"label",children:[ei({id:"babyGrowth.input.bmi",defaultMessage:"Body Mass"})," ",(0,n.tZ)(c.T,{as:"span",size:"n1",color:r.r.colors.gray400,children:ei({id:"babyGrowth.kg.m2",defaultMessage:"(kg/m2)"})})]}),precision:1,inputMode:"decimal",min:0,disabled:!0})]}),(0,n.tZ)(en.__,{children:(0,n.tZ)(u.D,{withAsterisk:!0,label:(0,n.tZ)(c.T,{as:"label",size:"s4",children:ei({id:"babyGrowth.input.measurementDate",defaultMessage:"Measurement date"})}),...ey.getInputProps("measurementDate"),excludeDate:e=>w()(e).isAfter(w()()),error:!!ey.getInputProps("measurementDate").error})}),eb.map((e,t)=>(0,n.tZ)(M.o,{question:e,multiple:e.isMulti,inputProps:ey.getInputProps(G.S0+e.question.id),onChange:t=>{ey.setFieldValue(G.S0+e.question.id,t.join(","))}},String(t))),(0,n.tZ)(h.B,{type:"submit",size:"lg",variant:"primary","data-event-category":"Health Tool","data-event-action":"Baby Growth","data-event-label":t,children:ei({id:"babyGrowth.input.submit",defaultMessage:"Track your baby's growth"})})]})})]})}},gLZu:function(e,t,a){a.d(t,{Z:function(){return leftColumn}});var n=a("BGKE"),i=a("q1tI"),l=a("rPIz"),r=a("iBNF"),o=a("pkib"),s=a("Wgwc"),d=a.n(s),c=a("dDsW"),u=a("oQBk"),h=a("xIXX"),g=a("CJtR"),m=a("PXQd"),p=a("eoTl"),f=a("ityh"),b=a("W7eR"),v=a("P5LW"),y=a("rIrU"),w=a("o0qI"),x=a("XP6q"),T=a("JiVP"),C=a("rBCA"),B=a("HMwR");let I=(0,C.Z)("div",{target:"e1tpolg70"})(".bbg_header{padding:25px 0;padding-top:0;display:flex;flex-direction:column;gap:15px;",B.M.mbDown,"{padding:10px 0;}}");var Z=a("rEaw"),leftColumn=()=>{let{state:e,dispatch:t}=(0,i.useContext)(T.p),{state:{isLoggedIn:a}}=(0,i.useContext)(w.I),{formatMessage:s}=(0,c.Z)(),{locale:C}=(0,v.h)(),{gender:B,name:S,age:k}=e,[A,E]=(0,i.useState)(f.BabyGrowthResultTab.Height),N=(0,i.useMemo)(()=>[{name:s({id:"babyGrowth.height",defaultMessage:"Height"})},{name:s({id:"babyGrowth.weight",defaultMessage:"Weight"})},...C!==Z.MV.Vietnam?[{name:s({id:"babyGrowth.head",defaultMessage:"Head"})}]:[],{name:"BMI"}],[]);(0,i.useEffect)(()=>{(async()=>{if(e){let a=await (0,p.w)(e,A,C,s);t({type:x.e.UPDATE_RESULT_BASED_ON_RISK_LEVEL,payload:a})}})()},[A]);let addMeasurement=async t=>{try{let a={height:e.height||0,weight:e.weight||0,head_circumference:e.head||0,bmi:Number(e.bmi),measurement_date:d()(e.measurementDate).format(y.yJ),percentile_height:[e.riskLevel,e.riskLevel,e.riskLevel],percentile_weight:[e.riskLevel,e.riskLevel,e.riskLevel],percentile_head_circumference:[e.riskLevel,e.riskLevel,e.riskLevel],percentile_bmi:[e.riskLevel,e.riskLevel,e.riskLevel],device_type:"web"};await (0,h.cA)((0,g.W4)(u.y.BABY_VACCINE.ADD_MEASUREMENT,{babyId:t||""}),"POST",{data:a})}catch(e){console.log(e)}};return(0,i.useEffect)(()=>{(async()=>{try{var t;(null===(t=e.currentBaby)||void 0===t?void 0:t.id)&&await addMeasurement(e.currentBaby.id)}catch(e){console.group("Save to SIDIS error"),console.trace(e),console.groupEnd()}})()},[]),(0,n.BX)(I,{children:[(0,n.BX)("div",{className:"bbg_header",children:[(0,n.tZ)(l.H,{tag:"h4",as:"h1",fontWeight:"bold",color:r.r.colors.gray800,children:s({id:"babyGrowth.pageTitle",defaultMessage:"Your child growth results"})}),(0,n.tZ)(o.fL,{name:S,gender:B,age:k,showMenu:!1,isLoggedIn:a,onAdd:()=>null,onEdit:()=>null,onRemove:()=>null,onSwitch:()=>null})]}),(0,n.tZ)(m.m,{className:"navigator-tab",initialTab:A,tabContent:N,onChange:E}),(0,n.tZ)(b.N,{tabIndex:A})]})}},a1b5:function(e,t,a){a.d(t,{Z:function(){return babyVaccinationForm}});var n=a("BGKE"),i=a("q1tI"),l=a("AFO6"),r=a("UFTh"),o=a("pkib"),s=a("FNss"),d=a("/kWL"),c=a("ndOt"),u=a("g8xC"),h=a("4tGp"),g=a("SPK5"),m=a("mYVa"),p=a("cChf"),f=a("Tabs"),b=a("Iblh"),v=a("Wgwc"),y=a.n(v),w=a("p46w"),x=a.n(w),T=a("E+oP"),C=a.n(T),B=a("dDsW"),I=a("oQBk"),Z=a("xIXX"),S=a("CJtR"),k=a("g/tz"),A=a("W+DG"),E=a("w99c"),N=a("YFSc"),M=a("0VOb"),L=a("raAP"),_=a("hXNO"),D=a("P5LW"),P=a("rIrU"),V=a("r2Jg"),R=a("8vdq"),z=a("rEaw"),O=a("o0qI"),G=a("REO7"),F=a("jQXw"),W=a("9O6x"),H=a("Vitr"),q=a("iBNF"),Y=a("+DyL"),X=a("LOL7"),U=a("DA0W"),K=a("q0An"),j=a("Uygi"),Q=a("em2k");K.kM(K.Ry,"atLeastOneOf",function(e,t){return this.test({name:"atLeastOneOf",message:t({id:P.ENV.DEPLOY_LOCALE===z.MV.Vietnam?j.c.BABY_GROWTH.AT_LEAST_ONE_OF_VN:j.c.BABY_GROWTH.AT_LEAST_ONE_OF,defaultMessage:"Must have at least one of these fields: ${keys}"}),exclusive:!0,params:{keys:e.join(", ")},test:t=>null==t||e.some(e=>null!=t[e])})}),K.kM(K.Z_,"valIncludesStr",function(e,t){return this.test({name:"valIncludesStr",message:t({id:"additionalQuestion.inputErr.otherAnswerRequire",defaultMessage:"Please fill your other answer"}),exclusive:!1,test:t=>!t.includes(e)})}),K.kM(K.nK,"requireBabyNameIfCheckForYourKid",function(e){return this.test({name:"requireBabyNameIfCheckForYourKid",message:e({id:"tools.inputErr.requireKidNames",defaultMessage:"Please fill your kid's answer"}),exclusive:!1,test:(e,t)=>!t.parent.isMyself||!!e})});let generateSchema=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a={};return t.map(t=>{a[t]=K.Z_().valIncludesStr(A.C,e)}),K.Ry().shape({gender:K.Z_().required(e({id:"tools.inputErr.requireBabyGender",defaultMessage:"Please fill your baby gender"})),birthday:K.hT().required(e({id:j.c.BABY_GROWTH.BIRTHDAY_REQUIRED,defaultMessage:"Birthday is required"})).test({name:"ageIsLowerThanNineteen",test:(t,a)=>{let n=(0,Q.F)(t||new Date,a.parent.measurementDate);return!(n.year>P.FO)||a.createError({message:e({id:j.c.BABY_GROWTH.INVALID_AGE,defaultMessage:""},{name:a.parent.name})})}}),...a})},generateGender=e=>"male"===e?z.Y0.Boy:z.Y0.Girl,J=(0,i.forwardRef)(function(e,t){let{gender:a,label:i,...l}=e;return(0,n.tZ)("div",{ref:t,...l,children:(0,n.BX)(U.Z,{noWrap:!0,children:[generateGender(a)===z.Y0.Boy?(0,n.tZ)(Y.Z,{size:24}):(0,n.tZ)(X.Z,{size:24}),(0,n.tZ)(H.T,{size:"p2",color:q.r.colors.gray800,children:i})]})})});var $=a("rBCA"),ee=a("HMwR");let et=(0,$.Z)("div",{target:"e148d7kp0"})(ee.M.mbDown,"{padding-top:20px;}padding-bottom:40px;.gender-selector > div{max-width:400px;}&[data-is-marryBaby='false']{max-width:400px;}"),ea=(0,$.Z)("form",{target:"e148d7kp1"})("display:flex;flex-direction:column;gap:16px;"),en=(0,$.Z)("div",{target:"e148d7kp2"})("display:flex;flex-direction:column;gap:6px;.error-input input{border:1px solid ",q.r.colors.red700,";}");var babyVaccinationForm=e=>{let{}=e,t=(0,L.U)(),{locale:a,push:v,query:{source:w}}=(0,D.h)(),T=w&&w.includes("baby-vaccine"),{state:{babyLists:H,babyVaccinationContent:q},dispatch:Y}=(0,i.useContext)(F.W),{state:{isLoggedIn:X,userInfo:U}}=(0,i.useContext)(O.I),K=(0,_.d)(),{formatMessage:j}=(0,B.Z)(),{getHealthToolLink:Q}=(0,l.u)(a),[$,{open:ee,close:ei}]=(0,b.q)(!1),[el,er]=(0,i.useState)(!1),[eo,es]=(0,i.useState)(""),[ed,ec]=(0,i.useState)(null),eu=(null==q?void 0:q.listQuestions)||[];(0,i.useEffect)(()=>{X&&ee()},[X]);let eh=(0,p.c)({initialValues:{isSubmitted:!1,isMyself:!1},validate:(0,f.X)(generateSchema(j,eu.map(e=>R.S0+e.question.id)))}),eg=(0,i.useMemo)(()=>(H||[]).map(e=>({label:e.name,value:e.name,...e})),[H]);(0,i.useEffect)(()=>{(async()=>{try{if(X){let e=await (0,Z.cA)((0,S.W4)(I.y.BABY_VACCINE.GET_HEALTH_TOOL_BABY_VACCINE_LIST),"GET");(null==e?void 0:e.data)&&Y({type:G.K.UPDATE_BABY_LIST,payload:((null==e?void 0:e.data.items)||[]).map(e=>{let t=(0,h.u)(e);return{...t.profile,additionalQuestions:t.additionalQuestions}})})}}catch(e){}})(),eh.setFieldValue("isMyself",X)},[X]);let onSubmit=async e=>{if(eh.setFieldValue("isSubmitted",!0),!X){x().set(V.Tx,JSON.stringify({...e})),(0,k.p0)("".concat(window.location.origin).concat(P.sb).concat(Q(R.QO.BABY_VACCINE)),"baby-vaccine");return}let t={...e,name:(null==ed?void 0:ed.name)||e.name||""},a=[...(null==ed?void 0:ed.additionalQuestions)||[]];eu.map(t=>{let n=a.findIndex(e=>e.question.id===t.question.id),i=(e[R.S0+t.question.id]||"").split(",").filter(Boolean),l={};t.answers.map(e=>{l[e.id]=e});let r=[],o=[];i.map(e=>{l[e]?r.push({id:l[e].id,value:l[e].answer}):o.push(e)}).filter(Boolean);let s=[...r,...o.length>0?[{id:0,value:null==o?void 0:o[0]}]:[]].filter(Boolean),d={question:{id:Number(t.question.id),value:t.question.question},answers:s};-1!==n?d.answers.length>0?a[n]=d:a.splice(n,1):d.answers.length>0&&a.push(d)});let[n]=await Promise.all([eh.isDirty()?(0,Z.cA)((0,S.W4)(I.y.BABY_VACCINE.GET_HEALTH_TOOL_BABY_VACCINE_LIST),"POST",{data:{type:Number(!e.isMyself),name:e.name||"a",gender:e.gender===z.Y0.Boy,dob:y()(e.birthday).format(P.yJ),...a.length>0&&{additional_questions:a}}}):void 0,(null==U?void 0:U.id)&&(null==e?void 0:e.parentBirthday)?await (0,W.eZ)({userInfo:U,data:{birthday:e.parentBirthday}}):void 0]);if(eh.isDirty()){let{data:{profile:e}}=n;Y({type:G.K.CURRENT_BABY,payload:e})}else Y({type:G.K.CURRENT_BABY,payload:ed});await Y({type:G.K.IS_NEW_BABY,payload:!ed}),await Y({type:G.K.SUBMIT,payload:t}),v("".concat(window.location.origin).concat(P.sb).concat(Q(R.QO.BABY_VACCINE),"result"))},onError=e=>{eh.setFieldValue("isSubmitted",!0),Object.values(e).forEach(e=>(0,M.c)({type:"danger",message:e||"",title:j({id:"babyGrowth.error.title",defaultMessage:"Invalid data"})}))};return(0,i.useEffect)(()=>{if(X){if(T){let e=JSON.parse(x().get(V.Tx)||"{}");if(C()(e))return;eh.setValues({gender:e.gender,birthday:y()(e.birthday).toDate()})}if(ed){let{dob:e,gender:t,name:a}=ed;eh.setValues({name:a,birthday:y()(e).toDate(),gender:generateGender(t),isMyself:!0}),T&&eh.onSubmit(onSubmit,onError)()}}},[X,ed,T]),(0,i.useEffect)(()=>{eg.find(e=>e.name===eh.values.name)?er(!0):(ec(null),er(!1))},[eh.values.name]),(0,i.useEffect)(()=>{if(ed){if(X){let{dob:e,gender:t,name:a,additionalQuestions:n}=ed,i={};eu.map(e=>{i[R.S0+e.question.id]=""}),n.map(e=>{i[R.S0+e.question.id]=(e.answers||[]).map(e=>0===e.id?e.value:e.id).join(",")});let l={name:a,birthday:y()(e).toDate(),gender:generateGender(t),...i};eh.setValues(l),eh.resetDirty(l),er(!0)}else er(!1)}},[ed,X]),(0,n.BX)(n.HY,{children:[T&&X&&(0,n.tZ)(o.dW,{currentProfileId:"new",babyProfiles:[],onAddMeasurement:e=>{if("new"===e){eh.onSubmit(onSubmit,onError)();return}},open:$,onClose:ei,isMobile:K,newBabyValue:eh.getInputProps("name").value||"",onNewBabyValueChange:eh.getInputProps("name").onChange,onSwitchProfile:e=>ec(e),buttonText:j({id:"vaccination.chooseProfile.button",defaultMessage:"Child's vaccination schedule"}),headerText:j({id:"babyGrowth.popup.heading",defaultMessage:"Baby's Profile"})}),(0,n.tZ)(et,{children:(0,n.BX)(ea,{id:"baby-vaccine-form",onSubmit:eh.onSubmit(onSubmit,onError),children:[X&&(0,n.BX)(g.k,{gap:(0,m.h)(24),sx:e=>({[e.fn.smallerThan("sm")]:{flexDirection:"column"},[e.fn.largerThan("sm")]:{"& > div":{width:"100%",flexGrow:1}}}),children:[(0,n.tZ)(en,{children:(0,n.tZ)(E.u,{...eh.getInputProps("parentBirthday")})}),(0,n.tZ)(en,{children:(0,n.tZ)(N.X,{...eh.getInputProps("isMyself"),withAsterisk:!0,checked:eh.getInputProps("isMyself").value,label:j({id:"tools.checkYourKidsInput.label",defaultMessage:"Are you checking for your kid?"}),sx:e=>({[e.fn.smallerThan("sm")]:{display:"flex",justifyContent:"space-between"}})})})]}),!T&&X&&(0,n.tZ)(en,{children:(0,n.tZ)(s.S,{keepSearch:!0,label:(0,n.tZ)(d.T,{as:"label",size:"s4",children:j({id:"babyGrowth.input.babyName",defaultMessage:"Input baby name or select"})}),id:"baby-name",placeholder:j({id:"babyGrowth.placeholder.babyName",defaultMessage:"Input baby’s name"}),data:eg,itemComponent:J,searchable:!0,onSearchChange:es,searchValue:eo,filter:(e,t)=>(t.label||"").toLowerCase().includes(e.toLowerCase().trim()),onItemSubmit:e=>{"string"!=typeof e&&ec(e)},...eh.getInputProps("name")})}),(0,n.tZ)(r.G,{withAsterisk:!0,isBaby:!0,availableValue:el&&eh.getInputProps("gender").value,genderValue:{male:z.Y0.Boy,female:z.Y0.Girl},labelTextProps:{size:"s4"},...eh.getInputProps("gender")}),(0,n.tZ)(en,{children:(0,n.tZ)(c.D,{withAsterisk:!0,label:(0,n.tZ)(d.T,{as:"label",size:"s4",children:j({id:"babyGrowth.input.birthday",defaultMessage:"Baby birthday"})}),...eh.getInputProps("birthday"),onChange:el?()=>null:eh.getInputProps("birthday").onChange,excludeDate:e=>y()(e).isAfter(y()()),disabled:el,error:!!eh.getInputProps("birthday").error})}),eu.map((e,t)=>(0,n.tZ)(A.o,{question:e,multiple:e.isMulti,inputProps:eh.getInputProps(R.S0+e.question.id),onChange:t=>{eh.setFieldValue(R.S0+e.question.id,t.join(","))}},String(t))),(0,n.tZ)(u.B,{mt:16,size:"lg","data-event-category":"Health Tool","data-event-action":"Baby Vaccination","data-event-label":t,type:"submit",form:"baby-vaccine-form",children:j({id:"babyVaccineTool.submit",defaultMessage:"See Schedule"})})]})})]})}},DskI:function(e,t,a){a.d(t,{Z:function(){return leftColumn}});var n=a("BGKE"),i=a("q1tI"),l=a("AFO6"),r=a("rPIz"),o=a("iBNF"),s=a("pkib"),d=a("unQi"),c=a("/kWL"),u=a("4tGp"),h=a("rlLN"),g=a("vaps"),m=a("SPK5"),p=a("OAL+"),f=a("Eso5"),b=a("7Ci/"),v=a("Iblh"),y=a("Wgwc"),w=a.n(y),x=a("dDsW"),T=a("oQBk"),C=a("xIXX"),B=a("CJtR"),I=a("e/nL"),Z=a("Hghg"),S=a("K27U"),k=a("rY9m"),A=a("Psub"),E=a("0VOb"),N=a("Oeb5"),M=a("P5LW"),L=a("rIrU"),_=a("8vdq"),D=a("o0qI"),P=a("jQXw"),V=a("rBCA"),R=a("HMwR");let z=(0,V.Z)("div",{target:"ed6dj190"})(".header{display:flex;flex-direction:column;gap:15px;",R.M.mbDown,"{padding:10px 0;}}");var leftColumn=()=>{var e,t,a,y,V,R;let{state:O}=(0,i.useContext)(P.W),{state:{isLoggedIn:G}}=(0,i.useContext)(D.I),{formatMessage:F}=(0,x.Z)(),{locale:W}=(0,M.h)(),{gender:H,name:q,age:Y,babyVaccinationContent:X,currentBaby:U}=O,[K,{open:j,close:Q}]=(0,v.q)(!1),[J,$]=(0,i.useState)(!1),[ee,et]=(0,i.useState)([]),[ea,en]=(0,i.useState)([]);(0,i.useEffect)(()=>{(async()=>{if(!K&&(null==U?void 0:U.id)){let e=(0,C.cA)((0,B.W4)(T.y.BABY_VACCINE.GET_HEALTH_TOOL_BABY_DETAIL_V2,{babyId:null==U?void 0:U.id}),"GET"),t=(0,C.cA)((0,B.W4)(T.y.BABY_VACCINE.GET_HEALTH_TOOL_BABY_IMMUNIZATION_V2,{babyId:null==U?void 0:U.id}),"GET"),[a,n]=await Promise.all([e,t]),i=(0,u.u)(null==a?void 0:a.data),l=null==n?void 0:n.data.map(u.h0);en(l),i&&i.vaccineSchedules&&(null==i?void 0:i.vaccineSchedules.length)>0&&et(null==i?void 0:i.vaccineSchedules)}})()},[K,null==U?void 0:U.id]);let{getHealthToolLink:ei}=(0,l.u)(W),el=(0,i.useMemo)(()=>"".concat((0,B.UC)(W)).concat(ei(_.QO.BABY_VACCINE)),[ei]),[er,eo]=(0,i.useState)("1"),es=[{id:"1",name:F({id:"babyVaccination.tab.timeline",defaultMessage:"{name}’s Timeline"},{name:q})},{id:"2",name:F({id:"babyVaccination.tab.immunization",defaultMessage:"Immunization Statics"})}],ed={title:F({id:"tools.info",defaultMessage:"Info"}),items:(null==X?void 0:X.information)||[]},[ec,eu]=(0,i.useState)(),[eh,eg]=(0,i.useState)(),[em,ep]=(0,i.useState)(!1),[ef,eb]=(0,i.useState)(!1),[ev,ey]=(0,i.useState)("default"),[ew,ex]=(0,i.useState)(!0),getVaccineDetail=async()=>{let e=await (0,C.cA)((0,B.W4)(T.y.BABY_VACCINE.GET_VACCINE_DETAIL,{babyId:(null==U?void 0:U.id)||0,vaccineId:(null==eh?void 0:eh.vaccineId)||""}),"GET");eu((0,u.h0)(null==e?void 0:e.data))};(0,i.useEffect)(()=>{(async()=>{K&&eh&&"default"===ev&&await getVaccineDetail()})()},[K,eh,U,ev]);let[eT,eC]=(0,i.useState)("all"),eB=(0,i.useMemo)(()=>"all"===eT?(eb(!1),ee):(eb(!0),ee.map(e=>{let t=e.timelines.map(e=>{let t=e.records.filter(e=>e.status===eT);return{...e,records:t}});return{...e,timelines:t}})),[ee,eT]),eI=(0,i.useMemo)(()=>eB.every(e=>e.timelines.every(e=>0===e.records.length)),[eB]),onInjectVaccine=async(e,t)=>{try{"default"===ev?await (0,C.cA)((0,B.W4)(T.y.BABY_VACCINE.ADD_INJECTED_DATE,{babyId:(null==U?void 0:U.id)||0,vaccineId:e.vaccineId}),"POST",{allowError:!0,data:{given_on:w()(null==t?void 0:t.date).format(L.tD),dose_number:e.doseNumber}}):(eg(e),await getVaccineDetail(),ey("default"))}catch(e){(0,E.c)({type:"danger",message:"",title:F({id:"vaccination.error.alert",defaultMessage:"Vaccine cannot be updated"})})}},onImmunizationClick=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"default";"immunization"===t?(ex(!1),eg({}),eu(e)):(eg(e),ex(!1),await getVaccineDetail()),ep(!1),ey(t),j()};return(0,i.useEffect)(()=>{$(!0),setTimeout(()=>$(!1),1e3),ex(!0)},[er]),(0,n.BX)(n.HY,{children:[("default"===ev&&eh&&ec||"immunization"===ev&&ec)&&(0,n.tZ)(u.gK,{currentRecord:eh,vaccineDetail:ec,onSubmit:onInjectVaccine,opened:K,onClose:Q,isDetail:em,template:ev,shouldAutoInjected:ew,birthday:null==U?void 0:U.dob}),(0,n.tZ)(z,{children:(0,n.BX)("div",{className:"header",children:[(0,n.tZ)(r.H,{tag:"h4",fontWeight:"bold",color:o.r.colors.gray800,children:F({id:"babyVaccination.heading",defaultMessage:"Baby's Profile"})}),(0,n.tZ)(s.fL,{name:q,gender:H,age:Y,showMenu:!1,isLoggedIn:G,onAdd:()=>null,onEdit:()=>null,onRemove:()=>null,onSwitch:()=>null}),J&&(0,n.tZ)(d.fz,{visible:J,sx:{position:"fixed"}}),(0,n.BX)(h.m,{value:er,onTabChange:eo,children:[(0,n.tZ)(g.x,{offsetScrollbars:!0,scrollbarSize:4,children:(0,n.tZ)(m.k,{justify:"space-between",children:(0,n.tZ)(h.m.List,{grow:!0,children:es.map(e=>(0,n.tZ)(h.m.Tab,{value:e.id,children:(0,n.tZ)(c.T,{size:"s2",weight:"semiBold",color:"inherit",children:e.name})},e.id))})})}),(0,n.tZ)(h.m.Panel,{value:"1",pt:24,children:(0,n.BX)(p.K,{spacing:16,children:[(0,n.tZ)(u.Ue,{status:eT,onClick:eC}),eI?(0,n.tZ)(I.j,{}):(0,n.tZ)(u.ot,{name:q,age:Y,hideBanner:ef,schedules:eB,gender:H,onTitleClick:e=>{eg(e),ep(!0),j()},onToggle:(e,t)=>{eg(t),ep(!1),j()}})]})}),(0,n.tZ)(h.m.Panel,{value:"2",pt:24,children:(0,n.tZ)(u.O5,{details:ea,onClick:onImmunizationClick})})]}),(0,n.tZ)(A.j,{heading:null==X?void 0:null===(e=X.additionalInfo)||void 0===e?void 0:e.title,content:null==X?void 0:null===(t=X.additionalInfo)||void 0===t?void 0:t.description,ctaUrl:null==X?void 0:null===(a=X.additionalInfo)||void 0===a?void 0:a.ctaUrl,ctaTitle:null==X?void 0:null===(y=X.additionalInfo)||void 0===y?void 0:y.ctaTitle,image:null==X?void 0:null===(V=X.additionalInfo)||void 0===V?void 0:V.image}),(0,n.tZ)(f.x,{my:24,children:(0,n.tZ)(k.Z,{toolLink:el,onRecalculate:()=>window.location.href=el,saveLabel:F({id:"pregnancyTool.save",defaultMessage:"Go to My Health"}),onSave:()=>window.location.href="/".concat(L.MO).concat(L.YP.MY_HEALTH_PARENTING),tracking:{share:{"data-event-action":"My Health Click","data-event-category":"Health Tool","data-event-label":"".concat(L.MO).concat(L.YP.MY_HEALTH_PARENTING)},save:{"data-event-action":"My Health Click","data-event-category":"Health Tool","data-event-label":"".concat(L.MO).concat(L.YP.MY_HEALTH_PARENTING)},reCalculate:{"data-event-action":"My Health Click","data-event-category":"Health Tool","data-event-label":"".concat((0,B.UC)(W)).concat(ei(_.QO.BMI))}}})}),(0,n.tZ)(Z.E,{}),(null==X?void 0:X.disclaimer)&&(null==X?void 0:X.disclaimer)!==""&&(0,n.tZ)(b.W,{fluid:!0,p:0,pb:24,children:(0,n.tZ)(N.b,{icon:(0,n.tZ)("img",{loading:"lazy",style:{height:"16px",width:"16px"},src:"".concat(L.Nr,"/info-icon.svg"),alt:""}),headingTitle:F({id:"tools.disclaimer",defaultMessage:"Disclaimer"}),children:(0,n.tZ)(c.T,{size:"p2",color:o.r.colors.gray600,children:X.disclaimer})})}),(null==ed?void 0:null===(R=ed.items)||void 0===R?void 0:R.length)>0&&(0,n.tZ)(S.e,{faqs:ed.items,titleProps:{icon:(0,n.tZ)("img",{loading:"lazy",style:{height:"16px",width:"16px"},src:"".concat(L.Nr,"/info-icon.svg"),alt:""}),headingTitle:F({id:"tools.info",defaultMessage:"Info"})}})]})})]})}},cfqT:function(e,t,a){a.d(t,{D:function(){return CalendarModal}});var n=a("BGKE"),i=a("Vitr"),l=a("Wgwc"),r=a.n(l),o=a("dDsW"),s=a("rBCA"),d=a("iBNF"),c=a("odgB"),u=a("wnYK"),h=a("rIrU");let g=(0,s.Z)("div",{target:"e1nh73110"})("position:fixed;top:0;left:0;align-items:flex-start;overflow:auto;width:100vw;height:100vh;z-index:",h.kg.headerContainerPopupSUbLevel,";background-color:",d.r.colors.white,";padding-top:72px;"),m=(0,s.Z)(u.f,{target:"e1nh73111"})("width:100%;> div:first-of-type{box-shadow:rgb(0 0 0 / 4%) 0px 10px 16px,rgb(0 0 0 / 4%) 0px 2px 8px,rgb(0 0 0 / 4%) 0px 0px 1px;}"),p=(0,s.Z)(c.B,{target:"e1nh73112"})("font-size:14px;font-weight:700;color:",d.r.colors.primaryBase,";margin-left:auto;"),f=(0,s.Z)("img",{target:"e1nh73113"})("width:24px;height:24px;cursor:pointer;"),b=(0,s.Z)("div",{target:"e1nh73114"})("display:flex;align-items:center;padding:16px;gap:16px;width:100%;position:fixed;top:0;left:0;z-index:",h.kg.adBlock,";background-color:",d.r.colors.white,";"),v=(0,s.Z)("div",{target:"e1nh73115"})();function CalendarModal(e){let{startDate:t=new Date,ranges:a,markers:l,selectedDate:s,onClose:d,onChangeSelectedDate:c,onChangeStartDate:u,renderTooltip:h,from:y}=e,{formatMessage:w}=(0,o.Z)();return(0,n.BX)(g,{children:[(0,n.BX)(b,{children:[(0,n.tZ)(f,{src:"/images/close.svg",alt:"",onClick:d}),(0,n.tZ)(i.T,{size:"md",type:"bold",children:w({id:"myHealth.calendar.title"},{year:t.getFullYear()})}),(0,n.tZ)(p,{size:"md",color:"ghost",onClick:function(){c&&(!y||r()(y).isBefore(r()()))&&c(new Date),u&&!r()(t).isSame(r()(),"year")&&u(new Date),setTimeout(()=>{let e=document.querySelector(".modal__content-wrapper");if(e){let e=document.querySelector('[data-month-index="'.concat(new Date().getMonth(),'"]'));null==e||e.scrollIntoView({behavior:"smooth"})}},200)},children:w({id:"myHealth.calendar.button.today"})})]}),(0,n.tZ)(v,{className:"modal__content-wrapper",children:(0,n.tZ)(m,{mode:"yearly",start:t,from:y,ranges:a,markers:l,selected:s,onChangeSelected:c,onChangeStart:u,renderTooltip:h})})]})}},a7TI:function(e,t,a){a.r(t),a.d(t,{DefaultPagination:function(){return ed},TitleComp:function(){return TitleComp},default:function(){return clinicLocator}});var n=a("BGKE"),i=a("q1tI"),l=a("rBCA"),r=a("FNss"),o=a("g8xC"),s=a("/kWL"),d=a("oTwY"),c=a("kd6S"),u=a("Eso5"),h=a("SPK5"),g=a("mYVa"),m=a("FQtM"),p=a("gxre"),f=a("XRSF"),b=a("gHhT"),v=a("sEfC"),y=a.n(v),w=a("dDsW"),x=a("gHFm"),T=a("rz9S"),C=a("3d+w"),B=a("raAP"),I=a("hXNO"),Z=a("P5LW"),S=a("rIrU"),k=a("mwIZ"),A=a.n(k),E=a("09QT"),N=a("/tR3"),M=a("oQBk"),L=a("rEaw");let _={streetViewControl:!1,fullscreenControl:!1,mapTypeControl:!1,styles:[{featureType:"all",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"poi.medical",elementType:"labels.icon",stylers:[{visibility:"on"}]}]},D={[L.MV.Vietnam]:{lat:10.762622,lng:106.660172},[L.MV.Indonesia]:{lat:-6.208763,lng:106.845599},[L.MV.Malaysia]:{lat:3.139003,lng:101.686855},[L.MV.Thailand]:{lat:13.756331,lng:100.501765},[L.MV.Cambodia]:{lat:11.544873,lng:104.892167},[L.MV.Taiwan]:{lat:25.032969,lng:121.565418},[L.MV.Myanmar]:{lat:19.763306,lng:96.07851},[L.MV.PhilippinesEnglish]:{lat:14.599512,lng:120.98422},[L.MV.India]:{lat:28.613939,lng:77.209021}};var P=a("GcSG"),V=a("94Cm");let R=(0,i.forwardRef)((e,t)=>{let{options:a=_,zoom:l=13,onLoad:r,center:o,onCenterChanged:s,markerItems:d,markerItemProps:{onClick:c}={},children:u}=e,[h,g]=(0,i.useState)(),m=(0,i.useCallback)(e=>{g(e),null==r||r(e)},[r]);return(0,i.useImperativeHandle)(t,()=>h,[h]),(0,n.tZ)(P.LoadScript,{googleMapsApiKey:V.JO,children:(0,n.BX)(P.GoogleMap,{id:"clinicLocator--map",zoom:l,options:a,onLoad:m,onCenterChanged:s,mapContainerClassName:"g-map",center:o,children:[null==d?void 0:d.map(e=>(0,n.tZ)(P.Marker,{position:{lat:Number(e.latitude),lng:Number(e.longitude)},onClick:()=>null==c?void 0:c(e)},e.id)),u]})})});var z=a("iBNF"),O=a("vq0H"),G=a("tqFW"),F=a("o5qa"),W=a("vaps"),H=a("iuhU"),q=a("eZo4"),Y=a("DzJC"),X=a.n(Y),U=a("pK+c"),K=a("jpeG"),j=a("YL+3");let ClinicLocatorSidebarLocation=e=>{var t;let{data:a=[],defaultValue:i="",onChange:l,...r}=e,{formatMessage:o}=(0,w.Z)();return a&&(null==a?void 0:a.length)?(0,n.tZ)(j.A,{...r,value:i,data:[{label:o({id:"clinicLocator.filterAll"}),value:"",type:null==a?void 0:null===(t=a[0])||void 0===t?void 0:t.type},...a],onSelectItem:e=>l(e)}):null};var Q=a("owZr"),J=a("VZtU"),$=a("OAL+");let ee=(0,i.createContext)({});var et=(0,a("/npG").k)(function(e){let{useMobileLayout:t,backgroundColor:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return{resultItem:{padding:(0,g.h)(12),display:"flex",flexDirection:"column",gap:4,...!t&&{[e.fn.largerThan("sm")]:{gap:8,padding:(0,g.h)(16)}}},wrapper:{flexDirection:"column-reverse",[e.fn.smallerThan("md")]:{height:"80vh"},...!t&&{[e.fn.largerThan("md")]:{height:"min(800px,100vh)",flexDirection:"row"}}},content:{height:"100%",position:"relative",...!t&&{[e.fn.largerThan("md")]:{flex:1,minWidth:0,position:"static"}}},searchBarMobile:{},sidebar:{width:"100%",backgroundColor:e.colors.neutral50,...!t&&{[e.fn.largerThan("md")]:{width:(0,g.h)(456),overflow:"auto",position:"relative","&:after":{content:'""',height:30,position:"absolute",left:0,right:0,bottom:0,backgroundImage:"linear-gradient(0deg, #FAFAFA 0%, rgba(250, 250, 250, 0) 100%)"}},[e.fn.largerThan(1500)]:{width:"max(".concat((0,g.h)(456),",25%)")}}},sidebarExtend:{order:3,paddingTop:(0,g.h)(8),paddingInline:(0,g.h)(16),paddingBottom:(0,g.h)(12),...!t&&{[e.fn.largerThan("md")]:{order:1,paddingInline:(0,g.h)(24),paddingTop:(0,g.h)(40),paddingBottom:0}}},sidebarSticky:{order:1,zIndex:1,paddingInline:(0,g.h)(16),paddingBlock:(0,g.h)(8),...!t&&{[e.fn.largerThan("md")]:{order:2,paddingTop:(0,g.h)(16),paddingInline:(0,g.h)(24),paddingBottom:(0,g.h)(12),width:"calc(100% - 6px)"}}},sidebarSearch:{[e.fn.smallerThan("sm")]:{marginBottom:10},...!t&&{[e.fn.largerThan("lg")]:{paddingBottom:(0,g.h)(16)}}},countTitle:{gap:(0,g.h)(8),alignItems:"center",...!t&&{[e.fn.largerThan("md")]:{flex:1,minWidth:0}},".mantine-Select-item":{whiteSpace:"nowrap",fontSize:(0,g.h)(14),padding:"10px 16px"}},searchBtn:{...!t&&{[e.fn.largerThan("lg")]:{paddingTop:(0,g.h)(12)}}},sidebarList:{maxWidth:"100%",order:2,display:"flex",gap:(0,g.h)(8),flexDirection:"row",overflow:"auto",paddingInline:(0,g.h)(16),[e.fn.smallerThan("md")]:{paddingBottom:16},[e.fn.largerThan("md")]:{...t&&{paddingTop:8,paddingBottom:16}},...!t&&{[e.fn.largerThan("md")]:{order:3,gap:0,flexDirection:"column",overflow:"hidden",paddingInline:0},[e.fn.largerThan("lg")]:{flex:1,minHeight:0}}},controlBtns:{transform:"translate(0, -50%)",backgroundColor:"#fff",borderRadius:(0,g.h)(4),".zoomBtn":{border:"none",borderRadius:(0,g.h)(4),borderTop:"1px solid ".concat(e.colors.gray100),borderInline:"1px solid ".concat(e.colors.gray100),"+ .zoomBtn":{borderRadius:0},"&:first-child":{borderRadius:"".concat((0,g.h)(4)," ").concat((0,g.h)(4)," 0 0")},"&:last-child":{borderRadius:"0 0 ".concat((0,g.h)(4)," ").concat((0,g.h)(4)),borderBottom:"1px solid ".concat(e.colors.gray100)},".zoomIcon":{width:"70%",height:"70%"},...!t&&{[e.fn.largerThan("sm")]:{width:(0,g.h)(46),height:(0,g.h)(46)}}}},contentWrapper:{position:"relative",maxHeight:"100%",display:"flex",overflow:"auto",flex:1,background:"white",transition:"all .3s ease",[e.fn.smallerThan("sm")]:{padding:"0 16px 16px",gap:(0,g.h)(12)},...!t&&{[e.fn.largerThan("sm")]:{flexDirection:"column",'&[data-opened="false"]':{transform:"translate(-50%, 0)",opacity:0}}}},searchItem:{width:"100%",background:"white",'&[data-selected="true"]':{background:e.colors.blue[0]},[e.fn.smallerThan("sm")]:{border:"1px solid ".concat(e.colors.neutral[1]),borderRadius:(0,g.h)(6)},...!t&&{[e.fn.largerThan("sm")]:{borderBottom:"1px solid ".concat(e.colors.neutral[1])}}},filterSelectRoot:{width:"120px"},filterSelectItem:{fontSize:"14px",padding:"8px 10px"},filterSelectInput:{height:"auto !important",border:0,paddingLeft:0,paddingRight:(0,g.h)(22),":focus":{outline:0,boxShadow:"none"},[e.fn.smallerThan("sm")]:{textAlign:"right"}},filterSelectRightSection:{pointerEvents:"none",width:(0,g.h)(20)},filterSelectDropdown:{...!t&&{[e.fn.largerThan("sm")]:{transform:"translate(-10px, 0)"}}},foundListRoot:{display:"flex",flexDirection:"column",transition:"all .3s ease",...!t&&{[e.fn.largerThan("sm")]:{position:"absolute",zIndex:2,top:(0,g.h)(29),left:(0,g.h)(10),maxHeight:"calc(100% - 53px)",width:(0,g.h)(312),alignItems:"flex-start",'&[data-open="false"]':{pointerEvents:"none"}}},[e.fn.smallerThan("sm")]:{border:"none",transition:"all .3s ease",background:"white"}},foundListWrapper:{padding:"".concat((0,g.h)(8)," ").concat((0,g.h)(16)),[e.fn.smallerThan("sm")]:{'&[data-open="false"]':{borderBottom:"1px solid ".concat(e.colors.neutral[1])}},...!t&&{[e.fn.largerThan("sm")]:{padding:"".concat((0,g.h)(8)," ").concat((0,g.h)(12)),background:"white",borderBottom:"1px solid ".concat(e.colors.neutral[1]),pointerEvents:"initial",width:"100%",'&[data-open="false"]':{width:"auto"}}}},foundListInner:{[e.fn.smallerThan("sm")]:{justifyContent:"space-between"},...!t&&{[e.fn.largerThan("sm")]:{justifyContent:"space-between",'&[data-open="false"]':{justifyContent:"flex-start"}}}},arrowBtn:{cursor:"pointer",...!t&&{[e.fn.largerThan("sm")]:{marginTop:"3px"}}},titleComp:{flex:1,color:e.colors.gray800,fontSize:(0,g.h)(24),fontWeight:700,lineHeight:(0,g.h)(32),letterSpacing:(0,g.h)(-.8),textAlign:"center",paddingTop:(0,g.h)(48),paddingBottom:(0,g.h)(16),...!t&&{[e.fn.largerThan(1112)]:{textAlign:"left",fontSize:(0,g.h)(22),letterSpacing:(0,g.h)(-.6),paddingTop:0,paddingBottom:0}}},viewExpertBtn:{height:"auto",paddingBlock:0,paddingLeft:0,paddingRight:0,marginLeft:"auto",borderRadius:(0,g.h)(8),color:e.colors.primary600,backgroundColor:"transparent !important",".mantine-Button-leftIcon":{marginRight:(0,g.h)(12)},...!t&&{[e.fn.largerThan("md")]:{height:(0,g.h)(48),paddingBlock:(0,g.h)(12),paddingLeft:(0,g.h)(12),paddingRight:(0,g.h)(16),color:"white",backgroundColor:"".concat(a||e.colors.primary600," !important"),"&:hover":{backgroundColor:"".concat(a||e.colors.primary500," !important")}}}}}});let ea=(0,i.forwardRef)(function(e,t){let{id:a,name:l,address:r,...o}=e,{isMobile:d}=(0,i.useContext)(ee),{classes:c}=et({useMobileLayout:d});return(0,n.BX)(u.x,{className:c.resultItem,ref:t,...o,children:[(0,n.tZ)(s.T,{size:"s3",weight:"semiBold",children:l}),(0,n.tZ)(s.T,{size:"p4",sx:{display:"-webkit-box","-webkit-line-clamp":"3","-webkit-box-orient":"vertical",overflow:"hidden"},children:r})]},a)}),en=(0,i.forwardRef)((e,t)=>{let{searchData:a,loading:i,placeholder:l,onClickLeftIcon:o,value:d,icon:c=(0,n.tZ)(J.Z,{color:z.r.colors.gray300,onClick:o}),hideSearchDropdown:u,...m}=e,{formatMessage:p}=(0,w.Z)(),f=p({id:"clinicLocator.inputPlaceholder",defaultMessage:"Search by hospital name"}),b=(0,n.BX)($.K,{align:"center",sx:{position:"relative",padding:(0,g.h)(40),width:"100%"},children:[(0,n.tZ)(q.f,{visible:null===a||!!i,sx:()=>({borderRadius:(0,g.h)(20),border:0})}),(0,n.BX)($.K,{align:"center",sx:{opacity:Number(!(null===a||i))},children:[(0,n.tZ)(h.k,{align:"center",justify:"center",sx:{background:"white",borderRadius:"50%",width:(0,g.h)(120),height:(0,g.h)(120),img:{width:(0,g.h)(80)}},children:(0,n.tZ)("img",{src:Q.C.getAssetPath("hospital.png"),alt:"Not found",loading:"lazy"})}),(0,n.tZ)(s.T,{size:"p4",children:p({id:"clinicLocator.notFound",defaultMessage:"No result found. Try another keyword!"})})]})]});return(0,n.tZ)(r.S,{ref:t,size:"lg",clearable:!0,keepSearch:!0,searchable:!0,withinPortal:!0,limit:20,icon:c,data:a||[],inputMode:"text",value:d||"",placeholder:l||f,filter:()=>!0,itemComponent:ea,rightSection:null,dropdownPosition:"bottom",dropdownComponent:e=>{let{children:t}=e;return(0,n.BX)(W.x,{scrollbarSize:8,className:"w-full",children:[t,(0,n.tZ)(q.f,{visible:!!i,sx:()=>({borderRadius:(0,g.h)(20),border:0})})]})},nothingFound:b,styles:e=>{let t={border:0,padding:0,borderRadius:(0,g.h)(20)};return(u||!d)&&(t.display="none"),{input:{borderRadius:(0,g.h)(8),borderColor:e.colors.gray200,fontSize:(0,g.h)(16),lineHeight:1.5,"&:not(.mantine-Textarea-input)":{[e.fn.smallerThan("sm")]:{height:40,fontSize:(0,g.h)(14)}},"&[data-with-icon]":{paddingLeft:(0,g.h)(48)},"&[disabled]":{opacity:1}},dropdown:t,item:{borderRadius:0,borderTop:"1px solid ".concat(e.colors.neutral100),"&:first-of-type":{borderTop:0}}}},...m})}),ei=(0,i.forwardRef)((e,t)=>{let{color:a,loadingAt:l,extendComponent:r,clinics:d,clinicSelected:c,onSelectClinic:m,pagination:p=ed,searchData:f=[],searchValue:b,onChangeSearch:v,onSubmitSearch:x,onItemSubmitSearch:T,filter:C=[],onFilter:B,onLoadMore:S,searchRef:k,hideSearchDropdown:A}=e,{isMobile:E}=(0,i.useContext)(ee),{classes:N}=et({useMobileLayout:E}),{locale:M}=(0,Z.h)(),{formatMessage:L}=(0,w.Z)(),_=(0,i.useRef)(null),D=(0,i.useRef)(null),P=(0,i.useRef)(null),[V,R]=(0,i.useState)(b||""),[Y,j]=(0,i.useState)(!0);(0,i.useImperativeHandle)(t,()=>({scrollTop:()=>{E?P.current&&P.current.scrollTo({left:0,behavior:"smooth"}):D.current&&D.current.scrollTo({top:0,behavior:"smooth"})}}));let Q=(0,i.useRef)(S),J=(0,i.useRef)(p),$=(0,i.useRef)(l);(0,i.useEffect)(()=>{Q.current=S,J.current=p,$.current=l},[S,p,l]);let ea=(0,i.useCallback)(X()(()=>{let e=J.current,t="string"==typeof $.current;if(e.current{let e=_.current,t=D.current;if(!e)return;let a=new IntersectionObserver(e=>{e[0].isIntersecting&&ea()},{root:t,threshold:.1,rootMargin:"0px 0px 400px 0px"});return a.observe(e),()=>{a.disconnect(),ea.cancel()}},[ea,E,null==d?void 0:d.length]);let{title:ei}=(0,i.useMemo)(()=>({title:L({id:"clinicLocator.foundClinics",defaultMessage:"{count} Clinics"},{count:null==p?void 0:p.total_items.toLocaleString(M)})}),[null==p?void 0:p.total_items,M,L]),el=(0,i.useMemo)(()=>(null==p?void 0:p.current)<(null==p?void 0:p.last),[null==p?void 0:p.current,null==p?void 0:p.last]),er=E?h.k:W.x,eo=E?{direction:"column"}:{viewportRef:D,styles:{root:{height:"100%"},thumb:{zIndex:2}},scrollbarSize:6},es=E?W.x:h.k,ec=E?{viewportRef:P,scrollbarSize:6,w:"100%",styles:e=>({root:{[e.fn.smallerThan("sm")]:{paddingLeft:0,paddingRight:0}},viewport:{[e.fn.smallerThan("sm")]:{paddingLeft:16,paddingRight:16}}})}:{},eu=E?h.k:u.x,eh=E?{gap:8}:{},eg=(0,i.useMemo)(()=>y()(e=>null==v?void 0:v(e),500),[v]);(0,i.useEffect)(()=>()=>eg.cancel(),[eg]);let em=(0,i.useCallback)(e=>{e.includes("-----")||(R(e),eg(e))},[eg]),ep=(0,i.useCallback)(e=>{"Enter"===e.key&&(null==x||x(e.target.value))},[x]),ef=(0,i.useCallback)(e=>{let{value:t,label:a,...n}=e;null==T||T(n)},[T]);return(0,i.useEffect)(()=>{R(b||"")},[b]),(0,n.BX)(er,{className:"ClinicLocatorSidebar--wrapper",...eo,children:[r&&(0,n.tZ)(h.k,{align:"stretch",gap:(0,g.h)(16),className:N.sidebarExtend,children:r}),(0,n.BX)(u.x,{pos:"sticky",top:0,left:0,bg:z.r.colors.neutral50,sx:{zIndex:10},className:(0,H.default)("ClinicLocatorSidebar--sticky relative",{"pt-4":!E,"block md:flex md:flex-col md:gap-2":I.d},N.sidebarSticky),children:[(0,n.tZ)(h.k,{gap:(0,g.h)(8),align:"center",children:(0,n.tZ)(o.B,{onClick:()=>j(!Y),leftIcon:Y?(0,n.tZ)(U.ok,{className:"text-[24px] text-gray800"}):(0,n.tZ)(K.Z,{className:"text-[24px] text-gray800"}),className:(0,H.default)("ml-auto !absolute top-[52px] right-[12px] !bg-[transparent] ",{"!block":E,"!hidden":!E,"md:top-[64px]":I.d})})}),(0,n.tZ)(en,{ref:k,searchData:Array.isArray(f)?f.map(e=>({...e,value:"-----".concat(e.id),label:e.name})):null,loading:"search-bar"===l,value:V,onChange:em,onItemSubmit:ef,onKeyUp:ep,className:N.sidebarSearch,hideSearchDropdown:A}),(0,n.BX)(h.k,{gap:(0,g.h)(8),align:"center",className:N.searchBtn,children:[(0,n.tZ)(F.Z,{size:24,color:a||z.r.colors.primary600}),(0,n.BX)(h.k,{className:N.countTitle,align:"center",gap:16,children:[(0,n.tZ)(s.T,{size:"s3",sx:{flex:1},children:ei}),(0,n.tZ)(ClinicLocatorSidebarLocation,{data:C,onChange:B})]})]})]}),(0,n.BX)(es,{...ec,className:(0,H.default)("clinicLocatorSidebar--body",{"!hidden":E&&!Y},N.sidebarList),children:[(0,n.tZ)(q.f,{visible:"sidebar"===l,sx:{borderRadius:(0,g.h)(20)}}),(0,n.BX)(eu,{...eh,children:[null==d?void 0:d.map((e,t)=>(0,n.BX)(h.k,{gap:(0,g.h)(16),sx:{cursor:"pointer",wordBreak:"break-word"},className:(0,H.default)("clinicLocatorSidebar--item relative",{"min-w-[280px]":E,"p-3":E,"px-6 py-3":!E,"border-b border-solid border-gray100":!E,"bg-[transparent]":(null==c?void 0:c.id)===e.id&&!E,"bg-blue50":(null==c?void 0:c.id)===e.id,...E&&{"bg-white":(null==c?void 0:c.id)!==e.id}}),onClick:()=>null==m?void 0:m(e),children:[(0,n.tZ)("div",{className:(0,H.default)("absolute bg-primary600",{"left-0 bottom-0 w-full h-[2px]":E,"top-0 left-0 w-[2px] h-full":!E,"opacity-100":(null==c?void 0:c.id)===e.id,"opacity-0":(null==c?void 0:c.id)!==e.id})}),!E&&(0,n.tZ)(u.x,{className:"w-8 h-8",children:(0,n.tZ)(O.I,{width:"100%",height:"100%",src:e.logo,alt:e.name,className:"object-contain"})}),(0,n.tZ)(u.x,{sx:{flex:1,minWidth:0},children:(0,n.BX)(s.T,{lineClamp:E?3:void 0,children:[(0,n.tZ)(s.T,{size:"s3",weight:"semiBold",children:e.name}),(0,n.tZ)(s.T,{size:"p4",lineClamp:E?void 0:3,children:e.address})]})})]},"".concat(e.id,"-").concat(t))),el&&(0,n.BX)(u.x,{py:20,sx:{textAlign:"center"},children:[(0,n.tZ)("div",{ref:_,style:{height:1}}),(0,n.tZ)(G.L,{className:"whitespace-nowrap"})]})]})]})]})});ei.displayName="ClinicLocatorSidebar";var el=a("mGnJ"),er=a("xrdX"),eo=a("8vDj"),es=a("CJtR");function SelectedClinicMarker(e){var t,a;let{selectedClinic:l,hideBooking:r}=e,{formatMessage:o}=(0,w.Z)(),d=(0,eo.rZ)(),{dataEventCategory:c}=(0,i.useContext)(ee),[m,p]=(0,i.useState)(),{locale:f}=(0,Z.h)(),b=el.C.includes(f)?(0,es.D4)({id:l.id,name:l.name,locale:f,slug:l.slug}):null,v=l.totalAvailableDoctors&&l.totalAvailableServices?{label:o({id:"articleAuthor.button",defaultMessage:"Book now"}),url:b}:l.totalAvailableDoctors?{label:o({id:"articleAuthor.button",defaultMessage:"Book now"}),url:"".concat(b,"?tab=").concat(null===(t=S.a8[f])||void 0===t?void 0:t.DOCTOR)}:l.totalAvailableServices?{label:o({id:"articleAuthor.button",defaultMessage:"Book now"}),url:"".concat(b,"?tab=").concat(null===(a=S.a8[f])||void 0===a?void 0:a.SERVICE)}:{label:o({id:"articlePage.careEmbedding.viewDetail"}),url:b};return(0,n.BX)(n.HY,{children:[(0,n.tZ)("style",{children:"\n .gm-style img {\n max-height: none !important;\n max-width: 100%;\n object-fit: contain;\n }\n\n .gm-style-iw-c {\n padding: 12px; \n border-radius: 16px; \n box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.04), \n 0px 0px 2px 0px rgba(0, 0, 0, 0.06), \n 0px 4px 8px 0px rgba(0, 0, 0, 0.04);\n }\n\n .gm-style-iw > button {\n right: 0 !important;\n top: 0 !important;\n }\n\n .gm-style-iw-chr {\n position: absolute;\n right: 0;\n }\n "}),(0,n.tZ)(P.Marker,{position:{lat:Number(l.latitude),lng:Number(l.longitude)},onLoad:p}),m&&(0,n.tZ)(P.InfoWindow,{anchor:m,options:{minWidth:320,maxWidth:320},children:(0,n.BX)($.K,{spacing:(0,g.h)(4),sx:{paddingTop:10},children:[l.logo?(0,n.tZ)("div",{children:(0,n.tZ)("img",{loading:"lazy",src:l.logo,alt:l.name,width:"auto",height:48})}):null,(0,n.BX)($.K,{spacing:(0,g.h)(4),children:[(0,n.tZ)(s.T,{size:"s4",weight:"semiBold",children:l.name}),(0,n.tZ)(s.T,{size:"n1",children:l.address}),!r&&(l.totalAvailableDoctors||l.totalAvailableServices)?(0,n.BX)(s.T,{size:"n1",children:[o({id:"clinicLocator.infoWindow.availableForBooking",defaultMessage:"Available for booking"}),": ",(0,n.BX)(u.x,{component:"span",sx:e=>({span:{display:"inline-block"},"span + span":{position:"relative",marginLeft:(0,g.h)(5),paddingLeft:(0,g.h)(5),"&:before":{content:'""',width:(0,g.h)(2),height:(0,g.h)(2),borderRadius:"50%",background:e.colors.gray[6],position:"absolute",left:"0",top:"50%"}}}),children:[l.totalAvailableDoctors>0&&(0,n.tZ)("span",{children:l.totalAvailableDoctors?o({id:"clinicLocator.infoWindow.availableDoctors"}):""}),l.totalAvailableServices>0&&(0,n.tZ)("span",{children:(0,n.tZ)("span",{children:l.totalAvailableServices?o({id:"clinicLocator.infoWindow.availableServices"}):""})})]})]}):null,(!r&&v.url||l.websiteUrl)&&(0,n.BX)(h.k,{align:"center",gap:16,sx:{"a:focus-visible":{outline:"none"}},children:[!r&&v.url&&(0,n.tZ)(u.x,{component:"a",href:v.url,target:"_blank",className:"pointer-event-child-none","data-event-category":c,"data-event-action":"Book Doctor via Clinic Click","data-event-label":"https://".concat(er.v[f]).concat(v.url),children:(0,n.tZ)(s.T,{size:"n1",sx:{color:d.colors.blue[8],textDecoration:"underline",textUnderlineOffset:(0,g.h)(4)},children:v.label})}),l.websiteUrl&&(0,n.tZ)(u.x,{component:"a",href:l.websiteUrl,target:"_blank",className:"pointer-event-child-none","data-event-category":c,"data-event-action":"Clinic Directory - Go to Hospital Page","data-event-label":l.websiteUrl,children:(0,n.tZ)(s.T,{size:"n1",sx:{color:d.colors.blue[8],textDecoration:"underline",textUnderlineOffset:(0,g.h)(4)},children:o({id:"clinicLocator.infoWindow.websiteUrl",defaultMessage:"Go to hospital page"})})})]})]})]})},l.id)]})}let ed={current:1,first:1,last:1,next:1,prev:1,total_items:0,items_per_page:20};var clinicLocator=e=>{var t,a;let{title:l,specialties:b=[],specialties_hashtag:v,defaultColor:S,hideBooking:k,onGetBrowserLoc:L,infoPath:_,useMobileLayout:P,dataEventCategory:V="Service Connection",...z}=e,{formatMessage:O}=(0,w.Z)(),{classes:G}=et({useMobileLayout:P}),{locale:F}=(0,Z.h)(),W=(0,I.d)(!0),H=(0,B.U)(),q=(0,i.useRef)(null),Y=(0,i.useRef)(null),X=(0,i.useRef)(null),U=(0,i.useRef)(null),K=function(e){let{specialties:t}=e,a={type:"hospital",allowSearchInDistrict:1,showDistricts:1};return t.length&&(a.specialtyIds=t.join(",")),a}({specialties:b}),[j,Q]=(0,i.useState)(K),[J,$]=(0,i.useState)(),[ea,en]=(0,i.useState)(null),[el,er]=(0,i.useState)([]),[eo,es]=(0,i.useState)(!1),[eu,eh]=(0,i.useState)(!1),[eg,em]=(0,i.useState)(!1),[ep,ef]=(0,i.useState)(!1),{fetchClinics:eb}=function(e){let{infoPath:t}=e,[a,n]=(0,i.useState)(!1),l=(0,i.useCallback)(async e=>{let{signal:a,...i}=e;n(!0);try{let e=await (0,E.d)(M.y.CARE.GET_SEARCH_CARE,{params:i,signal:a},"careV2"),{_data:n}=e||{};if(!n)throw Error(JSON.stringify(e));let{searches:l}=n||{};return{data:{...n,searches:l.map(e=>{let a={...e};return t&&(a.name=A()(e,t,e.name)),(0,N.ZL)(a)})},errors:[]}}catch(e){if("AbortError"===e.name||"canceled"===e.message)return{data:null,errors:[],isCanceled:!0};return{data:null,errors:[e]}}finally{n(!1)}},[t]);return(0,i.useMemo)(()=>({loading:a,setLoading:n,fetchClinics:l}),[a,n,l])}({infoPath:_}),ev=(0,i.useRef)(null),appendClinics=e=>{er(t=>{let a=[...t,...e],n=a.reduce((e,t)=>(e[t.id]=t,e),{});return Object.values(n)})},[ey,ew]=(0,i.useState)(null),[ex,eT]=(0,i.useState)(null),[eC,eB]=(0,i.useState)(),[eI,eZ]=(0,i.useState)(""),eS=D[F],{title:ek,viewExpertsBtn:eA}=(0,i.useMemo)(()=>({title:l||O({id:"section.clinicLocator.title",defaultMessage:"Explore the best Clinics for yourself"}),viewExpertsBtn:O({id:"section.clinicLocator.viewExpertsBtn",defaultMessage:"View Experts"})}),[O,l]),eE=(0,i.useMemo)(()=>(0,n.tZ)(TitleComp,{title:ek}),[ek]),eN=(0,i.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(0==e.length)return!1;if(q.current){let t=new window.google.maps.LatLngBounds;if(null==e||e.forEach(e=>{t.extend(new window.google.maps.LatLng(e.latitude,e.longitude))}),t.getNorthEast().equals(t.getSouthWest())){let e=new google.maps.LatLng(t.getNorthEast().lat()+.005,t.getNorthEast().lng()+.005),a=new google.maps.LatLng(t.getNorthEast().lat()-.005,t.getNorthEast().lng()-.005);t.extend(e),t.extend(a)}q.current.fitBounds(t)}},[]);function formatFilterData(e){let{cities:t=[],districts:a=[]}=e,n=a.length?a.map(e=>({label:e.name,value:e.id,type:"district"})):t.length?t.map(e=>({label:e.name,value:e.id,type:"city"})):[];return n}let handleReset=async()=>{Q(K),eM(K,"sidebar",e=>{var t;let{clinics:a,pagination:n,cities:i,districts:l}=e;eT({initialClinics:a,initialPagination:n,filter:formatFilterData({cities:i,districts:l})}),er(a||[]),en(null),eZ(""),null===(t=U.current)||void 0===t||t.scrollTop()})},handleFetch=async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n={...K,...e&&{latitude:e.lat,longitude:e.lng,...t&&{distance:5}}};Q(n),eZ(""),eM(n,"sidebar",e=>{let{clinics:t,pagination:n,cities:i,districts:l}=e;eT({initialClinics:t,initialPagination:n,filter:formatFilterData({cities:i,districts:l})}),er(t||[]),a&&setTimeout(()=>{ef(a)},1e3)})},handleLoadMore=async()=>{let e={...j,page:Number(null==ex?void 0:ex.initialPagination.current)+1};Q(e),eM(e,"load-more",e=>{let{clinics:t,pagination:a,cities:n,districts:i}=e;eT(e=>({initialClinics:[...(null==e?void 0:e.initialClinics)||[],...t],initialPagination:a,filter:function(e){if(!e||!e.length)return[];let t=new Map,a=[];return e.forEach(e=>t.set(e.value,e)),t.forEach(e=>{a.push(e)}),a}(((null==ex?void 0:ex.filter)||[]).concat(formatFilterData({cities:n,districts:i})))})),appendClinics(t),er(t||[])})},handleFilter=async e=>{let t=null==e?void 0:e.type,a=null==e?void 0:e.value,n={...j,page:1,..."district"===t?{districtId:a}:"city"===t?{cityId:a}:{}};a||(delete n.cityId,delete n.districtId,delete n.distance),Q(n);try{eM(n,"sidebar",e=>{var t;let{clinics:a,pagination:n,cities:i,districts:l}=e;eT({initialClinics:a,initialPagination:n,filter:formatFilterData({cities:i,districts:l})}),appendClinics(a),er(a||[]),null===(t=U.current)||void 0===t||t.scrollTop()})}catch(e){console.error(e)}},eM=(0,i.useCallback)(y()(async(e,t,a)=>{ev.current&&ev.current.abort();let n=new AbortController;ev.current=n;try{$(t);let i=await eb({...e,signal:n.signal});if((null==i?void 0:i.isCanceled)||n.signal.aborted)return;let{data:l}=i;if(!l)return;let{searches:r,districts:o,cities:s,pagination:d}=l;a&&a({clinics:r,pagination:d||ed,districts:o,cities:s})}catch(e){"AbortError"!==e.name&&console.error("Search Error:",e)}finally{n.signal.aborted||$(void 0)}},500),[null==ex?void 0:ex.filter]);(0,i.useEffect)(()=>()=>{eM.cancel()},[eM]);let handleSearch=async e=>{if(!e){eM.cancel(),handleReset();return}let t={...j,keyword:e,page:1};eM(t,"search-bar",e=>{let{clinics:t,pagination:a,cities:n,districts:i}=e;en({initialClinics:t,initialPagination:a,filter:formatFilterData({cities:n,districts:i})})})},trackSearchResults=(e,t)=>{var a,n;null===(a=(n=window).gtag)||void 0===a||a.call(n,"event","view_search_results",{event_category:V,event_action:"Clinic Directory",event_label:H,search_term:e,search_result_shown:((null==t?void 0:t.length)>0).toString()})},handleSubmitSearchValue=async e=>{var t,a;let n={...K,keyword:e,page:1};Q(n),es(!0),eZ(e),null==Y||null===(t=Y.current)||void 0===t||t.blur();let i=(null==ea?void 0:ea.initialClinics)||[];if("search-bar"!==J&&i.length>0){eT({initialClinics:i,initialPagination:(null==ea?void 0:ea.initialPagination)||ed,filter:(null==ea?void 0:ea.filter)||[]}),er(i),en(null),trackSearchResults(e,i),null===(a=U.current)||void 0===a||a.scrollTop();return}eM(n,"sidebar",t=>{var a;let{clinics:n,pagination:i,cities:l,districts:r}=t;eT({initialClinics:n,initialPagination:i||ed,filter:formatFilterData({cities:l,districts:r})}),er(n),en(null),trackSearchResults(e,n),null===(a=U.current)||void 0===a||a.scrollTop()})},handleMarkerClick=async function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(ew(e),t&&eZ(""),es(!0),q.current){let t=new window.google.maps.LatLngBounds;if(t.extend(new window.google.maps.LatLng(e.latitude,e.longitude)),t.getNorthEast().equals(t.getSouthWest())){let e=new google.maps.LatLng(t.getNorthEast().lat()+.01,t.getNorthEast().lng()+.01),a=new google.maps.LatLng(t.getNorthEast().lat()-.01,t.getNorthEast().lng()-.01);t.extend(e),t.extend(a)}q.current.fitBounds(t)}if(!ex){er([e]);let{data:t}=await eb({type:"hospital",latitude:e.latitude,longitude:e.longitude,distance:5,perPage:50,showDistricts:0}),{searches:a}=t;appendClinics(a)}},getCurrentLocation=()=>{if(!ep){if(!navigator.geolocation)return console.log("Geolocation is not supported by this browser."),null;eh(!0),navigator.geolocation.getCurrentPosition(e=>{eh(!1),handleFetch({lat:e.coords.latitude.toFixed(8),lng:e.coords.longitude.toFixed(8)},!0,!0),eB({lat:e.coords.latitude,lng:e.coords.longitude}),null==L||L({lat:e.coords.latitude,lng:e.coords.longitude})},e=>(console.log("Error getting user location",e),eh(!1),1===e.code&&em(!0),null))}},eL=(0,i.useCallback)(e=>()=>{var t,a;let n=(null===(t=q.current)||void 0===t?void 0:t.getZoom())||15;null===(a=q.current)||void 0===a||a.setZoom(n+e)},[null===(t=q.current)||void 0===t?void 0:t.getZoom,null===(a=q.current)||void 0===a?void 0:a.setZoom]);(0,i.useEffect)(()=>{q.current&&ex&&(((null==ex?void 0:ex.initialClinics)||[]).length>0?eN(ex.initialClinics):eC&&q.current.setCenter(eC))},[ex]),(0,i.useEffect)(()=>{if(q.current&&eC){let e=new window.google.maps.LatLngBounds;if(e.extend(new window.google.maps.LatLng(eC.lat,eC.lng)),e.getNorthEast().equals(e.getSouthWest())){let t=new google.maps.LatLng(e.getNorthEast().lat()+.01,e.getNorthEast().lng()+.01),a=new google.maps.LatLng(e.getNorthEast().lat()-.01,e.getNorthEast().lng()-.01);e.extend(t),e.extend(a)}q.current.fitBounds(e)}},[eC]),(0,i.useEffect)(()=>{if(eg){let e=setTimeout(()=>{em(!1)},3e3);return()=>clearTimeout(e)}},[eg]);let e_=W||P;return(0,n.tZ)(ee.Provider,{value:{isMobile:e_,dataEventCategory:V},children:(0,n.BX)(ec,{ref:X,...z,children:[e_&&(0,n.tZ)(x.W,{className:"map-hhg-container",children:eE}),(0,n.tZ)(u.x,{sx:{position:"relative",backgroundColor:"#fff"},children:(0,n.BX)(h.k,{className:G.wrapper,pos:"relative",children:[(0,n.tZ)(h.k,{id:"clinicLocator--sidebar",direction:"column",mah:"100%",className:G.sidebar,children:(0,n.tZ)(ei,{ref:U,color:S,loadingAt:J,extendComponent:!e_&&(0,n.BX)(n.HY,{children:[eE,(0,n.tZ)(ButtonComp,{buttonText:eA,backgroundColor:S,specialties_hashtag:v,currentUrl:H})]}),clinics:null==ex?void 0:ex.initialClinics,pagination:null==ex?void 0:ex.initialPagination,clinicSelected:ey,onSelectClinic:e=>{var t,a;handleMarkerClick(e,!1),null===(t=(a=window).gtag)||void 0===t||t.call(a,"event","interaction_click",{event_category:V,event_action:"Clinic Directory Click",event_label:H,hospital_id:e.id,click_location:"list",debug_mode:!0}),setTimeout(()=>{var e;null===(e=document.getElementById("clinicLocator--content"))||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},100)},hideSearchDropdown:eo,searchValue:eI,searchData:(null==ea?void 0:ea.initialClinics)||null,onChangeSearch:e=>{es(!1),handleSearch(e)},onItemSubmitSearch:e=>{var t,a,n,i,l;let r={...j};delete r.keyword,eZ(""),Q(r),appendClinics([e]),handleMarkerClick(e),null===(t=Y.current)||void 0===t||t.blur(),null===(a=(n=window).gtag)||void 0===a||a.call(n,"event","view_search_results",{event_category:V,event_action:"Clinic Directory",event_label:H,search_term:eI,search_result_shown:(((null==ea?void 0:ea.initialClinics)||[]).length>0).toString()}),null===(i=(l=window).gtag)||void 0===i||i.call(l,"event","interaction_click",{event_category:V,event_action:"Clinic Directory Click",event_label:H,hospital_id:e.id,click_location:"search box"}),setTimeout(()=>{var e;null===(e=document.getElementById("clinicLocator--content"))||void 0===e||e.scrollIntoView({behavior:"smooth",block:"center",inline:"center"})},100)},onSubmitSearch:handleSubmitSearchValue,onLoadMore:handleLoadMore,filter:null==ex?void 0:ex.filter,onFilter:handleFilter,searchRef:Y,queryParams:j})}),(0,n.BX)(u.x,{id:"clinicLocator--content",className:G.content,children:[(0,n.tZ)(R,{ref:q,onLoad:e=>{var t,a;let n=null===(t=e.getCenter())||void 0===t?void 0:t.lat(),i=null===(a=e.getCenter())||void 0===a?void 0:a.lng();if(n&&i){let e=(null==eS?void 0:eS.lat)===n&&(null==eS?void 0:eS.lng)===i,t={lat:n,lng:i};eB(t),handleFetch(t,!e)}},zoom:13,center:eC||eS,onCenterChanged:()=>ef(!1),markerItems:el,markerItemProps:{onClick(e){var t,a;handleMarkerClick(e),null===(t=(a=window).gtag)||void 0===t||t.call(a,"event","interaction_click",{event_category:V,event_action:"Clinic Directory Click",event_label:H,hospital_id:e.id,click_location:"map"})}},options:{cameraControl:!1,rotateControl:!1,streetViewControl:!1,mapTypeControl:!1,fullscreenControl:!1},children:ey&&(0,n.tZ)(SelectedClinicMarker,{selectedClinic:ey,hideBooking:k})}),(0,n.BX)(h.k,{direction:"column",gap:0,pos:"absolute",top:"50%",right:(0,g.h)(16),className:G.controlBtns,children:[(0,n.tZ)(m.u,{label:O({id:"clinicLocator.zoomOutToViewMore"}),position:"left",withArrow:!0,children:(0,n.tZ)(p.A,{variant:"default",className:"zoomBtn",onClick:()=>{eN(el)},children:(0,n.tZ)(C.Z,{className:"zoomIcon"})})}),(0,n.tZ)(p.A,{variant:"default",className:"zoomBtn",onClick:eL(1),children:(0,n.tZ)(d.Z,{className:"zoomIcon"})}),(0,n.tZ)(p.A,{variant:"default",className:"zoomBtn",onClick:eL(-1),children:(0,n.tZ)(c.Z,{className:"zoomIcon"})})]}),(0,n.tZ)(h.k,{pos:"absolute",left:"50%",sx:e=>({zIndex:0,transform:"translate(-50%, 0)",[e.fn.smallerThan("sm")]:{top:16},[e.fn.largerThan("sm")]:{bottom:16}}),children:(0,n.BX)(r.o,{position:"top",withArrow:!0,arrowPosition:"center",shadow:"md",opened:eg,onChange:em,positionDependencies:["isMobile"],children:[(0,n.tZ)(r.o.Target,{children:(0,n.tZ)(o.B,{className:"pointer-event-child-none",styles:e=>({root:{...S&&{background:"".concat(S,"!important"),"&:hover":{background:"".concat(e.fn.darken(S,.05))}},"&[data-loading]":{"&:before":{background:"transparent"}}},leftIcon:{display:"none"}}),onClick:()=>getCurrentLocation(),loading:eu,rightIcon:eu?(0,n.tZ)(f.a,{color:"#fff",size:"xs"}):(0,n.tZ)(T.Z,{color:"#fff",size:18}),"data-event-category":V,"data-event-action":"Find The Nearest Clinic","data-event-label":H,children:O({id:"clinicLocator.findNearClinic",defaultMessage:"Find your nearest Clinic"})})}),(0,n.tZ)(r.o.Dropdown,{style:{pointerEvents:"none"},children:(0,n.tZ)(s.T,{size:"xs",children:O({id:"clinicLocator.plsAllowAccess",defaultMessage:"Please allow location access"})})})]})})]})]})})]})})};let TitleComp=e=>{let{title:t}=e,{isMobile:a}=(0,i.useContext)(ee),{classes:l,cx:r}=et({useMobileLayout:a});return(0,n.tZ)(s.T,{as:"h2",miw:0,fs:(0,g.h)(22),className:r("map-header",l.titleComp),children:t})},ButtonComp=e=>{let{buttonText:t,backgroundColor:a,specialties_hashtag:l,currentUrl:r}=e,{isMobile:s,dataEventCategory:d}=(0,i.useContext)(ee),{classes:c}=et({backgroundColor:a,useMobileLayout:s}),u=(0,i.useMemo)(()=>{if(!l)return null;let e=document.getElementById("#".concat(l.replace(/\#/g,"")));if(!e)return null;let a={"data-event-category":d,"data-event-action":"CLick - View experts","data-event-label":"".concat(r).concat(l?"".concat(l):"")};return(0,n.tZ)(o.B,{...a,className:c.viewExpertBtn,size:"lg",variant:"primary",onClick:()=>{e.scrollIntoView({behavior:"smooth",inline:"center",block:"center"})},leftIcon:(0,n.tZ)(b.E,{w:(0,g.h)(24),h:(0,g.h)(24),src:"".concat(S.uQ,"/clinic.svg"),alt:t}),children:t})},[l,t]);return u},ec=(0,l.Z)("div",{target:"eyd257k0"})("display:flex;flex-direction:column;.g-map{width:100%;height:100%;}")},"7a+s":function(e,t,a){a.d(t,{S:function(){return ClinicLocatorEmbedCard}});var n=a("BGKE"),i=a("/kWL"),l=a("8vDj"),r=a("OAL+"),o=a("Vvt1"),s=a.n(o);let d=s()(()=>Promise.resolve().then(a.bind(a,"a7TI")).then(e=>e.default),{loadableGenerated:{webpack:()=>["a7TI"]},ssr:!1}),ClinicLocatorEmbedCard=e=>{let{title:t,description:a,specialties:o,color:s,dataEventCategory:c}=e,u=(0,l.rZ)();return(0,n.BX)(r.K,{spacing:16,sx:e=>({".map-hhg-container":{display:"none"},[e.fn.largerThan("sm")]:{"#clinicLocator--content":{height:400}}}),children:[(t||a)&&(0,n.BX)(r.K,{spacing:8,className:"clinic-locator-header",children:[t&&(0,n.tZ)(i.T,{size:"h3",variant:"primary",children:t}),a&&(0,n.tZ)(i.T,{size:"p1",children:a})]}),(0,n.tZ)(d,{useMobileLayout:!0,className:"locator-map",specialties:o,defaultColor:s||u.fn.primaryColor(),dataEventCategory:c})]})}}}]);