{"version":3,"file":"Auth.Dig9zgPR.mjs","names":["useState","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/gmhC23nPKZ3UNIHN0Umk/sShJD4xsFfEUAfSMWhXy/Auth.js"],"sourcesContent":["// Creates a Framer code override named `requireAuth` that password-protects pages with a shared 30-day localStorage session, show/hide password toggle, inline errors, return-home link, and editable text/style constants.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useMemo,useState}from\"react\";import{createPortal}from\"react-dom\";const PASSWORD=\"2026portfolio-bshin!\";const SESSION_KEY=\"bshin_portfolio_auth\";const SESSION_DURATION_MS=30*24*60*60*1e3;const TEXT_CONTENT={subtitle:\"Password Protected\",helperPrefix:\"Request to view my work: \",helperLinkLabel:\"email\",passwordPlaceholder:\"Password\",submitLabel:\"Enter\",showLabel:\"Show\",hideLabel:\"Hide\",errorMessage:\"Incorrect password. Please try again.\",returnToHomeLabel:\"Return to Home\"};const STYLE_TOKENS={colors:{background:\"#FCFAF7\",textPrimary:\"#000000\",textMuted:\"#666666\",buttonBackground:\"#000000\",buttonText:\"#FFFFFF\",border:\"#CCCCCC\",error:\"#D8512A\"},spacing:{xs:8,sm:12,md:16,lg:20,xl:28},radius:8,maxWidth:400,fontSize:{title:28,subtitle:15,body:14,input:15,button:15,link:14},tracking:{title:\"-0.02em\"},borderWidth:1};function readValidSession(){if(typeof window===\"undefined\")return false;try{const raw=window.localStorage.getItem(SESSION_KEY);if(!raw)return false;const parsed=JSON.parse(raw);return typeof parsed?.expiresAt===\"number\"&&parsed.expiresAt>Date.now();}catch{return false;}}function writeSession(){if(typeof window===\"undefined\")return;const payload={expiresAt:Date.now()+SESSION_DURATION_MS};window.localStorage.setItem(SESSION_KEY,JSON.stringify(payload));}export function requireAuth(Component){return /*#__PURE__*/forwardRef(function RequireAuthOverride(props,ref){const[isCheckingSession,setIsCheckingSession]=useState(true);const[isAuthenticated,setIsAuthenticated]=useState(false);const[passwordInput,setPasswordInput]=useState(\"\");const[showPassword,setShowPassword]=useState(false);const[error,setError]=useState(\"\");useEffect(()=>{const valid=readValidSession();startTransition(()=>{setIsAuthenticated(valid);setIsCheckingSession(false);});},[]);useEffect(()=>{if(typeof document===\"undefined\")return;if(isCheckingSession||isAuthenticated)return;const previousOverflow=document.body.style.overflow;document.body.style.overflow=\"hidden\";return()=>{document.body.style.overflow=previousOverflow;};},[isCheckingSession,isAuthenticated]);const handleSubmit=useCallback(event=>{event.preventDefault();if(passwordInput===PASSWORD){writeSession();startTransition(()=>{setIsAuthenticated(true);setError(\"\");setPasswordInput(\"\");});return;}startTransition(()=>{setError(TEXT_CONTENT.errorMessage);});},[passwordInput]);const handleInputChange=useCallback(event=>{const next=event.target.value;startTransition(()=>{setPasswordInput(next);if(error)setError(\"\");});},[error]);const togglePasswordVisibility=useCallback(()=>{startTransition(()=>{setShowPassword(current=>!current);});},[]);const wrapperStyle=useMemo(()=>({position:\"fixed\",top:0,left:0,right:0,bottom:0,zIndex:2147483647,background:STYLE_TOKENS.colors.background,color:STYLE_TOKENS.colors.textPrimary,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:STYLE_TOKENS.spacing.lg,boxSizing:\"border-box\",fontFamily:'\"TWK Lausanne\", \"Inter\", sans-serif'}),[]);const cardStyle=useMemo(()=>({width:\"100%\",maxWidth:STYLE_TOKENS.maxWidth,display:\"flex\",flexDirection:\"column\",gap:STYLE_TOKENS.spacing.md}),[]);const inputBaseStyle=useMemo(()=>({width:\"100%\",border:`${STYLE_TOKENS.borderWidth}px solid ${STYLE_TOKENS.colors.border}`,borderRadius:40,fontSize:STYLE_TOKENS.fontSize.input,lineHeight:1.3,padding:`${STYLE_TOKENS.spacing.sm}px ${STYLE_TOKENS.spacing.md}px`,color:STYLE_TOKENS.colors.textPrimary,background:STYLE_TOKENS.colors.background,outline:\"none\",boxSizing:\"border-box\",fontFamily:'\"TWK Lausanne\", \"Inter\", sans-serif'}),[]);if(isCheckingSession)return null;if(isAuthenticated){return /*#__PURE__*/_jsx(Component,{ref:ref,...props});}const gate=/*#__PURE__*/_jsx(\"div\",{style:wrapperStyle,children:/*#__PURE__*/_jsxs(\"div\",{style:cardStyle,children:[/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:STYLE_TOKENS.spacing.xs},children:/*#__PURE__*/_jsx(\"p\",{style:{margin:0,fontSize:19,fontWeight:500,lineHeight:1.4,color:STYLE_TOKENS.colors.textMuted,textAlign:\"center\"},children:TEXT_CONTENT.subtitle})}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",gap:STYLE_TOKENS.spacing.sm},children:[/*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\"},children:[/*#__PURE__*/_jsx(\"input\",{\"aria-label\":\"Password\",type:showPassword?\"text\":\"password\",value:passwordInput,onChange:handleInputChange,placeholder:TEXT_CONTENT.passwordPlaceholder,autoComplete:\"current-password\",style:inputBaseStyle,onFocus:event=>{event.currentTarget.style.borderColor=STYLE_TOKENS.colors.textPrimary;},onBlur:event=>{event.currentTarget.style.borderColor=STYLE_TOKENS.colors.border;}}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:togglePasswordVisibility,\"aria-label\":showPassword?\"Hide password\":\"Show password\",style:{position:\"absolute\",right:STYLE_TOKENS.spacing.sm,top:\"50%\",transform:\"translateY(-50%)\",border:\"none\",background:\"transparent\",cursor:\"pointer\",padding:0,color:STYLE_TOKENS.colors.textMuted,fontSize:STYLE_TOKENS.fontSize.body,fontFamily:'\"TWK Lausanne\", \"Inter\", sans-serif'},children:showPassword?TEXT_CONTENT.hideLabel:TEXT_CONTENT.showLabel})]}),error?/*#__PURE__*/_jsx(\"p\",{role:\"alert\",style:{margin:0,color:STYLE_TOKENS.colors.error,fontSize:STYLE_TOKENS.fontSize.body,lineHeight:1.4},children:error}):null,/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{border:\"none\",borderRadius:40,background:STYLE_TOKENS.colors.buttonBackground,color:STYLE_TOKENS.colors.buttonText,padding:`${STYLE_TOKENS.spacing.sm}px ${STYLE_TOKENS.spacing.md}px`,fontSize:STYLE_TOKENS.fontSize.button,lineHeight:1.2,cursor:\"pointer\",fontFamily:'\"TWK Lausanne\", \"Inter\", sans-serif'},children:TEXT_CONTENT.submitLabel}),/*#__PURE__*/_jsxs(\"p\",{style:{margin:0,fontSize:STYLE_TOKENS.fontSize.body,lineHeight:1.45,color:STYLE_TOKENS.colors.textMuted,textAlign:\"center\"},children:[TEXT_CONTENT.helperPrefix,/*#__PURE__*/_jsx(\"a\",{href:\"mailto:hello@borashin.com\",style:{color:STYLE_TOKENS.colors.textMuted,textDecoration:\"underline\",textUnderlineOffset:\"2px\",fontFamily:'\"TWK Lausanne\", \"Inter\", sans-serif'},children:TEXT_CONTENT.helperLinkLabel})]})]}),/*#__PURE__*/_jsx(\"a\",{href:\"/\",style:{color:STYLE_TOKENS.colors.textMuted,textDecoration:\"none\",fontSize:STYLE_TOKENS.fontSize.link,lineHeight:1.4,fontWeight:500,textAlign:\"center\",width:\"100%\"},children:TEXT_CONTENT.returnToHomeLabel})]})});if(typeof document!==\"undefined\"){return /*#__PURE__*/createPortal(gate,document.body);}return gate;});}\nexport const __FramerMetadata__ = {\"exports\":{\"requireAuth\":{\"type\":\"reactHoc\",\"name\":\"requireAuth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Auth.map"],"mappings":"wLACm6B,SAAS,GAAkB,CAAC,GAAU,IAAS,OAAY,MAAO,GAAM,GAAG,CAAC,IAAM,EAAI,EAAO,aAAa,QAAQ,EAAY,CAAC,GAAG,CAAC,EAAI,MAAO,GAAM,IAAM,EAAO,KAAK,MAAM,EAAI,CAAC,OAAO,OAAO,GAAQ,WAAY,UAAU,EAAO,UAAU,KAAK,KAAK,MAAO,CAAC,MAAO,IAAQ,SAAS,GAAc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