"use strict";(self.webpackChunkhhgHealthCareV1=self.webpackChunkhhgHealthCareV1||[]).push([[1768],{21768:function(e,t,a){a.d(t,{n:function(){return je}});var i=a(73884),o=a.n(i),l=a(51387),n=a(6596),s=a(73827),c=a(42060),r=a(14677),d=a(99312),p=a(68383),u=a(6806),h=a(11851),g=a(35291),m=a(4766),b=a(91266),y=a(35616),f=a.n(y),x=a(27516);const v=({className:e,color:t})=>o().createElement("svg",{width:"14",height:"20",viewBox:"0 0 14 20",className:e},o().createElement("path",{d:"M7 0C3.134 0 0 3.134 0 7C0 10.966 4.404 16.82 6.226 19.071C6.626 19.565 7.374 19.565 7.774 19.071C9.596 16.82 14 10.966 14 7C14 3.134 10.866 0 7 0ZM7 9.5C5.619 9.5 4.5 8.381 4.5 7C4.5 5.619 5.619 4.5 7 4.5C8.381 4.5 9.5 5.619 9.5 7C9.5 8.381 8.381 9.5 7 9.5Z",fill:t||"currentColor"})),w=h.A.li` display: flex; align-items: center; gap: 12px; padding: 8px 16px; > :first-child { flex: 1; } > :nth-child(2) { flex: 6; } & + li::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background-color: ${g.w.colors.neutral100}; } `,S="url(\"data:image/svg+xml,%3Csvg width='19' height='14' viewBox='0 0 19 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M16.9803 0.990669C16.7205 0.99841 16.4739 1.10699 16.2928 1.2934L5.99984 11.5864L2.70687 8.2934C2.61473 8.19743 2.50436 8.12081 2.38223 8.06802C2.2601 8.01524 2.12867 7.98735 1.99563 7.986C1.86259 7.98464 1.73061 8.00985 1.60743 8.06014C1.48426 8.11043 1.37235 8.18479 1.27827 8.27887C1.1842 8.37295 1.10983 8.48485 1.05954 8.60803C1.00926 8.73121 0.98405 8.86318 0.985403 8.99622C0.986757 9.12926 1.01464 9.26069 1.06743 9.38282C1.12021 9.50495 1.19684 9.61532 1.29281 9.70747L5.29281 13.7075C5.48035 13.8949 5.73467 14.0002 5.99984 14.0002C6.26501 14.0002 6.51933 13.8949 6.70687 13.7075L17.7069 2.70747C17.8514 2.567 17.9501 2.38616 17.99 2.18864C18.03 1.99112 18.0093 1.78614 17.9308 1.60055C17.8523 1.41497 17.7195 1.25744 17.5499 1.14861C17.3803 1.03978 17.1817 0.984729 16.9803 0.990669Z' fill='%232685F1'/%3E%3C/svg%3E%0A\")",C=(h.A.div` display: flex; position: absolute; top: 48px; min-width: 100%; box-shadow: 0px 24px 32px rgba(0, 0, 0, 0.04), 0px 16px 24px rgba(0, 0, 0, 0.04), 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 1px rgba(0, 0, 0, 0.04); border-radius: ${g.w.borderRadius}; background-color: white; z-index: 30; ${m.M.tdDown} { position: relative; top: 0; box-shadow: initial; } `,h.A.ul` width: 100%; max-height: 600px; overflow-y: auto; `,(0,h.A)(v)` width: 12px; height: 18px; `,h.A.li` position: relative; cursor: pointer; padding: 12px 18px; display: flex; align-items: center; gap: 14px; overflow: hidden; ${({isSelected:e})=>e&&`\n &::after {\n content: ${S};\n top: 50%;\n right: 18px;\n position: absolute;\n transform: translateY(-50%);\n }\n `} & + li::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background-color: ${g.w.colors.neutral100}; } &:not([data-is-denied='true']):hover { background-color: ${g.w.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; } `,(0,h.A)((({count:e,className:t})=>o().createElement(o().Fragment,null,[...Array(e)].map(((e,a)=>o().createElement(w,{className:t,key:a},o().createElement(b.A,{count:1,height:32}),o().createElement(b.A,{count:1,height:24})))))))` &:first-child { padding-top: 18px; } `,(e,t,a)=>f()(e,Object.assign(Object.assign({},t),{domain:x.y[a||"en-PH"]})));var E=a(48368),k=a(79740),O=a(38221),L=a.n(O),j=a(20404),$=a(87835),I=a(26662),M=a(74121),F=a(20697);const A="api/lists/cities?keyword={keyword}&country_id={countryId}&site={domain}&_nopaging={noPaging}&client={client}",P="api/v2/search/?site={domain}&type={searchType}&keyword={keyword}&city_id={city}&latitude={lat}&longitude={lng}&specialty_id={specialty_id}&client_slug={client_slug}&msd={msd}",T="api/geobyip?site={domain}&latitude={lat}&longitude={lng}&_nopaging={noPaging}&client={client}",R="api/v2/specialties/?site={domain}&type={searchType}&keyword={keyword}&city_id={city}&latitude={lat}&longitude={lng}&msd={msd}",K="api/search/keywords?site={domain}&sort_by={sort_by}&sort_order={sort_order}&type={searchType}",D=h.A.div``,N=h.A.div` background-color: ${g.w.colors.neutral50}; padding-bottom: 1px; ${m.M.mbDown} { padding: 0 16px 10px; } `,B=(0,h.A)($.C)` padding: 0 16px; ${m.M.mbDown} { padding: 0; } `,_=h.A.div` padding: 24px 56px; border-radius: 16px; background-color: ${g.w.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); ${m.M.mbDown} { padding: 16px 16px; border-radius: 0px 0px 12px 12px; } .flex-search-input { flex-direction: row; ${m.M.mbDown} { flex-direction: column; } } `,q={"en-PH":3,"tl-PH":2,"id-ID":3,"vi-VN":2,"zh-TW":0,"ms-MY":2,"th-TH":2},z={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:[]};var V;function G(e){const{selectedLocation:t,searchLocationKeywords:a}=e;return t&&a!==t.name?Object.assign(Object.assign({},e),{searchLocationKeywords:t.name}):e}function W(e,t){var a,i;switch(e.isDebug&&console.log("bookingSearchBar",{action:t,state:e}),t.type){case V.NavigateTo:return Object.assign(Object.assign({},e),{navigateTo:t.payload,focused:"none",isMobileModalOpened:!1});case V.ClickOutsideInputLocation:return"location"!==e.focused?e:G(Object.assign(Object.assign({},e),{focused:"none"}));case V.ClickOutsideInputSpecialty:return"specialty"!==e.focused?e:G(Object.assign(Object.assign({},e),{focused:"none"}));case V.ClickOutsideInputSearch:return"search"!==e.focused?e:Object.assign(Object.assign({},e),{focused:"none"});case V.ClickOutsideInputSearchSpecialty:return"search"!==e.focusedSpecialty?e:Object.assign(Object.assign({},e),{focusedSpecialty:"none"});case V.FocusInputLocation:{const t=Object.assign(Object.assign({},e),{focused:"location"});return(null===(a=e.selectedLocation)||void 0===a?void 0:a.id)===j.a&&(t.searchLocationKeywords=""),t}case V.FocusInputSpecialty:{const t=Object.assign(Object.assign({},e),{focused:"specialty"});return(null===(i=e.selectedLocation)||void 0===i?void 0:i.id)===j.a&&(t.searchLocationKeywords=""),t}case V.FocusInputSearch:const o=Object.assign(Object.assign({},e),{focused:"search"});return e.isMobile?G(o):o;case V.FocusInputSearchSpecialty:return Object.assign(Object.assign({},e),{focusedSpecialty:"search"});case V.ChangeInputLocation:return Object.assign(Object.assign({},e),{searchLocationKeywords:t.payload});case V.ChangeInputSearch:{const a=t.payload;return Object.assign(Object.assign({},e),{searchKeywords:a,isLoadingSearchResults:a.trim().length>q[e.locale]})}case V.SelectCurrentLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case V.ClearInputLocation:return Object.assign(Object.assign({},e),{focused:"location",cities:e.initialCities,searchLocationKeywords:""});case V.ClearInputSearch:return Object.assign(Object.assign({},e),{focused:"search",searchKeywords:""});case V.SelectLocation:return Object.assign(Object.assign({},e),{focused:"none",selectedLocation:t.payload,searchLocationKeywords:t.payload.name});case V.SelectSpecialty:return Object.assign(Object.assign({},e),{focused:"none",selectedSpecialty:t.payload});case V.SelectSearchResult:return Object.assign(Object.assign({},e),{searchKeywords:t.payload.name,isMobileModalOpened:!1,focused:"none",navigateTo:t.payload.url});case V.FetchCitiesStart:return Object.assign(Object.assign({},e),{isLoadingCities:!0});case V.FetchCitiesFinish:return Object.assign(Object.assign({},e),{isLoadingCities:!1});case V.FetchSearchResultsStart:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!0});case V.FetchSearchResultsFinish:return Object.assign(Object.assign({},e),{isLoadingSearchResults:!1});case V.FetchSearchResultsComplete:return Object.assign(Object.assign({},e),{searchResults:Object.assign(Object.assign({},e.searchResults),{[t.payload.key]:t.payload.searches})});case V.FetchCitiesByGeoIpComplete:{let{cities:a}=t.payload;const{default:i}=t.payload;a=a.filter((e=>e.id!==i.id)),i&&a.unshift(i),e.initialSelectedCity&&!a.find((t=>t.id===e.initialSelectedCity.id))&&a.unshift(e.initialSelectedCity);const o=Object.assign(Object.assign({},e),{defaultCity:i,initialCities:a,cities:a});return"denied"!==e.geoLocationPermission||e.initialSelectedCity||(o.selectedLocation=i,o.searchLocationKeywords=i.name),o}case V.FetchCitiesByKeywordComplete:return Object.assign(Object.assign({},e),{cities:t.payload});case V.DisplayInitialCities:return Object.assign(Object.assign({},e),{cities:e.initialCities});case V.DisplayInitialSearchResults:return Object.assign(Object.assign({},e),{searchResults:e.initialSearchResults,isLoadingSearchResults:!1});case V.UpdateInitialSearchResults:return Object.assign(Object.assign({},e),{initialSearchResults:Object.assign(Object.assign({},e.initialSearchResults),{[t.payload.key]:t.payload.searches})});case V.GrantGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"granted",geoLocationCoordinates:t.payload});case V.DenyGeoLocationPermission:return Object.assign(Object.assign({},e),{geoLocationPermission:"denied",geoLocationCoordinates:null});case V.OpenMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!0});case V.CloseMobileModal:return Object.assign(Object.assign({},e),{isMobileModalOpened:!1});case V.UpdateInitialSearchValue:return Object.assign(Object.assign({},e),{searchKeywords:t.payload});case V.SetInputSearchPlaceholder:return Object.assign(Object.assign({},e),{inputSearchPlaceholder:t.payload});case V.FetchAllSpecialties:return Object.assign(Object.assign({},e),{allSpecialties:t.payload});case V.FetchPopularKeys:return Object.assign(Object.assign({},e),{popularKeys:t.payload});default:return e}}!function(e){e.NavigateTo="navigate to url",e.ClickOutsideInputLocation="click outside input location",e.ClickOutsideInputSearch="click outside input search",e.ClickOutsideInputSearchSpecialty="click outside input search specialty",e.ClickOutsideInputSpecialty="click outside input specialty",e.SelectCurrentLocation="select current location",e.FocusInputLocation="focus input location",e.FocusInputSearch="focus input search",e.FocusInputSearchSpecialty="focus input search specialty",e.ChangeInputLocation="change input location",e.ChangeInputSearch="change input search",e.ClearInputLocation="clear input location",e.ClearInputSearch="clear input search",e.SelectLocation="select location",e.SelectSpecialty="select specialty",e.FetchCitiesStart="fetch cities start",e.FetchCitiesFinish="fetch cities finish",e.FetchSearchResultsStart="fetch search results start",e.FetchSearchResultsComplete="fetch search results complete",e.FetchSearchResultsFinish="fetch search results finish",e.FetchCitiesByGeoIpComplete="fetch cities by geo IP finish",e.FetchCitiesByKeywordComplete="fetch cities by keyword finish",e.DisplayInitialCities="display initial cities",e.DisplayInitialSearchResults="display initial search results",e.UpdateInitialSearchResults="update initial search results",e.GrantGeoLocationPermission="grant geolocation permission",e.DenyGeoLocationPermission="deny geolocation permission",e.OpenMobileModal="open mobile modal",e.CloseMobileModal="close mobile modal",e.UpdateInitialSearchValue="update initial search value",e.SelectSearchResult="select search result",e.SetInputSearchPlaceholder="set input search placeholder",e.FocusInputSpecialty="focus input specialty",e.FetchAllSpecialties="fetch all specialty",e.FetchPopularKeys="fetch popular key by type"}(V||(V={}));const H=h.A.div` flex: 1; position: relative; ${m.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } `,U=h.A.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${g.w.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${m.M.mbDown} { width: calc(100% + 64px); left: -32px; } `,Q=h.A.div``,Y=h.A.div` display: flex; justify-content: space-between; align-item: center; padding: 9px 14px 9px 22px; background: #f7f9fc; .title { color: ${g.w.colors.gray800}; font-size: 14px; font-weight: 600; line-height: 22px; } .btn-see-all { color: ${g.w.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `,Z=h.A.div` padding: 10px 16px; max-height: 400px; overflow: auto; `,J=h.A.div` display: flex; gap: 12px; align-items: center; cursor: pointer; &:hover { background-color: ${g.w.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 ${g.w.colors.neutral100}; .title { color: ${g.w.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; } .description { overflow: hidden; color: ${g.w.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; } } `;h.A.div` padding: 0 16px 16px; .search-detail-btn { color: ${g.w.colors.blue600}; font-size: 14px; line-height: 22px; cursor: pointer; } `;const X=({state:e,type:t,results:a,location:n,isLoading:s,typeInformation:c,clientSlug:r="",dispatch:d})=>{const{locale:p,t:u}=(0,k.u)(),{selectedLocation:h}=e,m=(0,i.useMemo)((()=>c[t].slug),[c,t]);return o().createElement(Q,null,o().createElement(Y,null,o().createElement("div",{className:"title"},u("booking.searchResult.description",{search_type:c[t].name,search_location:n})),a.length>0&&o().createElement("div",{className:"btn-see-all",onClick:()=>{let a=`/${h.slug}/${m}`;const i=j.M[p][r];i&&(a+=`/${i}`),("doctor"===t||"hospital"===t)&&e.selectedSpecialty.id>0&&(a+=`?specialtyId=${e.selectedSpecialty.id}`),a&&d({type:V.NavigateTo,payload:a})}},u("home.seeAll"))),o().createElement(Z,null,s&&Array(3).fill(void 0).map(((e,a)=>o().createElement(J,{key:t+"loading"+a,className:2===a?"last-item":""},o().createElement("div",{className:"image-item"},o().createElement(l.E,{height:48,circle:!0,mb:"xl",animate:!0})),o().createElement("div",{className:"infor"},o().createElement("div",{className:"title"},o().createElement(l.E,{height:8,mt:10,radius:"xl",animate:!0})),o().createElement("div",{className:"description"},o().createElement("div",{className:"sub-description"},o().createElement(l.E,{height:8,mt:10,radius:"xl",width:"80%",animate:!0}))))))),!s&&a&&a.length>0&&o().createElement(o().Fragment,null,a.map(((e,i)=>{var l,n;const s=a.length>4&&3===i||a.length<=4&&i===a.length-1;let r="";return"hospital"===t&&(r=(null===e||void 0===e?void 0:e.address)||""),"doctor"===t&&(r=(null===(l=null===e||void 0===e?void 0:e.specialties)||void 0===l?void 0:l.join(", "))||""),"service"===t&&(r=(null===(n=null===e||void 0===e?void 0:e.hospital_branch)||void 0===n?void 0:n.name)||""),i>=4?o().createElement(o().Fragment,null):o().createElement(J,{key:e.id,className:s?"last-item":"",onClick:()=>(e=>{let a="";switch(t){case"service":a=`/${h.slug}/${m}/${e.slug}`;break;case"doctor":case"hospital":a=`/${m}/${e.slug}-${e.id}`}a&&d({type:V.NavigateTo,payload:a})})(e)},o().createElement("div",{className:"image-item"},o().createElement("img",{src:e.logo||e.avatar,alt:e.name})),o().createElement("div",{className:"infor"},o().createElement("div",{className:"title"},e.name),o().createElement("div",{className:"description"},c[t].icon,o().createElement("div",{className:"sub-description"},r))))}))),!s&&0===(null===a||void 0===a?void 0:a.length)&&o().createElement(M.T,{size:"sm",color:g.w.colors.gray400},u("booking.searchBar.noResults"))))},ee=h.A.div` position: relative; ${m.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } `,te=h.A.div` position: absolute; top: calc(100% + 2px); width: calc(100% + 100px); border-radius: 4px; background: ${g.w.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; max-height: 300px; overflow: auto; ${m.M.mbDown} { width: calc(100% + 64px); left: -32px; } `,ae=h.A.li` position: relative; cursor: pointer; padding: 12px 18px; display: flex; align-items: center; gap: 14px; overflow: hidden; .image-item { display: flex; align-items: center; width: 40px; height: 40px; img { width: 100%; object-fit: cover; } svg { width: 40px; } } ${({isSelected:e})=>e&&`\n &::after {\n content: ${S};\n top: 50%;\n right: 18px;\n position: absolute;\n transform: translateY(-50%);\n }\n `} & + li::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background-color: ${g.w.colors.neutral100}; } &:not([data-is-denied='true']):hover { background-color: ${g.w.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; } `,ie=()=>o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o().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"})),oe=()=>o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o().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"})),le=()=>o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},o().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"})),ne=()=>o().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16"},o().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"})),se=({state:e,isMobile:t,debouncedFetchSearchResults:a,selectedLocation:l,onSpecialtyClick:s,dispatch:c})=>{var r;const{t:d,locale:p}=(0,k.u)(),u=(0,i.useRef)(null),h=(0,i.useMemo)((()=>j.L[p]),[p]),g=(0,i.useMemo)((()=>({wrapper:{"&:after":{content:'""',width:"1px",height:"20px",backgroundColor:"#E4E8EC",position:"absolute",right:0,top:"13px"}},input:{border:t?"border: 1px solid #d9d9d9":"none",height:t?"40px":"46px !important",paddingRight:"30px","&:focus":{boxShadow:t?"box-shadow: 0px 0px 0px 2px #91caff":"none"}},rightSection:{width:"30px",svg:{fontSize:"20px"}}})),[t]),m=(0,i.useCallback)((function(e){console.log(e)}),[a,c]);return(0,E.a)(u,(()=>{c({type:V.ClickOutsideInputSpecialty})})),o().createElement(ee,{ref:u},o().createElement(n.p.Wrapper,null,o().createElement(n.p,{size:t?"md":"lg",placeholder:d("booking.searchPopup.specialties"),value:(null===(r=null===e||void 0===e?void 0:e.selectedSpecialty)||void 0===r?void 0:r.name)||"",rightSection:o().createElement(F.C,null),styles:g,onFocus:()=>c({type:V.FocusInputSpecialty}),onChange:e=>{m(e.target.value)}})),"specialty"===e.focused&&o().createElement(te,null,o().createElement(ae,{key:"all-location",role:"button",tabIndex:0,onClick:()=>{s&&s({name:d("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:h.SPECIALTIES})}},o().createElement("div",{className:"image-item"},o().createElement(ne,null)),o().createElement(M.T,{size:"md"},d("booking.searchBar.allSpecialties"))),e.allSpecialties.map((e=>o().createElement(ae,{key:e.id,onClick:t=>{t.nativeEvent.stopImmediatePropagation(),s&&s(Object.assign(Object.assign({},e),{total_doctor:0}))},role:"button",tabIndex:0,"aria-label":`Select ${e.name} as location`,isSelected:(null===l||void 0===l?void 0:l.id)===e.id},o().createElement("div",{className:"image-item"},o().createElement("img",{src:e.thumbnail,alt:e.name})),o().createElement(M.T,{size:"md"},e.name))))))},ce=({state:e,type:t,isMobile:a,isLoading:l,initalSearchValue:s,typeInformation:c,debouncedFetchSearchResults:r,trackingAttributes:d,hideSpecialtySelection:p=!1,clientSlug:u="",focusSearchInput:h,onSearch:g,onEnterSearch:m,dispatch:b})=>{var y;const{t:f}=(0,k.u)(),x=(0,i.useRef)(null),v=(0,i.useMemo)((()=>d?{"data-event-category":d.dataEventCategory,"data-event-action":d.dataEventAction,"data-event-label":d.dataEventLabel}:{}),[d]),w=(0,i.useMemo)((()=>"doctor"===t?f("booking.searchBar.placeholder.doctor"):"service"===t?f("booking.searchBar.placeholder.service"):"hospital"===t?f("booking.searchBar.placeholder.hospital"):"specialty"===t?f("booking.searchBar.placeholder.specialty"):""),[t]),S=(0,i.useMemo)((()=>({root:{flex:1,"&.hide-specialty-selection":{".mantine-Input-rightSection":{display:"none"},input:{paddingLeft:"48px"},".mantine-Input-icon":{left:"0"}}}})),[]),C=(0,i.useMemo)((()=>({icon:{left:"165px"},input:{color:"#262626",'&[data-with-icon="true"]':{paddingLeft:"205px",paddingRight:"16px"}},rightSection:{left:0,width:"165px",padding:"1px"}})),[]),O=(0,i.useMemo)((()=>({input:{color:"#262626"}})),[]);(0,E.a)(x,(()=>{b({type:V.ClickOutsideInputSearch})}));const L=(0,i.useCallback)((function(a){b({type:V.ChangeInputSearch,payload:a}),"function"!==typeof g&&(a.trim().length>q[e.locale]||s||0===a.trim().length?r(a.trim(),e,t,u):(r.cancel(),b({type:V.DisplayInitialSearchResults})))}),[b,e,t]),j=(0,i.useCallback)((function(e){b({type:V.SelectSpecialty,payload:e}),h()}),[b]),$=(0,i.useCallback)((e=>{13===e.keyCode&&(e.stopPropagation(),e.preventDefault(),m&&m())}),[m]);return o().createElement(H,{ref:x},"specialty"===t?o().createElement(n.p.Wrapper,{styles:S},o().createElement(n.p,{icon:o().createElement(I.A,null),size:a?"md":"lg",placeholder:w,styles:O,value:e.searchKeywords,onFocus:()=>b({type:V.FocusInputSearchSpecialty}),onChange:e=>{L(e.target.value)},onKeyDown:$})):o().createElement(o().Fragment,null,"service"===t?o().createElement(n.p.Wrapper,{styles:S},o().createElement(n.p,{icon:o().createElement(I.A,null),size:a?"md":"lg",name:"search-results",placeholder:w,onFocus:()=>b({type:V.FocusInputSearch}),value:e.searchKeywords,onChange:e=>{L(e.target.value)},onKeyDown:$})):o().createElement(o().Fragment,null,a&&!p?o().createElement(o().Fragment,null,o().createElement(se,{state:e,isMobile:a,dispatch:b,debouncedFetchSearchResults:r,onSpecialtyClick:j}),o().createElement(n.p.Wrapper,{styles:S},o().createElement(n.p,{icon:o().createElement(I.A,null),size:"md",placeholder:w,value:e.searchKeywords,name:"search-results",onFocus:()=>b({type:V.FocusInputSearch}),onChange:e=>{L(e.target.value)},onKeyDown:$}))):o().createElement(n.p.Wrapper,{styles:S,className:p?"hide-specialty-selection":""},o().createElement(n.p,Object.assign({icon:o().createElement(I.A,null),size:"lg",placeholder:w,styles:C,name:"search-results",autoComplete:"off",value:e.searchKeywords,onChange:e=>{L(e.target.value)},onFocus:()=>b({type:V.FocusInputSearch}),onKeyDown:$},v,{rightSection:p?o().createElement(o().Fragment,null):o().createElement(se,{state:e,isMobile:a,dispatch:b,debouncedFetchSearchResults:r,onSpecialtyClick:j})})))),"search"===e.focused&&o().createElement(U,null,o().createElement(X,{type:t,state:e,results:(null===(y=e.searchResults)||void 0===y?void 0:y[t])||[],location:e.selectedLocation.name,dispatch:b,isLoading:l,typeInformation:c,clientSlug:u}))))},re=h.A.div` position: relative; ${m.M.mbDown} { width: 100%; display: flex; flex-direction: column; gap: 12px; } `,de=h.A.div` position: absolute; top: calc(100% + 2px); width: 100%; border-radius: 4px; background: ${g.w.colors.white}; box-shadow: 0px 8px 40px 0px rgba(0, 0, 0, 0.1); z-index: 10; ${m.M.mbDown} { width: calc(100% + 64px); left: -32px; } `,pe=h.A.li` position: relative; cursor: pointer; padding: 12px 18px; display: flex; align-items: center; gap: 14px; overflow: hidden; ${({isSelected:e})=>e&&`\n &::after {\n content: ${S};\n top: 50%;\n right: 18px;\n position: absolute;\n transform: translateY(-50%);\n }\n `} & + li::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; background-color: ${g.w.colors.neutral100}; } &:not([data-is-denied='true']):hover { background-color: ${g.w.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; } `,ue=(0,h.A)(v)` width: 12px; height: 18px; flex: 0 0 12px; `,he=({state:e,isMobile:t,debouncedFetchCitiesByKeyword:a,selectedLocation:l,trackingAttributes:s,onLocationClick:c,dispatch:r})=>{const{t:d,locale:p}=(0,k.u)(),u=(0,i.useRef)(null),h=(0,i.useMemo)((()=>s?{"data-event-category":s.dataEventCategory,"data-event-action":s.dataEventAction,"data-event-label":s.dataEventLabel}:{}),[s]),m=(0,i.useCallback)((function(t){r({type:V.ChangeInputLocation,payload:t}),t.trim().length>q[e.locale]?a(t.trim()):(a.cancel(),r({type:V.DisplayInitialCities}))}),[a,r]);return(0,E.a)(u,(()=>{r({type:V.ClickOutsideInputLocation})})),o().createElement(re,{ref:u},o().createElement(n.p.Wrapper,null,o().createElement(n.p,Object.assign({size:t?"md":"lg",placeholder:"Search location",value:e.searchLocationKeywords,onFocus:()=>r({type:V.FocusInputLocation}),onChange:e=>{m(e.target.value)}},h))),"location"===e.focused&&o().createElement(de,null,o().createElement(pe,{key:"all-location",role:"button",tabIndex:0,onClick:()=>{var e;c&&c({name:d("booking.searchBar.allLocations"),id:j.I,slug:null===(e=j.L[p])||void 0===e?void 0:e.ALL})}},o().createElement(ue,{color:g.w.colors.neutral400}),o().createElement(M.T,{size:"md"},d("booking.searchBar.allLocations"))),e.cities.map((e=>o().createElement(pe,{key:e.id,onClick:t=>{t.nativeEvent.stopImmediatePropagation(),c&&c(e)},role:"button",tabIndex:0,"aria-label":`Select ${e.name} as location`,isSelected:(null===l||void 0===l?void 0:l.id)===e.id},o().createElement(ue,{color:g.w.colors.neutral400}),o().createElement(M.T,{size:"md"},e.name))))))},ge=h.A.div` display: flex; flex-wrap: wrap; row-gap: 8px; column-gap: 20px; ${m.M.mbDown} { margin-top: 12px; } `,me=h.A.div` display: flex; align-items: center; border-radius: 8px; border: 1px solid ${g.w.colors.neutral100}; background: ${g.w.colors.white}; padding: 8px 12px 8px 8px; flex: 0 0 calc(33.3% - 13px); gap: 12px; cursor: pointer; &:hover { background: ${g.w.colors.blue50}; } ${m.M.tdDown} { flex: 0 0 calc(50% - 10px); } ${m.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: ${g.w.colors.gray800}; font-size: 14px; font-style: normal; font-weight: 400; line-height: 22px; } .description { color: ${g.w.colors.gray600}; font-size: 12px; font-weight: 400; line-height: 18px; } } `,be=(0,h.A)(s.c)` margin: 24px 0 !important; `,ye=h.A.div` display: flex; justify-content: center; margin-top: 24px; .show-more { border-radius: 4px; border: 1px solid ${g.w.colors.neutral200}; padding: 12px 16px; cursor: pointer; display: inline-block; color: ${g.w.colors.gray800}; font-size: 16px; font-weight: 600; line-height: 24px; ${m.M.mbDown} { width: 100%; text-align: center; } } `,fe=({state:e,isMobile:t,specialties:a,isLoading:n,dispatch:s})=>{const{t:c,locale:r}=(0,k.u)(),{selectedLocation:d}=e,p=(0,i.useMemo)((()=>j.L[r]),[r]),u=(0,i.useMemo)((()=>a.length>=9||e.searchKeywords.trim().length<=q[e.locale]),[e.searchKeywords,a]);return o().createElement(o().Fragment,null,!t&&o().createElement(be,{color:"#E4E8EC"}),o().createElement(ge,null,a.length>0&&!n&&o().createElement(o().Fragment,null,a.map(((e,t)=>t>=9?o().createElement(o().Fragment,null):o().createElement(me,{key:e.id,onClick:()=>(e=>{let t="";e===j.S?(t=`/${d.slug}/${p.HOSPITAL}/${j.C.GSK}/`,s({type:V.ClickOutsideInputSearchSpecialty})):t=`/${d.slug}/${p.DOCTOR}/${e}`,s({type:V.NavigateTo,payload:t})})(e.slug)},o().createElement("div",{className:"image-item"},o().createElement("img",{src:e.thumbnail,alt:e.name})),o().createElement("div",{className:"infor"},o().createElement("div",{className:"title"},e.name)))))),0===a.length&&!n&&o().createElement(M.T,{size:"sm",color:g.w.colors.gray400},c("booking.searchBar.noResults")),n&&Array(6).fill(void 0).map(((e,t)=>o().createElement(me,{key:"loading"+t},o().createElement("div",{className:"image-item"},o().createElement(l.E,{height:40,animate:!0})),o().createElement("div",{className:"infor"},o().createElement("div",{className:"title"},o().createElement(l.E,{height:20,radius:"sm",animate:!0}))))))),u&&o().createElement(ye,null,o().createElement("div",{className:"show-more",onClick:()=>{const e=`/${p.SPECIALTIES}`;s({type:V.NavigateTo,payload:e})}},c("home.seeAll"))))},xe=h.A.div` display: flex; gap: 5px; margin-top: 16px; flex-wrap: wrap; `,ve=h.A.div` color: ${g.w.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 12px; background: ${g.w.colors.white}; border-radius: 32px; cursor: pointer; border: 1px solid ${g.w.colors.white}; margin-bottom: 5px; border-color: ${g.w.colors.neutral100}; background: #f7f9fc; &.view-all { border-radius: 32px; border-color: ${g.w.colors.blue50}; background: ${g.w.colors.blue50}; color: ${g.w.colors.blue600}; &:hover { border-color: ${g.w.colors.blue50}; background: ${g.w.colors.blue50}; color: ${g.w.colors.blue600}; } } &:hover { border-color: ${g.w.colors.neutral100}; background: #f7f9fc; } `,we=h.A.div` color: ${g.w.colors.gray600}; font-size: 14px; font-weight: 600; line-height: 22px; padding: 4px 0; background: ${g.w.colors.white}; border-radius: 32px; border: 1px solid ${g.w.colors.white}; margin-bottom: 5px; margin-right: 7px; `,Se=({state:e,type:t,typeInformation:a,dispatch:l})=>{const{t:n}=(0,k.u)(),{selectedLocation:s}=e,c=(0,i.useMemo)((()=>a[t].slug),[a,t]);return o().createElement(xe,null,o().createElement(we,null,n("booking.searchBar.popularKey")),e.popularKeys.map((e=>o().createElement(ve,{key:e.id,onClick:()=>{var t;(t=e).url&&(window.location.href=t.url)}},e.keyword))),o().createElement(ve,{className:"view-all",onClick:()=>{const e=`/${s.slug}/${c}`;e&&l({type:V.NavigateTo,payload:e})}},n("booking.searchBar.viewAll")))},Ce=h.A.div` background: rgba(255, 255, 255, 0.64); backdrop-filter: blur(12px); border-bottom: 1px solid ${g.w.colors.neutral100}; `,Ee=(0,h.A)($.C)` padding: 0 16px; `,ke=({currentTab:e,hideTabBookingSearch:t=[],hideSpecialtyTab:a,isMobile:l,setCurrentTab:n})=>{const{t:s}=(0,k.u)(),r=(0,i.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]),d=(0,i.useMemo)((()=>[{value:"hospital",label:s("booking.searchPopup.hospitals")},{value:"doctor",label:s("booking.searchPopup.doctors")},{value:"service",label:s("booking.searchPopup.services")},...a?[]:[{value:"specialty",label:s("booking.searchPopup.specialties")}]]),[a]),p=(0,i.useMemo)((()=>d.filter((e=>!t.includes(e.value)))||[]),[t,d]);return o().createElement(Ce,{className:"booking-search-tab"},o().createElement(Ee,null,o().createElement(c.t,{value:e,onTabChange:e=>{n(e)},styles:r},o().createElement(c.t.List,null,p.map((e=>o().createElement(c.t.Tab,{value:e.value,key:e.value},e.label)))))))};var Oe;!function(e){e.doctor="doctor",e.service="hospital_service",e.hospital="hospital_branch"}(Oe||(Oe={}));const Le=e=>e.filter((e=>"string"===typeof e?"cacar-api"!==e:232!==(null===e||void 0===e?void 0:e.id)));const je=({isMobile:e,careApiDomain:t,geoLocationPermission:a,geoLocationCoordinates:l,initialSelectedCity:n,initialSearchValue:s="",initTypeSearch:c="hospital",initSpecialty:h,careFrontDomain:g="/care",isDebug:m=!1,gaTrackingSearchBar:b,gaTrackingLocationSearch:y,autoCompleteDisabled:f=!1,inputSearchPlaceholder:x="",hideTabBookingSearch:v=[],hideSpecialtySelection:w=!1,hideSpecialtyTab:S=!1,hidePopularSearchKeys:O=!1,clientSlug:$="",routerPush:I,onGeoLocationPermissionChange:M,onChangeLocation:F})=>{const{locale:G,t:H}=(0,k.u)(),U=(0,i.useRef)(null),Q=(0,i.useRef)(null),[Y,Z]=(0,i.useState)(c),{geoLocationPermission:J,geoLocationCoordinates:X}=function(){const[e,t]=(0,i.useState)((()=>{if("undefined"===typeof window)return"unset";if((0,u.Ri)(p.U))return"granted";const e=!location.protocol.includes("https")&&"localhost"!==location.hostname;return!navigator.geolocation||e?"denied":"unset"})),[a,o]=(0,i.useState)((()=>{if("undefined"===typeof window)return null;const e=(0,u.Ri)(p.U);if(e)try{return JSON.parse(e)}catch(t){console.log(t)}return null})),l=(0,i.useCallback)((function(){navigator.geolocation&&navigator.geolocation.getCurrentPosition((e=>{const a={lat:""+Math.round(1e7*e.coords.latitude)/1e7,lng:""+Math.round(1e7*e.coords.longitude)/1e7};(0,u.TV)(p.U,JSON.stringify(a),{minutes:15}),o(a),t("granted")}),(()=>{(0,u.Yj)(p.U),t("denied")}))}),[]);return(0,i.useMemo)((()=>({geoLocationPermission:e,geoLocationCoordinates:a,requestGeoLocation:l})),[e,a])}(),[ee,te]=(0,i.useReducer)(W,z,(t=>Object.assign(Object.assign({},t),{isDebug:m,isMobile:e,geoLocationPermission:a||J||"unset",geoLocationCoordinates:l||X||null,searchKeywords:s,initialSelectedCity:n||null,selectedLocation:n||t.selectedLocation||null,searchLocationKeywords:(null===n||void 0===n?void 0:n.name)||t.searchLocationKeywords,autoCompleteDisabled:f,inputSearchPlaceholder:x,locale:G}))),{navigateTo:ae,focusedSpecialty:se,searchKeywords:re,geoLocationPermission:de,selectedLocation:pe,selectedSpecialty:ue,initialSelectedCity:ge,searchResults:me,isLoadingSearchResults:be}=ee,{fetchCitiesByLocation:ye,fetchCitiesByKeyword:xe,fetchSearchResults:ve,fetchAllSpecialties:we,fetchPopularKeys:Ce}=function({dispatch:e,careApiDomain:t,locale:a="vi-VN",client:o=""}){const l=(0,i.useCallback)((function(i,o={}){const l=`${t}${i}`;return e({type:V.FetchCitiesStart}),fetch(C(l,o,a),{method:"GET"}).then((e=>e.json())).then((e=>1===e._status&&e._data?null===e||void 0===e?void 0:e._data:(console.log("error loading cities",e),Promise.reject(e)))).finally((()=>e({type:V.FetchCitiesFinish})))}),[a]);return{fetchCitiesByLocation:(0,i.useCallback)((function({coordinates:t}){let i={};const n={};t&&(i={lat:t.lat,lng:t.lng}),"ms-MY"===a&&(n.noPaging=1);const s=[l(T,Object.assign(Object.assign(Object.assign({},i),n),{client:j.C.MSD===o?"":o}))];return"zh-TW"===a&&s.push(l(A,{noPaging:1,client:j.C.MSD===o?"":o})),Promise.all(s).then((([t,a])=>{const i=Object.assign({},t);if(a){const e=i.cities.map((e=>e.id));i.cities=i.cities.concat(a.cities.filter((t=>!e.includes(t.id))))}e({type:V.FetchCitiesByGeoIpComplete,payload:i})})).catch((e=>console.error("error loading cities by location",e)))}),[a,t,e]),fetchCitiesByKeyword:(0,i.useCallback)((function(t){return l(A,{keyword:t,client:o}).then((t=>{e({type:V.FetchCitiesByKeywordComplete,payload:t.cities})})).catch((e=>console.error("error loading cities by keyword",e)))}),[a,t,e]),fetchSearchResults:(0,i.useCallback)((function(i,l,n,s,c){const r="specialty"===n?`${t}${R}`:`${t}${P}`;e({type:V.FetchSearchResultsStart});const{selectedLocation:d,geoLocationCoordinates:p,selectedSpecialty:u}=l;let h="";if(!d)return void e({type:V.FetchSearchResultsFinish});h=d.id===j.I?"":d.id;const g=(null===p||void 0===p?void 0:p.lat)||"",m=(null===p||void 0===p?void 0:p.lng)||"",b=(null===u||void 0===u?void 0:u.id)>0?null===u||void 0===u?void 0:u.id:"",y=i.trim().length>q[a]?i.trim():"";return fetch(C(r,{domain:t,searchType:n||"global",keyword:y,city:h===j.a?"":h,lat:g,lng:m,specialty_id:b,client_slug:j.C.MSD===s?"":s,msd:j.C.MSD===o?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?void 0:e._data:Promise.reject(e))).then((t=>{let a=[];"specialty"!==n&&(a="doctor"===n?t.searches.map((e=>Object.assign(Object.assign({},e),{specialties:Le((null===e||void 0===e?void 0:e.specialties)||[])}))):t.searches),"specialty"===n&&(a=Le(y?(null===t||void 0===t?void 0:t.specialties)||[]:(null===t||void 0===t?void 0:t.default)||[])),e({type:V.FetchSearchResultsComplete,payload:{key:n,searches:a||[]}}),c&&e({type:V.UpdateInitialSearchResults,payload:{key:n,searches:a||[]}})})).catch((e=>{console.log("error loading search results",{url:r,error:e})})).finally((()=>e({type:V.FetchSearchResultsFinish})))}),[a,t,e]),fetchAllSpecialties:(0,i.useCallback)((function(){const i=`${t}${R}`;return fetch(C(i,{domain:t,searchType:"",msd:j.C.MSD===o?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?void 0:e._data:Promise.reject(e))).then((t=>{e({type:V.FetchAllSpecialties,payload:Le(t.specialties||[])})})).catch((e=>{console.log("error loading search results",{url:i,error:e})}))}),[a,t,e]),fetchPopularKeys:(0,i.useCallback)((function(i){const o=`${t}${K}`;return fetch(C(o,{domain:t,searchType:Oe[i],sort_by:"display_order",sort_order:"asc"},a)).then((e=>e.json())).then((e=>1===e._status&&e._data?null===e||void 0===e?void 0:e._data:Promise.reject(e))).then((t=>{e({type:V.FetchPopularKeys,payload:t.popular_searches||[]})})).catch((e=>{console.log("error loading search results",{url:o,error:e})}))}),[a,t,e])}}({dispatch:te,locale:G,careApiDomain:t,client:$}),Ee=(0,i.useMemo)((()=>j.L[G]),[G]),je=(0,i.useMemo)((()=>Object.assign({doctor:{name:H("booking.searchPopup.doctors"),icon:o().createElement(ie,null),slug:Ee.DOCTOR},service:{name:H("booking.searchPopup.services"),icon:o().createElement(oe,null),slug:Ee.SERVICE},hospital:{name:H("booking.searchPopup.hospitals"),icon:o().createElement(le,null),slug:Ee.HOSPITAL}},!S&&{specialty:{name:H("booking.searchPopup.specialties"),icon:o().createElement(ne,null),slug:Ee.SPECIALTIES}})),[Y]),$e=(0,i.useMemo)((()=>L()(xe,400)),[xe]),Ie=(0,i.useMemo)((()=>L()(ve,400)),[ve]),Me=(0,i.useCallback)((function(e){te({type:V.SelectLocation,payload:e}),Fe(),F&&F(e)}),[H,te]);function Fe(){var e;U.current&&(null===(e=U.current.querySelector('input[name="search-results"]'))||void 0===e||e.focus())}function Ae(){let e="";const{slug:t}=je[Y];let a="";const i=j.M[G][$];("doctor"===Y||"hospital"===Y)&&ee.selectedSpecialty.id>0&&(a=`&specialtyId=${ee.selectedSpecialty.id}`),e="specialty"===Y?`/${t}`:`/${pe.slug}/${t}`,i&&(e+=`/${i}`),e+=`?q=${re}${a}`,e&&te({type:V.NavigateTo,payload:e})}return(0,E.a)(Q,(()=>{te({type:V.ClickOutsideInputSearchSpecialty})})),(0,i.useEffect)((()=>{var t;"denied"===de||ge||te({type:V.SelectLocation,payload:{name:H("booking.searchBar.allLocations"),id:j.I,slug:null===(t=j.L[G])||void 0===t?void 0:t.ALL}}),M&&M(de,ee.geoLocationCoordinates),e&&"granted"===de&&pe&&te({type:V.FocusInputSearch}),ye({coordinates:ee.geoLocationCoordinates})}),[de]),(0,i.useEffect)((()=>{const e=h||{name:H("booking.searchBar.allSpecialties"),id:-1,thumbnail:"",total_doctor:0,slug:Ee.SPECIALTIES};ee.selectedSpecialty||te({type:V.SelectSpecialty,payload:e})}),[h,ee.selectedSpecialty]),(0,i.useEffect)((()=>{we()}),[]),(0,i.useEffect)((()=>{Ce(Y)}),[Y]),(0,i.useEffect)((()=>{ae&&(I?I(ae):window.location.href=`${g}${ae}`)}),[ae]),(0,i.useEffect)((()=>{ve(ee.searchKeywords,ee,Y,$,!0)}),[pe,ue,Y]),o().createElement(D,{ref:U},o().createElement(ke,{currentTab:Y,setCurrentTab:Z,isMobile:e,hideTabBookingSearch:v,hideSpecialtyTab:S}),o().createElement(N,{className:"booking-search-container"},o().createElement(B,null,o().createElement(_,{className:"booking-search-content"},o().createElement("div",{ref:Q},o().createElement(r.s,{gap:"12px",justify:"space-between",align:"center",direction:e?"column":"row",className:"flex-search-input"},"specialty"!==Y&&o().createElement(he,{state:ee,isMobile:e,dispatch:te,debouncedFetchCitiesByKeyword:$e,selectedLocation:pe,onLocationClick:Me,trackingAttributes:y}),o().createElement(ce,{type:Y,isMobile:e,state:ee,dispatch:te,debouncedFetchSearchResults:Ie,initalSearchValue:s,focusSearchInput:Fe,onEnterSearch:Ae,typeInformation:je,trackingAttributes:b,isLoading:be,hideSpecialtySelection:w||S,clientSlug:$}),o().createElement(d.$,{size:e?"md":"lg",color:"#2D87F3",fullWidth:e,variant:"filled",onClick:Ae,styles:{root:{height:e?"40px":"48px"}}},H("booking.searchBar.searchButton"))),!O&&"specialty"!==Y&&ee.popularKeys.length>0&&o().createElement(Se,{type:Y,state:ee,typeInformation:je,dispatch:te}),"specialty"===Y&&"search"===se&&o().createElement(fe,{state:ee,isMobile:e,dispatch:te,specialties:(null===me||void 0===me?void 0:me.specialty)||[],isLoading:be}))))))}},26662:function(e,t,a){var i=a(73884),o=a.n(i),l=a(41303),n=function(e,t){var a={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(a[i]=e[i]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var o=0;for(i=Object.getOwnPropertySymbols(e);o{var{size:t,color:a=l.fT}=e,i=n(e,["size","color"]);const s=(0,l.D5)(t);return o().createElement("svg",Object.assign({width:s,height:s,viewBox:"0 0 24 24",fill:"none"},i),o().createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.972 10.873a6.901 6.901 0 1 1 13.803 0 6.901 6.901 0 0 1-13.803 0M10.873 2a8.873 8.873 0 1 0 5.539 15.806l3.905 3.906a.986.986 0 0 0 1.394-1.395l-3.905-3.905A8.873 8.873 0 0 0 10.873 2",fill:a}))}}}]);