{"version":3,"file":"ProgrammaContactLinkOverride.BEsHp05S.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/Z4eDvVImT6MMCihKY7bX/RftpF5psPvqVCXxion1E/ProgrammaContactLinkOverride.js"],"sourcesContent":["// Create a minimal Framer code override named withProgrammaContactLink for the native “Bespreek dit programma” button: on click/tap, read current pathname, use final path segment as CMS slug, URL-encode it, navigate to /contact?programma=<slug>, preserve existing behavior/presentation/accessibility, and fall back to original behavior when no usable slug exists.\n// Add a second minimal override named withProgrammaHiddenField for the native hidden field “Programma”: after mount and internal navigation, read programma from window.location.search, set the wrapped native input value to decoded query value (or clear it when missing/empty), then dispatch bubbling input and change events.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";function getEncodedProgrammaSlug(pathname){const segments=pathname.split(\"/\").filter(Boolean);const finalSegment=segments[segments.length-1];if(!finalSegment)return null;try{const decodedSegment=decodeURIComponent(finalSegment);const trimmed=decodedSegment.trim();if(!trimmed)return null;return encodeURIComponent(trimmed);}catch{const trimmed=finalSegment.trim();if(!trimmed)return null;return encodeURIComponent(trimmed);}}export function withProgrammaContactLink(Component){return /*#__PURE__*/forwardRef(function ProgrammaContactLinkOverride(props,ref){const{onClick,onTap,...rest}=props;const goToProgrammaContact=()=>{if(typeof window===\"undefined\")return false;const encodedSlug=getEncodedProgrammaSlug(window.location.pathname);if(!encodedSlug)return false;const target=`/contact?programma=${encodedSlug}`;window.history.pushState({},\"\",target);window.dispatchEvent(new PopStateEvent(\"popstate\"));return true;};const handleClick=event=>{const navigated=goToProgrammaContact();if(navigated){event.preventDefault();return;}onClick?.(event);};const handleTap=event=>{const navigated=goToProgrammaContact();if(navigated){event.preventDefault();return;}onTap?.(event);};return /*#__PURE__*/_jsx(Component,{ref:ref,...rest,onClick:handleClick,onTap:handleTap});});}export function withProgrammaHiddenField(Component){return /*#__PURE__*/forwardRef(function ProgrammaHiddenFieldOverride(props,ref){const inputRef=useRef(null);const assignRefs=useCallback(node=>{inputRef.current=node;if(!ref)return;if(typeof ref===\"function\"){ref(node);return;}ref.current=node;},[ref]);const syncInputFromQuery=useCallback(()=>{if(typeof window===\"undefined\")return;const input=inputRef.current;if(!input)return;const params=new URLSearchParams(window.location.search);const value=params.get(\"programma\");const nextValue=value&&value.trim()?value:\"\";if(input.value===nextValue)return;input.value=nextValue;input.dispatchEvent(new Event(\"input\",{bubbles:true}));input.dispatchEvent(new Event(\"change\",{bubbles:true}));},[]);useEffect(()=>{if(typeof window===\"undefined\")return;const originalPushState=window.history.pushState;const originalReplaceState=window.history.replaceState;const handleLocationUpdate=()=>{syncInputFromQuery();};window.history.pushState=function(...args){originalPushState.apply(window.history,args);window.dispatchEvent(new Event(\"framer:locationchange\"));};window.history.replaceState=function(...args){originalReplaceState.apply(window.history,args);window.dispatchEvent(new Event(\"framer:locationchange\"));};syncInputFromQuery();window.addEventListener(\"popstate\",handleLocationUpdate);window.addEventListener(\"framer:locationchange\",handleLocationUpdate);return()=>{window.history.pushState=originalPushState;window.history.replaceState=originalReplaceState;window.removeEventListener(\"popstate\",handleLocationUpdate);window.removeEventListener(\"framer:locationchange\",handleLocationUpdate);};},[syncInputFromQuery]);return /*#__PURE__*/_jsx(Component,{ref:assignRefs,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withProgrammaHiddenField\":{\"type\":\"reactHoc\",\"name\":\"withProgrammaHiddenField\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withProgrammaContactLink\":{\"type\":\"reactHoc\",\"name\":\"withProgrammaContactLink\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProgrammaContactLinkOverride.map"],"mappings":"qJAEsG,SAAS,EAAwB,EAAS,CAAC,IAAM,EAAS,EAAS,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO,EAAQ,EAAa,EAAS,EAAS,OAAO,GAAG,GAAG,CAAC,EAAa,OAAO,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