PageSourceSearch

https://easyhealth.asia/_next/static/chunks/2wdprrqpft3ip.js

js easyhealth.asia collected 2026-10-06 16:44:02 UTC 29,067 bytes, 1 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,413561,e=>{"use strict";var t=e.i(843476),r=e.i(740459),l=e.i(783132),s=e.i(221579),a=e.i(526732),i=e.i(861745),n=e.i(948148),o=e.i(438847),c=e.i(271645),d=e.i(38625),u=e.i(351415);function m({title:e,children:r,id:l,className:s}){return(0,t.jsxs)("section",{id:l,className:s,children:[(0,t.jsx)("p",{className:"mb-4 font-bold text-lg lg:text-2xl",children:e}),r]})}var x=e.i(744705),g=e.i(733966),p=e.i(586268),h=e.i(913107),f=e.i(542010),y=e.i(482820),b=e.i(657688),v=e.i(732657);function w({category:e,type:r}){let l=(0,n.useTranslations)(),s=(0,i.useLocale)(),o=(0,x.useRouter)(),c=(0,x.usePathname)(),d=(0,a.useSession)(),{openCreateCustomMealModal:u,modalLink:m}=(0,g.useCreateCustomMeal)(),j=c.includes("/kiosk-flow"),N=(0,y.default)(e.byoCardTitle,s)??"",C=(0,y.default)(e.byoCardDescription,s)??"",S=e.byoCardImage?.url??e.image?.url??"/category-image-placeholder.png";return(0,t.jsxs)("button",{type:"button",onClick:function(){if(j)return void u();if("authenticated"!==d.status)return void o.push(`/sign-in?callbackUrl=${encodeURIComponent("/my-meals?create-custom-meal=1")}`);let{href:e}=m("/my-meals");o.push(e,{scroll:!1})},className:(0,f.cn)((0,v.productCard)({color:r}),"flex flex-col h-full text-left max-sm:flex-row max-sm:min-h-[7.5rem]"),children:[(0,t.jsxs)("div",{className:"relative aspect-square sm:w-auto max-sm:w-28 max-sm:shrink-0 cursor-pointer flex justify-end items-start overflow-hidden m-2 rounded-xl",children:[(0,t.jsx)(b.default,{fill:!0,src:S,sizes:"(max-width: 639px) 112px, 390px",alt:N,className:"object-cover group-hover:scale-105 transition-all"}),(0,t.jsxs)("div",{className:(0,f.cn)("relative m-2 inline-flex items-center gap-2 rounded-full px-3 py-1 text-xs font-semibold max-sm:m-1.5 max-sm:gap-1 max-sm:px-2 max-sm:text-[10px]","bg-white/85 text-primary-900"),children:[(0,t.jsx)(p.PlusCircleIcon,{className:"size-4 max-sm:size-3.5"}),(0,t.jsx)("span",{className:"line-clamp-1",children:l("website.myMeals.createMyMealButton")})]})]}),(0,t.jsxs)("div",{className:"p-4 flex flex-col gap-3 lg:gap-4 grow min-w-0 max-sm:py-2 max-sm:pr-3 max-sm:pl-0 max-sm:gap-1.5",children:[(0,t.jsx)("p",{className:"font-semibold text-base lg:text-xl line-clamp-1 max-sm:text-sm max-sm:line-clamp-2",children:N}),C?(0,t.jsx)("p",{className:"text-sm text-gray-500 line-clamp-3 max-sm:text-xs max-sm:line-clamp-1",children:C}):null,(0,t.jsx)("div",{className:"grow -my-2 max-sm:-my-1"}),(0,t.jsx)("div",{className:"border-t border-primary/20 pt-3 max-sm:border-0 max-sm:pt-0",children:(0,t.jsxs)("div",{className:"w-full inline-flex items-center justify-center gap-2 rounded-xl bg-primary text-white font-semibold py-3 text-base hover:bg-primary/80 transition-colors max-sm:gap-1.5 max-sm:py-2 max-sm:text-sm",children:[(0,t.jsx)(h.PlusIcon,{className:"size-5 max-sm:size-4"}),l("website.global.create",{default:"Create"})]})})]})]})}var j=e.i(926320),N=e.i(752637),C=e.i(953025),S=e.i(751914),k=e.i(39875),T=e.i(349967),E=e.i(567526),P=e.i(991388),A=e.i(329194),z=e.i(524302);let M=(0,f.tv)({slots:{base:"popover",dialog:"popover__dialog",heading:"popover__heading",trigger:"popover__trigger"}});var R=e.i(207487),D=e.i(758282),O=e.i(409059),I=e.i(424971),H=e.i(296662),q=e.i(559381),$=e.i(255590),F=e.i(273580);let B=(0,c.createContext)({}),L=({children:e,...r})=>{let l=c.default.useMemo(()=>M(),[]);return(0,t.jsx)(B,{value:{slots:l},children:(0,t.jsx)(R.DialogTrigger,{"data-slot":"popover-root",...r,children:e})})},_=({children:e,className:r,...l})=>{let{slots:s}=(0,c.use)(B);return(0,t.jsx)(B,{value:{slots:s},children:(0,t.jsx)(F.SurfaceContext,{value:{variant:"default"},children:(0,t.jsx)(O.Popover,{...l,className:(0,q.composeTwRenderProps)(r,s?.base()),children:e})})})},G=({children:e,className:r,...l})=>{let{slots:s}=(0,c.use)(B);return(0,t.jsx)(H.Pressable,{children:(0,t.jsx)($.dom.div,{className:(0,q.composeSlotClassName)(s?.trigger,r),"data-slot":"popover-trigger",role:"button",...l,children:e})})},V=Object.assign(L,{Root:L,Trigger:G,Dialog:({children:e,className:r,...l})=>{let{slots:s}=(0,c.use)(B);return(0,t.jsx)(R.Dialog,{"data-slot":"popover-dialog",...l,className:(0,q.composeSlotClassName)(s?.dialog,r),children:e})},Arrow:({children:e,className:r,...l})=>{let s=(0,t.jsx)("svg",{"data-slot":"popover-overlay-arrow",fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M0 0C5.48483 8 6.5 8 12 0Z"})}),a=c.default.isValidElement(e)?c.default.cloneElement(e,{"data-slot":"popover-overlay-arrow"}):s;return(0,t.jsx)(I.OverlayArrow,{"data-slot":"popover-overlay-arrow-group",...l,className:r,children:a})},Content:_,Heading:({children:e,className:r,...l})=>{let{slots:s}=(0,c.use)(B);return(0,t.jsx)(D.Heading,{slot:"title",...l,className:(0,q.composeSlotClassName)(s?.heading,r),children:e})}});
1var W=e.i(464377),Y=e.i(287159);let K=()=>{let[e,l]=(0,o.useQueryState)("diets[]",(0,o.parseAsArrayOf)((0,o.parseAsStringEnum)((0,P.enumKeys)(s.Diet)))),[a,i]=(0,o.useQueryState)("allergens[]",(0,o.parseAsArrayOf)((0,o.parseAsStringEnum)((0,P.enumKeys)(r.Allergen))).withDefault([])),{isOpen:c,onOpen:d,onClose:u,setOpen:m}=(0,W.useDisclosureCompat)(),x=(0,n.useTranslations)(),g=Object.entries(s.Diet).map(([e,t])=>({key:t,label:x(`enum.diet.${t}`)})),p=Object.entries(r.Allergen).map(([e,t])=>({key:t,label:t})),h=(e?.length??0)+(a?.length??0);return(0,t.jsxs)(V,{isOpen:c,onOpenChange:m,children:[(0,t.jsx)(G,{children:(0,t.jsxs)(z.Button,{size:"lg",variant:"bordered",className:"capitalize text-sm lg:text-md text-center font-normal px-3 lg:px-24 py-2 bg-primary-200 flex gap-2 text-brandAquamarine border-brandAquamarine",onPress:d,children:[(0,t.jsx)(Y.DietsFilterIcon,{className:"size-5"}),x("website.products.dietsAndAllergens"),h>0&&(0,t.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-xs bg-brandAquamarine text-white rounded-full",children:h})]})}),(0,t.jsx)(_,{placement:"bottom end",offset:10,className:"w-[600px] max-w-[calc(100vw-2rem)] p-4",style:{maxWidth:"min(600px, calc(100vw - 2rem))"},children:(0,t.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:x("website.products.diets")}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:x("website.products.filterDietsDescription")})]}),(0,t.jsx)("div",{className:"flex items-start gap-2 flex-wrap",children:g.map(r=>{let s=r.key,a=(e??[]).includes(s);return(0,t.jsx)(A.TooltipCompat,{content:r.label,children:(0,t.jsxs)("button",{type:"button",onClick:()=>{let t;(t=e??[]).includes(s)?l(t.filter(e=>e!==s)):l([...t,s])},className:`flex flex-col items-center gap-1 transition-all duration-200 ${a?"opacity-100":"opacity-50"}`,"aria-label":r.label,"aria-pressed":a,children:[(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)(b.default,{src:(0,N.iconURLForDiet)(s),alt:r.label,width:48,height:48,className:"rounded-full"})}),(0,t.jsx)("span",{className:"text-xs text-gray-700 text-center max-w-[60px] leading-tight",children:r.label})]})})})})]}),(0,t.jsx)("div",{className:"border-t border-gray-200"}),(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-gray-700",children:x("website.menu.allergens")}),(0,t.jsx)("p",{className:"text-xs text-gray-500",children:x("website.products.excludeAllergensDescription")})]}),(0,t.jsx)("div",{className:"flex items-start gap-2 flex-wrap",children:p.map(e=>{let r=e.key,l=(a??[]).includes(r);return(0,t.jsx)(A.TooltipCompat,{content:e.label,children:(0,t.jsxs)("button",{type:"button",onClick:()=>{let e;(e=a??[]).includes(r)?i(e.filter(e=>e!==r)):i([...e,r])},className:`flex flex-col items-center gap-1 transition-all duration-200 ${l?"opacity-100":"opacity-50"}`,"aria-label":e.label,"aria-pressed":l,children:[(0,t.jsx)("div",{className:"relative",children:(0,t.jsx)(b.default,{src:(0,N.iconURLForAllergen)(r),alt:e.label,width:48,height:48,className:"rounded-full"})}),(0,t.jsx)("span",{className:"text-xs text-gray-700 text-center max-w-[70px] leading-tight wrap-break-word",children:e.label})]})})})})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-2 border-t border-gray-200",children:[h>0&&(0,t.jsx)(z.Button,{onPress:function(){l(null),i(null)},variant:"light",color:"primary",size:"sm",className:"text-xs text-gray-600 hover:text-gray-900",children:x("website.products.clearFilters")}),(0,t.jsx)(z.Button,{onPress:u,color:"primary",size:"sm",className:"text-xs",children:x("website.products.applyFilters")})]})]})})]})},U=function({showDietAndAllergenFilters:e=!0}){let r=(0,n.useTranslations)(),[l,s]=(0,o.useQueryState)("q",o.parseAsString.withDefault("").withOptions({clearOnDefault:!0,throttleMs:200}));return(0,t.jsxs)("div",{className:"flex flex-col lg:flex-row gap-3 lg:gap-4 lg:items-center justify-between",children:[(0,t.jsx)(E.InputField,{placeholder:r("admin.global.search"),className:"lg:flex-1",classNames:{input:"text-sm lg:text-base",inputWrapper:"rounded-full border border-gray-300"},value:l??void 0,onChange:e=>{let t=e.target.value;s(t),""!==t&&(0,C.trackEvent)(S.TrackedEvent.Search,{search_term:t})},endContent:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[l&&(0,t.jsx)("button",{type:"button",onClick:()=>s(""),className:"flex items-center justify-center size-5 rounded-full hover:bg-gray-100 transition-colors","aria-label":"Clear search",children:(0,t.jsx)(T.XMarkIcon,{className:"size-4 text-gray-500"})}),(0,t.jsx)("div",{className:"flex items-center justify-center size-8 bg-white rounded-full shadow-sm",children:(0,t.jsx)(k.MagnifyingGlassIcon,{className:"size-5 text-gray-600"})})]})}),e&&(0,t.jsx)(K,{})]})},Q=()=>{let e=(0,n.useTranslations)();return(0,t.jsx)(d.FadeInOnce,{className:"rounded-xl bg-brandGreen/5 flex min-h-96 justify-center py-10 transform transition-all duration-500 ease-out",duration:.2,children:(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(Y.SearchOffIcon,{className:"fill-brandGreen size-64"}),(0,t.jsx)("h1",{className:"font-semibold text-3xl",children:e("website.global.resultNotFound")})]})})};var J=e.i(307163),Z=e.i(247103),X=e.i(852012);let ee=c.forwardRef(function({title:e,titleId:t,...r},l){return c.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor","aria-hidden":"true","data-slot":"icon",ref:l,"aria-labelledby":t},r),e?c.createElement("title",{id:t},e):null,c.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 9a.75.75 0 0 0-1.5 0v2.25H9a.75.75 0 0 0 0 1.5h2.25V15a.75.75 0 0 0 1.5 0v-2.25H15a.75.75 0 0 0 0-1.5h-2.25V9Z",clipRule:"evenodd"}))});function et({category:e,isSelected:r=!1,onClick:l,className:s}){let a=(0,i.useLocale)(),n=e.image,o="liked"===e.id,c="my-byo"===e.id;return(0,t.jsxs)("button",{type:"button",className:(0,f.cn)(er({selected:r}),s),onClick:l,"aria-pressed":r,"aria-label":`View ${e.name[a]} category`,children:[(0,t.jsx)("div",{className:"relative size-16 shrink-0 rounded-xl overflow-hidden",children:o?(0,t.jsx)("div",{className:`flex h-full w-full items-center justify-center ${r?"bg-white/15":"bg-red-50"}`,children:(0,t.jsx)(X.HeartIcon,{className:"size-8 text-red-500"})}):c?(0,t.jsx)("div",{className:`flex h-full w-full items-center justify-center ${r?"bg-white/15":"bg-primary-100"}`,children:(0,t.jsx)(ee,{className:`size-8 ${r?"text-white":"text-primary"}`})}):(0,t.jsx)(b.default,{fill:!0,src:n?.url||"/category-image-placeholder.png",sizes:"64px",alt:"",className:"object-cover"})}),(0,t.jsx)("span",{className:"min-w-0 flex-1 text-left text-xs leading-snug wrap-break-word line-clamp-2",children:e.name[a]})]})}let er=(0,f.tv)({base:"flex items-center gap-3 rounded-xl transition-all duration-300 px-2 py-1.5 w-full cursor-pointer border",variants:{selected:{true:"bg-primary text-white hover:bg-primary border-transparent",false:"bg-white text-gray-700 hover:bg-primary hover:text-white border-primary-300"}},defaultVariants:{selected:!1}}),el=(0,c.forwardRef)(({categories:e,activeCategory:r,onScrollToCategory:l,scrollToCategoryId:s,mobileStickyTopOffset:a=0},i)=>{let{containerRef:n,canScrollLeft:o,canScrollRight:d,scrollLeft:u,scrollRight:m,scrollToElement:x,updateScrollButtons:g}=function(){let e=(0,c.useRef)(null),[t,r]=(0,c.useState)(!1),[l,s]=(0,c.useState)(!1),a=(0,c.useCallback)(()=>{if(!e.current)return;let{scrollLeft:t,scrollWidth:l,clientWidth:a}=e.current;r(t>0),s(t<l-a-1)},[]),i=(0,c.useCallback)(()=>{e.current&&e.current.scrollBy({left:-400,behavior:"smooth"})},[]),n=(0,c.useCallback)(()=>{e.current&&e.current.scrollBy({left:400,behavior:"smooth"})},[]),o=(0,c.useCallback)(t=>{if(!e.current)return;let r=e.current.querySelector(t);r&&r.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[]);return(0,c.useEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(a);return r.observe(t),()=>{r.disconnect()}},[a]),{containerRef:e,canScrollLeft:t,canScrollRight:l,scrollLeft:i,scrollRight:n,scrollToElement:o,updateScrollButtons:a}}(),p=(0,c.useRef)(!1),h=(0,c.useRef)(!1),f=(0,c.useRef)(null),y=(0,c.useRef)(null);(0,c.useEffect)(()=>{let e=null,t=()=>{if(!h.current){h.current=!0;return}p.current=!0,e&&clearTimeout(e),e=setTimeout(()=>{p.current=!1},150)};return window.addEventListener("scroll",t,{passive:!0}),()=>{window.removeEventListener("scroll",t),e&&clearTimeout(e)}},[]),(0,c.useEffect)(()=>{if(!s||0===e.length||!(window.innerWidth>=1024))return;h.current=!1;let t=()=>{let e=y.current?.querySelector(`[data-category-id="${s}"]`);if(e&&y.current){let t=y.current,r=e.getBoundingClientRect(),l=t.getBoundingClientRect(),s=r.top<l.top+10,a=r.bottom>l.bottom-10;
1if(s||a){let e=l.height,s=r.height,a=r.top-l.top+t.scrollTop,i=t.scrollHeight-e,n=Math.max(0,Math.min(a-e/2+s/2,i));t.scrollTo({top:n,behavior:"smooth"})}}},r=setTimeout(t,400),l=setTimeout(t,800),a=setTimeout(()=>{t(),setTimeout(()=>{h.current=!0},500)},1200);return()=>{clearTimeout(r),clearTimeout(l),clearTimeout(a)}},[s,e.length]),(0,c.useEffect)(()=>{if(r)if(window.innerWidth<1024)x(`[data-category-id="${r}"]`);else{let e=()=>{let e=y.current?.querySelector(`[data-category-id="${r}"]`);if(e&&y.current){let t=y.current,r=t.clientHeight,l=t.scrollTop,s=0,a=e;for(;a&&a!==t;)s+=a.offsetTop,a=a.offsetParent;let i=e.parentElement;i&&(s+=parseInt(getComputedStyle(i).paddingTop)||0);let n=e.clientHeight||80,o=s+n,c=s>l+r,d=Math.max(0,Math.min(s-r/2+n/2,t.scrollHeight-r)),u=Math.abs(l+r/2-(s+n/2));(o<l||c||u>50)&&Math.abs(l-d)>5&&t.scrollTo({top:d,behavior:"smooth"})}},t=200,l=y.current?.querySelector(`[data-category-id="${r}"]`);if(l&&y.current){let e=y.current,r=e.clientHeight,s=e.scrollTop,a=0,i=l;for(;i&&i!==e;)a+=i.offsetTop,i=i.offsetParent;let n=l.parentElement;n&&(a+=parseInt(getComputedStyle(n).paddingTop)||0);let o=a+(l.clientHeight||80),c=a>s+r;(o<s||c)&&(t=50)}let s=setTimeout(()=>{if(p.current){let t=y.current?.querySelector(`[data-category-id="${r}"]`);if(t&&y.current){let r=y.current,l=r.clientHeight,s=r.scrollTop,a=0,i=t;for(;i&&i!==r;)a+=i.offsetTop,i=i.offsetParent;let n=t.parentElement;n&&(a+=parseInt(getComputedStyle(n).paddingTop)||0),(a+(t.clientHeight||80)<s||a>s+l)&&e()}return}e()},t);return()=>clearTimeout(s)}},[r,x]),(0,c.useEffect)(()=>{g()},[e,g]),(0,c.useEffect)(()=>{if(!i)return;let e=()=>{let e=window.innerWidth<1024?f.current:y.current;"function"==typeof i?i(e):i&&(i.current=e)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[i]);let b=e.sort((e,t)=>e.order-t.order),v=`calc(var(--navbar-height) + ${a}px)`;return 0===e.length?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{ref:f,"data-categories-grid":!0,className:"lg:hidden sticky z-10 bg-[var(--menu-sticky-bg)] py-3 border-b border-gray-200 transition-[top] duration-500 ease-in-out",style:{top:v},children:(0,t.jsx)("div",{className:"flex gap-3 overflow-x-auto px-4",children:Array.from({length:5}).map((e,r)=>(0,t.jsx)("div",{className:"flex h-20 w-52 shrink-0 items-center gap-3 rounded-xl bg-gray-200 px-1.5 py-1.5 animate-pulse"},r))})}),(0,t.jsx)("div",{ref:y,"data-categories-grid":!0,className:"hidden lg:block sticky top-[calc(var(--navbar-height)+1px)] self-start w-48 pr-2 border-r border-gray-200 z-10 bg-[var(--menu-sticky-bg)] max-h-[calc(100vh-var(--navbar-height))]",children:(0,t.jsx)("div",{className:"flex flex-col gap-2 py-4 px-1",children:Array.from({length:8}).map((e,r)=>(0,t.jsx)("div",{className:"w-full flex items-center gap-3 rounded-xl px-1.5 py-1.5 h-20 bg-gray-200 animate-pulse"},r))})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{ref:f,"data-categories-grid":!0,className:"lg:hidden sticky z-10 bg-[var(--menu-sticky-bg)] py-3 transition-[top] duration-500 ease-in-out",style:{top:v},children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("div",{ref:n,className:"flex gap-3 overflow-x-auto scrollbar-hide",style:{scrollBehavior:"smooth"},onScroll:g,children:b.map(e=>{let s=r===e.id;return(0,t.jsx)("div",{"data-category-id":e.id,className:"w-52 shrink-0",children:(0,t.jsx)(et,{category:e,isSelected:s,onClick:()=>l(e.id)})},e.id)})}),o&&(0,t.jsx)(z.Button,{isIconOnly:!0,size:"sm",variant:"primary",radius:"full",className:"absolute left-1 top-1/2 z-10 size-9 min-w-9 -translate-y-1/2 shadow-lg",onPress:u,"aria-label":"Scroll categories left",children:(0,t.jsx)(J.ChevronLeftIcon,{className:"size-4 shrink-0"})}),d&&(0,t.jsx)(z.Button,{isIconOnly:!0,size:"sm",variant:"primary",radius:"full",className:"absolute right-1 top-1/2 z-10 size-9 min-w-9 -translate-y-1/2 shadow-lg",onPress:m,"aria-label":"Scroll categories right",children:(0,t.jsx)(Z.ChevronRightIcon,{className:"size-4 shrink-0"})})]}),(0,t.jsx)("div",{className:"absolute left-0 right-0 h-4 pointer-events-none",style:{to
1p:"100%",background:"linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.05) 30%, transparent 100%)"}})]}),(0,t.jsx)("div",{ref:y,"data-categories-grid":!0,className:"hidden lg:block sticky top-[calc(var(--navbar-height)+1px)] self-start w-48 pr-2 border-r border-gray-200 z-10 bg-[var(--menu-sticky-bg)] max-h-[calc(100vh-var(--navbar-height))] overflow-y-auto",style:{scrollbarWidth:"thin",scrollbarColor:"#d1d5db transparent"},children:(0,t.jsx)("div",{className:"flex flex-col gap-2 py-4 px-1 items-center",children:b.map(e=>{let s=r===e.id;return(0,t.jsx)("div",{"data-category-id":e.id,className:"w-full flex justify-center",children:(0,t.jsx)(et,{category:e,isSelected:s,onClick:()=>{p.current=!0,setTimeout(()=>{p.current=!1},1e3),l(e.id)}})},e.id)})})})]})});el.displayName="CategoriesGrid";var es=e.i(389472);function ea({className:e}){let r=(0,n.useTranslations)();return(0,t.jsx)(x.Link,{href:"/meal-plans",className:(0,f.cn)("group block w-full rounded-2xl bg-primary-100 ring-1 ring-primary/15 px-4 py-4 lg:px-6 lg:py-5","transition-all duration-200","hover:bg-primary-200 active:bg-primary-300","hover:ring-primary/25 hover:ring-1","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-white",e),children:(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsx)("div",{className:"flex flex-col items-center gap-2 pt-0.5",children:(0,t.jsx)("div",{className:"size-10 rounded-xl bg-white ring-1 ring-primary/10 flex items-center justify-center transition-colors group-hover:bg-white/90",children:(0,t.jsx)(es.CalendarDaysIcon,{className:"size-6 text-primary"})})}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("p",{className:"font-semibold text-base lg:text-lg text-primary-900",children:r("website.menu.mealPlansPromo.title")}),(0,t.jsx)("p",{className:"text-sm lg:text-base text-gray-700 max-w-2xl",children:r("website.menu.mealPlansPromo.subtitle")})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-primary font-semibold shrink-0 pt-0.5",children:[(0,t.jsx)("span",{className:"hidden sm:inline",children:r("website.menu.mealPlansPromo.cta")}),(0,t.jsx)(Z.ChevronRightIcon,{className:"size-5 transition-transform duration-200 group-hover:translate-x-0.5"})]})]})})}e.s(["default",0,function({types:e,showDietAndAllergenFilters:x=!0,showMealPlansPromoBanner:g=!1,showByoCards:p=!0,showMyByoSection:h=!1}){let f=(0,n.useTranslations)(),[y,b]=(0,o.useQueryStates)({"diets[]":(0,o.parseAsArrayOf)((0,o.parseAsStringEnum)(Object.values(s.Diet))).withDefault([]),"allergens[]":(0,o.parseAsArrayOf)((0,o.parseAsStringEnum)(Object.values(r.Allergen))).withDefault([]),q:o.parseAsString.withDefault("")}),[C,S]=(0,o.useQueryState)("categoryId"),{branchId:k}=(0,u.useSessionDataContext)(),T=(0,a.useSession)(),E=(0,i.useLocale)(),[P,A]=(0,c.useState)([]),[z,M]=(0,c.useState)(!0),R=(0,c.useRef)(null),D=(0,c.useRef)(null),O=(0,c.useRef)({diets:y["diets[]"],allergens:y["allergens[]"],q:y.q}),I=(0,c.useRef)(!1),{activeCategory:H}=function({categories:e,navbarRef:t,categoryGridRef:r}){let[l,s]=(0,c.useState)(null);return(0,c.useEffect)(()=>{if(0===e.length)return;let a=()=>{let a=window.innerWidth>=1024,i=t?.current||document.querySelector("nav")||document.querySelector("header"),n=i?a?i.offsetHeight+50:r?.current?i.offsetHeight+r.current.offsetHeight+50:i.offsetHeight+150:a?100:180,o=null,c=1/0;e.forEach(e=>{let t=document.getElementById(`category-${e.id}`);if(t){let r=t.getBoundingClientRect(),l=Math.abs(r.top-n);r.bottom>0&&r.top<window.innerHeight&&l<c&&(c=l,o=e.id)}}),window.scrollY<200?o=e[0]?.id||null:window.scrollY+window.innerHeight>=document.documentElement.scrollHeight-200&&(o=e[e.length-1]?.id||null),o&&o!==l&&s(o)};return a(),window.addEventListener("scroll",a,{passive:!0}),()=>{window.removeEventListener("scroll",a)}},[e,l,t,r]),{activeCategory:l}}({categories:P,navbarRef:D,categoryGridRef:R});!function({scrollToCategoryId:e,categories:t,navbarRef:r,categoryGridRef:l}){let s=(0,c.useRef)(null);(0,c.useEffect)(()=>
1{if(!e||0===t.length||(s.current&&s.current!==e&&(s.current=null),s.current===e||!document.querySelector(`#category-${e}`)))return;let a=setTimeout(()=>{let t=document.querySelector(`#category-${e}`);if(!t)return;let a=t.getBoundingClientRect().top,i=window.scrollY,n=window.innerWidth>=1024,o=r?.current||document.querySelector("nav")||document.querySelector("header"),c=Math.max(0,Math.min(i+a-(o?n?o.offsetHeight+20:l?.current?o.offsetHeight+l.current.offsetHeight+20:o.offsetHeight+100:n?100:180),document.documentElement.scrollHeight-window.innerHeight));window.scrollTo({top:c,behavior:"smooth"}),s.current=e},100);return()=>{clearTimeout(a)}},[e,t,r,l])}({scrollToCategoryId:C,categories:P,navbarRef:D,categoryGridRef:R});let{scrollDirection:q,scrollY:$}=function(){let[e,t]=(0,c.useState)(null),r=(0,c.useRef)(0),[l,s]=(0,c.useState)(0);return(0,c.useEffect)(()=>{let e=()=>{let e=window.scrollY;s(e),Math.abs(e-r.current)>3&&(t(e>r.current?"down":"up"),r.current=e>0?e:0)};return r.current=window.scrollY,s(window.scrollY),window.addEventListener("scroll",e,{passive:!0}),()=>window.removeEventListener("scroll",e)},[]),{scrollDirection:e,scrollY:l}}(),F="authenticated"===T.status,B=(0,c.useRef)(null),[L,_]=(0,c.useState)(0),G=(0,c.useCallback)(async()=>{0===P.length&&M(!0);try{if(F)try{let t=e.some(e=>"MealPlan"!==e),r=e.includes("MealPlan"),s=(await (0,l.fetchCategoriesAndProducts)(k,{...y,"types[]":e})).data.data??[],a=[];if(t)for(let[e,t]of((await (0,l.fetchLikedProducts)({branchId:k,page:1,pageSize:100})).data.data??[]).entries())a.push({product:t,mealPlan:null,order:e});else if(r)for(let[e,t]of((await (0,l.fetchLikedMealPlans)({branchId:k,page:1,pageSize:100})).data.data??[]).entries())a.push({product:null,mealPlan:t,order:e});if(a.length>0&&(s=[{id:"liked",name:{[E]:f("website.favorites.title")},description:{en:"",th:""},order:-1,image:null,byoCardEnabled:!1,byoCardPosition:1,byoCardTitle:{en:"",th:""},byoCardDescription:{en:"",th:""},byoCardImage:null,items:a},...s]),h)try{let e=(await (0,l.fetchMyMeals)(k)).data.data??[];e.length>0&&(s=[{id:"my-byo",name:{en:f("website.kioskFlow.myByo",{defaultMessage:"My BYO Meals"}),th:f("website.kioskFlow.myByo",{defaultMessage:"เมนูออกแบบเองของฉัน"})},description:{en:"",th:""},order:-2,image:null,byoCardEnabled:!1,byoCardPosition:1,byoCardTitle:{en:"",th:""},byoCardDescription:{en:"",th:""},byoCardImage:null,items:e.map((e,t)=>({customMeal:e,product:null,mealPlan:null,order:t}))},...s])}catch(e){console.error("Failed to fetch my BYO meals:",e)}A(s)}catch{let t=await (0,l.fetchCategoriesAndProducts)(k,{...y,"types[]":e});A(t.data.data??[])}else{let t=await (0,l.fetchCategoriesAndProducts)(k,{...y,"types[]":e});A(t.data.data??[])}}catch(e){console.error("Failed to fetch categories:",e),A([])}finally{M(!1)}},[y,k,P.length,e,F,h,E,f]);(0,c.useEffect)(()=>{let e=document.querySelector("nav")||document.querySelector("header");e&&D.current!==e&&(D.current=e)},[]),(0,c.useEffect)(()=>{"loading"===T.status||k&&G()},[y["allergens[]"],y.q,y["diets[]"],k,G,T.status]),(0,c.useEffect)(()=>{let e=()=>{k&&G()};return window.addEventListener(j.LIKES_CHANGED_EVENT,e),()=>{window.removeEventListener(j.LIKES_CHANGED_EVENT,e)}},[k,G]),(0,c.useEffect)(()=>{let e={diets:y["diets[]"],allergens:y["allergens[]"],q:y.q};(JSON.stringify(e.diets)!==JSON.stringify(O.current.diets)||JSON.stringify(e.allergens)!==JSON.stringify(O.current.allergens)||e.q!==O.current.q)&&(I.current=!0,C&&S(null))},[y["allergens[]"],y.q,y["diets[]"],S]);let V=(0,c.useCallback)(e=>{S(e)},[S]);(0,c.useEffect)(()=>{let e=B.current;if(!e)return;function t(){_(e?.offsetHeight??0)}t();let r=new ResizeObserver(t);return r.observe(e),()=>r.disconnect()},[z,x]);let W="down"===q&&$>100,Y="sticky top-[var(--navbar-height)] z-20 bg-[var(--menu-sticky-bg)] pt-[var(--menu-sticky-pt)] pb-4 transition-all duration-500 ease-in-out shadow-[0_4px_6px_-6px_rgba(0,0,0,0.08)]";return z?(0,t.jsxs)(c.Fragment,{children:[(0,t.jsx)("div",{className:"lg:hidden flex flex-col gap-4",children:(0,t.jsx)(U,{showDietAndAllergenFilters:x})}),(0,t.jsxs)("div",{className:"flex flex-col lg:flex-row lg:gap-4",children:[(0,t.jsx)(el,{ref:R,categories:[],activeCategory:null,onScrollToCategory:()=>{},scrollToCategoryId:null}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col gap-8 lg:mt-0 mt-8",children:[(0,t.jsx)("div",{className:"hidden lg:block",children:(0,t.jsx)(U,{showDietAndAllergenFilters:x})}),(0,t.jsx)("div",{className:"flex flex-col gap-8",children:Array.from({length:3}).map((e,r)=>(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"h-8 w-48 bg-gray-200 rounded animate-pulse"}),(0,t.jsx)("div",{className:(0,N.productGrid)(),children:Array.from({length:4}).map((e,r)=>(0,t.jsx)(v.ProductCardSkeleton,{type:r%2?v.ProductCardType.Secondary:v.ProductCardType.Popular},r))})]},r))})]})]})]}):0===P.length?(0,t.jsxs)(c.Fragment,{children:[(0,t.jsx)(U,{showDietAndAllergenFilters:x}),g&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(ea,{})}),(0,t.jsx)(Q,{})]}):(0,t.jsxs)(c.Fragment,{children:[(0,t.jsx)("div",{ref:B,className:`-mx-4 px-4 lg:hidden flex flex-col gap-4 ${Y} ${W?"-translate-y-full opacity-0 pointer-events-none":"translate-y-0 opacity-100"}`,children:(0,t.jsx)(U,{showDietAndAllergenFilters:x})}),(0,t.jsxs)("div",{className:"flex flex-col lg:flex-row lg:gap-4",children:[(0,t.jsx)(el,{ref:R,categories:P,activeCategory:H,onScrollToCategory:V,scrollToCategoryId:C,mobileStickyTopOffset:W?0:L}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col gap-8 lg:mt-0 mt-8",children:[g&&(0,t.jsx)("div",{className:"lg:hidden",children:(0,t.jsx)(ea,{})}),(0,t.jsx)("div",{className:`hidden lg:block ${Y} ${W?"-translate-y-full opacity-0 pointer-events-none":"translate-y-0 opacity-100"}`,children:(0,t.jsx)(U,{showDietAndAllergenFilters:x})}),g&&(0,t.jsx)("div",{className:"hidden lg:block",children:(0,t.jsx)(ea,{})}),(0,t.jsx)("div",{className:"flex flex-col gap-8",children:P.flatMap((e,r)=>{let l=e.items,s=r%2?v.ProductCardType.Secondary:v.ProductCardType.Popular;if(!l?.length)return null;let a=!!(p&&e.byoCardEnabled&&e.byoCardTitle&&e.byoCardDescription),i=a&&0===e.by
1oCardPosition,n=a&&0!==e.byoCardPosition;return(0,t.jsx)(d.FadeInOnce,{children:(0,t.jsx)(m,{id:`category-${e.id}`,title:e.name[E],children:(0,t.jsxs)("div",{className:(0,N.productGrid)(),children:[i&&(0,t.jsx)(w,{category:e,type:s},`${e.id}-byo`),l.map(e=>e.customMeal?(0,t.jsx)(v.CustomMealCard,{customMeal:e.customMeal},e.customMeal.id):e.product?(0,t.jsx)(v.ProductCard,{product:e.product,type:s},e.product.id):e.mealPlan?(0,t.jsx)(v.MealPlanCard,{mealPlan:e.mealPlan,type:s},e.mealPlan.id):null),n&&(0,t.jsx)(w,{category:e,type:s},`${e.id}-byo`)]})})},e.id)})})]})]})]})}],413561)}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.