{"version":3,"file":"PasswordProtection_BME.C5vZ3B52.mjs","names":["_Fragment"],"sources":["https:/framerusercontent.com/modules/n1knVd95gUQDgimYAvoq/VneuBrz8ZFJWNRUbQosp/PasswordProtection_BME.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";import bcrypt from\"bcryptjs\";export function withPasswordProtection(Component){const hashedCorrectPassword=\"$2y$10$K6F3SpVyflDtl4JR8qhmyO6IHKWMHdxahRtqny.mA/Ngm6KIjZLJ6\";return function WithPasswordProtection(props){const[password,setPassword]=useState(\"\");const[showContent,setShowContent]=useState(false);const[showForm,setShowForm]=useState(true);const[errorMessage,setErrorMessage]=useState(\"\");useEffect(()=>{const userPassword=localStorage.getItem(\"userPassword\");if(userPassword){bcrypt.compare(userPassword,hashedCorrectPassword,(err,match)=>{if(err){console.error(\"Error comparing passwords:\",err);return;}if(match){setShowContent(true);console.log(\"Password validation successful\");}else{console.log(\"Incorrect password\");}});}},[]);const handlePasswordChange=event=>{setPassword(event.target.value);setErrorMessage(\"\")// Clear the error message on input change\n;};const handleSubmit=event=>{event.preventDefault();bcrypt.compare(password,hashedCorrectPassword,(err,match)=>{if(err){console.error(\"Error comparing passwords:\",err);return;}if(match){setShowContent(true);localStorage.setItem(\"userPassword\",password);}else{setErrorMessage(\"Incorrect password. Please try again.\")// Set the error message on incorrect password\n;}});};const formStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"100vh\",opacity:showForm?1:0,transition:\"opacity 1s ease\",width:\"100%\"};const inputStyle={padding:\"10px\",borderRadius:\"10px 0 0 10px\",border:\"1px solid #ccc\",borderRight:\"none\",fontSize:\"16px\",width:\"200px\",maxWidth:\"100%\",height:\"45px\",outline:\"none\"};const buttonStyle={padding:\"11px 20px\",borderRadius:\"0 10px 10px 0\",border:\"none\",background:\"#649DE8\",color:\"#fff\",fontSize:\"16px\",cursor:\"pointer\",boxShadow:\"none\",height:\"45px\"};const wrapperStyle={boxShadow:\"rgba(0, 0, 0, 0.26) 0px 0.637473px 1.147451px -1.125px, rgba(0, 0, 0, 0.24) 0px 1.930942px 3.475695px -2.25px, rgba(0, 0, 0, 0.192) 0px 5.104227px 9.187608px -3.375px, rgba(0, 0, 0, 0.03) 0px 16px 28.8px -4.5px\",borderRadius:\"10px\"};const errorTextStyle={color:\"red\",fontSize:\"14px\",textAlign:\"center\",marginTop:\"16px\",marginBottom:\"16px\"};return /*#__PURE__*/_jsx(_Fragment,{children:showContent?/*#__PURE__*/_jsx(Component,{...props}):/*#__PURE__*/_jsx(\"form\",{onSubmit:handleSubmit,style:formStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:wrapperStyle,children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",placeholder:\"Enter password\",style:inputStyle,value:password,onChange:handlePasswordChange}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:buttonStyle,children:\"Submit\"}),errorMessage&&/*#__PURE__*/_jsx(\"div\",{style:errorTextStyle,children:errorMessage})]})})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withPasswordProtection\":{\"type\":\"reactHoc\",\"name\":\"withPasswordProtection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtection_BME.map"],"mappings":"yPAAkJ,SAAgB,EAAuB,EAAU,CAAC,IAAM,EAAsB,+DAA+D,OAAO,SAAgC,EAAM,CAAC,GAAK,CAAC,EAAS,EAAY,CAAC,EAAS,GAAG,CAAM,CAAC,EAAY,EAAe,CAAC,GAAS,EAAM,CAAM,CAAC,EAAS,EAAY,CAAC,GAAS,EAAK,CAAM,CAAC,EAAa,EAAgB,CAAC,EAAS,GAAG,CAAC,EAAU,IAAI,CAAC,IAAM,EAAa,aAAa,QAAQ,eAAe,CAAC,AAAG,GAAc,EAAO,QAAQ,EAAa,EAAsB,CAAC,EAAI,IAAQ,CAAC,GAAG,EAAI,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