{"version":3,"file":"HSform.DPRlSSbV.mjs","names":["useMemo","useCallback","useRef"],"sources":["https:/framerusercontent.com/modules/M1nu4MmWmFNoB5Dek6UR/W3NJ6myvNJkiKUxeLgFY/HSform.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{emptyStateStyle,stateParagraphStyle,stateTitleStyle}from\"https://framer.com/m/framer/integrations-styles.js@0.2.0\";import{useCallback,useEffect,useMemo,useRef}from\"react\";// User request: scope HubSpot form CSS per component/page and prevent style leakage across soft navigations with unique style IDs and cleanup.\nfunction poll(f,delay=200,count=5*60*5,i=0){if(i>count){console.error(\"poll max attempts\",f);return;}if(!f()){setTimeout(()=>{poll(f,delay,count,i+1);},delay);}}function EmptyState({title,description}){return /*#__PURE__*/_jsxs(\"div\",{style:{...emptyStateStyle,width:\"100%\",height:\"100%\"},children:[/*#__PURE__*/_jsx(\"h1\",{style:stateTitleStyle,children:title}),/*#__PURE__*/_jsx(\"p\",{style:stateParagraphStyle,children:description})]});}const WRAPPER_CLASS=\"hs-form-main\";const STYLE_ID=\"hs-form-main-style\";/**\n * @framerDisableUnlink\n *\n * @framerIntrinsicWidth 480\n * @framerIntrinsicHeight 300\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */const HubSpotLegacyForm=function HubSpotLegacyForm({portalId,formId,region,id}){if(!portalId||!formId||!region){return /*#__PURE__*/_jsx(EmptyState,{title:\"Hubspot\",description:\"Set a portal ID and form in the Properties.\"});}const elementId=useMemo(()=>`hubspot_form_${id}`,[id]);const cleanup=useCallback(()=>{if(typeof document===\"undefined\")return;const element=document.querySelector(`#${elementId}`);if(element)element.innerHTML=\"\";},[elementId]);const formRef=useRef(null);const scopedCSS=useMemo(()=>`\n.${WRAPPER_CLASS} .hs-form { max-width: 1200px; margin: 0 auto; }\n.${WRAPPER_CLASS} .hs-form input, .${WRAPPER_CLASS} .hs-form textarea, .${WRAPPER_CLASS} .hs-form select {\n    background: transparent !important;\n    border: none !important;\n    border-bottom: 1px solid rgba(255,255,255,0.6) !important;\n    color: #ffffff !important;\n    padding: 10px 0 !important;\n    font-size: 16px !important;\n    font-family: 'Open Sans', sans-serif !important;\n    font-weight: 400 !important;\n    margin-bottom: 20px !important;\n    width: 100% !important;\n    outline: none !important;\n    box-shadow: none !important;\n}\n.${WRAPPER_CLASS} .hs-form input::placeholder, .${WRAPPER_CLASS} .hs-form textarea::placeholder, .${WRAPPER_CLASS} .hs-form select::placeholder {\n    color: rgba(255,255,255,0.6) !important;\n    font-size: 16px !important;\n    font-family: 'Open Sans', sans-serif !important;\n    font-weight: 400 !important;\n}\n.${WRAPPER_CLASS} .hs-form label {\n    color: #ffffff !important;\n    font-size: 16px !important;\n    font-family: 'Open Sans', sans-serif !important;\n    font-weight: 400 !important;\n    display: block !important;\n    margin-bottom: 4px !important;\n}\n.${WRAPPER_CLASS} .hs-form fieldset {\n    max-width: 1000px !important;\n    width: 100% !important;\n    display: flex !important;\n    flex-wrap: wrap !important;\n    gap: 20px !important;\n    border: 0 !important;\n    margin: 0 !important;\n    padding: 0 !important;\n}\n.${WRAPPER_CLASS} .hs-form fieldset > *:not(.hs-form-booleancheckbox-display):not(.hs-form-checkbox):not(.hs-form-radio) {\n    flex: 1 1 0 !important;\n    min-width: 0 !important;\n}\n.${WRAPPER_CLASS} .hs-form .hs-form-booleancheckbox-display {\n    display: inline-flex !important;\n    align-items: center !important;\n    gap: 8px !important;\n    margin: 10px 0 !important;\n    flex: 0 0 auto !important;\n    width: auto !important;\n}\n.${WRAPPER_CLASS} .hs-form .hs-form-booleancheckbox-display input[type=\"checkbox\"] {\n    width: auto !important;\n    margin: 0 !important;\n    accent-color: #ffffff !important;\n}\n.${WRAPPER_CLASS} .hs-form .hs-form-checkbox, .${WRAPPER_CLASS} .hs-form .hs-form-radio {\n    display: flex !important;\n    flex-wrap: wrap !important;\n    gap: 12px 20px !important;\n    align-items: center !important;\n    margin: 6px 0 16px 0 !important;\n    flex: 0 0 100% !important;\n}\n.${WRAPPER_CLASS} .hs-form .hs-form-checkbox label,\n.${WRAPPER_CLASS} .hs-form .hs-form-radio label {\n    display: inline-flex !important;\n    align-items: center !important;\n    gap: 8px !important;\n    margin: 0 !important;\n    color: #ffffff !important;\n    font-size: 14px !important;\n}\n.${WRAPPER_CLASS} .hs-form .hs-form-checkbox input[type=\"checkbox\"],\n.${WRAPPER_CLASS} .hs-form .hs-form-radio input[type=\"radio\"] {\n    width: auto !important;\n    margin: 0 !important;\n    accent-color: #ffffff !important;\n}\n.${WRAPPER_CLASS} .hs-form input[type=\"submit\"] {\n    background-color: #ffffff !important;\n    color: #0f172a !important;\n    padding: 12px 20px !important;\n    font-weight: 600 !important;\n    border: none !important;\n    border-radius: 6px !important;\n    cursor: pointer !important;\n    margin-top: 10px !important;\n}\n.${WRAPPER_CLASS} .hs-form .legal-consent-container, .${WRAPPER_CLASS} .hs-form .hs-richtext {\n    color: #ffffff !important;\n    font-size: 12px !important;\n    font-family: 'Open Sans', sans-serif !important;\n    font-weight: 400 !important;\n    line-height: 1.5 !important;\n}\n.${WRAPPER_CLASS} .hs-form .legal-consent-container a, .${WRAPPER_CLASS} .hs-form .hs-richtext a {\n    color: #ffffff !important;\n    font-size: 12px !important;\n    font-family: 'Open Sans', sans-serif !important;\n    font-weight: 400 !important;\n    text-decoration: underline !important;\n}\n.${WRAPPER_CLASS} .hs-form input:focus, .${WRAPPER_CLASS} .hs-form textarea:focus, .${WRAPPER_CLASS} .hs-form select:focus {\n    border-bottom-color: #ffffff !important;\n}\n.${WRAPPER_CLASS} .hs-form .hs-error-msg, .${WRAPPER_CLASS} .hs-form .hs-error-msgs li {\n    color: #ffb4b4 !important;\n    font-size: 12px !important;\n    margin-top: -12px !important;\n    margin-bottom: 12px !important;\n}\n.${WRAPPER_CLASS} .hs-form .invalid input, .${WRAPPER_CLASS} .hs-form .invalid textarea, .${WRAPPER_CLASS} .hs-form .invalid select {\n    border-bottom-color: #ff6b6b !important;\n}\n.${WRAPPER_CLASS} .hs-form select option {\n    background-color: #007681 !important;\n    color: #ffffff !important;\n}\n@media (max-width: 810px) {\n    .${WRAPPER_CLASS} .hs-form fieldset {\n        flex-direction: column !important;\n        gap: 10px !important;\n    }\n    .${WRAPPER_CLASS} .hs-form fieldset > * { width: 100% !important; }\n    .${WRAPPER_CLASS} .hs-form .hs-form-booleancheckbox-display {\n        width: 100% !important;\n        justify-content: flex-start !important;\n    }\n}\n`,[]);const handleScriptLoad=useCallback(()=>{poll(()=>{if(typeof window===\"undefined\"||!window.hbspt){console.warn(`HubSpot could not be loaded: window.hbspt is missing`);return false;}if(typeof document===\"undefined\")return false;if(!document.querySelector(`#${elementId}`)){console.warn(`HubSpot could not be loaded: element not found #${elementId}`);return false;}cleanup();window.hbspt.forms.create({region,portalId,formId,target:`#${elementId}`,formInstanceId:formId});return true;});},[cleanup,elementId,formId,portalId,region]);useEffect(()=>{if(typeof document!==\"undefined\"){const existing=document.getElementById(STYLE_ID);if(existing){existing.dataset.instances=String((Number(existing.dataset.instances||\"0\")||0)+1);}else{const styleEl=document.createElement(\"style\");styleEl.id=STYLE_ID;styleEl.dataset.instances=\"1\";styleEl.textContent=scopedCSS;document.head.appendChild(styleEl);}}if(typeof window===\"undefined\"||typeof document===\"undefined\"){return;}if(window.hbspt){handleScriptLoad();return()=>{cleanup();const styleEl=document.getElementById(STYLE_ID);if(!styleEl)return;const nextCount=(Number(styleEl.getAttribute(\"data-instances\")||\"1\")||1)-1;if(nextCount<=0)styleEl.remove();else styleEl.setAttribute(\"data-instances\",String(nextCount));};}const script=document.createElement(\"script\");script.src=`https://js-${region}.hsforms.net/forms/shell.js`;script.onload=handleScriptLoad;document.body.appendChild(script);return()=>{cleanup();const styleEl=document.getElementById(STYLE_ID);if(!styleEl)return;const nextCount=(Number(styleEl.getAttribute(\"data-instances\")||\"1\")||1)-1;if(nextCount<=0)styleEl.remove();else styleEl.setAttribute(\"data-instances\",String(nextCount));};},[cleanup,formId,handleScriptLoad,portalId,region,scopedCSS]);return /*#__PURE__*/_jsx(\"div\",{className:WRAPPER_CLASS,style:{position:\"relative\",width:\"100%\",height:\"100%\"},children:/*#__PURE__*/_jsx(\"div\",{ref:formRef,id:elementId})});};addPropertyControls(HubSpotLegacyForm,{portalId:{title:\"Portal\",type:ControlType.String,placeholder:\"25276298\",description:\"Create a [Hubspot](https://www.hubspot.com/) account, add a new form and copy your portal ID. [Learn more…](https://www.framer.com/plugins/hubspot/)\"},formId:{title:\"Form\",type:ControlType.String,placeholder:\"e7167571-4bc4-4c2c-bfdc-a0a8dbfd22f1\"},advanced:{title:\"Advanced\",type:ControlType.Boolean,enabledTitle:\"Show\",disabledTitle:\"Hide\",defaultValue:false},region:{title:\"Region\",type:ControlType.String,placeholder:\"eu1\",defaultValue:\"eu1\",hidden:({advanced})=>!advanced}});export default HubSpotLegacyForm;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubSpotLegacyForm\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicWidth\":\"480\",\"framerDisableUnlink\":\"*\",\"framerIntrinsicHeight\":\"300\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HSform.map"],"mappings":"mSACA,SAAS,EAAK,EAAE,EAAM,IAAI,EAAM,IAAK,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,EAAM,CAAC,QAAQ,MAAM,oBAAoB,CAAC,EAAE,MAAO,CAAK,EAAE,GAAG,eAAe,CAAC,EAAK,EAAE,EAAM,EAAM,EAAE,CAAC,CAAE,EAAE,CAAK,CAAG,CAAC,SAAS,EAAW,CAAC,QAAM,eAAa,CAAC,OAAoB,EAAM,MAAM,CAAC,MAAM,CAAC,GAAG,EAAgB,MAAM,OAAO,OAA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