{"version":3,"file":"WithQueryParams.DHD7zLbD.mjs","names":[],"sources":["https:/framerusercontent.com/modules/lPYI16OnvYrZ2nhbDGeg/efBjvQCZZgbhxj5isQoU/WithQueryParams.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";// Learn more: https://www.framer.com/docs/guides/overrides/\nexport function withQueryParams(Component){const handleClick=e=>{e.preventDefault();const paramKey=\"brand_experience\";const paramValue=\"new\";const voucherParam=\"voucher_code\";const search=window.location.search;const urlParams=new URLSearchParams(search);const pathname=window.location.pathname;const isHomePage=pathname===\"/\"||pathname.includes(\"/home\");if(!urlParams.has(paramKey)||urlParams.get(paramKey)!==paramValue){urlParams.set(paramKey,paramValue);}const targetEl=e.target;let anchorEl;if(targetEl instanceof HTMLAnchorElement){anchorEl=targetEl;}else{anchorEl=targetEl.closest(\"a[href]\");}if(anchorEl){const ctaUrl=new URL(anchorEl.href);if(ctaUrl.searchParams.has(voucherParam)&&isHomePage){ctaUrl.searchParams.delete(voucherParam);}const prefix=ctaUrl.searchParams.has(voucherParam)||ctaUrl.searchParams.toString().length?\"&\":\"?\";const redirectUrl=ctaUrl.href+prefix+urlParams.toString();window.location.assign(redirectUrl);}};return props=>{return /*#__PURE__*/_jsx(Component,{onClick:handleClick,...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withQueryParams\":{\"type\":\"reactHoc\",\"name\":\"withQueryParams\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithQueryParams.map"],"mappings":"kHACA,SAAgB,EAAgB,EAAU,CAAC,IAAM,EAAY,GAAG,CAAC,EAAE,gBAAgB,CAAC,IAAM,EAAS,mBAAgD,EAAa,eAAqB,EAAO,EAAO,SAAS,OAAa,EAAU,IAAI,gBAAgB,EAAO,CAAO,EAAS,EAAO,SAAS,SAAe,EAAW,IAAW,KAAK,EAAS,SAAS,QAAQ,EAAI,CAAC,EAAU,IAAI,EAAS,EAAE,EAAU,IAAI,EAAS,GAAG,QAAY,EAAU,IAAI,EAAS,MAAW,CAAE,IAAM,EAAS,EAAE,OAAW,EAAiH,GAAxG,AAAkE,EAA/D,aAAoB,kBAA4B,EAAwB,EAAS,QAAQ,UAAU,CAAK,EAAS,CAAC,IAAM,EAAO,IAAI,IAAI,EAAS,KAAK,CAAI,EAAO,aAAa,IAAI,EAAa,EAAE,GAAY,EAAO,aAAa,OAAO,EAAa,CAAE,IAAM,EAAO,EAAO,aAAa,IAAI,EAAa,EAAE,EAAO,aAAa,UAAU,CAAC,OAAO,IAAI,IAAU,EAAY,EAAO,KAAK,EAAO,EAAU,UAAU,CAAC,EAAO,SAAS,OAAO,EAAY,GAAI,MAAO,IAA4B,EAAK,EAAU,CAAC,QAAQ,EAAY,GAAG,EAAM,CAAC,sBADj9B"}