{"version":3,"file":"AutoEmbedHeight.CCm_P7bx.mjs","names":["useState","useCallback","useMemo","__esmMin","ne","init_npm_react_18_3_1","te","pe","window","ce","init_jsx_runtime","J","c","_e","init_ssg_sandbox_shims","useIsStaticRenderer","init_framer_BisrWwwE","withAutoEmbedHeight","isStatic","receivedHeight","setReceivedHeight","onMessage","data","event","nextHeight","prev","mergedStyle","props","Component","init_AutoEmbedHeight"],"sources":["https:/framerusercontent.com/modules/9zidaR8Y7kdc2gEdMtoy/VLIvQit5GMyeYixzIvny/AutoEmbedHeight.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useMemo,useState}from\"react\";import{useIsStaticRenderer}from\"framer\";export function withAutoEmbedHeight(Component){return /*#__PURE__*/forwardRef(function WithAutoEmbedHeight(props,ref){const isStatic=useIsStaticRenderer();const[receivedHeight,setReceivedHeight]=useState(null);const onMessage=useCallback(event=>{const data=event.data;if(!data||data.type!==\"calc-embed-height\")return;if(typeof data.height!==\"number\"||Number.isNaN(data.height))return;const nextHeight=Math.min(1600,Math.max(200,Math.ceil(data.height)));startTransition(()=>{setReceivedHeight(prev=>prev===nextHeight?prev:nextHeight);});},[]);useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;window.addEventListener(\"message\",onMessage);return()=>{window.removeEventListener(\"message\",onMessage);};},[isStatic,onMessage]);const mergedStyle=useMemo(()=>{if(receivedHeight===null){return{...props.style,transition:props.style?.transition??\"height 0.25s ease\"};}return{...props.style,height:`${receivedHeight}px`,transition:props.style?.transition??\"height 0.25s ease\"};},[props.style,receivedHeight]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,style:mergedStyle});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withAutoEmbedHeight\":{\"type\":\"reactHoc\",\"name\":\"withAutoEmbedHeight\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AutoEmbedHeight.map"],"mappings":"A,sNAAwK,SAAgBiB,EAAoB,EAAU,CAAC,MAAoB,gBAAW,SAA6B,EAAM,EAAI,CAAC,IAAMC,EAASH,EAAoB,EAAO,CAACI,EAAeC,GAAmBpB,EAAS,IAAI,EAAQqB,EAAUpB,EAAY,GAAO,CAAC,IAAMqB,EAAKC,EAAM,KAAsD,GAA9C,CAACD,GAAMA,EAAK,OAAO,qBAA8B,OAAOA,EAAK,QAAS,UAAU,OAAO,MAAMA,EAAK,MAAM,EAAE,OAAO,IAAME,EAAW,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAKF,EAAK,MAAM,CAAC,CAAC,EAAEhB,MAAoB,CAACc,EAAkB,GAAMK,IAAOD,EAAWC,EAAKD,CAAU,CAAE,CAAC,CAAE,EAAE,CAAC,CAAC,EAAEf,MAAc,CAAC,GAAG,KAAiBD,IAAS,QAAgE,OAA7CA,EAAO,iBAAiB,UAAUa,CAAS,MAAY,CAACb,EAAO,oBAAoB,UAAUa,CAAS,CAAE,CAAE,EAAE,CAACH,EAASG,CAAS,CAAC,EAAE,IAAMK,EAAYxB,MAAgBiB,IAAiB,KAAY,CAAC,GAAGQ,EAAM,MAAM,WAAWA,EAAM,OAAO,YAAY,mBAAmB,EAAS,CAAC,GAAGA,EAAM,MAAM,OAAO,GAAGR,EAAe,IAAI,WAAWQ,EAAM,OAAO,YAAY,mBAAmB,EAAI,CAACA,EAAM,MAAMR,CAAc,CAAC,EAAE,MAAoB,gBAAKS,EAAU,CAAK,MAAI,GAAGD,EAAM,MAAMD,CAAW,CAAC,CAAE,CAAC,CAAE,C"}