{"version":3,"file":"Collection_Filters_Master.BCfbZvTR.mjs","names":["useState","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/hpVDdwY4AMP215Waiuor/6twUy1fMvj3gYo5vhV9q/Collection_Filters_Master.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";// --- PART 1: PAGE DETECTION (Watches vs Jewellery) ---\nconst isWatches=slug=>{return slug.includes(\"watch\")||slug.includes(\"timepiece\");};const isJewellery=slug=>{return slug.includes(\"saint\")||slug.includes(\"amor\")||slug.includes(\"bon\")||slug.includes(\"essentials\")||slug.includes(\"love\")||slug.includes(\"engagement\")||slug.includes(\"jewel\");};function getCurrentSlug(){if(typeof window===\"undefined\")return\"\";const parts=window.location.pathname.split(\"/\");return(parts[parts.length-1]||parts[parts.length-2]||\"\").toLowerCase();}export function ShowOnlyOnWatches(props){const slug=getCurrentSlug();if(!isWatches(slug))return{visible:false,style:{display:\"none\"}};return{};}export function ShowOnlyOnJewellery(props){const slug=getCurrentSlug();if(!isJewellery(slug))return{visible:false,style:{display:\"none\"}};return{};}// --- PART 2: SMART BRAND DETECTION (Fixed) ---\nfunction useIsFilterActive(brandName){const[isActive,setIsActive]=useState(false);const searchString=brandName.toLowerCase();const checkFilters=()=>{if(typeof window===\"undefined\")return;const urlParams=new URLSearchParams(window.location.search);let found=false;// CHECK 1: Look for simple URL parameters (matches your specific link)\n// Checks ?collection=Audemars+Piguet OR ?brand=Audemars+Piguet\nconst collectionParam=urlParams.get(\"collection\");const brandParam=urlParams.get(\"brand\")// Just in case\n;const vendorParam=urlParams.get(\"vendor\")// Just in case\n;if(collectionParam&&collectionParam.toLowerCase().includes(searchString))found=true;if(brandParam&&brandParam.toLowerCase().includes(searchString))found=true;if(vendorParam&&vendorParam.toLowerCase().includes(searchString))found=true;// CHECK 2: Look for Complex JSON filters (matches the Plugin logic)\nconst filterParam=urlParams.get(\"filters\");if(!found&&filterParam){try{const filters=JSON.parse(filterParam);// Check all relevant groups\nconst groupsToCheck=[filters[\"product-tag\"],filters[\"product-type\"],filters[\"collection\"],filters[\"variant\"],filters[\"brand\"],filters[\"vendor\"]];for(const group of groupsToCheck){if(group&&group.active&&group.values){if(group.values.some(val=>typeof val===\"string\"&&val.toLowerCase().includes(searchString)||typeof val===\"object\"&&val.optionValue&&val.optionValue.toLowerCase().includes(searchString))){found=true;break;}}}}catch(e){// Ignore parsing errors\n}}setIsActive(found);};useEffect(()=>{checkFilters();// Listen to everything possible to catch the update\ndocument.addEventListener(\"product-filter-change\",checkFilters);window.addEventListener(\"popstate\",checkFilters)// Back button\n;window.addEventListener(\"pushstate\",checkFilters)// Framer navigation\n;// Interval check (safety net for slow loading params)\nconst interval=setInterval(checkFilters,500);return()=>{document.removeEventListener(\"product-filter-change\",checkFilters);window.removeEventListener(\"popstate\",checkFilters);window.removeEventListener(\"pushstate\",checkFilters);clearInterval(interval);};},[]);return isActive;}// --- PART 3: THE OVERRIDES ---\nexport function ShowIfAudemarsSelected(props){if(!useIsFilterActive(\"Audemars Piguet\"))return{visible:false,style:{display:\"none\"}};return{};}export function ShowIfRolexSelected(props){if(!useIsFilterActive(\"Rolex\"))return{visible:false,style:{display:\"none\"}};return{};}export function ShowIfPatekSelected(props){if(!useIsFilterActive(\"Patek\"))return{visible:false,style:{display:\"none\"}};return{};}export function ShowIfCartierSelected(props){if(!useIsFilterActive(\"Cartier\"))return{visible:false,style:{display:\"none\"}};return{};}export function ShowIfRichardMilleSelected(props){if(!useIsFilterActive(\"Richard\"))return{visible:false,style:{display:\"none\"}};return{};}export function ShowIfVacheronSelected(props){if(!useIsFilterActive(\"Vacheron\"))return{visible:false,style:{display:\"none\"}};return{};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withShowOnlyOnWatches(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowOnlyOnWatches(props)});};}withShowOnlyOnWatches.displayName=\"ShowOnlyOnWatches\";export function withShowOnlyOnJewellery(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowOnlyOnJewellery(props)});};}withShowOnlyOnJewellery.displayName=\"ShowOnlyOnJewellery\";export function withShowIfAudemarsSelected(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowIfAudemarsSelected(props)});};}withShowIfAudemarsSelected.displayName=\"ShowIfAudemarsSelected\";export function withShowIfRolexSelected(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowIfRolexSelected(props)});};}withShowIfRolexSelected.displayName=\"ShowIfRolexSelected\";export function withShowIfPatekSelected(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowIfPatekSelected(props)});};}withShowIfPatekSelected.displayName=\"ShowIfPatekSelected\";export function withShowIfCartierSelected(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowIfCartierSelected(props)});};}withShowIfCartierSelected.displayName=\"ShowIfCartierSelected\";export function withShowIfRichardMilleSelected(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowIfRichardMilleSelected(props)});};}withShowIfRichardMilleSelected.displayName=\"ShowIfRichardMilleSelected\";export function withShowIfVacheronSelected(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ShowIfVacheronSelected(props)});};}withShowIfVacheronSelected.displayName=\"ShowIfVacheronSelected\";\nexport const __FramerMetadata__ = {\"exports\":{\"ShowIfRolexSelected\":{\"type\":\"override\",\"name\":\"ShowIfRolexSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowOnlyOnWatches\":{\"type\":\"reactHoc\",\"name\":\"withShowOnlyOnWatches\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowIfRichardMilleSelected\":{\"type\":\"reactHoc\",\"name\":\"withShowIfRichardMilleSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowIfCartierSelected\":{\"type\":\"reactHoc\",\"name\":\"withShowIfCartierSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowIfRichardMilleSelected\":{\"type\":\"override\",\"name\":\"ShowIfRichardMilleSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowOnlyOnWatches\":{\"type\":\"override\",\"name\":\"ShowOnlyOnWatches\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowIfAudemarsSelected\":{\"type\":\"override\",\"name\":\"ShowIfAudemarsSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowOnlyOnJewellery\":{\"type\":\"reactHoc\",\"name\":\"withShowOnlyOnJewellery\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowIfAudemarsSelected\":{\"type\":\"reactHoc\",\"name\":\"withShowIfAudemarsSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowIfPatekSelected\":{\"type\":\"reactHoc\",\"name\":\"withShowIfPatekSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowIfVacheronSelected\":{\"type\":\"override\",\"name\":\"ShowIfVacheronSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowIfVacheronSelected\":{\"type\":\"reactHoc\",\"name\":\"withShowIfVacheronSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowIfPatekSelected\":{\"type\":\"override\",\"name\":\"ShowIfPatekSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowIfCartierSelected\":{\"type\":\"override\",\"name\":\"ShowIfCartierSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withShowIfRolexSelected\":{\"type\":\"reactHoc\",\"name\":\"withShowIfRolexSelected\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowOnlyOnJewellery\":{\"type\":\"override\",\"name\":\"ShowOnlyOnJewellery\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Collection_Filters_Master.map"],"mappings":"+LACkS,SAAS,GAAgB,CAAC,GAAU,IAAS,OAAY,MAAM,GAAG,IAAM,EAAM,EAAO,SAAS,SAAS,MAAM,IAAI,CAAC,OAAO,EAAM,EAAM,OAAO,IAAI,EAAM,EAAM,OAAO,IAAI,IAAI,aAAa,CAAE,SAAgB,EAAkB,EAAM,CAA8F,OAA7D,EAArB,GAAgB,CAAoB,CAAoD,EAAE,CAA/C,CAAC,QAAQ,GAAM,MAAM,CAAC,QAAQ,OAAO,CAAC,CAAW,SAAgB,EAAoB,EAAM,CAAgG,OAA/D,EAArB,GAAgB,CAAsB,CAAoD,EAAE,CAA/C,CAAC,QAAQ,GAAM,MAAM,CAAC,QAAQ,OAAO,CAAC,CACrvB,SAAS,EAAkB,EAAU,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAO,EAAa,EAAU,aAAa,CAAO,MAAiB,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAU,IAAI,gBAAgB,EAAO,SAAS,OAAO,CAAK,EAAM,GAE3P,EAAgB,EAAU,IAAI,aAAa,CAAO,EAAW,EAAU,IAAI,QAAQ,CAClF,EAAY,EAAU,IAAI,SAAS,CACtC,GAAiB,EAAgB,aAAa,CAAC,SAAS,EAAa,GAAC,EAAM,IAAQ,GAAY,EAAW,aAAa,CAAC,SAAS,EAAa,GAAC,EAAM,IAAQ,GAAa,EAAY,aAAa,CAAC,SAAS,EAAa,GAAC,EAAM,IACtO,IAAM,EAAY,EAAU,IAAI,UAAU,CAAC,GAAG,CAAC,GAAO,EAAa,GAAG,CAAC,IAAM,EAAQ,KAAK,MAAM,EAAY,CACtG,EAAc,CAAC,EAAQ,eAAe,EAAQ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