{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/cmr3ZzIMH7ykVjVi0GzY/3x2PtvTZNoofNkSvjB3s/SecurePageProtectionv2.js"],
  "sourcesContent": ["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import{ControlType}from\"framer\";// IMPORTANT: Update this with your Cloudflare Worker URL\nconst WORKER_URL=\"https://shy-block-d95e.grantwang31.workers.dev\";export default function SecurePageProtection(props){const{pageName,children,overlayStyle}=props;const[isAuthenticated,setIsAuthenticated]=useState(false);const[isLoading,setIsLoading]=useState(true);const[password,setPassword]=useState(\"\");const[error,setError]=useState(\"\");// Authentication endpoints\nconst authEndpoint=`${WORKER_URL}/authenticate`;const validateEndpoint=`${WORKER_URL}/validate`;// Check existing token on component mount\nuseEffect(()=>{const checkAuth=async()=>{const token=sessionStorage.getItem(`auth_token_${pageName}`);if(token){try{const response=await fetch(validateEndpoint,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({token})});const data=await response.json();if(data.valid){setIsAuthenticated(true);}}catch(err){console.error(\"Token validation error:\",err);}}setIsLoading(false);};checkAuth();},[pageName,validateEndpoint]);const handleSubmit=async e=>{e.preventDefault();setError(\"\");try{const response=await fetch(authEndpoint,{method:\"POST\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({page:pageName,password})});const data=await response.json();if(data.success){// Store token in session storage\nsessionStorage.setItem(`auth_token_${pageName}`,data.token);setIsAuthenticated(true);}else{setError(data.message||\"Invalid password\");}}catch(err){setError(\"Authentication failed. Please try again.\");}};if(isLoading){return /*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"100vh\",width:\"100%\",position:\"fixed\",top:0,left:0,zIndex:1e3,backgroundColor:\"rgba(255, 255, 255, 0.9)\"},children:/*#__PURE__*/_jsx(\"div\",{className:\"loader\",children:\"Loading...\"})});}// Always render children, but overlay the auth form if not authenticated\nreturn /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\"},children:[children,!isAuthenticated&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100%\",height:\"100%\",backgroundColor:\"rgba(0, 0, 0, 0.7)\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",zIndex:1e3,...overlayStyle},children:/*#__PURE__*/_jsx(\"div\",{style:{maxWidth:\"400px\",width:\"90%\",padding:\"30px\",borderRadius:\"8px\",boxShadow:\"0 4px 20px rgba(0,0,0,0.2)\",backgroundColor:\"white\"},children:/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",value:password,onChange:e=>setPassword(e.target.value),placeholder:\"Enter password\",style:{width:\"100%\",padding:\"12px\",marginBottom:\"15px\",borderRadius:\"4px\",border:\"1px solid #ddd\",fontSize:\"16px\"},autoFocus:true}),error&&/*#__PURE__*/_jsx(\"p\",{style:{color:\"red\",marginBottom:\"15px\",textAlign:\"center\"},children:error}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{width:\"100%\",padding:\"12px\",backgroundColor:\"#000\",color:\"white\",border:\"none\",borderRadius:\"4px\",cursor:\"pointer\",fontSize:\"16px\",fontWeight:\"bold\"},children:\"Submit\"})]})})})]});}// Add property controls for use in Framer\nSecurePageProtection.propertyControls={pageName:{type:ControlType.String,title:\"Page Name\",defaultValue:\"project1\"},overlayStyle:{type:ControlType.Object,title:\"Overlay Style\",controls:{backgroundColor:{type:ControlType.Color,title:\"Backdrop Color\",defaultValue:\"rgba(0, 0, 0, 0.7)\"}}}};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SecurePageProtection\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SecurePageProtectionv2.map"],
  "mappings": "qEACA,IAAMA,EAAW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CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,CAChpCtB,EAAqB,iBAAiB,CAAC,SAAS,CAAC,KAAKwB,EAAY,OAAO,MAAM,YAAY,aAAa,UAAU,EAAE,aAAa,CAAC,KAAKA,EAAY,OAAO,MAAM,gBAAgB,SAAS,CAAC,gBAAgB,CAAC,KAAKA,EAAY,MAAM,MAAM,iBAAiB,aAAa,oBAAoB,CAAC,CAAC,CAAC",
  "names": ["WORKER_URL", "SecurePageProtection", "props", "pageName", "children", "overlayStyle", "isAuthenticated", "setIsAuthenticated", "ye", "isLoading", "setIsLoading", "password", "setPassword", "error", "setError", "authEndpoint", "validateEndpoint", "ue", "token", "err", "handleSubmit", "e", "data", "p", "u", "ControlType"]
}
