"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6885],{ytAX:function(e,t,i){i.d(t,{e_:function(){return h},a1:function(){return addMoreDataBMIAndSendToSidis},LM:function(){return generateBmiLevel},eo:function(){return generateBmiRedirect},eO:function(){return generateBmiUrlParamObj},pb:function(){return getBmiAdditionalQNA},v:function(){return getBmiLevel},XL:function(){return postBmiToSidis}});var a=i("LL/B"),l=i("XFb3"),o=i("p46w"),n=i.n(o),r=i("NFrr"),s=i.n(r),d=i("cr+I"),c=i("09QT"),u=i("oQBk"),g=i("rIrU"),m=i("9L6u");let BMI_ADDITIONAL_QUESTIONS_BY_NAME=e=>({question1:{id:1,value:e({id:"bmi.question.weightLossSupport",defaultMessage:"Are you interested in weight-loss treatment/support?"})},question2:{id:2,value:e({id:"bmi.question.glp1Awareness",defaultMessage:"Are you aware of GLP-1 treatment?"})},newsletter:{id:3,value:e({id:"bmi.newsletter.label",defaultMessage:"Stay in the loop, shed the weight: Get expert updates on weight loss treatments and support directly to your inbox"})}}),h="bmis",v={underweight:{id:"bmi.result.underweight",defaultMessage:"Underweight",color:l.t.blue[6],score:1,male:{inactiveImage:"/images/bmi-underweight-male-inactive.svg",activeImage:"/images/bmi-underweight-male-active.svg"},female:{inactiveImage:"/images/bmi-underweight-female-inactive.svg",activeImage:"/images/bmi-underweight-female-active.svg"}},healthy:{id:"bmi.result.healthy",defaultMessage:"Healthy",color:l.t.green[6],score:2,male:{inactiveImage:"/images/bmi-healthy-male-inactive.svg",activeImage:"/images/bmi-healthy-male-active.svg"},female:{inactiveImage:"/images/bmi-healthy-female-inactive.svg",activeImage:"/images/bmi-healthy-female-active.svg"}},overweight:{id:"bmi.result.overweight",defaultMessage:"Overweight",color:l.t.yellow[6],score:3,male:{inactiveImage:"/images/bmi-overweight-male-inactive.svg",activeImage:"/images/bmi-overweight-male-active.svg"},female:{inactiveImage:"/images/bmi-overweight-female-inactive.svg",activeImage:"/images/bmi-overweight-female-active.svg"}},obese_level:{id:"bmi.result.obese",defaultMessage:"Obese",color:l.t.yellow[9],score:4,male:{inactiveImage:"/images/bmi-obese_level_1-male-inactive.svg",activeImage:"/images/bmi-obese_level_1-male-active.svg"},female:{inactiveImage:"/images/bmi-obese_level_1-female-inactive.svg",activeImage:"/images/bmi-obese_level_1-female-active.svg"}},obese_level_1:{id:"bmi.result.obese1",defaultMessage:"Obese 1",color:l.t.yellow[9],score:4,male:{inactiveImage:"/images/bmi-obese_level_1-male-inactive.svg",activeImage:"/images/bmi-obese_level_1-male-active.svg"},female:{inactiveImage:"/images/bmi-obese_level_1-female-inactive.svg",activeImage:"/images/bmi-obese_level_1-female-active.svg"}},obese_level_2:{id:"bmi.result.obese2",defaultMessage:"Obese 2",color:l.t.red[8],score:5,male:{inactiveImage:"/images/bmi-obese_level_2-male-inactive.svg",activeImage:"/images/bmi-obese_level_2-male-active.svg"},female:{inactiveImage:"/images/bmi-obese_level_2-female-inactive.svg",activeImage:"/images/bmi-obese_level_2-female-active.svg"}},obese_level_3:{id:"bmi.result.obese3",defaultMessage:"Obese 3",color:l.t.red[9],score:6,male:{inactiveImage:"/images/bmi-obese_level_3-male-inactive.svg",activeImage:"/images/bmi-obese_level_3-male-active.svg"},female:{inactiveImage:"/images/bmi-obese_level_3-female-inactive.svg",activeImage:"/images/bmi-obese_level_3-female-active.svg"}}},p={underweight:[0,18.5],healthy:[18.5,23],overweight:[23,25],obese_level_1:[25,30],obese_level_2:[30,999]},updateRange=e=>{if(e&&(p={underweight:[0,e.underweight],healthy:[e.underweight,e.healthy],overweight:[e.healthy,e.overweight],obese_level_1:[e.overweight,e.obese_level_1],obese_level_2:[e.obese_level_1,e.obese_level_2||999],...e.obese_level_2?{obese_level_3:[e.obese_level_2,e.obese_level_3||999]}:{}},!(null==e?void 0:e.obese_level_1)&&!(null==e?void 0:e.obese_level_2)&&!(null==e?void 0:e.obese_level_3))){p.obese_level=[e.overweight,999],delete p.obese_level_1,delete p.obese_level_2,delete p.obese_level_3;return}};function getBmiLevel(e,t,i){if(!e||!t)return 1;let a=1;updateRange(i);let l=p;return Object.keys(l).forEach(t=>{let i=l[t];i&&s()(e,i[0],i[1])&&(a=v[t].score)}),a}function generateBmiLevel(e){let{f:t,gender:i,bmiValue:a,bmiRange:l}=e;updateRange(l);let o=p,n=Object.keys(o),r=Object.values(o),s=r[r.length-1][0]-r[0][0]+5,d=[];return{activePercent:Math.floor(void 0!==a?a/s*100:0),conditions:n.map((e,l)=>{let r;let c=o[e],u=v[e],g=l===n.length-1;if(!c)return;let m=c[0].toString(),h=c[1].toString();r=g?"> "+m:"0"===m?"< "+h:"".concat(m).concat(" - ").concat((100*+h-10)/100);let p={isActive:!1,value:c[0],valueKey:e,score:null==u?void 0:u.score,image:"",title:t({id:u.id,defaultMessage:u.defaultMessage}),description:r,color:u.color,percent:0,milestone:m.toString()+(g?"+":"")};p.isActive=void 0!==a&&c[0]<=a&&ae+=t,0))*100)/100),p.percent=b,p}).filter(Boolean)}}function generateBmiUrlParamObj(e){return{result:1,[a.Q.gender]:(0,m.QX)(e.gender),[a.Q.age]:e.age,[a.Q.height]:e.height,[a.Q.weight]:e.weight,joincommunity:1,[a.Q.yourself]:Number(!!e.isCheckYourself),[a.Q.activityLevel]:e.activityLevel}}function generateBmiRedirect(e,t){let i=d.stringifyUrl({url:e,query:generateBmiUrlParamObj(t)},{skipEmptyString:!0,skipNull:!0});return i}function addMoreDataBMIAndSendToSidis(e,t){let{articleCategories:i,positionType:a,additionalQuestion:l}=t,o={...e,source_url:window.location.href,height:parseFloat(e.height||""),weight:parseFloat(e.weight||""),device_type:"web",...(null==e?void 0:e.isCheckYourself)&&{is_my_self:1},...Array.isArray(l)&&l.length>0&&{additional_questions:l}};return void 0!==o.isCheckYourself&&delete o.isCheckYourself,i&&(o.categories=i.map(e=>({name:e.name||"",permalink:e.permalink||"",term_id:e.termId||"",text_color:e.textColor||""}))),a&&(o.position_type=a),o}function postBmiToSidis(e,t){let i=(null==t?void 0:t.score_level)||getBmiLevel(null==t?void 0:t.bmi,e),a=(null==t?void 0:t.ga_client_id)||n().get("_ga")||"",l=(null==t?void 0:t.site_id)||parseInt(g.CX[e].SITE_ID),o=(null==t?void 0:t.submited_at)||new Date().toISOString(),r={age:Number(null==t?void 0:t.age),gender:(null==t?void 0:t.gender)==="male",height:null==t?void 0:t.height,weight:null==t?void 0:t.weight,additional_questions:(null==t?void 0:t.additional_questions)||[],objective:1,account_id:t.account_id,ga_client_id:a,site_id:l,email:t.email,score_level:i,score:null==t?void 0:t.bmi,submited_at:o,categories:null==t?void 0:t.categories,position_type:null==t?void 0:t.position_type,device_type:null==t?void 0:t.device_type,is_my_self:null==t?void 0:t.is_my_self,active_level:null==t?void 0:t.active_level,url:window.location.href,source_url:null==t?void 0:t.source_url};return(0,c.d)(u.y.SIDIS.POST_SIDIS_BMI,{method:"POST",data:r},"sidis_update")}function getBmiAdditionalQNA(e,t){let i=BMI_ADDITIONAL_QUESTIONS_BY_NAME(e);return["question1","question2","newsletter"].map(e=>{let a=t[e];return{question:i[e],answer:{id:i[e].id,value:"1"===a||!0===a?"Yes":"No"}}})}},HmHl:function(e,t,i){i.d(t,{Bc:function(){return n},Ue:function(){return r},XN:function(){return d},jx:function(){return o},vw:function(){return c},wy:function(){return s}});var a=i("rBCA"),l=i("uuQu");let o=(0,a.Z)("div",{target:"e1xh3v8x0"})(l.M.mbUp,"{padding-left:16px;padding-right:16px;}padding-bottom:60px;&.baby-growth{padding-bottom:0;}"),n=(0,a.Z)("div",{target:"e1xh3v8x1"})("& >:not(:last-child){margin-bottom:28px;}"),r=(0,a.Z)("div",{target:"e1xh3v8x2"})(l.M.mbUp,"{padding-left:16px;padding-right:16px;}"),s=(0,a.Z)("div",{target:"e1xh3v8x3"})("padding-top:32px;& > div{margin-bottom:24px;}",l.M.mbUp,"{padding-left:16px;padding-right:16px;}"),d=(0,a.Z)("div",{target:"e1xh3v8x4"})("margin:32px 0 10px 0;"),c=(0,a.Z)("img",{target:"e1xh3v8x5"})("position:absolute;top:0;bottom:0;left:0;width:24px;height:24px;margin:auto;cursor:pointer;")},OPxG:function(e,t,i){i.r(t),i.d(t,{BMIToolPage:function(){return BMIToolPage}});var a=i("BGKE"),l=i("q1tI"),o=i("1HUI"),n=i("LL/B"),r=i("p46w"),s=i.n(r),d=i("dDsW"),c=i("09QT"),u=i("oQBk"),g=i("CJtR"),m=i("g/tz"),h=i("ouLS"),v=i("Y/XE"),p=i("bLQg"),b=i("gNV7"),f=i("2su4"),y=i("hXNO"),_=i("P5LW"),S=i("rIrU"),T=i("8vdq"),w=i("gwk1"),I=i("05Ua"),Z=i("o0qI"),R=i("9O6x"),B=i("wp0n"),x=i("8vDj"),C=i("OAL+"),M=i("K27U"),L=i("0njy");let FAQScreen=e=>{let{bmrData:t}=e,{formatMessage:i}=(0,d.Z)(),l=(0,x.rZ)(),o=null==t?void 0:t.bmiResult,n=null==o?void 0:o.community,r=o.faqs;return n||r?(0,a.BX)(C.K,{children:[n&&(0,a.BX)(C.K,{spacing:24,children:[(0,a.BX)(C.K,{spacing:8,children:[(0,a.tZ)(B.T,{size:"s1",weight:"semiBold",color:l.colors.gray[8],children:null==n?void 0:n.title}),(0,a.tZ)(B.T,{size:"p4",color:l.colors.gray[6],children:null==n?void 0:n.description})]}),(0,a.tZ)(L.EmbeddedCommunity.HealthTool,{community:n,style:{marginTop:0}})]}),r&&r.length>0&&(0,a.tZ)(M.e,{expandFirst:!0,faqs:r,titleProps:{icon:(0,a.tZ)("img",{style:{height:"16px",width:"16px"},src:"".concat(S.Nr,"/info-icon.svg"),alt:"",loading:"lazy"}),headingTitle:i({id:"tools.faqs",defaultMessage:"FAQs"})}})]}):null};var k=i("Eso5"),N=i("mYVa"),A=i("SPK5"),O=i("0D4Z"),D=i("HgWy"),P=i("1+YQ"),E=i("sKr0"),F=i("9L6u"),Q=i("Xbyz");let GeneralResultScreen=e=>{var t,i,l,o,r,s,d,c,u;let{loading:g,bmiLink:m,bmiContent:h,bmrData:v}=e,{bmi:p=0,gender:b="male"}=v||{},f=(0,x.rZ)(),_=(0,y.d)(),S="".concat(m,"?").concat(n.Q.bmi,"=").concat(p,"&").concat(n.Q.gender,"=").concat((0,F.QX)(b));return v||g?(0,a.BX)(C.K,{sx:{gap:16},children:[(0,a.BX)(C.K,{spacing:16,children:[(0,a.tZ)(k.x,{sx:{[f.fn.largerThan("sm")]:{backgroundColor:"#fff",borderRadius:12,padding:"".concat((0,N.h)(24)," ").concat((0,N.h)(40)," ").concat((0,N.h)(24))}},children:(0,a.tZ)(D.M,{loading:g,bmi:parseFloat(((null==v?void 0:v.bmi)||"").toString()),conditions:(null==v?void 0:null===(t=v.bmiLevels)||void 0===t?void 0:t.conditions)||[],activePercent:null==v?void 0:null===(i=v.bmiLevels)||void 0===i?void 0:i.activePercent,activeCond:null==v?void 0:v.activeCond})}),!_&&(0,a.tZ)(A.k,{justify:"center",children:g?(0,a.tZ)(O.O,{width:246,height:36,radius:24}):(0,a.tZ)(E.n.BottomNavHorizonal,{bgColor:"#fff",shareUrl:S,showFull:!0,iconSize:24,styles:{heading:{fontSize:12},copyRoot:{input:{border:0}},wrapper:{paddingRight:40},controls:{overflow:"hidden"}}})})]}),(0,a.tZ)(Q.k.Bmi,{loading:g,recommendMaxWeight:(null==v?void 0:v.recommendMaxWeight)||"",recommendMinWeight:(null==v?void 0:v.recommendMinWeight)||"",calories:null==v?void 0:v.calories,ctaText:null==h?void 0:null===(l=h.customWeightGainBanner)||void 0===l?void 0:l.buttonText,ctaColor:null==h?void 0:null===(o=h.customWeightGainBanner)||void 0===o?void 0:o.buttonColor,ctaUrl:null==h?void 0:null===(r=h.customWeightGainBanner)||void 0===r?void 0:r.link,sx:{height:"100%",".mantine-WeightManagement-goalFooter":{height:"100%",justifyContent:"space-between"},".mantine-WeightManagement-btn":{width:"100%"}}}),(null==h?void 0:null===(s=h.additionalInfo)||void 0===s?void 0:s.image)&&(0,a.tZ)(P.M,{loading:g,ctaUrl:null==h?void 0:null===(d=h.additionalInfo)||void 0===d?void 0:d.ctaUrl,image:null==h?void 0:null===(c=h.additionalInfo)||void 0===c?void 0:c.image,imageMobile:null==h?void 0:null===(u=h.additionalInfo)||void 0===u?void 0:u.imageMobile})]}):null};var X=i("ytAX"),U=(0,i("/npG").k)(e=>({root:{[e.fn.largerThan("sm")]:{".mantine-HealthToolFormWrapper__FormRow-root":{paddingLeft:0,paddingRight:0}}},actions:{paddingTop:16,[e.fn.largerThan("sm")]:{position:"sticky",left:0,right:0,bottom:0,backgroundColor:"#fff",zIndex:1,paddingBottom:24,paddingTop:24}},btn:{width:"100%"}})),G=i("J+gj"),H=i("Vvt1"),z=i.n(H),q=i("GnTU"),K=i("0L5m"),W=i("HmHl");let V=z()(()=>Promise.all([i.e(2138),i.e(9467),i.e(4467),i.e(6966),i.e(5243),i.e(8132),i.e(1375),i.e(4561),i.e(1448),i.e(5465),i.e(1217),i.e(5480),i.e(731),i.e(2050),i.e(2008),i.e(8469),i.e(8214),i.e(1482),i.e(6817),i.e(467),i.e(5951),i.e(9357),i.e(747),i.e(5675),i.e(6753),i.e(4802),i.e(3046),i.e(5745),i.e(3437),i.e(252),i.e(6839),i.e(9424),i.e(5702),i.e(8922),i.e(6399),i.e(553),i.e(2902),i.e(4969),i.e(3257),i.e(6611),i.e(7538),i.e(6894),i.e(5341),i.e(4846),i.e(2233),i.e(1058),i.e(3295),i.e(1538),i.e(7152),i.e(5684),i.e(2574),i.e(9884),i.e(7644),i.e(6962),i.e(8767),i.e(6638),i.e(7741),i.e(3434),i.e(2433),i.e(5385),i.e(3564),i.e(7082),i.e(3158),i.e(5641),i.e(7454),i.e(7004),i.e(4758),i.e(6219),i.e(17),i.e(8990),i.e(4067),i.e(9487),i.e(9083),i.e(1520),i.e(270),i.e(7596),i.e(8217),i.e(7543),i.e(2835),i.e(2507),i.e(6885),i.e(7859),i.e(690),i.e(2730),i.e(6287),i.e(7682),i.e(1551),i.e(4870),i.e(9922),i.e(3133),i.e(612),i.e(2002),i.e(1880),i.e(7471),i.e(7165),i.e(5451),i.e(8612)]).then(i.bind(i,"XRSz")).then(e=>e.ToolsChart),{loadableGenerated:{webpack:()=>["XRSz"]},ssr:!1}),ComparisonChart=e=>{var t,i,o,n;let{bmiResult:r,activeCond:s,bmi:c}=e,{formatMessage:u}=(0,d.Z)(),g=(0,x.rZ)(),m=(0,y.d)(),h=(0,l.useMemo)(()=>r.chartData.findIndex(e=>e.bmi+""==Math.round(parseFloat(String(c)))+""),[]),v=(0,l.useMemo)(()=>{var e;return Math.round((null!==(e=r.chartData.reduce((e,t,i)=>i>h?{bmi:t.bmi,percent:e.percent+t.percent}:{bmi:t.bmi,percent:e.percent},{percent:0,bmi:c}).percent)&&void 0!==e?e:0)*100)},[]),p=(0,l.useMemo)(()=>{var e;return Math.round((null!==(e=r.chartData.reduce((e,t,i)=>iu({id:"bmi.result.chart.shortenDescription",defaultMessage:"In a group of people of your sex and age, {higher}% have higher BMI than you and {lower}% have lower BMI than you."},{higher:v,lower:p}),[]),f=[{heading:u({id:"tools.condition"}),content:null==r?void 0:null===(i=r.assessmentData)||void 0===i?void 0:null===(t=i[0])||void 0===t?void 0:t.content,icon:(0,a.tZ)(G.Z,{size:m?16:20,color:g.fn.primaryColor()})},{icon:(0,a.tZ)(K.Z,{isOutline:!0,size:m?16:20}),heading:u({id:"tools.risks"}),content:null==r?void 0:null===(n=r.assessmentData)||void 0===n?void 0:null===(o=n[1])||void 0===o?void 0:o.content}];return(0,a.BX)(k.x,{children:[r.chartData&&r.chartData.length>0&&(0,a.tZ)(W.Ue,{children:(0,a.tZ)(V,{highlightBmi:String(c),chartData:r.chartData,chartDescription:b,color:s.color})}),(0,a.tZ)(C.K,{spacing:(0,N.h)(16),className:"risk-and-condition",children:m?(0,a.tZ)(M.e,{faqs:f.map(e=>({title:(0,a.BX)(A.k,{gap:8,align:"center",children:[e.icon,(0,a.tZ)(B.T,{size:"title2",children:e.heading})]}),description:e.content}))}):f.map((e,t)=>(0,a.tZ)(q.T,{...e,className:"risk-item"},String(t)))})]})},RiskAndConditionTools=e=>{var t,i,l,o;let{bmrData:n}=e,{locale:r}=(0,_.h)(),s=(0,x.rZ)();if(!n)return null;let d=Number((null===(i=n.calories)||void 0===i?void 0:null===(t=i.bmi)||void 0===t?void 0:t.minWeight)||0).toLocaleString(r),c=Number((null===(o=n.calories)||void 0===o?void 0:null===(l=o.bmi)||void 0===l?void 0:l.maxWeight)||0).toLocaleString(r),u={bmiResult:n.bmiResult,activeCond:n.activeCond,bmi:Number(n.bmi),recommendMinWeight:d,recommendMaxWeight:c};return(0,a.tZ)(k.x,{sx:{[s.fn.largerThan("sm")]:{".risk-and-condition":{flexDirection:"row",marginTop:40},".risk-item":{backgroundColor:"#fff",borderRadius:8,width:"50%"}}},children:(0,a.tZ)(ComparisonChart,{...u})})};var j=i("AlNH"),Y=i("uuQu"),J=i("ns0B"),$=i.n(J),ee=i("MP3q"),et=i("UJaG"),ei=i("M1QZ"),ea=i("NeDJ"),el=i("KBam"),eo=i("wCSE");let ArticleListing=e=>{let{listing:t,title:i,description:o}=e,{locale:n}=(0,_.h)(),r=(0,l.useMemo)(()=>(0,g.UC)(n),[n]),s=(0,x.rZ)(),d=(0,y.d)();return 0===t.length?null:(0,a.BX)(a.HY,{children:[(0,a.BX)(C.K,{spacing:24,children:[(0,a.BX)(C.K,{spacing:8,children:[(0,a.tZ)(B.T,{size:"s1",weight:"semiBold",color:s.colors.gray[8],children:i}),(0,a.tZ)(B.T,{size:"p4",color:s.colors.gray[6],children:o})]}),(0,a.tZ)(k.x,{sx:{[s.fn.smallerThan("sm")]:{marginLeft:-16,marginRight:-16}},children:(0,a.tZ)(ei.Z,{alwayShowProgressMobile:!0,slideSize:"100%",slideGap:16,slidesToScroll:1,withControls:!1,breakpoints:[{maxWidth:Y.B.BREAK_POINT_TABLET,slideSize:1===t.length?"100%":"80%",slideGap:24}],styles:e=>({viewport:{[e.fn.smallerThan("sm")]:{paddingLeft:16,paddingRight:16}}}),children:(0,a.BX)(C.K,{spacing:24,children:[(0,a.tZ)(k.x,{sx:{[s.fn.largerThan("sm")]:{backgroundColor:"#fff",borderRadius:16,padding:16}},children:(0,a.tZ)(ei.Z.Body,{children:(0,a.tZ)(ea.C,{itemsPerGroup:3,breakpoints:{base:{itemsPerGroup:1},md:{itemsPerGroup:3}},GroupWrapper:e=>(0,a.tZ)(ei.Z.Slide,{children:e}),items:t.map((e,t)=>{let i=(0,el.kO)({article:e,locale:n,version:"short"});return(0,a.tZ)(k.x,{sx:{[s.fn.largerThan("sm")]:{...t%3!=0&&{paddingTop:16,marginTop:8,borderTop:"1px solid ".concat(s.colors.neutral[1])},".cardArticleContent":{gap:8}}},children:(0,a.tZ)(ee.p,{disableBookmark:!0,moveAuthorIntoContent:!d,type:d?"vertical":"horizontalFooter",item:{ID:parseInt("".concat(e.id)),image:e.featureImage,image1x1:e.featureImageWithRatio1x1,permalink:e.permalink,title:$()(e.postTitle||e.postName||""),category:e.category,author:{name:(0,a.tZ)(et.x,{...i,formatOptionsProps:{expert_display_name:{"data-event-category":"Tool Category","data-event-action":"See Doctor","data-event-label":"".concat(r).concat(S.sb).concat(i.avatar_permalink)}}}),avatar:i.avatar,avatarAlt:i.avatar_alt,permalink:i.avatar_permalink,indicator:i.indicator}},itemTracking:{image:{"data-event-category":"Recommend Category","data-event-action":"Category Article Title","data-event-label":"".concat(r).concat(S.sb).concat(e.permalinkDecode)},title:{"data-event-category":"Recommend Category","data-event-action":"Category Article Title","data-event-label":"".concat(r).concat(S.sb).concat(e.permalinkDecode)},category:{"data-event-category":"Recommend Category","data-event-action":"Category Title","data-event-label":"".concat(r).concat(S.sb).concat(e.category.permalinkDecode)},authorAvatar:{"data-event-category":"Recommend Category","data-event-action":"See Doctor","data-event-label":"".concat(r).concat(S.sb).concat(i.avatar_permalink)}}})},"".concat(t))})})})}),(0,a.tZ)(k.x,{sx:{[s.fn.smallerThan("sm")]:{paddingLeft:16,paddingRight:16}},children:(0,a.BX)(ei.Z.Footer,{children:[(0,a.tZ)(ei.Z.Progress,{}),(0,a.BX)(ei.Z.Controls,{children:[(0,a.tZ)(ei.Z.Control,{direction:"prev","data-event-category":"Recommend Category","data-event-action":" See More Article","data-event-label":"".concat(r).concat(S.sb),color:"gray"}),(0,a.tZ)(ei.Z.Control,{direction:"next","data-event-category":"Recommend Category","data-event-action":"See More Article","data-event-label":"".concat(r).concat(S.sb),color:"gray"})]})]})})]})})})]}),(0,a.tZ)(eo.P,{})]})};var en=i("C/sX"),er=i("iBNF"),es=i("iuhU"),ed=i("QM8a"),ec=i("oGOP");let ToolCard=e=>{let{item:t,showIconPhone:i,...l}=e,{link:o,icon:n,title:r}=t,s=!!(null==t?void 0:t.isMobileAppTool),d=(0,x.rZ)();return(0,a.BX)(k.x,{component:"a",href:o,target:"_blank",className:(0,es.default)("relatedTool--card flex items-center gap-4 p-3 pr-4","relative bg-white rounded-lg","md:flex-col md:items-start md:min-h-[128px] md:h-full","[&+&]:max-md:mt-2"),...l,sx:{transition:"transform 0.2s",[d.fn.largerThan("sm")]:{"&:hover":{transform:"translateY(-5px)"}}},children:[(0,a.tZ)(k.x,{className:(0,es.default)("relatedTool--icon relative w-10 h-10 bg-neutral50 rounded-[50%] overflow-hidden p-1","max-md:flex max-md:items-center"),children:(0,a.tZ)("img",{loading:"lazy",src:n,alt:r,className:(0,es.default)("relatedTool--icon_img z-[2] relative")})}),(0,a.BX)("div",{className:(0,es.default)("relatedTool--card_content","md:min-h-0 md:flex-1 md:flex md:items-center md:flex-wrap"),children:[(0,a.tZ)(B.T,{as:"span",size:"p2",color:er.r.colors.gray800,className:"m-0 w-full block",children:r}),s&&(0,a.BX)(A.k,{gap:(0,N.h)(6),align:"center",py:(0,N.h)(5),children:[(0,a.tZ)(ed.Z,{className:"text-base leading-none w-[1em] h-[1em]"}),(0,a.tZ)(B.T,{as:"span",size:"n1",color:er.r.colors.blue800,children:"Hello Bacsi app"})]})]}),s&&i&&(0,a.tZ)(A.k,{w:(0,N.h)(32),h:(0,N.h)(32),align:"center",justify:"center",className:"absolute top-0 right-0 p-[6px] text-xl leading-none",children:(0,a.tZ)(ec.Z,{className:"w-[1em] h-[1em]"})})]})},MoreTool=e=>{let{listing:t,title:i,description:l,color:o}=e,n=(0,x.rZ)();return 0===t.length?null:(0,a.BX)(C.K,{spacing:12,sx:{[n.fn.smallerThan("sm")]:{backgroundColor:n.colors.neutral[0],marginLeft:-16,marginRight:-16,padding:16}},children:[(0,a.BX)(C.K,{spacing:8,children:[(0,a.tZ)(B.T,{size:"s1",weight:"semiBold",color:n.colors.gray[8],children:i}),(0,a.tZ)(B.T,{size:"p4",color:n.colors.gray[6],children:l})]}),(0,a.tZ)(ei.Z,{slideSize:"100%",slideGap:8,slidesToScroll:1,withControls:!0,arrowColor:o,children:(0,a.tZ)(C.K,{spacing:24,children:(0,a.tZ)(ei.Z.Body,{children:(0,a.tZ)(ea.C,{breakpoints:{base:{itemsPerGroup:t.length,GroupWrapper:e=>(0,a.tZ)(ei.Z.Slide,{children:(0,a.tZ)(en.r,{gutter:8,children:e})}),ItemWrapper:e=>(0,a.tZ)(en.r.Col,{span:12,children:e})},md:{itemsPerGroup:3,GroupWrapper:e=>(0,a.tZ)(ei.Z.Slide,{sx:{paddingTop:5},children:(0,a.tZ)(en.r,{gutter:8,children:e})}),ItemWrapper:e=>(0,a.tZ)(en.r.Col,{span:4,children:e})}},items:t.map((e,t)=>(0,a.tZ)(ToolCard,{item:e},String(t)))})})})})]})};var eu=i("+4HH"),eg=i("EoPH");let VideoItemListing=e=>{let{videos:t,onlyTypeVideo:i}=e,l=(0,x.rZ)();return(0,a.tZ)(k.x,{sx:{[l.fn.smallerThan("sm")]:{marginLeft:-16,marginRight:-16}},children:(0,a.tZ)(ei.Z,{containScroll:"trimSnaps",slideSize:"auto",slideGap:12,align:"start",withControls:!0,breakpoints:[{maxWidth:Y.B.BREAK_POINT_TABLET,slideSize:1===t.length?"100%":"auto",slideGap:24}],styles:()=>({viewport:{paddingLeft:16,paddingRight:16}}),children:(0,a.tZ)(C.K,{spacing:24,sx:()=>({marginLeft:-16,marginRight:-16}),children:(0,a.tZ)(ei.Z.Body,{children:(t||[]).map((e,t)=>(0,a.tZ)(ei.Z.Slide,{children:(0,a.tZ)(eu.V,{data:e,dataEventCategory:"Recommend Video",dataEventAction:"Video Click ".concat(t+1),styles:{root:{borderRadius:8,width:e.type===eg.V.SHORTS?103:330,[l.fn.largerThan("sm")]:{width:i?420:e.type===eg.V.SHORTS?160:515}},title:{[l.fn.largerThan("sm")]:{fontSize:(0,N.h)(14),lineHeight:(0,N.h)(22)}}}})},String(t)))})})})})};var em=i("KX2h");let VideoLibrary=e=>{let{videoList:t}=e,[i,o]=(0,l.useState)([]),[n,r]=(0,l.useState)(!1),s=(0,l.useCallback)(async()=>{try{r(!0);let e=await Promise.all(t.map(e=>(0,c.d)(u.y.TOGETHER.FETCH_PREVIEW,{method:"POST",data:{link:e.urlVideo}},"together")));r(!1);let i=e.map((e,i)=>{let a={id:i,videoId:String(i),url:t[i].urlVideo,title:t[i].videoTitle||e.title,description:"",type:eg.V.VIDEO,totalView:0,createTime:"",duration:0,image:t[i].image||"",imageMedium:t[i].image||"",imageThumbnail:t[i].image||"",active:!1,articleLink:""};return a}).filter(Boolean);i.length>0&&o(i)}catch(e){console.log(e),r(!1)}},[]);return(0,l.useEffect)(()=>{t.length>0&&s()},[t]),n?(0,a.tZ)(em.g,{}):i.length>0?(0,a.tZ)(a.HY,{children:(0,a.tZ)(VideoItemListing,{onlyTypeVideo:!0,videos:i})}):null},VideoListing=e=>{let{title:t,videos:i=[],videoUrl:l=[]}=e,o=(0,x.rZ)();return 0===i.length&&0===l.length?null:(0,a.BX)(k.x,{sx:{[o.fn.largerThan("sm")]:{backgroundColor:"#fff",borderRadius:16}},children:[(0,a.tZ)(k.x,{sx:{[o.fn.largerThan("sm")]:{padding:"".concat((0,N.h)(10)," ").concat((0,N.h)(16)),borderBottom:"1px solid ".concat(o.colors.neutral[1])}},children:(0,a.tZ)(B.T,{size:"s2",children:t})}),(0,a.tZ)(k.x,{sx:{padding:16},children:i.length>0?(0,a.tZ)(VideoItemListing,{videos:i}):l.length>0?(0,a.tZ)(VideoLibrary,{videoList:l}):null})]})},SuggestToolsAndArticleScreen=e=>{var t,i,l,o,n,r,s;let{bmrData:d,color:c}=e;if(!d)return null;let u=null==d?void 0:null===(t=d.bmiResult)||void 0===t?void 0:t.helpfulTips;return(0,a.BX)(C.K,{spacing:24,children:[(0,a.tZ)(MoreTool,{color:c,title:u.relatedTool.title,description:u.relatedTool.description,listing:u.relatedTool.healthtools||[]}),(0,a.tZ)(ArticleListing,{title:null==d?void 0:null===(i=d.bmiResult.suggestedArticles)||void 0===i?void 0:i.title,description:null==d?void 0:null===(l=d.bmiResult.suggestedArticles)||void 0===l?void 0:l.description,listing:(null==d?void 0:null===(o=d.bmiResult.suggestedArticles)||void 0===o?void 0:o.articles)||[]}),(0,a.tZ)(j.V,{content:(0,a.tZ)("div",{dangerouslySetInnerHTML:{__html:"C\xe1c b\xe0i viết của Hello Bacsi chỉ c\xf3 t\xednh chất tham khảo, kh\xf4ng thay thế cho việc chẩn đo\xe1n hoặc điều trị y khoa."}})}),(0,a.tZ)(VideoListing,{title:null==u?void 0:null===(n=u.suggestedVideos)||void 0===n?void 0:n.title,videos:null==u?void 0:null===(r=u.suggestedVideos)||void 0===r?void 0:r.video,videoUrl:null==u?void 0:null===(s=u.suggestedVideos)||void 0===s?void 0:s.videoUrl})]})};var eh=i("vAgI");let BMIToolPage=e=>{var t;let{type:i,dataNavMenuContent:r,footerInfo:B,bmiContent:x,bmiContentWParams:C,sitewideBanner:M}=e,L=(0,_.h)(),{locale:k,asPath:N,query:A,push:O}=L,{formatMessage:D}=(0,d.Z)(),{dispatch:P}=(0,l.useContext)(Z.I),{state:{isLoggedIn:E,userInfo:F}}=(0,l.useContext)(Z.I),{classes:Q}=U(void 0,{name:"BMIToolPage"}),{getHealthToolLink:G}=(0,o.u)(k),H=(0,l.useMemo)(()=>G(T.QO.BMI),[G]),[z,q]=(0,l.useState)("result"===i),[K,W]=(0,l.useState)("result"===i),[V,j]=(0,l.useState)((0,p.N)("result"===i?b.h.CalculatingFormBaseSSRParam:b.h.ShowGeneralForm)),[Y,J]=(0,l.useState)(null),[$,ee]=(0,l.useState)(!1),et=(null===(t=A.slug)||void 0===t?void 0:t[0])==="bmi-calculator-en",ei=(0,y.d)(),handleResult=async e=>{q(!0),j((0,p.N)(V.hasResult?b.h.ReCalculatingForm:b.h.CalculatingForm));let{gender:t,age:i,weight:a,height:l,activityLevel:o}=e,n=await (0,w.$)({gender:t,age:i,weight:a,height:l,activityLevel:o,isEnglishTool:et,locale:k,f:D});(null==n?void 0:n.bmi)?(J(n),j((0,p.N)(b.h.ShowSuccessResult)),O({pathname:L.pathname,query:(0,X.eO)(e)},"".concat(H,"?").concat(new URLSearchParams((0,X.eO)(e))),{shallow:!0})):j((0,p.N)(b.h.ShowFailResult)),q(!1)};function onRecalculate(){j((0,p.N)(b.h.RecalculateForm))}let onSubmit=async e=>{if(V.hasResult){var t;null===(t=document.scrollingElement)||void 0===t||t.scrollTo({top:0,behavior:"auto"})}let i={...e,additional_questions:(0,X.pb)(D,e)},a=(0,X.a1)({...i,bmi:Number(null==Y?void 0:Y.bmi)},{positionType:"landing_page",isMobile:ei});if(localStorage.setItem(X.e_,JSON.stringify(a)),(null==F?void 0:F.id)&&i.isCheckYourself&&(q(!0),await (0,R.eZ)({userInfo:F,data:i}),q(!1)),E)await handleResult(i);else if(S.Ew)h.P.syncParamsToUseOnSSOForm({gender:i.gender,birthday:i.birthday},L),P({type:I.H.ADD_SUCCESS_LOGIN_FN,payload:async()=>{await handleResult(i)}}),(0,m.p0)(void 0,"bmi");else{let e=(0,X.eo)(window.location.origin+H,i);E||et?L.push(e):(0,m.p0)(e,"bmi")}};return(0,l.useEffect)(()=>()=>{P({type:I.H.ADD_SUCCESS_LOGIN_FN,payload:void 0})},[]),(0,l.useEffect)(()=>{let e=null;return z&&V.hasResult?e=setTimeout(()=>{W(!0)},500):W(!1),()=>{e&&clearTimeout(e)}},[z,V.hasResult]),(0,l.useEffect)(()=>{let e="result"===i&&!A.resultId,t="result"===i&&F&&"string"==typeof A.resultId;async function loadResult(){q(!0),j((0,p.N)(b.h.CalculatingFormBaseSSRParam));try{let t;if(e)t={gender:"f"===A[n.Q.gender]?"female":"male",age:A[n.Q.age],weight:A[n.Q.weight],height:A[n.Q.height],activityLevel:A[n.Q.activityLevel],f:D,locale:k,isEnglishTool:et};else{let e=await (0,c.d)(u.y.SIDIS.GET_SIDIS_BMI,{params:{resultId:A.resultId}},"sidis_frontend");if((null==e?void 0:e._status)!==1||!(null==e?void 0:e._data))throw Error("Result not found");let i=e._data;t={gender:i.gender?"male":"female",age:i.age,weight:i.weight,height:i.height,activityLevel:(0,eh.OA)(i.objective||1),f:D,locale:k,isEnglishTool:et}}let i=await (0,w.$)(t);if(!(null==i?void 0:i.bmi))throw Error("BMI calculation failed");J(i),j((0,p.N)(b.h.ShowSuccessResult))}catch(e){console.error("loadResult error:",e),j((0,p.N)(b.h.ShowFailResult))}finally{q(!1)}}(e||t)&&loadResult()},[i,F]),(0,l.useEffect)(()=>{let e=s().get("_ga")||"",t=JSON.parse(localStorage.getItem(X.e_)||"false");t&&Y&&(null==F?void 0:F.id)&&(async()=>{try{ee(!0),await Promise.all([(0,X.XL)(k,{...t,bmi:null==Y?void 0:Y.bmi,account_id:F.id||null,ga_client_id:e,email:F.email||null})]),localStorage.removeItem(X.e_)}catch(e){}})()},[null==F?void 0:F.id,Y]),(0,a.tZ)(v.A,{type:i,showOnboading:$,className:Q.root,loading:z,layoutState:V,onClickRecalculateForm:onRecalculate,onClickBackToResult:()=>j((0,p.N)(b.h.BackToResult)),toolName:T.HE.BMI,toolInfo:x,extraPayloadValues:{gender:{value:(null==Y?void 0:Y.gender)||""}},layoutColor:"blue",navigatorProps:{title:D({id:"bmiPage.seoTitle",defaultMessage:"BMI Tool"}),description:D({id:"bmiPage.seoDescription",defaultMessage:"BMI Tool"}),image:"".concat((0,g.UC)(k)).concat(S.Nr,"/bmiThumbnail.png"),SEOData:{schemaData:D({id:"bmiPage.seoSchema",defaultMessage:"BMI Tool"}),apiMetaData:(null==C?void 0:C.metaTag)||(null==x?void 0:x.metaTag),isIndexable:!0},footerInfo:B,isSponsored:null==x?void 0:x.is_sponsored,sponsoredType:"content",sponsoredBy:x.sponsor||void 0,dataNavMenuContent:r,languageOptions:(0,f.c)(k,N),activeMenuService:"tools",isHealthToolResultSharing:!0,sitewideBanner:M},formEle:(0,a.tZ)(h.W,{classNames:{actions:Q.actions,btn:Q.btn},loading:z,onSubmit:onSubmit}),resultList:[{id:"main-info",label:D({id:"bmiTool.navResult.bmiReveal"}),children:(0,a.tZ)(GeneralResultScreen,{loading:z,bmiLink:H,bmiContent:x,bmrData:Y,onRecalculate:onRecalculate})},{id:"statistic",label:D({id:"bmiTool.navResult.statistic"}),children:Y&&!K?(0,a.tZ)(RiskAndConditionTools,{bmrData:Y}):null},{id:"suggested-tool",label:D({id:"bmiTool.navResult.suggestTool"}),children:Y&&!K?(0,a.tZ)(SuggestToolsAndArticleScreen,{bmrData:Y,color:x.sponsorTheme}):null},{id:"faq",label:D({id:"faq.title"}),children:Y&&!K?(0,a.tZ)(FAQScreen,{bmrData:Y}):null}],enabledAd:!!x.enable_ad})}},Lxg8:function(e,t,i){i.d(t,{TT:function(){return r},_j:function(){return getBmrKcal},mI:function(){return n},p7:function(){return generateBmrInfoToSendSidis},td:function(){return generateBmrRedirect}});var a=i("LL/B"),l=i("cr+I"),o=i("9L6u");let n="bmrInfo",r={low_intensity:1,moderate_intensity:2,aerobic_intensity:3,vigorous_intensity:4,maximum_intensity:5};function getBmrKcal(e,t){return Math.round(("male"===e?66.47+13.75*parseFloat(t.weight)+5.003*parseFloat(t.height)-6.755*parseFloat(t.age):655.1+9.563*parseFloat(t.weight)+1.85*parseFloat(t.height)-4.676*parseFloat(t.age))*100)/100}function generateBmrRedirect(e,t,i){let n=l.stringifyUrl({url:e,query:{result:1,[a.Q.gender]:(0,o.QX)(t),[a.Q.age]:i.age,[a.Q.height]:i.height,[a.Q.weight]:i.weight,[a.Q.yourself]:Number(!!i.isCheckYourself),[a.Q.activityLevel]:i.activityLevel,joincommunity:1}},{skipEmptyString:!0,skipNull:!0});return n}function generateBmrInfoToSendSidis(e,t,i,a){let{articleCategories:l,positionType:o}=a,n={age:i.age,height:i.height,weight:i.weight,kcal:e,gender:t,position_type:o,device_type:"web",...(null==i?void 0:i.isCheckYourself)&&{is_my_self:1},...(null==i?void 0:i.activityLevel)&&{active_level:(null==r?void 0:r[i.activityLevel])||1},source_url:window.location.href};return l&&(n.categories=l.map(e=>({name:e.name||"",permalink:e.permalink||"",term_id:e.termId||"",text_color:e.textColor||""}))),n}},"1x8x":function(e,t,i){i.r(t),i.d(t,{BMRToolPage:function(){return BMRToolPage}});var a=i("BGKE"),l=i("q1tI"),o=i("1HUI"),n=i("LL/B"),r=i("p46w"),s=i.n(r),d=i("dDsW"),c=i("09QT"),u=i("/tR3"),g=i("9R0S"),m=i("oQBk"),h=i("CJtR"),v=i("g/tz"),p=i("ouLS"),b=i("Bd17"),f=i("Y/XE"),y=i("bLQg"),_=i("gNV7"),S=i("2su4"),T=i("hXNO"),w=i("P5LW"),I=i("rIrU"),Z=i("8vdq"),R=i("05Ua"),B=i("o0qI"),x=i("9O6x"),C=i("wp0n"),M=i("8vDj"),L=i("OAL+"),k=i("K27U"),N=i("0njy");let FAQScreen=e=>{let{bmrData:t}=e,{formatMessage:i}=(0,d.Z)(),l=(0,M.rZ)(),o=null==t?void 0:t.bmiResult,n=null==o?void 0:o.community,r=o.faqs;return n||r?(0,a.BX)(L.K,{children:[n&&(0,a.BX)(L.K,{spacing:24,children:[(0,a.BX)(L.K,{spacing:8,children:[(0,a.tZ)(C.T,{size:"s1",weight:"semiBold",color:l.colors.gray[8],children:null==n?void 0:n.title}),(0,a.tZ)(C.T,{size:"p4",color:l.colors.gray[6],children:null==n?void 0:n.description})]}),(0,a.tZ)(N.EmbeddedCommunity.HealthTool,{community:n,style:{marginTop:0}})]}),r&&r.length>0&&(0,a.tZ)(k.e,{expandFirst:!0,faqs:r,titleProps:{icon:(0,a.tZ)("img",{style:{height:"16px",width:"16px"},src:"".concat(I.Nr,"/info-icon.svg"),alt:"",loading:"lazy"}),headingTitle:i({id:"tools.faqs",defaultMessage:"FAQs"})}})]}):null};var A=i("SPK5"),O=i("0D4Z"),D=i("sKr0"),P=i("9L6u"),E=i("Xbyz"),F=i("ENYw");let GeneralResultScreen=e=>{var t,i,l,o,r;let{loading:s,bmrLink:d,toolContent:c,bmrData:u}=e,{locale:g}=(0,w.h)(),{bmi:m=0,gender:h="male"}=u||{},v=(0,T.d)(),p="".concat(d,"?").concat(n.Q.bmi,"=").concat(m,"&").concat(n.Q.gender,"=").concat((0,P.QX)(h)),b={gender:null==u?void 0:u.gender,bmrNumber:Number(null==u?void 0:null===(i=u.calories)||void 0===i?void 0:null===(t=i.bmr)||void 0===t?void 0:t.bmr).toLocaleString(g),bmrResult:null==u?void 0:u.bmiResult,bmrContent:c,calories:null==u?void 0:u.calories,activityLevel:null==u?void 0:u.activityLevel,loading:s};return(0,a.BX)(L.K,{sx:{gap:16},children:[(0,a.BX)(L.K,{spacing:16,sx:e=>({[e.fn.smallerThan("sm")]:{".mantine-Bmr__MainInfo-group:last-child":{paddingBottom:0}}}),children:[(0,a.tZ)(F.n,{...b}),!v&&(0,a.tZ)(A.k,{justify:"center",children:s?(0,a.tZ)(O.O,{width:246,height:36,radius:24}):(0,a.tZ)(D.n.BottomNavHorizonal,{bgColor:"#fff",shareUrl:p,showFull:!0,iconSize:24,styles:{heading:{fontSize:12},copyRoot:{input:{border:0}},wrapper:{paddingRight:40},controls:{overflow:"hidden"}}})})]}),(0,a.tZ)(E.k.Bmr,{loading:s,calories:null==u?void 0:u.calories,tdee:Number(null==u?void 0:u.bmiResult.tdeeValue),ctaText:null==c?void 0:null===(l=c.customWeightGainBanner)||void 0===l?void 0:l.buttonText,ctaColor:null==c?void 0:null===(o=c.customWeightGainBanner)||void 0===o?void 0:o.buttonColor,ctaUrl:null==c?void 0:null===(r=c.customWeightGainBanner)||void 0===r?void 0:r.link,sx:()=>({height:"100%",".mantine-WeightManagement-goalFooter":{height:"100%",justifyContent:"space-between"}})})]})};var Q=i("Lxg8"),X=(0,i("/npG").k)(e=>({root:{[e.fn.largerThan("sm")]:{".mantine-HealthToolFormWrapper__FormRow-root":{paddingLeft:0,paddingRight:0}}},actions:{paddingTop:16,[e.fn.largerThan("sm")]:{position:"sticky",left:0,right:0,bottom:0,backgroundColor:"#fff",zIndex:1,paddingBottom:24,paddingTop:24}},btn:{width:"100%"}})),U=i("ija2"),G=i("ckcH"),H=i("ytAX"),z=i("vAgI");let BMRToolPage=e=>{var t;let{type:i,dataNavMenuContent:r,footerInfo:C,bmrContent:M,bmrContentWParams:L,sitewideBanner:k}=e,N=(0,w.h)(),{locale:A,query:O,push:D}=N,{formatMessage:P}=(0,d.Z)(),{dispatch:E}=(0,l.useContext)(B.I),{state:{isLoggedIn:F,userInfo:q}}=(0,l.useContext)(B.I),{classes:K}=X(void 0,{name:"BMIToolPage"}),{getHealthToolLink:W}=(0,o.u)(A),V=(0,l.useMemo)(()=>W(Z.QO.BMR),[W]),[j,Y]=(0,l.useState)("result"===i),[J,$]=(0,l.useState)("result"===i),[ee,et]=(0,l.useState)((0,y.N)("result"===i?_.h.CalculatingFormBaseSSRParam:_.h.ShowGeneralForm)),[ei,ea]=(0,l.useState)(null),[el,eo]=(0,l.useState)(!1),en=(null===(t=O.slug)||void 0===t?void 0:t[0])==="bmi-calculator-en",er=(0,T.d)(),handleResult=async e=>{try{let{gender:t,weight:i,height:a,age:l,activityLevel:o}=e||{};Y(!0),et((0,y.N)(ee.hasResult?_.h.ReCalculatingForm:_.h.CalculatingForm));let n=await calculateData({gender:t,weight:i,height:a,age:l,activityLevel:o});ea({...e,...n,bmrContent:M}),et((0,y.N)(_.h.ShowSuccessResult)),D({pathname:N.pathname,query:(0,H.eO)(e)},"".concat(V,"?").concat(new URLSearchParams((0,H.eO)(e))),{shallow:!0})}catch(e){et((0,y.N)(_.h.ShowFailResult))}finally{Y(!1)}};function onRecalculate(){et((0,y.N)(_.h.RecalculateForm))}let calculateData=async e=>{var t;let{gender:i,weight:a,height:l,age:o,activityLevel:n}=e||{},r=await (0,z.ZD)({gender:i,weight:a,height:l,age:o,activityLevel:n}),s=(null==r?void 0:r.data)||{};if(0===Object.keys(s).length)throw"bmr result failed";let d=null==s?void 0:null===(t=s.bmr)||void 0===t?void 0:t.bmr,h=(0,z.xv)({bmr:d,gender:i}),v=await (0,c.d)(m.y.HEALTH_TOOL.GET_HEALTH_TOOL_BMR_RESULT,{params:{kcals:d,age:o,gender:i,status:h,activityLevel:(null===Q.TT||void 0===Q.TT?void 0:Q.TT[n||""])||1}}),p=(null==v?void 0:v.data)||{};if(0===Object.keys(v).length)throw"bmr result failed";let b=I.Nj.findIndex(e=>e===p.status)+1||1;return{scoreLevel:b,bmiResult:(0,u.Xj)((null==v?void 0:v.data)||{},P({id:"bmr.state.".concat(h)})),calories:(0,g.W)((null==r?void 0:r.data)||{})}},onSubmit=async e=>{ee.hasResult&&requestAnimationFrame(()=>{var e;null===(e=document.scrollingElement)||void 0===e||e.scrollTo({top:0,behavior:"auto"})});let t=(0,Q.p7)(e.bmr||0,String(e.gender),e,{isMobile:er,positionType:"landing_page"});if(localStorage.setItem(Q.mI,JSON.stringify(t)),(null==q?void 0:q.id)&&e.isCheckYourself&&(Y(!0),await (0,x.eZ)({userInfo:q,data:e}),Y(!1)),F)await handleResult(e);else if(I.Ew)p.P.syncParamsToUseOnSSOForm({gender:e.gender,birthday:e.birthday},N),E({type:R.H.ADD_SUCCESS_LOGIN_FN,payload:async()=>{await handleResult(e)}}),(0,v.p0)(void 0,"bmr");else{let t=(0,Q.td)(window.location.origin+V,String(e.gender),e);F||en?N.push(t):(0,v.p0)(t,"bmr")}};return(0,l.useEffect)(()=>()=>{E({type:R.H.ADD_SUCCESS_LOGIN_FN,payload:void 0})},[]),(0,l.useEffect)(()=>{let e=null;return j&&ee.hasResult?e=setTimeout(()=>{$(!0)},500):$(!1),()=>{e&&clearTimeout(e)}},[j,ee.hasResult]),(0,l.useEffect)(()=>{let e="result"===i&&!O.resultId,t="result"===i&&q&&"string"==typeof O.resultId;async function loadResult(){Y(!0),et((0,y.N)(_.h.CalculatingFormBaseSSRParam));try{let t;if(e)t={gender:"f"===O[n.Q.gender]?"female":"male",age:O[n.Q.age],weight:O[n.Q.weight],height:O[n.Q.height],activityLevel:O[n.Q.activityLevel],f:P,locale:A,isEnglishTool:en};else{let e=await (0,c.d)(m.y.SIDIS.GET_SIDIS_BMR,{params:{resultId:O.resultId}},"sidis_frontend");if((null==e?void 0:e._status)!==1||!(null==e?void 0:e._data))throw Error("Result not found");let i=e._data;t={gender:i.gender?"male":"female",age:i.age,weight:i.weight,height:i.height,activityLevel:(0,z.OA)(i.objective||1),f:P,locale:A,isEnglishTool:en}}let i=await calculateData(t);ea({...t,...i,bmrContent:M}),et((0,y.N)(_.h.ShowSuccessResult))}catch(e){console.error("loadResult error:",e),et((0,y.N)(_.h.ShowFailResult))}finally{Y(!1)}}(e||t)&&loadResult()},[i,q]),(0,l.useEffect)(()=>{let e=s().get("_ga")||"",t=JSON.parse(localStorage.getItem(Q.mI)||"false");t&&ei&&(null==q?void 0:q.id)&&(async()=>{try{eo(!0),await Promise.all([(0,H.XL)(A,{...t,bmi:null==ei?void 0:ei.bmi,account_id:q.id||null,ga_client_id:e,email:q.email||null})]),localStorage.removeItem(Q.mI)}catch(e){}})()},[null==q?void 0:q.id,ei]),(0,a.tZ)(f.A,{type:i,showOnboading:el,className:K.root,loading:j,layoutState:ee,onClickRecalculateForm:onRecalculate,onClickBackToResult:()=>et((0,y.N)(_.h.BackToResult)),toolName:Z.HE.BMR,toolInfo:M,layoutColor:"green",extraPayloadValues:{gender:{value:(null==ei?void 0:ei.gender)||""}},navigatorProps:{title:P({id:"bmrPage.seoTitle",defaultMessage:"BMR Tool"}),description:P({id:"bmrPage.seoDescription",defaultMessage:"BMR Tool"}),image:"".concat((0,h.UC)(A)).concat(I.Nr,"/bmrThumbnail.png?v=1"),SEOData:{schemaData:P({id:"bmrPage.seoSchema",defaultMessage:"BMR Tool"}),apiMetaData:(null==L?void 0:L.metaTag)||(null==M?void 0:M.metaTag),isIndexable:!0},footerInfo:C,sponsoredType:"content",sponsoredBy:(null==M?void 0:M.sponsor)||void 0,isSponsored:M.is_sponsored,dataNavMenuContent:r,languageOptions:(0,S.c)(A,N.asPath),activeMenuService:"tools",isHealthToolResultSharing:!0,sitewideBanner:k},formEle:(0,a.tZ)(b.v,{classNames:{actions:K.actions,btn:K.btn},loading:j,onSubmit:onSubmit}),resultList:[{id:"main-info",label:P({id:"bmrTool.navResult.bmrReveal"}),children:(0,a.tZ)(GeneralResultScreen,{loading:j,bmrLink:V,toolContent:M,bmrData:ei,onRecalculate:onRecalculate})},{id:"statistic",label:P({id:"bmiTool.navResult.statistic"}),children:ei&&!J?(0,a.tZ)(U.P,{toolContent:M,bmrData:ei}):null},{id:"suggested-tool",label:P({id:"bmiTool.navResult.suggestTool"}),children:ei&&!J?(0,a.tZ)(G.V,{bmrData:ei,color:M.sponsorTheme}):null},{id:"faq",label:P({id:"faq.title"}),children:ei&&!J?(0,a.tZ)(FAQScreen,{bmrData:ei}):null}],enabledAd:!!M.enable_ad})}}}]);