{"version":3,"file":"Pagelockcomponent.JEE_5W8a.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/rBikhHhSEvBrfh8qPAWy/d2qli3BxTF4ePC7w4yaR/Pagelockcomponent.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * @framerDisableUnlink\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function PasswordProtect(props){const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[isUnlocked,setIsUnlocked]=useState(false);const[otp,setOtp]=useState([\"\",\"\",\"\",\"\",\"\",\"\"]);const inputRefs=useRef([]);useEffect(()=>{if(isCanvas)return;const storedPassword=localStorage.getItem(\"passwordProtect\");if(props.rememberPassword&&storedPassword===props.correctPassword){setIsUnlocked(true);}},[]);useEffect(()=>{if(isCanvas||isUnlocked)return;document.body.style.overflow=\"hidden\";document.documentElement.style.overflow=\"hidden\";return()=>{document.body.style.overflow=\"\";document.documentElement.style.overflow=\"\";};},[isCanvas,isUnlocked]);useEffect(()=>{if(isCanvas)return;const enteredPassword=otp.join(\"\");if(enteredPassword.length===6){if(enteredPassword===props.correctPassword){if(props.rememberPassword){localStorage.setItem(\"passwordProtect\",enteredPassword);}setIsUnlocked(true);}else{setTimeout(()=>{setOtp([\"\",\"\",\"\",\"\",\"\",\"\"]);inputRefs.current[0]?.focus();},500);}}},[otp,props.correctPassword,props.rememberPassword]);const handleChange=(index,value)=>{if(value.length>1)return;const newOtp=[...otp];newOtp[index]=value;setOtp(newOtp);if(value&&index<5){inputRefs.current[index+1]?.focus();}};const handleKeyDown=(index,e)=>{if(e.key===\"Backspace\"&&!otp[index]&&index>0){inputRefs.current[index-1]?.focus();}};const handlePaste=e=>{e.preventDefault();const pastedData=e.clipboardData.getData(\"text\").slice(0,6);const newOtp=[...otp];for(let i=0;i<pastedData.length;i++){if(i<6){newOtp[i]=pastedData[i];}}setOtp(newOtp);const nextEmptyIndex=newOtp.findIndex(digit=>!digit);if(nextEmptyIndex!==-1){inputRefs.current[nextEmptyIndex]?.focus();}else{inputRefs.current[5]?.focus();}};if(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"200px\",backgroundColor:props.backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:\"40px\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:props.hintText.spacing},children:[/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:props.inputSettings.spacing},children:[...Array(6)].map((_,index)=>/*#__PURE__*/_jsx(\"div\",{style:{width:props.inputSettings.width,height:props.inputSettings.height,backgroundColor:props.inputSettings.background,border:`${props.border.borderWidth}px ${props.border.borderStyle} ${props.border.borderColor}`,borderRadius:props.border.borderRadius,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",...props.inputSettings.font,color:props.inputSettings.color},children:index===0?\"1\":index===1?\"2\":\"\"},index))}),props.hintText.text&&/*#__PURE__*/_jsx(\"div\",{style:{...props.hintText.font,color:props.hintText.color,textAlign:\"center\"},children:props.hintText.text})]})});}if(isUnlocked){return null;}return /*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",top:0,left:0,width:\"100vw\",height:\"100vh\",backgroundColor:props.backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",zIndex:9999,overflow:\"hidden\"},children:/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:props.hintText.spacing},children:[/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",gap:props.inputSettings.spacing},children:otp.map((digit,index)=>/*#__PURE__*/_jsx(\"input\",{ref:el=>inputRefs.current[index]=el,type:\"text\",inputMode:\"numeric\",maxLength:1,value:digit,onChange:e=>handleChange(index,e.target.value),onKeyDown:e=>handleKeyDown(index,e),onPaste:handlePaste,autoFocus:index===0,style:{width:props.inputSettings.width,height:props.inputSettings.height,backgroundColor:props.inputSettings.background,border:`${props.border.borderWidth}px ${props.border.borderStyle} ${props.border.borderColor}`,borderRadius:props.border.borderRadius,textAlign:\"center\",...props.inputSettings.font,color:props.inputSettings.color,outline:\"none\",transition:\"all 0.2s ease\"},onFocus:e=>{e.target.style.borderColor=props.focusSettings.borderColor;e.target.style.backgroundColor=props.focusSettings.background;},onBlur:e=>{e.target.style.borderColor=props.border.borderColor;e.target.style.backgroundColor=props.inputSettings.background;}},index))}),props.hintText.text&&/*#__PURE__*/_jsx(\"div\",{style:{...props.hintText.font,color:props.hintText.color,textAlign:\"center\"},children:props.hintText.text})]})});}PasswordProtect.defaultProps={correctPassword:\"123456\",rememberPassword:false,backgroundColor:\"#ffffff\",inputSettings:{width:60,height:60,spacing:12,background:\"#f5f5f5\",color:\"#000000\",font:{fontSize:32,fontWeight:600}},border:{borderWidth:2,borderStyle:\"solid\",borderColor:\"#e0e0e0\",borderRadius:\"8px\"},focusSettings:{borderColor:\"#000000\",background:\"#ffffff\"},hintText:{text:\"Enter 6-digit code\",color:\"#666666\",spacing:16,font:{fontSize:14,fontWeight:400}}};addPropertyControls(PasswordProtect,{correctPassword:{type:ControlType.String,title:\"Password\",defaultValue:\"123456\"},rememberPassword:{type:ControlType.Boolean,title:\"Remember Password\",defaultValue:false},backgroundColor:{type:ControlType.Color,title:\"Background Color\"},inputSettings:{type:ControlType.Object,title:\"Input Settings\",controls:{width:{type:ControlType.Number,title:\"Width\",min:40,max:100,defaultValue:60},height:{type:ControlType.Number,title:\"Height\",min:40,max:100,defaultValue:60},spacing:{type:ControlType.Number,title:\"Spacing\",min:0,max:50,defaultValue:12},background:{type:ControlType.Color,title:\"Background\"},color:{type:ControlType.Color,title:\"Color\"},font:{type:ControlType.Font,controls:\"extended\",title:\"Font\"}}},border:{type:ControlType.Object,title:\"Border\",controls:{borderWidth:{type:ControlType.Number,title:\"Width\",min:0,max:10,defaultValue:2},borderStyle:{type:ControlType.Enum,title:\"Style\",options:[\"solid\",\"dashed\",\"dotted\",\"double\"],defaultValue:\"solid\"},borderColor:{type:ControlType.Color,title:\"Color\"},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\"}}},focusSettings:{type:ControlType.Object,title:\"Focus Settings\",controls:{borderColor:{type:ControlType.Color,title:\"Border Color\"},background:{type:ControlType.Color,title:\"Background\"}}},hintText:{type:ControlType.Object,title:\"Hint Text\",controls:{text:{type:ControlType.String,title:\"Text\",defaultValue:\"Enter 6-digit code\"},color:{type:ControlType.Color,title:\"Color\"},spacing:{type:ControlType.Number,title:\"Spacing\",min:0,max:50,defaultValue:16},font:{type:ControlType.Font,controls:\"extended\",title:\"Font\",description:\"v1.0 \\n[via SegmentUI](https://www.segmentUI.com)\"}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordProtect\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"*\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Pagelockcomponent.map"],"mappings":"sMAKG,SAAwB,EAAgB,EAAM,CAAC,IAAM,EAAS,EAAa,SAAS,GAAG,EAAa,OAAY,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAM,CAAC,EAAI,GAAQA,EAAS,CAAC,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC,CAAO,EAAUC,EAAO,EAAE,CAAC,CAAC,MAAc,CAAC,GAAG,EAAS,OAAO,IAAM,EAAe,aAAa,QAAQ,kBAAkB,CAAI,EAAM,kBAAkB,IAAiB,EAAM,iBAAiB,EAAc,GAAK,EAAI,EAAE,CAAC,CAAC,MAAc,CAAI,QAAU,GAAyG,MAAvF,UAAS,KAAK,MAAM,SAAS,SAAS,SAAS,gBAAgB,MAAM,SAAS,aAAmB,CAAC,SAAS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