@restaround/react 1.0.44 → 1.0.46

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.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("react/jsx-runtime"),t=require("react"),r=require("@sorocraft/js-utils"),a=require("@sorocraft/ui"),i=require("@sorocraft/ui/icons");function n(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)t.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(r[a[i]]=e[a[i]])}return r}function o(e,t,r,a){return new(r||(r=Promise))((function(i,n){function o(e){try{l(a.next(e))}catch(e){n(e)}}function s(e){try{l(a.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}l((a=a.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var s="PublicMenu-module_container__QLN6U",l="PublicMenu-module_categories__Iy6NC",d="PublicMenu-module_footer__6G3DQ";const c="https://images.restaround.co",u=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"",m=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/no-photo-128.webp",_=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/restaround-doodle.webp",h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=(e,t,r)=>h.charAt(e>>2)+h.charAt((3&e)<<4|t>>4)+h.charAt((15&t)<<2|r>>6)+h.charAt(63&r),p="restaround.co",v=[p,"restaround.az","restaround.ee","restaround.nl"],f=t.createContext({}),x=({children:t,value:a})=>{const i=r.isEmpty(a)?{}:a;return i.currency||i.currency,i.language||i.language,e.jsx(f.Provider,{value:r.isEmpty(a)?{}:a,children:t})},j=()=>t.useContext(f);var y="Header-module_container__tenlF",b="Header-module_cover__BAWZK",C="Header-module_content__Gx4Al",I="Header-module_logo__4MTCm",P="Header-module_info__IchYA",w="Header-module_name__30wyw",A="Header-module_address__WOxXc",N="Header-module_addressText__lUszI",O="Header-module_social__AoP0z",k="Header-module_links__EeQxg",S="Header-module_wifiPassword__VWBTa",L="Header-module_wifiPasswordIcon__Ukn3D";const T=t=>{const r=n(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:a}=j()||{};if(a){const r=a;return e.jsx(r,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(i=235,o=59,s=90,`data:image/gif;base64,R0lGODlhAQABAPAA${g(0,i,o)+g(s,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var i,o,s;return e.jsx("img",Object.assign({},r))};var D={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 R=()=>{var r;const{language:i,languages:n,onLanguageSelect:o}=j(),[s,l]=t.useState(!1),d=(null==n?void 0:n.length)>1,c=(null===(r=null==n?void 0:n.filter)||void 0===r?void 0:r.call(n,(({code:e})=>e!==i)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e.jsx("div",{className:D.container,onClick:()=>l(!s),children:e.jsxs(a.Row,{alignItems:"center",gap:0,children:[e.jsx(a.Row,{alignItems:"center",className:a.classNames(D,{options:!0,isOpen:s}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:D.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(i),alt:i||"",className:D.currentLanguage})]})}):null},z=({branch:t,coverImage:n,logoImage:o,name:s,instagram:l,facebook:d,whatsapp:c,telegram:u,tiktok:m})=>{const{address:_,latitude:h,longitude:g,phone:p,wifiPassword:v}=t||{},f=r.isEmpty(t),x=`https://www.google.com/maps/place/${h},${g}`;return e.jsxs("div",{className:y,children:[e.jsx(T,{src:n,alt:s,className:b,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:C,children:f?e.jsx((()=>e.jsxs(a.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(T,{src:o,alt:s,className:I,width:96,height:96}),e.jsx("div",{className:P,children:e.jsx("h1",{className:w,children:s})})]})),{}):e.jsx((()=>e.jsxs(a.Flex,{direction:"row",gap:1,alignItems:"center",children:[e.jsx(a.Flex.Item,{children:e.jsx(T,{src:o,alt:s,className:I,width:96,height:96})}),e.jsx(a.Flex.Item,{shrink:!0,children:e.jsx("div",{className:P,children:e.jsxs(a.Column,{gap:.25,children:[e.jsx("h1",{className:w,children:s}),e.jsx("a",{className:A,href:x,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(a.Row,{alignItems:"center",gap:.5,children:[e.jsx(a.SVGIcon,{icon:i.MarkerPin,theme:"dark"}),e.jsx("span",{className:N,children:_})]})})]})})})]})),{})}),e.jsx(R,{}),!f&&e.jsx("div",{className:O,children:e.jsx("div",{className:k,children:e.jsx(a.Row,{gap:2,alignItems:"center",children:e.jsxs(a.Row,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!p&&e.jsx(a.IconLink,{icon:i.Phone,href:`tel:+${p}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e.jsx(a.IconLink,{icon:i.Whatsapp,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!l&&e.jsx(a.IconLink,{icon:i.Instagram,href:l,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e.jsx(a.IconLink,{icon:i.Telegram,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!m&&e.jsx(a.IconLink,{icon:i.Tiktok,href:m,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e.jsx(a.IconLink,{icon:i.Facebook,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!v&&e.jsx(a.Tooltip,{hint:v,children:e.jsx("div",{className:S,children:e.jsx(a.SVGIcon,{icon:i.Wifi,size:"sm",className:L})})})]})})})})]})},E=({categoryProductMap:r=[],language:i,selectedCategoryId:n,onSelectCategory:o})=>{const s=t.useRef({}),d=t.useRef(null);return t.useEffect((()=>{n&&(()=>{var e;const t=null===(e=null==s?void 0:s.current)||void 0===e?void 0:e[n];if(!t||!d.current)return;const r=d.current.clientWidth,a=t.offsetLeft-r/2+t.offsetWidth/2;d.current.scrollTo({left:a,behavior:"smooth"})})()}),[n]),e.jsx("div",{className:l,children:e.jsx(a.Carousel,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(d.current=e.current)},children:(r||[]).map((({id:t,translations:r})=>{const{name:l}=r.find((e=>e.language===i))||{};return e.jsx(a.CarouselItem,{children:e.jsx(a.Chip,{onClick:()=>(e=>{e!==n&&o(e)})(t),type:a.UIElementType.BORDERED_PRIMARY,active:t===n,children:e.jsx("div",{ref:e=>s.current[t]=e,children:l})})},t)}))})})};var M="Products-module_container__bF2LF",Q="Products-module_products__AoDrY",W="Products-module_category__Sp7dE",F="Products-module_list__LH4v5";const B=t.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{}}),H=({children:a})=>{const[i,o]=t.useState({}),[s,l]=t.useState(!1),d=(e,t,a)=>{if(r.isEmpty(e)||t<0)return;const{id:i,price:s,vat:l=0}=e;o((e=>{const r=e[i],o=a?((null==r?void 0:r.quantity)||0)+t:t;if(o<=0){const t=e,r=i;t[r];return n(t,["symbol"==typeof r?r:r+""])}return Object.assign(Object.assign({},e),{[i]:{productId:i,price:s,quantity:o,vat:l}})}))},c=(e,t=1)=>d(e,t,!0),u=(e,t=1)=>d(e,t,!1),m=t.useMemo((()=>({cart:i,isCartOpen:s,addProduct:c,updateProduct:u,setIsCartOpen:l})),[i,s]);return e.jsx(B.Provider,{value:m,children:a})},q=()=>t.useContext(B);var Y={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 U=(e,t)=>{var r,a;return(null===(a=null===(r=null==e?void 0:e.translations)||void 0===r?void 0:r.find)||void 0===a?void 0:a.call(r,(e=>e.language===t)))||{}},V=(e,t,r=0)=>e*t*(1+r/100),G=(e,t,a,i=1)=>{const{price:n,vat:o}=e||{},s=V(n,i,o);return{totalPrice:s,formattedTotalPrice:r.priceFormatter(s,t,a)}},$=({product:n,currency:o,language:s,onClick:l})=>{const{addProduct:d}=q(),{image160:c}=n||{},{name:m,description:_}=t.useMemo((()=>U(n,s)),[n,s]),{formattedTotalPrice:h}=t.useMemo((()=>G(n,o,s)),[n,o,s]);return e.jsxs("div",{className:r.classNames(Y,{container:!0,isClickable:!!l}),onClick:l,children:[e.jsxs(a.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:Y.data,children:e.jsxs(a.Column,{gap:.25,children:[e.jsx("h3",{className:Y.name,children:m}),e.jsx("div",{className:Y.description,children:_}),e.jsx("div",{className:Y.price,children:h})]})}),c&&e.jsx(T,{src:u(c),alt:m||"menu",className:Y.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:Y.addToCart,children:e.jsx(a.IconButton,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(n)},icon:i.Plus,type:a.UIElementType.DEFAULT})})]})};var Z={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",close:"ProductDetails-module_close__4cHZ3",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 K={en:{viewOrder:"View order",removeFromOrder:"Remove from order",updateOrder:"Update order",addToOrder:"Add to order"},az:{viewOrder:"Şifarişi göstər",removeFromOrder:"Sifarişdən sil",updateOrder:"Sifarişi yenilə",addToOrder:"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"},tr:{viewOrder:"Siparişi Görüntüle",removeFromOrder:"Siparişten Kaldır",updateOrder:"Siparişi Güncelle",addToOrder:"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"},nl:{viewOrder:"Bestelling bekijken",removeFromOrder:"Uit bestelling verwijderen",updateOrder:"Bestelling bijwerken",addToOrder:"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"},et:{viewOrder:"Vaata tellimust",removeFromOrder:"Eemalda tellimusest",updateOrder:"Uuenda tellimust",addToOrder:"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"},pl:{viewOrder:"Zobacz zamówienie",removeFromOrder:"Usuń z zamówienia",updateOrder:"Zaktualizuj zamówienie",addToOrder:"Dodaj do zamówienia","Your order":"Twoje zamówienie","Empty order":"Puste zamówienie","You don't have any items in your order":"Nie masz żadnych pozycji w zamówieniu","Add items":"Dodaj przedmioty",Subtotal:"Suma"},ru:{viewOrder:"Посмотреть заказ",removeFromOrder:"Удалить из заказа",updateOrder:"Обновить заказ",addToOrder:"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого"}},X=()=>{const{language:e}=j();return{t:t=>{var r;return(null===(r=K[e])||void 0===r?void 0:r[t])||t}}},J=()=>{const{cart:e}=q();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var ee={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 te=({isDecreaseDisabled:t=!1,quantity:n=1,size:o="md",onIncrease:s,onDecrease:l})=>e.jsxs(a.Row,{className:r.classNames(ee,{container:!0},[ee[o]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:r.classNames(ee,{quantityAction:!0,isDisabled:t}),onClick:l,children:e.jsx(a.SVGIcon,{icon:i.Minus})}),e.jsx("div",{className:ee.quantityValue,children:n}),e.jsx("div",{className:ee.quantityAction,onClick:s,children:e.jsx(a.SVGIcon,{icon:i.Plus})})]}),re=({product:n,onClose:o})=>{const{language:s,currency:l}=j(),{addProduct:d,updateProduct:c}=q(),[m,_]=t.useState(1),[h,g]=t.useState(!1),p=t.useRef(),{t:v}=X(),f=(e=>{var t;const{cart:a}=q();return r.isEmpty(a)||!e?0:(null===(t=a[e])||void 0===t?void 0:t.quantity)||0})(null==n?void 0:n.id),{name:x,description:y}=t.useMemo((()=>U(n,s)),[n,s]),{totalPrice:b,formattedTotalPrice:C}=t.useMemo((()=>G(n,l,s)),[n,l,s]),I=t.useMemo((()=>m*b),[m,b]),P=t.useMemo((()=>r.priceFormatter(I,l,s)),[I,l,s]),w=h?0===m:1===m,A=t.useMemo((()=>v(h?0===m?"removeFromOrder":"updateOrder":"addToOrder")),[h,m]);t.useEffect((()=>{_(f>0?f:1),g(f>0)}),[f]);const N=e=>{-1===e&&w||_((t=>Math.max(0,t+e)))};if(r.isEmpty(n))return null;const{image1024:O,volume:k}=n;return e.jsx("div",{className:Z.container,onClick:e=>{var t,r;(null===(r=null===(t=null==p?void 0:p.current)||void 0===t?void 0:t.contains)||void 0===r?void 0:r.call(t,null==e?void 0:e.target))||o&&o()},children:e.jsx(a.Modal,{onClose:o,ref:p,noBodyPadding:!0,size:"small",content:e.jsxs("div",{className:Z.content,children:[e.jsxs(a.Column,{gap:0,children:[O&&e.jsx(T,{src:u(O),width:1024,height:400,alt:x||"product",className:Z.image}),e.jsxs(a.Column,{className:Z.details,gap:1,children:[e.jsx("h2",{className:Z.name,children:x}),e.jsxs(a.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:Z.price,children:C}),e.jsx("div",{className:Z.volume,children:k})]}),e.jsx("div",{className:Z.description,children:y})]})]}),e.jsx("div",{className:Z.close,children:e.jsx(a.IconButton,{onClick:o,icon:i.Close})})]}),footer:e.jsxs(a.Row,{className:Z.addToCart,gap:.5,children:[e.jsx(te,{isDecreaseDisabled:w,onDecrease:()=>N(-1),onIncrease:()=>N(1),quantity:m}),e.jsx(a.Button,{className:Z.addAction,label:e.jsxs(a.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{children:A}),e.jsx("span",{children:P})]}),onClick:()=>{h?c(n,m):d(n,m),o&&o()},size:"xl",fullWidth:!0})]})})})};var ae="Cart-module_container__3KQtx",ie="Cart-module_content__rkiZa",ne={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 oe=({actionText:t,onClick:i})=>{const n=J(),{formattedTotalPrice:o}=(()=>{const{cart:e}=q(),{currency:t,language:a}=j(),i=Object.values(e||{}).reduce(((e,{price:t,quantity:r,vat:a})=>e+V(t,r,a)),0);return{totalPrice:i,formattedTotalPrice:r.priceFormatter(i,t,a)}})();return e.jsxs(a.Flex,{className:r.classNames(ne,{container:!0,isClickable:!!i}),justifyContent:"space-between",alignItems:"center",onClick:i,children:[e.jsx(a.Flex.Item,{flex:1,children:e.jsxs(a.Row,{alignItems:"center",children:[e.jsx("div",{className:ne.count,children:n}),e.jsx("div",{className:ne.actionText,children:t})]})}),e.jsx(a.Flex.Item,{className:ne.totalPrice,flex:1,children:o})]})},se=()=>{const{setIsCartOpen:t}=q(),{t:r}=X();return J()<=0?null:e.jsx("div",{className:ae,children:e.jsx("div",{className:ie,children:e.jsx(oe,{onClick:()=>t(!0),actionText:r("viewOrder")})})})};var le={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"},de="CartItem-module_container__At7lj",ce="CartItem-module_image__D-zzG",ue="CartItem-module_data__Lo3Fb",me="CartItem-module_name__EksZu",_e="CartItem-module_price__yJxl6";const he=e=>{var t;const{products:r}=j();return(null===(t=null==r?void 0:r.find)||void 0===t?void 0:t.call(r,(({id:t})=>t===e)))||{}},ge=({productId:t,min:r=1,size:a="md"})=>{const i=(e=>{const{cart:t}=q(),r=t[e];return(null==r?void 0:r.quantity)||1})(t),n=he(t),{updateProduct:o}=q(),s=i===r;return e.jsx(te,{isDecreaseDisabled:s,onDecrease:()=>o(n,i-1),onIncrease:()=>o(n,i+1),quantity:i,size:a})},pe=({item:r})=>{const{productId:i,quantity:n}=r||{},o=he(i),{language:s,currency:l}=j(),{image160:d}=o,{name:c}=t.useMemo((()=>U(o,s)),[o,s]),{formattedTotalPrice:m}=t.useMemo((()=>G(o,l,s,n)),[o,l,s,n]);return e.jsxs(a.Row,{className:de,gap:1,alignItems:"center",children:[d&&e.jsx(T,{src:u(d),alt:c||"menu",className:ce,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:ue,children:[e.jsx("div",{className:me,children:c}),e.jsx("div",{className:_e,children:m})]}),e.jsx(ge,{productId:i,size:"sm",min:0})]})},ve=()=>{const{isCartOpen:i,cart:n,setIsCartOpen:o}=q(),s=t.useRef(),{t:l}=X(),d=r.isEmpty(n),c=()=>o(!1);return i?e.jsx("div",{className:le.container,onClick:e=>{var t,r;(null===(r=null===(t=null==s?void 0:s.current)||void 0===t?void 0:t.contains)||void 0===r?void 0:r.call(t,null==e?void 0:e.target))||c()},children:e.jsx(a.Drawer,{ref:s,onClose:c,isOpen:i,title:l("Your order"),content:e.jsx("div",{className:le.content,children:d?e.jsx((()=>e.jsxs(a.Column,{className:le.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e.jsx(a.Text,{variant:"h2",children:l("Empty order")}),e.jsx(a.Description,{text:l("You don't have any items in your order")})]})),{}):e.jsx("div",{className:le.items,children:Object.keys(n||{}).map((t=>e.jsx(pe,{item:n[t]},t)))})}),footer:d?e.jsx(a.Button,{label:l("Add items"),onClick:c,type:a.UIElementType.PRIMARY,size:"xl",fullWidth:!0}):e.jsx(oe,{actionText:l("Subtotal")})})}):null},fe=t.memo((({categoryProductMap:r=[],currency:i,language:n,productBlocksRef:o,containerRef:s,onCategoryInView:l})=>{const[d,c]=t.useState(null);return t.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const r=((null===(t=null==s?void 0:s.current)||void 0===t?void 0:t.clientHeight)||1e3)/2;let a=null,i=1/0;e.forEach((e=>{if(e.isIntersecting){const t=e.boundingClientRect,n=t.top+t.height/2,o=Math.abs(n-r);o<i&&(i=o,a=e.target.getAttribute("data-category-id"))}})),a&&l(Number(a))}),{threshold:.5});return Object.entries(o.current||{}).forEach((([t,r])=>{r&&(r.setAttribute("data-category-id",t),e.observe(r))})),()=>{e.disconnect()}}),[o,s]),e.jsx(H,{children:e.jsxs("div",{className:M,children:[e.jsx(a.Column,{children:(r||[]).map((t=>{const{name:r}=((e,t)=>{var r,a;return(null===(a=null===(r=null==e?void 0:e.translations)||void 0===r?void 0:r.find)||void 0===a?void 0:a.call(r,(e=>e.language===t)))||{}})(t,n),{id:s,products:l}=t;return e.jsxs("div",{className:Q,ref:e=>o.current[s]=e,"data-category-id":s,children:[e.jsx("h2",{className:W,children:r}),e.jsx("div",{className:F,children:e.jsx(a.Column,{gap:0,children:(l||[]).map((t=>e.jsx($,{product:t,currency:i,language:n,onClick:()=>c(t)},t.id)))})})]},s)}))}),e.jsx(re,{product:d,onClose:()=>c(null)}),e.jsx(se,{}),e.jsx(ve,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));var xe="Branches-module_branches__sOuoV",je="Branches-module_list__vYoT2",ye="Branches-module_name__K0Z-4";const be=({branches:t=[],rootPath:r="",onBranchSelect:i})=>{const n=({children:t,id:a})=>i?e.jsx("div",{onClick:()=>i(a),children:t}):e.jsx("a",{href:`${r}/${a}`,children:t});return e.jsx("div",{className:xe,children:e.jsx(a.Container,{className:je,children:t.map((({id:t,name:r})=>e.jsx(n,{id:t,children:e.jsx(a.Card,{noBottomMargin:!0,children:e.jsx(a.Flex,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e.jsx("h2",{className:ye,children:r})})})},t)))})})},Ce=({data:r})=>{var a;const{name:i,coverImage:n,logoImage:l,branches:c=[],branchId:u,language:h,categories:g,products:f,currency:x,instagram:j,facebook:y,whatsapp:b,telegram:C,tiktok:I,rootPath:P,hostname:w,onBranchSelect:A}=r||{},N=c.length<=1,O=((e,t)=>{const r=t.reduce(((e,t)=>{const r=Number(t.categoryId);return e[r]||(e[r]=[]),e[r].push(t),e}),{});return e.map((e=>Object.assign(Object.assign({},e),{products:r[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,f),k=(()=>{var e;return N?(null===(e=null==c?void 0:c[0])||void 0===e?void 0:e.id)?c[0]:{}:c.find((e=>e.id===Number(u)))})(),S=N||!(null==k?void 0:k.name)?i:(null==k?void 0:k.name)||"",[L,T]=t.useState(null===(a=null==g?void 0:g[0])||void 0===a?void 0:a.id),D=t.useRef({}),R=t.useRef(null),M=t.useRef(!0),{url:Q,domain:W}=((e,t)=>{const r=v.includes(e)?e:p;return{url:`https://${r}/${t||"en"}`,domain:r}})(w,h);return e.jsxs("div",{className:s,ref:R,children:[e.jsx(z,{branch:k,name:S,coverImage:_(n),logoImage:m(l),instagram:j,facebook:y,whatsapp:b,telegram:C,tiktok:I}),N||u?e.jsxs(e.Fragment,{children:[e.jsx(E,{categoryProductMap:O,language:h,selectedCategoryId:L,onSelectCategory:e=>o(void 0,void 0,void 0,(function*(){M.current=!1,T(e),(e=>{var t;const r=null===(t=null==D?void 0:D.current)||void 0===t?void 0:t[e];r&&(setTimeout((()=>{r.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{M.current=!0}),1e3))})(e)}))}),e.jsx(fe,{currency:x,language:h,productBlocksRef:D,containerRef:R,categoryProductMap:O,onCategoryInView:e=>{(null==M?void 0:M.current)&&T(e)}})]}):e.jsx(be,{branches:c,onBranchSelect:A,rootPath:P}),!!w&&e.jsx("a",{rel:"noopener",target:"_blank",href:Q,className:d,children:W})]})};exports.PublicMenu=({data:t})=>e.jsx(x,{value:t,children:e.jsx(Ce,{data:t})});
1
+ "use strict";var e=require("react/jsx-runtime"),t=require("react"),a=require("@sorocraft/js-utils"),r=require("@sorocraft/ui"),i=require("@sorocraft/ui/icons");function n(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 o(e,t,a,r){return new(a||(a=Promise))((function(i,n){function o(e){try{l(r.next(e))}catch(e){n(e)}}function s(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,s)}l((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var s="PublicMenu-module_container__QLN6U",l="PublicMenu-module_categories__Iy6NC",d="PublicMenu-module_footer__6G3DQ";const c="https://images.restaround.co",u=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"",m=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/no-photo-128.webp",_=e=>e?e.includes("base64")||e.startsWith("https://")?e:`${c}/${e}`:"https://images.restaround.co/restaround-doodle.webp",h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=(e,t,a)=>h.charAt(e>>2)+h.charAt((3&e)<<4|t>>4)+h.charAt((15&t)<<2|a>>6)+h.charAt(63&a),p="restaround.co",v=[p,"restaround.az","restaround.ee","restaround.nl"],f=t.createContext({}),x=({children:t,value:r})=>{const i=a.isEmpty(r)?{}:r;return i.currency||i.currency,i.language||i.language,e.jsx(f.Provider,{value:a.isEmpty(r)?{}:r,children:t})},j=()=>t.useContext(f);var y="Header-module_container__tenlF",b="Header-module_cover__BAWZK",C="Header-module_content__Gx4Al",I="Header-module_logo__4MTCm",P="Header-module_info__IchYA",w="Header-module_name__30wyw",A="Header-module_address__WOxXc",N="Header-module_addressText__lUszI",O="Header-module_social__AoP0z",k="Header-module_links__EeQxg",S="Header-module_wifiPassword__VWBTa",L="Header-module_wifiPasswordIcon__Ukn3D";const T=t=>{const a=n(t,["priority","blurDataURL","quality","placeholder","fetchPriority"]),{imageTag:r}=j()||{};if(r){const a=r;return e.jsx(a,Object.assign({},t,{quality:t.quality||100,placeholder:"blur",blurDataURL:(i=235,o=59,s=90,`data:image/gif;base64,R0lGODlhAQABAPAA${g(0,i,o)+g(s,255,255)}/yH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==`)}))}var i,o,s;return e.jsx("img",Object.assign({},a))};var D={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 R=()=>{var a;const{language:i,languages:n,onLanguageSelect:o}=j(),[s,l]=t.useState(!1),d=(null==n?void 0:n.length)>1,c=(null===(a=null==n?void 0:n.filter)||void 0===a?void 0:a.call(n,(({code:e})=>e!==i)))||[],u=e=>`https://images.restaround.co/languages/${e}.svg`;return d?e.jsx("div",{className:D.container,onClick:()=>l(!s),children:e.jsxs(r.Row,{alignItems:"center",gap:0,children:[e.jsx(r.Row,{alignItems:"center",className:r.classNames(D,{options:!0,isOpen:s}),children:c.map((({code:t})=>e.jsx("img",{src:u(t),className:D.option,onClick:()=>(e=>{o&&o(e)})(t),alt:t},t)))}),e.jsx("img",{src:u(i),alt:i||"",className:D.currentLanguage})]})}):null},z=({branch:t,coverImage:n,logoImage:o,name:s,instagram:l,facebook:d,whatsapp:c,telegram:u,tiktok:m})=>{const{address:_,latitude:h,longitude:g,phone:p,wifiPassword:v}=t||{},f=a.isEmpty(t),x=`https://www.google.com/maps/place/${h},${g}`;return e.jsxs("div",{className:y,children:[e.jsx(T,{src:n,alt:s,className:b,width:1024,height:400,priority:!0,sizes:"100vw",fetchPriority:"high",loading:"eager"}),e.jsx("div",{className:C,children:f?e.jsx((()=>e.jsxs(r.Column,{fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",children:[e.jsx(T,{src:o,alt:s,className:I,width:96,height:96}),e.jsx("div",{className:P,children:e.jsx("h1",{className:w,children:s})})]})),{}):e.jsx((()=>e.jsxs(r.Flex,{direction:"row",gap:1,alignItems:"center",children:[e.jsx(r.Flex.Item,{children:e.jsx(T,{src:o,alt:s,className:I,width:96,height:96})}),e.jsx(r.Flex.Item,{shrink:!0,children:e.jsx("div",{className:P,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h1",{className:w,children:s}),e.jsx("a",{className:A,href:x,target:"_blank",rel:"noopener noreferrer",children:e.jsxs(r.Row,{alignItems:"center",gap:.5,children:[e.jsx(r.SVGIcon,{icon:i.MarkerPin,theme:"dark"}),e.jsx("span",{className:N,children:_})]})})]})})})]})),{})}),e.jsx(R,{}),!f&&e.jsx("div",{className:O,children:e.jsx("div",{className:k,children:e.jsx(r.Row,{gap:2,alignItems:"center",children:e.jsxs(r.Row,{alignItems:"center",justifyContent:"center",gap:.5,children:[!!p&&e.jsx(r.IconLink,{icon:i.Phone,href:`tel:+${p}`,size:"sm",shape:"circle",theme:"light"}),!!c&&e.jsx(r.IconLink,{icon:i.Whatsapp,href:`https://wa.me/${c}`,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!l&&e.jsx(r.IconLink,{icon:i.Instagram,href:l,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!u&&e.jsx(r.IconLink,{icon:i.Telegram,href:u,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!m&&e.jsx(r.IconLink,{icon:i.Tiktok,href:m,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!d&&e.jsx(r.IconLink,{icon:i.Facebook,href:d,size:"sm",shape:"circle",theme:"light",target:"_blank"}),!!v&&e.jsx(r.Tooltip,{hint:v,children:e.jsx("div",{className:S,children:e.jsx(r.SVGIcon,{icon:i.Wifi,size:"sm",className:L})})})]})})})})]})},E=({categoryProductMap:a=[],language:i,selectedCategoryId:n,onSelectCategory:o})=>{const s=t.useRef({}),d=t.useRef(null);return t.useEffect((()=>{n&&(()=>{var e;const t=null===(e=null==s?void 0:s.current)||void 0===e?void 0:e[n];if(!t||!d.current)return;const a=d.current.clientWidth,r=t.offsetLeft-a/2+t.offsetWidth/2;d.current.scrollTo({left:r,behavior:"smooth"})})()}),[n]),e.jsx("div",{className:l,children:e.jsx(r.Carousel,{gap:1,onGetRef:e=>{(null==e?void 0:e.current)&&(d.current=e.current)},children:(a||[]).map((({id:t,translations:a})=>{const{name:l}=a.find((e=>e.language===i))||{};return e.jsx(r.CarouselItem,{children:e.jsx(r.Chip,{onClick:()=>(e=>{e!==n&&o(e)})(t),type:r.UIElementType.BORDERED_PRIMARY,active:t===n,children:e.jsx("div",{ref:e=>s.current[t]=e,children:l})})},t)}))})})};var W="Products-module_container__bF2LF",M="Products-module_products__AoDrY",Q="Products-module_category__Sp7dE",F="Products-module_list__LH4v5";const B=t.createContext({cart:{},isCartOpen:!1,addProduct:()=>{},updateProduct:()=>{},setIsCartOpen:()=>{}}),H=({children:r})=>{const[i,o]=t.useState({}),[s,l]=t.useState(!1),d=(e,t,r)=>{if(a.isEmpty(e)||t<0)return;const{id:i,price:s,vat:l=0}=e;o((e=>{const a=e[i],o=r?((null==a?void 0:a.quantity)||0)+t:t;if(o<=0){const t=e,a=i;t[a];return n(t,["symbol"==typeof a?a:a+""])}return Object.assign(Object.assign({},e),{[i]:{productId:i,price:s,quantity:o,vat:l}})}))},c=(e,t=1)=>d(e,t,!0),u=(e,t=1)=>d(e,t,!1),m=t.useMemo((()=>({cart:i,isCartOpen:s,addProduct:c,updateProduct:u,setIsCartOpen:l})),[i,s]);return e.jsx(B.Provider,{value:m,children:r})},q=()=>t.useContext(B);var Y={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 U=(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)))||{}},V=(e,t,a=0)=>e*t*(1+a/100),G=(e,t,r,i=1)=>{const{price:n,vat:o}=e||{},s=V(n,i,o);return{totalPrice:s,formattedTotalPrice:a.priceFormatter(s,t,r)}},$=({product:n,currency:o,language:s,onClick:l})=>{const{addProduct:d}=q(),{image160:c,volume:m}=n||{},{name:_,description:h}=t.useMemo((()=>U(n,s)),[n,s]),{formattedTotalPrice:g}=t.useMemo((()=>G(n,o,s)),[n,o,s]);return e.jsxs("div",{className:a.classNames(Y,{container:!0,isClickable:!!l}),onClick:l,children:[e.jsxs(r.Row,{justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:Y.data,children:e.jsxs(r.Column,{gap:.25,children:[e.jsx("h3",{className:Y.name,children:e.jsxs(r.Row,{gap:.5,fullWidth:!0,children:[e.jsx("span",{children:_}),!!m&&e.jsxs("span",{children:["(",m,")"]})]})}),e.jsx("div",{className:Y.description,children:h}),e.jsx("div",{className:Y.price,children:g})]})}),c&&e.jsx(T,{src:u(c),alt:_||"menu",className:Y.image,loading:"lazy",width:160,height:90})]}),e.jsx("div",{className:Y.addToCart,children:e.jsx(r.IconButton,{onClick:e=>{e.preventDefault(),e.stopPropagation(),d(n)},icon:i.Plus,type:r.UIElementType.DEFAULT})})]})};var Z={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",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 K={en:{viewOrder:"View order",removeFromOrder:"Remove from order",updateOrder:"Update order",addToOrder:"Add to order"},az:{viewOrder:"Şifarişi göstər",removeFromOrder:"Sifarişdən sil",updateOrder:"Sifarişi yenilə",addToOrder:"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"},tr:{viewOrder:"Siparişi Görüntüle",removeFromOrder:"Siparişten Kaldır",updateOrder:"Siparişi Güncelle",addToOrder:"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"},nl:{viewOrder:"Bestelling bekijken",removeFromOrder:"Uit bestelling verwijderen",updateOrder:"Bestelling bijwerken",addToOrder:"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"},et:{viewOrder:"Vaata tellimust",removeFromOrder:"Eemalda tellimusest",updateOrder:"Uuenda tellimust",addToOrder:"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"},pl:{viewOrder:"Zobacz zamówienie",removeFromOrder:"Usuń z zamówienia",updateOrder:"Zaktualizuj zamówienie",addToOrder:"Dodaj do zamówienia","Your order":"Twoje zamówienie","Empty order":"Puste zamówienie","You don't have any items in your order":"Nie masz żadnych pozycji w zamówieniu","Add items":"Dodaj przedmioty",Subtotal:"Suma"},ru:{viewOrder:"Посмотреть заказ",removeFromOrder:"Удалить из заказа",updateOrder:"Обновить заказ",addToOrder:"Добавить в заказ","Your order":"Ваш заказ","Empty order":"Пустой заказ","You don't have any items in your order":"В вашем заказе нет товаров","Add items":"Добавить товары",Subtotal:"Итого"}},X=()=>{const{language:e}=j();return{t:t=>{var a;return(null===(a=K[e])||void 0===a?void 0:a[t])||t}}},J=()=>{const{cart:e}=q();return Object.values(e||{}).reduce(((e,t)=>e+t.quantity),0)};var ee={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 te=({isDecreaseDisabled:t=!1,quantity:n=1,size:o="md",onIncrease:s,onDecrease:l})=>e.jsxs(r.Row,{className:a.classNames(ee,{container:!0},[ee[o]]),justifyContent:"space-between",gap:0,children:[e.jsx("div",{className:a.classNames(ee,{quantityAction:!0,isDisabled:t}),onClick:l,children:e.jsx(r.SVGIcon,{icon:i.Minus})}),e.jsx("div",{className:ee.quantityValue,children:n}),e.jsx("div",{className:ee.quantityAction,onClick:s,children:e.jsx(r.SVGIcon,{icon:i.Plus})})]}),ae=({product:n,onClose:o})=>{const{language:s,currency:l}=j(),{addProduct:d,updateProduct:c}=q(),[m,_]=t.useState(1),[h,g]=t.useState(!1),p=t.useRef(),{t:v}=X(),f=(e=>{var t;const{cart:r}=q();return a.isEmpty(r)||!e?0:(null===(t=r[e])||void 0===t?void 0:t.quantity)||0})(null==n?void 0:n.id),{name:x,description:y}=t.useMemo((()=>U(n,s)),[n,s]),{totalPrice:b,formattedTotalPrice:C}=t.useMemo((()=>G(n,l,s)),[n,l,s]),I=t.useMemo((()=>m*b),[m,b]),P=t.useMemo((()=>a.priceFormatter(I,l,s)),[I,l,s]),w=h?0===m:1===m,A=t.useMemo((()=>v(h?0===m?"removeFromOrder":"updateOrder":"addToOrder")),[h,m]);t.useEffect((()=>{_(f>0?f:1),g(f>0)}),[f,n]);const N=e=>{-1===e&&w||_((t=>Math.max(0,t+e)))};if(a.isEmpty(n))return null;const{image1024:O,volume:k}=n;return e.jsx("div",{className:Z.container,onClick:e=>{var t,a;(null===(a=null===(t=null==p?void 0:p.current)||void 0===t?void 0:t.contains)||void 0===a?void 0:a.call(t,null==e?void 0:e.target))||o&&o()},children:e.jsx(r.Modal,{onClose:o,ref:p,noBodyPadding:!0,size:"small",content:e.jsxs("div",{className:Z.content,children:[e.jsxs(r.Column,{gap:0,children:[O&&e.jsx(T,{src:u(O),width:1024,height:400,alt:x||"product",className:Z.image}),e.jsxs(r.Column,{className:Z.details,gap:1,children:[e.jsx("h2",{className:Z.name,children:x}),e.jsxs(r.Row,{justifyContent:"space-between",children:[e.jsx("div",{className:Z.price,children:C}),e.jsx("div",{className:Z.volume,children:k})]}),e.jsx("div",{className:Z.description,children:y})]})]}),e.jsx("div",{className:Z.close,children:e.jsx(r.IconButton,{onClick:o,icon:i.Close})})]}),footer:e.jsxs(r.Row,{className:Z.addToCart,gap:.5,children:[e.jsx(te,{isDecreaseDisabled:w,onDecrease:()=>N(-1),onIncrease:()=>N(1),quantity:m}),e.jsx(r.Button,{className:Z.addAction,label:e.jsxs(r.Row,{fullWidth:!0,justifyContent:"space-between",children:[e.jsx("span",{className:Z.actionTitle,children:A}),e.jsx("span",{children:P})]}),onClick:()=>{h?c(n,m):d(n,m),o&&o()},size:"xl",fullWidth:!0})]})})})};var re="Cart-module_container__3KQtx",ie="Cart-module_content__rkiZa",ne={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 oe=({actionText:t,onClick:i})=>{const n=J(),{formattedTotalPrice:o}=(()=>{const{cart:e}=q(),{currency:t,language:r}=j(),i=Object.values(e||{}).reduce(((e,{price:t,quantity:a,vat:r})=>e+V(t,a,r)),0);return{totalPrice:i,formattedTotalPrice:a.priceFormatter(i,t,r)}})();return e.jsxs(r.Flex,{className:a.classNames(ne,{container:!0,isClickable:!!i}),justifyContent:"space-between",alignItems:"center",onClick:i,children:[e.jsx(r.Flex.Item,{flex:1,children:e.jsxs(r.Row,{alignItems:"center",children:[e.jsx("div",{className:ne.count,children:n}),e.jsx("div",{className:ne.actionText,children:t})]})}),e.jsx(r.Flex.Item,{className:ne.totalPrice,flex:1,children:o})]})},se=()=>{const{setIsCartOpen:t}=q(),{t:a}=X();return J()<=0?null:e.jsx("div",{className:re,children:e.jsx("div",{className:ie,children:e.jsx(oe,{onClick:()=>t(!0),actionText:a("viewOrder")})})})};var le={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"},de="CartItem-module_container__At7lj",ce="CartItem-module_image__D-zzG",ue="CartItem-module_data__Lo3Fb",me="CartItem-module_name__EksZu",_e="CartItem-module_price__yJxl6";const he=e=>{var t;const{products:a}=j();return(null===(t=null==a?void 0:a.find)||void 0===t?void 0:t.call(a,(({id:t})=>t===e)))||{}},ge=({productId:t,min:a=1,size:r="md"})=>{const i=(e=>{const{cart:t}=q(),a=t[e];return(null==a?void 0:a.quantity)||1})(t),n=he(t),{updateProduct:o}=q(),s=i===a;return e.jsx(te,{isDecreaseDisabled:s,onDecrease:()=>o(n,i-1),onIncrease:()=>o(n,i+1),quantity:i,size:r})},pe=({item:a})=>{const{productId:i,quantity:n}=a||{},o=he(i),{language:s,currency:l}=j(),{image160:d}=o,{name:c}=t.useMemo((()=>U(o,s)),[o,s]),{formattedTotalPrice:m}=t.useMemo((()=>G(o,l,s,n)),[o,l,s,n]);return e.jsxs(r.Row,{className:de,gap:1,alignItems:"center",children:[d&&e.jsx(T,{src:u(d),alt:c||"menu",className:ce,loading:"lazy",width:80,height:45}),e.jsxs("div",{className:ue,children:[e.jsx("div",{className:me,children:c}),e.jsx("div",{className:_e,children:m})]}),e.jsx(ge,{productId:i,size:"sm",min:0})]})},ve=()=>{const{isCartOpen:i,cart:n,setIsCartOpen:o}=q(),s=t.useRef(),{t:l}=X(),d=a.isEmpty(n),c=()=>o(!1);return i?e.jsx("div",{className:le.container,onClick:e=>{var t,a;(null===(a=null===(t=null==s?void 0:s.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.jsx(r.Drawer,{ref:s,onClose:c,isOpen:i,title:l("Your order"),content:e.jsx("div",{className:le.content,children:d?e.jsx((()=>e.jsxs(r.Column,{className:le.noItems,fullWidth:!0,fullHeight:!0,alignItems:"center",justifyContent:"center",gap:0,children:[e.jsx(r.Text,{variant:"h2",children:l("Empty order")}),e.jsx(r.Description,{text:l("You don't have any items in your order")})]})),{}):e.jsx("div",{className:le.items,children:Object.keys(n||{}).map((t=>e.jsx(pe,{item:n[t]},t)))})}),footer:d?e.jsx(r.Button,{label:l("Add items"),onClick:c,type:r.UIElementType.PRIMARY,size:"xl",fullWidth:!0}):e.jsx(oe,{actionText:l("Subtotal")})})}):null},fe=t.memo((({categoryProductMap:a=[],currency:i,language:n,productBlocksRef:o,containerRef:s,onCategoryInView:l})=>{const[d,c]=t.useState(null);return t.useEffect((()=>{const e=new IntersectionObserver((e=>{var t;const a=((null===(t=null==s?void 0:s.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&&l(Number(r))}),{threshold:.5});return Object.entries(o.current||{}).forEach((([t,a])=>{a&&(a.setAttribute("data-category-id",t),e.observe(a))})),()=>{e.disconnect()}}),[o,s]),e.jsx(H,{children:e.jsxs("div",{className:W,children:[e.jsx(r.Column,{children:(a||[]).map((t=>{const{name:a}=((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)))||{}})(t,n),{id:s,products:l}=t;return e.jsxs("div",{className:M,ref:e=>o.current[s]=e,"data-category-id":s,children:[e.jsx("h2",{className:Q,children:a}),e.jsx("div",{className:F,children:e.jsx(r.Column,{gap:0,children:(l||[]).map((t=>e.jsx($,{product:t,currency:i,language:n,onClick:()=>c(t)},t.id)))})})]},s)}))}),e.jsx(ae,{product:d,onClose:()=>c(null)}),e.jsx(se,{}),e.jsx(ve,{})]})})}),((e,t)=>e.categoryProductMap===t.categoryProductMap&&e.currency===t.currency&&e.language===t.language));var xe="Branches-module_branches__sOuoV",je="Branches-module_list__vYoT2",ye="Branches-module_name__K0Z-4";const be=({branches:t=[],rootPath:a="",onBranchSelect:i})=>{const n=({children:t,id:r})=>i?e.jsx("div",{onClick:()=>i(r),children:t}):e.jsx("a",{href:`${a}/${r}`,children:t});return e.jsx("div",{className:xe,children:e.jsx(r.Container,{className:je,children:t.map((({id:t,name:a})=>e.jsx(n,{id:t,children:e.jsx(r.Card,{noBottomMargin:!0,children:e.jsx(r.Flex,{justifyContent:"center",alignItems:"center",fullHeight:!0,children:e.jsx("h2",{className:ye,children:a})})})},t)))})})},Ce=({data:a})=>{var r;const{name:i,coverImage:n,logoImage:l,branches:c=[],branchId:u,language:h,categories:g,products:f,currency:x,instagram:j,facebook:y,whatsapp:b,telegram:C,tiktok:I,rootPath:P,hostname:w,onBranchSelect:A}=a||{},N=c.length<=1,O=((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,f),k=(()=>{var e;return N?(null===(e=null==c?void 0:c[0])||void 0===e?void 0:e.id)?c[0]:{}:c.find((e=>e.id===Number(u)))})(),S=N||!(null==k?void 0:k.name)?i:(null==k?void 0:k.name)||"",[L,T]=t.useState(null===(r=null==g?void 0:g[0])||void 0===r?void 0:r.id),D=t.useRef({}),R=t.useRef(null),W=t.useRef(!0),{url:M,domain:Q}=((e,t)=>{const a=v.includes(e)?e:p;return{url:`https://${a}/${t||"en"}`,domain:a}})(w,h);return e.jsxs("div",{className:s,ref:R,children:[e.jsx(z,{branch:k,name:S,coverImage:_(n),logoImage:m(l),instagram:j,facebook:y,whatsapp:b,telegram:C,tiktok:I}),N||u?e.jsxs(e.Fragment,{children:[e.jsx(E,{categoryProductMap:O,language:h,selectedCategoryId:L,onSelectCategory:e=>o(void 0,void 0,void 0,(function*(){W.current=!1,T(e),(e=>{var t;const a=null===(t=null==D?void 0:D.current)||void 0===t?void 0:t[e];a&&(setTimeout((()=>{a.scrollIntoView({behavior:"smooth",block:"start"})}),100),setTimeout((()=>{W.current=!0}),1e3))})(e)}))}),e.jsx(fe,{currency:x,language:h,productBlocksRef:D,containerRef:R,categoryProductMap:O,onCategoryInView:e=>{(null==W?void 0:W.current)&&T(e)}})]}):e.jsx(be,{branches:c,onBranchSelect:A,rootPath:P}),!!w&&e.jsx("a",{rel:"noopener",target:"_blank",href:M,className:d,children:Q})]})};exports.PublicMenu=({data:t})=>e.jsx(x,{value:t,children:e.jsx(Ce,{data:t})});
2
2
  //# sourceMappingURL=index.js.map