(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[352],{41409:function(e,t,l){Promise.resolve().then(l.bind(l,18645))},10064:function(e){"use strict";e.exports=["pz-click-collect","pz-checkout-gift-pack","pz-gpay"]},52682:function(e,t,l){"use strict";var n,o,s,i,r,a,c,d,u,m;l.r(t),l.d(t,{ROUTES:function(){return p}}),(c=n||(n={})).HOME="/",c.BASKET="/baskets/basket",c.LIST="/list",c.STORE="/stores",(d=o||(o={})).AUTH="/users/auth",d.FORGOT_PASSWORD="/users/password/reset",d.EMAIL_SET_PRIMARY="/users/email-set-primary/.+",d.CONFIRM_EMAIL="/users/registration/account-confirm-email/.+",(u=s||(s={})).ACCOUNT="/account",u.ACCOUNT_ADDRESS="/account/address",u.ACCOUNT_CHANGE_EMAIL="/account/change-email",u.ACCOUNT_CHANGE_PASSWORD="/account/change-password",u.ACCOUNT_NOTIFICATIONS="/account/notification-settings/",u.ACCOUNT_CONTACT="/account/contact",u.ACCOUNT_COUPONS="/account/coupons",u.ACCOUNT_FAQ="/account/faq",u.ACCOUNT_ORDERS="/users/orders",u.ACCOUNT_PROFILE="/account/profile",u.ACCOUNT_WISHLIST="/account/favourite-products/",u.ANONYMOUS_TRACKING="/anonymous-tracking",(m=i||(i={})).CHECKOUT="/orders/checkout",m.CHECKOUT_COMPLETED="/orders/completed",(r||(r={})).CONTACT_US="/contact-us",a||(a={});let p={...n,...o,...s,...i,...r,...a}},1675:function(e,t,l){"use strict";var n,o=l(32215);let{LocaleUrlStrategy:s}=l(55223),{ROUTES:i}=l(52682),r=encodeURI(null!==(n=o.env.SERVICE_BACKEND_URL)&&void 0!==n?n:"default");e.exports={commerceUrl:r,commonProductAttributes:[{translationKey:"color",key:"color"},{translationKey:"size",key:"size"}],localization:{locales:[{label:"EN",value:"en",localePath:"en",apiValue:"en-us",rtl:!1},{label:"TR",value:"tr",localePath:"tr",apiValue:"tr-tr",rtl:!1}],currencies:[{label:"USD",code:"usd"},{label:"₺",code:"try"}],defaultLocaleValue:"tr",localeUrlStrategy:s.HideDefaultLocale,redirectToDefaultLocale:!0,defaultCurrencyCode:"try"},rewrites:[{source:i.AUTH,destination:"/auth"},{source:i.BASKET,destination:"/basket"},{source:i.ACCOUNT_ORDERS,destination:"/account/orders"}],redis:{defaultExpirationTime:900},checkout:{iframeExcludedPaymentOptions:["credit-card"]}}},18645:function(e,t,l){"use strict";l.r(t),l.d(t,{default:function(){return h}});var n=l(3827),o=l(72020),s=l(61380),i=l(64090),r=l(93293),a=l(32215);async function c(e){if("string"!=typeof e)return;let t=a.env.NEXT_PUBLIC_MAP_API_KEY,l="https://maps.googleapis.com/maps/api/geocode/json?address=".concat(encodeURIComponent(e),"&key=").concat(t),n=await fetch(l),o=await n.json();if(0===o.results.length)throw Error("No results found for the given city name.");let{lat:s,lng:i}=o.results[0].geometry.location;return{lat:s,lng:i}}let d={width:"100%",height:"544px"},u=e=>{let{stores:t,selectedStorePk:l,setSelectedStorePk:u,userLocation:m,setClickedStorePk:p,setMapDetailShowInfo:f,setMapDetailHideInfo:x,cityMapLanLon:h,setStoreDetailInfo:v,setCityMapLanLon:g}=e,[b,w]=(0,i.useState)(null),[k,S]=(0,i.useState)(null),[N,j]=(0,i.useState)(null),[C,y]=(0,i.useState)(5),{isLoaded:T}=(0,o.Ji)({id:"google-map-script",googleMapsApiKey:a.env.NEXT_PUBLIC_MAP_API_KEY}),I=null==t?void 0:t.results.find(e=>e.pk.toString()===l),_=(0,i.useCallback)(e=>{w(e),y(e.getZoom())},[]),A=(0,i.useCallback)(()=>w(null),[]),E=(0,i.useCallback)(()=>{b&&y(b.getZoom())},[b]);return(0,i.useEffect)(()=>{h?(async()=>{try{let e=await c(h);S(e)}catch(e){console.error("Error while fetching city coordinates:",e)}})():j({lat:39.3073998,lng:36.7081859})},[h]),(0,i.useEffect)(()=>{if(b&&(null==t?void 0:t.results)){let e=new window.google.maps.LatLngBounds;t.results.forEach(t=>{e.extend({lat:Number(t.latitude),lng:Number(t.longitude)})}),b.fitBounds(e)}},[null==t?void 0:t.results,b]),(0,i.useEffect)(()=>{if(b&&I){let e=parseFloat(I.latitude),t=parseFloat(I.longitude);isNaN(e)||isNaN(t)?console.error("Invalid coordinates for selected store:",{lat:e,lng:t}):(b.panTo({lat:e,lng:t}),b.setZoom(15))}},[I,b]),(0,i.useEffect)(()=>{if(b&&k){let{lat:e,lng:t}=k;isNaN(e)||isNaN(t)?console.error("Invalid coordinates for city:",k):(b.panTo(k),b.setZoom(10))}},[k,b]),(0,i.useEffect)(()=>{if(b&&T){let{lat:e,lng:t}=N;isNaN(e)||isNaN(t)?console.error("Invalid coordinates for city:",N):(b.panTo(N),setTimeout(()=>{b.setZoom(5)},500))}},[b,T,N]),(0,n.jsx)(n.Fragment,{children:T&&void 0!==window.google?(0,n.jsxs)(o.b6,{mapContainerStyle:d,onLoad:_,onUnmount:A,onZoomChanged:E,children:[b&&(0,n.jsx)(o.Jx,{icon:{fillColor:"#4285F4",fillOpacity:1,path:google.maps.SymbolPath.CIRCLE,scale:8,strokeColor:"rgb(255,255,255)",strokeWeight:2},position:{lat:parseFloat(m.lat),lng:parseFloat(m.lng)}}),(null==t?void 0:t.results)&&t.results.map(e=>{var t;return(0,n.jsx)(o.Jx,{icon:{url:"".concat(null===(t=r.Z.src)||void 0===t?void 0:t.toString()),size:new window.google.maps.Size(38,35),scaledSize:new window.google.maps.Size(35,35)},position:{lat:parseFloat(e.latitude),lng:parseFloat(e.longitude)},onClick:C<15?()=>{p(e.pk.toString()),u(e.pk.toString()),f(!0),x(!1),v(!0),g({lat:39.3073998,lng:36.7081859})}:()=>{}},e.pk)})]}):(0,n.jsx)(s.SkeletonWrapper,{children:(0,n.jsx)(s.Skeleton,{className:"w-full h-[34rem]  md:mt-0"})})})};function m(e){let{cities:t,countries:l,selectedCityPk:o,setSelectedCityPk:r,setSelectedStoreShow:a,setStoreDetailInfo:c,setCityMapLanLon:d,setShowStores:u,storesRef:m}=e,[p,f]=(0,i.useState)(null),[x,h]=(0,i.useState)([]),[v,g]=(0,i.useState)(""),b=[{label:"\xdclke Se\xe7İnİz",value:""},...((null==l?void 0:l.results)||[]).map(e=>({label:e.name,value:e.pk}))],w=[{label:"Şehir Se\xe7İnİz",value:""},...(x||[]).map(e=>({label:e.name,value:e.pk}))],k=(0,i.useMemo)(()=>null==b?void 0:b.sort((e,t)=>{var l;if(e.value&&t.value)return(null==e?void 0:e.label)==="T\xfcrkiye"||(null==t?void 0:t.label)==="T\xfcrkiye"?(null==e?void 0:e.label)==="T\xfcrkiye"?-1:1:null==e?void 0:null===(l=e.label)||void 0===l?void 0:l.localeCompare(null==t?void 0:t.label)}),[b]);return(0,i.useEffect)(()=>{p&&h(null==t?void 0:t.results.filter(e=>e.country===parseInt(p,10)))},[p,t]),(0,i.useEffect)(()=>{if(o){let e=x.find(e=>e.pk===parseInt(o,10));e&&g(e.name)}},[o,x]),(0,n.jsx)("div",{className:"h-full md:max-h-[520px] mt-5 bg-gray-25 rounded-2xl flex flex-col md:flex-row md:gap-[30px]",children:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.Select,{options:k,onChange:e=>{f(e.target.value)},value:p||"",labelClassName:"md:w-[20.5%] w-full",className:"bg-gray-25 border-b border-[#e8e7e7] cursor-pointer py-2 truncate w-100 outline-none mb-4 text-opacity-65"}),(0,n.jsx)(s.Select,{options:w,onChange:e=>{r(e.target.value),u(!1),c(!1),a(!1)},value:o||"",labelClassName:"md:w-[20.5%] w-full",className:"bg-gray-25 border-b border-[#e8e7e7] cursor-pointer py-2 truncate w-100 outline-none mb-4 text-opacity-65"}),(0,n.jsx)(s.Button,{className:"md:w-[16rem] mb-4 ".concat(p&&o?"cursor-pointer":"cursor-not-allowed"),onClick:()=>{v&&d(v),u(!0),window.innerWidth<768&&m.current.scrollIntoView({behavior:"smooth",block:"start"})},disabled:!p||!o,children:"Ara"})]})})}var p=l(9557),f=e=>{var t,l,o,i,r,a,c,d,u,m,f,x,h;let{stores:v,setSelectedStorePk:g,storeDetailInfo:b,setStoreDetailInfo:w,setSelectedStoreShow:k,setMapDetailShowInfo:S,setMapDetailHideInfo:N,clickedStorePk:j,setClickedStorePk:C,setShowStores:y,setCityMapLanLon:T,storesRef:I}=e;return(0,n.jsxs)("div",{children:[b?(0,n.jsxs)("div",{className:"border-t-[1px] cursor-pointer py-4 border-[#e8e7e7] text-xs font-semibold text-black tracking-[1px]",children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)("div",{className:"mb-5 flex items-center justify-between",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:null===(t=v.find(e=>e.pk.toString()===j))||void 0===t?void 0:t.name}),(0,n.jsx)(s.Icon,{name:"close",size:12,onClick:()=>{C(null),k(!1),w(!1),T(null),window.innerWidth<768&&I.current.scrollIntoView({behavior:"smooth"})},className:"cursor-pointer"})]}),(0,n.jsx)("p",{className:"text-sm font-normal",children:null===(l=v.find(e=>e.pk.toString()===j))||void 0===l?void 0:l.address}),(0,n.jsx)("p",{className:"text-sm font-normal",children:null===(r=v.find(e=>e.pk.toString()===j))||void 0===r?void 0:null===(i=r.township)||void 0===i?void 0:null===(o=i.city)||void 0===o?void 0:o.name}),(0,n.jsxs)("p",{className:"text-sm font-normal",children:[(null===(a=v.find(e=>e.pk.toString()===j))||void 0===a?void 0:a.phone_number)?"T:":""," ",null===(c=v.find(e=>e.pk.toString()===j))||void 0===c?void 0:c.phone_number]}),(0,n.jsxs)("p",{className:"text-sm font-normal",children:[(null===(d=v.find(e=>e.pk.toString()===j))||void 0===d?void 0:d.fax_phone_number)?"F:":""," ",null===(u=v.find(e=>e.pk.toString()===j))||void 0===u?void 0:u.fax_phone_number]})]}),(0,n.jsx)("div",{children:(0,n.jsx)(p.Image,{src:(null===(m=v.find(e=>e.pk.toString()===j))||void 0===m?void 0:m.image)||"/pancomagza.png",alt:(null===(f=v.find(e=>e.pk.toString()===j))||void 0===f?void 0:f.name)||"store-image",width:288,height:148,className:"mb-3 mt-6 w-full"})}),(0,n.jsx)("div",{className:"w-full flex items-center justify-center mt-3",children:(0,n.jsx)(s.Link,{href:"https://www.google.com/maps/dir/?api=1&destination=".concat(parseFloat(null===(x=v.find(e=>e.pk.toString()===j))||void 0===x?void 0:x.latitude),",").concat(parseFloat(null===(h=v.find(e=>e.pk.toString()===j))||void 0===h?void 0:h.longitude)),target:"_blank",className:"flex gap-1 items-center w-full",children:(0,n.jsx)(s.Button,{className:"w-full font-medium text-xs uppercase",children:"Yol Tarifi Al"})})})]}):(0,n.jsx)("ul",{children:v.map(e=>(0,n.jsxs)("li",{onClick:()=>{window.innerWidth<768&&window.scrollTo({top:250,behavior:"smooth"}),C(e.pk.toString()),w(!0),k(!0),T("".concat(e.latitude,",").concat(e.longitude)),g(e.pk.toString())},className:"border-b-[1px] cursor-pointer py-4 flex justify-between border-[#e8e7e7] text-xs font-semibold text-black tracking-[1px] ".concat(j===e.pk.toString()?"hidden":"flex"),children:[e.name,(0,n.jsx)(s.Icon,{name:"chevron-end",size:13,className:"fill-[#000] text-black"})]},e.pk))}),(0,n.jsx)("span",{className:"cursor-pointer underline block text-sm text-[#000] font-medium mt-4 mb-3",onClick:()=>{w(!1),N(!0),S(!1),T(null),C(null),k(!1),y(!1),window.innerWidth<768&&I.current.scrollIntoView({behavior:"smooth"})},children:"T\xfcm listeye d\xf6n"})]})},x=e=>{var t,l;let{store:o,onClose:i}=e;return(0,n.jsxs)("div",{className:"border-t-[1px] cursor-pointer py-4 border-[#e8e7e7] text-xs font-semibold text-black tracking-[1px]",children:[(0,n.jsxs)("div",{className:"",children:[(0,n.jsxs)("div",{className:"mb-5 flex items-center justify-between",children:[(0,n.jsx)("p",{className:"text-sm font-medium",children:null==o?void 0:o.name}),(0,n.jsx)(s.Icon,{name:"close",size:12,onClick:i,className:""})]}),(0,n.jsx)("p",{className:"text-sm font-normal",children:null==o?void 0:o.address}),(0,n.jsx)("p",{className:"text-sm font-normal",children:null==o?void 0:null===(l=o.township)||void 0===l?void 0:null===(t=l.city)||void 0===t?void 0:t.name}),(0,n.jsxs)("p",{className:"text-sm font-normal",children:[(null==o?void 0:o.phone_number)?"T:":""," ",null==o?void 0:o.phone_number]}),(0,n.jsxs)("p",{className:"text-sm font-normal",children:[(null==o?void 0:o.fax_phone_number)?"F:":""," ",null==o?void 0:o.fax_phone_number]})]}),(0,n.jsx)("div",{children:(0,n.jsx)(p.Image,{src:(null==o?void 0:o.image)||"/pancomagza.png",alt:(null==o?void 0:o.name)||"store-image",width:288,height:148,className:"mb-3 mt-6 w-full"})}),(0,n.jsx)("div",{className:"w-full flex items-center justify-center mt-3",children:(0,n.jsx)(s.Link,{href:"https://www.google.com/maps/dir/?api=1&destination=".concat(parseFloat(null==o?void 0:o.latitude),",").concat(parseFloat(null==o?void 0:o.longitude)),target:"_blank",className:"flex gap-1 items-center w-full",children:(0,n.jsx)(s.Button,{className:"w-full font-medium text-xs uppercase",children:"Yol Tarifi Al"})})})]})};function h(e){let{stores:t,cities:l,countries:o}=e,r=(0,i.useRef)(null),a=(0,i.useRef)(null),[c,d]=(0,i.useState)(null),[p,h]=(0,i.useState)(null),[v]=(0,i.useState)({lat:null,lng:null}),[g,b]=(0,i.useState)([]),[w,k]=(0,i.useState)(null),[S,N]=(0,i.useState)(!1),[j,C]=(0,i.useState)(!1),[y,T]=(0,i.useState)(!0),[I,_]=(0,i.useState)(null),[A,E]=(0,i.useState)(!1),[O,L]=(0,i.useState)(t),[R,U]=(0,i.useState)(l),[P,F]=(0,i.useState)(o),[M,z]=(0,i.useState)(!1);(0,i.useEffect)(()=>{L(t),U(l),F(o)},[t,l,o]);let D=O.results.filter(e=>{var t;return e.township&&e.township.city&&(null===(t=e.township.city.country)||void 0===t?void 0:t.code)==="tr"}).map(e=>e.township.city.name).filter((e,t,l)=>l.indexOf(e)===t),W=O.results.filter(e=>{var t;return e.township&&e.township.city&&(null===(t=e.township.city.country)||void 0===t?void 0:t.code)!=="tr"}).map(e=>e.township.city.name).filter((e,t,l)=>l.indexOf(e)===t),H=(e,t)=>{h(e);let l=O.results.filter(t=>{var l,n;return(null===(n=t.township)||void 0===n?void 0:null===(l=n.city)||void 0===l?void 0:l.pk)===e});k(t),b(l),z(!0)},V=e=>{_(e===I?null:e),E(!0),d(e.toString()),window.innerWidth<768&&window.scrollTo({top:250,behavior:"smooth"})};return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h2",{className:"font-semibold text-black-700 text-3xl",children:"Mağazalar"}),(0,n.jsx)("div",{children:(0,n.jsx)(m,{stores:O,cities:R,countries:P,selectedCityPk:p,setSelectedCityPk:h,showStores:S,setShowStores:N,setStoreDetailInfo:E,setSelectedStoreShow:z,setCityMapLanLon:k,storesRef:a})}),(0,n.jsxs)("div",{ref:a,className:"flex w-full mt-7 ".concat(A?"flex-col ":"flex-col-reverse","  md:flex-row"),children:[S?(0,n.jsx)("div",{className:"w-full md:w-[26%] md:max-h-[34rem] overflow-y-auto",children:S&&p&&(0,n.jsx)(f,{stores:t.results.filter(e=>e.township.city.pk===parseInt(p)),setSelectedStorePk:d,setStoreDetailInfo:E,storeDetailInfo:A,setSelectedStoreShow:z,setClickedStorePk:_,clickedStorePk:I,setShowStores:N,setCityMapLanLon:k,setMapDetailShowInfo:C,setMapDetailHideInfo:T,storesRef:a,detailRef:r})}):(0,n.jsx)("div",{className:"w-full md:w-[26%] md:max-h-[34rem] overflow-y-auto",children:!j&&y?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{children:[!M&&(0,n.jsx)("h2",{className:"text-sm font-normal tracking-[1.4px] text-black",children:"YURT İ\xc7İ MAĞAZALAR"}),(0,n.jsx)("ul",{children:M?(0,n.jsxs)("ul",{children:[g.map(e=>(0,n.jsx)("div",{className:"detailView",children:I!==String(e.pk)?(0,n.jsxs)("li",{className:"".concat(A?"hidden":"flex"," border-b-[1px] cursor-pointer py-4 justify-between border-[#e8e7e7] text-xs font-semibold text-black tracking-[1px]"),onClick:()=>{V(String(e.pk))},children:[e.name,(0,n.jsx)(s.Icon,{name:"chevron-end",size:13,className:"fill-[#000] text-black"})]},e.pk):(0,n.jsx)(n.Fragment,{children:M&&I&&(0,n.jsx)(x,{store:O.results.find(e=>e.pk.toString()===I),onClose:()=>{E(!1),T(!0),C(!1),_(null),z(!1),k(null),window.innerWidth<768&&a.current.scrollIntoView({behavior:"smooth"})}})})},e.pk)),(0,n.jsx)("span",{className:"cursor-pointer underline block text-sm text-[#000] font-medium mt-4 mb-3",onClick:()=>{z(!1),E(!1),k(null),window.innerWidth<768&&a.current.scrollIntoView({behavior:"smooth"})},children:"T\xfcm listeye d\xf6n"})]}):(0,n.jsx)("ul",{children:D.map(e=>(0,n.jsxs)("li",{className:"border-b-[1px] cursor-pointer py-4 flex justify-between border-[#e8e7e7] text-xs font-semibold text-black tracking-[1px]",onClick:async()=>{let t=R.results.find(t=>t.name===e);z(!0),H((null==t?void 0:t.pk)||"",e),window.innerWidth<768&&a.current.scrollIntoView({behavior:"smooth"})},children:[e,(0,n.jsx)(s.Icon,{name:"chevron-end",size:13,className:"fill-[#000] text-black"})]},e))})})]}),(0,n.jsxs)("div",{children:[!M&&(0,n.jsx)("h3",{className:"text-sm font-normal tracking-[1.4px] text-black mt-4 ",children:"YURT DIŞI MAĞAZALAR"}),(0,n.jsx)("ul",{children:!M&&(0,n.jsx)("div",{children:W.map(e=>(0,n.jsxs)("li",{className:"border-b-[1px] cursor-pointer py-4 flex justify-between border-[#e8e7e7] text-xs font-semibold text-black tracking-[1px]",onClick:()=>{let t=R.results.find(t=>t.name===e);H((null==t?void 0:t.pk)||"",e),window.innerWidth<768&&a.current.scrollIntoView({behavior:"smooth"})},children:[e,(0,n.jsx)(s.Icon,{name:"chevron-end",size:13,className:"fill-[#000] text-black"})]},e))})})]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(x,{store:O.results.find(e=>e.pk.toString()===I),onClose:()=>{E(!1),T(!0),C(!1),k(null),_(null),z(!1)}}),(0,n.jsx)("span",{className:"cursor-pointer underline block text-sm text-[#000] font-medium mt-4 mb-3",onClick:()=>{E(!1),T(!0),C(!1),k(null),_(null),z(!1)},children:"T\xfcm listeye d\xf6n"})]})}),(0,n.jsx)("div",{className:"w-full h-full mb-8 md:mb-0 md:pl-8",children:(0,n.jsx)(u,{selectedStorePk:c,setSelectedStorePk:d,userLocation:v,stores:O,setClickedStorePk:_,setMapDetailShowInfo:C,setMapDetailHideInfo:T,cityMapLanLon:w,setStoreDetailInfo:E,setCityMapLanLon:k})})]})]})})}},93293:function(e,t){"use strict";t.Z={src:"/_next/static/media/pin.c57ee3f0.svg",height:34,width:34,blurWidth:0,blurHeight:0}}},function(e){e.O(0,[1910,9305,2278,1814,9247,4364,8947,9557,1380,2971,8069,1744],function(){return e(e.s=41409)}),_N_E=e.O()}]);