import{d as g,a as S,bO as h,r as m,j as k,f as i,h as t,x as p,i as y,g as e,v as n,A as N,B as x,z as A,bP as E,o as u,_ as I}from"./BxiWQxwE.js";const C={class:"store-selector"},O={class:"store-selector__content"},T={class:"icon"},B={key:0,class:"description"},V={key:1,class:"description"},w=["disabled"],D=g({__name:"store-nearby",emits:["selectStore"],setup(L,{emit:v}){const{$messages:l}=S(),{nearestStore:b,nearbyStore:o}=h(),s=m(!1),c=m(!1),f=v;return k(()=>{navigator.geolocation&&!o.value?(s.value=!0,navigator.geolocation.getCurrentPosition(a=>{const r=a.coords.latitude,d=a.coords.longitude;b(r,d).catch(_=>{s.value=!1,c.value=!0,console.error("Error getting nearby store:",_)}),s.value=!1,c.value=!1},a=>{switch(s.value=!1,c.value=!0,a.code){case a.PERMISSION_DENIED:console.error("User denied the request for Geolocation.");break;case a.POSITION_UNAVAILABLE:console.error("Location information is unavailable.");break;case a.TIMEOUT:console.error("The request to get user location timed out.");break;default:console.error("An unknown error occurred.");break}},{enableHighAccuracy:!0,timeout:1e4,maximumAge:0})):(console.error("Geolocation is not supported by this browser."),s.value=!1,c.value=!0)}),(a,r)=>{const d=E;return u(),i("div",C,[t("div",O,[t("div",T,[y(d,{"aria-label":e(l)("aria.chooseStore")},null,8,["aria-label"])]),e(o)&&!e(s)?(u(),i("div",B,[t("h5",null,n(e(o).fullName),1),t("p",null,n(e(o).postalCode)+" "+n(e(o).city),1)])):p("",!0),e(c)&&!e(o)?(u(),i("div",V,[t("h5",null,n(e(l)("assortment.popup.selectStore.option.noStoreFound")),1),t("p",null,n(e(l)("assortment.popup.selectStore.option.selectAStoreOption")),1)])):p("",!0),e(s)&&!e(o)?(u(),i("div",{key:2,class:N(["description",{loading:e(s)}])},[t("p",null,[x(n(e(l)("stores.nearbyLoading"))+" ",1),r[1]||(r[1]=t("span",{class:"loading"},null,-1))])],2)):p("",!0)]),t("button",{disabled:!e(o),class:"btn-green",onClick:r[0]||(r[0]=A(_=>f("selectStore",e(o)),["prevent"]))},n(e(l)("assortment.popup.selectStore.option.selectThisStore")),9,w)])}}}),P=I(D,[["__scopeId","data-v-4007b76e"]]);export{P as default};
