{"version":3,"file":"LCMapTapToLoad.DCebdH_j.mjs","names":["useState","useRef","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","p","ce","de","addPropertyControls","init_framer_BisrWwwE","ControlType","RenderTarget","useNear","near","setNear","enabled","el","ref","timer","inRange","r","h","io","entries","onScroll","LCMapTapToLoad","props","loaded","setLoaded","box","loadOn","boxHeight","height","onCanvas","q","query","name","id","cid","embed","enc","zoom","open","grid","lineColor","FONT","style","radius","tintColor","accentColor","textColor","showLabel","note","mutedColor","address","openLabel","init_LCMapTapToLoad","init_jsx_runtime","s"],"sources":["https:/framerusercontent.com/modules/FzDRUNEI3hZrBeSMpv7J/ahXuwTFX68nJBPUCXPJq/LCMapTapToLoad.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";// LangkawiCruise location map (Google Maps embed, no API key).\n// Load on \"page\" (default, Alain 27 Sep 2026: map visible when the page opens, as on the current site) or on \"tap\"\n// (a locally drawn preview; nothing is requested from Google until the visitor taps \"Show map\").\n// Round 15: in \"page\" mode the map is requested only when its section comes near the screen (the preview shows until then).\n// \"Open in Google Maps\" is a plain link that opens Google Maps in a new tab. The Framer canvas always shows the preview.\nconst FONT=\"Inter, Inter Placeholder, system-ui, sans-serif\";// Round 15 (Alain 29 Sep 2026): load the page section by section. A photo (or map) is requested only when its\n// section is on the screen or about to be (up to 3/4 of a screen below, 1/4 above), so the first screen loads first\n// and the rest follows, top to bottom, as the visitor scrolls. Nothing is in the server HTML for those photos.\n// The position is checked again 150 ms later, because Framer lays lists out in steps while the page starts.\nfunction useNear(ref,enabled){const[near,setNear]=useState(false);useEffect(()=>{if(!enabled||near)return;const el=ref.current;if(!el||typeof IntersectionObserver===\"undefined\"){setNear(true);return;}let timer=0;const inRange=()=>{const r=el.getBoundingClientRect(),h=window.innerHeight||800;return(r.width>0||r.height>0)&&r.bottom>-h*.25&&r.top<h*1.75;};const io=new IntersectionObserver(entries=>{if(!entries.some(e=>e.isIntersecting))return;window.clearTimeout(timer);timer=window.setTimeout(()=>{if(inRange()){setNear(true);io.disconnect();}},150);},{rootMargin:\"25% 0px 75% 0px\"});io.observe(el);const onScroll=()=>{if(inRange()){window.clearTimeout(timer);timer=window.setTimeout(()=>{if(inRange()){setNear(true);io.disconnect();}},150);}};window.addEventListener(\"scroll\",onScroll,{passive:true});return()=>{io.disconnect();window.clearTimeout(timer);window.removeEventListener(\"scroll\",onScroll);};},[enabled,near]);return near;}const enc=s=>encodeURIComponent((s||\"\").trim());/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n * @framerIntrinsicWidth 520\n */export default function LCMapTapToLoad(props){const{name,address,query,cid,zoom,loadOn,height,showLabel,openLabel,note,textColor,mutedColor,accentColor,lineColor,tintColor,radius,style}=props;const[loaded,setLoaded]=useState(false);const box=useRef(null);const near=useNear(box,loadOn!==\"tap\");const boxHeight=Math.max(160,Number(height)||340)// values bound from the canvas can arrive as strings\n;const onCanvas=RenderTarget.current()===RenderTarget.canvas;const q=query||name;// A Google Business listing id (CID) pins the map to that exact listing; otherwise the place is found by name.\nconst id=String(cid||\"\").replace(/\\D/g,\"\");const embed=id?`https://maps.google.com/maps?cid=${id}&output=embed`:`https://www.google.com/maps?q=${enc(q)}&z=${Math.round(zoom||15)}&output=embed`;const open=id?`https://www.google.com/maps?cid=${id}`:`https://www.google.com/maps/search/?api=1&query=${enc(q)}`;const grid=`linear-gradient(${lineColor} 1px, transparent 1px), linear-gradient(90deg, ${lineColor} 1px, transparent 1px)`;return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",fontFamily:FONT,display:\"flex\",flexDirection:\"column\",gap:12,...style},children:[/*#__PURE__*/_jsx(\"div\",{ref:box,style:{position:\"relative\",width:\"100%\",height:boxHeight,borderRadius:Number(radius)||0,overflow:\"hidden\",border:`1px solid ${lineColor}`,background:tintColor},children:(loaded||loadOn!==\"tap\"&&near)&&!onCanvas?/*#__PURE__*/_jsx(\"iframe\",{title:`Map: ${name}`,src:embed,style:{position:\"absolute\",inset:0,width:\"100%\",height:\"100%\",border:0},loading:\"lazy\",referrerPolicy:\"no-referrer-when-downgrade\",allowFullScreen:true}):/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",inset:0,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",gap:12,padding:20,textAlign:\"center\",backgroundImage:grid,backgroundSize:\"36px 36px\",backgroundPosition:\"center\"},children:[/*#__PURE__*/_jsx(\"svg\",{width:\"40\",height:\"40\",viewBox:\"0 0 24 24\",\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(\"path\",{fill:accentColor,d:\"M12 2C8.1 2 5 5.1 5 9c0 5.2 7 13 7 13s7-7.8 7-13c0-3.9-3.1-7-7-7zm0 9.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z\"})}),/*#__PURE__*/_jsx(\"div\",{style:{fontSize:17,fontWeight:700,lineHeight:1.3,color:textColor,maxWidth:420},children:name}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>setLoaded(true),\"aria-label\":`${showLabel}: ${name}`,style:{display:\"inline-flex\",alignItems:\"center\",justifyContent:\"center\",minHeight:44,padding:\"12px 22px\",borderRadius:100,border:\"none\",cursor:\"pointer\",background:accentColor,color:\"#fff\",fontFamily:FONT,fontSize:15,fontWeight:700,lineHeight:1.2},children:showLabel}),note&&loadOn===\"tap\"?/*#__PURE__*/_jsx(\"div\",{style:{fontSize:12,lineHeight:1.4,color:mutedColor,maxWidth:360},children:note}):null]})}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexWrap:\"wrap\",alignItems:\"baseline\",justifyContent:\"space-between\",gap:\"6px 16px\"},children:[address?/*#__PURE__*/_jsx(\"div\",{style:{fontSize:14,lineHeight:1.45,color:mutedColor,flex:\"1 1 220px\",minWidth:0},children:address}):null,/*#__PURE__*/_jsxs(\"a\",{href:open,target:\"_blank\",rel:\"noopener noreferrer\",style:{fontSize:14,fontWeight:700,lineHeight:1.4,color:accentColor,textDecoration:\"none\"},children:[openLabel,\" ↗\"]})]})]});}LCMapTapToLoad.defaultProps={name:\"Royal Langkawi Yacht Club\",address:\"Jalan Dato Syed Omar, 07000 Kuah, Langkawi, Kedah\",query:\"Royal Langkawi Yacht Club\",cid:\"\",zoom:15,loadOn:\"page\",height:340,showLabel:\"Show map\",openLabel:\"Open in Google Maps\",note:\"The map loads from Google Maps when you tap.\",textColor:\"rgb(7, 27, 51)\",mutedColor:\"rgb(81, 98, 116)\",accentColor:\"rgb(14, 111, 120)\",lineColor:\"rgba(7, 27, 51, 0.12)\",tintColor:\"rgb(230, 244, 245)\",radius:20};addPropertyControls(LCMapTapToLoad,{name:{type:ControlType.String,title:\"Place name\"},address:{type:ControlType.String,title:\"Address\",displayTextArea:true},query:{type:ControlType.String,title:\"Maps search\"},cid:{type:ControlType.String,title:\"Listing CID\",placeholder:\"optional\"},zoom:{type:ControlType.Number,title:\"Zoom\",min:10,max:19,step:1},loadOn:{type:ControlType.Enum,title:\"Load map\",options:[\"page\",\"tap\"],optionTitles:[\"On page load\",\"On tap\"],defaultValue:\"page\"},height:{type:ControlType.Number,title:\"Map height\",min:200,max:640,step:10},showLabel:{type:ControlType.String,title:\"Show label\"},openLabel:{type:ControlType.String,title:\"Open label\"},note:{type:ControlType.String,title:\"Note\"},textColor:{type:ControlType.Color,title:\"Text\"},mutedColor:{type:ControlType.Color,title:\"Muted\"},accentColor:{type:ControlType.Color,title:\"Accent\"},lineColor:{type:ControlType.Color,title:\"Line\"},tintColor:{type:ControlType.Color,title:\"Tint\"},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:40}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LCMapTapToLoad\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupport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