{"version":3,"file":"AdjustIframeHeight.CfzBOrLS.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/wkSLs6NuoF8tBrwFABbQ/e89djrK563iwBusFLYiI/AdjustIframeHeight.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";// Learn more: https://www.framer.com/docs/guides/overrides/\nexport function withChangeHeightToFitIframeContent(Component){return props=>{const defaultHeight=\"none\"// Default height\n;const[iframeHeight,setIframeHeight]=useState(defaultHeight)// Default height\n;useEffect(()=>{const handleMessage=event=>{// It's important to validate the origin of the message for security reasons\nif(event.origin!==\"https://app.storiesonboard.com\"){// Ignore messages from unexpected origins\nconsole.log(event.origin);//return\n}if(typeof event.data===\"string\"){try{const msg=JSON.parse(event.data);//console.log(msg)\nif(msg&&msg.event==\"storymap\"){console.log(msg.height);setIframeHeight(msg.height);}}catch(e){console.log(e);}}};window.addEventListener(\"message\",handleMessage);// Cleanup the event listener when the component unmounts\nreturn()=>{window.removeEventListener(\"message\",handleMessage);};},[]);// Create a new props object\nconst newProps={...props,transition:{duration:.5}};// Conditionally add the animate property if the height has changed\nif(iframeHeight!==defaultHeight){newProps.animate={height:iframeHeight};}return /*#__PURE__*/_jsx(Component,{...newProps,height:iframeHeight,id:\"StartWithAi\"});};}//ezt mar nem hasznaljuk, azert maradt bent hogy legyen egy pelda a variant allitasra\n//postMessage uzenetet megkapva atallitja a komponenst masik variansra\nexport function withChangeToStorymapVariant(Component){return props=>{const[variant,setVariant]=useState(\"Form\")// Default height\n;useEffect(()=>{const handleMessage=event=>{// It's important to validate the origin of the message for security reasons\nif(event.origin!==\"https://app.storiesonboard.com\"){// Ignore messages from unexpected origins\nconsole.log(event.origin);return;}if(typeof event.data===\"string\"){try{const msg=JSON.parse(event.data);if(msg&&msg.event==\"storymap\"){setVariant(\"Storymap\");}}catch(e){}}};window.addEventListener(\"message\",handleMessage);// Cleanup the event listener when the component unmounts\nreturn()=>{window.removeEventListener(\"message\",handleMessage);};},[]);return /*#__PURE__*/_jsx(Component,{...props,variant:variant});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withChangeHeightToFitIframeContent\":{\"type\":\"reactHoc\",\"name\":\"withChangeHeightToFitIframeContent\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withChangeToStorymapVariant\":{\"type\":\"reactHoc\",\"name\":\"withChangeToStorymapVariant\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AdjustIframeHeight.map"],"mappings":"uIACA,SAAgB,EAAmC,EAAU,CAAC,MAAO,IAAO,CAAC,IAAM,EAAc,OAC3F,CAAC,EAAa,GAAiBA,EAAS,EAAc,CAC3D,MAAc,CAAC,IAAM,EAAc,GAAO,CAG1C,GAFE,EAAM,SAAS,kCAClB,QAAQ,IAAI,EAAM,OAAO,CACrB,OAAO,EAAM,MAAO,SAAU,GAAG,CAAC,IAAM,EAAI,KAAK,MAAM,EAAM,KAAK,CACnE,GAAK,EAAI,OAAO,aAAY,QAAQ,IAAI,EAAI,OAAO,CAAC,EAAgB,EAAI,OAAO,QAAS,EAAE,CAAC,QAAQ,IAAI,EAAE,GAC5G,OADiH,EAAO,iBAAiB,UAAU,EAAc,KACvJ,CAAC,EAAO,oBAAoB,UAAU,EAAc,GAAK,EAAE,CAAC,CACtE,IAAM,EAAS,CAAC,GAAG,EAAM,WAAW,CAAC,SAAS,GAAG,CAAC,CACuB,OAAtE,IAAe,IAAe,EAAS,QAAQ,CAAC,OAAO,EAAa,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAS,OAAO,EAAa,GAAG,cAAc,CAAC,uBAVpH,IAAsC"}