{"version":3,"file":"PasswordProtectedNew.B9NoXoy-.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/vqWVXBzH3HE8a9lgu5Py/2Y1592CAT0eBDNa3kKyy/PasswordProtectedNew.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";export function withPasswordProtection(Component){const hashedCorrectPassword=\"$2y$10$9C8Xk9ytWLIBB2.638gWr.pGYWCFS/q7u2Tg3wg5LhoNoJ5uP1fb2\";return function WithPasswordProtection(props){const[password,setPassword]=useState(\"\");const[showContent,setShowContent]=useState(false);const[showForm,setShowForm]=useState(false);const[isBrowser,setIsBrowser]=useState(false);useEffect(()=>{// Mark that we're now in the browser\nsetIsBrowser(true);// Only attempt to validate stored password after component mounts in browser\nconst userPassword=localStorage.getItem(\"userPassword\");if(userPassword){// Import bcrypt dynamically only in the browser\nimport(\"bcryptjs\").then(bcryptModule=>{const bcrypt=bcryptModule.default;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();// Only run in browser\nif(isBrowser){// Import bcrypt dynamically\nimport(\"bcryptjs\").then(bcryptModule=>{const bcrypt=bcryptModule.default;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\");}});});}};// Rest of your styles remain the same\nconst 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:\"#000\",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\"};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\"})]})})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withPasswordProtection\":{\"type\":\"reactHoc\",\"name\":\"withPasswordProtection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtectedNew.map"],"mappings":"iLAAqH,SAAgB,EAAuB,EAAU,CAAC,IAAM,EAAsB,+DAA+D,OAAO,SAAgC,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAMsS,OANrS,MAAc,CACnf,EAAa,GAAK,CAClB,IAAM,EAAa,aAAa,QAAQ,eAAe,CAAI,GAC3D,OAAO,yBAAY,K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