{"version":3,"file":"LocalityViewer.B7kE8Re6.mjs","names":["React.useRef"],"sources":["https:/framerusercontent.com/modules/wchZr8UkHoK6NhK8Hpj1/ZczY1B3DL5iiYPqdwdQq/LocalityDataNode.js","https:/framerusercontent.com/modules/ayBdMo40B0aS1bIfHS11/Dy1vCtHqZxyp7E9tAPEt/LocalityViewer.js"],"sourcesContent":["// Get Started: https://www.framer.com/developers\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";/**\n * LocalityDataNode\n *\n * Renders an invisible <div> with locality data as data attributes.\n * Place inside a Collection List bound to a linked Localities collection.\n * The StaffMap component reads these nodes from the DOM.\n *//**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function LocalityDataNode({locality,postcode,state,lat,lng}){return /*#__PURE__*/_jsx(\"div\",{\"data-locality-pin\":true,\"data-locality\":locality??\"\",\"data-postcode\":postcode??\"\",\"data-state\":state??\"\",\"data-lat\":lat??\"\",\"data-lng\":lng??\"\",style:{display:\"none\",position:\"absolute\",pointerEvents:\"none\"}});}LocalityDataNode.defaultProps={locality:\"\",postcode:\"\",state:\"\",lat:0,lng:0};LocalityDataNode.displayName=\"Locality Data Node\";addPropertyControls(LocalityDataNode,{locality:{type:ControlType.String,title:\"Locality\",defaultValue:\"\"},postcode:{type:ControlType.String,title:\"Postcode\",defaultValue:\"\"},state:{type:ControlType.String,title:\"State\",defaultValue:\"\"},lat:{type:ControlType.String,title:\"Latitude\",defaultValue:\"\"},lng:{type:ControlType.String,title:\"Longitude\",defaultValue:\"\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LocalityDataNode\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LocalityDataNode.map","import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{Frame,addPropertyControls,ControlType}from\"framer\";/**\n * LocalityViewer.tsx\n * Framer Code Component: OSM map with multiple circle overlays\n * Dynamically injects Leaflet via CDN (no install required)\n * Reads locality data from LocalityDataNode DOM elements.\n */function LocalityViewer(props){const{radiusKM,circleColor,showCircles,width,height,borderRadius}=props;const mapRef=React.useRef(null);const mapInstance=React.useRef(null);function getLocalities(){const nodes=document.querySelectorAll(\"[data-locality-pin]\");return Array.from(nodes).map(el=>({locality:el.dataset.locality,postcode:el.dataset.postcode,state:el.dataset.state,lat:parseFloat(el.dataset.lat),lng:parseFloat(el.dataset.lng)})).filter(loc=>!isNaN(loc.lat)&&!isNaN(loc.lng));}React.useEffect(()=>{const container=mapRef.current;if(!container)return;if(!document.querySelector(\"link[data-leaflet-css]\")){const link=document.createElement(\"link\");link.rel=\"stylesheet\";link.href=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.css\";link.setAttribute(\"data-leaflet-css\",\"\");document.head.appendChild(link);}const loadLeaflet=()=>new Promise(resolve=>{if(window.L)return resolve(null);const script=document.createElement(\"script\");script.src=\"https://unpkg.com/leaflet@1.9.4/dist/leaflet.js\";script.onload=()=>resolve(null);document.body.appendChild(script);});async function initMap(){await loadLeaflet();if(!container||!window.L)return;if(mapInstance.current){mapInstance.current.remove();}mapInstance.current=window.L.map(container,{zoomControl:false,attributionControl:false});window.L.tileLayer(\"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png\",{attribution:'&copy; <a href=\"https://www.openstreetmap.org\">OpenStreetMap</a> contributors'}).addTo(mapInstance.current);if(!document.getElementById(\"leaflet-grayscale-style\")){const styleEl=document.createElement(\"style\");styleEl.id=\"leaflet-grayscale-style\";styleEl.textContent=`\n                    .leaflet-container .leaflet-tile {\n                        filter: grayscale(100%);\n                    }\n                `;document.head.appendChild(styleEl);}const locations=getLocalities();if(locations.length){const rMeters=radiusKM*1e3;const earthRadius=6378137;let south=Infinity,north=-Infinity,west=Infinity,east=-Infinity;for(const loc of locations){const latDelta=rMeters/earthRadius*(180/Math.PI);const lonDelta=latDelta/Math.cos(loc.lat*Math.PI/180);south=Math.min(south,loc.lat-latDelta);north=Math.max(north,loc.lat+latDelta);west=Math.min(west,loc.lng-lonDelta);east=Math.max(east,loc.lng+lonDelta);if(showCircles){window.L.circle([loc.lat,loc.lng],{color:circleColor,opacity:.5,weight:2,fillColor:circleColor,fillOpacity:.15,radius:rMeters}).addTo(mapInstance.current);}}mapInstance.current.fitBounds([[south,west],[north,east]]);mapInstance.current.invalidateSize();}else{mapInstance.current.setView([-25.2744,133.7751],4);}}initMap();return()=>{if(mapInstance.current){mapInstance.current.remove();mapInstance.current=null;}};},[radiusKM,circleColor,showCircles]);React.useEffect(()=>{if(mapInstance.current){mapInstance.current.invalidateSize();}},[width,height]);const handleZoomIn=()=>mapInstance.current?.zoomIn();const handleZoomOut=()=>mapInstance.current?.zoomOut();return /*#__PURE__*/_jsxs(Frame,{width:\"100%\",height:\"100%\",background:\"none\",radius:borderRadius,overflow:\"hidden\",style:{position:\"relative\",zIndex:0},children:[/*#__PURE__*/_jsx(\"div\",{ref:mapRef,style:{width:\"100%\",height:\"100%\"}}),/*#__PURE__*/_jsxs(\"div\",{style:{position:\"absolute\",top:10,right:10,zIndex:1e3,display:\"flex\",flexDirection:\"column\"},children:[/*#__PURE__*/_jsx(\"button\",{style:{width:30,height:30,marginBottom:5,border:\"none\",borderRadius:4,background:\"#fff\",cursor:\"pointer\"},onClick:handleZoomIn,children:\"+\"}),/*#__PURE__*/_jsx(\"button\",{style:{width:30,height:30,border:\"none\",borderRadius:4,background:\"#fff\",cursor:\"pointer\"},onClick:handleZoomOut,children:\"-\"})]})]});}export default LocalityViewer;LocalityViewer.defaultProps={radiusKM:5,circleColor:\"#FF0000\",showCircles:true,width:600,height:400,borderRadius:8};LocalityViewer.displayName=\"Locality Viewer\";addPropertyControls(LocalityViewer,{showCircles:{type:ControlType.Boolean,title:\"Show Circles\",defaultValue:true,enabledTitle:\"Visible\",disabledTitle:\"Hidden\"},radiusKM:{type:ControlType.Number,title:\"Radius (km)\",defaultValue:5,min:1,max:100,step:1,displayStepper:true,hidden:props=>!props.showCircles},circleColor:{type:ControlType.Color,title:\"Circle Color\",hidden:props=>!props.showCircles},width:{type:ControlType.Number,title:\"Width\",min:100,step:1},height:{type:ControlType.Number,title:\"Height\",min:100,step:1},borderRadius:{type:ControlType.Number,title:\"Corner Radius\",min:0,step:1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LocalityViewer\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LocalityViewer.map"],"mappings":"wMAUG,SAAwB,EAAiB,CAAC,WAAS,WAAS,QAAM,MAAI,OAAK,CAAC,OAAoB,EAAK,MAAM,CAAC,oBAAoB,GAAK,gBAAgB,GAAU,GAAG,gBAAgB,GAAU,GAAG,aAAa,GAAO,GAAG,WAAW,GAAK,GAAG,WAAW,GAAK,GAAG,MAAM,CAAC,QAAQ,OAAO,SAAS,WAAW,cAAc,OAAO,CAAC,CAAC,kBATrR,IAAoD,CASmO,EAAiB,aAAa,CAAC,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,EAAiB,YAAY,qBAAqB,EAAoB,EAAiB,CAAC,SAAS,CAAC,KAAK,EAAY,OAAO,MAAM,WAAW,aAAa,GAAG,CAAC,SAAS,CAAC,KAAK,EAAY,OAAO,MAAM,WAAW,aAAa,GAAG,CAAC,MAAM,CAAC,KAAK,EAAY,OAAO,MAAM,QAAQ,aAAa,GAAG,CAAC,IAAI,CAAC,KAAK,EAAY,OAAO,MAAM,WAAW,aAAa,GAAG,CAAC,IAAI,CAAC,KAAK,EAAY,OAAO,MAAM,YAAY,aAAa,GAAG,CAAC,CAAC,ICL1yB,SAAS,EAAe,EAAM,CAAC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