{"version":3,"file":"HubSpot_Form.BFRonfpO.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","window","_e","de","init_jsx_runtime","c","p","ce","init_ssg_sandbox_shims","useIsOnFramerCanvas","addPropertyControls","init_framer_B1b760uK","ControlType","EmbedHTML","ref","iframeHeight","setIframeHeight","hasAutoHeight","style","hasScript","html","iframeWindow","handleMessage","event","data","height","srcDoc","currentStyle","HubSpot_Form","portalId","dataHostingLocation","formId","Placeholder","init_HubSpot_Form"],"sources":["https:/framerusercontent.com/modules/e40uXZbiDF4v3OxInDmN/HnmiRf1QhOLZJFamt6CP/HubSpot_Form.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsOnFramerCanvas}from\"framer\";function EmbedHTML({html,style}){const ref=useRef();const onCanvas=useIsOnFramerCanvas();const[iframeHeight,setIframeHeight]=useState(0);const hasAutoHeight=!style.height;const hasScript=html.includes(\"</script>\");useEffect(()=>{var _this;const iframeWindow=(_this=ref.current)===null||_this===void 0?void 0:_this.contentWindow;function handleMessage(event){if(event.source!==iframeWindow)return;const data=event.data;if(typeof data!==\"object\"||data===null)return;const height=data.embedHeight;if(typeof height!==\"number\")return;setIframeHeight(height);}window.addEventListener(\"message\",handleMessage);iframeWindow===null||iframeWindow===void 0?void 0:iframeWindow.postMessage(\"getEmbedHeight\",\"*\");return()=>{window.removeEventListener(\"message\",handleMessage);};},[]);if(hasScript){const srcDoc=`\n      <html>\n        <head>\n          <style>body { margin: 0; }</style>\n        </head>\n        <body>\n          ${html}\n          <script type=\"module\">\n            let height = 0\n\n            function sendEmbedHeight() {\n              window.parent.postMessage({\n                embedHeight: height\n              }, \"*\")\n            }\n\n            const observer = new ResizeObserver((entries) => {\n              if (entries.length !== 1) return\n              const entry = entries[0]\n              if (entry.target !== document.body) return\n\n              height = entry.contentRect.height\n              sendEmbedHeight()\n            })\n\n            observer.observe(document.body)\n\n            window.addEventListener(\"message\", (event) => {\n              if (event.source !== window.parent) returna\n              if (event.data !== \"getEmbedHeight\") return\n              sendEmbedHeight()\n            })\n          </script>\n        </body>\n      </html>\n    `;const currentStyle={width:\"100%\",height:\"100%\",border:\"none\",...style};if(hasAutoHeight){currentStyle.height=iframeHeight+\"px\";}return /*#__PURE__*/_jsx(\"iframe\",{ref:ref,style:currentStyle,srcDoc:srcDoc});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",...style},dangerouslySetInnerHTML:{__html:html}});}const Placeholder=()=>{const containerStyle={minWidth:\"100%\",minHeight:\"100%\",maxWidth:\"480px\",maxHeight:\"300px\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",alignItems:\"center\",border:\"1px dashed #FF7A59\",borderRadius:\"8px\",padding:\"20px\",boxSizing:\"border-box\",backgroundColor:\"rgba(255, 122, 89, 0.3)\"};const headingStyle={fontSize:\"12px\",fontWeight:600,margin:0,marginBottom:\"5px\",color:\"#FF7A59\"};const paragraphStyle={fontSize:\"12px\",margin:0,color:\"#FF7A59\",maxWidth:\"200px\",textAlign:\"center\"};return /*#__PURE__*/_jsxs(\"div\",{style:containerStyle,children:[/*#__PURE__*/_jsx(\"h1\",{style:headingStyle,children:\"HubSpot\"}),/*#__PURE__*/_jsx(\"p\",{style:paragraphStyle,children:\"Set the HubSpot properties in the Properties panel.\"})]});};/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 500\n * @framerDisableUnlink\n */export default function HubSpot_Form({portalId,dataHostingLocation,formId}){const isAllPropertiesAdded=portalId&&dataHostingLocation&&formId;if(!isAllPropertiesAdded){return /*#__PURE__*/_jsx(Placeholder,{});}const html=`<script charset=\"utf-8\" type=\"text/javascript\" src=\"//js-${dataHostingLocation}.hsforms.net/forms/embed/v2.js\"></script><script>hbspt.forms.create({ region: \"${dataHostingLocation}\", portalId: \"${portalId}\", formId: \"${formId}\" }); </script>`;return /*#__PURE__*/_jsx(EmbedHTML,{html:html,style:{width:\"100%\",height:\"100%\"}});}HubSpot_Form.displayName=\"HubSpot Form\";addPropertyControls(HubSpot_Form,{portalId:{type:ControlType.String,title:\"Portal ID\"},dataHostingLocation:{type:ControlType.String,title:\"Location\"},formId:{type:ControlType.String,title:\"Form ID\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"HubSpot_Form\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"600\",\"framerIntrinsicHeight\":\"500\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HubSpot_Form.map"],"mappings":"A,qNAA8K,SAASgB,EAAU,CAAC,OAAK,SAAO,CAAC,IAAMC,EAAIjB,EAAO,EAAiBY,EAAoB,EAAE,GAAK,CAACM,EAAaC,GAAiBlB,EAAS,CAAC,EAAQmB,EAAc,CAACC,EAAM,OAAaC,EAAUC,EAAK,SAAS,YAAW,EAA+iB,GAA7iBb,MAAc,CAAW,IAAMc,EAAoBP,EAAI,SAA6C,cAAc,SAASQ,EAAc,EAAM,CAAC,GAAGC,EAAM,SAASF,EAAa,OAAO,IAAMG,EAAKD,EAAM,KAAK,GAAG,OAAOC,GAAO,WAAUA,EAAY,OAAO,IAAMC,EAAOD,EAAK,YAAe,OAAOC,GAAS,UAAgBT,EAAgBS,CAAM,CAAE,CAAmJ,OAAlJxB,EAAO,iBAAiB,UAAUqB,CAAa,EAAED,GAA+D,YAAY,iBAAiB,GAAG,MAAY,CAACpB,EAAO,oBAAoB,UAAUqB,CAAa,CAAE,CAAE,EAAE,CAAC,CAAC,EAAKH,EAAU,CAAC,IA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