{"version":3,"file":"SectorState.Dfmma0yV.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/OsgOEqWGc7KIL1cCtPXx/KprZCKxtYskgZDPGz4Rw/SectorState.js"],"sourcesContent":["/**\n * Create a new SectorState.tsx file with direct named Framer override HOCs:\n * withCommercialLoans, withAgribusiness, withResidentialLoans, withHomeLoans, and withSectorState.\n * Button overrides should preserve existing onClick, then store the sector in sessionStorage\n * (no navigation). withSectorState should read storage after mount, react to resize, and\n * apply an initial responsive variant outside RenderTarget.canvas without fighting in-component\n * SET_VARIANT interactions.\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{startTransition,useEffect,useState}from\"react\";import{RenderTarget}from\"framer\";const SECTOR_KEY=\"caseStudySector\";function normalizeSector(value){if(value===\"Commercial Loans\"||value===\"Construction Loans\"||value===\"Agribusiness\"||value===\"Residential Loans\"||value===\"Home Loans\"){return value;}return\"Commercial Loans\";}function breakpointSuffix(width){if(width<768)return\" Phone\";if(width<1200)return\" Tablet\";return\"\";}export function withCommercialLoans(Component){return function Inner(props){const handleClick=event=>{props.onClick?.(event);if(typeof window!==\"undefined\"&&RenderTarget.current()!==RenderTarget.canvas&&window.sessionStorage){window.sessionStorage.setItem(SECTOR_KEY,\"Commercial Loans\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function withConstructionLoans(Component){return function Inner(props){const handleClick=event=>{props.onClick?.(event);if(typeof window!==\"undefined\"&&RenderTarget.current()!==RenderTarget.canvas&&window.sessionStorage){window.sessionStorage.setItem(SECTOR_KEY,\"Construction Loans\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function withAgribusiness(Component){return function Inner(props){const handleClick=event=>{props.onClick?.(event);if(typeof window!==\"undefined\"&&RenderTarget.current()!==RenderTarget.canvas&&window.sessionStorage){window.sessionStorage.setItem(SECTOR_KEY,\"Agribusiness\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function withResidentialLoans(Component){return function Inner(props){const handleClick=event=>{props.onClick?.(event);if(typeof window!==\"undefined\"&&RenderTarget.current()!==RenderTarget.canvas&&window.sessionStorage){window.sessionStorage.setItem(SECTOR_KEY,\"Residential Loans\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function withHomeLoans(Component){return function Inner(props){const handleClick=event=>{props.onClick?.(event);if(typeof window!==\"undefined\"&&RenderTarget.current()!==RenderTarget.canvas&&window.sessionStorage){window.sessionStorage.setItem(SECTOR_KEY,\"Home Loans\");}};return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});};}export function withSectorState(Component){return function Inner(props){const[resolved,setResolved]=useState(undefined);const[isLockedToStoredVariant,setIsLockedToStoredVariant]=useState(true);useEffect(()=>{if(typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.canvas||!window.sessionStorage){return;}const updateVariant=()=>{if(!isLockedToStoredVariant)return;const sector=normalizeSector(window.sessionStorage.getItem(SECTOR_KEY));const suffix=breakpointSuffix(window.innerWidth);startTransition(()=>setResolved(`${sector}${suffix}`));};updateVariant();window.addEventListener(\"resize\",updateVariant);return()=>{window.removeEventListener(\"resize\",updateVariant);};},[isLockedToStoredVariant]);const handleClick=event=>{props.onClick?.(event);if(!isLockedToStoredVariant)return;startTransition(()=>setIsLockedToStoredVariant(false));};if(typeof window===\"undefined\"||RenderTarget.current()===RenderTarget.canvas||!window.sessionStorage){return /*#__PURE__*/_jsx(Component,{...props});}if(!isLockedToStoredVariant){return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick});}return /*#__PURE__*/_jsx(Component,{...props,onClick:handleClick,variant:resolved??props.variant});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withConstructionLoans\":{\"type\":\"reactHoc\",\"name\":\"withConstructionLoans\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withResidentialLoans\":{\"type\":\"reactHoc\",\"name\":\"withResidentialLoans\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withHomeLoans\":{\"type\":\"reactHoc\",\"name\":\"withHomeLoans\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAgribusiness\":{\"type\":\"reactHoc\",\"name\":\"withAgribusiness\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withSectorState\":{\"type\":\"reactHoc\",\"name\":\"withSectorState\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withCommercialLoans\":{\"type\":\"reactHoc\",\"name\":\"withCommercialLoans\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SectorState.map"],"mappings":"+LAOwK,SAAS,EAAgB,EAAM,CAAuJ,OAAnJ,IAAQ,oBAAoB,IAAQ,sBAAsB,IAAQ,gBAAgB,IAAQ,qBAAqB,IAAQ,aAAqB,EAAa,kBAAmB,CAAC,SAAS,EAAiB,EAAM,CAA2D,OAAvD,EAAM,IAAU,SAAY,EAAM,KAAW,UAAgB,EAAG,CAAC,SAAgB,EAAoB,EAAU,CAAC,OAAO,SAAe,EAAM,CAAC,IAAM,EAAY,GAAO,CAAC,EAAM,UAAU,CAAK,EAAY,IAAS,QAAa,EAAa,QAAQ,IAAI,EAAa,QAAQ,EAAO,gBAAgB,EAAO,eAAe,QAAQ,EAAW,kBAAkB,CAAG,EAAE,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,QAAQ,CAAW,CAAC,CAAE,CAAE,CAAC,SAAgB,EAAsB,EAAU,CAAC,OAAO,SAAe,EAAM,CAAC,IAAM,EAAY,GAAO,CAAC,EAAM,UAAU,CAAK,EAAY,IAAS,QAAa,EAAa,QAAQ,IAAI,EAAa,QAAQ,EAAO,gBAAgB,EAAO,eAAe,QAAQ,EAAW,oBAAoB,CAAG,EAAE,OAAoB,EAAK,EAAU,CAAC,GAAG,EAAM,QAAQ,CAAW,CAAC,CAAE,CAAE,CAAC,SAAgB,EAAiB,EAAU,CAAC,OAAO,SAAe,EAAM,CAAC,IAAM,EAAY,GAAO,CAAC,EAAM,UAAU,CAAK,EAA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