{"version":3,"file":"CaseStudyAccessGuard.CP8abaTg.mjs","names":[],"sources":["https:/framerusercontent.com/modules/t4ZIzvuyjHZtAXAY6ZGj/mFjEA2LokcogEPSPzPQX/CaseStudyAccessGuard.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";function normalizePath(path){const trimmed=(path||\"\").trim();if(!trimmed)return\"/\";const withSlash=trimmed.startsWith(\"/\")?trimmed:`/${trimmed}`;return withSlash.length>1?withSlash.replace(/\\/+$/,\"\"):withSlash;}function hasValidAccess(storageKey){try{const rawSession=window.localStorage.getItem(storageKey);if(!rawSession)return false;if(rawSession===\"granted\")return true;const session=JSON.parse(rawSession);const isGranted=session?.granted===true;const isUnexpired=typeof session?.expiresAt===\"number\"&&Date.now()<session.expiresAt;if(isGranted&&isUnexpired)return true;window.localStorage.removeItem(storageKey);return false;}catch(error){return false;}}/**\n * Case Study Access Guard\n *\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function CaseStudyAccessGuard(props){const{enabled=true,protectedPath=\"/homigo\",passwordPath=\"/password\",storageKey=\"homeigo-case-study-access\",previewLabel=\"Guard\",style}=props;React.useEffect(()=>{if(!enabled)return;if(RenderTarget.current()!==RenderTarget.preview)return;if(typeof window===\"undefined\")return;const currentPath=normalizePath(window.location.pathname);const lockedPath=normalizePath(protectedPath||\"/homigo\");const unlockPath=normalizePath(passwordPath||\"/password\");if(currentPath===unlockPath||currentPath!==lockedPath)return;if(!hasValidAccess(storageKey)){window.location.href=passwordPath||\"/password\";}},[enabled,protectedPath,passwordPath,storageKey]);if(RenderTarget.current()!==RenderTarget.canvas){return null;}return /*#__PURE__*/_jsx(\"div\",{style:{...style,width:\"100%\",height:\"100%\",borderRadius:6,border:\"1px solid rgba(232, 255, 156, 0.5)\",background:\"rgba(232, 255, 156, 0.12)\",color:\"rgba(232, 255, 156, 0.95)\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",fontFamily:\"DM Sans, Inter, system-ui, sans-serif\",fontSize:10,lineHeight:1,overflow:\"hidden\"},children:previewLabel});}addPropertyControls(CaseStudyAccessGuard,{enabled:{type:ControlType.Boolean,title:\"Enabled\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},protectedPath:{type:ControlType.String,title:\"Protected Page\",defaultValue:\"/homigo\"},passwordPath:{type:ControlType.String,title:\"Password Page\",defaultValue:\"/password\"},storageKey:{type:ControlType.String,title:\"Storage Key\",defaultValue:\"homeigo-case-study-access\"},previewLabel:{type:ControlType.String,title:\"Canvas Label\",defaultValue:\"Guard\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CaseStudyAccessGuard\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicHeight\":\"1\",\"framerIntrinsicWidth\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CaseStudyAccessGuard.map"],"mappings":"0LAAwI,SAAS,EAAc,EAAK,CAAC,IAAM,GAAS,GAAM,GAAA,CAAI,KAAK,EAAE,GAAG,CAAC,EAAQ,MAAM,IAAI,IAAM,EAAU,EAAQ,WAAW,GAAG,EAAE,EAAQ,IAAI,IAAU,OAAO,EAAU,OAAO,EAAE,EAAU,QAAQ,OAAO,EAAE,EAAE,CAAU,CAAC,SAAS,EAAe,EAAW,CAAC,GAAG,CAAC,IAAM,EAAW,EAAO,aAAa,QAAQ,CAAU,EAAE,GAAG,CAAC,EAAW,MAAO,GAAM,GAAG,IAAa,UAAU,MAAO,GAAK,IAAM,EAAQ,KAAK,MAAM,CAAU,EAAQ,EAAU,GAAS,UAAU,GAAW,EAAY,OAAO,GAAS,WAAY,UAAU,KAAK,IAAI,EAAE,EAA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