{"version":3,"file":"DecryptText.CaWfBAOK.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/ODC5jgHGerq2KJvDm74t/REbs4ssz6VAj3kVpHvfE/DecryptText.js"],"sourcesContent":["// Decrypt text effect that reveals text character by character on hover\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function DecryptText(props){const{text=\"DECRYPT ME\",font,textColor,hoverColor,speed,characters,link,openInNewTab}=props;const[displayText,setDisplayText]=useState(text);const[isDecrypting,setIsDecrypting]=useState(false);const[isHovered,setIsHovered]=useState(false);const intervalRef=useRef(null);const isStatic=useIsStaticRenderer();const generateRandomChar=()=>{return characters[Math.floor(Math.random()*characters.length)];};const startDecryption=()=>{if(isStatic)return;startTransition(()=>{setIsDecrypting(true);setIsHovered(true);});let iteration=0;const targetText=text;if(intervalRef.current){clearInterval(intervalRef.current);}intervalRef.current=window.setInterval(()=>{startTransition(()=>{setDisplayText(prev=>targetText.split(\"\").map((letter,index)=>{if(index<iteration){return targetText[index];}return generateRandomChar();}).join(\"\"));});if(iteration>=targetText.length){if(intervalRef.current){clearInterval(intervalRef.current);}startTransition(()=>setIsDecrypting(false));}iteration+=1/3;},speed);};const resetText=()=>{if(isStatic)return;if(intervalRef.current){clearInterval(intervalRef.current);}startTransition(()=>{setDisplayText(text);setIsDecrypting(false);setIsHovered(false);});};useEffect(()=>{return()=>{if(intervalRef.current){clearInterval(intervalRef.current);}};},[]);const isFixedWidth=props?.style&&props.style.width===\"100%\";const handleClick=()=>{if(link&&typeof window!==\"undefined\"){window.open(link,openInNewTab?\"_blank\":\"_self\");}};const ContentWrapper=link?\"a\":\"div\";return /*#__PURE__*/_jsx(ContentWrapper,{href:link||undefined,target:link&&openInNewTab?\"_blank\":undefined,rel:link&&openInNewTab?\"noopener noreferrer\":undefined,style:{...props.style,position:\"relative\",...isFixedWidth?{...props?.style}:{width:\"max-content\"},cursor:isStatic?\"default\":link?\"pointer\":\"pointer\",userSelect:\"none\",textDecoration:\"none\"},onMouseEnter:isStatic?undefined:startDecryption,onMouseLeave:isStatic?undefined:resetText,onClick:link&&isStatic?undefined:handleClick,children:/*#__PURE__*/_jsx(\"span\",{style:{color:isHovered?hoverColor:textColor,fontFamily:\"monospace\",letterSpacing:\"0.1em\",...font,display:\"block\"},children:displayText})});}addPropertyControls(DecryptText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"DECRYPT ME\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"32px\",variant:\"Bold\",letterSpacing:\"0.1em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},hoverColor:{type:ControlType.Color,title:\"Hover Color\",defaultValue:\"#6074F5\"},speed:{type:ControlType.Number,title:\"Speed\",defaultValue:30,min:10,max:100,step:10,unit:\"ms\"},characters:{type:ControlType.String,title:\"Random Characters\",defaultValue:\"!@#$%^&*()_+-=[]{}|;:,.<>?~`\"},link:{type:ControlType.String,title:\"Link URL\",defaultValue:\"\"},openInNewTab:{type:ControlType.Boolean,title:\"Open in New Tab\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"DecryptText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DecryptText.map"],"mappings":"qNAIG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,aAAa,OAAK,YAAU,aAAW,QAAM,aAAW,OAAK,gBAAc,EAAW,CAAC,EAAY,GAAgBA,EAAS,EAAK,CAAM,C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