"use strict";(self.webpackChunkhhgDiscoverV1=self.webpackChunkhhgDiscoverV1||[]).push([[3041],{"7/Cf":function(e,t,n){n.d(t,{dh:function(){return getHhgIdFromCookie},lT:function(){return getSubotCookieId},VV:function(){return getUserIdFromCookie},Us:function(){return getUserInfoFromCookie}});var i=n("iVi/"),o=n("p46w"),r=n.n(o),a=n("Q6jF"),c=n("9brV"),l=window.atob&&window.atob.bind(window)||function(e){let t=String(e).replace(/=+$/,"");if(t.length%4==1)throw Error("'atob' failed: The string to be decoded is not correctly encoded.");let n="";for(let e=0,i=0,o,r=0;o=t.charAt(r++);~o&&(i=e%4?64*i+o:o,e++%4)&&(n+=String.fromCharCode(255&i>>(-2*e&6))))o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return n};let getUserIdFromCookie=e=>{let t=i.parse(e||""),n=t[c.ty],o=n||r().get(c.ty)||"";try{let e=o.split(".")[1],t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(l(t).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(n).sub}catch(e){return""}},getUserInfoFromCookie=e=>{let t=i.parse(e||""),n=t[c.ty],o=n||r().get(c.ty)||"";try{let e=o.split(".")[1],t=e.replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(l(t).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join("")),i=JSON.parse(n);return{email:i.email,id:i.sub}}catch(e){return{email:"",id:0}}},getHhgIdFromCookie=e=>{let t=i.parse(e||""),n=t["hhg-id"];return n||r().get("hhg-id")||""},getSubotCookieId=e=>{if(e)return r().set("hhg-id",e),e;let t=getHhgIdFromCookie();if(t)return t;let n=(0,a.A)();return r().set("hhg-id",n),n}},"4Spt":function(e,t,n){n.r(t),n.d(t,{default:function(){return AppLegacyWrapper}});var i=n("BGKE"),o=n("+OUp"),r=n("+m3q"),a=n("VoJx"),c=n.n(a),l=n("k3v3"),s=n.n(l),u=n("99+y"),d=n.n(u),m=n("3oGN"),h=n.n(m),g=n("8BcA"),v=n("+QaA"),p=n.n(v),I=n("13Ln"),_=n.n(I),f=n("5Bip"),y=n.n(f),E=n("11iF"),L=n.n(E),A=n("s3Wo"),b=n.n(A);g.extend(p()),g.extend(L()),g.extend(b()),g.extend(y()),g.extend(_());var k=n("imPi"),w=n("bGjd");let AppHeightListener=()=>(!function(){let{isMobile:e}=(0,w.lm)();(0,o.useEffect)(()=>{let t=document.documentElement,setAppHeight=()=>{k.$.mutate(()=>{t.style.setProperty("--app-height","".concat(window.innerHeight,"px"))})};if(e)return setAppHeight(),window.addEventListener("resize",setAppHeight,{passive:!0}),()=>window.removeEventListener("resize",setAppHeight);k.$.mutate(()=>{t.style.removeProperty("--app-height")})},[e])}(),null);var S=n("3Yr3"),T=n("8z4i"),C=n("yNk5");(async()=>{"IntersectionObserver"in window||await n.e(5127).then(n.t.bind(n,"Wr5T",23))})(),(0,r.g)({DISCOVER_API:"https://wp.hellobacsi.com/",INTERNAL_DISCOVER_API:C.env.WP_INTERNAL_API,TOGETHER_API:"https://together.hellohealthgroup.com/",CARE_API:"https://health-care.hellohealthgroup.com/",SIDIS_TEMPLATE_API:"https://sidis-template-be.hellohealthgroup.com/",SIDIS_API:"https://producer-sidis.hellohealthgroup.com/",SIDIS_API_GET:"https://api-internal-sidis.hellohealthgroup.com/",SSO_API:"https://id.hellobacsi.com/",LOCALE:"vi-VN",DEPLOY_ENV:"production",LEAD_API:"https://lead.hellohealthgroup.com/",SUBOT_API:"https://subot.hellohealthgroup.com/frontend/api/",INTERNAL_SUBOT_API:C.env.SUBOT_INTERNAL,SUBOT_URL:"https://subot.hellobacsi.com/"}),history.scrollRestoration&&(history.scrollRestoration="manual");let O=c()(()=>Promise.all([n.e(1813),n.e(1809),n.e(1509),n.e(2808),n.e(4728),n.e(8666),n.e(2648),n.e(9681),n.e(2654),n.e(2584),n.e(9009),n.e(8874)]).then(n.bind(n,"c4O3")),{loadableGenerated:{webpack:()=>["c4O3"]}});function AppLegacyWrapper(e){let{Component:t,pageProps:n,err:r}=e;(0,o.useEffect)(()=>{var e,t;(null==n?void 0:n.collectServerLogs)&&(console.group("Server Side NextJs Logs"),null===(e=(t=n.collectServerLogs).map)||void 0===e||e.call(t,(e,t)=>{console.log("".concat(t+1,". "),...e)}),console.groupEnd())},[]),(0,S.tN)(),(0,o.useEffect)(()=>{h().configure({showSpinner:!1}),setTimeout(()=>{d().events.on("routeChangeStart",()=>h().start())},100),d().events.on("routeChangeComplete",()=>h().done()),d().events.on("routeChangeError",()=>h().done())},[]);let a=t.LayoutComponent||O;return(0,i.FD)(i.FK,{children:[(0,i.Y)(T.EZ,{}),(0,i.Y)(s(),{children:(0,i.Y)("script",{id:"debug-bear-rum",async:!0,dangerouslySetInnerHTML:{__html:"(function () {\n const dbpr = 100;\n if (Math.random() * 100 > 100 - dbpr) {\n const d = 'dbbRum', w = window, o = document, a = addEventListener, scr = o.createElement('script');\n scr.async = true;\n w[d] = w[d] || [];\n w[d].push(['presampling', dbpr]);\n ['error', 'unhandledrejection'].forEach(function (t) {\n a(t, function (e) {\n w[d].push([t, e]);\n });\n });\n scr.src = 'https://cdn.debugbear.com/".concat("6SloummLPO3W",".js';\n o.head.appendChild(scr);\n }\n })();")}},"debug-bear-rum")}),(0,i.FD)(w.LB,{isMobileSSR:null==n?void 0:n.isMobileSsr,children:[(0,i.Y)(w.O4,{}),(0,i.Y)(AppHeightListener,{}),(0,i.Y)(a,{pageProps:n,children:(0,i.Y)(t,{...n,err:r})})]})]})}},wA0V:function(e,t,n){n.d(t,{m:function(){return useCurrentUrl}});var i=n("+OUp"),o=n("bPK4"),r=n("AG8C"),a=n("9brV");function useCurrentUrl(){let{locale:e,router:{asPath:t}}=(0,r.$)(),[n,c]=(0,i.useState)(()=>"".concat((0,o.oN)(e,!1)).concat(a.Jp).concat(t));return(0,i.useEffect)(()=>{c(window.location.href)},[t]),n}},"3Yr3":function(e,t,n){n.d(t,{IQ:function(){return g},QB:function(){return useTrackingGetFcmToken},Td:function(){return useTrackingClickButtonTemplate},VY:function(){return h},tN:function(){return useTrackingVisitSite},vA:function(){return useTrackingClickCarePathTemplate}});var i=n("+OUp"),o=n("dvDa"),r=n("p46w"),a=n.n(r),c=n("aVqH"),l=n("7/Cf"),s=n("9brV"),u=n("YhO6"),d=n("wA0V"),m=n("a5L+");let h=s.p8?"https://event-tracking.hellohealthgroup.com":"https://event-tracking-staging.hellohealthgroup.com",g={[u.n.Vietnam]:"hellobacsi",[u.n.Indonesia]:"hellosehat",[u.n.Thailand]:"hellokhunmor",[u.n.Malaysia]:"hellodoktor",[u.n.Taiwan]:"helloyishi",[u.n.Myanmar]:"hellosayarwon",[u.n.PhilippinesEnglish]:"hellodoctor",[u.n.Cambodia]:"hellokrupet",[u.n.India]:"helloswasthya",[u.n.PhilippinesTagalog]:"hellodoctor-fil",[u.n.Singapore]:"hellojiankang"};function useTrackingVisitSite(){let e=(0,d.m)();(0,i.useEffect)(()=>{var t;let n=(0,l.Us)();o.A.post(h+"/v1/custom-event/collect",{action:"start",source:"Discover",ga_client_id:a().get(s.pJ),site_code:g[c.Hg],email:n.email,account_id:n.id,data:{timestamp:new Date().toISOString(),page_url:e,window_id:(0,c.Q2)(),cookie_id:(0,l.lT)(),client_agent:(null===(t=navigator)||void 0===t?void 0:t.userAgent)||"",token:localStorage.getItem("fcm_token")||"",email:n.email,account_id:n.id}}).catch(console.log)},[])}function useTrackingGetFcmToken(){let e=(0,d.m)();return{trackingGetFcmToken:t=>{var n;if(localStorage.getItem("last_track")===t)return;let i=(0,l.Us)();o.A.post(h+"/v1/custom-event/collect",{action:"get_token",source:"Discover",ga_client_id:a().get(s.pJ),site_code:g[c.Hg],email:i.email,account_id:i.id,data:{timestamp:new Date().toISOString(),page_url:e,window_id:(0,c.Q2)(),cookie_id:(0,l.lT)(),client_agent:(null===(n=navigator)||void 0===n?void 0:n.userAgent)||"",token:t,email:i.email,account_id:i.id}}).then(()=>{localStorage.setItem("last_track",t)}).catch(console.log)}}}let useTrackingClickCarePathTemplate=()=>{let e=(0,d.m)(),t=(0,m.a)(),n=(0,i.useRef)(n=>{var i;let r=(0,l.Us)(),u=new Date().toISOString();o.A.post(h+"/v1/custom-event/collect",{action:"submit",source:"spotlight",ga_client_id:a().get(s.pJ),email:(null==r?void 0:r.email)||"",account_id:null==r?void 0:r.id,site_code:g[c.Hg],timestamp:u,data:{timestamp:u,url:e,window_id:(0,c.Q2)(),cookie_id:(0,l.lT)(),client_agent:(null===(i=navigator)||void 0===i?void 0:i.userAgent)||"",token:localStorage.getItem("fcm_token"),target_group:n,device_type:t?"mobile":"web"}}).catch(console.log)});return{trackUserClickCarePathTemplate:n.current}},useTrackingClickButtonTemplate=()=>{let e=(0,d.m)(),t=(0,m.a)(),n=(0,i.useRef)(n=>{var i;let r=(0,l.Us)(),u=new Date().toISOString();o.A.post(h+"/v1/custom-event/collect",{action:n,source:"landing_page",ga_client_id:a().get(s.pJ),email:(null==r?void 0:r.email)||"",account_id:null==r?void 0:r.id,site_code:g[c.Hg],timestamp:u,data:{timestamp:u,url:e,window_id:(0,c.Q2)(),cookie_id:(0,l.lT)(),client_agent:(null===(i=navigator)||void 0===i?void 0:i.userAgent)||"",token:localStorage.getItem("fcm_token"),device_type:t?"mobile":"web"}}).catch(console.log)});return{trackingClickButtonTemplate:n.current}}},"8z4i":function(e,t,n){n.d(t,{EZ:function(){return WaitInteractionListener},bq:function(){return useWaitInteraction}});var i=n("BGKE"),o=n("+OUp"),r=n("VNqU");let a=(0,r.vt)(e=>({isInteracted:!1,setIsInteracted:t=>e({isInteracted:t})})),WaitInteractionListener=()=>{let{setIsInteracted:e}=a();return(0,o.useEffect)(()=>{if(window.hhg_isInteracted){e(!0);return}function userInteracted(){e(!0),removeListeners()}function removeListeners(){document.removeEventListener("click",userInteracted),document.removeEventListener("keydown",userInteracted),document.removeEventListener("mousemove",userInteracted),document.removeEventListener("scroll",userInteracted),document.removeEventListener("touchstart",userInteracted)}return document.addEventListener("click",userInteracted),document.addEventListener("keydown",userInteracted),document.addEventListener("mousemove",userInteracted),document.addEventListener("scroll",userInteracted),document.addEventListener("touchstart",userInteracted),()=>{removeListeners()}},[]),(0,i.Y)("script",{async:!0,dangerouslySetInnerHTML:{__html:"\n ;(() => {\n function userInteracted() {\n window.hhg_isInteracted = true\n removeListeners()\n }\n // Add event listeners for different types of interactions\n document.addEventListener('click', userInteracted)\n document.addEventListener('keydown', userInteracted)\n document.addEventListener('mousemove', userInteracted)\n document.addEventListener('scroll', userInteracted)\n document.addEventListener('touchstart', userInteracted)\n\n // Optional: Remove event listeners after first interaction\n function removeListeners() {\n document.removeEventListener('click', userInteracted)\n document.removeEventListener('keydown', userInteracted)\n document.removeEventListener('mousemove', userInteracted)\n document.removeEventListener('scroll', userInteracted)\n document.removeEventListener('touchstart', userInteracted)\n }\n })()\n "}})},useWaitInteraction=e=>{let{isInteracted:t}=a(),[n,i]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{if(e){let t=setTimeout(()=>{i(!0)},e);return()=>{clearTimeout(t)}}},[e]),n||t}},mdEm:function(e,t,n){n.d(t,{CD:function(){return s},Qh:function(){return getActivityLevelList},_8:function(){return getActivityLevelShortLabel},e4:function(){return r},vL:function(){return a},zY:function(){return l}});var i,o,r,a,c=n("Wbba");(i=r||(r={})).DUE_DATE="due-date-calculator",i.BMI="bmi",i.BMR="bmr",i.OVULATION="ovulation",i.IFRAME="IFRAME",i.PWG="pregnancy-weight-gain",i.THR="heart-rate",i.BABY_VACCINE="vaccination-tool",i.BABY_GROWTH="baby-growth-tracking",i.BABY_POOP="baby-poop-checking",i.AIR_POPULATION="air-population-tool";let l={DUE_DATE:"due-date-calculator",BMI:"bmi",BMR:"bmr",OVULATION:"ovulation",IFRAME:"IFRAME",PWG:"pregnancy-weight-gain",THR:"heart-rate",BABY_VACCINE:"vaccination-tool",BABY_GROWTH:"baby-growth-tracking",BABY_POOP:"baby-poop-checking"};(o=a||(a={})).LOW_INTENSITY="low_intensity",o.MODERATE_INTENSITY="moderate_intensity",o.AEROBIC_INTENSITY="aerobic_intensity",o.VIGOROUS_INTENSITY="vigorous_intensity",o.MAXIMUM_INTENSITY="maximum_intensity";let getActivityLevelShortLabel=(e,t)=>{let n={low_intensity:t({id:"activityLevel.noExerciseShort"}),moderate_intensity:t({id:"activityLevel.oneThreeDaysShort"}),aerobic_intensity:t({id:"activityLevel.threeFiveDaysShort"}),vigorous_intensity:t({id:"activityLevel.sixSevenDaysShort"}),maximum_intensity:t({id:"activityLevel.routineShort"})};return n[e]||""},getActivityLevelList=e=>[{label:e({id:"activityLevel.noExercise",defaultMessage:"Little to no exercise"}),value:"low_intensity",point:1.2},{label:e({id:"activityLevel.oneThreeDays",defaultMessage:"Light exercise 1–3 days a week"}),value:"moderate_intensity",point:1.375},{label:e({id:"activityLevel.threeFiveDays",defaultMessage:"Medium exercise 3–5 days a week"}),value:"aerobic_intensity",point:1.55},{label:e({id:"activityLevel.sixSevenDays",defaultMessage:"Hard exercise 6–7 days a week"}),value:"vigorous_intensity",point:1.725},{label:e({id:"activityLevel.routine",defaultMessage:"Challenging exercise routine"}),value:"maximum_intensity",point:1.9}];l.DUE_DATE,c.C.getAssetPath("health-tools/due-date-icon.svg");let s="additional_questions"},imPi:function(e,t,n){n.d(t,{$:function(){return c}});var i=n("Sn6X"),o=n.n(i),r=n("KYiY"),a=n.n(r);let c=o().extend(a())}}]);