{"version":3,"file":"CalculatorEmbed.CS_GGC7c.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","te","_e","Ha","p","c","init_jsx_runtime","ce","de","init_framer_DKgW_P28","ControlType","addPropertyControls","useIsStaticRenderer","pinnedHeader","h","pos","CalculatorEmbed","props","frameRef","queueRef","height","setHeight","initialHeight","summary","setSummary","showBar","setShowBar","summaryRef","isStatic","src","setSrc","url","q","onMessage","sm","next","to","top","raf","send","frame","r","head","show","vh","toolOnScreen","resTop","resBottom","resultsOnScreen","prev","queue","box","bar","init_CalculatorEmbed","init_npm_react_dom_18_3_1"],"sources":["https:/framerusercontent.com/modules/sSHbR7bk9vKKkIimc9R4/ulpKchvPohUVvu3rah4r/CalculatorEmbed.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState,startTransition}from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";// Height of a header that stays pinned to the top of the page, if there is one.\nfunction pinnedHeader(){if(typeof document===\"undefined\")return 0;const h=document.querySelector(\"header\");if(!h)return 0;const pos=window.getComputedStyle(h).position;return pos===\"sticky\"||pos===\"fixed\"?Math.round(h.getBoundingClientRect().height):0;}/**\n * Embeds the Netlify-hosted calculator in an iframe that resizes to fit,\n * using the { denrowCalcHeight } messages the calculator posts to its parent.\n * It also tells the tool where the visitor has scrolled ({ denrowViewport }),\n * so a tool can keep a side panel in view even though the frame is full height.\n *\n * @framerIntrinsicWidth 480\n * @framerIntrinsicHeight 1800\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function CalculatorEmbed(props){const{url=\"https://tools.ralphorena.com/\",title=\"The Real Cost of Moving to Dubai calculator\",initialHeight=1800,background=\"transparent\"}=props;const frameRef=useRef(null);const queueRef=useRef(()=>{});const[height,setHeight]=useState(initialHeight);const[summary,setSummary]=useState(null);const[showBar,setShowBar]=useState(false);const summaryRef=useRef(null);const isStatic=useIsStaticRenderer();// Pass the page's own query (e.g. ?src=youtube) through to the tool, so it can record where visitors came from (29 Nov 2026).\nconst[src,setSrc]=useState(url);useEffect(()=>{if(typeof window===\"undefined\")return;const q=window.location.search.replace(/^\\?/,\"\");setSrc(q?url+(url.includes(\"?\")?\"&\":\"?\")+q:url);},[url]);useEffect(()=>{if(typeof window===\"undefined\")return;function onMessage(e){if(!frameRef.current||e.source!==frameRef.current.contentWindow)return;const h=e.data&&Number(e.data.denrowCalcHeight);if(h&&h>200&&h<2e4)startTransition(()=>setHeight(Math.ceil(h)));if(e.data&&e.data.denrowViewportRequest)queueRef.current();const sm=e.data&&e.data.denrowSummary;if(sm&&typeof sm.top===\"number\"&&typeof sm.height===\"number\"){const next={label:String(sm.label||\"\").slice(0,80),value:String(sm.value||\"\").slice(0,40),top:sm.top,height:sm.height};summaryRef.current=next;startTransition(()=>setSummary(next));queueRef.current();}const to=e.data&&Number(e.data.denrowScrollTo);if(isFinite(to)&&to>=0&&e.data.denrowScrollTo!==undefined){const top=frameRef.current.getBoundingClientRect().top+window.scrollY+to-pinnedHeader()-16;window.scrollTo({top:Math.max(0,top),behavior:\"smooth\"});}}window.addEventListener(\"message\",onMessage);return()=>window.removeEventListener(\"message\",onMessage);},[]);// Send the frame's position and the window height to the tool, at most once per frame.\nuseEffect(()=>{if(typeof window===\"undefined\")return;let raf=0;const send=()=>{raf=0;const frame=frameRef.current;if(!frame||!frame.contentWindow)return;const r=frame.getBoundingClientRect();const head=pinnedHeader();frame.contentWindow.postMessage({denrowViewport:{top:r.top,vh:window.innerHeight,head}},\"*\");// Narrow screens: show the pinned results bar while the tool is on screen but its results are not.\nconst sm=summaryRef.current;let show=false;if(sm&&window.innerWidth<=940){const vh=window.innerHeight;const toolOnScreen=r.top<vh-120&&r.bottom>head+120;const resTop=r.top+sm.top;const resBottom=resTop+sm.height;const resultsOnScreen=resTop<vh-80&&resBottom>head+80;show=toolOnScreen&&!resultsOnScreen;}setShowBar(prev=>prev===show?prev:show);};const queue=()=>{if(!raf)raf=window.requestAnimationFrame(send);};queueRef.current=queue;window.addEventListener(\"scroll\",queue,{passive:true});window.addEventListener(\"resize\",queue);return()=>{if(raf)window.cancelAnimationFrame(raf);window.removeEventListener(\"scroll\",queue);window.removeEventListener(\"resize\",queue);queueRef.current=()=>{};};},[]);// The frame's height changes as the tool grows, which moves everything below the fold.\nuseEffect(()=>{queueRef.current();},[height]);const box={...props.style,position:\"relative\",width:\"100%\",height,background,overflow:\"hidden\"};if(isStatic){return /*#__PURE__*/_jsx(\"div\",{style:{...box,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",color:\"#B9B4AA\",fontFamily:\"sans-serif\",fontSize:14},children:\"Calculator loads here on the live site\"});}const goToResults=()=>{const frame=frameRef.current;const sm=summaryRef.current;if(!frame||!sm)return;const top=frame.getBoundingClientRect().top+window.scrollY+sm.top-pinnedHeader()-16;window.scrollTo({top:Math.max(0,top),behavior:\"smooth\"});};const bar=summary&&showBar&&typeof document!==\"undefined\"?/*#__PURE__*/createPortal(/*#__PURE__*/_jsxs(\"button\",{type:\"button\",onClick:goToResults,\"aria-label\":`${summary.label} ${summary.value}. See the breakdown`,style:{position:\"fixed\",left:0,right:0,bottom:0,zIndex:9,display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\",gap:12,width:\"100%\",minHeight:60,padding:\"10px 20px calc(10px + env(safe-area-inset-bottom, 0px))\",border:0,borderTop:\"2px solid #DC683C\",background:\"#141414\",color:\"#FFFCF5\",textAlign:\"left\",cursor:\"pointer\",fontFamily:'\"Inter Tight\", system-ui, sans-serif'},children:[/*#__PURE__*/_jsxs(\"span\",{style:{display:\"flex\",flexDirection:\"column\",gap:2,minWidth:0},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontSize:13,lineHeight:1.25,color:\"rgba(255,252,245,0.78)\",overflow:\"hidden\",textOverflow:\"ellipsis\",whiteSpace:\"nowrap\"},children:summary.label}),summary.value?/*#__PURE__*/_jsx(\"span\",{style:{fontSize:20,fontWeight:600,letterSpacing:\"-0.03em\",lineHeight:1.1,fontVariantNumeric:\"tabular-nums\"},children:summary.value}):null]}),/*#__PURE__*/_jsx(\"span\",{style:{flex:\"none\",fontSize:14,fontWeight:600,whiteSpace:\"nowrap\"},children:\"See breakdown ↓\"})]}),document.body):null;return /*#__PURE__*/_jsxs(\"div\",{style:box,children:[bar,/*#__PURE__*/_jsx(\"iframe\",{ref:frameRef,src:src,title:title,onLoad:()=>queueRef.current(),style:{width:\"100%\",height:\"100%\",border:0,display:\"block\",background},allow:\"clipboard-write\"})]});}addPropertyControls(CalculatorEmbed,{url:{type:ControlType.String,title:\"URL\",defaultValue:\"https://tools.ralphorena.com/\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"The Real Cost of Moving to Dubai calculator\"},initialHeight:{type:ControlType.Number,title:\"Start height\",defaultValue:1800,min:400,max:6e3,step:50,unit:\"px\"},background:{type:ControlType.Color,title:\"Background\",defaultValue:\"rgba(0, 0, 0, 0)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CalculatorEmbed\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"1800\",\"framerIntrinsicWidth\":\"480\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CalculatorEmbed.map"],"mappings":"A,qOACA,SAASkB,GAAc,CAAC,GAAG,OAAO,SAAW,IAAY,MAAO,GAAE,IAAMC,EAAE,SAAS,cAAc,QAAQ,EAAE,GAAG,CAACA,EAAE,MAAO,GAAE,IAAMC,EAAIf,EAAO,iBAAiBc,CAAC,CAAC,CAAC,SAAS,OAAOC,IAAM,UAAUA,IAAM,QAAQ,KAAK,MAAMD,EAAE,sBAAsB,CAAC,CAAC,MAAM,EAAE,CAAE,CAWzP,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