{"version":3,"file":"Barch_Map.DXma2_Fb.mjs","names":["React.useRef","React.useState","p"],"sources":["https:/framerusercontent.com/modules/V8DaxCrlcZkpXHB1jdaS/0addM9QykGEUixP2cdaj/Barch_Map.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType}from\"framer\";const containerStyle={width:\"100%\",height:\"100%\",position:\"relative\",overflow:\"hidden\",backgroundColor:\"#f5f5f5\",fontFamily:'\"Inter\", sans-serif'};export function BarchMap(props){const mapRef=React.useRef(null);const mapInstance=React.useRef(null);const markerInstance=React.useRef(null);const[isGalleryOpen,setIsGalleryOpen]=React.useState(false);// Dynamické měřítko boxu při zoomování\nconst updatePopupScale=()=>{if(!mapInstance.current)return;const currentZoom=mapInstance.current.getZoom();const initialZoom=props.zoom;let scale=1+(currentZoom-initialZoom)*.15;scale=Math.max(.4,Math.min(scale,1.5));const popupElements=document.querySelectorAll(\".leaflet-popup\");popupElements.forEach(el=>{el.style.transform=`${el.style.transform.split(\"scale\")[0]} scale(${scale})`;el.style.transformOrigin=\"bottom center\";el.style.transition=\"transform 0.1s ease-out\";});};// Blokování mapy při otevřené galerii\nReact.useEffect(()=>{if(mapInstance.current){if(isGalleryOpen){mapInstance.current.dragging.disable();mapInstance.current.touchZoom.disable();}else{mapInstance.current.dragging.enable();mapInstance.current.touchZoom.enable();}}},[isGalleryOpen]);React.useEffect(()=>{const handlePopupClick=e=>{if(e.target&&e.target.id===\"open-gallery-btn\")setIsGalleryOpen(true);};document.addEventListener(\"click\",handlePopupClick);return()=>document.removeEventListener(\"click\",handlePopupClick);},[]);React.useEffect(()=>{if(!document.getElementById(\"leaflet-css\")){const link=document.createElement(\"link\");link.id=\"leaflet-css\";link.rel=\"stylesheet\";link.href=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.css\";document.head.appendChild(link);}const init=()=>initMap();if(window.L){init();}else{const script=document.createElement(\"script\");script.src=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.js\";script.async=true;script.onload=init;document.body.appendChild(script);}},[]);React.useEffect(()=>{if(mapInstance.current&&window.L){const map=mapInstance.current;const L=window.L;const globalPinPoint=map.project([props.lat,props.lng],props.zoom);const offsetPoint=L.point(0,props.offsetY);const newCenterLatLng=map.unproject(globalPinPoint.subtract(offsetPoint),props.zoom);map.setView(newCenterLatLng,props.zoom,{animate:false});if(markerInstance.current){markerInstance.current.setLatLng([props.lat,props.lng]);if(props.showPopup){const newContent=getPopupContent(props);markerInstance.current.bindPopup(newContent,{closeButton:false,autoClose:false,closeOnClick:false,className:\"custom-popup\"});if(!markerInstance.current.isPopupOpen())markerInstance.current.openPopup();markerInstance.current.setPopupContent(newContent);}}map.invalidateSize();updatePopupScale();}},[props.lat,props.lng,props.zoom,props.width,props.height,props.address,props.email,props.logo,props.offsetY,props.showPopup,props.logoHeight,props.popupWidth]);const getPopupContent=p=>{const logoHtml=p.logo?`<img src=\"${p.logo}\" style=\"height: ${p.logoHeight}px; width: auto; display: block; margin-bottom: 15px;\" />`:\"\";return`\n            <div style=\"padding: 18px; font-family: 'Inter', sans-serif; text-align: left; box-sizing: border-box;\">\n                ${logoHtml}\n                <p style=\"margin: 0 0 12px 0; font-size: 13px; color: #000; font-weight: 500; line-height: 1.4;\">${p.address.replace(/\\n/g,\"<br>\")}</p>\n                <div style=\"margin-bottom: 12px; border-top: 1px solid #eee; padding-top: 12px; font-size: 12px; line-height: 1.6;\">\n                    <div>Email: ${p.email}</div>\n                </div>\n                <div style=\"display: flex; gap: 6px; flex-direction: column;\">\n                    <button id=\"open-gallery-btn\" style=\"width: 100%; background: #fff; color: #000; border: 1px solid #000; padding: 8px; font-size: 10px; font-weight: 700; text-transform: uppercase; cursor: pointer;\">Foto navigace</button>\n                    <a href=\"${p.linkUrl}\" target=\"_blank\" style=\"display: block; background: #000; color: #fff; text-decoration: none; padding: 10px; font-size: 10px; font-weight: 700; text-transform: uppercase; text-align: center;\">Kudy k n\\xe1m →</a>\n                </div>\n            </div>\n        `;};const initMap=()=>{if(!mapRef.current||!window.L||mapInstance.current)return;const L=window.L;const map=L.map(mapRef.current,{center:[props.lat,props.lng],zoom:props.zoom,zoomControl:true,scrollWheelZoom:false,attributionControl:false,closePopupOnClick:false});map.on(\"zoom\",updatePopupScale);map.on(\"zoomend\",updatePopupScale);L.tileLayer(\"https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png\",{maxZoom:20}).addTo(map);const customIcon=L.divIcon({className:\"custom-pin\",html:`<div style=\"background:#000; width:12px; height:12px; border-radius:50%; animation: pulse-black 2s infinite;\"></div>`,iconSize:[40,40],iconAnchor:[20,20],popupAnchor:[0,-25]});markerInstance.current=L.marker([props.lat,props.lng],{icon:customIcon}).addTo(map);if(props.showPopup)markerInstance.current.bindPopup(getPopupContent(props),{closeButton:false,autoClose:false,closeOnClick:false}).openPopup();mapInstance.current=map;setTimeout(()=>{map.invalidateSize();updatePopupScale();},100);};const images=[props.img1,props.img2,props.img3,props.img4].filter(Boolean);return /*#__PURE__*/_jsxs(\"div\",{ref:mapRef,style:containerStyle,children:[isGalleryOpen&&/*#__PURE__*/_jsxs(\"div\",{onWheel:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),style:{position:\"absolute\",top:0,left:0,right:0,bottom:0,backgroundColor:\"black\",zIndex:1e4,display:\"flex\",flexDirection:\"column\",color:\"white\",overflowY:\"auto\",WebkitOverflowScrolling:\"touch\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{position:\"sticky\",top:0,backgroundColor:\"black\",zIndex:10,display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",padding:\"15px 20px\",borderBottom:\"1px solid #333\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{fontSize:\"10px\",fontWeight:700,textTransform:\"uppercase\",letterSpacing:\"2px\"},children:\"Cesta k n\\xe1m\"}),/*#__PURE__*/_jsx(\"button\",{onClick:()=>setIsGalleryOpen(false),style:{background:\"none\",border:\"none\",color:\"white\",fontSize:\"20px\",cursor:\"pointer\"},children:\"✕\"})]}),/*#__PURE__*/_jsx(\"div\",{className:\"barch-gallery-grid\",children:images.map((src,i)=>/*#__PURE__*/_jsx(\"img\",{src:src,className:\"gallery-img-bw\",style:{width:\"100%\",aspectRatio:\"3/4\",objectFit:\"cover\",border:\"1px solid #222\"}},i))})]}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes pulse-black { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(0, 0, 0, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); } }\n                .leaflet-control-zoom { border: none !important; box-shadow: 0px 5px 15px rgba(0,0,0,0.1) !important; margin: 15px !important; }\n                .leaflet-control-zoom-in, .leaflet-control-zoom-out { background: #fff !important; color: #000 !important; border: 1px solid #eee !important; border-radius: 0 !important; width: 30px !important; height: 30px !important; font-size: 14px !important; }\n                .leaflet-popup-content-wrapper { border-radius: 0 !important; padding: 0 !important; box-shadow: 10px 10px 30px rgba(0,0,0,0.1) !important; overflow: hidden; }\n                \n                /* DYNAMICK\\xc1 Š\\xcdŘKA BOXU */\n                .leaflet-popup-content { margin: 0 !important; width: ${props.popupWidth}px !important; }\n                \n                .barch-gallery-grid { padding: 10px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }\n                @media (min-width: 768px) { .barch-gallery-grid { grid-template-columns: repeat(4, 1fr); gap: 15px; padding: 30px; } }\n                .gallery-img-bw { filter: grayscale(100%) contrast(1.1); transition: filter 0.3s ease; }\n                .gallery-img-bw:hover { filter: grayscale(0%) contrast(1); }\n            `})]});}addPropertyControls(BarchMap,{showPopup:{type:ControlType.Boolean,title:\"Zobrazit info box\",defaultValue:true},popupWidth:{type:ControlType.Number,title:\"Š\\xedřka boxu\",defaultValue:240,min:150,max:400,step:10},logo:{type:ControlType.Image,title:\"Logo firmy\"},logoHeight:{type:ControlType.Number,title:\"Velikost loga\",defaultValue:45},img1:{type:ControlType.Image,title:\"Foto 1\"},img2:{type:ControlType.Image,title:\"Foto 2\"},img3:{type:ControlType.Image,title:\"Foto 3\"},img4:{type:ControlType.Image,title:\"Foto 4\"},lat:{type:ControlType.Number,title:\"Latitude\",defaultValue:48.9747,step:1e-4},lng:{type:ControlType.Number,title:\"Longitude\",defaultValue:14.4743,step:1e-4},zoom:{type:ControlType.Number,title:\"Z\\xe1kladn\\xed Zoom\",defaultValue:15},offsetY:{type:ControlType.Number,title:\"Posun mapy\",defaultValue:120},address:{type:ControlType.String,title:\"Adresa\",defaultValue:\"Hroznov\\xe1 24,\\n370 01 Česk\\xe9 Budějovice\",displayTextArea:true},email:{type:ControlType.String,title:\"E-mail\",defaultValue:\"info@barch.cz\"},linkUrl:{type:ControlType.String,title:\"Link mapy\",defaultValue:\"https://goo.gl/maps/...\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"BarchMap\":{\"type\":\"reactComponent\",\"name\":\"BarchMap\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Barch_Map.map"],"mappings":"6MAA4R,SAAgB,EAAS,EAAM,CAAC,IAAM,EAAOA,EAAa,KAAK,CAAO,EAAYA,EAAa,KAAK,CAAO,EAAeA,EAAa,KAAK,CAAM,CAAC,EAAc,GAAkBC,EAAe,GAAM,CAC9d,MAAqB,CAAC,GAAG,CAAC,EAAY,QAAQ,OAAoF,IAAI,EAAM,GAArE,EAAY,QAAQ,SAAS,CAAmB,EAAM,MAA2C,IAAI,EAAM,KAAK,IAAI,GAAG,KAAK,IAAI,EAAM,IAAI,CAAC,CAAqB,SAAS,iBAAiB,iBAAiB,CAAe,QAAQ,GAAI,CAAC,EAAG,MAAM,UAAU,GAAG,EAAG,MAAM,UAAU,MAAM,QAAQ,CAAC,GAAG,SAAS,EAAM,GAAG,EAAG,MAAM,gBAAgB,gBAA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