@restaround/react 1.0.53 → 1.0.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,2 +1,2 @@
1
- import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{isEmpty as r,trackEvent as i,priceFormatter as n,classNames as o}from"@sorocraft/js-utils";import{createContext as l,useContext as d,useState as c,useRef as s,useEffect as u,useMemo as m,memo as _,useCallback as h}from"react";import{Row as g,classNames as v,IconLink as p,Tooltip as f,SVGIcon as y,Flex as I,Column as P,Carousel as b,CarouselItem as C,Chip as A,UIElementType as N,Text as k,IconButton as w,Modal as S,Input as D,InputType as L,Button as T,Drawer as O,Description as R,Container as G,Card as x,DropDown as q,DropDownMenuItem as j,Loading as z,BarChart as W}from"@sorocraft/ui";import{Phone as E,Whatsapp as Q,Instagram as H,Telegram as B,Tiktok as $,Facebook as M,Wifi as U,MarkerPin as V,Plus as Y,Minus as F,Trash as K,ShoppingBag as X,Close as Z,List as J,Grid as ee}from"@sorocraft/ui/icons";function te(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(a[r[i]]=e[r[i]])}return a}function ae(e,t,a,r){return new(a||(a=Promise))((function(i,n){function o(e){try{d(r.next(e))}catch(e){n(e)}}function l(e){try{d(r.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,l)}d((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var re="PublicMenu-module_container__QLN6U",ie="PublicMenu-module_categories__Iy6NC",ne="PublicMenu-module_footer__6G3DQ";const oe="https://images.restaround.co",le=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${oe}/${e}`:"",de=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${oe}/${e}`:"https://images.restaround.co/no-photo-128.webp",ce=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${oe}/${e}`:"https://images.restaround.co/restaround-doodle.webp",se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ue=(e,t,a)=>se.charAt(e>>2)+se.charAt((3&e)<<4|t>>4)+se.charAt((15&t)<<2|a>>6)+se.charAt(63&a),me="restaround.co",_e=[me,"restaround.az","restaround.ee","restaround.nl"],he=l({}),ge=({children:t,value:a})=>{const i=r(a)?{}:a;return i.currency||(i.currency="AZN"),i.language||(i.language="az"),e(he.Provider,{value:r(a)?{}:a,children:t})},ve=()=>d(he),pe="digital_menu",fe=`${pe}_category_select`,ye=`${pe}_category_scroll`,Ie=`${pe}_product_details`,Pe=`${pe}_product_add_cart`,be=`${pe}_product_view_changed`,Ce=[fe,ye,Ie,Pe],Ae=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var Ne="Header-module_container__tenlF",ke="Header-module_cover__BAWZK",we="Header-module_content__Gx4Al",Se="Header-module_logo__4MTCm",De="Header-module_info__IchYA",Le="Header-module_name__30wyw",Te="Header-module_address__WOxXc",Oe="Header-module_addressText__lUszI",Re="Header-module_social__AoP0z",Ge="Header-module_links__EeQxg",xe="Header-module_wifiPassword__VWBTa",qe="Header-module_wifiPasswordIcon__Ukn3D";const je=t=>{const a=te(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:r}=ve()||{};if(r){return e(r,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(i=235,n=59,o=90,`data:image/gif;base64,R0lGODlhAQABAPAA${ue(0,i,n)+ue(o,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var i,n,o;return e("img",Object.assign({},a))};var ze={container:"Languages-module_container__nJeK1",currentLanguage:"Languages-module_currentLanguage__EFw6Q",options:"Languages-module_options__6jLRm",option:"Languages-module_option__QkVQd",isOpen:"Languages-module_isOpen__eUGbg",flexWide:"Languages-module_flexWide__zQ9jN",slidein:"Languages-module_slidein__C4UHU",fadeInOut:"Languages-module_fadeInOut__U-vhH",heightAnimation:"Languages-module_heightAnimation__gIQkF",fadein:"Languages-module_fadein__vPmsX",floatAnimation:"Languages-module_floatAnimation__L-kPH",bottomSheet:"Languages-module_bottomSheet__-t-q8",slideRightToLeft:"Languages-module_slideRightToLeft__y0l-f"};const We=()=>{var a;const{language:r,languages:i,onLanguageSelect:n}=ve(),[o,l]=c(!1),d=(null==i?void 0:i.length)>1,s=(null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.call(i,(({code:e})=>e!==r)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e("div",{className:ze.container,onClick:()=>l(!o),children:t(g,{alignItems:"center",gap:0,children:[e(g,{alignItems:"center",className:v(ze,{options:!0,isOpen:o}),children:s.map((({code:t})=>e("img",{src:u(t),className:ze.option,onClick:()=>(e=>{n&&n(e)})(t),alt:t},t)))}),e("img",{src:u(r),alt:r||"",className:ze.currentLanguage})]})}):null},Ee=({branch:a,coverImage:i,logoImage:n,name:o,instagram:l,facebook:d,whatsapp:c,telegram:s,tiktok:u})=>{const{address:m,latitude:_,longitude:h,phone:v,wifiPassword:b}=a||{},C=r(a),A=`https://www.google.com/maps/place/${_},${h}`;return t("div",{className:Ne,children:[e(je,{src:i,alt:o,className:ke,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e("div",{className:we,children:e(C?()=>t(P,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e(je,{src:n,alt:o,className:Se,width:96,height:96}),e("div",{className:De,children:e("h1",{className:Le,children:o})})]}):()=>t(I,{direction:"row",gap:1,alignItems:"center",children:[e(I.Item,{children:e(je,{src:n,alt:o,className:Se,width:96,height:96})}),e(I.Item,{shrink:!0,children:e("div",{className:De,children:t(P,{gap:.25,children:[e("h1",{className:Le,children:o}),e("a",{className:Te,href:A,target:"_blank",rel:"noopener noreferrer",children:t(g,{alignItems:"center",gap:.5,children:[e(y,{icon:V,theme:"dark"}),e("span",{className:Oe,children:m})]})})]})})})]}),{})}),e(We,{}),!C&&e("div",{className:Re,children:e("div",{className:Ge,children:e(g,{gap:2,alignItems:"center",children:t(g,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!v&&e(p,{icon:E,href:`tel:+${v}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e(p,{icon:Q,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!l&&e(p,{icon:H,href:l,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!s&&e(p,{icon:B,href:s,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e(p,{icon:$,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e(p,{icon:M,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!b&&e(f,{hint:b,children:e("div",{className:xe,children:e(y,{icon:U,size:"sm",className:qe})})})]})})})})]})},Qe=({categoryProductMap:t=[],language:a,selectedCategoryId:r,onSelectCategory:n})=>{const o=s({}),l=s(null);return u((()=>{r&&(()=>{var e;const t=null===(e=null==o?void 0:o.current)||void 0===e?void 0:e[r];if(!t||!l.current)return;const a=l.current.clientWidth,i=t.offsetLeft-a/2+t.offsetWidth/2;l.current.scrollTo({left:i,behavior:"smooth"})})()}),[r]),e("div",{className:ie,children:e(b,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(l.current=e.current)},children:(t||[]).map((({id:t,translations:l})=>{const{name:d}=l.find((e=>e.language===a))||{};return e(C,{children:e(A,{onClick:()=>((e,t)=>{e!==r&&(i(fe,{name:t}),n(e))})(t,d),type:N.BORDERED_PRIMARY,active:t===r,children:e("div",{ref:e=>{e&&(o.current[t]=e)},children:d})})},t)}))})})};var He="Products-module_container__bF2LF",Be="Products-module_view__l857X",$e="Products-module_products__AoDrY",Me="Products-module_category__Sp7dE",Ue="Products-module_list__LH4v5";const Ve=(e,t,a=0)=>e*t*(1+a/100),Ye=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}},Fe=(e,t,a,r=1)=>{const{price:i,vat:o}=e||{},l=Ve(i,r,o);return{totalPrice:l,formattedTotalPrice:n(l,t,a)}},Ke=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.variants)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.id===t)))||{}},Xe=({variantId:e,currency:t="USD",language:a="en",product:r,quantity:i=1})=>{const o=Ke(r,e),{vat:l}=r||{},{price:d}=o||{},c=Ve(d,i,l);return{totalPrice:c,formattedTotalPrice:n(c,t,a)}},Ze=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var Je;!function(e){e.LIST="list",e.GRID="grid"}(Je||(Je={}));const et=l({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{},removeAllProductVariants:()=>{}}),tt=({children:t})=>{const[a,i]=c({}),[n,o]=c(!1),l=({product:e,quantity:t,isAddOperation:a,variantId:n})=>{var o;if(r(e)||t<0)return;const{id:l,price:d,vat:c=0}=e,s=n?`${l}-${n}`:`${l}`,u=n?null===(o=Ke(e,n))||void 0===o?void 0:o.price:d;i((e=>{const r=e[s],i=a?((null==r?void 0:r.quantity)||0)+t:t;if(i<=0){const t=e,a=s;t[a];return te(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[s]:{productId:l,price:u,quantity:i,vat:c,variantId:n}})}))},d=({product:e,quantity:t=1,variantId:a})=>l({product:e,quantity:t,variantId:a,isAddOperation:!0}),s=({product:e,quantity:t=1,variantId:a})=>l({product:e,quantity:t,variantId:a,isAddOperation:!1}),u=e=>{if(!e||r(a))return;const t=Object.entries(a).reduce(((t,[a,r])=>(r.productId!==e&&(t[a]=r),t)),{});i(t)},_=m((()=>({cart:a,isCartOpen:n,addProduct:d,updateProduct:s,setIsCartOpen:o,removeAllProductVariants:u})),[a,n]);return e(et.Provider,{value:_,children:t})},at=()=>d(et);var rt={container:"ProductsListItem-module_container__i9tFs",isClickable:"ProductsListItem-module_isClickable__iHHdI",data:"ProductsListItem-module_data__Mb3SF",name:"ProductsListItem-module_name__T1gyJ",description:"ProductsListItem-module_description__oL4CH",price:"ProductsListItem-module_price__V1GRM",image:"ProductsListItem-module_image__h6Wbi",addToCart:"ProductsListItem-module_addToCart__WXrQZ",flexWide:"ProductsListItem-module_flexWide__Ds6LE",slidein:"ProductsListItem-module_slidein__rEzMI",fadeInOut:"ProductsListItem-module_fadeInOut__i1FNq",heightAnimation:"ProductsListItem-module_heightAnimation__2fk7l",fadein:"ProductsListItem-module_fadein__tPTJ6",floatAnimation:"ProductsListItem-module_floatAnimation__vugAV",bottomSheet:"ProductsListItem-module_bottomSheet__-YAdd",slideRightToLeft:"ProductsListItem-module_slideRightToLeft__oXk26"};const it=({product:a,currency:r,language:n,onClick:l})=>{var d;const{addProduct:c}=at(),{image160:s,volume:u}=a||{},{name:_,description:h}=m((()=>Ye(a,n)),[a,n]),{formattedTotalPrice:v}=m((()=>Fe(a,r,n)),[a,r,n]),p=(null===(d=null==a?void 0:a.variants)||void 0===d?void 0:d.length)>0;return t("div",{className:o(rt,{container:!0,isClickable:!!l}),onClick:l,children:[t(g,{justifyContent:"space-between",gap:0,children:[e("div",{className:rt.data,children:t(P,{gap:.25,children:[e("h3",{className:rt.name,children:_}),e("p",{className:rt.description,children:h}),t(g,{className:rt.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e("span",{children:v}),!!u&&e(k,{color:"muted",children:u})]})]})}),s&&e(je,{src:le(s),alt:_||"menu",className:rt.image,loading:"lazy",width:160,height:90})]}),e("div",{className:rt.addToCart,children:e(w,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),p&&l)return l();c({product:a}),i(Pe,{name:_,quantity:1})},icon:Y,type:N.DEFAULT})})]})};var nt={container:"ProductsGridItem-module_container__DU5KG",content:"ProductsGridItem-module_content__FXs0Y",isClickable:"ProductsGridItem-module_isClickable__8zhwt",info:"ProductsGridItem-module_info__HkBG-",data:"ProductsGridItem-module_data__Z-N1X",name:"ProductsGridItem-module_name__ZrIx3",description:"ProductsGridItem-module_description__-FQPA",price:"ProductsGridItem-module_price__BFu2H",imageContainer:"ProductsGridItem-module_imageContainer__eHS4Z",image:"ProductsGridItem-module_image__alZWL",addToCart:"ProductsGridItem-module_addToCart__gYVrI",noImage:"ProductsGridItem-module_noImage__78UHW",volume:"ProductsGridItem-module_volume__oxEAr",flexWide:"ProductsGridItem-module_flexWide__qcB5X",slidein:"ProductsGridItem-module_slidein__oKaVb",fadeInOut:"ProductsGridItem-module_fadeInOut__d2zot",heightAnimation:"ProductsGridItem-module_heightAnimation__zgbh9",fadein:"ProductsGridItem-module_fadein__Z067K",floatAnimation:"ProductsGridItem-module_floatAnimation__GXjP-",bottomSheet:"ProductsGridItem-module_bottomSheet__-zrFD",slideRightToLeft:"ProductsGridItem-module_slideRightToLeft__R7hv5"};const ot=({product:a,currency:r,language:n,onClick:l})=>{var d;const{addProduct:c}=at(),{volume:s,image580:u,image160:_,image1024:h}=a||{},v=u||h||_,{name:p,description:f}=m((()=>Ye(a,n)),[a,n]),{formattedTotalPrice:y}=m((()=>Fe(a,r,n)),[a,r,n]),I=(null===(d=null==a?void 0:a.variants)||void 0===d?void 0:d.length)>0;return e("div",{className:nt.container,children:t("div",{className:o(nt,{content:!0,isClickable:!!l,noImage:!v}),onClick:l,children:[v&&e("div",{className:nt.imageContainer,children:e(je,{src:le(v),alt:p||"menu",className:nt.image,loading:"lazy",width:580,height:326})}),e("div",{className:nt.info,children:e("div",{className:nt.data,children:t(P,{gap:.25,children:[e("h3",{className:nt.name,children:p}),e("p",{className:nt.description,children:f}),t(g,{className:nt.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e("span",{children:y}),!!s&&e(k,{color:"white",className:nt.volume,children:s})]})]})})}),e("div",{className:nt.addToCart,children:e(w,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),I&&l)return l();c({product:a}),i(Pe,{name:p,quantity:1})},icon:Y,type:N.DEFAULT})})]})})};var lt={container:"ProductDetails-module_container__oa07j",content:"ProductDetails-module_content__Db3NC",image:"ProductDetails-module_image__BlMfl",details:"ProductDetails-module_details__zfnlt",name:"ProductDetails-module_name__ganLM",price:"ProductDetails-module_price__W34k9",volume:"ProductDetails-module_volume__RWG5s",description:"ProductDetails-module_description__HBufi",variants:"ProductDetails-module_variants__zOWjJ",focused:"ProductDetails-module_focused__Nsffd",variantsTitle:"ProductDetails-module_variantsTitle__ta-cw",variant:"ProductDetails-module_variant__vQ5yD",close:"ProductDetails-module_close__4cHZ3",addAction:"ProductDetails-module_addAction__o4T5R",actionTitle:"ProductDetails-module_actionTitle__NIJGW",flexWide:"ProductDetails-module_flexWide__w06FX",slidein:"ProductDetails-module_slidein__N8f4g",fadeInOut:"ProductDetails-module_fadeInOut__hYRtK",heightAnimation:"ProductDetails-module_heightAnimation__hLQyz",fadein:"ProductDetails-module_fadein__QN4mI",floatAnimation:"ProductDetails-module_floatAnimation__dTQbc",bottomSheet:"ProductDetails-module_bottomSheet__HO2S-",slideRightToLeft:"ProductDetails-module_slideRightToLeft__hbtJg"};const dt={en:{},az:{"View order":"Şifarişi göstər","Remove from order":"Sifarişdən sil","Update order":"Sifarişi yenilə","Add to order":"Sifarişə əlavə et","Your order":"Sifarişiniz",Subtotal:"Ümumi","Empty order":"Boş sifariş","You don't have any items in your order":"Sifarişinizdə heç bir məhsul yoxdur","Add items":"Məhsul əlavə et",Events:"Hərəkətlər","Scrolled to Category":"Kateqoriyaya sürüşdürdü","Category Selected":"Kateqoriya seçildi","Product Details":"Məhsul detalına baxıldı","Product Added to Cart":"Səbətə əlavə edildi","Product choices":"Seçimlər","In order":"Sifarişdə"},tr:{"View order":"Siparişi Görüntüle","Remove from order":"Siparişten Kaldır","Update order":"Siparişi Güncelle","Add to order":"Siparişe Ekle","Your order":"Siparişiniz","Empty order":"Boş sipariş","You don't have any items in your order":"Siparişinizde hiç bir ürün yok","Add items":"Ürün ekle",Subtotal:"Toplam",Events:"Olaylar","Product choices":"Seçenekler","In order":"Siparişte"},nl:{"View order":"Bestelling bekijken","Remove from order":"Uit bestelling verwijderen","Update order":"Bestelling bijwerken","Add to order":"Aan bestelling toevoegen","Your order":"Uw bestelling","Empty order":"Lege bestelling","You don't have any items in your order":"U heeft geen items in uw bestelling","Add items":"Items toevoegen",Subtotal:"Totaal",Events:"Gebeurtenissen","Product choices":"Productkeuzes","In order":"In bestelling"},et:{"View order":"Vaata tellimust","Remove from order":"Eemalda tellimusest","Update order":"Uuenda tellimust","Add to order":"Lisa tellimusele","Your order":"Teie tellimus","Empty order":"Tühi tellimus","You don't have any items in your order":"Teie tellimuses pole ühtegi eset","Add items":"Lisa esemeid",Subtotal:"Kokku",Events:"Sündmused","Product choices":"Tootevalikud","In order":"Tellimuses"},ru:{"View order":"Посмотреть заказ","Remove from order":"Удалить из заказа","Update order":"Обновить заказ","Add to order":"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого",Events:"События","Product choices":"Варианты товара","In order":"В заказе"}},ct=e=>{const{language:t}=ve(),a=e||t;return{t:e=>{var t;return(null===(t=dt[a])||void 0===t?void 0:t[e])||e}}},st=(e,t="USD",a="en")=>{const{price:r,vat:i,quantity:o}=e||{},l=Ve(r,o,i);return{totalPrice:l,formattedTotalPrice:n(l,t,a)}},ut=()=>{const{cart:e}=at();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var mt={container:"Quantity-module_container__01ySb",quantityAction:"Quantity-module_quantityAction__wRV2F",quantityValue:"Quantity-module_quantityValue__BBpyw",isDisabled:"Quantity-module_isDisabled__crQCf",sm:"Quantity-module_sm__0Hgp2",md:"Quantity-module_md__hu7a8",lg:"Quantity-module_lg__GA4jn",flexWide:"Quantity-module_flexWide__R95Jw",slidein:"Quantity-module_slidein__5yeWf",fadeInOut:"Quantity-module_fadeInOut__cllco",heightAnimation:"Quantity-module_heightAnimation__dhOgA",fadein:"Quantity-module_fadein__Cof2o",floatAnimation:"Quantity-module_floatAnimation__DSqQr",bottomSheet:"Quantity-module_bottomSheet__5-5iY",slideRightToLeft:"Quantity-module_slideRightToLeft__cjDHk"};const _t=({isDecreaseDisabled:a=!1,quantity:r=1,size:i="md",onIncrease:n,onDecrease:l})=>t(g,{className:o(mt,{container:!0},[mt[i]]),justifyContent:"space-between",gap:0,children:[e("div",{className:o(mt,{quantityAction:!0,isDisabled:a}),onClick:l,children:e(y,{icon:F})}),e("div",{className:mt.quantityValue,children:r}),e("div",{className:mt.quantityAction,onClick:n,children:e(y,{icon:Y})})]});var ht="ProductInCart-module_container__oSrwq",gt="ProductInCart-module_title__Vnc4l";const vt=({productId:a,onModalClose:i})=>{const{setIsCartOpen:n,removeAllProductVariants:o}=at(),{t:l}=ct(),d=(e=>{const{cart:t}=at();return r(t)||!e?0:Object.values(t).filter((t=>t.productId===e)).reduce(((e,t)=>e+t.quantity),0)})(a);return d<=0?null:t(I,{className:ht,fullWidth:!0,justifyContent:"space-between",alignItems:"center",children:[t(I.Item,{flex:1,className:gt,children:[l("In order")," (",d,")"]}),e(I.Item,{flex:0,children:t(g,{children:[e(w,{icon:K,onClick:()=>{o(a)},type:N.DANGER,tooltip:l("Remove from order")}),e(w,{icon:X,onClick:()=>{n(!0),i&&i()},type:N.SUCCESS,tooltip:l("View order")})]})})]})},pt=({product:a,onClose:n})=>{const{language:l,currency:d}=ve(),{addProduct:_,updateProduct:h}=at(),[v,p]=c(1),[f,y]=c(!1),[I,b]=c(null),[C,A]=c(null),N=s(null),{t:k}=ct(),O=((e,t)=>{var a;const{cart:i}=at();return r(i)||!e?0:(null===(a=i[t?`${e}-${t}`:`${e}`])||void 0===a?void 0:a.quantity)||0})(null==a?void 0:a.id,I),{name:R,description:G}=m((()=>Ye(a,l)),[a,l]),{formattedTotalPrice:x}=m((()=>Fe(a,d,l)),[a,d,l]),{formattedTotalPrice:q}=m((()=>(({product:e,variantId:t,quantity:a=1,currency:r,language:i})=>t?Xe({variantId:t,currency:r,language:i,product:e,quantity:a}):Fe(e,r,i,a))({product:a,quantity:v,language:l,currency:d,variantId:I})),[a,v,l,d,I]),j=f?0===v:1===v,z=m((()=>k(f?0===v?"Remove from order":"Update order":"Add to order")),[f,v]);u((()=>{p(O>0?O:1),y(O>0)}),[O,a]),u((()=>{b(null)}),[a]);const W=e=>{-1===e&&j||p((t=>Math.max(0,t+e)))};if(r(a))return null;const{image1024:E,volume:Q,variants:H}=a;return e("div",{className:lt.container,onClick:e=>{var t,a;(null===(a=null===(t=null==N?void 0:N.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||n&&n()},children:e(S,{onClose:n,ref:N,noBodyPadding:!0,size:"small",content:t("div",{className:lt.content,children:[t(P,{gap:0,children:[E&&e(je,{src:le(E),width:1024,height:400,alt:R||"product",className:lt.image}),t(P,{className:lt.details,gap:1,children:[e("h2",{className:lt.name,children:R}),t(g,{justifyContent:"space-between",children:[e("div",{className:lt.price,children:x}),e("div",{className:lt.volume,children:Q})]}),e("div",{className:lt.description,children:G})]}),(null==H?void 0:H.length)>0&&t(P,{className:o(lt,{variants:!0,focused:"variant"===C}),gap:1,fullWidth:!0,children:[e("div",{className:lt.variantsTitle,children:k("Product choices")}),H.map((r=>{const{id:i}=r||{},{formattedTotalPrice:n}=Xe({variantId:i,language:l,currency:d,product:a}),{title:o}=Ze(r,l);return t(g,{justifyContent:"space-between",onClick:()=>b(i),className:lt.variant,children:[e(D,{label:o,name:"variant",onChange:()=>b(i),checked:I===i,type:L.RADIO}),e("div",{className:lt.variantPrice,children:n})]},i)}))]})]}),e("div",{className:lt.close,children:e(w,{onClick:n,icon:Z})})]}),footer:t(P,{children:[e(vt,{productId:null==a?void 0:a.id,onModalClose:n}),t(g,{className:lt.addToCart,gap:.5,children:[e(_t,{isDecreaseDisabled:j,onDecrease:()=>W(-1),onIncrease:()=>W(1),quantity:v}),e(T,{className:lt.addAction,label:t(g,{fullWidth:!0,justifyContent:"space-between",children:[e("span",{className:lt.actionTitle,children:z}),e("span",{children:q})]}),onClick:()=>{var e;if((null===(e=null==a?void 0:a.variants)||void 0===e?void 0:e.length)>0&&!I)return A("variant"),void setTimeout((()=>{A(null)}),200);f?h({product:a,quantity:v,variantId:I}):(_({product:a,quantity:v,variantId:I}),i(Pe,{name:R,quantity:v})),n&&n()},size:"xl",fullWidth:!0})]})]})})})};var ft="Cart-module_container__3KQtx",yt="Cart-module_content__rkiZa",It={container:"CartStepper-module_container__4CF1L",count:"CartStepper-module_count__E-RBg",actionText:"CartStepper-module_actionText__-rVKA",totalPrice:"CartStepper-module_totalPrice__QboRN",isClickable:"CartStepper-module_isClickable__mDptU",flexWide:"CartStepper-module_flexWide__eXxCr",slidein:"CartStepper-module_slidein__d5JQ-",fadeInOut:"CartStepper-module_fadeInOut__pS8nn",heightAnimation:"CartStepper-module_heightAnimation__7-e5Z",fadein:"CartStepper-module_fadein__-Ba0-",floatAnimation:"CartStepper-module_floatAnimation__rq6zX",bottomSheet:"CartStepper-module_bottomSheet__1wHHD",slideRightToLeft:"CartStepper-module_slideRightToLeft__0KLAo"};const Pt=({actionText:a,onClick:r})=>{const i=ut(),{formattedTotalPrice:l}=(()=>{const{cart:e}=at(),{currency:t,language:a}=ve(),r=Object.values(e||{}).reduce(((e,t)=>{const{totalPrice:a}=st(t);return e+a}),0);return{totalPrice:r,formattedTotalPrice:n(r,t,a)}})();return t(I,{className:o(It,{container:!0,isClickable:!!r}),justifyContent:"space-between",alignItems:"center",onClick:r,children:[e(I.Item,{flex:1,children:t(g,{alignItems:"center",children:[e("div",{className:It.count,children:i}),e("div",{className:It.actionText,children:a})]})}),e(I.Item,{className:It.totalPrice,flex:1,children:l})]})},bt=()=>{const{setIsCartOpen:t}=at(),{t:a}=ct();return ut()<=0?null:e("div",{className:ft,children:e("div",{className:yt,children:e(Pt,{onClick:()=>t(!0),actionText:a("View order")})})})};var Ct={container:"CartDrawer-module_container__zvapw",content:"CartDrawer-module_content__ELSiG",flexWide:"CartDrawer-module_flexWide__ySgY-",slidein:"CartDrawer-module_slidein__XC9AW",fadeInOut:"CartDrawer-module_fadeInOut__w9h6X",heightAnimation:"CartDrawer-module_heightAnimation__tBgkj",fadein:"CartDrawer-module_fadein__QNPoQ",floatAnimation:"CartDrawer-module_floatAnimation__nZWoY",bottomSheet:"CartDrawer-module_bottomSheet__m0wy7",slideRightToLeft:"CartDrawer-module_slideRightToLeft__gpixh"},At="CartItem-module_container__At7lj",Nt="CartItem-module_image__D-zzG",kt="CartItem-module_data__Lo3Fb",wt="CartItem-module_name__EksZu",St="CartItem-module_price__yJxl6";const Dt=e=>{var t;const{products:a}=ve();return(null===(t=null==a?void 0:a.find)||void 0===t?void 0:t.call(a,(({id:t})=>t===e)))||{}},Lt=({productId:t,variantId:a,min:r=1,size:i="md"})=>{const n=((e,t)=>{const{cart:a}=at(),r=a[t?`${e}-${t}`:`${e}`];return(null==r?void 0:r.quantity)||1})(t,a),o=Dt(t),{updateProduct:l}=at();return e(_t,{isDecreaseDisabled:n===r,onDecrease:()=>l({product:o,quantity:n-1,variantId:a}),onIncrease:()=>l({product:o,quantity:n+1,variantId:a}),quantity:n,size:i})},Tt=({item:a})=>{const{productId:r,variantId:i}=a||{},n=Dt(r),o=Ke(n,i),{language:l,currency:d}=ve(),{image160:c}=n,{title:s}=Ze(o,l),{name:u}=m((()=>Ye(n,l)),[n,l]),{formattedTotalPrice:_}=m((()=>st(a,d,l)),[a,d,l]);return t(g,{className:At,gap:1,alignItems:"center",children:[c&&e(je,{src:le(c),alt:u||"menu",className:Nt,loading:"lazy",width:80,height:45}),t("div",{className:kt,children:[e("div",{className:wt,children:u}),!!s&&e(k,{color:"muted",variant:"small",children:s}),e("div",{className:St,children:_})]}),e(Lt,{productId:r,variantId:i,size:"sm",min:0})]})},Ot=()=>{const{isCartOpen:a,cart:i,setIsCartOpen:n}=at(),o=s(null),{t:l}=ct(),d=r(i),c=()=>n(!1);return a?e("div",{className:Ct.container,onClick:e=>{var t,a;(null===(a=null===(t=null==o?void 0:o.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||c()},children:e(O,{ref:o,onClose:c,isOpen:a,title:l("Your order"),content:e("div",{className:Ct.content,children:d?e((()=>t(P,{className:Ct.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e(k,{variant:"h2",children:l("Empty order")}),e(R,{text:l("You don't have any items in your order")})]})),{}):e("div",{className:Ct.items,children:Object.keys(i||{}).map((t=>e(Tt,{item:i[t]},t)))})}),footer:d?e(T,{label:l("Add items"),onClick:c,type:N.PRIMARY,size:"xl",fullWidth:!0}):e(Pt,{actionText:l("Subtotal")})})}):null},Rt=_((({categoryProductMap:a=[],currency:r,language:n,productBlocksRef:o,containerRef:l,onCategoryInView:d})=>{const[s,m]=c(null),[_,h]=c(Je.LIST),v=[{icon:J,type:Je.LIST},{icon:ee,type:Je.GRID}],p=e=>{const{name:t}=Ye(e,n);i(Ie,{name:t}),m(e)};return u((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let r=null,i=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,n=t.top+t.height/2,o=Math.abs(n-a);o<i&&(i=o,r=e.target.getAttribute("data-category-id"))}})),r&&d(Number(r))}),{threshold:.1});return Object.entries(o.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[o,l]),e(tt,{children:t("div",{className:He,children:[e(g,{className:Be,alignItems:"center",children:v.map((({icon:t,type:a})=>e(w,{icon:t,onClick:()=>(e=>{h(e),i(be,{name:e})})(a),type:a===_?N.PRIMARY:N.DEFAULT},a)))}),e(P,{children:(a||[]).map((a=>{const{name:i}=Ae(a,n),{id:l,products:d}=a;return t("div",{className:$e,ref:e=>{e&&(o.current[l]=e)},"data-category-id":l,children:[e("h2",{className:Me,children:i}),e("div",{className:Ue,children:e(P,{gap:0,children:(d||[]).map((t=>_===Je.GRID?e(ot,{product:t,currency:r,language:n,onClick:()=>p(t)},t.id):e(it,{product:t,currency:r,language:n,onClick:()=>p(t)},t.id)))})})]},l)}))}),e(pt,{product:s,onClose:()=>m(null)}),e(bt,{}),e(Ot,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));Rt.displayName="Products";var Gt="Branches-module_branches__sOuoV",xt="Branches-module_list__vYoT2",qt="Branches-module_name__K0Z-4";const jt=({branches:t=[],rootPath:a="",onBranchSelect:r})=>{const i=({children:t,id:i})=>r?e("div",{onClick:()=>r(i),children:t}):e("a",{href:`${a}/${i}`,children:t});return e("div",{className:Gt,children:e(G,{className:xt,children:t.map((({id:t,name:a})=>e(i,{id:t,children:e(x,{noBottomMargin:!0,children:e(I,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e("h2",{className:qt,children:a})})})},t)))})})},zt=({data:n})=>{var o;const{name:l,coverImage:d,logoImage:u,branches:m=[],branchId:_,language:h,categories:g,products:v,currency:p,instagram:f,facebook:y,whatsapp:I,telegram:P,tiktok:b,rootPath:C,hostname:A,onBranchSelect:N}=n||{},k=m.length<=1,w=((e,t)=>{const a=t.reduce(((e,t)=>{const a=Number(t.categoryId);return e[a]||(e[a]=[]),e[a].push(t),e}),{});return e.map((e=>Object.assign(Object.assign({},e),{products:a[Number(e.id)]||[]}))).filter((e=>{var t;return(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t.length)>0}))})(g,v),S=(()=>{var e;return k?(null===(e=null==m?void 0:m[0])||void 0===e?void 0:e.id)?m[0]:{}:m.find((e=>e.id===Number(_)))})(),D=k||!(null==S?void 0:S.name)?l:(null==S?void 0:S.name)||"",[L,T]=c(null===(o=null==g?void 0:g[0])||void 0===o?void 0:o.id),O=s({}),R=s(null),G=s(!0),{url:x,domain:q}=((e,t)=>{const a=_e.includes(e)?e:me;return{url:`https://${a}/${t||"en"}`,domain:a}})(A,h);return t("div",{className:re,ref:R,children:[e(Ee,{branch:S,name:D,coverImage:ce(d),logoImage:de(u),instagram:f,facebook:y,whatsapp:I,telegram:P,tiktok:b}),k||_?t(a,{children:[e(Qe,{categoryProductMap:w,language:h,selectedCategoryId:L,onSelectCategory:e=>ae(void 0,void 0,void 0,(function*(){G.current=!1,T(e),(e=>{var t;const a=null===(t=null==O?void 0:O.current)||void 0===t?void 0:t[e];a&&(setTimeout((()=>{a.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{G.current=!0}),1e3))})(e)}))}),e(Rt,{currency:p,language:h,productBlocksRef:O,containerRef:R,categoryProductMap:w,onCategoryInView:e=>{if(!(null==G?void 0:G.current))return;const t=((e,t,a)=>{var i;const n=null===(i=null==t?void 0:t.find)||void 0===i?void 0:i.call(t,(({id:t})=>t===e));if(r(n))return"";const{name:o}=Ae(n,a);return o})(e,g,h);i(ye,{name:t}),T(e)}})]}):e(jt,{branches:m,onBranchSelect:N,rootPath:C}),!!A&&e("a",{rel:"noopener noreferrer",target:"_blank",href:x,className:ne,children:q})]})},Wt=({data:t})=>e(ge,{value:t,children:e(zt,{data:t})});var Et={};const Qt=({currentGoal:t,language:a,setGoal:r})=>{const{t:i}=ct(a),n=s({}),o=e=>{switch(e){case ye:return i("Scrolled to Category");case fe:return i("Category Selected");case Ie:return i("Product Details");case Pe:return i("Product Added to Cart");default:return""}},l=h((e=>{var t,a;r(e),null===(a=null===(t=null==n?void 0:n.current)||void 0===t?void 0:t.close)||void 0===a||a.call(t)}),[r]);return e(q,{action:o(t),actionSize:"large",type:N.BORDERED_PRIMARY,closeRef:n,menu:e("div",{className:Et.toolbarMenu,children:Ce.map((t=>e(j,{onClick:()=>l(t),children:o(t)},t)))})})},Ht=({data:t,isLoading:a=!1,loadingImage:r,language:i,goal:n,setGoal:o})=>{const{t:l}=ct(i);return e(x,{title:l("Events"),toolbar:e(Qt,{language:i,currentGoal:n,setGoal:o}),children:a?e(z,{image:r}):e(W,{data:t})})};export{Ht as Events,Wt as PublicMenu};
1
+ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{isEmpty as r,trackEvent as i,priceFormatter as n,classNames as o}from"@sorocraft/js-utils";import{createContext as l,useContext as d,useState as c,useRef as s,useEffect as u,useMemo as m,memo as _,useCallback as h}from"react";import{Row as g,classNames as v,IconLink as p,Tooltip as f,SVGIcon as y,Flex as I,Column as P,Carousel as b,CarouselItem as C,Chip as A,UIElementType as N,Text as k,IconButton as w,Modal as S,Input as D,InputType as L,Button as T,Drawer as O,Description as R,Container as G,Card as x,DropDown as q,DropDownMenuItem as j,Loading as W,BarChart as z}from"@sorocraft/ui";import{Phone as E,Whatsapp as Q,Instagram as H,Telegram as B,Tiktok as $,Facebook as M,Wifi as U,MarkerPin as V,Plus as Y,Minus as F,Trash as K,ShoppingBag as X,Close as Z,List as J,Grid as ee}from"@sorocraft/ui/icons";function te(e,t){var a={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(a[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(a[r[i]]=e[r[i]])}return a}function ae(e,t,a,r){return new(a||(a=Promise))((function(i,n){function o(e){try{d(r.next(e))}catch(e){n(e)}}function l(e){try{d(r.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,l)}d((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var re="PublicMenu-module_container__QLN6U",ie="PublicMenu-module_categories__Iy6NC",ne="PublicMenu-module_footer__6G3DQ";const oe="https://images.restaround.co",le=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${oe}/${e}`:"",de=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${oe}/${e}`:"https://images.restaround.co/no-photo-128.webp",ce=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${oe}/${e}`:"https://images.restaround.co/restaround-doodle.webp",se="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",ue=(e,t,a)=>se.charAt(e>>2)+se.charAt((3&e)<<4|t>>4)+se.charAt((15&t)<<2|a>>6)+se.charAt(63&a),me="restaround.co",_e=[me,"restaround.az","restaround.ee","restaround.nl"],he=l({}),ge=({children:t,value:a})=>{const i=r(a)?{}:a;return i.currency||(i.currency="AZN"),i.language||(i.language="az"),e(he.Provider,{value:r(a)?{}:a,children:t})},ve=()=>d(he),pe="digital_menu",fe=`${pe}_category_select`,ye=`${pe}_category_scroll`,Ie=`${pe}_product_details`,Pe=`${pe}_product_add_cart`,be=`${pe}_product_view_changed`,Ce=[fe,ye,Ie,Pe],Ae=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var Ne="Header-module_container__tenlF",ke="Header-module_cover__BAWZK",we="Header-module_content__Gx4Al",Se="Header-module_logo__4MTCm",De="Header-module_info__IchYA",Le="Header-module_name__30wyw",Te="Header-module_address__WOxXc",Oe="Header-module_addressText__lUszI",Re="Header-module_social__AoP0z",Ge="Header-module_links__EeQxg",xe="Header-module_wifiPassword__VWBTa",qe="Header-module_wifiPasswordIcon__Ukn3D";const je=t=>{const a=te(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:r}=ve()||{};if(r){return e(r,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(i=235,n=59,o=90,`data:image/gif;base64,R0lGODlhAQABAPAA${ue(0,i,n)+ue(o,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var i,n,o;return e("img",Object.assign({},a))};var We={container:"Languages-module_container__nJeK1",currentLanguage:"Languages-module_currentLanguage__EFw6Q",options:"Languages-module_options__6jLRm",option:"Languages-module_option__QkVQd",isOpen:"Languages-module_isOpen__eUGbg",flexWide:"Languages-module_flexWide__zQ9jN",slidein:"Languages-module_slidein__C4UHU",fadeInOut:"Languages-module_fadeInOut__U-vhH",heightAnimation:"Languages-module_heightAnimation__gIQkF",fadein:"Languages-module_fadein__vPmsX",floatAnimation:"Languages-module_floatAnimation__L-kPH",bottomSheet:"Languages-module_bottomSheet__-t-q8",slideRightToLeft:"Languages-module_slideRightToLeft__y0l-f"};const ze=()=>{var a;const{language:r,languages:i,onLanguageSelect:n}=ve(),[o,l]=c(!1),d=(null==i?void 0:i.length)>1,s=(null===(a=null==i?void 0:i.filter)||void 0===a?void 0:a.call(i,(({code:e})=>e!==r)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e("div",{className:We.container,onClick:()=>l(!o),children:t(g,{alignItems:"center",gap:0,children:[e(g,{alignItems:"center",className:v(We,{options:!0,isOpen:o}),children:s.map((({code:t})=>e("img",{src:u(t),className:We.option,onClick:()=>(e=>{n&&n(e)})(t),alt:t},t)))}),e("img",{src:u(r),alt:r||"",className:We.currentLanguage})]})}):null},Ee=({branch:a,coverImage:i,logoImage:n,name:o,instagram:l,facebook:d,whatsapp:c,telegram:s,tiktok:u})=>{const{address:m,latitude:_,longitude:h,phone:v,wifiPassword:b}=a||{},C=r(a),A=`https://www.google.com/maps/place/${_},${h}`;return t("div",{className:Ne,children:[e(je,{src:i,alt:o,className:ke,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e("div",{className:we,children:e(C?()=>t(P,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e(je,{src:n,alt:o,className:Se,width:96,height:96}),e("div",{className:De,children:e("h1",{className:Le,children:o})})]}):()=>t(I,{direction:"row",gap:1,alignItems:"center",fullWidth:!0,children:[e(I.Item,{children:e(je,{src:n,alt:o,className:Se,width:96,height:96})}),e(I.Item,{shrink:!0,className:De,children:t(P,{gap:.25,children:[e("h1",{className:Le,children:o}),e("a",{className:Te,href:A,target:"_blank",rel:"noopener noreferrer",children:t(g,{alignItems:"center",gap:.5,children:[e(y,{icon:V,theme:"dark"}),e("span",{className:Oe,children:m})]})})]})})]}),{})}),e(ze,{}),!C&&e("div",{className:Re,children:e("div",{className:Ge,children:e(g,{gap:2,alignItems:"center",children:t(g,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!v&&e(p,{icon:E,href:`tel:+${v}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e(p,{icon:Q,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!l&&e(p,{icon:H,href:l,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!s&&e(p,{icon:B,href:s,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e(p,{icon:$,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e(p,{icon:M,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!b&&e(f,{hint:b,children:e("div",{className:xe,children:e(y,{icon:U,size:"sm",className:qe})})})]})})})})]})},Qe=({categoryProductMap:t=[],language:a,selectedCategoryId:r,onSelectCategory:n})=>{const o=s({}),l=s(null);return u((()=>{r&&(()=>{var e;const t=null===(e=null==o?void 0:o.current)||void 0===e?void 0:e[r];if(!t||!l.current)return;const a=l.current.clientWidth,i=t.offsetLeft-a/2+t.offsetWidth/2;l.current.scrollTo({left:i,behavior:"smooth"})})()}),[r]),e("div",{className:ie,children:e(b,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(l.current=e.current)},children:(t||[]).map((({id:t,translations:l})=>{const{name:d}=l.find((e=>e.language===a))||{};return e(C,{children:e(A,{onClick:()=>((e,t)=>{e!==r&&(i(fe,{name:t}),n(e))})(t,d),type:N.BORDERED_PRIMARY,active:t===r,children:e("div",{ref:e=>{e&&(o.current[t]=e)},children:d})})},t)}))})})};var He="Products-module_container__bF2LF",Be="Products-module_view__l857X",$e="Products-module_products__AoDrY",Me="Products-module_category__Sp7dE",Ue="Products-module_list__LH4v5";const Ve=(e,t,a=0)=>e*t*(1+a/100),Ye=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}},Fe=(e,t,a,r=1)=>{const{price:i,vat:o}=e||{},l=Ve(i,r,o);return{totalPrice:l,formattedTotalPrice:n(l,t,a)}},Ke=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.variants)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.id===t)))||{}},Xe=({variantId:e,currency:t="USD",language:a="en",product:r,quantity:i=1})=>{const o=Ke(r,e),{vat:l}=r||{},{price:d}=o||{},c=Ve(d,i,l);return{totalPrice:c,formattedTotalPrice:n(c,t,a)}},Ze=(e,t)=>{var a,r;return(null===(r=null===(a=null==e?void 0:e.translations)||void 0===a?void 0:a.find)||void 0===r?void 0:r.call(a,(e=>e.language===t)))||{}};var Je;!function(e){e.LIST="list",e.GRID="grid"}(Je||(Je={}));const et=l({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{},removeAllProductVariants:()=>{}}),tt=({children:t})=>{const[a,i]=c({}),[n,o]=c(!1),l=({product:e,quantity:t,isAddOperation:a,variantId:n})=>{var o;if(r(e)||t<0)return;const{id:l,price:d,vat:c=0}=e,s=n?`${l}-${n}`:`${l}`,u=n?null===(o=Ke(e,n))||void 0===o?void 0:o.price:d;i((e=>{const r=e[s],i=a?((null==r?void 0:r.quantity)||0)+t:t;if(i<=0){const t=e,a=s;t[a];return te(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[s]:{productId:l,price:u,quantity:i,vat:c,variantId:n}})}))},d=({product:e,quantity:t=1,variantId:a})=>l({product:e,quantity:t,variantId:a,isAddOperation:!0}),s=({product:e,quantity:t=1,variantId:a})=>l({product:e,quantity:t,variantId:a,isAddOperation:!1}),u=e=>{if(!e||r(a))return;const t=Object.entries(a).reduce(((t,[a,r])=>(r.productId!==e&&(t[a]=r),t)),{});i(t)},_=m((()=>({cart:a,isCartOpen:n,addProduct:d,updateProduct:s,setIsCartOpen:o,removeAllProductVariants:u})),[a,n]);return e(et.Provider,{value:_,children:t})},at=()=>d(et);var rt={container:"ProductsListItem-module_container__i9tFs",isClickable:"ProductsListItem-module_isClickable__iHHdI",data:"ProductsListItem-module_data__Mb3SF",name:"ProductsListItem-module_name__T1gyJ",description:"ProductsListItem-module_description__oL4CH",price:"ProductsListItem-module_price__V1GRM",image:"ProductsListItem-module_image__h6Wbi",addToCart:"ProductsListItem-module_addToCart__WXrQZ",flexWide:"ProductsListItem-module_flexWide__Ds6LE",slidein:"ProductsListItem-module_slidein__rEzMI",fadeInOut:"ProductsListItem-module_fadeInOut__i1FNq",heightAnimation:"ProductsListItem-module_heightAnimation__2fk7l",fadein:"ProductsListItem-module_fadein__tPTJ6",floatAnimation:"ProductsListItem-module_floatAnimation__vugAV",bottomSheet:"ProductsListItem-module_bottomSheet__-YAdd",slideRightToLeft:"ProductsListItem-module_slideRightToLeft__oXk26"};const it=({product:a,currency:r,language:n,onClick:l})=>{var d;const{addProduct:c}=at(),{image160:s,volume:u}=a||{},{name:_,description:h}=m((()=>Ye(a,n)),[a,n]),{formattedTotalPrice:v}=m((()=>Fe(a,r,n)),[a,r,n]),p=(null===(d=null==a?void 0:a.variants)||void 0===d?void 0:d.length)>0;return t("div",{className:o(rt,{container:!0,isClickable:!!l}),onClick:l,children:[t(g,{justifyContent:"space-between",gap:0,children:[e("div",{className:rt.data,children:t(P,{gap:.25,children:[e("h3",{className:rt.name,children:_}),e("p",{className:rt.description,children:h}),t(g,{className:rt.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e("span",{children:v}),!!u&&e(k,{color:"muted",children:u})]})]})}),s&&e(je,{src:le(s),alt:_||"menu",className:rt.image,loading:"lazy",width:160,height:90})]}),e("div",{className:rt.addToCart,children:e(w,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),p&&l)return l();c({product:a}),i(Pe,{name:_,quantity:1})},icon:Y,type:N.DEFAULT})})]})};var nt={container:"ProductsGridItem-module_container__DU5KG",content:"ProductsGridItem-module_content__FXs0Y",isClickable:"ProductsGridItem-module_isClickable__8zhwt",info:"ProductsGridItem-module_info__HkBG-",data:"ProductsGridItem-module_data__Z-N1X",name:"ProductsGridItem-module_name__ZrIx3",description:"ProductsGridItem-module_description__-FQPA",price:"ProductsGridItem-module_price__BFu2H",imageContainer:"ProductsGridItem-module_imageContainer__eHS4Z",image:"ProductsGridItem-module_image__alZWL",addToCart:"ProductsGridItem-module_addToCart__gYVrI",noImage:"ProductsGridItem-module_noImage__78UHW",volume:"ProductsGridItem-module_volume__oxEAr",flexWide:"ProductsGridItem-module_flexWide__qcB5X",slidein:"ProductsGridItem-module_slidein__oKaVb",fadeInOut:"ProductsGridItem-module_fadeInOut__d2zot",heightAnimation:"ProductsGridItem-module_heightAnimation__zgbh9",fadein:"ProductsGridItem-module_fadein__Z067K",floatAnimation:"ProductsGridItem-module_floatAnimation__GXjP-",bottomSheet:"ProductsGridItem-module_bottomSheet__-zrFD",slideRightToLeft:"ProductsGridItem-module_slideRightToLeft__R7hv5"};const ot=({product:a,currency:r,language:n,onClick:l})=>{var d;const{addProduct:c}=at(),{volume:s,image580:u,image160:_,image1024:h}=a||{},v=u||h||_,{name:p,description:f}=m((()=>Ye(a,n)),[a,n]),{formattedTotalPrice:y}=m((()=>Fe(a,r,n)),[a,r,n]),I=(null===(d=null==a?void 0:a.variants)||void 0===d?void 0:d.length)>0;return e("div",{className:nt.container,children:t("div",{className:o(nt,{content:!0,isClickable:!!l,noImage:!v}),onClick:l,children:[v&&e("div",{className:nt.imageContainer,children:e(je,{src:le(v),alt:p||"menu",className:nt.image,loading:"lazy",width:580,height:326})}),e("div",{className:nt.info,children:e("div",{className:nt.data,children:t(P,{gap:.25,children:[e("h3",{className:nt.name,children:p}),e("p",{className:nt.description,children:f}),t(g,{className:nt.price,gap:.5,fullWidth:!0,justifyContent:"space-between",children:[e("span",{children:y}),!!s&&e(k,{color:"white",className:nt.volume,children:s})]})]})})}),e("div",{className:nt.addToCart,children:e(w,{onClick:e=>{if(e.preventDefault(),e.stopPropagation(),I&&l)return l();c({product:a}),i(Pe,{name:p,quantity:1})},icon:Y,type:N.DEFAULT})})]})})};var lt={container:"ProductDetails-module_container__oa07j",content:"ProductDetails-module_content__Db3NC",image:"ProductDetails-module_image__BlMfl",details:"ProductDetails-module_details__zfnlt",name:"ProductDetails-module_name__ganLM",price:"ProductDetails-module_price__W34k9",volume:"ProductDetails-module_volume__RWG5s",description:"ProductDetails-module_description__HBufi",variants:"ProductDetails-module_variants__zOWjJ",focused:"ProductDetails-module_focused__Nsffd",variantsTitle:"ProductDetails-module_variantsTitle__ta-cw",variant:"ProductDetails-module_variant__vQ5yD",close:"ProductDetails-module_close__4cHZ3",addAction:"ProductDetails-module_addAction__o4T5R",actionTitle:"ProductDetails-module_actionTitle__NIJGW",flexWide:"ProductDetails-module_flexWide__w06FX",slidein:"ProductDetails-module_slidein__N8f4g",fadeInOut:"ProductDetails-module_fadeInOut__hYRtK",heightAnimation:"ProductDetails-module_heightAnimation__hLQyz",fadein:"ProductDetails-module_fadein__QN4mI",floatAnimation:"ProductDetails-module_floatAnimation__dTQbc",bottomSheet:"ProductDetails-module_bottomSheet__HO2S-",slideRightToLeft:"ProductDetails-module_slideRightToLeft__hbtJg"};const dt={en:{},az:{"View order":"Şifarişi göstər","Remove from order":"Sifarişdən sil","Update order":"Sifarişi yenilə","Add to order":"Sifarişə əlavə et","Your order":"Sifarişiniz",Subtotal:"Ümumi","Empty order":"Boş sifariş","You don't have any items in your order":"Sifarişinizdə heç bir məhsul yoxdur","Add items":"Məhsul əlavə et",Events:"Hərəkətlər","Scrolled to Category":"Kateqoriyaya sürüşdürdü","Category Selected":"Kateqoriya seçildi","Product Details":"Məhsul detalına baxıldı","Product Added to Cart":"Səbətə əlavə edildi","Product choices":"Seçimlər","In order":"Sifarişdə"},tr:{"View order":"Siparişi Görüntüle","Remove from order":"Siparişten Kaldır","Update order":"Siparişi Güncelle","Add to order":"Siparişe Ekle","Your order":"Siparişiniz","Empty order":"Boş sipariş","You don't have any items in your order":"Siparişinizde hiç bir ürün yok","Add items":"Ürün ekle",Subtotal:"Toplam",Events:"Olaylar","Product choices":"Seçenekler","In order":"Siparişte"},nl:{"View order":"Bestelling bekijken","Remove from order":"Uit bestelling verwijderen","Update order":"Bestelling bijwerken","Add to order":"Aan bestelling toevoegen","Your order":"Uw bestelling","Empty order":"Lege bestelling","You don't have any items in your order":"U heeft geen items in uw bestelling","Add items":"Items toevoegen",Subtotal:"Totaal",Events:"Gebeurtenissen","Product choices":"Productkeuzes","In order":"In bestelling"},et:{"View order":"Vaata tellimust","Remove from order":"Eemalda tellimusest","Update order":"Uuenda tellimust","Add to order":"Lisa tellimusele","Your order":"Teie tellimus","Empty order":"Tühi tellimus","You don't have any items in your order":"Teie tellimuses pole ühtegi eset","Add items":"Lisa esemeid",Subtotal:"Kokku",Events:"Sündmused","Product choices":"Tootevalikud","In order":"Tellimuses"},ru:{"View order":"Посмотреть заказ","Remove from order":"Удалить из заказа","Update order":"Обновить заказ","Add to order":"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого",Events:"События","Product choices":"Варианты товара","In order":"В заказе"}},ct=e=>{const{language:t}=ve(),a=e||t;return{t:e=>{var t;return(null===(t=dt[a])||void 0===t?void 0:t[e])||e}}},st=(e,t="USD",a="en")=>{const{price:r,vat:i,quantity:o}=e||{},l=Ve(r,o,i);return{totalPrice:l,formattedTotalPrice:n(l,t,a)}},ut=()=>{const{cart:e}=at();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var mt={container:"Quantity-module_container__01ySb",quantityAction:"Quantity-module_quantityAction__wRV2F",quantityValue:"Quantity-module_quantityValue__BBpyw",isDisabled:"Quantity-module_isDisabled__crQCf",sm:"Quantity-module_sm__0Hgp2",md:"Quantity-module_md__hu7a8",lg:"Quantity-module_lg__GA4jn",flexWide:"Quantity-module_flexWide__R95Jw",slidein:"Quantity-module_slidein__5yeWf",fadeInOut:"Quantity-module_fadeInOut__cllco",heightAnimation:"Quantity-module_heightAnimation__dhOgA",fadein:"Quantity-module_fadein__Cof2o",floatAnimation:"Quantity-module_floatAnimation__DSqQr",bottomSheet:"Quantity-module_bottomSheet__5-5iY",slideRightToLeft:"Quantity-module_slideRightToLeft__cjDHk"};const _t=({isDecreaseDisabled:a=!1,quantity:r=1,size:i="md",onIncrease:n,onDecrease:l})=>t(g,{className:o(mt,{container:!0},[mt[i]]),justifyContent:"space-between",gap:0,children:[e("div",{className:o(mt,{quantityAction:!0,isDisabled:a}),onClick:l,children:e(y,{icon:F})}),e("div",{className:mt.quantityValue,children:r}),e("div",{className:mt.quantityAction,onClick:n,children:e(y,{icon:Y})})]});var ht="ProductInCart-module_container__oSrwq",gt="ProductInCart-module_title__Vnc4l";const vt=({productId:a,onModalClose:i})=>{const{setIsCartOpen:n,removeAllProductVariants:o}=at(),{t:l}=ct(),d=(e=>{const{cart:t}=at();return r(t)||!e?0:Object.values(t).filter((t=>t.productId===e)).reduce(((e,t)=>e+t.quantity),0)})(a);return d<=0?null:t(I,{className:ht,fullWidth:!0,justifyContent:"space-between",alignItems:"center",children:[t(I.Item,{flex:1,className:gt,children:[l("In order")," (",d,")"]}),e(I.Item,{flex:0,children:t(g,{children:[e(w,{icon:K,onClick:()=>{o(a)},type:N.DANGER,tooltip:l("Remove from order")}),e(w,{icon:X,onClick:()=>{n(!0),i&&i()},type:N.SUCCESS,tooltip:l("View order")})]})})]})},pt=({product:a,onClose:n})=>{const{language:l,currency:d}=ve(),{addProduct:_,updateProduct:h}=at(),[v,p]=c(1),[f,y]=c(!1),[I,b]=c(null),[C,A]=c(null),N=s(null),{t:k}=ct(),O=((e,t)=>{var a;const{cart:i}=at();return r(i)||!e?0:(null===(a=i[t?`${e}-${t}`:`${e}`])||void 0===a?void 0:a.quantity)||0})(null==a?void 0:a.id,I),{name:R,description:G}=m((()=>Ye(a,l)),[a,l]),{formattedTotalPrice:x}=m((()=>Fe(a,d,l)),[a,d,l]),{formattedTotalPrice:q}=m((()=>(({product:e,variantId:t,quantity:a=1,currency:r,language:i})=>t?Xe({variantId:t,currency:r,language:i,product:e,quantity:a}):Fe(e,r,i,a))({product:a,quantity:v,language:l,currency:d,variantId:I})),[a,v,l,d,I]),j=f?0===v:1===v,W=m((()=>k(f?0===v?"Remove from order":"Update order":"Add to order")),[f,v]);u((()=>{p(O>0?O:1),y(O>0)}),[O,a]),u((()=>{b(null)}),[a]);const z=e=>{-1===e&&j||p((t=>Math.max(0,t+e)))};if(r(a))return null;const{image1024:E,volume:Q,variants:H}=a;return e("div",{className:lt.container,onClick:e=>{var t,a;(null===(a=null===(t=null==N?void 0:N.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||n&&n()},children:e(S,{onClose:n,ref:N,noBodyPadding:!0,size:"small",content:t("div",{className:lt.content,children:[t(P,{gap:0,children:[E&&e(je,{src:le(E),width:1024,height:400,alt:R||"product",className:lt.image}),t(P,{className:lt.details,gap:1,children:[e("h2",{className:lt.name,children:R}),t(g,{justifyContent:"space-between",children:[e("div",{className:lt.price,children:x}),e("div",{className:lt.volume,children:Q})]}),e("div",{className:lt.description,children:G})]}),(null==H?void 0:H.length)>0&&t(P,{className:o(lt,{variants:!0,focused:"variant"===C}),gap:1,fullWidth:!0,children:[e("div",{className:lt.variantsTitle,children:k("Product choices")}),H.map((r=>{const{id:i}=r||{},{formattedTotalPrice:n}=Xe({variantId:i,language:l,currency:d,product:a}),{title:o}=Ze(r,l);return t(g,{justifyContent:"space-between",onClick:()=>b(i),className:lt.variant,children:[e(D,{label:o,name:"variant",onChange:()=>b(i),checked:I===i,type:L.RADIO}),e("div",{className:lt.variantPrice,children:n})]},i)}))]})]}),e("div",{className:lt.close,children:e(w,{onClick:n,icon:Z})})]}),footer:t(P,{children:[e(vt,{productId:null==a?void 0:a.id,onModalClose:n}),t(g,{className:lt.addToCart,gap:.5,children:[e(_t,{isDecreaseDisabled:j,onDecrease:()=>z(-1),onIncrease:()=>z(1),quantity:v}),e(T,{className:lt.addAction,label:t(g,{fullWidth:!0,justifyContent:"space-between",children:[e("span",{className:lt.actionTitle,children:W}),e("span",{children:q})]}),onClick:()=>{var e;if((null===(e=null==a?void 0:a.variants)||void 0===e?void 0:e.length)>0&&!I)return A("variant"),void setTimeout((()=>{A(null)}),200);f?h({product:a,quantity:v,variantId:I}):(_({product:a,quantity:v,variantId:I}),i(Pe,{name:R,quantity:v})),n&&n()},size:"xl",fullWidth:!0})]})]})})})};var ft="Cart-module_container__3KQtx",yt="Cart-module_content__rkiZa",It={container:"CartStepper-module_container__4CF1L",count:"CartStepper-module_count__E-RBg",actionText:"CartStepper-module_actionText__-rVKA",totalPrice:"CartStepper-module_totalPrice__QboRN",isClickable:"CartStepper-module_isClickable__mDptU",flexWide:"CartStepper-module_flexWide__eXxCr",slidein:"CartStepper-module_slidein__d5JQ-",fadeInOut:"CartStepper-module_fadeInOut__pS8nn",heightAnimation:"CartStepper-module_heightAnimation__7-e5Z",fadein:"CartStepper-module_fadein__-Ba0-",floatAnimation:"CartStepper-module_floatAnimation__rq6zX",bottomSheet:"CartStepper-module_bottomSheet__1wHHD",slideRightToLeft:"CartStepper-module_slideRightToLeft__0KLAo"};const Pt=({actionText:a,onClick:r})=>{const i=ut(),{formattedTotalPrice:l}=(()=>{const{cart:e}=at(),{currency:t,language:a}=ve(),r=Object.values(e||{}).reduce(((e,t)=>{const{totalPrice:a}=st(t);return e+a}),0);return{totalPrice:r,formattedTotalPrice:n(r,t,a)}})();return t(I,{className:o(It,{container:!0,isClickable:!!r}),justifyContent:"space-between",alignItems:"center",onClick:r,children:[e(I.Item,{flex:1,children:t(g,{alignItems:"center",children:[e("div",{className:It.count,children:i}),e("div",{className:It.actionText,children:a})]})}),e(I.Item,{className:It.totalPrice,flex:1,children:l})]})},bt=()=>{const{setIsCartOpen:t}=at(),{t:a}=ct();return ut()<=0?null:e("div",{className:ft,children:e("div",{className:yt,children:e(Pt,{onClick:()=>t(!0),actionText:a("View order")})})})};var Ct={container:"CartDrawer-module_container__zvapw",content:"CartDrawer-module_content__ELSiG",flexWide:"CartDrawer-module_flexWide__ySgY-",slidein:"CartDrawer-module_slidein__XC9AW",fadeInOut:"CartDrawer-module_fadeInOut__w9h6X",heightAnimation:"CartDrawer-module_heightAnimation__tBgkj",fadein:"CartDrawer-module_fadein__QNPoQ",floatAnimation:"CartDrawer-module_floatAnimation__nZWoY",bottomSheet:"CartDrawer-module_bottomSheet__m0wy7",slideRightToLeft:"CartDrawer-module_slideRightToLeft__gpixh"},At="CartItem-module_container__At7lj",Nt="CartItem-module_image__D-zzG",kt="CartItem-module_data__Lo3Fb",wt="CartItem-module_name__EksZu",St="CartItem-module_price__yJxl6";const Dt=e=>{var t;const{products:a}=ve();return(null===(t=null==a?void 0:a.find)||void 0===t?void 0:t.call(a,(({id:t})=>t===e)))||{}},Lt=({productId:t,variantId:a,min:r=1,size:i="md"})=>{const n=((e,t)=>{const{cart:a}=at(),r=a[t?`${e}-${t}`:`${e}`];return(null==r?void 0:r.quantity)||1})(t,a),o=Dt(t),{updateProduct:l}=at();return e(_t,{isDecreaseDisabled:n===r,onDecrease:()=>l({product:o,quantity:n-1,variantId:a}),onIncrease:()=>l({product:o,quantity:n+1,variantId:a}),quantity:n,size:i})},Tt=({item:a})=>{const{productId:r,variantId:i}=a||{},n=Dt(r),o=Ke(n,i),{language:l,currency:d}=ve(),{image160:c}=n,{title:s}=Ze(o,l),{name:u}=m((()=>Ye(n,l)),[n,l]),{formattedTotalPrice:_}=m((()=>st(a,d,l)),[a,d,l]);return t(g,{className:At,gap:1,alignItems:"center",children:[c&&e(je,{src:le(c),alt:u||"menu",className:Nt,loading:"lazy",width:80,height:45}),t("div",{className:kt,children:[e("div",{className:wt,children:u}),!!s&&e(k,{color:"muted",variant:"small",children:s}),e("div",{className:St,children:_})]}),e(Lt,{productId:r,variantId:i,size:"sm",min:0})]})},Ot=()=>{const{isCartOpen:a,cart:i,setIsCartOpen:n}=at(),o=s(null),{t:l}=ct(),d=r(i),c=()=>n(!1);return a?e("div",{className:Ct.container,onClick:e=>{var t,a;(null===(a=null===(t=null==o?void 0:o.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||c()},children:e(O,{ref:o,onClose:c,isOpen:a,title:l("Your order"),content:e("div",{className:Ct.content,children:d?e((()=>t(P,{className:Ct.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e(k,{variant:"h2",children:l("Empty order")}),e(R,{text:l("You don't have any items in your order")})]})),{}):e("div",{className:Ct.items,children:Object.keys(i||{}).map((t=>e(Tt,{item:i[t]},t)))})}),footer:d?e(T,{label:l("Add items"),onClick:c,type:N.PRIMARY,size:"xl",fullWidth:!0}):e(Pt,{actionText:l("Subtotal")})})}):null},Rt=_((({categoryProductMap:a=[],currency:r,language:n,productBlocksRef:o,containerRef:l,onCategoryInView:d})=>{const[s,m]=c(null),[_,h]=c(Je.LIST),v=[{icon:J,type:Je.LIST},{icon:ee,type:Je.GRID}],p=e=>{const{name:t}=Ye(e,n);i(Ie,{name:t}),m(e)};return u((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==l?void 0:l.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let r=null,i=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,n=t.top+t.height/2,o=Math.abs(n-a);o<i&&(i=o,r=e.target.getAttribute("data-category-id"))}})),r&&d(Number(r))}),{threshold:.1});return Object.entries(o.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[o,l]),e(tt,{children:t("div",{className:He,children:[e(g,{className:Be,alignItems:"center",children:v.map((({icon:t,type:a})=>e(w,{icon:t,onClick:()=>(e=>{h(e),i(be,{name:e})})(a),type:a===_?N.PRIMARY:N.DEFAULT},a)))}),e(P,{children:(a||[]).map((a=>{const{name:i}=Ae(a,n),{id:l,products:d}=a;return t("div",{className:$e,ref:e=>{e&&(o.current[l]=e)},"data-category-id":l,children:[e("h2",{className:Me,children:i}),e("div",{className:Ue,children:e(P,{gap:0,children:(d||[]).map((t=>_===Je.GRID?e(ot,{product:t,currency:r,language:n,onClick:()=>p(t)},t.id):e(it,{product:t,currency:r,language:n,onClick:()=>p(t)},t.id)))})})]},l)}))}),e(pt,{product:s,onClose:()=>m(null)}),e(bt,{}),e(Ot,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));Rt.displayName="Products";var Gt="Branches-module_branches__sOuoV",xt="Branches-module_list__vYoT2",qt="Branches-module_name__K0Z-4";const jt=({branches:t=[],rootPath:a="",onBranchSelect:r})=>{const i=({children:t,id:i})=>r?e("div",{onClick:()=>r(i),children:t}):e("a",{href:`${a}/${i}`,children:t});return e("div",{className:Gt,children:e(G,{className:xt,children:t.map((({id:t,name:a})=>e(i,{id:t,children:e(x,{noBottomMargin:!0,children:e(I,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e("h2",{className:qt,children:a})})})},t)))})})},Wt=({data:n})=>{var o;const{name:l,coverImage:d,logoImage:u,branches:m=[],branchId:_,language:h,categories:g,products:v,currency:p,instagram:f,facebook:y,whatsapp:I,telegram:P,tiktok:b,rootPath:C,hostname:A,onBranchSelect:N}=n||{},k=m.length<=1,w=((e,t)=>{const a=t.reduce(((e,t)=>{const a=Number(t.categoryId);return e[a]||(e[a]=[]),e[a].push(t),e}),{});return e.map((e=>Object.assign(Object.assign({},e),{products:a[Number(e.id)]||[]}))).filter((e=>{var t;return(null===(t=null==e?void 0:e.products)||void 0===t?void 0:t.length)>0}))})(g,v),S=(()=>{var e;return k?(null===(e=null==m?void 0:m[0])||void 0===e?void 0:e.id)?m[0]:{}:m.find((e=>e.id===Number(_)))})(),D=k||!(null==S?void 0:S.name)?l:(null==S?void 0:S.name)||"",[L,T]=c(null===(o=null==g?void 0:g[0])||void 0===o?void 0:o.id),O=s({}),R=s(null),G=s(!0),{url:x,domain:q}=((e,t)=>{const a=_e.includes(e)?e:me;return{url:`https://${a}/${t||"en"}`,domain:a}})(A,h);return t("div",{className:re,ref:R,children:[e(Ee,{branch:S,name:D,coverImage:ce(d),logoImage:de(u),instagram:f,facebook:y,whatsapp:I,telegram:P,tiktok:b}),k||_?t(a,{children:[e(Qe,{categoryProductMap:w,language:h,selectedCategoryId:L,onSelectCategory:e=>ae(void 0,void 0,void 0,(function*(){G.current=!1,T(e),(e=>{var t;const a=null===(t=null==O?void 0:O.current)||void 0===t?void 0:t[e];a&&(setTimeout((()=>{a.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{G.current=!0}),1e3))})(e)}))}),e(Rt,{currency:p,language:h,productBlocksRef:O,containerRef:R,categoryProductMap:w,onCategoryInView:e=>{if(!(null==G?void 0:G.current))return;const t=((e,t,a)=>{var i;const n=null===(i=null==t?void 0:t.find)||void 0===i?void 0:i.call(t,(({id:t})=>t===e));if(r(n))return"";const{name:o}=Ae(n,a);return o})(e,g,h);i(ye,{name:t}),T(e)}})]}):e(jt,{branches:m,onBranchSelect:N,rootPath:C}),!!A&&e("a",{rel:"noopener noreferrer",target:"_blank",href:x,className:ne,children:q})]})},zt=({data:t})=>e(ge,{value:t,children:e(Wt,{data:t})});var Et={};const Qt=({currentGoal:t,language:a,setGoal:r})=>{const{t:i}=ct(a),n=s({}),o=e=>{switch(e){case ye:return i("Scrolled to Category");case fe:return i("Category Selected");case Ie:return i("Product Details");case Pe:return i("Product Added to Cart");default:return""}},l=h((e=>{var t,a;r(e),null===(a=null===(t=null==n?void 0:n.current)||void 0===t?void 0:t.close)||void 0===a||a.call(t)}),[r]);return e(q,{action:o(t),actionSize:"large",type:N.BORDERED_PRIMARY,closeRef:n,menu:e("div",{className:Et.toolbarMenu,children:Ce.map((t=>e(j,{onClick:()=>l(t),children:o(t)},t)))})})},Ht=({data:t,isLoading:a=!1,loadingImage:r,language:i,goal:n,setGoal:o})=>{const{t:l}=ct(i);return e(x,{title:l("Events"),toolbar:e(Qt,{language:i,currentGoal:n,setGoal:o}),children:a?e(W,{image:r}):e(z,{data:t})})};export{Ht as Events,zt as PublicMenu};
2
2
  //# sourceMappingURL=index.esm.js.map