{"version":3,"file":"PasswordProtectRemeber.CsQdaIwA.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/Q40gZrMx1cxdXHBalJIF/tNzbtg12ZMb5DrsgvLeR/PasswordProtectRemeber.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";const sha256=str=>{const encoder=new TextEncoder;const data=encoder.encode(str);return crypto.subtle.digest(\"SHA-256\",data).then(hashArray=>{const hashHex=Array.from(new Uint8Array(hashArray)).map(byte=>byte.toString(16).padStart(2,\"0\")).join(\"\");return hashHex;});};export function withPasswordProtection(Component){const hashedCorrectPassword=\"f9ef33811a16683fa1fd2bd2b6361483306d339b21aa49c5c214eda2d1bc001c\";// Encrypt your desired password using this link https://workat.tech/developer-tools/sha256-hash-generator than replace its value above, do not remove the double quotes\nreturn function WithPasswordProtection(props){const[password,setPassword]=useState(\"\");const[showContent,setShowContent]=useState(false);const[showForm,setShowForm]=useState(false);useEffect(()=>{const userPassword=localStorage.getItem(\"userPassword\");const checkPassword=async()=>{if(userPassword){const hashedUserPassword=await sha256(userPassword);if(hashedUserPassword===hashedCorrectPassword){setShowContent(true);console.log(\"Password validation successful\");}if(hashedUserPassword===hashedCorrectPassword2){setShowContent(true);console.log(\"Password validation successful\");}}setShowForm(true);};checkPassword();},[]);const handleSubmit=async event=>{event.preventDefault();const hashedPassword=await sha256(password);if(hashedPassword===hashedCorrectPassword){setShowContent(true);console.log(\"Password validation successful\");// Store the user input password in local storage\nlocalStorage.setItem(\"userPassword\",password);}if(hashedPassword===hashedCorrectPassword2){setShowContent(true);console.log(\"Password validation successful\");// Store the user input password in local storage\nlocalStorage.setItem(\"userPassword\",password);}else{console.log(\"Incorrect password\");}};const formStyle={display:\"flex\",justifyContent:\"center\",flexDirection:\"column\",alignItems:\"center\",height:\"60vh\",opacity:showForm?1:0,transition:\"opacity 1.6s ease\",width:\"100%\",backgroundImage:`url(https://framerusercontent.com/images/99TFvGeeUAr666VOKCnuivIKk.png?scale-down-to=1024)`,backgroundSize:\"cover\",backgroundPosition:\"center\"};const inputStyle={padding:\"10px\",borderRadius:\"10px 0 0 10px\",border:\"1px solid #ccc\",borderRight:\"none\",fontSize:\"16px\",width:\"200px\",fontFamily:\"Noto Sans\",maxWidth:\"100%\",height:\"45px\",outline:\"none\"};const buttonStyle={padding:\"11px 20px\",borderRadius:\"0 10px 10px 0\",border:\"none\",background:\"#1a1a1a\",color:\"#fff\",fontSize:\"16px\",fontFamily:\"Noto Sans\",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 wrapperStyle2={padding:\"0px 0px 15px 0px\",fontSize:\"27px\",color:\"#1a1a1a\",fontStyle:\"normal\",fontFamily:\"Noto Sans\",fontWeight:\"700\",height:\"fit\",textAlign:\"center\"};const subline={padding:\"15px 0px 40px 0px\",fontSize:\"16px\",fontStyle:\"normal\",color:\"#1a1a1a\",fontFamily:\"Noto Sans\",fontWeight:\"400\",height:\"20px\",textAlign:\"center\"};return /*#__PURE__*/_jsx(_Fragment,{children:showContent?/*#__PURE__*/_jsx(Component,{...props}):/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:formStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:wrapperStyle2,children:\"This content is password protected\"}),/*#__PURE__*/_jsxs(\"div\",{style:wrapperStyle,children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",placeholder:\"Enter password\",style:inputStyle,value:password,onChange:e=>setPassword(e.target.value)}),/*#__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=./PasswordProtectRemeber.map"],"mappings":"6HAAgY,SAAgB,EAAuB,EAAU,CAAC,IAAM,EAAsB,mEAC9c,OAAO,SAAgC,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,GAAG,CAAM,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,GAAM,CAE4uC,OAF3uC,MAAc,CAAC,IAAM,EAAa,aAAa,QAAQ,eAAe,EAAqB,SAAS,CAAC,GAAG,EAAa,CAAC,IAAM,EAAmB,MAAM,EAAO,EAAa,CAAI,IAAqB,IAAuB,EAAe,GAAK,CAAC,QAAQ,IAAI,iCAAiC,EAAK,IAAqB,yBAAwB,EAAe,GAAK,CAAC,QAAQ,IAAI,iCAAiC,EAAG,EAAY,GAAK,IAAkB,EAAG,EAAE,CAAC,CAEo0B,EAAKC,EAAU,CAAC,SAAS,EAAyB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,CAAc,EAAM,OAAO,CAAC,SAFx5B,KAAM,IAAO,CAAC,EAAM,gBAAgB,CAAC,IAAM,EAAe,MAAM,EAAO,EAAS,CAAI,IAAiB,IAAuB,EAAe,GAAK,CAAC,QAAQ,IAAI,iCAAiC,CACl0B,aAAa,QAAQ,eAAe,EAAS,EAAK,IAAiB,wBAAwB,EAAe,GAAK,CAAC,QAAQ,IAAI,iCAAiC,CAC7J,aAAa,QAAQ,eAAe,EAAS,EAAO,QAAQ,IAAI,qBAAqB,EAA69C,MAAz8C,CAAC,QAAQ,OAAO,eAAe,SAAS,cAAc,SAAS,WAAW,SAAS,OAAO,OAAO,QAAQ,EAAS,EAAE,EAAE,WAAW,oBAAoB,MAAM,OAAO,gBAAgB,6FAA6F,eAAe,QAAQ,mBAAmB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