{"version":3,"file":"PasswordProtection.DxbG489e.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/msIWfdimRZQWGpFsbmHB/oMtGPDxy13lLoULC2IY7/PasswordProtection.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$0azYpZcFZ2DXi0lMQYrF5eeK3pOzgpARQzFW4bPUpIGk7KcytFtmO\"// Encrypt your desired password using this link https://bcrypt.online than replace its value above, do not remove the double quotes\n;return function WithPasswordProtection(props){const[password,setPassword]=useState(\"\");const[showContent,setShowContent]=useState(false);const[showForm,setShowForm]=useState(false);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\");}});}setShowForm(true);},[]);const handlePasswordChange=event=>{setPassword(event.target.value);};const handleSubmit=event=>{event.preventDefault();bcrypt.compare(password,hashedCorrectPassword,(err,match)=>{if(err){console.error(\"Error comparing passwords:\",err);return;}if(match){setShowContent(true);console.log(\"Password validation successful\");localStorage.setItem(\"userPassword\",password);}else{console.log(\"Incorrect password\");}});};const formStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",textAlight:\"center\",height:\"95vh\",opacity:showForm?1:0,transition:\"opacity 1s ease\",width:\"100%\",padding:\"20px\"};const inputStyle={padding:\"18px 28px 18px 18px\",borderRadius:\"14px\",border:\"1px solid #cccccc\",fontSize:\"14px\",width:\"200px\",maxWidth:\"100%\",height:\"55px\",outline:\"none\",fontFamily:\"Figtree\"};const buttonStyle={padding:\"11px 20px\",borderRadius:\"14px\",border:\"none\",background:\"#10cfb8\",color:\"#fff\",fontSize:\"14px\",cursor:\"pointer\",boxShadow:\"none\",height:\"55px\",fontFamily:\"Figtree\",margin:\"0px 0px 0px 10px\"};const titleStyle={color:\"#fff\",fontSize:\"20px\",height:\"auto\",width:\"auto\",fontFamily:\"Figtree\"};const subtitleStyle={color:\"#747474\",fontSize:\"14px\",height:\"auto\",width:\"100%\",fontFamily:\"Figtree\",justifyContent:\"center\",alignItems:\"center\",textAlign:\"center\"};const wrapperStyle={alignItems:\"center\",borderRadius:\"10px\"};const lockbox={width:\"56px\",height:\"56px\",display:\"flex\",flexDirection:\"row\",justifyContent:\"center\",alignItems:\"center\",padding:\"20px 20px 20px 20px\",background:\"#141414\",overflow:\"visible\",alignContent:\"center\",flexWrap:\"nowrap\",gap:0,position:\"relative\",borderRadius:\"16px\",border:\"1px solid rgba(64, 64, 64, 0.55)\"};const titleSection={placeContent:\"center\",alignContent:\"center\",alignItems:\"center\",justifyContent:\"center\",display:\"flex\",flex:\"0 0 auto\",flexFlow:\"column\",gap:\"16px\",height:\"100vh\",overflow:\"hidden\",position:\"relative\",width:\"auto\",padding:\"20px\"};const inlineStyle={display:\"flex\",flexDirection:\"row\",justifyContent:\"center\",alignItems:\"center\"};const linkStyle={color:\"#fff\",fontSize:\"14px\",height:\"auto\",width:\"auto\",fontFamily:\"Figtree\"};return /*#__PURE__*/_jsx(_Fragment,{children:showContent?/*#__PURE__*/_jsx(Component,{...props}):/*#__PURE__*/_jsx(\"form\",{onSubmit:handleSubmit,style:formStyle,children:/*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:titleSection,children:[/*#__PURE__*/_jsx(\"div\",{style:lockbox,children:/*#__PURE__*/_jsxs(\"svg\",{xmlns:\"http://www.w3.org/2000/svg\",width:\"24\",height:\"24\",viewBox:\"0 0 24 24\",fill:\"none\",stroke:\"rgb(255, 255, 255)\",\"stroke-width\":\"2\",\"stroke-linecap\":\"round\",\"stroke-linejoin\":\"round\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"3\",y:\"11\",width:\"18\",height:\"11\",rx:\"2\",ry:\"2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M7 11V7a5 5 0 0 1 10 0v4\"})]})}),/*#__PURE__*/_jsx(\"p\",{style:titleStyle,children:\"This project is protected.\"}),/*#__PURE__*/_jsx(\"p\",{style:subtitleStyle,children:\"If you'd like to see it and don't have a password, please e-mail me to grab it.\"}),/*#__PURE__*/_jsxs(\"div\",{style:inlineStyle,children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",placeholder:\"Enter password\",style:inputStyle,value:password,onChange:handlePasswordChange}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:buttonStyle,children:\"Submit\"})]}),/*#__PURE__*/_jsx(\"a\",{style:linkStyle,href:\"https://fahd-ab.com/\",children:\"Never-mind, go back home\"})]})})})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withPasswordProtection\":{\"type\":\"reactHoc\",\"name\":\"withPasswordProtection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtection.map"],"mappings":"yPAAkJ,SAAgB,EAAuB,EAAU,CAAC,IAAM,EAAsB,+DAC/N,OAAO,SAAgC,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAC,MAAc,CAAC,IAAM,EAAa,aAAa,QAAQ,eAAe,CAAI,GAAc,EAAO,QAAQ,EAAa,GAAuB,EAAI,IAAQ,CAAC,GAAG,EAAI,CAAC,QAAQ,MAAM,6BAA6B,EAAI,CAAC,OAAW,GAAO,EAAe,GAAK,CAAC,QAAQ,IAAI,iCAAiC,EAAO,QAAQ,IAAI,qBAAqB,EAAI,CAAE,EAAY,GAAK,EAAG,EAAE,CAAC,CAAC,IAAM,EAAqB,GAAO,CAAC,EAAY,EAAM,OAAO,MAAM,EAAS,EAAa,GAAO,CAAC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