{"version":3,"file":"PasswordProtection.BiVDHPfj.mjs","names":["useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/ahqwDJBjGFYp3YFgJKXd/TSXeNhcskEbL8o7bylxa/PasswordProtection.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=\"eac08d025203a95727bc7c10567c327eb837c4f8c4b5ef18213edb8d35384176\"// 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\n;return function WithPasswordProtection(props){const[password,setPassword]=useState(\"\");const[showContent,setShowContent]=useState(false);const[showForm,setShowForm]=useState(false);useEffect(()=>{setShowForm(true);},[]);const handleSubmit=async event=>{event.preventDefault();const hashedPassword=await sha256(password);if(hashedPassword===hashedCorrectPassword){setShowContent(true);console.log(\"Password validation successful\");}else{alert(\"La password \\xe8 errata\");console.log(\"Incorrect password\");}};const formStyle={display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"300px\",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:\"#003D51\",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:\"Inserisci password\",style:inputStyle,value:password,onChange:e=>setPassword(e.target.value)}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:buttonStyle,children:\"Entra\"})]})})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withPasswordProtection\":{\"type\":\"reactHoc\",\"name\":\"withPasswordProtection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtection.map"],"mappings":"uIAAgY,SAAgB,EAAuB,EAAU,CAChb,OAAO,SAAgC,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,EAAE,EAAO,CAAC,EAAY,GAAgBA,EAAS,EAAK,EAAO,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAolC,OAAllC,MAAc,CAAC,EAAY,EAAI,CAAE,EAAE,CAAC,CAAC,EAAikC,EAAKC,EAAU,CAAC,SAAS,EAAyB,EAAK,EAAU,CAAC,GAAG,CAAK,CAAC,EAAe,EAAK,OAAO,CAAC,SAAS,KAAtpC,IAAO,CAAC,EAAM,eAAe,EAAiD,MAApB,EAAO,CAAQ,IAAsB,oEAAuB,EAAe,EAAI,EAAE,QAAQ,IAAI,gCAAgC,IAAQ,MAAM,sBAAyB,EAAE,QAAQ,IAAI,oBAAoB,EAAG,EAAg6B,MAAM,CAAn5B,QAAQ,OAAO,eAAe,SAAS,WAAW,SAAS,OAAO,QAAQ,QAAQ,KAAa,WAAW,kBAAkB,MAAM,MAAyxB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