{"version":3,"file":"CmsFilterControls.VmGza-i0.mjs","names":["React.useRef","React.useState","React.useCallback"],"sources":["https:/framerusercontent.com/modules/wI1NWJiVBFGYXj2NnUPO/MDt2Nqb22cpMgwqOqlJ9/CmsFilterControls.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";// Register only menus using this reset override; unrelated search fields stay outside it.\nconst filterResetScopes=new WeakSet;function clearFilterSearch(button,menu){if(!menu.contains(button))return;const name=button.getAttribute(\"data-framer-name\")||\"\";if(!/clear.*filters/i.test(button.textContent||\"\")&&!name.startsWith(\"Filter by \"))return;const input=menu.querySelector('input[type=\"text\"],input[type=\"search\"]');const view=menu.ownerDocument.defaultView;if(!input||!view||!input.value)return;const setter=Object.getOwnPropertyDescriptor(view.HTMLInputElement.prototype,\"value\")?.set;setter?.call(input,\"\");input.dispatchEvent(new view.Event(\"input\",{bubbles:true}));input.dispatchEvent(new view.Event(\"change\",{bubbles:true}));}// Keep native Framer variables and pointer interactions as the source of truth.\n// Expose their rendered state and add Space support alongside native Enter/click.\nexport function withNativeFilterButton(Component){return /*#__PURE__*/React.forwardRef(function NativeFilterButton(props,forwardedRef){const root=React.useRef(null);const[state,setState]=React.useState({});React.useEffect(()=>{const button=root.current;if(!button)return;const update=()=>{const name=button.getAttribute(\"data-framer-name\")||\"\";const label=button.getAttribute(\"aria-label\")||\"\";const choice=button.querySelector('[data-framer-name=\"Active\"], [data-framer-name=\"Default\"]');const pressed=choice?choice.getAttribute(\"data-framer-name\")===\"Active\":undefined;const expanded=name===\"Pairing suggestions\"?/^hide\\s/i.test(button.textContent?.trim()||\"\"):/^(show|hide)\\s/i.test(label)&&/filter/i.test(label)?/^hide\\s/i.test(label):undefined;setState(previous=>previous.pressed===pressed&&previous.expanded===expanded?previous:{pressed,expanded});};update();const observer=new MutationObserver(update);observer.observe(button,{subtree:true,childList:true,characterData:true,attributes:true,attributeFilter:[\"data-framer-name\",\"aria-label\"]});return()=>observer.disconnect();},[]);const ref=React.useCallback(node=>{root.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;},[forwardedRef]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref,\"aria-pressed\":state.pressed,\"aria-expanded\":state.expanded,onKeyDown:event=>{props.onKeyDown?.(event);if(event.defaultPrevented||event.target!==event.currentTarget||event.key!==\" \")return;const activate=props.onTap||props.onClick||props.click;if(typeof activate!==\"function\")return;event.preventDefault();if(event.repeat)return;const button=event.currentTarget;for(let menu=button;menu;menu=menu.parentElement){if(filterResetScopes.has(menu)){clearFilterSearch(button,menu);break;}}activate(event,{point:{x:0,y:0}});}});});}// Framer's native filter reset updates results but can leave input text stale.\n// Keep the existing native events and clear only the search inside this menu.\nexport function withFilterInputReset(Component){return /*#__PURE__*/React.forwardRef(function FilterInputReset(props,forwardedRef){const root=React.useRef(null);React.useEffect(()=>{const menu=root.current;if(!menu)return;const clearSearch=event=>{const target=event.target;const button=target?.closest(\"button\");if(!button||!menu.contains(button))return;clearFilterSearch(button,menu);};filterResetScopes.add(menu);menu.addEventListener(\"click\",clearSearch,true);return()=>{menu.removeEventListener(\"click\",clearSearch,true);filterResetScopes.delete(menu);};},[]);const ref=React.useCallback(node=>{root.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;},[forwardedRef]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withNativeFilterButton\":{\"type\":\"reactHoc\",\"name\":\"withNativeFilterButton\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withFilterInputReset\":{\"type\":\"reactHoc\",\"name\":\"withFilterInputReset\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CmsFilterControls.map"],"mappings":"8IACoC,SAAS,EAAkB,EAAO,EAAK,CAAC,GAAG,CAAC,EAAK,SAAS,CAAM,EAAE,OAA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