{"version":3,"file":"AutoHeightIframe.CFl52ghk.mjs","names":["React.useState","height"],"sources":["https:/framerusercontent.com/modules/Ju494bQ2n5rMhQlk945N/8kWiM9Wa8dxZihO5ooy0/AutoHeightIframe.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function AutoHeightIframe({src,initialHeight,minHeight}){const[height,setHeight]=React.useState(initialHeight);const[ready,setReady]=React.useState(false);// Reset when src changes\n// Reset when src changes\nReact.useEffect(()=>{setHeight(initialHeight);setReady(false);// Fallback: show iframe even if no message ever comes\nconst timeout=setTimeout(()=>{setReady(true);},700);return()=>clearTimeout(timeout);},[src,initialHeight]);React.useEffect(()=>{function onMessage(event){const{type,height}=event.data||{};const next=Number(height);if(!Number.isFinite(next))return;if(type===\"IFRAME_READY\"){setHeight(next);setReady(true);}if(type===\"IFRAME_HEIGHT\"){setHeight(next);}}window.addEventListener(\"message\",onMessage);return()=>window.removeEventListener(\"message\",onMessage);},[]);return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",position:\"relative\"},children:[!ready&&/*#__PURE__*/_jsx(\"div\",{style:{height,width:\"100%\",borderRadius:12,background:\"rgba(0,0,0,0.06)\"}}),/*#__PURE__*/_jsx(\"iframe\",{src:src,style:{width:\"100%\",height,minHeight,border:\"none\",display:\"block\",opacity:ready?1:0,transition:\"opacity 250ms ease, height 200ms ease\"},scrolling:\"no\"})]});}addPropertyControls(AutoHeightIframe,{src:{type:ControlType.String,title:\"Source URL\",placeholder:\"https://fynbos.money/embed/funds-table\"},initialHeight:{type:ControlType.Number,title:\"Initial Height\",defaultValue:200,min:200,max:5e3,step:50},minHeight:{type:ControlType.Number,title:\"Min Height\",defaultValue:1e3,min:200,max:2e3,step:50}});AutoHeightIframe.defaultProps={src:\"https://fynbos.money/embed/funds-table\",initialHeight:1e3};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",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