{"version":3,"file":"LifestyleDeepLink.B1DW4ATq.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/wcJA0YeRUEgQN55ljr2r/J3YK4PRnzYazk4nhWKJg/LifestyleTwoCardTest.js","https:/framerusercontent.com/modules/crbZjpMNkO2okZuowGeF/GZVkAx4k3StEsCZ3GlLJ/LifestyleDeepLink.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";import{useRouter,useCurrentRouteId}from\"framer\";const storageKey=\"kitchi-lifestyle-tab\";function setForwardedRef(ref,value){if(typeof ref===\"function\"){ref(value);}else if(ref){ref.current=value;}}// Keep shared cards in the current language, including Framer Preview.\nfunction useLifestyleDestination(){const router=useRouter();const routeId=useCurrentRouteId();const path=router.routes?.[routeId]?.path||\"/\";const english=/^\\/en(?:\\/|$)/.test(path);const destination=Object.entries(router.routes||{}).find(([,route])=>route.path===(english?\"/en/target\":\"/target\"));const href=path===\"/en\"?\"./en/target\":\"./target\";return{router,english,destinationId:destination?.[0],href};}function keepEnglishHref(root,href){const update=()=>{const links=root.matches(\"a\")?[root]:Array.from(root.querySelectorAll(\"a\"));for(const link of links){const previous=link.getAttribute(\"href\")||\"\";if(/\\/target(?:[?#]|$)/.test(previous)&&previous!==href){link.setAttribute(\"href\",href);}}};update();const observer=new MutationObserver(update);observer.observe(root,{subtree:true,childList:true,attributes:true,attributeFilter:[\"href\"]});return()=>observer.disconnect();}function withStoredTab(Component,tab){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const localRef=useRef(null);const destination=useLifestyleDestination();useEffect(()=>{const root=localRef.current;if(!root)return;const disconnect=destination.english?keepEnglishHref(root,destination.href):()=>{};const rememberTab=event=>{window.sessionStorage.setItem(storageKey,tab);if(destination.english&&destination.destinationId&&!event.metaKey&&!event.ctrlKey&&!event.shiftKey&&!event.altKey&&event.button===0){event.preventDefault();event.stopPropagation();destination.router.navigate(destination.destinationId);}};root.addEventListener(\"click\",rememberTab,true);return()=>{root.removeEventListener(\"click\",rememberTab,true);disconnect();};},[destination.english,destination.destinationId,destination.href]);const attachRef=node=>{localRef.current=node;setForwardedRef(forwardedRef,node);};return /*#__PURE__*/_jsx(Component,{ref:attachRef,...props});});}export function withHealthyLink(Component){return withStoredTab(Component,\"healthy\");}export function withLowSodiumLink(Component){return withStoredTab(Component,\"low-sodium\");}export function withMomKidsLink(Component){return withStoredTab(Component,\"mom-kids\");}export function withSeniorsLink(Component){return withStoredTab(Component,\"seniors\");}export function withBusinessLink(Component){return withStoredTab(Component,\"business\");}export function withTargetTab(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[variant,setVariant]=useState(props.variant);useEffect(()=>{const tab=window.sessionStorage.getItem(storageKey);const variants={healthy:\"Healthy\",\"low-sodium\":\"Low Sodium\",\"mom-kids\":\"Mom & Kids\",seniors:\"Seniors\",business:\"Business\"};if(tab&&variants[tab]){setVariant(variants[tab]);}window.sessionStorage.removeItem(storageKey);},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,variant:variant});});}const lifestyleTabByLabel=[[\"Healthy\",\"healthy\"],[\"Less Sodium\",\"low-sodium\"],[\"Low Sodium\",\"low-sodium\"],[\"Mom & Kids\",\"mom-kids\"],[\"Seniors\",\"seniors\"],[\"Restaurants\",\"business\"],[\"คนรักสุขภาพ\",\"healthy\"],[\"ผู้ที่ต้องควบคุมโซเดียม\",\"low-sodium\"],[\"คุณแม่และเด็ก\",\"mom-kids\"],[\"ผู้สูงอายุ\",\"seniors\"],[\"ธุรกิจร้านอาหาร\",\"business\"]];export function withLifestyleGroupLinks(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const localRef=useRef(null);const destination=useLifestyleDestination();useEffect(()=>{const root=localRef.current;if(!root)return;const disconnect=destination.english?keepEnglishHref(root,destination.href):()=>{};const rememberClickedTab=event=>{const target=event.target;const clickable=target?.closest(\"a, button, [role='link']\");if(!clickable||!root.contains(clickable))return;const label=(clickable.textContent||\"\").replace(/\\s+/g,\" \").trim();const match=lifestyleTabByLabel.find(([text])=>label.includes(text));if(match){window.sessionStorage.setItem(storageKey,match[1]);if(destination.english&&destination.destinationId&&!event.metaKey&&!event.ctrlKey&&!event.shiftKey&&!event.altKey&&event.button===0){event.preventDefault();event.stopPropagation();destination.router.navigate(destination.destinationId);}}};root.addEventListener(\"click\",rememberClickedTab,true);return()=>{root.removeEventListener(\"click\",rememberClickedTab,true);disconnect();};},[destination.english,destination.destinationId,destination.href]);const attachRef=node=>{localRef.current=node;setForwardedRef(forwardedRef,node);};return /*#__PURE__*/_jsx(Component,{ref:attachRef,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withBusinessLink\":{\"type\":\"reactHoc\",\"name\":\"withBusinessLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSeniorsLink\":{\"type\":\"reactHoc\",\"name\":\"withSeniorsLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLowSodiumLink\":{\"type\":\"reactHoc\",\"name\":\"withLowSodiumLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLifestyleGroupLinks\":{\"type\":\"reactHoc\",\"name\":\"withLifestyleGroupLinks\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHealthyLink\":{\"type\":\"reactHoc\",\"name\":\"withHealthyLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withTargetTab\":{\"type\":\"reactHoc\",\"name\":\"withTargetTab\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMomKidsLink\":{\"type\":\"reactHoc\",\"name\":\"withMomKidsLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LifestyleTwoCardTest.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef}from\"react\";import{withHealthyLink,withLowSodiumLink,withMomKidsLink,withSeniorsLink,withBusinessLink,withLifestyleGroupLinks}from\"https://framerusercontent.com/modules/wcJA0YeRUEgQN55ljr2r/J3YK4PRnzYazk4nhWKJg/LifestyleTwoCardTest.js\";const blogSlugByTitle={\"the-secret-behind-our-fresh-and-flavorful-dishes\":\"the-secret-behind-our-fresh-and-flavorful-dishes.\",\"5-must-try-signature-dishes-for-your-next-visit\":\"5-must-try-signature-dishes-for-your-next-visit.\",\"how-fresh-ingredients-transform-every-dishwe-erve\":\"how-fresh-ingredients-transform-every-dish-we-serve\",\"behind-the-kitchen-crafting-flavorful-dining-experiences\":\"behind-the-kitchen-crafting-flavorful-dining-experiences\"};function titleKey(value){return String(value??\"\").toLowerCase().trim().replace(/[^a-z0-9]+/g,\"-\").replace(/^-+|-+$/g,\"\");}export function withLifestyleFromUrl(Component){return Component;}export function withLifestyleLinkByText(Component){return withLifestyleGroupLinks(Component);}export function withHealthyCardLink(Component){return withHealthyLink(Component);}export function withLowSodiumCardLink(Component){return withLowSodiumLink(Component);}export function withMomKidsCardLink(Component){return withMomKidsLink(Component);}export function withSeniorsCardLink(Component){return withSeniorsLink(Component);}export function withBusinessCardLink(Component){return withBusinessLink(Component);}export function withMenuDetailLink(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"/menu/\"+encodeURIComponent(title):\"/menu\"});});}export function withMenuDetailNavigation(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"/menu/\"+encodeURIComponent(title):\"/menu\"});});}export function withMenuDetailNavigationRelative(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"./menu/\"+encodeURIComponent(title):\"./menu\"});});}export function withMenuDetailFromCardText(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const title=String(props.title??props.Title??\"\").trim();return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:title?\"/menu/\"+encodeURIComponent(title):\"/menu\"});});}export function withBlogDetailFromCardText(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const key=titleKey(props.Title??props.title);const slug=blogSlugByTitle[key];return /*#__PURE__*/_jsx(Component,{ref:ref,...props,href:slug?\"/blog/\"+slug:\"/blog\"});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withLifestyleLinkByText\":{\"type\":\"reactHoc\",\"name\":\"withLifestyleLinkByText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLowSodiumCardLink\":{\"type\":\"reactHoc\",\"name\":\"withLowSodiumCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBusinessCardLink\":{\"type\":\"reactHoc\",\"name\":\"withBusinessCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withLifestyleFromUrl\":{\"type\":\"reactHoc\",\"name\":\"withLifestyleFromUrl\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailNavigationRelative\":{\"type\":\"reactHoc\",\"name\":\"withMenuDetailNavigationRelative\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailNavigation\":{\"type\":\"reactHoc\",\"name\":\"withMenuDetailNavigation\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSeniorsCardLink\":{\"type\":\"reactHoc\",\"name\":\"withSeniorsCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBlogDetailFromCardText\":{\"type\":\"reactHoc\",\"name\":\"withBlogDetailFromCardText\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHealthyCardLink\":{\"type\":\"reactHoc\",\"name\":\"withHealthyCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMomKidsCardLink\":{\"type\":\"reactHoc\",\"name\":\"withMomKidsCardLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailLink\":{\"type\":\"reactHoc\",\"name\":\"withMenuDetailLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withMenuDetailFromCardText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