{"version":3,"file":"RecapchaInput.CcT_YUgO.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/LTiDVJjck6SSTlFhMJBt/S0lunmRcGLdLBsRjcuZ3/RecapchaInput.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useRef,useState}from\"react\";import{HiddenInput}from\"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/p64C0n6xNEFY9NovSiJw/FramerFormsShared.js\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function RecaptchaInput(props){const[verified,setVerified]=useState(false);if(!props.siteKey){return /*#__PURE__*/_jsx(\"div\",{style:{...props.style},children:/*#__PURE__*/_jsx(InvalideSetupMessage,{})});}return /*#__PURE__*/_jsxs(\"div\",{style:{...props.style},children:[/*#__PURE__*/_jsx(RepatchaContainer,{siteKey:props.siteKey,onVerifiedChange:setVerified}),/*#__PURE__*/_jsx(HiddenInput,{name:\"recaptcha\",required:true,value:verified?\"Yes\":\"\"})]});}RecaptchaInput.displayName=\"reCAPTCHA Input\";addPropertyControls(RecaptchaInput,{siteKey:{type:ControlType.String,title:\"Site Key\",defaultValue:\"\",placeholder:\"Paste your site key here\"}});const RepatchaContainer=props=>{const captchaContainerRef=useRef(null);useEffect(()=>{if(!document.getElementById(\"recaptcha-script\")){const script=document.createElement(\"script\");script.id=\"recaptcha-script\";script.src=\"https://www.google.com/recaptcha/api.js?render=explicit\";script.async=true;script.defer=true;document.body.appendChild(script);}},[]);useEffect(()=>{if(!props.siteKey)return;const interval=setInterval(()=>{const reCaptchaInitialized=!!window.grecaptcha&&window.grecaptcha.render;const captchaContainer=captchaContainerRef.current;if(!captchaContainer)return;if(!reCaptchaInitialized)return;window.grecaptcha.render(captchaContainer,{sitekey:props.siteKey,callback:()=>props.onVerifiedChange(true),\"expired-callback\":()=>props.onVerifiedChange(false)});clearInterval(interval);},500);return()=>clearInterval(interval);},[props.siteKey]);return /*#__PURE__*/_jsx(\"div\",{ref:captchaContainerRef});};const InvalideSetupMessage=()=>{return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"12px\",background:\"#f5f5f5\",color:\"#888\",borderRadius:\"6px\",fontSize:\"14px\",textAlign:\"center\"},children:\"Enter your reCAPTCHA site key in the properties panel\"});};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RecaptchaInput\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RecapchaInput.map"],"mappings":"6PAGG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAmI,OAA7H,EAAM,QAA2I,EAAM,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,KAAK,EAAE,SAAS,CAAc,EAAK,EAAkB,CAAC,QAAQ,EAAM,QAAQ,iBAAiB,CAAW,CAAC,EAAe,EAAK,EAAY,CAAC,KAAK,YAAY,SAAS,GAAK,MAAM,EAAS,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAA/U,EAAK,MAAM,CAAC,MAAM,CAAC,GAAG,EAAM,KAAK,EAAE,SAAsB,EAAK,EAAqB,CAAC,CAAC,CAAC,CAAC,CAA0P,yBAH7Z,IAAoD,IAA6C,IAA8H,EAG+L,EAAe,YAAY,kBAAkB,EAAoB,EAAe,CAAC,QAAQ,CAAC,KAAK,EAAY,OAAO,MAAM,WAAW,aAAa,GAAG,YAAY,0BAA0B,CAAC,CAAC,EAAQ,EAAkB,GAAO,CAAC,IAAM,EAAoBC,EAAO,IAAI,EAAqxB,OAAnxB,MAAc,CAAC,GAAG,CAAC,SAAS,eAAe,kBAAkB,EAAE,CAAC,IAAM,EAAO,SAAS,cAAc,QAAQ,EAAE,EAAO,GA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