{"version":3,"file":"GlowFilters.chRypRL-.mjs","names":["React.useRef","React.useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","c","init_jsx_runtime","ce","de","setFilter","label","EVENT","normalise","value","withFilterPill","ref","setLabel","active","setActive","text","current","onChange","e","Component","props","withFilterableGrid","apply","filter","grid","categories","cell","show","init_GlowFilters"],"sources":["https:/framerusercontent.com/modules/kym1qZryiAee2W4hD9Qi/zUvNU30gNzI1iADj4MNN/GlowFilters.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";const EVENT=\"gw-filter-change\";function setFilter(label){if(typeof window===\"undefined\")return;window.__gwFilter=label;window.dispatchEvent(new CustomEvent(EVENT,{detail:label}));}function normalise(value){return value.trim().toLowerCase();}// Attach to each filter pill. Reads its own text label on mount.\n// Clicking broadcasts the label; \"All\" clears the filter.\n// Inactive pills dim slightly so the active choice is visible.\nexport function withFilterPill(Component){return props=>{const ref=React.useRef(null);const[label,setLabel]=React.useState(\"\");const[active,setActive]=React.useState(false);React.useEffect(()=>{if(typeof window===\"undefined\")return;const text=ref.current?.textContent?.trim()||\"\";setLabel(text);const current=window.__gwFilter||\"All\";setActive(normalise(current)===normalise(text));const onChange=e=>{const value=e.detail||\"All\";setActive(normalise(value)===normalise(text));};window.addEventListener(EVENT,onChange);return()=>window.removeEventListener(EVENT,onChange);},[]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,onClick:()=>label&&setFilter(label),style:{cursor:\"pointer\",opacity:active?1:.55,transition:\"opacity .3s\",width:\"fit-content\",height:\"fit-content\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}// Attach to the directory grid. Hides cards whose first small\n// category label does not include the active filter.\nexport function withFilterableGrid(Component){return props=>{const ref=React.useRef(null);React.useEffect(()=>{if(typeof window===\"undefined\")return;const apply=()=>{const filter=normalise(window.__gwFilter||\"All\");const grid=ref.current?.firstElementChild;if(!grid)return;const cells=Array.from(grid.children);cells.forEach(cell=>{const tag=cell.querySelector(\"p, h6, span\");const raw=tag?.textContent||\"\";const categories=raw.split(\"\\xb7\").map(normalise);const show=filter===\"all\"||categories.includes(filter);cell.style.display=show?\"\":\"none\";});};apply();window.addEventListener(EVENT,apply);return()=>window.removeEventListener(EVENT,apply);},[]);return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{width:\"100%\"},children:/*#__PURE__*/_jsx(Component,{...props})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withFilterPill\":{\"type\":\"reactHoc\",\"name\":\"withFilterPill\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFilterableGrid\":{\"type\":\"reactHoc\",\"name\":\"withFilterableGrid\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GlowFilters.map"],"mappings":"A,8IAAsG,SAASW,EAAU,EAAM,CAAWN,IAAS,SAAmB,EAAO,WAAWO,EAAMP,EAAO,cAAc,IAAI,YAAYQ,EAAM,CAAC,OAAOD,CAAK,CAAC,CAAC,EAAE,CAAC,SAASE,EAAU,EAAM,CAAC,OAAOC,EAAM,KAAK,CAAC,CAAC,YAAY,CAAE,CAGvT,SAAgBC,EAAe,EAAU,CAAC,MAAO,IAAO,CAAC,IAAMC,EAAIjB,EAAa,IAAI,EAAO,CAACY,EAAMM,GAAUjB,EAAe,EAAE,EAAO,CAACkB,EAAOC,GAAWnB,EAAe,EAAK,EAAqZ,OAAnZQ,MAAoB,CAAC,GAAUJ,IAAS,OAAY,OAAO,IAAMgB,EAAKJ,EAAI,SAAS,aAAa,KAAK,GAAG,GAAGC,EAASG,CAAI,EAAE,IAAMC,EAAQjB,EAAO,YAAY,MAAMe,EAAUN,EAAUQ,CAAO,IAAIR,EAAUO,CAAI,CAAC,EAAE,IAAME,EAAS,GAAG,CAAC,IAAMR,EAAMS,EAAE,QAAQ,MAAMJ,EAAUN,EAAUC,CAAK,IAAID,EAAUO,CAAI,CAAC,CAAE,EAA0C,OAAxCh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