{"version":3,"file":"eventWindow.a-Bja-h8.mjs","names":["useState","useLayoutEffect","useEffect"],"sources":["https:/framerusercontent.com/modules/8eTkGukfZc4ERHQIvNHR/ejjNmHRHUFXgdoEXaMWQ/eventWindow.js"],"sourcesContent":["import{useEffect,useLayoutEffect,useState}from\"react\";const useIsoLayoutEffect=typeof window!==\"undefined\"?useLayoutEffect:useEffect;function todayAmsterdam(){// en-CA formats as YYYY-MM-DD\nreturn new Intl.DateTimeFormat(\"en-CA\",{timeZone:\"Europe/Amsterdam\",year:\"numeric\",month:\"2-digit\",day:\"2-digit\"}).format(new Date);}export function isInWindow(iso,when,today=todayAmsterdam()){if(when===\"all\"||!iso||!/^\\d{4}-\\d{2}-\\d{2}/.test(iso))return true;const day=iso.slice(0,10);return when===\"upcoming\"?day>=today:day<today;}// The list slot is the outermost single-child ancestor below the list itself\n// (component root → Framer's instance wrapper → item wrapper frame).\nexport function findListSlot(el){let slot=el;for(let i=0;i<4;i++){const parent=slot.parentElement;if(!parent||parent.childElementCount!==1)break;slot=parent;}return slot;}/**\n * Returns whether the item should render. Also hides the item's list slot in the\n * DOM, so hydration from a stale pre-rendered page (published on an earlier day)\n * still ends up correct.\n */export function useEventWindow(ref,date,when){const[visible,setVisible]=useState(()=>isInWindow(date,when));useIsoLayoutEffect(()=>{const el=ref.current;if(!el)return;const show=isInWindow(date,when);setVisible(show);el.style.display=show?\"flex\":\"none\";const slot=findListSlot(el);if(slot===el)return;const prev=slot.style.display;slot.style.display=show?prev:\"none\";return()=>{slot.style.display=prev;};},[date,when]);return visible;}/**\n * Hides an item and its Collection List slot while `hidden` is true, so no empty\n * grid cell or stack gap remains. For client-side filters (e.g. the News filter\n * bar); restores the previous inline display when shown again.\n */export function useHideListSlot(ref,hidden,...deps){useIsoLayoutEffect(()=>{const el=ref.current;if(!el||!hidden)return;const slot=findListSlot(el);const prevEl=el.style.display;const prevSlot=slot.style.display;el.style.display=\"none\";slot.style.display=\"none\";return()=>{el.style.display=prevEl;slot.style.display=prevSlot;};},[hidden,...deps]);}/**\n * One list for upcoming and past events (2026-09-24, /news-and-events): the list is sorted by\n * date ascending in Framer, and this moves past items after the upcoming ones, most recent\n * first, with CSS `order` on the item's list slot. Upcoming items keep order 0 (their date order).\n * ListLoadMore's countVisible mode follows this display order.\n */export function usePastLast(ref,date,enabled){useIsoLayoutEffect(()=>{const el=ref.current;if(!el||!enabled||!date||!/^\\d{4}-\\d{2}-\\d{2}/.test(date))return;const slot=findListSlot(el);if(slot===el)return;const prev=slot.style.order;// yyyymmdd → a later past date gets a smaller order, so it comes first\nslot.style.order=isInWindow(date,\"past\")?String(1e8-Number(date.slice(0,10).replace(/-/g,\"\"))):\"0\";return()=>{slot.style.order=prev;};},[date,enabled]);}export default null;\nexport const __FramerMetadata__ = {\"exports\":{\"EventWindow\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useEventWindow\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useHideListSlot\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"findListSlot\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isInWindow\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"usePastLast\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./eventWindow.map"],"mappings":"gIAAqI,SAAS,GAAgB,CAC9J,OAAO,IAAI,KAAK,eAAe,QAAQ,CAAC,SAAS,mBAAmB,KAAK,UAAU,MAAM,UAAU,IAAI,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,IAAI,CAAE,CAAC,SAAgB,EAAW,EAAI,EAAK,EAAM,EAAe,EAAE,CAAC,GAAG,IAAO,OAAO,CAAC,GAAK,CAAC,qBAAqB,KAAK,CAAG,EAAE,MAAO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