{"version":3,"file":"FilterKeepInView.CSlTlSBT.mjs","names":["_Fragment","__esmMin","init_ssg_sandbox_shims","l","c","init_jsx_runtime","init_npm_react_18_3_1","ce","window","RenderTarget","init_framer_D6uXRwWs","fkFindColumn","list","win","FK_COLUMN","i","fkHome","row","column","style","sticky","top","FK_PLAIN_TOP","fkInstall","root","timer","frame","release","glide","from","ms","home","start","last","step","y","now","t","onClick","e","el","chip","FK_CHIP","FK_ZONE","reduce","FilterKeepInView","init_FilterKeepInView"],"sources":["https:/framerusercontent.com/modules/6WVLbxZEsU5zl41XyRVq/f1Rts11y1VCk8w3Nkdhw/FilterKeepInView.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{RenderTarget}from\"framer\";/*\n * Filter Keep In View (renders nothing). Placed once on /sessions and once on /artists.\n *\n * A click on a filter chip makes the list shorter, so the page gets shorter. A visitor who had\n * scrolled down the list would land below it, with the filter column above the screen. After such\n * a click this helper brings the page back, so the column and the first results are in view.\n *\n * - Only real clicks count. The chip press of Programme Hash Filter is not one, so links such as\n *   /sessions#offering-team-energiser keep working as they do.\n * - Column sticky (Desktop): the page goes back to where the column reaches its sticky place.\n * - Column beside the list but not sticky (/sessions Tablet): same, just below the header.\n * - Column above the list (Phone, /artists Tablet): nothing. The chips sit right above the first\n *   result, so nothing moves away.\n * - At or above that point nothing happens, so a click from the top never moves the page.\n * - Finds its way by layer names, which are never translated: the column \"Filters\", the frame\n *   \"Empty state\" and the chip variants \"Default\" and \"Active\". Keep those names.\n * - Does nothing on the Framer canvas and during server rendering.\n * - Returns an empty fragment on purpose: Framer does not offer a file as a component when it\n *   returns null.\n */// CORE-START\nconst FK_COLUMN='[data-framer-name=\"Filters\"]';const FK_ZONE=FK_COLUMN+',[data-framer-name=\"Empty state\"]';const FK_CHIP='[data-framer-name=\"Default\"],[data-framer-name=\"Active\"]';const FK_PLAIN_TOP=96// Tablet header 72 + the same 24 px of air the sticky column has on Desktop\n;function fkFindColumn(win){const list=win.document.querySelectorAll(FK_COLUMN);for(let i=0;i<list.length;i++){if(list[i].getClientRects().length>0)return list[i];}return null;}/** The page position to go back to, or null when this layout has nothing to bring back. */function fkHome(win,column){const row=column.parentElement;if(!row)return null;const style=win.getComputedStyle(column);const sticky=style.position===\"sticky\";if(!sticky&&win.getComputedStyle(row).flexDirection!==\"row\")return null;const top=sticky?parseFloat(style.top)||0:FK_PLAIN_TOP;return Math.max(0,Math.round(row.getBoundingClientRect().top+win.scrollY-top));}function fkInstall(win){const root=win.document.documentElement;let timer=0;let frame=0;function release(){win.clearTimeout(timer);win.cancelAnimationFrame(frame);root.style.overflowAnchor=\"\";}// Moves the page frame by frame on purpose: Safari ends its own smooth scroll for good when the\n// list gets shorter under it, which would leave the visitor halfway. Never moves the page down.\nfunction glide(home){const from=win.scrollY;const ms=Math.min(700,250+(from-home)*.15);let start=0;let last=from;function step(now){const y=win.scrollY;if(y>last+2)return;// The visitor scrolls down, so the page is his again.\nstart=start||now;const t=Math.min(1,(now-start)/ms);last=Math.round(Math.min(y,from+(home-from)*(1-Math.pow(1-t,3))));win.scrollTo(0,last);if(t<1)frame=win.requestAnimationFrame(step);}frame=win.requestAnimationFrame(step);}function onClick(e){if(!e.isTrusted)return;const el=e.target;const chip=el&&el.closest?el.closest(FK_CHIP):null;if(!chip||!chip.closest(FK_ZONE))return;const column=fkFindColumn(win);const home=column?fkHome(win,column):null;if(home===null||win.scrollY<=home+1)return;const reduce=!!(win.matchMedia&&win.matchMedia(\"(prefers-reduced-motion: reduce)\").matches);// The list changes while the page moves. Scroll anchoring would pull the page around then.\nroot.style.overflowAnchor=\"none\";win.clearTimeout(timer);timer=win.setTimeout(release,1500);win.cancelAnimationFrame(frame);if(reduce)win.scrollTo(0,home);else glide(home);}win.addEventListener(\"click\",onClick,true);return()=>{win.removeEventListener(\"click\",onClick,true);release();};}// CORE-END\n/**\n * Filter Keep In View: invisible helper for the filter chips on /sessions and /artists.\n *\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function FilterKeepInView(){useEffect(()=>{if(RenderTarget.current()===RenderTarget.canvas)return;return fkInstall(window);},[]);return /*#__PURE__*/_jsx(_Fragment,{});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FilterKeepInView\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"1\",\"framerIntrinsicWidth\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FilterKeepInView.map"],"mappings":"A,yLAqBC,SAASW,EAAa,EAAI,CAAC,IAAMC,EAAKC,EAAI,SAAS,iBAAiBC,CAAS,EAAE,IAAI,IAAIC,EAAE,EAAEA,EAAEH,EAAK,OAAO,IAAK,GAAGA,EAAKG,EAAE,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE,OAAOH,EAAKG,GAAI,OAAO,IAAK,CAA4F,SAASC,EAAO,EAAI,EAAO,CAAC,IAAMC,EAAIC,EAAO,cAAc,GAAG,CAACD,EAAI,OAAO,KAAK,IAAME,EAAMN,EAAI,iBAAiBK,CAAM,EAAQE,EAAOD,EAAM,WAAW,SAAS,GAAG,CAACC,GAAQP,EAAI,iBAAiBI,CAAG,CAAC,CAAC,gBAAgB,MAAM,OAAO,KAAK,IAAMI,EAAID,EAAO,WAAWD,EAAM,GAAG,GAAG,EAAEG,EAAa,OAAO,KAAK,IAAI,EAAE,KAAK,MAAML,EAAI,sBAAsB,CAAC,CAAC,IAAIJ,EAAI,QAAQQ,CAAG,CAAC,CAAE,CAAC,SAASE,EAAU,EAAI,CAAC,IAAMC,EAAKX,EAAI,SAAS,gBAAoBY,EAAM,EAAMC,EAAM,EAAE,SAASC,GAAS,CAACd,EAAI,aAAaY,CA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