{"version":3,"file":"GradientLocationGuide.sAVn3XlD.mjs","names":["React.useRef","React.useState","React.useMemo","React.useCallback"],"sources":["https:/framerusercontent.com/modules/WjsUf3PW5QjXk24i4MO8/JVxdrQEijcvAdQ0vRsop/GradientLocationGuide.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function GradientLocationGuide(props){const{src,title,height,minHeight,maxHeight,backgroundColor,style}=props;const wrapperRef=React.useRef(null);const[responsiveHeight,setResponsiveHeight]=React.useState(height);const[messageHeight,setMessageHeight]=React.useState(null);const safeMinHeight=React.useMemo(()=>Math.max(200,Math.min(minHeight,maxHeight)),[minHeight,maxHeight]);const safeMaxHeight=React.useMemo(()=>Math.max(safeMinHeight,maxHeight),[safeMinHeight,maxHeight]);const clampedHeight=React.useCallback(value=>Math.max(safeMinHeight,Math.min(value,safeMaxHeight)),[safeMinHeight,safeMaxHeight]);const calculateFallbackHeight=React.useCallback((wrapperWidth,viewportHeight)=>{const desktopBaseline=900;const widthRatio=wrapperWidth>0?1200/wrapperWidth:1;const narrowBoost=Math.max(0,(widthRatio-1)*320);const viewportGuard=viewportHeight>0?viewportHeight*.88:desktopBaseline;const computed=desktopBaseline+narrowBoost;return clampedHeight(Math.max(computed,viewportGuard));},[clampedHeight]);const updateResponsiveHeight=React.useCallback(()=>{if(typeof window===\"undefined\")return;const wrapperWidth=wrapperRef.current?.clientWidth??window.innerWidth;const nextHeight=calculateFallbackHeight(wrapperWidth,window.innerHeight);React.startTransition(()=>{setResponsiveHeight(previous=>Math.abs(previous-nextHeight)>1?nextHeight:previous);});},[calculateFallbackHeight]);React.useEffect(()=>{React.startTransition(()=>{setMessageHeight(null);});updateResponsiveHeight();},[src,updateResponsiveHeight]);React.useEffect(()=>{if(typeof window===\"undefined\")return;const element=wrapperRef.current;let observer=null;const onResize=()=>{updateResponsiveHeight();};if(typeof ResizeObserver!==\"undefined\"&&element){observer=new ResizeObserver(()=>onResize());observer.observe(element);}else{window.addEventListener(\"resize\",onResize);}return()=>{if(observer)observer.disconnect();window.removeEventListener(\"resize\",onResize);};},[updateResponsiveHeight]);React.useEffect(()=>{if(typeof window===\"undefined\")return;const trustedOrigin=\"https://gradient-location-guide.replit.app\";const onMessage=event=>{if(event.origin!==trustedOrigin)return;const data=event.data;const rawHeight=typeof data?.height===\"number\"?data.height:typeof data?.iframeHeight===\"number\"?data.iframeHeight:null;if(rawHeight===null||Number.isNaN(rawHeight))return;const nextHeight=clampedHeight(rawHeight);React.startTransition(()=>{setMessageHeight(nextHeight);});};window.addEventListener(\"message\",onMessage);return()=>window.removeEventListener(\"message\",onMessage);},[clampedHeight]);const finalHeight=React.useMemo(()=>{const preferred=messageHeight??responsiveHeight;return clampedHeight(preferred||height);},[messageHeight,responsiveHeight,clampedHeight,height]);const containerStyle=React.useMemo(()=>({position:\"relative\",width:\"100%\",height:finalHeight,backgroundColor,overflow:\"hidden\",display:\"block\",...style}),[finalHeight,backgroundColor,style]);const iframeStyle=React.useMemo(()=>({width:\"100%\",height:\"100%\",border:\"none\",display:\"block\",backgroundColor}),[backgroundColor]);return /*#__PURE__*/_jsx(\"div\",{ref:wrapperRef,style:containerStyle,children:/*#__PURE__*/_jsx(\"iframe\",{src:src,title:title,loading:\"lazy\",allow:\"clipboard-write\",style:iframeStyle})});}addPropertyControls(GradientLocationGuide,{src:{type:ControlType.String,title:\"Source\",defaultValue:\"https://gradient-location-guide.replit.app/nyc\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Gradient New York City Location Guide\"},height:{type:ControlType.Number,title:\"Height\",defaultValue:900,min:200,max:2e3,step:10,unit:\"px\"},minHeight:{type:ControlType.Number,title:\"Min Height\",defaultValue:700,min:200,max:2e3,step:10,unit:\"px\"},maxHeight:{type:ControlType.Number,title:\"Max Height\",defaultValue:1800,min:400,max:2800,step:10,unit:\"px\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#F6EFE6\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GradientLocationGuide\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GradientLocationGuide.map"],"mappings":"kNAGG,SAAwB,EAAsB,EAAM,CAAC,GAAK,CAAC,MAAI,QAAM,SAAO,YAAU,YAAU,kBAAgB,SAAO,EAAY,EAAWA,EAAa,IAAI,EAAO,CAAC,EAAiB,GAAqBC,EAAe,CAAM,EAAO,CAAC,EAAc,GAAkBA,EAAe,IAAI,EAAQ,EAAcC,MAAkB,KAAK,IAAI,IAAI,KAAK,IAAI,EAAU,CAAS,CAAC,EAAE,CAAC,EAAU,CAAS,CAAC,EAAQ,EAAcA,MAAkB,KAAK,IAAI,EAAc,CAAS,EAAE,CAAC,EAAc,CAAS,CAAC,EAAQ,EAAcC,EAAkB,GAAO,KAAK,IAAI,EAAc,KAAK,IAAI,EAAM,CAAa,CAAC,EAAE,CAAC,EAAc,CAAa,CAAC,EAAQ,EAAwBA,GAAmB,EAAa,IAAiB,CAAC,IAAgC,EAAW,EAAa,EAAE,KAAK,EAAa,EAAQ,EAAY,KAAK,IAAI,GAAG,EAAW,GAAG,GAAG,EAAQ,EAAc,EAAe,EAAE,EAAe,IAAI,IAAsB,EAAS,IAAgB,EAAY,OAAO,EAAc,KAAK,IAAI,EAAS,CAAa,CAAC,CAAE,EAAE,CAAC,CAAa,CAAC,EAAQ,EAAuBA,MAAsB,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAa,EAAW,SAAS,aAAa,EAAO,WAAiB,EAAW,EAAwB,EAAa,EAAO,WAAW,EAAE,MAA0B,CAAC,EAAoB,GAAU,KAAK,IAAI,EAAS,CAAU,EAAE,EAAE,EAA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