{"version":3,"file":"RecaptchaInput_2.CBISpCT8.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/th05mcMnNz4aWAcco6aV/xtNv9HnZYvSR7eBBUK2Z/RecaptchaInput_2.js"],"sourcesContent":["// RecaptchaInput: Framer reCAPTCHA input that is required by Framer Form. Fixes hidden input to allow required validation.\n//The error you’re seeing on the reCAPTCHA component onframer project canvas is normal — it won’t appear on the published domain.\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * RecaptchaInput\n *\n * Framer reCAPTCHA input that is required by Framer Form. Hidden input is not readOnly so required validation works.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function RecaptchaInput(props){const{siteKey,size,errorMessage,style}=props;const containerRef=useRef(null);const inputRef=useRef(null);const widgetIdRef=useRef(null);const[verified,setVerified]=useState(false);const[error,setError]=useState(\"\");const[scriptLoaded,setScriptLoaded]=useState(false);const[statusMessage,setStatusMessage]=useState(\"\");const renderAttemptedRef=useRef(false);// Load reCAPTCHA script\nuseEffect(()=>{if(typeof window===\"undefined\"||!siteKey)return;const checkAndLoadScript=()=>{if(window.grecaptcha?.ready){startTransition(()=>setScriptLoaded(true));return;}const existingScript=document.querySelector('script[src*=\"google.com/recaptcha/api.js\"]');if(!existingScript){const script=document.createElement(\"script\");script.src=`https://www.google.com/recaptcha/api.js?render=explicit`;script.async=true;script.defer=true;script.onload=()=>{// Wait a bit for grecaptcha to be fully available\nconst checkReady=()=>{if(window.grecaptcha?.ready){startTransition(()=>{setScriptLoaded(true);setStatusMessage(\"reCAPTCHA loaded successfully\");});}else{setTimeout(checkReady,100);}};checkReady();};script.onerror=()=>{startTransition(()=>{setError(\"Failed to load reCAPTCHA script.\");setStatusMessage(\"Failed to load reCAPTCHA script\");});};document.body.appendChild(script);}else{// Script exists, wait for grecaptcha to be ready\nconst checkReady=()=>{if(window.grecaptcha?.ready){startTransition(()=>setScriptLoaded(true));}else{setTimeout(checkReady,100);}};checkReady();}};checkAndLoadScript();},[siteKey]);// Render reCAPTCHA widget\nuseEffect(()=>{if(typeof window===\"undefined\"||!scriptLoaded||!siteKey||!containerRef.current)return;renderAttemptedRef.current=false;const renderWidget=()=>{if(renderAttemptedRef.current)return;if(!window.grecaptcha?.render){// Not ready yet, try again\nsetTimeout(renderWidget,100);return;}renderAttemptedRef.current=true;// Clear container and reset widget\nif(widgetIdRef.current!==null){try{window.grecaptcha.reset(widgetIdRef.current);}catch(e){// Widget might not exist, continue to render new one\n}widgetIdRef.current=null;}if(containerRef.current){containerRef.current.innerHTML=\"\";}try{const widgetId=window.grecaptcha.render(containerRef.current,{sitekey:siteKey.trim(),size,callback:token=>{startTransition(()=>{setVerified(true);setError(\"\");setStatusMessage(\"Verification successful. You are verified as human.\");if(inputRef.current){inputRef.current.value=token;inputRef.current.setAttribute(\"aria-invalid\",\"false\");const event=new Event(\"input\",{bubbles:true});const change=new Event(\"change\",{bubbles:true});inputRef.current.dispatchEvent(event);inputRef.current.dispatchEvent(change);}});},\"expired-callback\":()=>{startTransition(()=>{setVerified(false);setError(errorMessage);setStatusMessage(`Verification expired. ${errorMessage}`);if(inputRef.current){inputRef.current.value=\"\";inputRef.current.setAttribute(\"aria-invalid\",\"true\");const event=new Event(\"input\",{bubbles:true});const change=new Event(\"change\",{bubbles:true});inputRef.current.dispatchEvent(event);inputRef.current.dispatchEvent(change);}});},\"error-callback\":()=>{startTransition(()=>{setVerified(false);setError(\"reCAPTCHA error. Please check your site key.\");setStatusMessage(\"reCAPTCHA error occurred. Please try again or check your site key.\");if(inputRef.current){inputRef.current.value=\"\";inputRef.current.setAttribute(\"aria-invalid\",\"true\");const event=new Event(\"input\",{bubbles:true});const change=new Event(\"change\",{bubbles:true});inputRef.current.dispatchEvent(event);inputRef.current.dispatchEvent(change);}});}});widgetIdRef.current=widgetId;}catch(err){console.error(\"reCAPTCHA render error:\",err);startTransition(()=>{setError(\"Failed to render reCAPTCHA. Check site key.\");setStatusMessage(\"Failed to render reCAPTCHA. Please check your site key.\");});renderAttemptedRef.current=false;}};window.grecaptcha.ready(renderWidget);return()=>{if(widgetIdRef.current!==null&&window.grecaptcha?.reset){try{window.grecaptcha.reset(widgetIdRef.current);}catch(e){// Ignore cleanup errors\n}}widgetIdRef.current=null;renderAttemptedRef.current=false;};},[scriptLoaded,siteKey,size,errorMessage]);if(!siteKey||siteKey.trim().length<30){return /*#__PURE__*/_jsx(\"div\",{style:{color:\"#c00\",fontSize:13},role:\"alert\",\"aria-live\":\"assertive\",children:\"⚠️ Invalid reCAPTCHA site key. Add a valid key in Property Controls.\"});}if(RenderTarget.current()===RenderTarget.thumbnail)return null;return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",display:\"flex\",flexDirection:\"column\",alignItems:\"flex-start\",...style},role:\"group\",\"aria-labelledby\":\"recaptcha-label\",children:[/*#__PURE__*/_jsx(\"label\",{id:\"recaptcha-label\",htmlFor:\"recaptcha-input\",style:{position:\"absolute\",width:\"1px\",height:\"1px\",padding:0,margin:\"-1px\",overflow:\"hidden\",clip:\"rect(0, 0, 0, 0)\",whiteSpace:\"nowrap\",border:0},children:\"reCAPTCHA verification required. Please complete the challenge to verify you are human.\"}),/*#__PURE__*/_jsx(\"div\",{role:\"status\",\"aria-live\":\"polite\",\"aria-atomic\":\"true\",style:{position:\"absolute\",width:\"1px\",height:\"1px\",padding:0,margin:\"-1px\",overflow:\"hidden\",clip:\"rect(0, 0, 0, 0)\",whiteSpace:\"nowrap\",border:0},children:statusMessage}),/*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{minHeight:size===\"compact\"?60:80,width:size===\"compact\"?180:304},role:\"application\",\"aria-label\":\"reCAPTCHA verification widget\"}),error&&/*#__PURE__*/_jsx(\"span\",{style:{color:\"#c00\",fontSize:13,marginTop:6},role:\"alert\",\"aria-live\":\"assertive\",id:\"recaptcha-error\",children:error}),/*#__PURE__*/_jsx(\"input\",{ref:inputRef,id:\"recaptcha-input\",type:\"text\",name:\"recaptcha\",defaultValue:\"\",required:true,style:{opacity:0,height:0,width:0,position:\"absolute\",pointerEvents:\"none\"},tabIndex:-1,\"aria-hidden\":\"true\",\"aria-invalid\":error?\"true\":\"false\",\"aria-describedby\":error?\"recaptcha-error\":undefined,autoComplete:\"off\"})]});}addPropertyControls(RecaptchaInput,{siteKey:{type:ControlType.String,title:\"Site Key\",placeholder:\"Paste reCAPTCHA site key\",defaultValue:\"\"},size:{type:ControlType.Enum,title:\"Size\",options:[\"normal\",\"compact\"],optionTitles:[\"Normal\",\"Compact\"],defaultValue:\"normal\",displaySegmentedControl:true},errorMessage:{type:ControlType.String,title:\"Error Message\",defaultValue:\"Please verify you are not a robot.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RecaptchaInput\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./RecaptchaInput_2.map"],"mappings":"sNASG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,UAAQ,OAAK,eAAa,SAAO,EAAY,EAAaA,EAAO,KAAK,CAAO,EAASA,EAAO,KAAK,CAAO,EAAYA,EAAO,KAAK,CAAM,CAAC,EAAS,GAAaC,EAAS,GAAM,CAAM,CAAC,EAAM,GAAUA,EAAS,GAAG,CAAM,CAAC,EAAa,GAAiBA,EAAS,GAAM,CAAM,CAAC,EAAc,GAAkBA,EAAS,GAAG,CAAO,EAAmBD,EAAO,GAAM,CAQZ,OAPzY,MAAc,CAAW,IAAS,QAAa,CAAC,QAA4C,CAAC,GAAG,EAAO,YAAY,MAAM,CAAC,MAAoB,EAAgB,GAAK,CAAC,CAAC,OAAkG,GAArE,SAAS,cAAc,6CAA6C,CAC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