"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7730],{"w/UI":function(e,t,a){a.d(t,{S:function(){return n}});var l=a("2wr/");let n=l.r},TAnM:function(e,t,a){a.d(t,{P:function(){return PostContent},T:function(){return o},U:function(){return i},a:function(){return ProfileDetail},b:function(){return V}});var l,n,o,i,r=a("z/kP"),s=a("q1tI"),c=a("Wgwc"),d=a.n(c),u=a("/TVU"),p=a("B+GY"),m=a("OQ3V"),h=a("IQVP"),g=a("EJrp"),v=a("vWP/"),b=a("/npG"),y=a("eito"),f=a("bpvy"),x=a("SPK5"),E=a("8vDj"),C=a("owZr"),S=a("vq0H"),k=a("jkNU"),w=a("4B16"),O=a("5kis"),T=a("iBNF"),L=a("Frvz"),I=a("h84G"),P=a("FNss"),N=a("/kWL"),j=a("g8xC"),$=a("rBCA"),R=a("aZjv"),A=a("eaXp"),M=a("odgB");let _=$.Z.div` padding: 0.5rem 1rem 1rem; line-height: 1.5; word-break: break-word; .post-content-replying { margin-right: 5px; cursor: pointer; display: inline-block; &.tag-only { margin-right: 0; } } .post-content { display: inline; white-space: pre-wrap; /* > *:first-child, */ > mention:first-child ~ * { &:not(ul), &:not(ol) { display: inline-block; } } > mention:first-child { margin-right: 5px; } &.has-see-more { *:last-child { &:not(ul), &:not(ol) { display: inline; } } } img { width: 100%; height: unset; } ul, ol { list-style-position: inside; padding-left: 1rem; display: block; } ol { list-style-type: decimal; } ul { list-style-type: disc; } mention { color: ${e=>e.mentionColor||"#1890ff"}; padding-right: 4px; :hover { text-decoration: underline; } } .markdown { white-space: normal; p, ul, ol { margin-top: 1em; &:first-child { margin-top: 0; } } li { margin-top: 0.5em; &:first-child { margin-top: 0; } } } } `,D=$.Z.span` overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: ${e=>e.line||1}; display: -webkit-box; -webkit-box-orient: vertical; &.post-content-show-all { display: block; } `,B=$.Z.span` padding-left: 2px; background-color: ${T.r.colors.white}; bottom: 8px; position: absolute; right: 0; z-index: 10; cursor: pointer; `;var F=(0,b.k)(e=>({root:{mention:{color:e.fn.primaryColor()},a:{"&,&:visited,&:focus":{color:e.fn.primaryColor()}},".create-post-link":{display:"inline",color:e.fn.primaryColor(),cursor:"pointer"}}}));let PostContent=e=>{var{trackingCategory:t,url:a,className:l,style:n,replyingTo:o,mentionedUser:i,description:c,disableShortenContent:d,mentions:u=[],maxChars:p=1e3,maxLines:m,hideShowAllBtn:h,styles:v,onClickCreatePostLink:b}=e,f=(0,r._)(e,["trackingCategory","url","className","style","replyingTo","mentionedUser","description","disableShortenContent","mentions","maxChars","maxLines","hideShowAllBtn","styles","onClickCreatePostLink"]);let{classes:x,theme:E}=F(void 0,{name:"PostContent",styles:v}),[C,S]=(0,s.useState)(!1),[w,T]=(0,s.useState)(!1),{t:L}=(0,O.u)(),{authActionWrapper:I}=(0,R.iV)(),[P,N]=(0,s.useState)(!1),j=(0,A.d)((0,A.b)(c||"","display"),u),{action:{sanitizeFunction:$}}=(0,s.useContext)(g.T),M=(0,s.useMemo)(()=>{let e=$(j||"");if(d||C)return{showContent:e,hasSeeMore:!1};let t=e.slice(0,p),a=p-((t.match(/<\/div>/g)||[]).length-1)*27,l=(t||"").slice(0,a<40?40:a),n=$(l.replace(/(<|<\/)( +|[a-zA-Z]*)$/gi,"")),o=n.lengths.createElement(s.Fragment,null,"... ",!h&&s.createElement(y.e,Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),I(()=>S(!0))},className:"see-more-text"},t?{"data-event-category":t,"data-event-action":"See More Post Click","data-event-label":a}:{}),L("post.seeMore"))),[h,a,t]),handleCreatePostClick=e=>{e.preventDefault(),null==b||b()},isEllipsisActive=e=>e.scrollHeight>e.clientHeight;return(0,s.useEffect)(()=>{var e;return null===(e=null==Z?void 0:Z.current)||void 0===e||e.querySelectorAll("[data-create-post]").forEach(e=>{e.addEventListener("click",handleCreatePostClick,{passive:!0})}),()=>{var e;null===(e=null==Z?void 0:Z.current)||void 0===e||e.querySelectorAll("[data-create-post]").forEach(e=>{e.removeEventListener("click",handleCreatePostClick,!1)})}},[d,C,j]),(0,s.useEffect)(()=>{K.current&&j&&m&&(isEllipsisActive(K.current)?T(!0):T(!1))},[j,m]),s.createElement(s.Fragment,null,q&&s.createElement(k.P,{isOpen:P,onClose:()=>N(!1),expertId:String(null==i?void 0:i.partnerId)}),s.createElement(_,Object.assign({ref:Z,className:`${x.root} ${l} no-replace-click`,style:n,mentionColor:E.fn.primaryColor()},f),z&&s.createElement(y.e,{onClick:()=>q&&N(!0),className:"post-content-replying"},"@",z),(null==c?void 0:c.startsWith("[mention+id="))&&s.createElement("span",{className:"post-content-replying tag-only",style:{color:E.fn.primaryColor()}},"@"),m?s.createElement(s.Fragment,null,s.createElement(D,{dangerouslySetInnerHTML:{__html:j},className:`post-content-line ${C?"post-content-show-all":""}`,line:m,ref:K}),w&&!C&&s.createElement(B,null,G())):s.createElement(s.Fragment,null,s.createElement("span",{dangerouslySetInnerHTML:{__html:M.showContent},className:`post-content ${M.hasSeeMore?"has-see-more":""}`}),M.hasSeeMore&&!C&&s.createElement("span",null,G()))))},CategoryText=({children:e,className:t=""})=>s.createElement("div",{className:`l5fL1xL ${t}`},e),Title=({children:e,className:t=""})=>s.createElement("div",{className:`L-aGKo7 ${t}`},e),Thumbnail=({src:e,defaultSrc:t=C.C.getAssetPath("logo/logomark.png"),ratio:a=1,size:l=80,radius:n=8,alt:o,className:i=""})=>s.createElement("div",{className:i},s.createElement("div",{className:"DZmf3s7",style:{width:`${l}px`,height:`${l*a}px`,borderRadius:`${n}px`}},s.createElement(S.I,{src:e,backupSrc:t,alt:o}))),CardArticle=({category:e,title:t,src:a,children:l,className:n=""})=>s.createElement("div",{className:`eaR8ATZ ${n}`},s.createElement(Thumbnail,{src:a}),s.createElement("div",{className:"xM-7K0a"},l||s.createElement("div",null,e&&s.createElement(CategoryText,null,e),t&&s.createElement(Title,null,t))));CardArticle.CategoryText=CategoryText,CardArticle.Title=Title;let ArticleCard=({featureImage:e,postTitle:t,author:a,categories:l,isReview:n,className:o=""})=>{var i;return s.createElement(CardArticle,{src:e,className:o},s.createElement(s.Fragment,null,s.createElement(CardArticle.CategoryText,null,null===(i=null==l?void 0:l[0])||void 0===i?void 0:i.name),s.createElement(CardArticle.Title,null,t),s.createElement(k.d,{avatarProps:Object.assign(Object.assign({},a),{size:32}),subTitle:s.createElement(s.Fragment,null,n?"Medically reviewed by Jobelle Ann Dela Cruz Bigalbal, MD":"Written by Jobelle Ann Dela Cruz Bigalbal, MD",s.createElement(k.d.SubDivider,null),"Dec 12, 2022")})))};var z={container:"SFSgnOz",header:"Tf3aoVa",heading:"TOt4QXl",headingIcon:"_5XYN1KT",accBodyGroup:"yE-tZRj",accBodyGroupItem:"LXiGuGT",accBodyGroupDesc:"r4rx-6v",subTitle:"XrHh8-C",subIcon:"c5-Yecd",group:"UBj6nWr",groupBody:"_2vptVBd",articleCardLink:"ZPDAwiR",relatedList:"_6wJn-NR",socialItem:"_21XDdFv",mbChevronWrapper:"LSyr3Zo"};let q=(0,s.createContext)({}),About=({className:e=""})=>{var t,a,l,n,o;let{t:i}=(0,O.u)(),{info:r,isMarryBaby:c,currentPageUrl:d}=(0,s.useContext)(q),u=null==r?void 0:r.data,p=[{type:w.S.LinkedIn,icon:C.C.getAssetPath("linkedin.svg"),url:null===(t=null==r?void 0:r.contact)||void 0===t?void 0:t.linkedin,eventAction:"Doctor Profile - Linkedin"},{type:w.S.Instagram,icon:C.C.getAssetPath("instagram.svg"),url:null===(a=null==r?void 0:r.contact)||void 0===a?void 0:a.instagram,eventAction:"Doctor Profile - Instagram"},{type:w.S.Facebook,icon:C.C.getAssetPath("facebook.svg"),url:null===(l=null==r?void 0:r.contact)||void 0===l?void 0:l.facebook,eventAction:"Doctor Profile - Facebook"},{type:w.S.Youtube,icon:C.C.getAssetPath("youtube.svg"),url:null===(n=null==r?void 0:r.contact)||void 0===n?void 0:n.youtube,eventAction:"Doctor Profile - Youtube"},{type:w.S.Tiktok,icon:C.C.getAssetPath("tiktok.svg"),url:null===(o=null==r?void 0:r.contact)||void 0===o?void 0:o.tiktok,eventAction:"Doctor Profile - TikTok"}],m=[...((null==r?void 0:r.experiences)||[]).length>0?[{key:"experience",heading:i("profilePanel.experience"),iconSrc:C.C.getAssetPath(c?"award-doc-mb.svg":"award-doc.svg"),eventAction:"Doctor Experience Click",panel:s.createElement("div",{className:z.accBodyGroup},null==r?void 0:r.experiences.map((e,t)=>s.createElement("div",{className:z.accBodyGroupItem,key:String(t)},s.createElement("div",{className:z.accBodyGroupTitle},e.title),s.createElement("div",{className:z.accBodyGroupDesc},s.createElement("p",null,e.organization),s.createElement("p",null,e.duration)))))}]:[],...((null==r?void 0:r.educations)||[]).length>0?[{key:"education",heading:i("profilePanel.education"),iconSrc:C.C.getAssetPath(c?"book-mb.svg":"book.svg"),eventAction:"Doctor Degree Click",panel:s.createElement("div",{className:z.accBodyGroup},null==r?void 0:r.educations.map((e,t)=>s.createElement("div",{className:z.accBodyGroupItem,key:String(t)},s.createElement("div",{className:z.accBodyGroupTitle},e.schoolName),s.createElement("div",{className:z.accBodyGroupDesc},s.createElement("p",null,e.study),s.createElement("p",null,e.completedYear)))))}]:[],...((null==r?void 0:r.awards)||[]).length>0?[{key:"awards",heading:i("profilePanel.awards"),iconSrc:C.C.getAssetPath(c?"award-mb.svg":"award.svg"),eventAction:"Doctor Award Click",panel:s.createElement("div",{className:z.accBodyGroup},null==r?void 0:r.awards.map((e,t)=>s.createElement("div",{className:z.accBodyGroupTitle,key:t},e.title)))}]:[]],h=(null==r?void 0:r.relatedPosts)||[],g=p.filter(e=>e.url);return s.createElement("div",{className:`${z.container} ${e}`,"data-is-marrybaby":c},m.length>0&&s.createElement(f.U,{defaultValue:m[0].key,chevron:c?s.createElement("div",{className:z.mbChevronWrapper},s.createElement(v.Z,{size:12,color:T.r.mbColors.midGray})):s.createElement(v.Z,{color:T.r.colors.gray400}),styles:{chevron:{"&[data-rotate]":{".minus-path":{display:"block"},".plus-path":{display:"none"}}},content:{display:"flex",flexDirection:"column",gap:"16px",padding:"0"},item:{border:0},control:{paddingLeft:0,"&:hover":{background:"transparent"},"*":{pointerEvents:"none"}}}},m.map(e=>s.createElement(f.U.Item,{key:e.key,value:e.key},s.createElement(f.U.Control,{"data-event-category":"Together","data-event-action":e.eventAction,"data-event-label":d},s.createElement("div",{className:z.header},s.createElement("div",{className:z.headingIcon},s.createElement("img",{src:e.iconSrc,loading:"lazy"})),s.createElement("div",{className:z.heading},e.heading))),s.createElement(f.U.Panel,null,e.panel)))),h.length>0&&s.createElement("div",{className:z.group},s.createElement("div",{className:z.subTitle},s.createElement("img",{className:z.subIcon,src:C.C.getAssetPath(c?"mb-logo.svg":"logo/circle-solid.svg"),loading:"lazy"}),i("profilePanel.publishedArticles")),s.createElement("div",{className:`${z.relatedList}`},null==r?void 0:r.relatedPosts.map(e=>s.createElement("a",{key:String(e.id),href:`${window.location.origin}${null==e?void 0:e.permalink}`,className:z.articleCardLink},s.createElement(ArticleCard,Object.assign({className:"article-card"},Object.assign(Object.assign({},e),!e.author&&{author:{displayName:null==u?void 0:u.name,avatar:null==u?void 0:u.avatar}}),{isReview:!0})))))),g.length>0&&s.createElement("div",{className:z.group},s.createElement("div",{className:z.subTitle},s.createElement("img",{className:z.subIcon,src:C.C.getAssetPath(c?"social-mb.svg":"social.svg"),loading:"lazy"}),i("profilePanel.socialLinks")),s.createElement("div",{className:z.groupBody},s.createElement(x.k,null,p.map((e,t)=>e.url&&s.createElement("div",{className:z.socialItem,key:t},s.createElement("a",{href:e.url,target:"_blank",rel:"noreferrer"},s.createElement("img",{src:e.icon,loading:"lazy",width:"32px","data-event-category":"Together","data-event-action":e.eventAction,"data-event-label":d}))))))))};var Z={container:"GYUElSy",question:"_3C6QpT1",questionTitle:"_9M9VYL6",community:"_1RuSyv3",questionCard:"_1IG-eEp"};let PostCard$1=({post:e,className:t=""})=>{var a,l,n,o,i,r,c,d;let{t:u}=(0,O.u)(),{data:{userInfo:p,env:{togetherBasePath:m}}}=(0,s.useContext)(g.T),{authActionWrapper:h,authorProps:v,currentPageUrl:b}=(0,s.useContext)(q),y=`${window.location.origin}${m}/${null===(a=null==e?void 0:e.community)||void 0===a?void 0:a.slug}/${null==e?void 0:e.slug}/`;return s.createElement("div",{className:`${Z.container} ${t}`},s.createElement("div",{className:Z.header},s.createElement("div",{className:Z.question},u("profilePanel.question")," ",s.createElement(P.b,{className:Z.questionTitle,href:"#",onClick:()=>{(null==p?void 0:p.id)||null==h||h(()=>window.location.href=y,{_location:y})}},"#",null==e?void 0:e.title)),s.createElement("div",{className:Z.community},null===(l=null==e?void 0:e.community)||void 0===l?void 0:l.name," - ",null==e?void 0:e.createdTime)),s.createElement("div",{className:Z.questionCard},s.createElement(k.C,Object.assign({className:"card-author"},v,{role:"user",avatarIcon:s.createElement(L.Z,null),subLine:s.createElement(k.C.SubTextRow,null,s.createElement(k.C.SubText,null,null===(i=null===(o=null===(n=null==e?void 0:e.expertAnswer)||void 0===n?void 0:n.answer)||void 0===o?void 0:o[0])||void 0===i?void 0:i.createdTime))})),s.createElement(PostContent,{className:"post-content-wrapper",description:(null===(d=null===(c=null===(r=null==e?void 0:e.expertAnswer)||void 0===r?void 0:r.answer)||void 0===c?void 0:c[0])||void 0===d?void 0:d.content)||"",mentions:null==e?void 0:e.mentions,"data-testid":"Content of the Post"})),s.createElement(j.B,{variant:"secondary","data-event-category":"Together","data-event-action":"Doctor Reply Click","data-event-label":b,size:"md",onClick:()=>{(null==p?void 0:p.id)?window.location.href=y:null==h||h(()=>window.location.href=y,{_location:y})}},u("profilePanel.anserwing.viewFull")))};var K={container:"_8fd7YMs",thumb:"DomiQfw",content:"-b2qnfL"};let EmptyMessage=({message:e,buttonTxt:t,imgSrc:a,onBtnClick:l})=>{let{siteType:n,isMarryBaby:o}=(0,s.useContext)(q);return s.createElement("div",{className:K.container},s.createElement("div",{className:K.thumb},s.createElement("img",{src:a||C.C.getAssetPath(o?"comments-mb.svg":"comments.svg"),loading:"lazy"})),e&&s.createElement("div",{className:K.content},e),t&&s.createElement(M.B,{size:"md",theme:n,color:"secondary",onClick:l},t))},Answering=({id:e})=>{let{t}=(0,O.u)(),{data:{locale:a}}=(0,s.useContext)(g.T),{authorProps:l}=(0,s.useContext)(q),[n,o]=(0,s.useState)(null),[i,c]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{e&&(0,r.a)(void 0,void 0,void 0,function*(){var t;c(!0);let l=yield(0,g.c)((0,g.f)(h.yy.USER.LIST_ANSWERS,{_locale:a,id:e}),"GET"),n=((null===(t=null==l?void 0:l.data)||void 0===t?void 0:t.replies)||[]).map(m.a);o(n),c(!1)})},[]),s.createElement("div",{className:"MrdoES3"},i?s.createElement(p.L,null):null!==n&&(n.length>0?n.map(e=>s.createElement(PostCard$1,{className:"post-card",key:e.id,post:e})):s.createElement(EmptyMessage,{message:t("profilePanel.emptyPostMess.content",{name:(null==l?void 0:l.name)||(null==l?void 0:l.username)})})))},QuestionCard=e=>{var t,a,l,n,{post:o}=e,i=(0,r._)(e,["post"]);let{data:{env:{togetherBasePath:c}}}=(0,s.useContext)(g.T);return s.createElement(s.Fragment,null,s.createElement("div",Object.assign({},i,{className:`toEutn7 ${(null==i?void 0:i.className)||""}`}),s.createElement(k.C,{className:"card-author",avatar:null===(t=null==o?void 0:o.author)||void 0===t?void 0:t.avatar,name:(null===(a=null==o?void 0:o.author)||void 0===a?void 0:a.name)||(null===(l=null==o?void 0:o.author)||void 0===l?void 0:l.username),isAnonymous:!!(null==o?void 0:o.isAnonymous),subLine:s.createElement(k.C.SubTextRow,null,s.createElement(k.C.SubText,null,null==o?void 0:o.createdTime))}),s.createElement(P.b,{href:`${window.location.origin}${c}/${null===(n=null==o?void 0:o.community)||void 0===n?void 0:n.slug}/${null==o?void 0:o.slug}/`,className:"drdisHs",rel:"noreferrer"},null==o?void 0:o.title)))};var G={accordion:"I-uIJ6E",header:"_41WRsj2",heading:"AcOGL93",headingIcon:"JD3dWJN",chevron:"L2Q9T6m",container:"h-pSmhX"};let Care=()=>{var e,t;let{t:a}=(0,O.u)(),{data:{locale:l,userInfo:n}}=(0,s.useContext)(g.T),{onSkipQuestion:o,countValues:i,setCountValues:c}=(0,s.useContext)(q),[d,u]=(0,s.useState)(),[v,b]=(0,s.useState)([]),[y,x]=(0,s.useState)(!1),E=null==n?void 0:n.id;(0,s.useEffect)(()=>{E&&(0,r.a)(void 0,void 0,void 0,function*(){var e;x(!0);let t=yield(0,g.e)((0,g.f)(h.yy.USER.LIST_QUESTION_NEED_REPLY,{_locale:l}),"GET"),a=[],n=Object.create({});((null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.communities)||[]).filter(e=>((null==e?void 0:e.question)||[]).length>0).map(e=>{n[e.id]=e.question.map(m.a),delete e.question,a.push((0,m.f)(e))}),b(a),u(n),x(!1)})},[]);let handleSkipQuestion=({id:e,communityId:t})=>{if(e&&t&&d){let a=Object.assign(Object.assign({},d),{[t]:[...((null==d?void 0:d[t])||[]).filter(t=>t.id!==e)]}),l=0;Object.keys(a).map(e=>l+=a[e].length||0),u(a),c(Object.assign(Object.assign({},i),{total_question:l})),null==o||o(l)}};return s.createElement("div",{className:G.container},y?s.createElement(p.L,null):(null==i?void 0:i.total_question)>0?v.length>0&&s.createElement(f.U,{className:G.accordion,defaultValue:String((null===(t=v[null===(e=Object.keys(v))||void 0===e?void 0:e[0]])||void 0===t?void 0:t.id)||""),styles:e=>({control:{padding:"16px",border:`1px solid ${e.colors.neutral[1]}`,borderTopLeftRadius:"8px",borderTopRightRadius:"8px",'&[aria-expanded="false"]':{borderBottom:0}},chevron:{width:"32px",height:"32px"},content:{padding:0,border:`1px solid ${e.colors.neutral[1]}`,borderTop:0,borderBottom:0},label:{padding:0},item:{marginBottom:"16px"}}),chevron:s.createElement("div",{className:G.chevron},s.createElement(I.Z,{color:T.r.colors.gray600,size:20}))},v.map(e=>{let t=d&&(null==d?void 0:d[e.id])||[];return t.length>0&&s.createElement(f.U.Item,{key:e.id,value:String(e.id)},s.createElement(f.U.Control,null,s.createElement("div",{className:G.header},s.createElement("div",{className:G.headingIcon},s.createElement("img",{src:e.thumbnail,loading:"lazy"})),s.createElement("div",{className:G.heading},e.name))),s.createElement(f.U.Panel,null,s.createElement("div",{className:G.body},t.map(e=>s.createElement(QuestionCard,{className:"question-card",key:e.id,post:e,onSkip:handleSkipQuestion})))))})):s.createElement(EmptyMessage,{message:a("profilePanel.emptyCareMess.content"),imgSrc:C.C.getAssetPath("questions.svg")}))},PostCard=({post:e,className:t=""})=>{var a;let{data:{userInfo:l,env:{togetherBasePath:n}}}=(0,s.useContext)(g.T),{t:o}=(0,O.u)(),i=(0,E.rZ)(),{authActionWrapper:r,authorProps:c}=(0,s.useContext)(q),d=`${window.location.origin}${n}/${null===(a=null==e?void 0:e.community)||void 0===a?void 0:a.slug}/${null==e?void 0:e.slug}/`;return s.createElement("div",{className:`GA-zc-O ${t}`},s.createElement("div",{className:"IB049vj"},s.createElement("a",{"data-event-category":"Together","data-event-action":"Click Post","data-event-label":d,className:"_8I--vEV",href:d,onClick:e=>{(null==l?void 0:l.id)||(e.preventDefault(),null==r||r(()=>window.location.href=d,{_location:d}))}}),s.createElement(k.d,{className:"card-author",avatarProps:{avatar:null==c?void 0:c.avatar,size:32}},s.createElement(k.C.MainText,{className:"A18McWD"},null==e?void 0:e.title),s.createElement(k.C.SubTextRow,null,s.createElement(k.C.SubText,null,null==e?void 0:e.createdTime))),s.createElement(PostContent,{className:"post-content-wrapper",description:null==e?void 0:e.description,mentions:null==e?void 0:e.mentions,maxChars:200,"data-testid":"Content of the Post",hideShowAllBtn:!0}),s.createElement(N.T,{size:"p3",color:i.fn.primaryColor()},o("post.seeMore"))))},Posts=()=>{let{t:e}=(0,O.u)(),{data:{locale:t}}=(0,s.useContext)(g.T),{authorId:a,authorProps:l,isAuthorLogin:n,onCloseFromPost:o}=(0,s.useContext)(q),[i,c]=(0,s.useState)(null),[d,u]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{a&&(0,r.a)(void 0,void 0,void 0,function*(){var e;u(!0);let l=yield(0,g.c)((0,g.f)(h.yy.USER.LIST_POST,{_locale:t,id:a,isAnonymous:0}),"GET"),n=((null===(e=null==l?void 0:l.data)||void 0===e?void 0:e.posts)||[]).map(m.a);c(n),u(!1)})},[a]),s.createElement("div",{className:"TSMHoEM"},d?s.createElement(p.L,null):null!==i&&(i.length>0?i.map(e=>s.createElement(PostCard,{className:"post-card",key:e.id,post:e})):s.createElement(EmptyMessage,{message:e("profilePanel.emptyPostMess.content",{name:(null==l?void 0:l.name)||(null==l?void 0:l.username)||""}),buttonTxt:n&&e("profilePanel.createPost"),onBtnClick:()=>{null==o||o()}})))};var U={container:"_4Vekw96",info:"DIJdGcB",body:"aQSt4-Q"};let formatExperience=e=>e?{title:null==e?void 0:e.title,organization:null==e?void 0:e.organization,duration:e.duration}:{},formatEducation=e=>e?{completedYear:null==e?void 0:e.completed_year,schoolName:e.school_name,study:e.study}:{};(l=o||(o={}))[l.About=0]="About",l[l.Care=1]="Care",l[l.Answer=2]="Answer",l[l.Posts=3]="Posts",(n=i||(i={}))[n.Expert=0]="Expert",n[n.User=1]="User";let V={experiences:[],relatedPosts:[],educations:[],awards:[],contact:{},data:{}},ProfileDetail=e=>{var t,{authorProps:a,selectedTab:l,authActionWrapper:n,onSkipQuestion:i,onCloseFromPost:c,hideQuestionTab:v,hideAnswerTab:b,showSkipQuestionTag:y,rolesToShowQuestionsTab:f=["expert"],currentPageUrl:x}=e,E=(0,r._)(e,["authorProps","selectedTab","authActionWrapper","onSkipQuestion","onCloseFromPost","hideQuestionTab","hideAnswerTab","showSkipQuestionTag","rolesToShowQuestionsTab","currentPageUrl"]);let{data:{locale:C,userInfo:S,env:{isMarryBaby:w}}}=(0,s.useContext)(g.T),{t:T}=(0,O.u)(),L=null==a?void 0:a.role,I=null==S?void 0:S.role,P=String(null==a?void 0:a.userId),[N,j]=(0,s.useState)(),[$,R]=(0,s.useState)(!1),[A,M]=(0,s.useState)(),_=(null==S?void 0:S._togetherUserId)===(null==a?void 0:a.userId),D=[...-1!==f.indexOf(L)?[{value:o.About,text:T("profilePanel.tabs.highlight"),content:s.createElement(About,{id:P,info:A}),dataEventCategory:"Together",dataEventAction:"Doctor Profile Click",dataEventLabel:x}]:[],{value:o.Posts,text:T("profilePanel.tabs.posts"),content:s.createElement(Posts,null),hasCountResult:!0,keyOfCountApi:"post",keyOfResult:"total_post"},...v||-1===f.indexOf(I)||(null==S?void 0:S._togetherUserId)!==(null==a?void 0:a.userId)?[]:[{value:o.Care,text:`${T("profilePanel.tabs.care")}`,content:s.createElement(Care,null),hasCountResult:!0,keyOfCountApi:"question",keyOfResult:"total_question",dataEventCategory:"Together",dataEventAction:"Doctor Questions Click",dataEventLabel:x}],...b||-1===f.indexOf(L)?[]:[{value:o.Answer,text:`${T("profilePanel.tabs.expertAnswer")}`,content:s.createElement(Answering,{id:P}),hasCountResult:!0,keyOfCountApi:"reply",keyOfResult:"total_reply",dataEventCategory:"Together",dataEventAction:"Doctor Reply Tab Click",dataEventLabel:x}]],[B,F]=(0,s.useState)(null),[z,Z]=(0,s.useState)(null),K={value:String(z),dataList:B,onTabChange:e=>Z(Number(e))},G=null==D?void 0:D.filter(e=>null==e?void 0:e.hasCountResult);(0,s.useEffect)(()=>{(0,r.a)(void 0,void 0,void 0,function*(){var e,t,a,n,i,r,s,c,d,u;R(!0);let p=yield Promise.all([(0,g.c)((0,g.f)(h.yy.USER.DETAIL,{_locale:C,id:P}),"GET"),...G.map(e=>(0,g.c)((0,g.f)(h.yy.USER.COUNT_TABS,{_locale:C,id:P,[e.keyOfCountApi]:1}),"GET"))]),[v]=p,b={data:null==v?void 0:v.data,experiences:((null===(t=null===(e=null==v?void 0:v.data)||void 0===e?void 0:e.fields)||void 0===t?void 0:t.experiences)||[]).map(formatExperience),relatedPosts:((null===(a=null==v?void 0:v.data)||void 0===a?void 0:a.related_post)||[]).map(e=>(0,m.b)(e.post)),educations:((null===(i=null===(n=null==v?void 0:v.data)||void 0===n?void 0:n.fields)||void 0===i?void 0:i.educations)||[]).map(formatEducation),awards:(null===(s=null===(r=null==v?void 0:v.data)||void 0===r?void 0:r.fields)||void 0===s?void 0:s.awards_accreditations)||[],contact:(null===(d=null===(c=null==v?void 0:v.data)||void 0===c?void 0:c.fields)||void 0===d?void 0:d.contact)||{}};(null==v?void 0:v.status)===1&&M(b);let y=(null==b?void 0:b.relatedPosts)||[],f=Object.keys(b.contact).map(e=>{var t;return(null===(t=null==b?void 0:b.contact)||void 0===t?void 0:t[e])!==""}),x=[...(null==b?void 0:b.experiences)||[],...(null==b?void 0:b.educations)||[],...(null==b?void 0:b.awards)||[]],E=y.length>0||f.length>0||x.length>0,S={},k=G.map((e,t)=>{var a,l,n;let i=(null===(n=null===(l=null===(a=p[t+1])||void 0===a?void 0:a.data)||void 0===l?void 0:l.counting)||void 0===n?void 0:n[e.keyOfResult])||0;return i>0?(S[e.keyOfResult]=i,e):-1!==[o.Care,o.Posts].indexOf(e.value)?e:void 0}).filter(Boolean).map(e=>e.value),w=D.map(e=>{let t=Object.assign(Object.assign({},e),{text:e.text+(e.keyOfResult?` (${(null==S?void 0:S[e.keyOfResult])||"0"})`:"")});return t.hasCountResult?-1!==k.indexOf(t.value)?t:void 0:t.value===o.About?E&&t:t}).filter(Boolean);F(w),Z(l||(null===(u=null==w?void 0:w[0])||void 0===u?void 0:u.value)),j(S),R(!1)})},[]);let V=null==A?void 0:A.data;return s.createElement(q.Provider,{value:{isMarryBaby:w,siteType:w?"marryBaby":"helloSites",authorId:String((null==a?void 0:a.userId)||""),authActionWrapper:n,onSkipQuestion:i,info:A,authorProps:a,onCloseFromPost:c,countValues:N,setCountValues:j,isAuthorLogin:_,showSkipQuestionTag:y,currentPageUrl:x}},s.createElement("div",Object.assign({},E,{className:`${U.container} ${(null==E?void 0:E.className)||""}`,"data-is-marrybaby":w}),$?s.createElement(p.L,null):s.createElement(s.Fragment,null,s.createElement(k.C,Object.assign({},a,{className:"card-author",showDetailPopup:!1,subLine:(null==a?void 0:a.role)==="expert"?(null==V?void 0:V.specialty)&&(null==V?void 0:V.organisation)&&s.createElement(k.C.SubTextRow,null,(null==V?void 0:V.specialty)&&s.createElement(s.Fragment,null,s.createElement(k.C.SubText,null,null==V?void 0:V.specialty),s.createElement(k.C.SubDivider,null)),s.createElement(k.C.SubText,null,null==V?void 0:V.organisation)):(null==V?void 0:V.created_at)&&s.createElement(k.C.SubTextRow,null,s.createElement(k.C.SubText,null,T("profilePanel.joined")," ",d()(null==V?void 0:V.created_at).toNow(!0)))})),"expert"===L&&s.createElement("div",{className:U.info,dangerouslySetInnerHTML:{__html:null===(t=null==A?void 0:A.data)||void 0===t?void 0:t.description}}),null!==B&&null!==z&&(B.length>0?s.createElement("div",{className:U.body},s.createElement(u.T,Object.assign({},K))):s.createElement(EmptyMessage,{message:T("profilePanel.emptyPostMess.content",{text:(null==a?void 0:a.name)||(null==a?void 0:a.username)||""})})))))}},NWQy:function(e,t,a){a.d(t,{B:function(){return BookingSearchBarV3},T:function(){return TextDivider}});var l,n,o,i,r=a("q1tI"),s=a("6mQP"),c=a("0D4Z"),d=a("iuhU"),u=a("Eso5"),p=a("aDCK"),m=a("mYVa"),h=a("vaps"),g=a("8vDj"),v=a("OAL+"),b=a("SPK5"),y=a("TIp3"),f=a("CmzK"),x=a("NEaA"),E=a("rlLN"),C=a("Iblh"),S=a("SHVZ"),k=a("nBAg"),w=a("5kis"),O=a("sEfC"),T=a.n(O),L=a("86J3"),I=a("rBCA"),P=a("iBNF"),N=a("HMwR"),j=a("f1C9"),$=a("/kWL"),R=a("p34X"),A=a("z/kP"),M=a("A24R"),_=a("GqLv"),D=a("LIyQ"),B=a("g8xC");let F=I.Z.div``,z=I.Z.div` background-color: ${P.r.colors.neutral50}; padding-bottom: 1px; ${N.M.mbDown} { padding: 0; } `,q=(0,I.Z)(j.C)` padding: 0 16px; ${N.M.mbDown} { padding: 0; } `,Z=I.Z.div` padding: 24px 56px; border-radius: 16px; background-color: ${P.r.colors.white}; box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.04), 0px 0px 2px 0px rgba(0, 0, 0, 0.06), 0px 4px 8px 0px rgba(0, 0, 0, 0.04); ${N.M.mbDown} { padding: 16px; border-radius: 0; } .flex-search-input { flex-direction: row; ${N.M.mbDown} { flex-direction: column; } } `,K={"en-PH":3,"tl-PH":2,"id-ID":3,"vi-VN":2,"zh-TW":0,"ms-MY":2,"th-TH":2},G={isMobile:!1,isDebug:!1,navigateTo:null,geoLocationPermission:"unset",geoLocationCoordinates:null,focused:"none",focusedSpecialty:"none",searchLocationKeywords:"",searchSpecialtyKeywords:"",searchKeywords:"",selectedLocation:null,selectedSpecialty:null,defaultCity:null,initialCities:[],cities:[],searchResults:{},initialSearchResults:{},isLoadingCities:!1,isLoadingSearchResults:!1,isMobileModalOpened:!1,initialSelectedCity:null,autoCompleteDisabled:!1,inputSearchPlaceholder:"",locale:"vi-VN",allSpecialties:[],popularKeys:[]};function resetSearchLocationKeywords(e){let{selectedLocation:t,searchLocationKeywords:a}=e;return t&&a!==t.name?Object.assign(Object.assign({},e),{searchLocationKeywords:t.name}):e}function reducer(e,t){var a,l;switch(e.isDebug&&console.log("bookingSearchBarV3",{action:t,state:e}),t.type){case o.NavigateTo:return Object.assign(Object.assign({},e),{navigateTo:t.payload,focused:"none",isMobileModalOpened:!1});case o.ClickOutsideInputLocation:if("location"!==e.focused)return e;return resetSearchLocationKeywords(Object.assign(Object.assign({},e),{focused:"none"}));case o.ClickOutsideInputSpecialty:if("specialty"!==e.focused)return e;return resetSearchLocationKeywords(Object.assign(Object.assign({},e),{focused:"none"}));case o.ClickOutsideInputSearch:if("search"!==e.focused)return e;return Object.assign(Object.assign({},e),{focused:"none"});case o.ClickOutsideInputSearchSpecialty:if("search"!==e.focusedSpecialty)return e;return Object.assign(Object.assign({},e),{focusedSpecialty:"none"});case o.FocusInputLocation:{let t=Object.assign(Object.assign({},e),{focused:"location"});return(null===(a=e.selectedLocation)||void 0===a?void 0:a.id)===L.a&&(t.searchLocationKeywords=""),t}case o.FocusInputSpecialty:{let t=Object.assign(Object.assign({},e),{focused:"specialty"});return(null===(l=e.selectedLocation)||void 0===l?void 0:l.id)===L.a&&(t.searchLocationKeywords=""),t}case o.FocusInputSearch:let n=Object.assign(Object.assign({},e),{focused:"search"});if(e.isMobile)return resetSearchLocationKeywords(n);return n;case o.FocusInputSearchSpecialty:{let t=Object.assign(Object.assign({},e),{focusedSpecialty:"search"});return t}case o.ChangeInputLocation:return Object.assign(Object.assign({},e),{searchLocationKeywords:t.payload});case o.ChangeInputSearch:{let a=t.payload;return Object.assign(Object.assign({},e),{searchKeywords:a,isLoadingSearchResults:a.trim().length>K[e.locale]})}case o.SelectCurrentLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case o.ClearInputLocation:return Object.assign(Object.assign({},e),{focused:"location",cities:e.initialCities,searchLocationKeywords:""});case o.ClearInputSearch:return Object.assign(Object.assign({},e),{focused:"search",searchKeywords:""});case o.SelectLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name,searchResults:{}});case o.SelectSpecialty:return Object.assign(Object.assign({},e),{focused:"none",selectedSpecialty:t.payload,searchResults:{}});case o.SelectSearchResult:return Object.assign(Object.assign({},e),{searchKeywords:t.payload.name,isMobileModalOpened:!1,focused:"none",navigateTo:t.payload.url});case o.FetchCitiesStart:return Object.assign(Object.assign({},e),{isLoadingCities:!0});case o.FetchCitiesFinish:return Object.assign(Object.assign({},e),{isLoadingCities:!1});case o.FetchSearchResultsStart:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!0});case o.FetchSearchResultsFinish:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!1});case o.FetchSearchResultsComplete:{let a=Object.assign(Object.assign({},e),{searchResults:Object.assign(Object.assign({},e.searchResults),{[t.payload.key]:t.payload.searches})});return a}case o.FetchCitiesByGeoIpComplete:{let{cities:a}=t.payload,{default:l}=t.payload;a=a.filter(e=>e.id!==l.id),l&&a.unshift(l),e.initialSelectedCity&&!a.find(t=>t.id===e.initialSelectedCity.id)&&a.unshift(e.initialSelectedCity);let n=Object.assign(Object.assign({},e),{defaultCity:l,initialCities:a,cities:a});return"denied"!==e.geoLocationPermission||e.initialSelectedCity||(n.selectedLocation=l,n.searchLocationKeywords=l.name),n}case o.FetchCitiesByKeywordComplete:return Object.assign(Object.assign({},e),{cities:t.payload});case o.DisplayInitialCities:return Object.assign(Object.assign({},e),{cities:e.initialCities});case o.DisplayInitialSearchResults:{let t=e.searchKeywords.trim(),a=K[e.locale],l=t.length>0&&t.length<=a;return Object.assign(Object.assign({},e),{searchResults:l?{}:e.initialSearchResults,isLoadingSearchResults:!1})}case o.UpdateInitialSearchResults:return Object.assign(Object.assign({},e),{initialSearchResults:Object.assign(Object.assign({},e.initialSearchResults),{[t.payload.key]:t.payload.searches})});case o.GrantGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"granted",geoLocationCoordinates:t.payload});case o.DenyGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"denied",geoLocationCoordinates:null});case o.OpenMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!0});case o.CloseMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!1});case o.UpdateInitialSearchValue:return Object.assign(Object.assign({},e),{searchKeywords:t.payload});case o.SetInputSearchPlaceholder:return Object.assign(Object.assign({},e),{inputSearchPlaceholder:t.payload});case o.FetchAllSpecialties:return Object.assign(Object.assign({},e),{allSpecialties:t.payload});case o.FetchPopularKeys:return Object.assign(Object.assign({},e),{popularKeys:t.payload});default:return e}}(l=o||(o={})).NavigateTo="navigate to url",l.ClickOutsideInputLocation="click outside input location",l.ClickOutsideInputSearch="click outside input search",l.ClickOutsideInputSearchSpecialty="click outside input search specialty",l.ClickOutsideInputSpecialty="click outside input specialty",l.SelectCurrentLocation="select current location",l.FocusInputLocation="focus input location",l.FocusInputSearch="focus input search",l.FocusInputSearchSpecialty="focus input search specialty",l.ChangeInputLocation="change input location",l.ChangeInputSearch="change input search",l.ClearInputLocation="clear input location",l.ClearInputSearch="clear input search",l.SelectLocation="select location",l.SelectSpecialty="select specialty",l.FetchCitiesStart="fetch cities start",l.FetchCitiesFinish="fetch cities finish",l.FetchSearchResultsStart="fetch search results start",l.FetchSearchResultsComplete="fetch search results complete",l.FetchSearchResultsFinish="fetch search results finish",l.FetchCitiesByGeoIpComplete="fetch cities by geo IP finish",l.FetchCitiesByKeywordComplete="fetch cities by keyword finish",l.DisplayInitialCities="display initial cities",l.DisplayInitialSearchResults="display initial search results",l.UpdateInitialSearchResults="update initial search results",l.GrantGeoLocationPermission="grant geolocation permission",l.DenyGeoLocationPermission="deny geolocation permission",l.OpenMobileModal="open mobile modal",l.CloseMobileModal="close mobile modal",l.UpdateInitialSearchValue="update initial search value",l.SelectSearchResult="select search result",l.SetInputSearchPlaceholder="set input search placeholder",l.FocusInputSpecialty="focus input specialty",l.FetchAllSpecialties="fetch all specialty",l.FetchPopularKeys="fetch popular key by type";let U=I.Z.div` flex: 1; position: relative; ${N.M.mbDown} { width: 100%; } `,V=I.Z.div` background: #f7f9fc; border-radius: 12px; height: 48px; display: flex; align-items: center; padding: 4px 12px 4px 4px; gap: 16px; ${N.M.mbDown} { height: 48px; width: 100%; } `,Q=I.Z.div` display: flex; align-items: center; flex-shrink: 0; color: #8c8c8c; svg { width: 18px; height: 18px; } `,H=I.Z.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${P.r.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${N.M.mbDown} { width: calc(100% + 64px); left: -32px; } `,W=I.Z.div``;I.Z.div` display: flex; justify-content: space-between; align-item: center; padding: 9px 14px 9px 22px; background: #f7f9fc; .title { color: ${P.r.colors.gray800}; font-size: 14px; font-weight: 600; line-height: 22px; } .btn-see-all { color: ${P.r.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `;let Y=I.Z.div` padding: 10px 16px; max-height: 400px; overflow: auto; `,J=I.Z.div` display: flex; gap: 12px; align-items: center; cursor: pointer; ${N.M.mbUp} { &:hover { background-color: ${P.r.colors.blue50}; } } .image-item { flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; img { object-fit: contain; width: 100%; height: 100%; border-radius: 50%; } } .infor { overflow: hidden; padding: 12px 0; flex: 1; border-bottom: 1px solid ${P.r.colors.neutral100}; .title { color: ${P.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; } .description { overflow: hidden; color: ${P.r.colors.gray600}; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 18px; display: flex; gap: 8px; align-items: center; margin-top: 5px; svg { flex: 0 0 16px; } .sub-description { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; } } } &.last-item { .infor { border-bottom: none; } } `;I.Z.div` padding: 0 16px 16px; .search-detail-btn { color: ${P.r.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `;let SearchResult=({state:e,type:t,results:a,isLoading:l,typeInformation:n,dispatch:i})=>{let{t:s}=(0,w.u)(),{selectedLocation:u}=e,p=(0,r.useMemo)(()=>n[t].slug,[n,t]),handleOnClick=e=>{let a="";switch(t){case"service":a=`/${u.slug}/${p}/${e.slug}`;break;case"doctor":case"hospital":a=`/${p}/${e.slug}-${e.id}`}a&&i({type:o.NavigateTo,payload:a})};return null===a?null:r.createElement(W,null,r.createElement(Y,{className:"search-results__body"},l&&r.createElement("div",{className:"skeleton-result"},[,,,].fill(void 0).map((e,a)=>r.createElement(J,{key:t+"loading"+a,className:2===a?"last-item":""},r.createElement("div",{className:"image-item"},r.createElement(c.O,{height:48,circle:!0,mb:"xl",animate:!0})),r.createElement("div",{className:"infor"},r.createElement("div",{className:"title"},r.createElement(c.O,{height:8,mt:10,radius:"xl",animate:!0})),r.createElement("div",{className:"description"},r.createElement("div",{className:"sub-description"},r.createElement(c.O,{height:8,mt:10,radius:"xl",width:"80%",animate:!0}))))))),!l&&a&&a.length>0&&r.createElement(r.Fragment,null,a.map((e,l)=>{var o,i;let s=a.length>4&&3===l||a.length<=4&&l===a.length-1,c="";return("hospital"===t&&(c=(null==e?void 0:e.address)||""),"doctor"===t&&(c=(null===(o=null==e?void 0:e.specialties)||void 0===o?void 0:o.join(", "))||""),"service"===t&&(c=(null===(i=null==e?void 0:e.hospital_branch)||void 0===i?void 0:i.name)||""),l>=4)?r.createElement(r.Fragment,null):r.createElement(J,{key:e.id,className:(0,d.default)(s?"last-item":"","result-item"),onClick:()=>handleOnClick(e)},r.createElement("div",{className:"image-item"},r.createElement("img",{src:e.logo||e.avatar,alt:e.name})),r.createElement("div",{className:"infor"},r.createElement("div",{className:"title"},e.name),r.createElement("div",{className:"description"},n[t].icon,r.createElement("div",{className:"sub-description"},c))))})),!l&&(null==a?void 0:a.length)===0&&r.createElement($.T,{size:"sm",color:P.r.colors.gray400,className:"noresult-block"},s("booking.searchBar.noResults"))))},SearchResultContent=({state:e,type:t,isLoading:a,clientSlug:l,typeInformation:n,dispatch:o})=>{var i;return"search"!==e.focused?null:r.createElement(SearchResult,{type:t,state:e,results:(null===(i=e.searchResults)||void 0===i?void 0:i[t])||null,location:e.selectedLocation.name,dispatch:o,isLoading:a,typeInformation:n,clientSlug:l})},X=I.Z.div` position: relative; flex-shrink: 0; ${N.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } &.compact { ${N.M.mbDown} { width: auto; display: block; } } `,ee=I.Z.div` position: absolute; top: calc(100% + 4px); left: 0; min-width: 264px; background: white; border-radius: 12px; box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.04), 0px 2px 8px 0px rgba(0, 0, 0, 0.04), 0px 10px 16px 0px rgba(0, 0, 0, 0.04); z-index: 10; overflow: hidden; &.mobile { min-width: 280px; } `,et=I.Z.div` cursor: pointer; padding: 12px 16px; display: flex; align-items: center; gap: 12px; outline: none; .image-item { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; img { width: 100%; height: 100%; object-fit: contain; } svg { width: 24px; height: 24px; } } .item-label { font-size: 15px; font-weight: 400; line-height: 24px; letter-spacing: -0.3px; color: ${P.r.colors.gray800}; } &:hover { background-color: ${P.r.colors.neutral50}; } &.selected { background-color: ${P.r.colors.neutral50}; } &:last-child { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; } `,DoctorIcon=()=>r.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},r.createElement("path",{d:"M8.983 14.333q-1.666 0-2.833-1.166Q4.983 12 4.983 10.333v-.366a3.48 3.48 0 0 1-2.258-1.2 3.57 3.57 0 0 1-.909-2.434V3.1a.58.58 0 0 1 .175-.425.58.58 0 0 1 .425-.175h1.4v-.167a.486.486 0 0 1 .5-.5q.217 0 .36.142a.5.5 0 0 1 .14.358v1.334a.485.485 0 0 1-.5.5.484.484 0 0 1-.5-.5V3.5h-1v2.833q0 1.1.784 1.884Q4.383 9 5.483 9t1.883-.783.784-1.884V3.5h-1v.167a.485.485 0 0 1-.5.5.484.484 0 0 1-.5-.5V2.333a.486.486 0 0 1 .5-.5q.217 0 .358.142a.5.5 0 0 1 .142.358V2.5h1.4a.58.58 0 0 1 .425.175.58.58 0 0 1 .175.425v3.233q0 1.4-.908 2.434a3.5 3.5 0 0 1-2.259 1.2v.366q0 1.25.875 2.126a2.9 2.9 0 0 0 2.125.874q1.25 0 2.125-.874a2.9 2.9 0 0 0 .875-2.126V9.25a1.74 1.74 0 0 1-.858-.609 1.6 1.6 0 0 1-.342-1.008q0-.716.5-1.216t1.2-.5q.716 0 1.217.5.5.5.5 1.216 0 .567-.342 1.008t-.875.609v1.083q0 1.667-1.167 2.834-1.166 1.166-2.833 1.166m3.5-6q.3 0 .509-.208a.67.67 0 0 0 .208-.492q0-.3-.208-.508a.7.7 0 0 0-.509-.208q-.3 0-.5.208a.7.7 0 0 0-.2.508q0 .284.2.492t.5.208",fill:"#595959"})),ServiceIcon=()=>r.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},r.createElement("path",{d:"M6.868 9.265v.974q0 .405.284.69.284.283.69.283t.69-.284.284-.69v-.973h.973q.405 0 .69-.284a.94.94 0 0 0 .284-.689.94.94 0 0 0-.284-.69.94.94 0 0 0-.69-.284h-.973v-.974a.94.94 0 0 0-.284-.69.94.94 0 0 0-.69-.284.94.94 0 0 0-.689.284.94.94 0 0 0-.285.69v.974h-.973a.94.94 0 0 0-.69.283.94.94 0 0 0-.284.69q0 .405.284.69.285.284.69.284zm-3.46 4.868q-.581 0-.994-.413A1.36 1.36 0 0 1 2 12.725v-6.65a1.4 1.4 0 0 1 .563-1.127l4.434-3.333q.369-.282.844-.282.474 0 .846.282l4.434 3.333q.264.193.413.493.15.3.15.633v6.651q0 .58-.414.995a1.36 1.36 0 0 1-.994.413zm0-1.168h8.868q.105 0 .172-.068a.23.23 0 0 0 .068-.172v-6.65a.2.2 0 0 0-.027-.11.3.3 0 0 0-.07-.085L7.983 2.554a.2.2 0 0 0-.142-.052.2.2 0 0 0-.142.052L3.266 5.88a.3.3 0 0 0-.071.086.2.2 0 0 0-.027.108v6.651q0 .105.068.172a.23.23 0 0 0 .172.068",fill:"#595959"})),HospitalIcon=()=>r.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},r.createElement("path",{d:"M8 8q.55 0 .941-.392.393-.391.392-.941 0-.55-.392-.942A1.28 1.28 0 0 0 8 5.333q-.55 0-.942.392a1.28 1.28 0 0 0-.391.942q0 .55.391.941Q7.45 8 8 8m0 4.9q2.032-1.866 3.017-3.392Q12 7.983 12 6.8q0-1.817-1.158-2.975Q9.682 2.667 8 2.667T5.158 3.825Q4 4.983 4 6.8q0 1.184.983 2.708Q5.966 11.034 8 12.9m0 1.517a.8.8 0 0 1-.5-.183q-2.433-2.151-3.633-3.992T2.667 6.8q0-2.5 1.608-3.983Q5.883 1.332 8 1.333q2.116 0 3.725 1.484T13.333 6.8q0 1.6-1.2 3.442-1.2 1.841-3.633 3.991a.8.8 0 0 1-.5.184",fill:"#8C8C8C"})),SpecialtyIcon=()=>r.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},r.createElement("path",{d:"M3.833.5a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667M10.5.5c-.92 0-1.667.746-1.667 1.667V5.5c0 .92.746 1.667 1.667 1.667h3.333c.921 0 1.667-.746 1.667-1.667V2.167C15.5 1.246 14.754.5 13.833.5zM3.833 8.833a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667m8.334 0a3.333 3.333 0 1 0 0 6.667 3.333 3.333 0 0 0 0-6.667",fill:"#9AA2AC"})),SearchSpecialty=({state:e,isMobile:t,onSpecialtyClick:a,dispatch:l,isCompact:n=!1})=>{let{t:i,locale:c}=(0,w.u)(),d=(0,r.useRef)(null),g=(0,r.useRef)(null),v=(0,r.useMemo)(()=>L.L[c],[c]),[b,y]=(0,r.useState)(""),[f,{close:x,toggle:E}]=(0,C.q)(!1);(0,k.a)(d,()=>{x(),y(""),l({type:o.ClickOutsideInputSpecialty})});let S=(0,r.useMemo)(()=>[{name:i("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:v.SPECIALTIES},...e.allSpecialties],[e.allSpecialties,i,v.SPECIALTIES]),O=(0,r.useMemo)(()=>b.trim()?S.filter(e=>e.name.toLowerCase().includes(b.toLowerCase().trim())):S,[S,b]),T=(0,r.useMemo)(()=>e.selectedSpecialty?e.selectedSpecialty.name:"",[e.selectedSpecialty]),I=(0,r.useCallback)(e=>{a({id:e.id,name:e.name,slug:e.slug,thumbnail:e.thumbnail||"",total_doctor:0}),x(),y("")},[a,x]),N=(0,r.useCallback)(()=>{E(),f&&y("")},[E,f]);return r.createElement(X,{ref:d,className:n?"compact":""},r.createElement(u.x,{onClick:N,className:f?"dropdown-trigger-open":"",sx:{cursor:"pointer",position:"relative",width:n?t?96:160:"100%",flexShrink:0}},r.createElement(p.I,{readOnly:!0,value:T,placeholder:i("booking.searchPopup.specialties"),rightSection:r.createElement(R.C,{style:{width:20,height:20}}),styles:Object.assign({input:{cursor:"pointer",outline:"none","&:focus":{outline:"none"},"&:not(.mantine-Textarea-input)":{height:n?40:t?40:46,fontSize:n?(0,m.h)(14):t?(0,m.h)(14):(0,m.h)(16),paddingLeft:n?12:16,paddingRight:30,background:n?"white":"transparent",border:n?`1px solid ${P.r.colors.gray200}`:"none",borderRadius:8,letterSpacing:"-0.2px",color:P.r.colors.gray800,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}},rightSection:{width:30,pointerEvents:"none"}},!n&&{wrapper:{position:"relative","&:after":{content:'""',width:"1px",height:"20px",backgroundColor:P.r.colors.neutral100,position:"absolute",right:0,top:"50%",transform:"translateY(-50%)"}}})})),f&&r.createElement(ee,{className:t?"mobile":""},r.createElement(u.x,{sx:{padding:"12px 12px 8px"}},r.createElement(p.I,{ref:g,icon:r.createElement(s.Z,{size:18,color:P.r.colors.gray300}),placeholder:i("booking.searchBar.placeholder.specialty"),value:b,onChange:e=>y(e.target.value),size:"md",styles:{input:{height:40,fontSize:(0,m.h)(15),paddingLeft:36,"&::placeholder":{color:P.r.colors.gray400}},icon:{width:36}}})),r.createElement(h.x.Autosize,{mah:300},0===O.length?r.createElement(u.x,{sx:{padding:"12px 16px",color:P.r.colors.gray400,fontSize:14}},i("common.noResult")):O.map(t=>{var a,l;return r.createElement(et,{key:t.id,tabIndex:0,role:"option","aria-selected":(null===(a=e.selectedSpecialty)||void 0===a?void 0:a.id)===t.id,className:(null===(l=e.selectedSpecialty)||void 0===l?void 0:l.id)===t.id?"selected":"",onClick:()=>I(t),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),I(t))}},r.createElement("div",{className:"image-item"},t.thumbnail?r.createElement("img",{src:t.thumbnail,alt:t.name}):r.createElement(SpecialtyIcon,null)),r.createElement("span",{className:"item-label"},t.name))}))))},ea=(0,r.forwardRef)(({state:e,type:t,isMobile:a,isLoading:l,initalSearchValue:n,typeInformation:i,debouncedFetchSearchResults:c,trackingAttributes:d,hideSpecialtySelection:u=!1,clientSlug:h="",onSearch:g,onFocusInput:v,onEnterSearch:b,dispatch:y,onlyShowSearchBox:f,onChangeSpecialty:x},E)=>{let{t:C}=(0,w.u)(),S=(0,r.useRef)(null),O=(0,r.useRef)(null);(0,r.useImperativeHandle)(E,()=>({focus:()=>{var e;null===(e=O.current)||void 0===e||e.focus()}}));let T=(0,r.useMemo)(()=>d?{"data-event-category":d.dataEventCategory,"data-event-action":d.dataEventAction,"data-event-label":d.dataEventLabel}:{},[d]),L=(0,r.useMemo)(()=>"doctor"===t?C("booking.searchBar.placeholder.doctor"):"service"===t?C("booking.searchBar.placeholder.service"):"hospital"===t?C("booking.searchBar.placeholder.hospital"):"specialty"===t?C("booking.searchBar.placeholder.specialty"):"",[t,C]),I="specialty"!==t&&"service"!==t&&!u&&!f,N=(0,r.useMemo)(()=>({input:{border:"none",background:"transparent",height:"100%",fontSize:(0,m.h)(16),color:P.r.colors.gray800,padding:"0","&::placeholder":{color:P.r.colors.gray400},"&:focus":{outline:"none",boxShadow:"none"},[a?"@media (max-width: 767px)":""]:a?{fontSize:(0,m.h)(16)}:{}},wrapper:{flex:1}}),[a]);(0,k.a)(S,()=>{a||y({type:o.ClickOutsideInputSearch})});let j=(0,r.useCallback)(function(a){y({type:o.ChangeInputSearch,payload:a}),"function"!=typeof g&&(a.trim().length>K[e.locale]||n||0===a.trim().length)&&c(a.trim(),e,t,h)},[y,e,t,n,c,h,g]),$=(0,r.useCallback)(function(e){var t;y({type:o.SelectSpecialty,payload:e}),null==x||x(e),a||null===(t=O.current)||void 0===t||t.focus()},[y,x]),R=(0,r.useCallback)(e=>{"Enter"===e.key&&(e.stopPropagation(),e.preventDefault(),b&&b())},[b]);return r.createElement(U,{ref:S},r.createElement(V,null,I&&r.createElement(SearchSpecialty,{state:e,isMobile:a,dispatch:y,debouncedFetchSearchResults:c,onSpecialtyClick:$,isCompact:!0}),r.createElement(Q,null,r.createElement(s.Z,null)),r.createElement(p.I,Object.assign({ref:O,variant:"unstyled",size:a?"md":"lg",placeholder:L,styles:N,value:e.searchKeywords,name:"search-results",autoComplete:"off",onFocus:()=>{y({type:o.FocusInputSearch}),null==v||v()},onChange:e=>{j(e.target.value)},onKeyDown:R},T))),!a&&"specialty"!==t&&r.createElement(H,null,r.createElement(SearchResultContent,{type:t,state:e,dispatch:y,isLoading:l,typeInformation:i,clientSlug:h})))});ea.displayName="SearchInputs";let ModalSearchResult=e=>{var{searchInputEle:t,closeModal:a,children:l}=e,n=(0,A._)(e,["searchInputEle","closeModal","children"]);let o=(0,g.rZ)();return r.createElement(_.M,Object.assign({},n,{zIndex:310,fullScreen:!0,styles:{content:{borderRadius:0,height:"100%",".search-results__body":{padding:0},".result-item":{paddingLeft:16,paddingRight:16},".noresult-block":{padding:16},".skeleton-result":{padding:16}},header:{display:"none"}}}),r.createElement(v.K,{spacing:16,sx:{paddingTop:16}},r.createElement(b.k,{align:"center",gap:12},r.createElement(M.Z,{size:28,onClick:a,color:o.fn.primaryColor()}),r.createElement(u.x,{sx:{width:"100%"}},t)),l))},el=I.Z.div` position: relative; width: 240px; flex-shrink: 0; ${N.M.mbDown} { width: 100%; } `;I.Z.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${P.r.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${N.M.mbDown} { width: calc(100% + 64px); left: -32px; } `;let en=I.Z.div` position: relative; cursor: pointer; padding: 12px 18px; display: flex; align-items: center; gap: 14px; overflow: hidden; & + li::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background-color: ${P.r.colors.neutral100}; } &:not([data-is-denied='true']):hover { background-color: ${P.r.colors.neutral50}; } &:last-child:hover { border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; } &:first-child:hover { border-top-right-radius: 6px; border-top-left-radius: 6px; } &[data-is-denied='true'] { cursor: not-allowed; } `,eo=(0,I.Z)(S.P)` width: 12px; height: 18px; flex: 0 0 12px; `,ei=(0,r.forwardRef)((e,t)=>{var{label:a,value:l}=e,n=(0,A._)(e,["label","value"]);return r.createElement("div",Object.assign({ref:t},n),r.createElement(en,{key:l,role:"button",tabIndex:0,"aria-label":`Select ${a} as location`,className:"location-item"},r.createElement(eo,{color:P.r.colors.neutral400}),r.createElement(y.x,{size:"md"},a)))}),SearchLocation=({state:e,debouncedFetchCitiesByKeyword:t,selectedLocation:a,trackingAttributes:l,onLocationClick:n,dispatch:i})=>{var s;let{t:c,locale:d}=(0,w.u)(),u=(0,r.useRef)(null),p=(0,r.useMemo)(()=>{var t;return[{name:c("booking.searchBar.allLocations"),id:L.I,slug:null===(t=L.L[d])||void 0===t?void 0:t.ALL},...e.cities]},[e.cities,c,d]),h=(0,r.useMemo)(()=>l?{"data-event-category":l.dataEventCategory,"data-event-action":l.dataEventAction,"data-event-label":l.dataEventLabel}:{},[l]),g=(0,r.useCallback)(function(a){i({type:o.ChangeInputLocation,payload:a}),a.trim().length>K[e.locale]?t(a.trim()):(t.cancel(),i({type:o.DisplayInitialCities}))},[t,i,e.locale]);(0,k.a)(u,()=>{i({type:o.ClickOutsideInputLocation})});let v=null!==(s=null==a?void 0:a.id)&&void 0!==s?s:null,b=null===v?void 0:String(v);return r.createElement(el,{ref:u},r.createElement(f.Ph,Object.assign({key:null!=b?b:"no-selected-location",defaultValue:b,placeholder:c("booking.searchBar.allLocations"),searchable:!0,onSearchChange:e=>{g(e)},onFocus:()=>{i({type:o.DisplayInitialCities})},onDropdownClose:()=>{t.cancel(),i({type:o.DisplayInitialCities})},nothingFound:c("common.noResult"),maxDropdownHeight:340,dropdownPosition:"bottom",icon:r.createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},r.createElement("path",{d:"M9.99908 10.8332C11.2264 10.8332 12.2213 9.83764 12.2213 8.61097C12.2213 7.3843 11.2264 6.38875 9.99908 6.38875C8.77174 6.38875 7.77686 7.3843 7.77686 8.61097C7.77686 9.83764 8.77174 10.8332 9.99908 10.8332Z",stroke:"#111111",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),r.createElement("path",{d:"M9.99919 18.0554C11.7584 17.4999 16.6659 13.611 16.6659 8.61097C16.6659 4.93097 13.6811 1.94431 9.99919 1.94431C6.3173 1.94431 3.33252 4.93097 3.33252 8.61097C3.33252 13.611 8.23996 17.4999 9.99919 18.0554Z",stroke:"#111111",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),rightSection:r.createElement(R.C,{style:{width:20,height:20}})},h,{styles:()=>({item:{padding:0,"&[data-selected]":{"&, &:hover":{backgroundColor:"#F7F9FC",color:"inherit"},".location-item":{"&::after":{content:S.i,top:"50%",right:19,position:"absolute",transform:"translateY(-50%)"}}},"&[data-hovered]":{backgroundColor:"transparent"}},root:{width:"100%"},wrapper:{width:"100%"},input:{"&:not(.mantine-Textarea-input)":{height:48,fontSize:(0,m.h)(15),fontWeight:400,letterSpacing:"-0.3px",color:P.r.colors.gray1000,paddingLeft:44,paddingRight:40,background:"white",border:`1px solid ${P.r.colors.gray200}`,borderRadius:12}},icon:{width:44,paddingLeft:12},rightSection:{width:40,paddingRight:12},itemsWrapper:{padding:0},dropdown:{left:"0 !important",border:0,marginTop:4,borderRadius:12,overflow:"hidden",boxShadow:"0px 0px 1px 0px rgba(0, 0, 0, 0.04), 0px 2px 8px 0px rgba(0, 0, 0, 0.04), 0px 10px 16px 0px rgba(0, 0, 0, 0.04)","& ::-webkit-scrollbar":{width:"6px",height:"6px"}}}),itemComponent:ei,filter:()=>!0,onChange:e=>{if(null==e)return;let a=p.find(t=>String(t.id)===e);a&&(n(a),t.cancel(),i({type:o.DisplayInitialCities}),setTimeout(()=>{var e,t;null===(t=null===(e=u.current)||void 0===e?void 0:e.querySelector("input"))||void 0===t||t.blur()},0))},data:p.map(e=>({value:String(e.id),label:e.name,city:e}))})))},er=I.Z.div` display: flex; flex-wrap: wrap; row-gap: 8px; column-gap: 20px; ${N.M.mbDown} { margin-top: 12px; } `,es=I.Z.div` display: flex; align-items: center; border-radius: 8px; border: 1px solid ${P.r.colors.neutral100}; background: ${P.r.colors.white}; padding: 8px 12px 8px 8px; flex: 0 0 calc(33.3% - 13px); gap: 12px; cursor: pointer; &:hover { background: ${P.r.colors.blue50}; } ${N.M.tdDown} { flex: 0 0 calc(50% - 10px); } ${N.M.mbDown} { flex: 0 0 100%; border: none; } .image-item { display: flex; align-items: center; width: 40px; height: 40px; img { width: 100%; object-fit: cover; } } .infor { flex: 1; .title { color: ${P.r.colors.gray800}; font-size: 14px; font-style: normal; font-weight: 400; line-height: 22px; } .description { color: ${P.r.colors.gray600}; font-size: 12px; font-weight: 400; line-height: 18px; } } `,ec=(0,I.Z)(x.i)` margin: 24px 0 !important; `,ed=I.Z.div` display: flex; justify-content: center; margin-top: 24px; .show-more { border-radius: 4px; border: 1px solid ${P.r.colors.neutral200}; padding: 12px 16px; cursor: pointer; display: inline-block; color: ${P.r.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; ${N.M.mbDown} { width: 100%; text-align: center; } } `,SearchResultSpecialties=({state:e,isMobile:t,specialties:a,isLoading:l,dispatch:n})=>{let{t:i,locale:s}=(0,w.u)(),{selectedLocation:d}=e,u=(0,r.useMemo)(()=>L.L[s],[s]),handleOnClick=e=>{let t="";e===L.S?(t=`/${d.slug}/${u.HOSPITAL}/${L.C.GSK}/`,n({type:o.ClickOutsideInputSearchSpecialty})):t=`/${d.slug}/${u.DOCTOR}/${e}`,n({type:o.NavigateTo,payload:t})},p=(0,r.useMemo)(()=>a.length>=9||e.searchKeywords.trim().length<=K[e.locale],[e.searchKeywords,a]);return r.createElement(r.Fragment,null,!t&&r.createElement(ec,{color:"#E4E8EC"}),r.createElement(er,null,a.length>0&&!l&&r.createElement(r.Fragment,null,a.map((e,t)=>t>=9?r.createElement(r.Fragment,null):r.createElement(es,{key:e.id,onClick:()=>handleOnClick(e.slug)},r.createElement("div",{className:"image-item"},r.createElement("img",{src:e.thumbnail,alt:e.name})),r.createElement("div",{className:"infor"},r.createElement("div",{className:"title"},e.name))))),0===a.length&&!l&&r.createElement($.T,{size:"sm",color:P.r.colors.gray400},i("booking.searchBar.noResults")),l&&Array(6).fill(void 0).map((e,t)=>r.createElement(es,{key:"loading"+t},r.createElement("div",{className:"image-item"},r.createElement(c.O,{height:40,animate:!0})),r.createElement("div",{className:"infor"},r.createElement("div",{className:"title"},r.createElement(c.O,{height:20,radius:"sm",animate:!0})))))),p&&r.createElement(ed,null,r.createElement("div",{className:"show-more",onClick:()=>{let e=`/${u.SPECIALTIES}`;n({type:o.NavigateTo,payload:e})}},i("home.seeAll"))))},eu=I.Z.div` display: flex; gap: 5px; margin-top: 16px; flex-wrap: wrap; `,ep=I.Z.div` color: ${P.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 12px; background: ${P.r.colors.white}; border-radius: 32px; cursor: pointer; border: 1px solid ${P.r.colors.white}; margin-bottom: 5px; border-color: ${P.r.colors.neutral100}; background: #f7f9fc; &.view-all { border-radius: 32px; border-color: ${P.r.colors.blue50}; background: ${P.r.colors.blue50}; color: ${P.r.colors.blue600}; &:hover { border-color: ${P.r.colors.blue50}; background: ${P.r.colors.blue50}; color: ${P.r.colors.blue600}; } } &:hover { border-color: ${P.r.colors.neutral100}; background: #f7f9fc; } `,em=I.Z.div` color: ${P.r.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 0; background: ${P.r.colors.white}; border-radius: 32px; border: 1px solid ${P.r.colors.white}; margin-bottom: 5px; margin-right: 7px; `,SearchTag=({state:e,type:t,typeInformation:a,dispatch:l})=>{let{t:n}=(0,w.u)(),{selectedLocation:i}=e,s=(0,r.useMemo)(()=>a[t].slug,[a,t]),handleClickKeyword=e=>{e.url&&(window.location.href=e.url)};return r.createElement(eu,null,r.createElement(em,null,n("booking.searchBar.popularKey")),e.popularKeys.map(e=>r.createElement(ep,{key:e.id,onClick:()=>handleClickKeyword(e)},e.keyword)),r.createElement(ep,{className:"view-all",onClick:()=>{let e=`/${i.slug}/${s}`;e&&l({type:o.NavigateTo,payload:e})}},n("booking.searchBar.viewAll")))},eh=I.Z.div` background: rgba(255, 255, 255, 0.64); backdrop-filter: blur(12px); border-bottom: 1px solid ${P.r.colors.neutral100}; `,eg=(0,I.Z)(j.C)` padding: 0 16px; `,TabSearch=({currentTab:e,hideTabBookingSearch:t=[],hideSpecialtyTab:a,isMobile:l,setCurrentTab:n})=>{let{t:o}=(0,w.u)(),i=(0,r.useMemo)(()=>({root:{overflowY:l?"hidden":"initial",overflowX:l?"auto":"initial"},tabsList:{background:"rgba(255, 255, 255, 0)",borderBottom:"none",flexWrap:"nowrap",".mantine-Tabs-tab":{"&:last-child":{"&:after":{display:"none"}}}},tab:{padding:l?"12px 16px 12px 16px":"15px 40px 15px 40px",borderTop:"2px solid transparent",borderBottom:"none",margin:0,borderRadius:0,position:"relative",width:"auto",'&[data-active="true"]':{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:after":{display:"none"},"&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:hover":{borderColor:"#2d87f3",backgroundColor:"#ffffff","&:before":{content:'""',width:"100%",height:"1px",position:"absolute",backgroundColor:"#ffffff",bottom:"-1px"}},"&:after":{content:'""',width:"1px",height:"24px",backgroundColor:"#E4E8EC",position:"absolute",right:"-1px"}},tabLabel:{color:"#595959",fontSize:l?"14px":"16px",fontWeight:600,lineHeight:l?"22px":"24px"}}),[l]),s=(0,r.useMemo)(()=>[{value:"hospital",label:o("booking.searchPopup.hospitals")},{value:"doctor",label:o("booking.searchPopup.doctors")},{value:"service",label:o("booking.searchPopup.services")},...a?[]:[{value:"specialty",label:o("booking.searchPopup.specialties")}]],[a]),c=(0,r.useMemo)(()=>s.filter(e=>!t.includes(e.value))||[],[t,s]);return r.createElement(eh,{className:"booking-search-tab"},r.createElement(eg,null,r.createElement(E.m,{value:e,onTabChange:e=>{n(e)},styles:i},r.createElement(E.m.List,null,c.map(e=>r.createElement(E.m.Tab,{value:e.value,key:e.value},e.label))))))};(n=i||(i={})).doctor="doctor",n.service="hospital_service",n.hospital="hospital_branch";let ignoreCacarSpecialty=e=>e.filter(e=>"string"==typeof e?"cacar-api"!==e:(null==e?void 0:e.id)!==232),BookingSearchBarV3=({isMobile:e,careApiDomain:t,geoLocationPermission:a,geoLocationCoordinates:l,initialSelectedCity:n,initialSearchValue:c="",initTypeSearch:d="hospital",initSpecialty:p,careFrontDomain:m="/care",isDebug:h=!1,gaTrackingSearchBar:g,gaTrackingLocationSearch:v,autoCompleteDisabled:y=!1,inputSearchPlaceholder:f="",hideTabBookingSearch:x=[],hideSpecialtySelection:E=!1,hideSpecialtyTab:O=!1,hidePopularSearchKeys:I=!1,clientSlug:P="",triggerSearchWhenChangeFilter:N,routerPush:j,onGeoLocationPermissionChange:$,onChangeLocation:R})=>{var A;let{locale:M,t:_}=(0,w.u)(),U=(0,r.useRef)(null),V=(0,r.useRef)(null),Q=(0,r.useRef)(null),H=(0,r.useRef)(null),[W,Y]=(0,r.useState)(d),{geoLocationPermission:J,geoLocationCoordinates:X}=(0,S.u)(),[ee,et]=(0,r.useReducer)(reducer,G,t=>Object.assign(Object.assign({},t),{isDebug:h,isMobile:e,geoLocationPermission:a||J||"unset",geoLocationCoordinates:l||X||null,searchKeywords:c,initialSelectedCity:n||null,selectedLocation:n||t.selectedLocation||null,searchLocationKeywords:(null==n?void 0:n.name)||t.searchLocationKeywords,autoCompleteDisabled:y,inputSearchPlaceholder:f,locale:M})),{navigateTo:el,focusedSpecialty:en,searchKeywords:eo,geoLocationPermission:ei,selectedLocation:er,initialSelectedCity:es,searchResults:ec,isLoadingSearchResults:ed}=ee,{fetchCitiesByLocation:eu,fetchCitiesByKeyword:ep,fetchSearchResults:em,fetchAllSpecialties:eh,fetchPopularKeys:eg}=function({dispatch:e,careApiDomain:t,locale:a="vi-VN",client:l=""}){let n=(0,r.useCallback)(function(l,n={}){let i=`${t}${l}`;return e({type:o.FetchCitiesStart}),fetch((0,S.h)(i,n,a),{method:"GET"}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e))).finally(()=>e({type:o.FetchCitiesFinish}))},[a]),s=(0,r.useCallback)(function({coordinates:t}){let i={},r={};t&&(i={lat:t.lat,lng:t.lng}),"ms-MY"===a&&(r.noPaging=1);let s=[n(D.P.GET_CITY_BY_IP,Object.assign(Object.assign(Object.assign({},i),r),{hospitalActive:1,client:L.C.MSD===l?"":l}))];return"zh-TW"===a?s.push(n(D.P.GET_CITIES_LIST,{noPaging:1,hospitalActive:1,client:L.C.MSD===l?"":l})):s.push(n(D.P.GET_CITIES_LIST,{noPaging:1,hospitalActive:1})),Promise.all(s).then(([t,a])=>{let l=Object.assign({},t);if(a){let e=l.cities.map(e=>e.id);l.cities=l.cities.concat(a.cities.filter(t=>!e.includes(t.id)))}e({type:o.FetchCitiesByGeoIpComplete,payload:l})}).catch(e=>console.error("error loading cities by location",e))},[a,t,e]),c=(0,r.useCallback)(function(t){return n(D.P.GET_CITIES_LIST,{keyword:t,client:l}).then(t=>{e({type:o.FetchCitiesByKeywordComplete,payload:t.cities})}).catch(e=>console.error("error loading cities by keyword",e))},[a,t,e]),d=(0,r.useCallback)(function(n,i,r,s,c){let d="specialty"===r?`${t}${D.P.GET_SEARCH_SPECIALTY}`:`${t}${D.P.GET_SEARCH_V2}`;e({type:o.FetchSearchResultsStart});let{selectedLocation:u,geoLocationCoordinates:p,selectedSpecialty:m}=i,h="";if(!u){e({type:o.FetchSearchResultsFinish});return}h=u.id===L.I?"":u.id;let g=(null==p?void 0:p.lat)||"",v=(null==p?void 0:p.lng)||"",b=(null==m?void 0:m.id)>0?null==m?void 0:m.id:"",y=n.trim().length>K[a]?n.trim():"";return fetch((0,S.h)(d,Object.assign({domain:t,searchType:r||"global",keyword:y,city:h===L.a?"":h,lat:g,lng:v,specialty_id:b,client_slug:L.C.MSD===s?"":s,msd:L.C.MSD===l?1:""},"doctor"===r&&{skipBooking:1}),a),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e)).then(t=>{let a=[];"specialty"!==r&&(a="doctor"===r?t.searches.map(e=>Object.assign(Object.assign({},e),{specialties:ignoreCacarSpecialty((null==e?void 0:e.specialties)||[])})):t.searches),"specialty"===r&&(a=y?ignoreCacarSpecialty((null==t?void 0:t.specialties)||[]):ignoreCacarSpecialty((null==t?void 0:t.default)||[])),e({type:o.FetchSearchResultsComplete,payload:{key:r,searches:a||[]}}),c&&e({type:o.UpdateInitialSearchResults,payload:{key:r,searches:a||[]}})}).catch(e=>{console.log("error loading search results",{url:d,error:e})}).finally(()=>e({type:o.FetchSearchResultsFinish}))},[a,t,e]),u=(0,r.useCallback)(function(){let n=`${t}${D.P.GET_SEARCH_SPECIALTY}`;return fetch((0,S.h)(n,{domain:t,searchType:"",msd:L.C.MSD===l?1:""},a),{method:"GET",headers:{accept:"version=2.0.0.0"}}).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e)).then(t=>{e({type:o.FetchAllSpecialties,payload:ignoreCacarSpecialty(t.specialties||[])})}).catch(e=>{console.log("error loading search results",{url:n,error:e})})},[a,t,e]),p=(0,r.useCallback)(function(l){let n=`${t}${D.P.GET_SEARCH_POPULAR_KEY}`;return fetch((0,S.h)(n,{domain:t,searchType:i[l],sort_by:"display_order",sort_order:"asc"},a)).then(e=>e.json()).then(e=>1===e._status&&e._data?null==e?void 0:e._data:Promise.reject(e)).then(t=>{e({type:o.FetchPopularKeys,payload:t.popular_searches||[]})}).catch(e=>{console.log("error loading search results",{url:n,error:e})})},[a,t,e]);return{fetchCitiesByLocation:s,fetchCitiesByKeyword:c,fetchSearchResults:d,fetchAllSpecialties:u,fetchPopularKeys:p}}({dispatch:et,locale:M,careApiDomain:t,client:P}),ev=(0,r.useMemo)(()=>L.L[M],[M]),[eb,{close:ey,open:ef}]=(0,C.q)(!1),ex=(0,r.useMemo)(()=>Object.assign({doctor:{name:_("booking.searchPopup.doctors"),icon:r.createElement(DoctorIcon,null),slug:ev.DOCTOR},service:{name:_("booking.searchPopup.services"),icon:r.createElement(ServiceIcon,null),slug:ev.SERVICE},hospital:{name:_("booking.searchPopup.hospitals"),icon:r.createElement(HospitalIcon,null),slug:ev.HOSPITAL}},!O&&{specialty:{name:_("booking.searchPopup.specialties"),icon:r.createElement(SpecialtyIcon,null),slug:ev.SPECIALTIES}}),[W]),eE=(0,r.useMemo)(()=>T()(ep,400),[ep]),eC=(0,r.useMemo)(()=>T()(em,400),[em]),eS=(0,r.useCallback)(function({locationSlug:e,specialtyId:t}={}){var a;ey();let l="",{slug:n}=ex[W],i="",r=L.M[M][P],s=t||(null===(a=ee.selectedSpecialty)||void 0===a?void 0:a.id)||-1,c=e||(null==er?void 0:er.slug)||"";("doctor"===W||"hospital"===W)&&s>0&&(i=`&specialtyId=${s}`),l="specialty"===W?`/${n}`:`/${c}/${n}`,r&&(l+=`/${r}`),(l+=`?q=${eo}${i}`)&&et({type:o.NavigateTo,payload:l})},[P,ey,W,et,M,eo,null==er?void 0:er.slug,null===(A=ee.selectedSpecialty)||void 0===A?void 0:A.id,ex]),ek=(0,r.useCallback)(function(e){N&&eS({locationSlug:e.slug}),et({type:o.SelectLocation,payload:e}),R&&R(e)},[et,e,R,eS,N]);(0,k.a)(H,()=>{e||et({type:o.ClickOutsideInputSearchSpecialty})}),(0,r.useEffect)(()=>{var t;"denied"===ei||es||et({type:o.SelectLocation,payload:{name:_("booking.searchBar.allLocations"),id:L.I,slug:null===(t=L.L[M])||void 0===t?void 0:t.ALL}}),$&&$(ei,ee.geoLocationCoordinates),e&&"granted"===ei&&er&&et({type:o.FocusInputSearch}),eu({coordinates:ee.geoLocationCoordinates})},[ei]),(0,r.useEffect)(()=>{var e;let t=p||{name:_("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:ev.SPECIALTIES};if(p){(null===(e=ee.selectedSpecialty)||void 0===e?void 0:e.id)!==p.id&&et({type:o.SelectSpecialty,payload:p});return}ee.selectedSpecialty&&ee.selectedSpecialty.id===t.id||et({type:o.SelectSpecialty,payload:t})},[p,ev.SPECIALTIES,_]),(0,r.useEffect)(()=>{eh()},[]),(0,r.useEffect)(()=>{eg(W)},[W]),(0,r.useEffect)(()=>{el&&(j?j(el):window.location.href=`${m}${el}`)},[el]),(0,r.useEffect)(()=>{em(ee.searchKeywords,ee,W,P,!0)},[W]),(0,r.useEffect)(()=>{if(eb&&e){let e=setTimeout(()=>{var e;null===(e=Q.current)||void 0===e||e.focus()},150);return()=>clearTimeout(e)}},[eb,e]);let ew={type:W,isMobile:e,state:ee,dispatch:et,debouncedFetchSearchResults:eC,initalSearchValue:c,onEnterSearch:eS,typeInformation:ex,trackingAttributes:g,isLoading:ed,hideSpecialtySelection:E||O,clientSlug:P,triggerSearchWhenChangeFilter:N,onChangeSpecialty:e=>N&&eS({specialtyId:e.id})};return r.createElement(r.Fragment,null,r.createElement(F,{ref:U},r.createElement(TabSearch,{currentTab:W,setCurrentTab:Y,isMobile:e,hideTabBookingSearch:x,hideSpecialtyTab:O}),r.createElement(z,{className:"booking-search-container"},r.createElement(q,null,r.createElement(Z,{className:"booking-search-content"},r.createElement("div",{ref:H},r.createElement(b.k,{gap:"12px",align:"center",className:"flex-search-input"},r.createElement(ea,Object.assign({},ew,{ref:V,onFocusInput:()=>e&&ef()})),"specialty"!==W&&r.createElement(SearchLocation,{state:ee,isMobile:e,dispatch:et,debouncedFetchCitiesByKeyword:eE,selectedLocation:er,onLocationClick:ek,trackingAttributes:v}),!e&&r.createElement(B.B,{size:"lg",variant:"primary",onClick:()=>eS(),styles:{root:{height:"48px",minWidth:"120px",borderRadius:"12px"}}},_("booking.searchBar.searchButton"))),!I&&"specialty"!==W&&ee.popularKeys.length>0&&r.createElement(SearchTag,{type:W,state:ee,typeInformation:ex,dispatch:et}),"specialty"===W&&"search"===en&&r.createElement(SearchResultSpecialties,{state:ee,isMobile:e,dispatch:et,specialties:(null==ec?void 0:ec.specialty)||[],isLoading:ed})))))),e&&r.createElement(ModalSearchResult,{keepMounted:!0,opened:eb,onClose:ey,closeModal:ey,searchInputEle:r.createElement(b.k,{align:"center",gap:8},r.createElement(ea,Object.assign({},ew,{onlyShowSearchBox:!0,ref:Q})),r.createElement(B.B,{variant:"primary",leftIcon:r.createElement(s.Z,{size:20,color:"#fff"}),onClick:()=>eS(),styles:{root:{borderRadius:"12px"}}}))},r.createElement(u.x,{sx:{marginLeft:-16,marginRight:-16}},r.createElement(SearchResultContent,{type:W,state:ee,dispatch:et,isLoading:ed,typeInformation:ex,clientSlug:P}))))},ev=I.Z.div` background-color: var(--neutral50); padding: 12px 0; box-shadow: inset 0px 1px 0px #e4e8ec; > * { display: grid; grid-template-columns: 32px 1fr; align-content: center; p { font-weight: 600; } } .icon-wrapper { display: flex; align-items: center; } `,TextDivider=({children:e,icon:t,className:a,style:l})=>r.createElement(ev,{style:l,className:a},r.createElement(j.C,null,r.createElement("div",{className:"icon-wrapper"},t),r.createElement($.T,{size:"c1",color:"var(--neutral800)"},e)))}}]);