"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5451],{uriS:function(e,t,a){a.d(t,{v:function(){return DueDateCalculator},Q:function(){return A.Q4}});var o=a("BGKE"),n=a("q1tI"),l=a("iBNF"),i=a("xi0p"),r=a("wp0n"),c=a("fdQd"),d=a("8wjV"),s=a("Eso5"),u=a("mYVa"),m=a("OAL+"),h=a("gHhT"),g=a("cChf"),p=a("Wgwc"),f=a.n(p),v=a("dDsW"),b=a("6l8M"),y=a("w99c"),w=a("YFSc"),D=a("1LUM"),Z=a("ouLS"),C=a("RGkz"),S=a("P5LW"),P=a("rIrU"),T=a("o0qI"),B=a("aNTj"),_=a("1HUI"),I=a("LL/B"),E=a("u7wK"),L=a("g/tz"),x=a("csLd"),N=a("8vdq"),k=a("rBCA");a("qQsD");var F=a("uuQu");let R=(0,k.Z)("div",{target:"erjgweg0"})("width:100%;.method-label{display:flex;align-items:center;gap:4px;}");F.M.mbDown,F.M.mbDown,l.r.colors.primaryBase,l.r.colors.primaryBase;let M=(0,k.Z)(R,{target:"erjgweg4"})("#due-date-dropdown{z-index:1;width:100%;min-width:unset;max-width:unset;margin-bottom:2rem;color:",l.r.colors.gray800,";}.due-date-input{width:100%;min-width:unset;max-width:unset;color:",l.r.colors.gray800,";}.due-date-calculate-button{margin-right:auto;margin-left:auto;}"),O=(0,k.Z)("div",{target:"erjgweg5"})("display:flex;align-items:right;& > p{display:inline-block;border-bottom:solid 1px ",l.r.colors.primaryBase,";margin-bottom:24px;margin-left:auto;color:",l.r.colors.primaryBase,";cursor:pointer;font-size:11px;line-height:16px;text-align:right;}"),H=(0,k.Z)("div",{target:"erjgweg7"})("margin-bottom:1rem;"),U=(0,k.Z)("form",{target:"erjgweg8"})(F.M.mbDown,"{padding:16px 12px;border-radius:12px;background-color:",l.r.colors.white,";}");var A=a("i/U4"),X=(0,n.forwardRef)((e,t)=>{let{onSubmit:a,isEmbed:l=!1,controlledSubmit:i}=e,{formatMessage:c}=(0,v.Z)(),{locale:d,router:s}=(0,S.h)(),{state:{isLoggedIn:u}}=(0,x.b)(),[m,h]=(0,n.useState)(new Date),{getHealthToolLink:g}=(0,_.u)(d),{setIsCalculating:p}=(0,A.eY)();(0,n.useImperativeHandle)(t,()=>({submitForm:onSubmitForm}));let onSubmitForm=async()=>{let e=l?"".concat(window.location.origin).concat(P.sb).concat(g(N.QO.DUE_DATE)):window.location.origin+window.location.pathname,t=["".concat(I.Q.type,"=").concat(A.Q4.conception),"".concat(I.Q.startDate,"=").concat(f()(m).format(P.yJ)),"".concat(I.Q.additional,"= "),I.c.includes(d)?"joincommunity=1":""].filter(Boolean).join("&"),o=e+"?".concat(t);if(i){p(!0);let e=await (0,A.P2)(m);a&&a(e,o);return}if(u||(0,L.p0)(o,"due-date"),l)s.push(o);else{p(!0);let e=await (0,A.P2)(m);a&&a(e,o)}};return(0,o.tZ)(M,{children:(0,o.tZ)(H,{children:(0,o.tZ)(E.D,{label:(0,o.tZ)(r.T,{as:"label",size:"s4",children:c({id:"dueDatePage.conceptionDate"})}),value:m,size:"md",onChange:e=>{h(e||new Date)},excludeDate:e=>f()(e).isBefore(f()().subtract(43,"week"))})})})}),z=(0,n.forwardRef)((e,t)=>{let{onSubmit:a,isEmbed:l=!1,controlledSubmit:i}=e,{formatMessage:c}=(0,v.Z)(),{state:{isLoggedIn:d}}=(0,x.b)(),{locale:s,router:u}=(0,S.h)(),{getHealthToolLink:m}=(0,_.u)(s),{setIsCalculating:h}=(0,A.eY)(),g=(0,n.useMemo)(()=>m(N.QO.DUE_DATE),[m]),[p,b]=(0,n.useState)(new Date);(0,n.useImperativeHandle)(t,()=>({submitForm:onSubmitForm}));let onSubmitForm=async()=>{let e=l?"".concat(window.location.origin,"/").concat(g):window.location.origin+window.location.pathname,t=["".concat(I.Q.type,"=").concat(A.Q4.IUI),"".concat(I.Q.startDate,"=").concat(f()(p).format(P.yJ)),"".concat(I.Q.additional,"= "),I.c.includes(s)?"joincommunity=1":""].filter(Boolean).join("&"),o=e+"?".concat(t);if(i){h(!0);let e=await (0,A.NC)(p);a&&a(e,o);return}if(d||(0,L.p0)(o,"due-date"),l)u.push(o);else{h(!0);let e=await (0,A.NC)(p);a&&a(e,o)}};return(0,o.tZ)(M,{children:(0,o.tZ)(H,{children:(0,o.tZ)(E.D,{label:(0,o.tZ)(r.T,{as:"label",size:"s4",children:c({id:"dueDatePage.date_of_IUI_procedure",defaultMessage:"Date of IUI procedure"})}),value:p,onChange:e=>{b(e||new Date)},excludeDate:e=>f()(e).isBefore(f()().subtract(43,"week")),size:"md"})})})}),Q=(0,n.forwardRef)((e,t)=>{let{onSubmit:a,isEmbed:l=!1,controlledSubmit:i}=e,{formatMessage:d}=(0,v.Z)(),{locale:s,router:u}=(0,S.h)(),{state:{isLoggedIn:h}}=(0,n.useContext)(T.I)||{},[g,p]=(0,n.useState)(new Date),[b,y]=(0,n.useState)("3"),{getHealthToolLink:w}=(0,_.u)(s),{setIsCalculating:D}=(0,A.eY)();(0,n.useImperativeHandle)(t,()=>({submitForm:onSubmitForm}));let onSubmitForm=async()=>{let e=l?"".concat(window.location.origin).concat(P.sb).concat(w(N.QO.DUE_DATE)):window.location.origin+window.location.pathname,t=e+"?".concat(I.Q.type,"=2&").concat(I.Q.startDate,"=").concat(f()(g).format(P.yJ),"&").concat(I.Q.additional,"=").concat(b).concat(I.c.includes(s)?"&joincommunity=1":"");if(i){D(!0);let e=await (0,A.kF)(g,b);a&&a(e,t);return}if(h||(0,L.p0)(t,"due-date"),l)u.push(t);else{D(!0);let e=await (0,A.kF)(g,b);a&&a(e,t)}};return(0,o.BX)(M,{children:[(0,o.tZ)(H,{children:(0,o.tZ)(E.D,{label:(0,o.tZ)(r.T,{as:"label",size:"s4",children:d({id:"dueDatePage.ivf.transferDate"})}),value:g,onChange:e=>{p(e||new Date)},excludeDate:e=>f()(e).isBefore(f()().subtract(43,"week")),size:"md"})}),(0,o.tZ)(H,{children:(0,o.tZ)(c.R.Group,{name:"dayTransfer",value:b,onChange:e=>y(e),size:"md",children:(0,o.BX)(m.K,{spacing:"xs",children:[(0,o.tZ)(c.R,{value:"3",label:d({id:"dueDatePage.ivf.transferDateRadio"},{number:3})}),(0,o.tZ)(c.R,{value:"5",label:d({id:"dueDatePage.ivf.transferDateRadio"},{number:5})})]})})})]})}),G=(0,n.forwardRef)((e,t)=>{let{onSubmit:a,isEmbed:l=!1,controlledSubmit:i}=e,{formatMessage:d}=(0,v.Z)(),{state:{isLoggedIn:s}}=(0,x.b)(),[u,m]=(0,n.useState)("28"),{locale:h,router:g}=(0,S.h)(),{getHealthToolLink:p}=(0,_.u)(h),{setIsCalculating:b}=(0,A.eY)(),y=(0,n.useMemo)(()=>p(N.QO.DUE_DATE),[p]),w=(0,n.useMemo)(()=>[...Array(21)].map((e,t)=>({label:d({id:"dueDatePage.daysText"},{number:t+20}),value:"".concat(t+20)})),[]),[D,Z]=(0,n.useState)(new Date);(0,n.useImperativeHandle)(t,()=>({submitForm:onSubmitForm}));let onSubmitForm=async()=>{let e=l?"".concat(window.location.origin,"/").concat(y):window.location.origin+window.location.pathname,t=["".concat(I.Q.type,"=").concat(A.Q4.lastPeriod),"".concat(I.Q.startDate,"=").concat(f()(D).format(P.yJ)),"".concat(I.Q.additional,"=").concat(u),I.c.includes(h)?"joincommunity=1":""].filter(Boolean).join("&"),o=e+"?".concat(t);if(i){b(!0);let e=await (0,A.g6)(D,u);a&&a(e,o);return}if(s||(0,L.p0)(o,"due-date"),l)g.push(o);else{b(!0);let e=await (0,A.g6)(D,u);a&&a(e,o)}};return(0,o.BX)(M,{children:[(0,o.tZ)(H,{children:(0,o.tZ)(E.D,{label:(0,o.tZ)(r.T,{as:"label",size:"s4",children:d({id:"dueDatePage.lastPeriod.lastPeriodLabel"})}),value:D,onChange:e=>{Z(e||new Date)},excludeDate:e=>f()(e).isBefore(f()().subtract(43,"week")),size:"md"})}),(0,o.tZ)(H,{children:(0,o.tZ)(c.S,{label:(0,o.tZ)(r.T,{as:"label",size:"s4",children:d({id:"dueDatePage.lastPeriod.periodLengthLabel"})}),size:"md",maxDropdownHeight:300,data:w,value:u,onChange:e=>m(e||"")})})]})}),V=a("SPK5"),j=a("FQtM"),Y=a("hXNO"),W=(0,n.forwardRef)((e,t)=>{let{onSubmit:a,isEmbed:i=!1,controlledSubmit:d,form:s,scrollIntoExplaination:u}=e,{formatMessage:m}=(0,v.Z)(),{state:{isLoggedIn:g}}=(0,x.b)(),p=(0,Y.d)(),{locale:b,router:y}=(0,S.h)(),{getHealthToolLink:w}=(0,_.u)(b),D=(0,n.useMemo)(()=>w(N.QO.DUE_DATE),[w]),[Z,C]=(0,n.useState)(new Date),T=s.getInputProps("ultrasoundCRL"),B=s.getInputProps("ultrasoundMSD");(0,n.useImperativeHandle)(t,()=>({submitForm:onSubmitForm}));let onSubmitForm=async()=>{let e=i?"".concat(window.location.origin,"/").concat(D):window.location.origin+window.location.pathname,t="".concat(T.value,"|").concat(B.value),o=["".concat(I.Q.type,"=").concat(A.Q4.ultrasound),"".concat(I.Q.startDate,"=").concat(f()(Z).format(P.yJ)),"".concat(I.Q.additional,"=").concat(t),I.c.includes(b)?"joincommunity=1":""].filter(Boolean).join("&"),n=e+"?".concat(o);if(d){let e=await (0,A.Oh)(Z,t);a&&a(e,n);return}if(g||(0,L.p0)(n,"due-date"),i)y.push(n);else{let e=await (0,A.Oh)(Z,t);a&&a(e,n)}},k=(0,o.tZ)(r.T,{size:"p4",color:l.r.colors.gray400,children:"mm"});return(0,o.BX)(M,{children:[(0,o.tZ)(H,{children:(0,o.tZ)(E.D,{label:(0,o.BX)(r.T,{as:"label",size:"s4",children:[m({id:"dueDatePage.date_of_ultrasound",defaultMessage:"Date of Ultrasound"})," "]}),value:Z,onChange:e=>{C(e||new Date)},excludeDate:e=>f()(e).isBefore(f()().subtract(43,"week")),size:"md"})}),(0,o.BX)(V.k,{align:"center",gap:4,mb:4,children:[(0,o.tZ)(r.T,{as:"label",size:"s4",children:m({id:"dueDatePage.validation.one_is_required",defaultMessage:"At least one is required"})}),(0,o.tZ)(j.u,{withinPortal:!0,withArrow:!0,width:300,multiline:!0,label:m({id:"dueDatePage.ultrasound.tooltip"}),children:(0,o.tZ)(h.E,{width:18,height:18,src:"".concat(P.Nr,"/info-icon.svg"),alt:"",onClick:u})})]}),(0,o.BX)(H,{children:[(0,o.BX)(V.k,{gap:p?8:12,children:[(0,o.tZ)(c.I,{placeholder:"CRL",sx:{flex:1},rightSection:k,type:"number",min:0,step:.01,...T,errorProps:{sx:{display:"none"}}}),(0,o.tZ)(c.I,{placeholder:"MSD",sx:{flex:1},rightSection:k,type:"number",min:0,step:.01,...B,errorProps:{sx:{display:"none"}}})]}),T.error||B.error?(0,o.tZ)(r.T,{size:"p5",color:l.r.colors.red700,children:T.error||B.error}):null]})]})});let q=(0,n.forwardRef)((e,t)=>{let{value:a,label:n,imageSrc:i,...c}=e;return(0,o.BX)(s.x,{ref:t,sx:{gap:(0,u.h)(8),display:"flex",padding:"5px 6px",alignItems:"center","&[data-selected]":{backgroundColor:l.r.colors.gray100},"&[data-selected]:hover":{backgroundColor:l.r.colors.gray100},"&[data-hovered]":{backgroundColor:l.r.colors.gray100}},className:"",...c,children:[(0,o.tZ)("img",{src:i,style:{width:"20px",height:"20px",objectFit:"contain",maxWidth:"100%"},alt:n,loading:"lazy"}),(0,o.tZ)(r.T,{size:"p2",children:n})]})}),DueDateCalculator=e=>{let{additionalQuestions:t=[],onSubmitDueDate:a,isEmbed:l=!1,controlledSubmit:p,adUnitPath:_}=e,I=(0,n.useRef)(null),{formatMessage:E}=(0,v.Z)(),{router:L,locale:x}=(0,S.h)(),{state:{userInfo:N}}=(0,n.useContext)(T.I),k=(0,n.useRef)(null),{calculatorType:F,setCalculatorType:M,isCalculating:H}=(0,A.eY)(),V=(0,g.c)({initialValues:{birthday:void 0,isFirstPregnant:!0,isMyself:!0,ultrasoundCRL:void 0,ultrasoundMSD:void 0},validate(e){let t=e.birthday?{}:{birthday:E({id:"validation.error.requiredField"})};if(F===A.Q4.ultrasound){let a=Number(e.ultrasoundCRL),o=Number(e.ultrasoundMSD);if(!a&&!o)return{ultrasoundCRL:E({id:"dueDatePage.validation.record_not_valid",defaultMessage:"Your recorded isn't valid!"}),...t};let n=a>=5&&a<=101,l=o>0&&o<=13;if(n||l)return{...t};if(a&&!n)return{ultrasoundCRL:E({id:"dueDatePage.validation.record_not_valid",defaultMessage:"Your recorded isn't valid!"}),...t};if(o&&!l)return{ultrasoundMSD:E({id:"dueDatePage.validation.crl",defaultMessage:"The MSD value is invalid. Please enter the CRL metric to continue."}),...t}}return{...t}}}),j=(0,n.useMemo)(()=>i.a[x].map(e=>{let t=A.iB[e];return{...t,label:E({id:t.label})}}),[x]),Y=(0,n.useCallback)(()=>{B.E.measure(()=>{let e=document.querySelector("#calculator-info");if(e){let t=e.getBoundingClientRect().top+window.scrollY-80;window.scrollTo({top:t,behavior:"smooth"})}})},[]),onBeforeSubmit=async(e,t)=>{var o;let n=V.getInputProps("birthday").value,l={...e,...n&&{birthday:f()(n).format(P.tD)},isMyself:Number(!!V.getInputProps("isMyself").value),isFirstPregnant:Number(!!V.getInputProps("isFirstPregnant").value),...(null===(o=V.getInputProps("additionalQuestions").value)||void 0===o?void 0:o.length)>0&&{additionalQuestions:V.getInputProps("additionalQuestions").value}};localStorage.setItem(A.Ls,JSON.stringify({...l,isSubmitted:!!(null==N?void 0:N.id),source_url:window.location.href})),null==a||a(l,t)};(0,n.useEffect)(()=>{(null==N?void 0:N.id)&&(V.setFieldValue("isMyself",!0),(null==N?void 0:N.birthday)&&V.setFieldValue("birthday",f()(N.birthday).toDate()))},[null==N?void 0:N.id]);let K=V.getInputProps("birthday").value,J=V.getInputProps("isMyself").value;(0,n.useEffect)(()=>{null===N&&Z.P.syncParamsToUseOnSSOForm({gender:J?"female":"",birthday:J?K:void 0},L)},[K,N,J]);let $=(0,n.useMemo)(()=>j.find(e=>e.value===String(F)),[j,F]);return(0,o.BX)(s.x,{pb:24,children:[(0,o.tZ)(U,{onSubmit:V.onSubmit(()=>{var e;return null===(e=k.current)||void 0===e?void 0:e.submitForm()}),children:(0,o.BX)(m.K,{spacing:(0,u.h)(12),children:[(0,o.tZ)(C.__,{children:(0,o.tZ)(y.u,{...V.getInputProps("birthday")})}),(0,o.BX)(C.__,{children:[(0,o.tZ)(w.X,{checked:V.getInputProps("isMyself").value,...V.getInputProps("isMyself"),onChange:e=>V.setFieldValue("isMyself",e.currentTarget.checked)}),(0,o.tZ)(w.X,{...V.getInputProps("isFirstPregnant"),defaultChecked:!0,label:E({id:"tools.isFirstPregnant",defaultMessage:"Is this the first pregnant?"})})]}),(0,o.BX)(R,{children:[(0,o.BX)(s.x,{className:"method-label",mb:4,children:[(0,o.tZ)(r.T,{as:"label",size:"s4",children:E({id:"dueDatePage.calculationMethod"})}),(0,o.tZ)(h.E,{width:18,height:18,src:"".concat(P.Nr,"/info-icon.svg"),alt:"",onClick:Y})]}),(0,o.tZ)(c.S,{value:String(F),placeholder:E({id:"dueDatePage.calculationMethod"}),data:j,itemComponent:q,onChange:e=>M(Number(e)),icon:(0,o.tZ)("img",{src:null==$?void 0:$.imageSrc,style:{width:"20px",height:"20px",objectFit:"contain",maxWidth:"100%"},alt:null==$?void 0:$.imageSrc,loading:"lazy"}),styles:{input:{"&[data-with-icon]":{paddingLeft:"2.3rem"}}}}),!l&&(0,o.tZ)(O,{})]}),(0,o.BX)(s.x,{children:[F===A.Q4.lastPeriod?(0,o.tZ)(G,{ref:k,isEmbed:l,controlledSubmit:p,onSubmit:onBeforeSubmit}):null,F===A.Q4.IUI?(0,o.tZ)(z,{ref:k,isEmbed:l,controlledSubmit:p,onSubmit:onBeforeSubmit}):null,F===A.Q4.ultrasound?(0,o.tZ)(W,{ref:k,isEmbed:l,controlledSubmit:p,onSubmit:onBeforeSubmit,form:V,scrollIntoExplaination:Y}):null,F===A.Q4.conception?(0,o.tZ)(X,{ref:k,isEmbed:l,controlledSubmit:p,onSubmit:onBeforeSubmit}):null,F===A.Q4.IVF?(0,o.tZ)(Q,{ref:k,isEmbed:l,controlledSubmit:p,onSubmit:onBeforeSubmit}):null,(0,o.tZ)(b.Z,{ref:I,additionalQuestions:t,onChange:e=>V.setFieldValue("additionalQuestions",e),className:"mb-4"})]}),(0,o.tZ)(d.B,{type:"submit",className:"due-date-calculate-button",size:"lg",color:"primary",dataEventCategory:"Health Tool",dataEventAction:"Due Date",fullWidth:!0,loading:H,children:E({id:H?"dueDatePage.calculating":"dueDatePage.lastPeriod.calculate"})})]})}),_&&(0,o.tZ)(D.AdBlock,{adUnitPath:_,size:[300,250],divId:"div-gpt-ad-topbanner-mobile",pos:["TopBanner"]})]})}},"i/U4":function(e,t,a){a.d(t,{Ls:function(){return h},NC:function(){return getDueDateIUI},Oh:function(){return getDueDateUltrasound},P2:function(){return getDueDateConception},Q4:function(){return l},Y7:function(){return DateToInputValue},eY:function(){return p},g6:function(){return getDueDateLastPeriod},iB:function(){return g},kF:function(){return getDueDateIVF}});var o,n,l,i,r=a("Wgwc"),c=a.n(r),d=a("VNqU"),s=a("09QT"),u=a("oQBk"),m=a("rIrU");let h="duedateInfo";(o=l||(l={}))[o.lastPeriod=0]="lastPeriod",o[o.conception=1]="conception",o[o.IVF=2]="IVF",o[o.IUI=3]="IUI",o[o.ultrasound=4]="ultrasound",(n=i||(i={})).lastPeriod="lmp",n.conception="cd",n.IVF="ivf",n.IUI="iui",n.ultrasound="us";let g={[String(0)]:{value:String(0),imageSrc:"".concat(m.Nr,"/due-date-last-period-icon-revamp.png"),label:"dueDatePage.lastPeriod"},[String(2)]:{value:String(2),imageSrc:"".concat(m.Nr,"/due-date-ivf-icon.png"),label:"dueDatePage.ivf"},[String(1)]:{value:String(1),imageSrc:"".concat(m.Nr,"/due-date-conception-date-icon.png"),label:"dueDatePage.conceptionDate"},[String(3)]:{value:String(3),imageSrc:"".concat(m.Nr,"/due-date-iui-icon.png"),label:"dueDatePage.IUI"},[String(4)]:{value:String(4),imageSrc:"".concat(m.Nr,"/due-date-ultrasound-icon.png"),label:"dueDatePage.ultrasound"}},getDueDateLastPeriod=async(e,t)=>{let a=Number(t),o=["method=lmp","circle_length=".concat(a),"date=".concat(c()(e).format(m.tD))].join("&"),n="".concat(u.y.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(o),l={method:1,first_day:c()(e).format(m.yJ),cycle_length_days:a,conception_date:null,ivf_transfer_date:null,days_transfer:null};try{var i,r;let{data:e}=await (0,s.d)(n);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(r=e.gestational_week)||void 0===r?void 0:null===(i=r[1])||void 0===i?void 0:i.from))return{startDate:null,dueDate:null,otherInfo:l};return{startDate:c()(e.gestational_week[1].from,m.tD).toDate(),dueDate:c()(e.due_date,m.tD).toDate(),otherInfo:l}}catch(e){return{startDate:null,dueDate:null,otherInfo:l}}},getDueDateIUI=async e=>{let t=["method=iui","date=".concat(c()(e).format(m.tD))].join("&"),a="".concat(u.y.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(t),o={method:4,insemination_date:c()(e).format(m.yJ),cycle_length_days:null,conception_date:null,ivf_transfer_date:null,days_transfer:null};try{var n,l;let{data:e}=await (0,s.d)(a);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(l=e.gestational_week)||void 0===l?void 0:null===(n=l[1])||void 0===n?void 0:n.from))return{startDate:null,dueDate:null,otherInfo:o};return{startDate:c()(e.gestational_week[1].from,m.tD).toDate(),dueDate:c()(e.due_date,m.tD).toDate(),otherInfo:o}}catch(e){return{startDate:null,dueDate:null,otherInfo:o}}},getDueDateUltrasound=async(e,t)=>{let[a,o]=t.split("|"),[n,l]=[Number(a),Number(o)],i=["method=us","date=".concat(c()(e).format(m.tD)),n?"crl=".concat(n):"",!n&&l?"msd=".concat(l):""].join("&"),r="".concat(u.y.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(i),d={method:5,measurement_date:c()(e).format(m.yJ),crl_value:n,msd_value:l,insemination_date:null,cycle_length_days:null,conception_date:null,ivf_transfer_date:null,days_transfer:null};try{var h,g;let{data:e}=await (0,s.d)(r);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(g=e.gestational_week)||void 0===g?void 0:null===(h=g[1])||void 0===h?void 0:h.from))return{startDate:null,dueDate:null,otherInfo:d};return{startDate:c()(e.gestational_week[1].from,m.tD).toDate(),dueDate:c()(e.due_date,m.tD).toDate(),otherInfo:d}}catch(e){return{startDate:null,dueDate:null,otherInfo:d}}},getDueDateConception=async e=>{let t=["method=cd","date=".concat(c()(e).format(m.tD))].join("&"),a="".concat(u.y.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(t),o={method:2,conception_date:c()(e).format(m.yJ),insemination_date:null,measurement_date:null,first_day:null,cycle_length_days:null,ivf_transfer_date:null,days_transfer:null};try{var n,l;let{data:e}=await (0,s.d)(a);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(l=e.gestational_week)||void 0===l?void 0:null===(n=l[1])||void 0===n?void 0:n.from))return{startDate:null,dueDate:null,otherInfo:o};return{startDate:c()(e.gestational_week[1].from,m.tD).toDate(),dueDate:c()(e.due_date,m.tD).toDate(),otherInfo:o}}catch(e){return{startDate:null,dueDate:null,otherInfo:o}}},getDueDateIVF=async(e,t)=>{let a=Number(t),o=["method=ivf","embryo_transfer_date=".concat(a),"date=".concat(c()(e).format(m.tD))].join("&"),n="".concat(u.y.HEALTH_TOOL.GET_DUE_DATE_RESULT,"?").concat(o),l={method:3,ivf_transfer_date:c()(e).format(m.yJ),measurement_date:null,insemination_date:null,days_transfer:a,conception_date:null,first_day:null,cycle_length_days:null};try{var i,r;let{data:e}=await (0,s.d)(n);if(!(null==e?void 0:e.due_date)&&!(null==e?void 0:null===(r=e.gestational_week)||void 0===r?void 0:null===(i=r[1])||void 0===i?void 0:i.from))return{startDate:null,dueDate:null,otherInfo:l};return{startDate:c()(e.gestational_week[1].from,m.tD).toDate(),dueDate:c()(e.due_date,m.tD).toDate(),otherInfo:l}}catch(e){return{startDate:null,dueDate:null,otherInfo:l}}},DateToInputValue=e=>"".concat(e.getFullYear(),"-").concat(String(e.getMonth()+1).padStart(2,"0"),"-").concat(String(e.getDate()).padStart(2,"0")),p=(0,d.Ue)(e=>({isCalculating:!1,isRecalculate:!1,navResultTarget:"due_date_revealed",setNavResultTarget:t=>e({navResultTarget:t}),calculatorType:0,setCalculatorType:t=>e(()=>({calculatorType:t})),setIsCalculating:t=>e(()=>({isCalculating:t})),setIsRecalculate:t=>e(()=>({isRecalculate:t}))}))},daLf:function(e,t,a){a.d(t,{f:function(){return HealthToolLayout}});var o=a("BGKE"),n=a("q1tI"),l=a("7Ci/"),i=a("Eso5"),r=a("OAL+"),c=a("mYVa");let HealthToolLayout=e=>{let{children:t}=e,a=n.Children.toArray(t),r=a.find(e=>"left"===e.type.columnName),c=a.find(e=>"right"===e.type.columnName);return(0,o.tZ)(l.W,{size:"lg",sx:{margin:"0 auto",backgroundColor:"#fff",borderRadius:8},children:(0,o.BX)(i.x,{sx:e=>({[e.fn.largerThan("sm")]:{display:"flex",justifyContent:"space-between"}}),children:[r&&(0,o.tZ)(i.x,{sx:e=>({[e.fn.largerThan("sm")]:{width:"calc(65% - 24px)"}}),children:r}),c&&(0,o.tZ)(i.x,{sx:e=>({[e.fn.largerThan("sm")]:{width:"35%"}}),children:c})]})})};function LeftColumn(e){let{children:t,...a}=e;return(0,o.tZ)(r.K,{sx:e=>({padding:"".concat((0,c.h)(16)," 0"),gap:(0,c.h)(24),[e.fn.largerThan("sm")]:{padding:"".concat((0,c.h)(32)," 0")}}),...a,children:t})}function RightColumn(e){let{children:t,...a}=e;return(0,o.tZ)(r.K,{sx:e=>({[e.fn.largerThan("sm")]:{padding:"".concat((0,c.h)(24)," 0")}}),...a,children:t})}LeftColumn.columnName="left",LeftColumn.displayName="HealthToolLayoutLeft",HealthToolLayout.LeftColumn=LeftColumn,RightColumn.columnName="right",RightColumn.displayName="HealthToolLayoutRight",HealthToolLayout.RightColumn=RightColumn},bLQg:function(e,t,a){a.d(t,{N:function(){return getLayoutStateByStep}});var o=a("gNV7");function getLayoutStateByStep(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o.h.ShowGeneralForm,t={hasResult:!1,showCalculatorForm:!0,showGeneralInfo:!0,showNavResult:!1,showDetailResult:!1,showError:!1};switch(e){case o.h.ShowGeneralForm:case o.h.CalculatingForm:return t;case o.h.ShowSuccessResult:return{hasResult:!0,showCalculatorForm:!1,showGeneralInfo:!1,showNavResult:!0,showDetailResult:!0,showError:!1};case o.h.ShowFailResult:return{hasResult:!1,showCalculatorForm:!0,showGeneralInfo:!1,showNavResult:!1,showDetailResult:!1,showError:!0};case o.h.RecalculateForm:case o.h.ReCalculatingForm:return{hasResult:!0,showCalculatorForm:!0,showGeneralInfo:!1,showNavResult:!1,showDetailResult:!0,showError:!1};case o.h.BackToResult:return{hasResult:!0,showCalculatorForm:!1,showGeneralInfo:!1,showNavResult:!0,showDetailResult:!0,showError:!1};case o.h.CalculatingFormBaseSSRParam:return{hasResult:!1,showCalculatorForm:!1,showGeneralInfo:!1,showNavResult:!0,showDetailResult:!0,showError:!1};default:return t}}},"Y/XE":function(e,t,a){a.d(t,{A:function(){return HealthToolTwoColumnLayout}});var o=a("BGKE"),n=a("q1tI"),l=a("1HUI"),i=a("LL/B"),r=a("ZLal"),c=a("fNFL"),d=a("kfjY"),s=a("Eso5"),u=a("vaps"),m=a("SPK5"),h=a("OAL+"),g=a("dDsW"),p=a("O+8R"),f=a("CBW8"),v=a("lXMY"),b=a("2kea"),y=a("usqR"),w=a("JizU"),D=a("OHji"),Z=a("O+H8"),C=a("FxIt"),S=a("Uj9i"),P=a("zTPA"),T=a("raAP"),B=a("hXNO"),_=a("P5LW"),I=a("rIrU"),E=a("T9go"),L=a("VIdu"),x=a("/npG"),N=(0,x.k)(e=>({root:{},colLeft:{position:"relative"},colRight:{},colLeftContent:{flexGrow:1},formWrapper:{[e.fn.smallerThan("sm")]:{backgroundColor:"#fff",borderRadius:12,padding:12}},formEle:{[e.fn.largerThan("sm")]:{position:"absolute",top:0,left:0,right:0,bottom:0}},selectNavResult:{position:"fixed",top:0,left:0,right:0,zIndex:2}})),k=a("wp0n"),F=a("1Hbx"),R=a("bpvy"),M=a("0UxZ"),O=a("mYVa"),H=(0,x.k)(()=>({icon:{width:24,height:24,display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",backgroundColor:"#fff"},accControl:{padding:0,"-webkit-tap-highlight-color":"transparent","&:active":{backgroundColor:"transparent"}},accItem:{padding:0,border:0},accContent:{padding:"".concat((0,O.h)(8)," 0")},accLabel:{padding:0}}));let ToolHeader=e=>{let{toolInfo:t,hasResult:a,withDescriptionAccordion:n}=e,{classes:l}=H(void 0,{name:"HealthToolTwoColumnLayout__ToolHeader"}),i=(0,o.tZ)(k.T,{size:"h3",as:a?"h2":"h1",children:null==t?void 0:t.title});return(0,o.BX)(h.K,{spacing:4,children:[n&&(null==t?void 0:t.description)?(0,o.tZ)(R.U,{classNames:{control:l.accControl,item:l.accItem,content:l.accContent,label:l.accLabel},children:(0,o.BX)(R.U.Item,{value:"item-1",children:[(0,o.tZ)(R.U.Control,{className:"no-focus",chevron:(0,o.tZ)(s.x,{className:l.icon,children:(0,o.tZ)(F.Z,{size:18})}),children:i}),(0,o.tZ)(R.U.Panel,{children:(0,o.tZ)(k.T,{size:"p4",as:"div",dangerouslySetInnerHTML:{__html:null==t?void 0:t.description}})})]})}):i,(0,o.tZ)(M.I.MedicalReview,{size:"small",reviewBy:null==t?void 0:t.reviewBy})]})};var U=a("2su4"),A=a("VJ+m");let X={in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(10%)"},transitionProperty:"transform, opacity"},z={in:{opacity:1,transform:"translate(-50%, 0)"},out:{opacity:0,transform:"translate(-50%, 100%) "},transitionProperty:"transform, opacity"},HealthToolTwoColumnLayout=e=>{var t;let{type:a,navigatorProps:x,toolInfo:k,toolName:F,formEle:R,layoutState:{hasResult:M,showCalculatorForm:O,showGeneralInfo:H,showNavResult:Q,showDetailResult:G,showError:V},loading:j,showOnboading:Y,onClickRecalculateForm:W,onClickBackToResult:q,resultList:K,extraPayloadValues:J,layoutColor:$,styles:ee,classNames:et}=e,ea=(0,B.d)(),{classes:eo}=N(void 0,{name:"HealthToolTwoColumnLayout",styles:ee,classNames:et}),{formatMessage:en}=(0,g.Z)(),{locale:el,query:ei,asPath:er}=(0,_.h)(),ec=(0,T.U)(),{getHealthToolLink:ed}=(0,l.u)(el),es=(0,E.a)(e=>e.setShouldOnboardingModalOpen),eu=ei[i.Q.source],em="".concat(I.MO,"user"),eh=M?"my-health"===eu?[{label:en({id:"healthTool.breadcrumb.myHealth",defaultMessage:"My Health"}),value:"".concat(em,"/health")},{label:en({id:"".concat(F,".breadcrumb.result"),defaultMessage:"BMI Result"}),value:""}]:[{label:en({id:"healthtools.title"}),value:"/health-tools"},{label:en({id:"".concat(F,".heading"),defaultMessage:"BMI Calculator"}),value:ed(F)},{label:en({id:"".concat(F,".breadcrumb.result"),defaultMessage:"BMI Result"}),value:""}]:[{label:en({id:"healthtools.title"}),value:"/health-tools"},{label:en({id:"".concat(F,".heading"),defaultMessage:"BMI Calculator"}),value:ed(F)}],eg=null==k?void 0:k.is_sponsored,ep=(null==k?void 0:k.sponsorTheme)||$,ef=(0,L.od)({countryAdTag:(0,L.Em)(el,{isMobile:ea}),contentAdTag:(0,L.WV)(el,er,["health-tools/due-date"])}),ev=!ea||"form"===a&&!M;return(0,n.useEffect)(()=>{Y&&es(!0)},[Y]),(0,n.useEffect)(()=>{G&&requestAnimationFrame(()=>{var e;null===(e=document.scrollingElement)||void 0===e||e.scrollTo({top:0,behavior:"auto"})})},[G]),(0,o.tZ)(o.HY,{children:(0,o.tZ)(r.T,{variant:r.C.LEADGEN,children:(0,o.tZ)(U.x,{...x,children:(0,o.BX)(o.HY,{children:[(0,o.tZ)(Z.X,{hasSponsor:eg,listing:K,loading:j,children:(0,o.BX)(A.l,{hasSponsor:eg,classNames:{contentBox:eo.colLeftContent},color:ep,breadcrumbEle:(0,o.tZ)(b.d,{pageItem:eh}),recalculateEle:(M||ea&&V)&&(0,o.tZ)(p.w,{"data-event-category":"Health Tool","data-event-action":"Recalculation Click","data-event-label":ec,showCalculatorForm:O,onShowCalculatorForm:W,onBack:q}),header:(0,o.tZ)(ToolHeader,{toolInfo:k,hasResult:M,withDescriptionAccordion:ea}),children:[ev&&(0,o.tZ)(A.l.ColLeft,{className:eo.colLeft,children:(0,o.tZ)(o.HY,{children:(0,o.BX)(A.l.ColLeftContent,{children:[(0,o.tZ)(d.u,{keepMounted:!0,mounted:O,transition:X,children:e=>(0,o.tZ)(s.x,{style:e,className:eo.formEle,children:(0,o.tZ)(u.x,{h:"100%",type:"hover",scrollbarSize:6,children:(0,o.tZ)(A.l.ColLeftInner,{className:eo.formWrapper,children:R})})})}),(0,o.tZ)(d.u,{mounted:Q,transition:X,children:e=>(0,o.tZ)(s.x,{style:e,sx:()=>({height:"100%"}),children:(0,o.BX)(A.l.ColLeftInner,{sx:{display:"flex",justifyContent:"space-between",flexDirection:"column",paddingTop:26,paddingBottom:24,height:"100%"},children:[(0,o.tZ)(Z.X.Nav,{}),(0,o.tZ)(y.E,{contentSize:"n1",bordered:!1,description:null==k?void 0:k.disclaimer,headingSize:"c2"})]})})})]})})}),(0,o.tZ)(Z.X.NavSelect,{className:eo.selectNavResult,mounted:Q&&ea}),(0,o.BX)(A.l.ColRight,{className:eo.colRight,color:ep,children:[(0,o.tZ)(d.u,{transition:"fade",mounted:G,children:e=>(0,o.tZ)(Z.X.ResultListing,{itemWrapper:A.l.FullScreenSection,style:e})}),(0,o.tZ)(d.u,{transition:"fade",mounted:H,children:e=>(0,o.tZ)(D.T,{color:ep,toolInfo:k,style:e})}),(0,o.tZ)(d.u,{transition:"fade",mounted:V,children:e=>(0,o.tZ)(m.k,{align:"center",justify:"center",style:e,sx:e=>({[e.fn.largerThan("sm")]:{position:"absolute",inset:0}}),children:(0,o.tZ)(w.I,{})})})]})]})}),(null==k?void 0:k.enable_ad)&&(0,o.tZ)(o.HY,{children:G&&ea?(0,o.tZ)(f.o,{children:(0,o.tZ)(v.FixedBottomAdBlock,{adUnitPath:ef,className:"article-bottom-ad",isMobile:!0})}):(0,o.tZ)(d.u,{keepMounted:!0,mounted:!O,transition:z,children:e=>(0,o.tZ)(f.o,{children:(0,o.tZ)(v.FixedBottomAdBlock,{adUnitPath:ef,className:"article-bottom-ad",isMobile:!1,style:e})})})}),M&&(0,o.tZ)(f.o,{children:(0,o.tZ)(S.OutOfPageAd,{id:"div-gpt-out-of-page",adUnitPath:ef})}),Y&&(0,o.tZ)(P.X,{campaign:null==k?void 0:null===(t=k.collectingData)||void 0===t?void 0:t.campaigns,isSkippable:null==k?void 0:k.isSkippable,typeForm:null==k?void 0:k.collectingTypes,phoneVerify:null==k?void 0:k.phoneVerification,toolName:"bmi",extraPayloadValues:J}),ea&&(0,o.tZ)(c.M,{opened:O&&M,onClose:q,zIndex:305,fullScreen:!0,withCloseButton:!0,transitionProps:{transition:"slide-right",duration:200},styles:e=>{var t;return{content:{borderRadius:0,height:"100% !important"},header:{borderBottom:0,...ep&&{backgroundColor:null===(t=e.colors[ep])||void 0===t?void 0:t[0]}}}},children:(0,o.BX)(h.K,{spacing:16,children:[(0,o.tZ)(s.x,{sx:e=>{var t;return{marginLeft:-16,marginRight:-16,padding:"0 16px 16px",...ep&&{backgroundColor:null===(t=e.colors[ep])||void 0===t?void 0:t[0]}}},children:(0,o.tZ)(ToolHeader,{toolInfo:k,hasResult:M})}),(0,o.tZ)(s.x,{sx:{borderRadius:12,backgroundColor:"#fff"},children:R})]})}),(0,o.tZ)(C.default.FitnessHealthTool,{})]})})})})}},gNV7:function(e,t,a){var o,n;a.d(t,{h:function(){return o}}),(n=o||(o={})).ShowGeneralForm="ShowGeneralForm",n.CalculatingForm="CalculatingForm",n.ReCalculatingForm="ReCalculatingForm",n.ShowSuccessResult="ShowSuccessResult",n.ShowFailResult="ShowFailResult",n.RecalculateForm="RecalculateForm",n.BackToResult="BackToResult",n.CalculatingFormBaseSSRParam="CalculatingFormBaseSSRParam"},Ovg6:function(e,t,a){a.d(t,{q:function(){return DiscoverHead}});var o=a("BGKE"),n=a("q1tI"),l=a("4v/2"),i=a("g4pe"),r=a.n(i),c=a("CJtR"),d=a("Nzzg"),s=a("iv2E"),u=a("P5LW"),m=a("rIrU");let DiscoverHead=e=>{var t,a,i,h;let g,{SEOData:p={},noUsingRouterPush:f=!1,languageOptions:v=[],isHealthToolResultSharing:b}=e,{DEPLOY_ENV:y}=m.ENV,{asPath:w}=(0,u.h)(),{totalPages:D,currentPage:Z,title:C="",description:S="",image:P,type:T,customMetaData:B=[],isIndexable:_=!0,hasNoCanonical:I=!1,openGraph:E,twitter:L}=p,{title:x,image:N,imageWidth:k="1200",imageHeight:F="630",description:R}=E||{},{image:M,title:O,description:H}=L||{},{locale:U,router:{pathname:A,query:X,push:z}}=(0,u.h)(),Q="https://".concat(s.domainLocales[U]).concat(m.Nr,"/").concat(U,".png"),G=(0,d.y)(U,P)||Q,V=(0,d.y)(U,N),j=(0,d.y)(U,M),Y="".concat(m.sb).concat(A);Object.keys(X).forEach(e=>{let t=X[e];t&&Array.isArray(t)&&(Y=Y.replace("[...".concat(e,"]"),t.join("/"))),"string"==typeof t&&A.endsWith("[".concat(e,"]"))&&(Y=Y.replace("[".concat(e,"]"),t))});let W=(0,n.useMemo)(()=>(null==v?void 0:v.length)>=2?v.map(e=>e.label===m.K4.EN?{...e,label:"en-PH"}:e.label===m.K4.FIL?{...e,label:"tl-PH"}:e):[],[v]);(0,n.useEffect)(()=>{let replaceClick=e=>{if(e&&e.target){let t=e.target;"A"!=t.nodeName||t.closest(".no-replace-click")||"_blank"===t.target||(e.preventDefault(),z(t.href))}};return()=>{f||window.document.body.removeEventListener("click",replaceClick)}},[]);let q="/"===Y?"":"/";if(p.apiMetaData&&"string"==typeof p.apiMetaData){let e=null===(h=p.apiMetaData)||void 0===h?void 0:h.match(/