{"version":3,"file":"Password.BeQ833Dk.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/4eo765hW6qDaYFR1w33x/IwBDn2mDNfRzZHEJVkm2/Password.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";const brandColor=\"#000000\";const LOCK_DURATION=2*60*1e3;const MAX_ATTEMPTS=5;const PASSWORDS=[\"beartechpulse\"];const GOOGLE_APPS_SCRIPT_URL=\"https://script.google.com/macros/s/AKfycbyK9FCx6SoxvNL_4-WwZnDhAUsUBIe1eXeTXzPT9NvNYEXxWx9TnztQXvMghCPZNTo/exec\";const PROTECTED_SLUGS=[\"/packaging\",\"/packaging-dark\",\"/environmental\",\"/environmental-dark\",\"/ogimage\",\"/flavorflux\",\"/theaddress\",\"/spokesmith\"];export function withPasswordProtection(Component){const Wrapper=props=>{const currentPath=typeof window!==\"undefined\"?window.location.pathname:\"\";const isProtected=PROTECTED_SLUGS.some(slug=>currentPath.startsWith(slug));const[authenticated,setAuthenticated]=useState(false);const[showPassword,setShowPassword]=useState(false);const[error,setError]=useState(\"\");const[isLoading,setIsLoading]=useState(false);const[attempts,setAttempts]=useState(0);const[isLocked,setIsLocked]=useState(false);const[lockExpires,setLockExpires]=useState(null);const[countdown,setCountdown]=useState(0);useEffect(()=>{const stored=localStorage.getItem(\"lockExpires\");if(stored){const expires=parseInt(stored,10);if(Date.now()<expires){setIsLocked(true);setLockExpires(expires);}else localStorage.removeItem(\"lockExpires\");}},[]);useEffect(()=>{let timer;if(isLocked&&lockExpires){timer=setInterval(()=>{const timeLeft=lockExpires-Date.now();if(timeLeft<=0){setIsLocked(false);setAttempts(0);setError(\"\");setLockExpires(null);setCountdown(0);localStorage.removeItem(\"lockExpires\");clearInterval(timer);}else setCountdown(Math.ceil(timeLeft/1e3));},1e3);}return()=>clearInterval(timer);},[isLocked,lockExpires]);if(!isProtected||authenticated)return /*#__PURE__*/_jsx(Component,{...props});const handleSubmit=e=>{e.preventDefault();if(isLocked)return;setIsLoading(true);const inputPassword=e.currentTarget.elements.namedItem(\"password\").value;setTimeout(()=>{if(PASSWORDS.includes(inputPassword)){setAuthenticated(true);setError(\"\");fetch(GOOGLE_APPS_SCRIPT_URL,{method:\"POST\",mode:\"no-cors\",headers:{\"Content-Type\":\"application/json\"},body:JSON.stringify({passwordUsed:inputPassword,timestamp:new Date().toISOString(),page:window.location.href,userAgent:navigator.userAgent})}).catch(console.error);}else{const newAttempts=attempts+1;setAttempts(newAttempts);setError(\"Incorrect password. Please try again.\");if(newAttempts>=MAX_ATTEMPTS){const expires=Date.now()+LOCK_DURATION;setIsLocked(true);setLockExpires(expires);setCountdown(Math.ceil(LOCK_DURATION/1e3));localStorage.setItem(\"lockExpires\",expires.toString());setError(\"Too many attempts. Locked for 2 minutes.\");}}setIsLoading(false);},800);};return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",height:\"100vh\",width:\"100%\",backgroundImage:\"url('https://framerusercontent.com/images/syDxEAMDA8W3EZsqXsWAChHuOHs.jpg')\",backgroundSize:\"cover\",backgroundPosition:\"center\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",zIndex:2,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",height:\"100%\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",width:\"250px\",gap:\"10px\",backgroundColor:\"rgba(255,255,255,0.9)\",padding:\"20px\",borderRadius:\"8px\"},children:[/*#__PURE__*/_jsx(\"label\",{style:{fontSize:16,color:\"#000\"},children:\"Password:\"}),/*#__PURE__*/_jsx(\"input\",{type:showPassword?\"text\":\"password\",name:\"password\",disabled:isLocked,style:{padding:\"12px\",fontSize:\"16px\",borderRadius:\"4px\",border:\"1px solid #ccc\",width:\"100%\"}}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>setShowPassword(!showPassword),style:{background:\"none\",border:\"1px solid #ccc\",borderRadius:\"4px\",padding:\"4px\",cursor:\"pointer\",fontSize:\"12px\",color:brandColor},children:showPassword?\"HIDE PASSWORD\":\"SHOW PASSWORD\"}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",disabled:isLocked||isLoading,style:{padding:\"8px\",fontSize:\"16px\",borderRadius:\"4px\",border:\"none\",backgroundColor:brandColor,color:\"white\",cursor:isLocked?\"not-allowed\":\"pointer\"},children:isLoading?\"Submitting...\":\"Submit\"}),error&&/*#__PURE__*/_jsx(\"div\",{style:{color:\"red\",fontSize:\"14px\",textAlign:\"center\"},children:error})]}),/*#__PURE__*/_jsx(\"div\",{style:{marginTop:\"20px\",fontSize:\"13px\",color:\"#ccc\"},children:\"For access please contact Kevin\"})]})});};return Wrapper;}\nexport const __FramerMetadata__ = {\"exports\":{\"withPasswordProtection\":{\"type\":\"reactHoc\",\"name\":\"withPasswordProtection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Password.map"],"mappings":"qJAAgf,SAAgB,EAAuB,EAAU,CAA6tH,MAA9sH,IAAO,CAAC,IAAM,EAAmB,IAAS,OAAqC,GAAzB,EAAO,SAAS,SAAkB,EAAY,EAAgB,KAAK,GAAM,EAAY,WAAW,CAAI,CAAC,EAAO,CAAC,EAAc,GAAkBA,EAAS,EAAK,EAAO,CAAC,EAAa,GAAiBA,EAAS,EAAK,EAAO,CAAC,EAAM,GAAUA,EAAS,EAAE,EAAO,CAAC,EAAU,GAAcA,EAAS,EAAK,EAAO,CAAC,EAAS,GAAaA,EAAS,CAAC,EAAO,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAO,CAAC,EAAY,GAAgBA,EAAS,IAAI,EAAO,CAAC,EAAU,GAAcA,EAAS,CAAC,EAAgkD,OAA9jD,MAAc,CAAC,IAAM,EAAO,aAAa,QAAQ,aAAa,EAAE,GAAG,EAAO,CAAC,IAAM,EAAQ,SAAS,EAAO,EAAE,EA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