{"version":3,"file":"HubspotForm.DqDBEdJL.mjs","names":["useRef","useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/zsYGETgrUhR6TxueMCIf/eQgoXuQJ795pR9ofoNvV/HubspotForm.js"],"sourcesContent":["// HubSpot Form Embed Component for Framer\n//\n// This HubSpot form renders inside a same-origin <iframe> (class\n// \"hs-form-iframe\"). The inputs, the .hs-dependent-field, and HubSpot's\n// `width:90%` rules all live INSIDE that iframe's document, so the width\n// override is injected into the IFRAME's own document head. A single\n// stylesheet there also covers the radio-toggled dependent field.\n//\n// The form iframe is found by searching the whole document (it can sit in a\n// container other than this instance's own), and a lightweight watcher keeps\n// it injected, re-injecting if HubSpot ever rebuilds the iframe.\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * HubSpot Form Embed\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function HubspotForm(props){const{formId,showSpinner=true,spinnerColor=\"#3498db\",overlayOpacity=.7,formPadding=16,style}=props;const containerRef=useRef(null);const[isSubmitting,setIsSubmitting]=useState(false);const PORTAL_ID=\"24432600\";const ZEROBOUNCE_API_KEY=\"8134cbee87174cbe8e52d30b859e2fd2\";useEffect(()=>{if(typeof window===\"undefined\"||!formId)return;const STYLE_ID=\"s8-hs-width-fix\";const OVERRIDE_CSS=`\n            .hs-input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]),\n            textarea.hs-input,\n            select.hs-input {\n                width: 100% !important;\n                max-width: 100% !important;\n                box-sizing: border-box !important;\n            }\n        `;function injectInto(doc){try{if(!doc||!doc.head)return false;let st=doc.getElementById(STYLE_ID);if(!st){st=doc.createElement(\"style\");st.id=STYLE_ID;doc.head.appendChild(st);}st.textContent=OVERRIDE_CSS;return true;}catch(e){return false;}}function findIframe(){return document.querySelector(\"iframe.hs-form-iframe, iframe[id^='hs-form-iframe']\");}function ensureInjected(){// Fallback for the rare non-iframe embed.\ninjectInto(document);const ifr=findIframe();if(!ifr)return;if(!ifr.__s8bound){ifr.__s8bound=true;ifr.addEventListener(\"load\",ensureInjected);}let doc=null;try{doc=ifr.contentDocument||ifr.contentWindow&&ifr.contentWindow.document||null;}catch(e){// Iframe is cross-origin; cannot style it from here.\nreturn;}if(doc&&!doc.getElementById(STYLE_ID)){injectInto(doc);}}// Lightweight watcher: covers async iframe creation and any later\n// rebuild. Once the style is in place it only does a quick check.\nensureInjected();const watcher=setInterval(ensureInjected,600);// Load HubSpot script if not already present\nif(!document.querySelector('script[src*=\"js.hsforms.net/forms/embed/v2.js\"]')){const script=document.createElement(\"script\");script.src=\"//js.hsforms.net/forms/embed/v2.js\";script.async=true;script.charset=\"utf-8\";document.body.appendChild(script);script.onload=createForm;}else{createForm();}function createForm(){// @ts-ignore\nif(!window[\"hbspt\"]||!containerRef.current)return;containerRef.current.innerHTML=\"\";// @ts-ignore\nwindow[\"hbspt\"].forms.create({portalId:PORTAL_ID,formId:formId,region:\"na1\",target:`#${containerRef.current.id}`,onFormSubmit:function(){if(showSpinner){startTransition(()=>setIsSubmitting(true));}},onFormSubmitted:function(){setIsSubmitting(false);},onFormReady:function($form){ensureInjected();setTimeout(ensureInjected,400);setTimeout(ensureInjected,1200);const config={apiKey:ZEROBOUNCE_API_KEY,disableSubmitOnError:true,hubspotFormId:formId};const zbScript=document.createElement(\"script\");zbScript.src=\"https://www.zerobounce.net/widget/ZeroBounceHubSpotValidationWidget.js\";zbScript.async=true;zbScript.onload=function(){// @ts-ignore\nif(typeof initializeZeroBounce===\"function\"){// @ts-ignore\ninitializeZeroBounce(config);}};document.head.appendChild(zbScript);}});}// Cleanup on unmount\nreturn()=>{clearInterval(watcher);if(containerRef.current)containerRef.current.innerHTML=\"\";};},[formId,showSpinner]);const containerId=`hubspot-form-container-${formId||\"default\"}`;return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",minHeight:200,borderRadius:12,boxSizing:\"border-box\",...style},children:[/*#__PURE__*/_jsx(\"div\",{ref:containerRef,id:containerId,style:{width:\"100%\",minHeight:200,padding:formPadding,boxSizing:\"border-box\",filter:isSubmitting?\"blur(2px)\":\"none\",transition:\"filter 0.3s ease\",pointerEvents:isSubmitting?\"none\":\"auto\"},\"aria-live\":\"polite\"}),isSubmitting&&showSpinner&&/*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor:`rgba(255, 255, 255, ${overlayOpacity})`,borderRadius:\"inherit\",zIndex:8,animation:\"hubspot-overlay-fade-in 0.2s ease-out\",pointerEvents:\"auto\"},role:\"status\",\"aria-label\":\"Submitting form\",children:/*#__PURE__*/_jsx(\"div\",{style:{width:40,height:40,border:\"3px solid rgba(0, 0, 0, 0.1)\",borderTop:`3px solid ${spinnerColor}`,borderRadius:\"50%\",animation:\"hubspot-spinner 0.8s linear infinite\"}})}),/*#__PURE__*/_jsx(\"style\",{children:`\n                            @keyframes hubspot-spinner {\n                                0% { transform: rotate(0deg); }\n                                100% { transform: rotate(360deg); }\n                            }\n                            @keyframes hubspot-overlay-fade-in {\n                                from { opacity: 0; }\n                                to { opacity: 1; }\n                            }\n                        `})]})]});}addPropertyControls(HubspotForm,{formId:{type:ControlType.String,title:\"Form ID\",defaultValue:\"\",placeholder:\"Paste HubSpot Form ID\"},showSpinner:{type:ControlType.Boolean,title:\"Spinner\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},spinnerColor:{type:ControlType.Color,title:\"Spinner Color\",defaultValue:\"#3498db\"},overlayOpacity:{type:ControlType.Number,title:\"Overlay Fade\",defaultValue:.7,min:0,max:1,step:.05,displayStepper:false},formPadding:{type:ControlType.Number,title:\"Form Padding\",description:\"Inner buffer inside the form. Gives the blur halo room to fade out cleanly during submission - increase this if you see hard cuts at the edges.\",defaultValue:16,min:0,max:64,step:1,unit:\"px\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubspotForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubspotForm.map"],"mappings":"sNAgBG,SAAwB,EAAY,EAAM,CAAC,GAAK,CAAC,SAAO,cAAY,GAAK,eAAa,UAAU,iBAAe,GAAG,cAAY,GAAG,SAAO,EAAY,EAAaA,EAAO,KAAK,CAAM,CAAC,EAAa,GAAiBC,EAAS,GAAM,CAAwF,MAAc,CAAC,GAAU,IAAS,QAAa,CAAC,EAAO,OAAO,IAAM,EAAS,kBAQ/X,SAAS,EAAW,EAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAK,CAAC,EAAI,KAAK,MAAO,GAAM,IAAI,EAAG,EAAI,eAAe,EAAS,CAA4G,OAAvG,IAAI,EAAG,EAAI,cAAc,QAAQ,CAAC,EAAG,GAAG,EAAS,EAAI,KAAK,YAAY,EAAG,EAAE,EAAG,YAAY;;;;;;;;UAAoB,QAAc,CAAC,MAAO,IAAQ,SAAS,GAAY,CAAC,OAAO,SAAS,cAAc,sDAAsD,CAAE,SAAS,GAAgB,CAChY,EAAW,SAAS,CAAC,IAAM,EAAI,GAAY,CAAC,GAAG,CAAC,EAAI,OAAW,EAAI,YAAW,EAAI,UAAU,GAAK,EAAI,iBAAiB,OAAO,EAAe,EAAE,IAAI,EAAI,KAAK,GAAG,CAAC,EAAI,EAAI,iBAAiB,EAAI,eAAe,EAAI,cAAc,UAAU,UAAc,CACrP,OAAW,GAAK,CAAC,EAAI,eAAe,EAAS,EAAE,EAAW,EAAI,CAE9D,GAAgB,CAAC,IAAM,EAAQ,YAAY,EAAe,IAAI,CAC9D,GAAI,SAAS,cAAc,kDA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