{"version":3,"file":"AutoEmbedHeight.BCfTQJ3M.mjs","names":["useState","useCallback","useMemo"],"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":"sNAAwK,SAAgB,EAAoB,EAAU,CAAC,OAAoB,EAAW,SAA6B,EAAM,EAAI,CAAC,IAAM,EAAS,EAAoB,EAAO,CAAC,EAAe,GAAmBA,EAAS,IAAI,EAAQ,EAAUC,EAAY,GAAO,CAAC,IAAM,EAAK,EAAM,KAAsD,GAA9C,CAAC,GAAM,EAAK,OAAO,qBAA8B,OAAO,EAAK,QAAS,UAAU,OAAO,MAAM,EAAK,MAAM,EAAE,OAAO,IAAM,EAAW,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAK,MAAM,CAAC,CAAC,EAAE,MAAoB,CAAC,EAAkB,GAAM,IAAO,EAAW,EAAK,CAAU,CAAE,CAAC,CAAE,EAAE,CAAC,CAAC,EAAE,MAAc,CAAI,QAAiB,IAAS,QAAgE,OAA7C,EAAO,iBAAiB,UAAU,CAAS,MAAY,CAAC,EAAO,oBAAoB,UAAU,CAAS,CAAE,CAAE,EAAE,CAAC,EAAS,CAAS,CAAC,EAAE,IAAM,EAAYC,MAAgB,IAAiB,KAAY,CAAC,GAAG,EAAM,MAAM,WAAW,EAAM,OAAO,YAAY,mBAAmB,EAAS,CAAC,GAAG,EAAM,MAAM,OAAO,GAAG,EAAe,IAAI,WAAW,EAAM,OAAO,YAAY,mBAAmB,EAAI,CAAC,EAAM,MAAM,CAAc,CAAC,EAAE,OAAoB,EAAK,EAAU,CAAK,MAAI,GAAG,EAAM,MAAM,CAAW,CAAC,CAAE,CAAC,CAAE,qBAA9rC,IAAqF,IAAwC"}