1import{r as x,j as l}from"./vendor-react-OCc4dLhu.js";import{u as qe,d as Ke,l as xe,b as ve,f as Qe,c as Ye,L as N,e as Je,M as Xe,T as et,a as B}from"./leaflet-O-0gmm2v.js";import{a as tt,T as nt,p as it,e as rt,ak as ot,h as st,t as ne,d as at,v as lt}from"./index-4TahScS1.js";import{o as Le,m as ct,a as oe,h as ye,p as ie,b as G,c as z,g as A,f as ee,d as F}from"./mapUtils-DomPKREr.js";import{L as W}from"./vendor-router-DfjHVv-z.js";import{P as Z}from"./Popup-BrR13zDP.js";import"./vendor-dnd-kit-CAuH8bg0.js";function P(){return qe().map}function se(u){const a=P();return x.useEffect(function(){return a.on(u),function(){a.off(u)}},[a,u]),a}const ut=Ke(function(a,f){const g=new xe.Tooltip(a,f.overlayContainer);return ve(g,f)},function(a,f,{position:g},_){x.useEffect(function(){const t=f.overlayContainer;if(t==null)return;const{instance:n}=a,i=s=>{s.tooltip===n&&(g!=null&&n.setLatLng(g),n.update(),_(!0))},r=s=>{s.tooltip===n&&_(!1)};return t.on({tooltipopen:i,tooltipclose:r}),t.bindTooltip(n),function(){t.off({tooltipopen:i,tooltipclose:r}),t._map!=null&&t.unbindTooltip()}},[a,f,_,g])}),dt=Qe(function(a){return new xe.Control.Zoom(a)});var U={exports:{}},ht=U.exports,fe;function ft(){return fe||(fe=1,(function(u,a){(function(f,g){g(a)})(ht,function(f){var g=L.MarkerClusterGroup=L.FeatureGroup.extend({options:{maxClusterRadius:80,iconCreateFunction:null,clusterPane:L.Marker.prototype.options.pane,spiderfyOnEveryZoom:!1,spiderfyOnMaxZoom:!0,showCoverageOnHover:!0,zoomToBoundsOnClick:!0,singleMarkerMode:!1,disableClusteringAtZoom:null,removeOutsideVisibleBounds:!0,animate:!0,animateAddingMarkers:!1,spiderfyShapePositions:null,spiderfyDistanceMultiplier:1,spiderLegPolylineOptions:{weight:1.5,color:"#222",opacity:.5},chunkedLoading:!1,chunkInterval:200,chunkDelay:50,chunkProgress:null,polygonOptions:{}},initialize:function(e){L.Util.setOptions(this,e),this.options.iconCreateFunction||(this.options.iconCreateFunction=this._defaultIconCreateFunction),this._featureGroup=L.featureGroup(),this._featureGroup.addEventParent(this),this._nonPointGroup=L.featureGroup(),this._nonPointGroup.addEventParent(this),this._inZoomAnimation=0,this._needsClustering=[],this._needsRemoving=[],this._currentShownBounds=null,this._queue=[],this._childMarkerEventHandlers={dragstart:this._childMarkerDragStart,move:this._childMarkerMoved,dragend:this._childMarkerDragEnd};var t=L.DomUtil.TRANSITION&&this.options.animate;L.extend(this,t?this._withAnimation:this._noAnimation),this._markerCluster=t?L.MarkerCluster:L.MarkerClusterNonAnimated},addLayer:function(e){if(e instanceof L.LayerGroup)return this.addLayers([e]);if(!e.getLatLng)return this._nonPointGroup.addLayer(e),this.fire("layeradd",{layer:e}),this;if(!this._map)return this._needsClustering.push(e),this.fire("layeradd",{layer:e}),this;if(this.hasLayer(e))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(e,this._maxZoom),this.fire("layeradd",{layer:e}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons();var t=e,n=this._zoom;if(e.__parent)for(;t.__parent._zoom>=n;)t=t.__parent;return this._currentShownBounds.contains(t.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(e,t):this._animationAddLayerNonAnimated(e,t)),this},removeLayer:function(e){return e instanceof L.LayerGroup?this.removeLayers([e]):e.getLatLng?this._map?e.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(e)),this._removeLayer(e,!0),this.fire("layerremove",{layer:e}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),e.off(this._childMarkerEventHandlers,this),this._featureGroup.hasLayer(e)&&(this._featureGroup.removeLayer(e),e.clusterShow&&e.clusterShow()),this):this:(!this._arraySplice(this._needsClustering,e)&&this.hasLayer(e)&&this._needsRemoving.push({layer:e,latlng:e._latlng}),this.fire("layerremove",{layer:e}),this):(this._nonPointGroup.removeLayer(e),this.fire("layerremove",{layer:e}),this)},addLayers:function(e,t){if(!L.Util.isArray(e))return this.addLayer(e);var n=this._featureGroup,i=this._nonPointGroup,r=this.options.chunkedLoading,s=this.options.chunkInterval,o=this.options.chunkProgress,c=e.length,d=0,p=!0,m;if(this._map){var b=new Date().getTime(),v=L.bind(function(){var M=new Date().getTime();for(this._map&&this._unspiderfy&&this._unspiderfy();d<c;d++){if(r&&d%200===0){var R=new Date().getTime()-M;if(R>s)break}if(m=e[d],m instanceof L.LayerGroup){p&&(e=e.slice(),p=!1),this._extractNonGroupLayers(m,e),c=e.length;continue}if(!m.getLatLng){i.addLayer(m),t||this.fire("layeradd",{layer:m});continue}if(!this.hasLayer(m)&&(this._addLayer(m,this._maxZoom),t||this.fire("layeradd",{layer:m}),m.__parent&&m.__parent.getChildCount()===2)){var E=m.__parent.getAllChildMarkers(),Q=E[0]===m?E[1]:E[0];n.removeLayer(Q)}}o&&o(d,c,new Date().getTime()-b),d===c?(this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)):setTimeout(v,this.options.chunkDelay)},this);v()}else for(var k=this._needsClustering;d<c;d++){if(m=e[d],m instanceof L.LayerGroup){p&&(e=e.slice(),p=!1),this._extractNonGroupLayers(m,e),c=e.length;continue}if(!m.getLatLng){i.addLayer(m);continue}this.hasLayer(m)||k.push(m)}return this},removeLayers:function(e){var t,n,i=e.length,r=this._featureGroup,s=this._nonPointGroup,o=!0;if(!this._map){for(t=0;t<i;t++){if(n=e[t],n instanceof L.LayerGroup){o&&(e=e.slice(),o=!1),this._extractNonGroupLayers(n,e),i=e.length;continue}this._arraySplice(this._needsClustering,n),s.removeLayer(n),this.hasLayer(n)&&this._needsRemoving.push({layer:n,latlng:n._latlng}),this.fire("layerremove",{layer:n})}return this}if(this._unspiderfy){this._unspiderfy();var c=e.slice(),d=i;for(t=0;t<d;t++){if(n=c[t],n instanceof L.LayerGroup){this._extractNonGroupLayers(n,c),d=c.length;continue}this._unspiderfyLayer(n)}}for(t=0;t<i;t++){if(n=e[t],n instanceof L.LayerGroup){o&&(e=e.slice(),o=!1),this._extractNonGroupLayers(n,e),i=e.length;continue}if(!n.__parent){s.removeLayer(n),this.fire("layerremove",{layer:n});continue}this._removeLayer(n,!0,!0),this.fire("layerremove",{layer:n}),r.hasLayer(n)&&(r.removeLayer(n),n.clusterShow&&n.clusterShow())}return this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds),this},clearLayers:function(){return this._map||(this._needsClustering=[],this._needsRemoving=[],delete this._gridClusters,delete this._gridUnclustered),this._noanimationUnspiderfy&&this._noanimationUnspiderfy(),this._featureGroup.clearLayers(),this._nonPointGroup.clearLayers(),this.eachLayer(function(e){e.off(this._childMarkerEventHandlers,this),delete e.__parent},this),this._map&&this._generateInitialClusters(),this},getBounds:function(){var e=new L.LatLngBounds;this._topClusterLevel&&e.extend(this._topClusterLevel._bounds);for(var t=this._needsClustering.length-1;t>=0;t--)e.extend(this._needsClustering[t].getLatLng());return e.extend(this._nonPointGroup.getBounds()),e},eachLayer:function(e,t){var n=this._needsClustering.slice(),i=this._needsRemoving,r,s,o;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(n),s=n.length-1;s>=0;s--){for(r=!0,o=i.length-1;o>=0;o--)if(i[o].layer===n[s]){r=!1;break}r&&e.call(t,n[s])}this._nonPointGroup.eachLayer(e,t)},getLayers:function(){var e=[];return this.eachLayer(function(t){e.push(t)}),e},getLayer:function(e){var t=null;return e=parseInt(e,10),this.eachLayer(function(n){L.stamp(n)===e&&(t=n)}),t},hasLayer:function(e){if(!e)return!1;var t,n=this._needsClustering;for(t=n.length-1;t>=0;t--)if(n[t]===e)return!0;for(n=this._needsRemoving,t=n.length-1;t>=0;t--)if(n[t].layer===e)return!1;return!!(e.__parent&&e.__parent._group===this)||this._nonPointGroup.hasLayer(e)},zoomToShowLayer:function(e,t){var n=this._map;typeof t!="function"&&(t=function(){});var i=function(){(n.hasLayer(e)||n.hasLayer(e.__parent))&&!this._inZoomAnimation&&(this._map.off("moveend",i,this),this.off("animationend",i,this),n.hasLayer(e)?t():e.__parent._icon&&(this.once("spiderfied",t,this),e.__parent.spiderfy()))};e._icon&&this._map.getBounds().contains(e.getLatLng())?t():e.__parent._zoom<Math.round(this._map._zoom)?(this._map.on("moveend",i,this),this._map.panTo(e.getLatLng())):(this._map.on("moveend",i,this),this.on("animationend",i,this),e.__parent.zoomToBounds())},onAdd:function(e){this._map=e;var t,n,i;if(!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";
1for(this._featureGroup.addTo(e),this._nonPointGroup.addTo(e),this._gridClusters||this._generateInitialClusters(),this._maxLat=e.options.crs.projection.MAX_LATITUDE,t=0,n=this._needsRemoving.length;t<n;t++)i=this._needsRemoving[t],i.newlatlng=i.layer._latlng,i.layer._latlng=i.latlng;for(t=0,n=this._needsRemoving.length;t<n;t++)i=this._needsRemoving[t],this._removeLayer(i.layer,!0),i.layer._latlng=i.newlatlng;this._needsRemoving=[],this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds(),this._map.on("zoomend",this._zoomEnd,this),this._map.on("moveend",this._moveEnd,this),this._spiderfierOnAdd&&this._spiderfierOnAdd(),this._bindEvents(),n=this._needsClustering,this._needsClustering=[],this.addLayers(n,!0)},onRemove:function(e){e.off("zoomend",this._zoomEnd,this),e.off("moveend",this._moveEnd,this),this._unbindEvents(),this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim",""),this._spiderfierOnRemove&&this._spiderfierOnRemove(),delete this._maxLat,this._hideCoverage(),this._featureGroup.remove(),this._nonPointGroup.remove(),this._featureGroup.clearLayers(),this._map=null},getVisibleParent:function(e){for(var t=e;t&&!t._icon;)t=t.__parent;return t||null},_arraySplice:function(e,t){for(var n=e.length-1;n>=0;n--)if(e[n]===t)return e.splice(n,1),!0},_removeFromGridUnclustered:function(e,t){for(var n=this._map,i=this._gridUnclustered,r=Math.floor(this._map.getMinZoom());t>=r&&i[t].removeObject(e,n.project(e.getLatLng(),t));t--);},_childMarkerDragStart:function(e){e.target.__dragStart=e.target._latlng},_childMarkerMoved:function(e){if(!this._ignoreMove&&!e.target.__dragStart){var t=e.target._popup&&e.target._popup.isOpen();this._moveChild(e.target,e.oldLatLng,e.latlng),t&&e.target.openPopup()}},_moveChild:function(e,t,n){e._latlng=t,this.removeLayer(e),e._latlng=n,this.addLayer(e)},_childMarkerDragEnd:function(e){var t=e.target.__dragStart;delete e.target.__dragStart,t&&this._moveChild(e.target,t,e.target._latlng)},_removeLayer:function(e,t,n){var i=this._gridClusters,r=this._gridUnclustered,s=this._featureGroup,o=this._map,c=Math.floor(this._map.getMinZoom());t&&this._removeFromGridUnclustered(e,this._maxZoom);var d=e.__parent,p=d._markers,m;for(this._arraySplice(p,e);d&&(d._childCount--,d._boundsNeedUpdate=!0,!(d._zoom<c));)t&&d._childCount<=1?(m=d._markers[0]===e?d._markers[1]:d._markers[0],i[d._zoom].removeObject(d,o.project(d._cLatLng,d._zoom)),r[d._zoom].addObject(m,o.project(m.getLatLng(),d._zoom)),this._arraySplice(d.__parent._childClusters,d),d.__parent._markers.push(m),m.__parent=d.__parent,d._icon&&(s.removeLayer(d),n||s.addLayer(m))):d._iconNeedsUpdate=!0,d=d.__parent;delete e.__parent},_isOrIsParent:function(e,t){for(;t;){if(e===t)return!0;t=t.parentNode}return!1},fire:function(e,t,n){if(t&&t.layer instanceof L.MarkerCluster){if(t.originalEvent&&this._isOrIsParent(t.layer._icon,t.originalEvent.relatedTarget))return;e="cluster"+e}L.FeatureGroup.prototype.fire.call(this,e,t,n)},listens:function(e,t){return L.FeatureGroup.prototype.listens.call(this,e,t)||L.FeatureGroup.prototype.listens.call(this,"cluster"+e,t)},_defaultIconCreateFunction:function(e){var t=e.getChildCount(),n=" marker-cluster-";return t<10?n+="small":t<100?n+="medium":n+="large",new L.DivIcon({html:"<div><span>"+t+"</span></div>",className:"marker-cluster"+n,iconSize:new L.Point(40,40)})},_bindEvents:function(){var e=this._map,t=this.options.spiderfyOnMaxZoom,n=this.options.showCoverageOnHover,i=this.options.zoomToBoundsOnClick,r=this.options.spiderfyOnEveryZoom;(t||i||r)&&this.on("clusterclick clusterkeypress",this._zoomOrSpiderfy,this),n&&(this.on("clustermouseover",this._showCoverage,this),this.on("clustermouseout",this._hideCoverage,this),e.on("zoomend",this._hideCoverage,this))},_zoomOrSpiderfy:function(e){var t=e.layer,n=t;if(!(e.type==="clusterkeypress"&&e.originalEvent&&e.originalEvent.keyCode!==13)){for(;n._childClusters.length===1;)n=n._childClusters[0];n._zoom===this._maxZoom&&n._childCount===t._childCount&&this.options.spiderfyOnMaxZoom?t.spiderfy():this.options.zoomToBoundsOnClick&&t.zoomToBounds(),this.options.spiderfyOnEveryZoom&&t.spiderfy(),e.originalEvent&&e.originalEvent.keyCode===13&&this._map._container.focus()}},_showCoverage:function(e){var t=this._map;this._inZoomAnimation||(this._shownPolygon&&t.removeLayer(this._shownPolygon),e.layer.getChildCount()>2&&e.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(e.layer.getConvexHull(),this.options.polygonOptions),t.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var e=this.options.spiderfyOnMaxZoom,t=this.options.showCoverageOnHover,n=this.options.zoomToBoundsOnClick,i=this.options.spiderfyOnEveryZoom,r=this._map;(e||n||i)&&this.off("clusterclick clusterkeypress",this._zoomOrSpiderfy,this),t&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),r.off("zoomend",this._hideCoverage,this))}
1,_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var e=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,e),this._topClusterLevel._recursivelyAddChildrenToMap(null,Math.round(this._map._zoom),e),this._currentShownBounds=e}},_generateInitialClusters:function(){var e=Math.ceil(this._map.getMaxZoom()),t=Math.floor(this._map.getMinZoom()),n=this.options.maxClusterRadius,i=n;typeof n!="function"&&(i=function(){return n}),this.options.disableClusteringAtZoom!==null&&(e=this.options.disableClusteringAtZoom-1),this._maxZoom=e,this._gridClusters={},this._gridUnclustered={};for(var r=e;r>=t;r--)this._gridClusters[r]=new L.DistanceGrid(i(r)),this._gridUnclustered[r]=new L.DistanceGrid(i(r));this._topClusterLevel=new this._markerCluster(this,t-1)},_addLayer:function(e,t){var n=this._gridClusters,i=this._gridUnclustered,r=Math.floor(this._map.getMinZoom()),s,o;for(this.options.singleMarkerMode&&this._overrideMarkerIcon(e),e.on(this._childMarkerEventHandlers,this);t>=r;t--){s=this._map.project(e.getLatLng(),t);var c=n[t].getNearObject(s);if(c){c._addChild(e),e.__parent=c;return}if(c=i[t].getNearObject(s),c){var d=c.__parent;d&&this._removeLayer(c,!1);var p=new this._markerCluster(this,t,c,e);n[t].addObject(p,this._map.project(p._cLatLng,t)),c.__parent=p,e.__parent=p;var m=p;for(o=t-1;o>d._zoom;o--)m=new this._markerCluster(this,o,m),n[o].addObject(m,this._map.project(c.getLatLng(),o));d._addChild(m),this._removeFromGridUnclustered(c,t);return}i[t].addObject(e,s)}this._topClusterLevel._addChild(e),e.__parent=this._topClusterLevel},_refreshClustersIcons:function(){this._featureGroup.eachLayer(function(e){e instanceof L.MarkerCluster&&e._iconNeedsUpdate&&e._updateIcon()})},_enqueue:function(e){this._queue.push(e),this._queueTimeout||(this._queueTimeout=setTimeout(L.bind(this._processQueue,this),300))},_processQueue:function(){for(var e=0;e<this._queue.length;e++)this._queue[e].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){var e=Math.round(this._map._zoom);this._processQueue(),this._zoom<e&&this._currentShownBounds.intersects(this._getExpandedVisibleBounds())?(this._animationStart(),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,this._getExpandedVisibleBounds()),this._animationZoomIn(this._zoom,e)):this._zoom>e?(this._animationStart(),this._animationZoomOut(this._zoom,e)):this._moveEnd()},_getExpandedVisibleBounds:function(){if(this.options.removeOutsideVisibleBounds){if(L.Browser.mobile)return this._checkBoundsMaxLat(this._map.getBounds())}else return this._mapBoundsInfinite;return this._checkBoundsMaxLat(this._map.getBounds().pad(1))},_checkBoundsMaxLat:function(e){var t=this._maxLat;return t!==void 0&&(e.getNorth()>=t&&(e._northEast.lat=1/0),e.getSouth()<=-t&&(e._southWest.lat=-1/0)),e},_animationAddLayerNonAnimated:function(e,t){if(t===e)this._featureGroup.addLayer(e);else if(t._childCount===2){t._addToMap();var n=t.getAllChildMarkers();this._featureGroup.removeLayer(n[0]),this._featureGroup.removeLayer(n[1])}else t._updateIcon()},_extractNonGroupLayers:function(e,t){var n=e.getLayers(),i=0,r;for(t=t||[];i<n.length;i++){if(r=n[i],r instanceof L.LayerGroup){this._extractNonGroupLayers(r,t);continue}t.push(r)}return t},_overrideMarkerIcon:function(e){var t=e.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[e]}});return t}});L.MarkerClusterGroup.include({_mapBoundsInfinite:new L.LatLngBounds(new L.LatLng(-1/0,-1/0),new L.LatLng(1/0,1/0))}),L.MarkerClusterGroup.include({_noAnimation:{_animationStart:function(){},_animationZoomIn:function(e,t){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),e),this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationZoomOut:function(e,t){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),e),this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationAddLayer:function(e,t){this._animationAddLayerNonAnimated(e,t)}},_withAnimation:{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim",this._inZoomAnimation++},_animationZoomIn:function(e,t){var n=this._getExpandedVisibleBounds(),i=this._featureGroup,r=Math.floor(this._map.getMinZoom()),s;this._ignoreMove=!0,this._topClusterLevel._recursively(n,e,r,function(o){var c=o._latlng,d=o._markers,p;for(n.contains(c)||(c=null),o._isSingleParent()&&e+1===t?(i.removeLayer(o),o._recursivelyAddChildrenToMap(null,t,n)):(o.clusterHide(),o._recursivelyAddChildrenToMap(c,t,n)),s=d.length-1;s>=0;s--)p=d[s],n.contains(p._latlng)||i.removeLayer(p)}),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(n,t),i.eachLayer(function(o){!(o instanceof L.MarkerCluster)&&o._icon&&o.clusterShow()}),this._topClusterLevel._recursively(n,e,t,function(o){o._recursivelyRestoreChildPositions(t)}),this._ignoreMove=!1,this._enqueue(function(){this._topClusterLevel._recursively(n,e,r,function(o){i.removeLayer(o),o.clusterShow()}),this._animationEnd()})},_animationZoomOut:function(e,t){this._animationZoomOutSingle(this._topClusterLevel,e-1,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,t,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),e,this._getExpandedVisibleBounds())},_animationAddLayer:function(e,t){var n=this,i=this._featureGroup;i.addLayer(e),t!==e&&(t._childCount>2?(t._updateIcon(),this._forceLayout(),this._animationStart(),e._setPos(this._map.latLngToLayerPoint(t.getLatLng())),e.clusterHide(),this._enqueue(function(){i.removeLayer(e),e.clusterShow(),n._animationEnd()})):(this._forceLayout(),n._animationStart(),n._animationZoomOutSingle(t,this._map.getMaxZoom(),this._zoom)))}},_animationZoomOutSingle:function(e,t,n){var i=this._getExpandedVisibleBounds(),r=Math.floor(this._map.getMinZoom());e._recursivelyAnimateChildrenInAndAddSelfToMap(i,r,t+1,n);var s=this;this._forceLayout(),e._recursivelyBecomeVisible(i,n),this._enqueue(function(){if(e._childCount===1){var o=e._markers[0];this._ignoreMove=!0,o.setLatLng(o.getLatLng()),this._ignoreMove=!1,o.clusterShow&&o.clusterShow()}else e._recursively(i,n,r,function(c){c._recursivelyRemoveChildrenFromMap(i,r,t+1)});s._animationEnd()})},_animationEnd:function(){this._map&&(this._map._mapPane.className=this._map._mapPane.className.replace(" leaflet-cluster-anim","")),this._inZoomAnimation--,this.fire("animationend")},_forceLayout:function(){L.Util.falseFn(document.body.offsetWidth)}}),L.markerClusterGroup=function(e){return new L.MarkerClusterGroup(e)};
1var _=L.MarkerCluster=L.Marker.extend({options:L.Icon.prototype.options,initialize:function(e,t,n,i){L.Marker.prototype.initialize.call(this,n?n._cLatLng||n.getLatLng():new L.LatLng(0,0),{icon:this,pane:e.options.clusterPane}),this._group=e,this._zoom=t,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._bounds=new L.LatLngBounds,n&&this._addChild(n),i&&this._addChild(i)},getAllChildMarkers:function(e,t){e=e||[];for(var n=this._childClusters.length-1;n>=0;n--)this._childClusters[n].getAllChildMarkers(e,t);for(var i=this._markers.length-1;i>=0;i--)t&&this._markers[i].__dragStart||e.push(this._markers[i]);return e},getChildCount:function(){return this._childCount},zoomToBounds:function(e){for(var t=this._childClusters.slice(),n=this._group._map,i=n.getBoundsZoom(this._bounds),r=this._zoom+1,s=n.getZoom(),o;t.length>0&&i>r;){r++;var c=[];for(o=0;o<t.length;o++)c=c.concat(t[o]._childClusters);t=c}i>r?this._group._map.setView(this._latlng,r):i<=s?this._group._map.setVie
1w(this._latlng,s+1):this._group._map.fitBounds(this._bounds,e)},getBounds:function(){var e=new L.LatLngBounds;return e.extend(this._bounds),e},_updateIcon:function(){this._iconNeedsUpdate=!0,this._icon&&this.setIcon(this)},createIcon:function(){return this._iconNeedsUpdate&&(this._iconObj=this._group.options.iconCreateFunction(this),this._iconNeedsUpdate=!1),this._iconObj.createIcon()},createShadow:function(){return this._iconObj.createShadow()},_addChild:function(e,t){this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._setClusterCenter(e),e instanceof L.MarkerCluster?(t||(this._childClusters.push(e),e.__parent=this),this._childCount+=e._childCount):(t||this._markers.push(e),this._childCount++),this.__parent&&this.__parent._addChild(e,!0)},_setClusterCenter:function(e){this._cLatLng||(this._cLatLng=e._cLatLng||e._latlng)},_resetBounds:function(){var e=this._bounds;e._southWest&&(e._southWest.lat=1/0,e._southWest.lng=1/0),e._northEast&&(e._northEast.lat=-1/0,e._northEast.lng=-1/0)},_recalculateBounds:function(){var e=this._markers,t=this._childClusters,n=0,i=0,r=this._childCount,s,o,c,d;if(r!==0){for(this._resetBounds(),s=0;s<e.length;s++)c=e[s]._latlng,this._bounds.extend(c),n+=c.lat,i+=c.lng;for(s=0;s<t.length;s++)o=t[s],o._boundsNeedUpdate&&o._recalculateBounds(),this._bounds.extend(o._bounds),c=o._wLatLng,d=o._childCount,n+=c.lat*d,i+=c.lng*d;this._latlng=this._wLatLng=new L.LatLng(n/r,i/r),this._boundsNeedUpdate=!1}},_addToMap:function(e){e&&(this._backupLatlng=this._latlng,this.setLatLng(e)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(e,t,n){this._recursively(e,this._group._map.getMinZoom(),n-1,function(i){var r=i._markers,s,o;for(s=r.length-1;s>=0;s--)o=r[s],o._icon&&(o._setPos(t),o.clusterHide())},function(i){var r=i._childClusters,s,o;for(s=r.length-1;s>=0;s--)o=r[s],o._icon&&(o._setPos(t),o.clusterHide())})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(e,t,n,i){this._recursively(e,i,t,function(r){r._recursivelyAnimateChildrenIn(e,r._group._map.latLngToLayerPoint(r.getLatLng()).round(),n),r._isSingleParent()&&n-1===i?(r.clusterShow(),r._recursivelyRemoveChildrenFromMap(e,t,n)):r.clusterHide(),r._addToMap()})},_recursivelyBecomeVisible:function(e,t){this._recursively(e,this._group._map.getMinZoom(),t,null,function(n){n.clusterShow()})},_recursivelyAddChildrenToMap:function(e,t,n){this._recursively(n,this._group._map.getMinZoom()-1,t,function(i){if(t!==i._zoom)for(var r=i._markers.length-1;r>=0;r--){var s=i._markers[r];n.contains(s._latlng)&&(e&&(s._backupLatlng=s.getLatLng(),s.setLatLng(e),s.clusterHide&&s.clusterHide()),i._group._featureGroup.addLayer(s))}},function(i){i._addToMap(e)})},_recursivelyRestoreChildPositions:function(e){for(var t=this._markers.length-1;t>=0;t--){var n=this._markers[t];n._backupLatlng&&(n.setLatLng(n._backupLatlng),delete n._backupLatlng)}if(e-1===this._zoom)for(var i=this._childClusters.length-1;i>=0;i--)this._childClusters[i]._restorePosition();else for(var r=this._childClusters.length-1;r>=0;r--)this._childClusters[r]._recursivelyRestoreChildPositions(e)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(e,t,n,i){var r,s;this._recursively(e,t-1,n-1,function(o){for(s=o._markers.length-1;s>=0;s--)r=o._markers[s],(!i||!i.contains(r._latlng))&&(o._group._featureGroup.removeLayer(r),r.clusterShow&&r.clusterShow())},function(o){for(s=o._childClusters.length-1;s>=0;s--)r=o._childClusters[s],(!i||!i.contains(r._latlng))&&(o._group._featureGroup.removeLayer(r),r.clusterShow&&r.clusterShow())})},_recursively:function(e,t,n,i,r){var s=this._childClusters,o=this._zoom,c,d;if(t<=o&&(i&&i(this),r&&o===n&&r(this)),o<t||o<n)for(c=s.length-1;c>=0;c--)d=s[c],d._boundsNeedUpdate&&d._recalculateBounds(),e.intersects(d._bounds)&&d._recursively(e,t,n,i,r)},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}});L.Marker.include({clusterHide:function(){var e=this.options.opacity;return this.setOpacity(0),this.options.opacity=e,this},clusterShow:function(){return this.setOpacity(this.options.opacity)}}),L.DistanceGrid=function(e){this._cellSize=e,this._sqCellSize=e*e,this._grid={},this._objectPoint={}},L.DistanceGrid.prototype={addObject:function(e,t){var n=this._getCoord(t.x),i=this._getCoord(t.y),r=this._grid,s=r[i]=r[i]||{},o=s[n]=s[n]||[],c=L.Util.stamp(e);this._objectPoint[c]=t,o.push(e)},updateObject:function(e,t){this.removeObject(e),this.addObject(e,t)},removeObject:function(e,t){var n=this._getCoord(t.x),i=this._getCoord(t.y),r=this._grid,s=r[i]=r[i]||{},o=s[n]=s[n]||[],c,d;for(delete this._objectPoint[L.Util.stamp(e)],c=0,d=o.length;c<d;c++)if(o[c]===e)return o.splice(c,1),d===1&&delete s[n],!0},eachObject:function(e,t){var n,i,r,s,o,c,d,p=this._grid;for(n in p){o=p[n];for(i in o)for(c=o[i],r=0,s=c.length;r<s;r++)d=e.call(t,c[r]),d&&(r--,s--)}},getNearObject:function(e){var t=this._getCoord(e.x),n=this._getCoord(e.y),i,r,s,o,c,d,p,m,b=this._objectPoint,v=this._sqCellSize,k=null;for(i=n-1;i<=n+1;i++)if(o=this._grid[i],o){for(r=t-1;r<=t+1;r++)if(c=o[r],c)for(s=0,d=c.length;s<d;s++)p=c[s],m=this._sqDist(b[L.Util.stamp(p)],e),(m<v||m<=v&&k===null)&&(v=m,k=p)}return k},_getCoord:function(e){var t=Math.floor(e/this._cellSize);return isFinite(t)?t:e},_sqDist:function(e,t){var n=t.x-e.x,i=t.y-e.y;return n*n+i*i}},(function(){L.QuickHull={getDistant:function(e,t){var n=t[1].lat-t[0].lat,i=t[0].lng-t[1].lng;return i*(e.lat-t[0].lat)+n*(e.lng-t[0].lng)},findMostDistantPointFromBaseLine:function(e,t){var n=0,i=null,r=[],s,o,c;for(s=t.length-1;s>=0;s--){if(o=t[s],c=this.getDistant(o,e),c>0)r.push(o);else continue;c>n&&(n=c,i=o)}return{maxPoint:i,newPoints:r}},buildConvexHull:function(e,t){var n=[],i=this.findMostDistantPointFromBaseLine(e,t);return i.maxPoint?(n=n.concat(this.buildConvexHull([e[0],i.maxPoint],i.newPoints)),n=n.concat(this.buildConvexHull([i.maxPoint,e[1]],i.newPoints)),n):[e[0]]},getConvexHull:function(e){var t=!1,n=!1,i=!1,r=!1,s=null,o=null,c=null,d=null,p=null,m=null,b;for(b=e.length-1;b>=0;b--){var v=e[b];(t===!1||v.lat>t)&&(s=v,t=v.lat),(n===!1||v.lat<n)&&(o=v,n=v.lat),(i===!1||v.lng>i)&&(c=v,i=v.lng),(r===!1||v.lng<r)&&(d=v,r=v.lng)}
vendor: 4,455 bytes, line 1
1n!==t?(m=o,p=s):(m=d,p=c);var k=[].concat(this.buildConvexHull([m,p],e),this.buildConvexHull([p,m],e));return k}}})(),L.MarkerCluster.include({getConvexHull:function(){var e=this.getAllChildMarkers(),t=[],n,i;for(i=e.length-1;i>=0;i--)n=e[i].getLatLng(),t.push(n);return L.QuickHull.getConvexHull(t)}}),L.MarkerCluster.include({_2PI:Math.PI*2,_circleFootSeparation:25,_circleStartAngle:0,_spiralFootSeparation:28,_spiralLengthStart:11,_spiralLengthFactor:5,_circleSpiralSwitchover:9,spiderfy:function(){if(!(this._group._spiderfied===this||this._group._inZoomAnimation)){var e=this.getAllChildMarkers(null,!0),t=this._group,n=t._map,i=n.latLngToLayerPoint(this._latlng),r;this._group._unspiderfy(),this._group._spiderfied=this,this._group.options.spiderfyShapePositions?r=this._group.options.spiderfyShapePositions(e.length,i):e.length>=this._circleSpiralSwitchover?r=this._generatePointsSpiral(e.length,i):(i.y+=10,r=this._generatePointsCircle(e.length,i)),this._animationSpiderfy(e,r)}},unspiderfy:function(e){this._group._inZoomAnimation||(this._animationUnspiderfy(e),this._group._spiderfied=null)},_generatePointsCircle:function(e,t){var n=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+e),i=n/this._2PI,r=this._2PI/e,s=[],o,c;for(i=Math.max(i,35),s.length=e,o=0;o<e;o++)c=this._circleStartAngle+o*r,s[o]=new L.Point(t.x+i*Math.cos(c),t.y+i*Math.sin(c))._round();return s},_generatePointsSpiral:function(e,t){var n=this._group.options.spiderfyDistanceMultiplier,i=n*this._spiralLengthStart,r=n*this._spiralFootSeparation,s=n*this._spiralLengthFactor*this._2PI,o=0,c=[],d;for(c.length=e,d=e;d>=0;d--)d<e&&(c[d]=new L.Point(t.x+i*Math.cos(o),t.y+i*Math.sin(o))._round()),o+=r/i+d*5e-4,i+=s/o;return c},_noanimationUnspiderfy:function(){var e=this._group,t=e._map,n=e._featureGroup,i=this.getAllChildMarkers(null,!0),r,s;for(e._ignoreMove=!0,this.setOpacity(1),s=i.length-1;s>=0;s--)r=i[s],n.removeLayer(r),r._preSpiderfyLatlng&&(r.setLatLng(r._preSpiderfyLatlng),delete r._preSpiderfyLatlng),r.setZIndexOffset&&r.setZIndexOffset(0),r._spiderLeg&&(t.removeLayer(r._spiderLeg),delete r._spiderLeg);e.fire("unspiderfied",{cluster:this,markers:i}),e._ignoreMove=!1,e._spiderfied=null}}),L.MarkerClusterNonAnimated=L.MarkerCluster.extend({_animationSpiderfy:function(e,t){var n=this._group,i=n._map,r=n._featureGroup,s=this._group.options.spiderLegPolylineOptions,o,c,d,p;for(n._ignoreMove=!0,o=0;o<e.length;o++)p=i.layerPointToLatLng(t[o]),c=e[o],d=new L.Polyline([this._latlng,p],s),i.addLayer(d),c._spiderLeg=d,c._preSpiderfyLatlng=c._latlng,c.setLatLng(p),c.setZIndexOffset&&c.setZIndexOffset(1e6),r.addLayer(c);this.setOpacity(.3),n._ignoreMove=!1,n.fire("spiderfied",{cluster:this,markers:e})},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),L.MarkerCluster.include({_animationSpiderfy:function(e,t){var n=this,i=this._group,r=i._map,s=i._featureGroup,o=this._latlng,c=r.latLngToLayerPoint(o),d=L.Path.SVG,p=L.extend({},this._group.options.spiderLegPolylineOptions),m=p.opacity,b,v,k,M,R,E;for(m===void 0&&(m=L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity),d?(p.opacity=0,p.className=(p.className||"")+" leaflet-cluster-spider-leg"):p.opacity=m,i._ignoreMove=!0,b=0;b<e.length;b++)v=e[b],E=r.layerPointToLatLng(t[b]),k=new L.Polyline([o,E],p),r.addLayer(k),v._spiderLeg=k,d&&(M=k._path,R=M.getTotalLength()+.1,M.style.strokeDasharray=R,M.style.strokeDashoffset=R),v.setZIndexOffset&&v.setZIndexOffset(1e6),v.clusterHide&&v.clusterHide(),s.addLayer(v),v._setPos&&v._setPos(c);for(i._forceLayout(),i._animationStart(),b=e.length-1;b>=0;b--)E=r.layerPointToLatLng(t[b]),v=e[b],v._preSpiderfyLatlng=v._latlng,v.setLatLng(E),v.clusterShow&&v.clusterShow(),d&&(k=v._spiderLeg,M=k._path,M.style.strokeDashoffset=0,k.setStyle({opacity:m}));this.setOpacity(.3),i._ignoreMove=!1,setTimeout(function(){i._animationEnd(),i.fire("spiderfied",{cluster:n,markers:e})},200)},_animationUnspiderfy:function(e){var t=this,n=this._group,i=n._map,r=n._featureGroup,s=e?i._latLngToNewLayerPoint(this._latlng,e.zoom,e.center):i.latLngToLayerPoint(this._latlng),o=this.getAllChildMarkers(null,!0),c=L.Path.SVG,d,p,m,b,v,k;for(n._ignoreMove=!0,n._animationStart(),this.setOpacity(1),p=o.length-1;p>=0;p--)d=o[p],d._preSpiderfyLatlng&&(d.closePopup(),d.setLatLng(d._preSpiderfyLatlng),delete d._preSpiderfyLatlng,k=!0,d._setPos&&(d._setPos(s),k=!1),d.clusterHide&&(d.clusterHide(),k=!1),k&&r.removeLayer(d
1),c&&(m=d._spiderLeg,b=m._path,v=b.getTotalLength()+.1,b.style.strokeDashoffset=v,m.setStyle({opacity:0})));n._ignoreMove=!1,setTimeout(function(){var M=0;for(p=o.length-1;p>=0;p--)d=o[p],d._spiderLeg&&M++;for(p=o.length-1;p>=0;p--)d=o[p],d._spiderLeg&&(d.clusterShow&&d.clusterShow(),d.setZIndexOffset&&d.setZIndexOffset(0),M>1&&r.removeLayer(d),i.removeLayer(d._spiderLeg),delete d._spiderLeg);n._animationEnd(),n.fire("unspiderfied",{cluster:t,markers:o})},200)}}),L.MarkerClusterGroup.include({_spiderfied:null,unspiderfy:function(){this._unspiderfy.apply(this,arguments)},_spiderfierOnAdd:function(){this._map.on("click",this._unspiderfyWrapper,this),this._map.options.zoomAnimation&&this._map.on("zoomstart",this._unspiderfyZoomStart,this),this._map.on("zoomend",this._noanimationUnspiderfy,this),L.Browser.touch||this._map.getRenderer(this)},_spiderfierOnRemove:function(){this._map.off("click",this._unspiderfyWrapper,this),this._map.off("zoomstart",this._unspiderfyZoomStart,this),this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._map.off("zoomend",this._noanimationUnspiderfy,this),this._noanimationUnspiderfy()},_unspiderfyZoomStart:function(){this._map&&this._map.on("zoomanim",this._unspiderfyZoomAnim,this)},_unspiderfyZoomAnim:function(e){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(e))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(e){this._spiderfied&&this._spiderfied.unspiderfy(e)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(e){e._spiderLeg&&(this._featureGroup.removeLayer(e),e.clusterShow&&e.clusterShow(),e.setZIndexOffset&&e.setZIndexOffset(0),this._map.removeLayer(e._spiderLeg),delete e._spiderLeg)}}),L.MarkerClusterGroup.include({refreshClusters:function(e){return e?e instanceof L.MarkerClusterGroup?e=e._topClusterLevel.getAllChildMarkers():e instanceof L.LayerGroup?e=e._layers:e instanceof L.MarkerCluster?e=e.getAllChildMarkers():e instanceof L.Marker&&(e=[e]):e=this._topClusterLevel.getAllChildMarkers(),this._flagParentsIconsNeedUpdate(e),this._refreshClustersIcons(),this.options.singleMarkerMode&&this._refreshSingleMarkerModeMarkers(e),this},_flagParentsIconsNeedUpdate:function(e){var t,n;for(t in e)for(n=e[t].__parent;n;)n._iconNeedsUpdate=!0,n=n.__parent},_refreshSingleMarkerModeMarkers:function(e){var t,n;for(t in e)n=e[t],this.hasLayer(n)&&n.setIcon(this._overrideMarkerIcon(n))}}),L.Marker.include({refreshIconOptions:function(e,t){var n=this.options.icon;return L.setOptions(n,e),this.setIcon(n),t&&this.__parent&&this.__parent._group.refreshClusters(this),this}}),f.MarkerClusterGroup=g,f.MarkerCluster=_,Object.defineProperty(f,"__esModule",{value:!0})})})(U,U.exports)),U.exports}ft();function re(u){let a={},f={};const{children:g,..._}=u;return Object.entries(_).forEach(([e,t])=>{e.startsWith("on")?f={...f,[e]:t}:a={...a,[e]:t}}),{clusterProps:a,clusterEvents:f}}function pt(u,a){const{clusterProps:f,clusterEvents:g}=re(u),_=new N.MarkerClusterGroup(f);Object.entries(g).forEach(([c,d])=>{const p=`cluster${c.substring(2).toLowerCase()}`;_.on(p,d)});const e=N.MarkerClusterGroup.prototype;let t=[],n=[],i=!1;function r(){i=!1;const c=new Map;for(const m of t)c.set(m,(c.get(m)??0)+1);for(const m of n)c.set(m,(c.get(m)??0)-1);const d=[],p=[];for(const[m,b]of c)b>0?d.push(m):b<0&&p.push(m);n=[],t=[],p.length>0&&_.removeLayers(p),d.length>0&&_.addLayers(d)}function s(){i||(i=!0,queueMicrotask(r))}_.addLayer=function(c){return this._map?(t.push(c),s(),this):e.addLayer.call(this,c)},_.removeLayer=function(c){return this._map?(n.push(c),s(),this):e.removeLayer.call(this,c)};const o=_.clearLayers;return _.clearLayers=function(){return t=[],n=[],i=!1,o.call(this)},_._moveChild=function(c,d,p){c._latlng=d,e.removeLayer.call(this,c),c._latlng=p,e.addLayer.call(this,c)},ve(_,Je(a,{layerContainer:_}))}var mt=(u,a,f)=>{const{clusterProps:g,clusterEvents:_}=re(a),{clusterProps:e,clusterEvents:t}=re(f);Object.keys(g).forEach(n=>{g[n]!==e[n]&&(u.options[n]=g[n])}),Object.entries(t).forEach(([n,i])=>{const r=`cluster${n.substring(2).toLowerCase()}`;u.off(r,i)}),Object.entries(_).forEach(([n,i])=>{const r=`cluster${n.substring(2).toLowerCase()}`;u.on(r,i)})},_t=Ye(pt,mt),H=_t;function gt({keyTypes:u}
1){const[a,f]=x.useState(!1),[g,_]=x.useState(null),[e,t]=x.useState({}),n=x.useRef(null);return x.useEffect(()=>{tt().then(({db:i,collection:r,getDocs:s})=>s(r(i,"locationTypes"))).then(i=>{const r={};i.docs.forEach(s=>{r[s.id]=s.data()}),t(r)}).catch(()=>{})},[]),x.useEffect(()=>{if(!a)return;const i=r=>{n.current&&!n.current.contains(r.target)&&f(!1)};return document.addEventListener("mousedown",i),()=>document.removeEventListener("mousedown",i)},[a]),l.jsxs("div",{ref:n,className:"hidden md:flex absolute z-[400] flex-col items-center pointer-events-none",style:{bottom:"1.5rem",left:"50%",transform:"translateX(-50%)"},children:[a&&l.jsx("div",{className:"pointer-events-auto mb-1.5 rounded overflow-hidden",style:{background:"rgba(0,0,0,0.92)",border:"1px solid rgba(255,255,255,0.15)",boxShadow:"0 2px 12px rgba(0,0,0,0.6)",minWidth:"210px"},children:u.length>0&&l.jsxs("div",{className:"pt-2 pb-1",children:[l.jsx("p",{className:"text-[9px] font-bold text-stone-600 uppercase tracking-[0.12em] mb-1.5 px-3",children:"Types"}),u.map(i=>{const r=rt[i]||"#78716c",s=nt[i]||i,o=s.indexOf(" â "),c=o>0?s.slice(0,o):s,d=o>0?s.slice(o+3):"",p=g===i;return l.jsxs("div",{className:"px-3 py-1.5 hover:bg-white/[0.06] transition-colors cursor-default border-b border-white/[0.04] last:border-0",onMouseEnter:()=>_(i),onMouseLeave:()=>_(null),onClick:()=>_(m=>m===i?null:i),children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"shrink-0 leading-none",dangerouslySetInnerHTML:{__html:it(i,r,18)}}),l.jsx("span",{className:"text-[10px] font-mono font-bold shrink-0 w-[48px] leading-none",style:{color:r},children:i}),l.jsx("span",{className:"text-[9px] text-stone-400 leading-tight flex-1",children:c})]}),p&&(()=>{const m=e[i]?.description||ot[i]||d;return m?l.jsx("p",{className:"text-[10px] text-stone-500 leading-relaxed mt-1.5 pl-[26px] whitespace-normal break-words max-w-[240px]",children:m}):null})()]},i)})]})}),l.jsxs("button",{onClick:()=>f(i=>!i),className:"pointer-events-auto text-white text-[10px] font-bold uppercase tracking-[0.08em] px-2.5 py-1 rounded hover:brightness-125 transition-all",style:{background:"rgba(0,0,0,0.92)",border:"1px solid rgba(255,255,255,0.15)",boxShadow:"0 2px 12px rgba(0,0,0,0.6)"},children:["Key ",a?"â´":"â¾"]})]})}const ae="aw_map_";function V(u,a,f){return[`${ae}${u}`,f??"",a.getSouth().toFixed(1),a.getWest().toFixed(1),a.getNorth().toFixed(1),a.getEast().toFixed(1)].join("_")}function q(u){try{const a=localStorage.getItem(u);if(!a)return null;const{results:f,fetchedAt:g,ttl:_}=JSON.parse(a);return Date.now()-g>_?(localStorage.removeItem(u),null):f}catch{return null}}function K(u,a,f){const g=JSON.stringify({results:a,fetchedAt:Date.now(),ttl:f});if(!(g.length>5e5))try{localStorage.setItem(u,g)}catch(_){_.name==="QuotaExceededError"&&xt()}}function xt(){try{Object.keys(localStorage).filter(u=>u.startsWith(ae)).forEach(u=>{try{const{fetchedAt:a,ttl:f}=JSON.parse(localStorage.getItem(u));Date.now()-a>f&&localStorage.removeItem(u)}catch{localStorage.removeItem(u)}})}catch{}}function vt(){try{Object.keys(localStorage).filter(u=>u.startsWith(ae)).forEach(u=>localStorage.removeItem(u))}catch{}}const be=720*60*60*1e3,Ce=10080*60*1e3,Lt="https://services-eu1.arcgis.com/ZOdPfBS3aqqDYPUQ/ArcGIS/rest/services/National_Heritage_List_for_England_NHLE_v02_VIEW/FeatureServer",yt=["pillbox","anti-tank","anti tank","coastal battery","gun battery","anti-aircraft battery","searchlight battery","HAA battery","radar","searchlight","stop line","acoustic mirror","machine gun","observation post","anti-aircraft","gun site","war ii","world war","WWII","WW2"].map(u=>`UPPER(Name) LIKE UPPER('%${u}%')`).join(" OR ");async function pe(u,a){const f=u===6?"Name,ListEntry,SchedDate,hyperlink":"Name,ListEntry,Grade,ListDate,hyperlink",g=`${Lt}/${u}/query?where=${encodeURIComponent(yt)}&geometry=${a.getWest()}%2C${a.getSouth()}%2C${a.getEast()}%2C${a.getNorth()}&geometryType=esriGeometryEnvelope&inSR=4326&spatialRel=esriSpatialRelIntersects&outFields=${encodeURIComponent(f)}&returnGeometry=true&outSR=4326&resultRecordCount=200&f=json`;return(await(await fetch(g)).json()).features||[]}const me=u=>{const a=u==="LB"?"#D4860A":"#6B46C1",f=`<div style="width:26px;height:26px;border-radius:50%;background-color:${a};border:2px solid ${a}cc;display:flex;align-items:center;justify-content:center;color:#fff;font-size:8px;font-weight:900;letter-spacing:0.05em;font-family:sans-serif;box-shadow:0 2px 4px rgba(0,0,0,0.4);">${u}</div>`;return new N.divIcon({className:"bg-transparent border-0",html:f,iconSize:[26,26],iconAnchor:[13,13],popupAnchor:[0,-13]})};function bt({showNHLE:u,setListedBuildings:a,setScheduledMonuments:f,onLoadStart:g,onLoadEnd:_}){const e=P(),t=x.useRef(null),n=x.useRef(null),i=x.useRef(new Map),r=x.useCallback(async()=>{const s=e.getBounds(),o=e.getZoom();if(o<9){a([]),f([]);return}if(!Le(s)){a([]),f([]);return}if(n.current&&ct(s,n.current))return;n.current=s;const c=V("nhle",s,o);if(i.current.has(c)){const[p,m]=i.current.get(c);a(p),f(m);return}const d=q(c);if(d){i.current.set(c,d),a(d[0]),f(d[1]);return}g?.();try{const[p,m]=await Promise.all([pe(0,s),pe(6,s)]);i.current.set(c,[p,m]),K(c,[p,m],be),a(p),f(m)}catch(p){console.error("NHLE fetch error:",p)}finally{_?.()}},[e,a,f]);return x.useEffect(()=>{if(!u){a([]),f([]),n.current=null,clearTimeout(t.current);return}r();const s=()=>{clearTimeout(t.current),t.current=setTimeout(r,2e3)};return e.on("moveend",s),()=>{e.off("moveend",s),clearTimeout(t.current)}},[u,e,r]),null}function _e({type:u,attr:a,nearby:f}){const g=u==="LB",_=g?"#D4860A":"#6B46C1",e=g?"Listed Building":"Scheduled Monument",t=a.hyperlink||(a.ListEntry?`https://historicengland.org.uk/listing/the-list/list-entry/${a.ListEntry}`:null),n=g?[a.Grade,a.ListDate?`Listed ${a.ListDate}
1`:null].filter(Boolean).join(" â "):a.SchedDate?`Scheduled ${a.SchedDate}`:null;return l.jsxs("div",{className:"min-w-[220px] p-3",children:[l.jsx("div",{className:"mb-1.5",children:l.jsx("span",{className:"text-white text-[8px] font-black px-1.5 py-0.5 rounded",style:{background:_},children:e})}),l.jsx("h3",{className:"font-bold text-stone-900 text-sm leading-tight mb-0.5",children:a.Name||"Unnamed"}),n&&l.jsx("p",{className:"text-[10px] text-stone-500 mb-2",children:n}),t&&l.jsx("div",{className:"border-t border-stone-200 pt-2 mb-2",children:l.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-blue-600 hover:text-blue-800",children:"View Historic England entry â"})}),f&&l.jsxs("div",{className:"border-t border-stone-200 pt-2",children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-stone-400 mb-1",children:"In this archive"}),l.jsxs(W,{to:`/location/${f.slug||f.id}`,className:"text-[10px] font-bold text-blue-600 hover:text-blue-800 no-underline",children:[f.title," â"]})]})]})}const Ct="https://services-eu1.arcgis.com/ZOdPfBS3aqqDYPUQ/ArcGIS/rest/services/Historic_England_Heritage_at_Risk_Register_2022/FeatureServer",kt=["pillbox","battery","radar","anti-tank","anti tank","searchlight","gun site","observation post","stop line","acoustic mirror","machine gun","anti-aircraft","war ii","world war","WWII","WW2"].map(u=>`UPPER(EntryName) LIKE UPPER('%${u}%')`).join(" OR ");async function wt(u){const a=`${Ct}/0/query?where=${encodeURIComponent(kt)}&geometry=${u.getWest()}%2C${u.getSouth()}%2C${u.getEast()}%2C${u.getNorth()}&geometryType=esriGeometryEnvelope&inSR=4326&spatialRel=esriSpatialRelIntersects&outFields=EntryName%2CList_Entry%2CHeritageCa%2CRisk_Metho%2CURL&returnGeometry=true&outSR=4326&resultRecordCount=200&f=json`;return(await(await fetch(a)).json()).features||[]}const St=(u=!1)=>{const a=u?'<div style="width:28px;height:28px;border-radius:50%;background:linear-gradient(90deg,#D4860A 50%,#DC2626 50%);border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;color:#fff;font-size:9px;font-weight:900">â²</div>':'<div style="width:26px;height:26px;border-radius:50%;background:#DC2626;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;color:#fff;font-size:11px;font-weight:900">â²</div>';return new N.divIcon({className:"bg-transparent border-0",html:a,iconSize:[26,26],iconAnchor:[13,13],popupAnchor:[0,-13]})};function Mt({showHAR:u,setHarFeatures:a,onLoadStart:f,onLoadEnd:g}){const _=P(),e=x.useRef(null),t=x.useRef(null),n=x.useRef(new Map),i=x.useCallback(async()=>{const r=_.getBounds();if(!Le(r)){a([]);return}if(t.current&&oe(r,t.current))return;t.current=r;const s=V("har",r,_.getZoom());if(n.current.has(s)){a(n.current.get(s));return}const o=q(s);if(o){n.current.set(s,o),a(o);return}f?.();try{const c=await wt(r);n.current.set(s,c),K(s,c,be),a(c)}catch(c){console.error("HAR fetch error:",c)}finally{g?.()}},[_,a]);return x.useEffect(()=>{if(!u){a([]),t.current=null,clearTimeout(e.current);return}i();const r=()=>{clearTimeout(e.current),e.current=setTimeout(i,600)};return _.on("moveend",r),()=>{_.off("moveend",r),clearTimeout(e.current)}},[u,_,i]),null}function Nt({attr:u,nearby:a,nhleAttr:f}){const g=u.EntryName||"Unnamed",_=u.URL||null,e=u.HeritageCa||null;return l.jsxs("div",{className:"min-w-[220px] p-3",children:[l.jsx("div",{className:"mb-1.5 flex items-center gap-1.5",children:l.jsx("span",{className:"text-white text-[8px] font-black px-1.5 py-0.5 rounded",style:{background:"#DC2626"},children:"â Heritage at Risk"})}),l.jsx("h3",{className:"font-bold text-stone-900 text-sm leading-tight mb-0.5",children:g}),l.jsxs("div",{className:"border-t border-stone-200 pt-2 mb-2 space-y-0.5",children:[e&&l.jsxs("p",{className:"text-[10px] text-stone-700",children:[l.jsx("span",{className:"font-bold text-stone-500",children:"Category: "}),e]}),u.Risk_Metho&&l.jsxs("p",{className:"text-[10px] text-stone-700",children:[l.jsx("span",{className:"font-bold text-stone-500",children:"Risk: "}),u.Risk_Metho]})]}),_&&l.jsx("div",{className:"border-t border-stone-200 pt-2 mb-2",children:l.jsx("a",{href:_,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-blue-600 hover:text-blue-800",children:"View Historic England entry â"})}),f&&l.jsxs("div",{className:"border-t border-stone-200 pt-2 mb-2",children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-stone-400 mb-0.5",children:"Also listed"}),l.jsxs("p",{className:"text-[10px] text-stone-600",children:[f.Grade?`Grade ${f.Grade}`:"Listed Building",f.ListDate?` â Listed ${f.ListDate}`:""]})]}),a&&l.jsxs("div",{className:"border-t border-stone-200 pt-2",children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-stone-400 mb-1",children:"In this archive"}),l.jsxs(W,{to:`/location/${a.slug||a.id}`,className:"text-[10px] font-bold text-blue-600 hover:text-blue-800 no-underline",children:[a.title," â"]})]})]})}async function jt(u){const a=`${u.getSouth()},${u.getWest()},${u.getNorth()},${u.getEast()}`,f=`[out:json][timeout:25][maxsize:1000000]; 2( 3 node["historic"="bunker"](${a}
3); 4 node["military"="bunker"](${a}); 5 node["historic"="battery"](${a}); 6 node["historic"="fort"](${a}); 7 node["historic"="pillbox"](${a}); 8 node["bunker_type"](${a}); 9 way["historic"="bunker"](${a}); 10 way["military"="bunker"](${a}); 11); 12out center body;`,g=await fetch("https://overpass-api.de/api/interpreter",{method:"POST",body:f});if(g.status===429)return console.warn("OSM: rate limited, backing off"),[];const _=await g.text();try{return JSON.parse(_).elements||[]}catch{return console.warn("OSM: non-JSON response",_.slice(0,100)),[]}}const Et=()=>{const u='<div style="width:26px;height:26px;border-radius:50%;background:#3B82F6;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;color:#fff;font-size:8px;font-weight:900;font-family:sans-serif">OSM</div>';return new N.divIcon({className:"bg-transparent border-0",html:u,iconSize:[26,26],iconAnchor:[13,13],popupAnchor:[0,-13]})},Pt=Et();function Ot({showOSM:u,setOSMFeatures:a,onLoadStart:f,onLoadEnd:g}){const _=P(),e=x.useRef(null),t=x.useRef(null),n=x.useRef(new Map),i=x.useCallback(async()=>{if(_.getZoom()<8){a([]);return}const r=_.getBounds();if(t.current&&oe(r,t.current))return;const s=V("osm",r,_.getZoom());if(n.current.has(s)){a(n.current.get(s));return}const o=q(s);if(o){n.current.set(s,o),a(o);return}t.current=r,f?.();try{const c=await jt(r);n.current.set(s,c),K(s,c,Ce),a(c)}catch(c){console.error("OSM fetch error:",c)}finally{g?.()}},[_,a]);return x.useEffect(()=>{if(!u){a([]),t.current=null,clearTimeout(e.current);return}i();const r=()=>{clearTimeout(e.current),e.current=setTimeout(i,3e3)};return _.on("moveend",r),()=>{_.off("moveend",r),clearTimeout(e.current)}},[u,_,i]),null}function It({el:u,nearby:a}){const f=u.tags||{},g=`https://www.openstreetmap.org/${u.type}/${u.id}`,_=u.lat??u.center?.lat,e=u.lon??u.center?.lon,t=a&&_&&e?ye(_,e,a.coordinates.lat,a.coordinates.lng):null,n=f.historic||f.military||f.bunker_type||null,i=f.website||g;return l.jsxs("div",{className:"min-w-[220px] p-3",children:[l.jsx("div",{className:"mb-1.5",children:l.jsx("span",{className:"text-white text-[8px] font-black px-1.5 py-0.5 rounded",style:{background:"#3B82F6"},children:"OpenStreetMap"})}),l.jsx("h3",{className:"font-bold text-stone-900 text-sm leading-tight mb-0.5",children:f.name||(n?n.replace(/_/g," "):"Military Site")}),l.jsxs("div",{className:"border-t border-stone-200 pt-2 mb-2 space-y-0.5",children:[n&&f.name&&l.jsxs("p",{className:"text-[10px] text-stone-700",children:[l.jsx("span",{className:"font-bold text-stone-500",children:"Type: "}),n.replace(/_/g," ")]}),f.bunker_type&&f.bunker_type!==n&&l.jsxs("p",{className:"text-[10px] text-stone-700",children:[l.jsx("span",{className:"font-bold text-stone-500",children:"Bunker type: "}),f.bunker_type]}),f.access&&l.jsxs("p",{className:"text-[10px] text-stone-700",children:[l.jsx("span",{className:"font-bold text-stone-500",children:"Access: "}),f.access]}),f.start_date&&l.jsxs("p",{className:"text-[10px] text-stone-700",children:[l.jsx("span",{className:"font-bold text-stone-500",children:"Built: "}),f.start_date]}),f.description&&l.jsx("p",{className:"text-[10px] text-stone-700 line-clamp-3",children:f.description})]}),l.jsx("div",{className:"border-t border-stone-200 pt-2 mb-2",children:l.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-blue-600 hover:text-blue-800",children:f.website?"View site page â":"View on OpenStreetMap â"})}),a&&l.jsxs("div",{className:"border-t border-stone-200 pt-2",children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-stone-400 mb-1",children:"Nearby in this archive"}),l.jsxs(W,{to:`/location/${a.slug||a.id}`,className:"text-[10px] font-bold text-blue-600 hover:text-blue-800 no-underline",children:[a.title,t!==null?` (${t.toFixed(1)}km)`:""," â"]})]})]})}const Rt="https://europe-west2-atlantikwall-a75d6.cloudfunctions.net/wikidataProxy";async function ge(u){const a=` 13 SELECT ?item ?itemLabel ?itemDescription ?coords ?image ?article WHERE { 14 SERVICE wikibase:box { 15 ?item wdt:P625 ?coords . 16 bd:serviceParam wikibase:cornerSouthWest "Point(${u.getWest()} ${u.getSouth()})"^^geo:wktLiteral . 17 bd:serviceParam wikibase:cornerNorthEast "Point(${u.getEast()} ${u.getNorth()})"^^geo:wktLiteral . 18 } 19 VALUES ?type { 20 wd:Q57634 # bunker 21 wd:Q1785071 # pillbox 22 wd:Q3196949 # coastal artillery battery 23 } 24 ?item wdt:P31 ?type . 25 OPTIONAL { ?item wdt:P18 ?image . } 26 OPTIONAL { 27 ?article schema:about ?item ; 28 schema:inLanguage "en" ; 29 schema:isPartOf <https://en.wikipedia.org/> . 30 } 31 SERVICE wikibase:label { 32 bd:serviceParam wikibase:language "en,fr,de,nl" . 33 } 34 } 35 LIMIT 50 36 `,f=`${Rt}?query=${encodeURIComponent(a)}`,g=await fetch(f);if(!g.ok)throw new Error(`Wikidata proxy ${g.status}`);return(await g.json()).results?.bindings||[]}const Tt=()=>{const u='<div style="width:26px;height:26px;border-radius:50%;background:#8B5CF6;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;color:#fff;font-size:11px;font-weight:900;font-family:sans-serif">W</div>';return new N.divIcon({className:"bg-transparent border-0",html:u,iconSize:[26,26],iconAnchor:[13,13],popupAnchor:[0,-13]})},Bt=Tt();function Gt({showWikidata:u,setWikidataFeatures:a,onLoadStart:f,onLoadEnd:g,onLoadError:_}){const e=P(),t=x.useRef(null),n=x.useRef(null),i=x.useRef(null),r=x.useRef(new Map),s=x.useCallback(async()=>{const o=e.getBounds(),c=e.getZoom();
36if(!(i.current!==c)&&n.current&&oe(o,n.current))return;i.current=c,n.current=o;const p=V("wikidata",o,c);if(r.current.has(p)){a(r.current.get(p));return}const m=q(p);if(m){r.current.set(p,m),a(m);return}f?.();try{let b;try{b=await ge(o)}catch(k){console.warn("Wikidata fetch failed, retrying in 2sâ¦",k.message),await new Promise(M=>setTimeout(M,2e3)),b=await ge(o)}const v=[...new Map(b.map(k=>[k.item?.value,k])).values()];r.current.set(p,v),K(p,v,Ce),a(v)}catch(b){console.error("Wikidata fetch error:",b),_?.()}finally{g?.()}},[e,a]);return x.useEffect(()=>{if(!u){a([]),n.current=null,i.current=null,clearTimeout(t.current);return}s();const o=()=>{clearTimeout(t.current),t.current=setTimeout(s,1e3)};return e.on("moveend",o),e.on("zoomend",o),()=>{e.off("moveend",o),e.off("zoomend",o),clearTimeout(t.current)}},[u,e,s]),null}function At({binding:u,nearby:a}){const f=u.itemLabel?.value||"Unknown",g=u.itemDescription?.value||null,_=u.image?.value||null,e=u.article?.value||null,t=u.item?.value?.split("/").pop()||null,n=t?`https://www.wikidata.org/wiki/${t}`:null,i=_?_.replace("http://commons.wikimedia.org/wiki/Special:FilePath/","https://commons.wikimedia.org/wiki/Special:FilePath/")+"?width=300":null,r=ie(u.coords?.value),s=a&&r?ye(r.lat,r.lng,a.coordinates.lat,a.coordinates.lng):null;return l.jsxs("div",{className:"min-w-[220px] p-3",children:[l.jsx("div",{className:"mb-1.5",children:l.jsx("span",{className:"text-white text-[8px] font-black px-1.5 py-0.5 rounded",style:{background:"#F59E0B"},children:"Wikidata / Wikipedia"})}),l.jsx("h3",{className:"font-bold text-stone-900 text-sm leading-tight mb-0.5",children:f}),g&&l.jsx("p",{className:"text-[10px] text-stone-500 mb-2 line-clamp-3",children:g}),i&&l.jsx("div",{className:"mb-2 rounded overflow-hidden border border-stone-200",children:l.jsx("img",{src:i,alt:f,className:"w-full object-cover max-h-32",loading:"lazy"})}),l.jsxs("div",{className:"border-t border-stone-200 pt-2 mb-2 flex flex-col gap-1",children:[e&&l.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-blue-600 hover:text-blue-800",children:"Read on Wikipedia â"}),n&&l.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] font-bold text-blue-600 hover:text-blue-800",children:"View on Wikidata â"})]}),a&&l.jsxs("div",{className:"border-t border-stone-200 pt-2",children:[l.jsx("p",{className:"text-[9px] font-bold uppercase tracking-widest text-stone-400 mb-1",children:"Nearby in this archive"}),l.jsxs(W,{to:`/location/${a.slug||a.id}`,className:"text-[10px] font-bold text-blue-600 hover:text-blue-800 no-underline",children:[a.title,s!==null?` (${s.toFixed(1)}km)`:""," â"]})]})]})}function Zt(u){return(u||[]).filter(a=>a.coordinates&&Number.isFinite(a.coordinates.lat)&&Number.isFinite(a.coordinates.lng))}function zt(){const u=P();return x.useEffect(()=>{const a=u.getContainer();if(!a)return;let f=!0;const g=new ResizeObserver(()=>{f&&u.invalidateSize()});return g.observe(a),()=>{f=!1,g.disconnect()}},[u]),null}function Ft(){const u=x.useRef(!1);return se({movestart:()=>{u.current||(u.current=!0,ne("map_engaged"))},zoomstart:()=>{u.current||(u.current=!0,ne("map_engaged"))}}),null}function Ht({onZoomChange:u}){const a=P();return se({zoomend:()=>u(a.getZoom())}),null}function Ut({panTarget:u}){const a=P();return x.useEffect(()=>{if(!u)return;const{lat:f,lng:g}=u;if(!Number.isFinite(f)||!Number.isFinite(g))return;const _=a.getSize();if(!(!_||_.x===0||_.y===0))try{a.flyTo([f,g],14,{animate:!0,duration:.8})}catch(e){console.warn("PanToController: flyTo skipped â",e.message)}},[u]),null}function $t({userLocation:u,nearMeSites:a}){const f=P(),g=x.useRef(null);return x.useEffect(()=>{if(!u){g.current=null;return}const _=`${u.lat},${u.lng}`;if(g.current===_)return;g.current=_;const e=[[u.lat,u.lng]];(a||[]).forEach(t=>{t.coordinates?.lat&&t.coordinates?.lng&&e.push([t.coordinates.lat,t.coordinates.lng])});try{f.flyToBounds(N.latLngBounds(e),{padding:[40,40],maxZoom:13,animate:!0,duration:.8})}catch(t){console.warn("NearMeFitController: fitBounds skipped â",t.message)}},[u,a]),null}function Dt({active:u,onPick:a}){return se({click(f){u&&a({lat:f.latlng.lat,lng:f.latlng.lng})}}),null}const te=new Map,Wt=(u,a)=>{const f=`${u}||${a}`;if(te.has(f))return te.get(f);const g=at(u),_=lt[a]||"#666",e=` 37 <div class="w-6 h-6 rounded-full border-2 shadow-lg flex items-center justify-center text-white" 38 style="background-color:${_};border-color:${_}cc;"> 39 <div class="w-3 h-3 flex items-center justify-center">${g.svg}</div> 40 </div> 41 `,t=new N.divIcon({className:"bg-transparent border-0",html:e,iconSize:[24,24],iconAnchor:[12,12],popupAnchor:[0,-12]});return te.set(f,t),t};function Vt({popupTarget:u,onPopupOpened:a,panTarget:f,onPanDone:g}){const _=P();return x.useEffect(()=>{u&&_.eachLayer(e=>{e._popup&&e.options?.siteId===u&&(e.openPopup(),a?.())})},[u]),x.useEffect(()=>{if(!f?.id)return;const e=setTimeout(()=>{_.eachLayer(t=>{t._popup&&t.options?.siteId===f.id&&t.openPopup()}),g?.()},100);return()=>clearTimeout(e)},[f]),null}const tn=x.memo(function({sections:a=[],activeSectionId:f,onScrollToSection:g,onClearSection:_,hoveredLocationId:e,onHoverLocation:t,onSelectLocation:n,onOpenLocation:i,popupTarget:r,onPopupOpened:s,panTarget:o,onPanDone:c,user:d,userLocation:p=null,nearMeSites:m,pickMode:b=!1,onPickLocation:v}){const k=x.useRef(null),[M,R]=x.useState(!1),[E,Q]=x.useState(6),[$,ke]=x.use
41State(!1),[le,we]=x.useState([]),[ce,Se]=x.useState([]),[D,Me]=x.useState(!1),[Y,Ne]=x.useState([]),[ue,je]=x.useState(!1),[Ee,Pe]=x.useState([]),[J,Oe]=x.useState(!1),[Ie,Re]=x.useState([]),[Te,X]=x.useState(!1),[de,Be]=x.useState(new Set),he=window.innerWidth<768,Ge=[50.2,.5],Ae=5,[Ze,ze]=x.useState(!1);x.useEffect(()=>{const h=window.requestIdleCallback||(S=>setTimeout(S,150)),C=window.cancelIdleCallback||clearTimeout,w=h(()=>ze(!0));return()=>C(w)},[]);const O=x.useCallback((h,C)=>{Be(w=>{const S=new Set(w);return C?S.add(h):S.delete(h),S})},[]),I=x.useMemo(()=>a.flatMap(h=>Zt(h.allSites).map(C=>({...C,sectionId:h.id}))),[a]),Fe=x.useMemo(()=>G(I,h=>h.coordinates),[I]),He=["STP","WN","HKB","MKB","BATTERIE","FLAK","FUMG","FUSAN","RADAR","RAF","RNAS","RFC","CAMP"],Ue=new Set(I.map(h=>(h.locationType||"").toUpperCase()).filter(Boolean)),$e=He.filter(h=>Ue.has(h)),De=[[35,-20],[75,40]],We=[...le,...ce];return l.jsxs("div",{className:`relative w-full h-full rounded-xl border border-stone-700 shadow-2xl bg-stone-800 overflow-hidden ${m!==void 0?"aw-force-zoom-controls":""}`,children:[l.jsx("style",{children:` 42 .leaflet-marker-icon { transition: opacity 200ms ease; } 43 .oob-pin-tooltip { 44 background: rgba(0,0,0,0.88) !important; 45 border: 1px solid rgba(255,255,255,0.2) !important; 46 color: #fff !important; 47 font-size: 11px !important; 48 font-weight: 600 !important; 49 letter-spacing: 0.03em !important; 50 padding: 3px 8px !important; 51 border-radius: 3px !important; 52 box-shadow: 0 2px 6px rgba(0,0,0,0.5) !important; 53 white-space: nowrap !important; 54 } 55 .oob-pin-tooltip::before { border-top-color: rgba(0,0,0,0.88) !important; } 56 @keyframes aw-user-pulse { 57 0% { box-shadow: 0 0 0 0 rgba(59,130,246,0.5); } 58 70% { box-shadow: 0 0 0 8px rgba(59,130,246,0); } 59 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0); } 60 } 61 `}),l.jsx(gt,{keyTypes:$e}),l.jsxs("div",{className:"hidden md:block absolute left-3 z-[400] pointer-events-none",style:{bottom:"1.5rem",width:196},children:[l.jsxs("button",{onClick:()=>R(h=>!h),className:"pointer-events-auto w-full flex items-center justify-between px-3 py-2 text-[9px] font-bold uppercase tracking-[0.15em] text-stone-400 hover:text-stone-200 transition-colors",style:{background:"rgba(0,0,0,0.88)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:M?"8px 8px 0 0":"8px"},children:[l.jsx("span",{children:"Official Records"}),l.jsx("svg",{className:`w-3 h-3 shrink-0 transition-transform duration-150 ${M?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),M&&l.jsxs("div",{className:"pointer-events-auto flex flex-col gap-1.5 px-3 pt-1.5 pb-2.5",style:{background:"rgba(0,0,0,0.88)",border:"1px solid rgba(255,255,255,0.08)",borderTop:"none",borderRadius:"0 0 8px 8px"},children:[l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox",checked:$,onChange:h=>ke(h.target.checked),className:"w-3 h-3 cursor-pointer shrink-0",style:{accentColor:"#F59E0B"}}),l.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-stone-400",children:"Historic England Listed"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox",checked:D,onChange:h=>Me(h.target.checked),className:"w-3 h-3 cursor-pointer shrink-0",style:{accentColor:"#EF4444"}}),l.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-stone-400",children:"Heritage at Risk"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox",checked:ue,onChange:h=>je(h.target.checked),className:"w-3 h-3 cursor-pointer shrink-0",style:{accentColor:"#3B82F6"}}),l.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-stone-400",children:"OpenStreetMap Heritage"})]}),l.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[l.jsx("input",{type:"checkbox",checked:J,onChange:h=>{Oe(h.target.checked),h.target.checked||X(!1)},className:"w-3 h-3 cursor-pointer shrink-0",style:{accentColor:"#8B5CF6"}}),l.jsxs("span",{className:"text-[10px] font-bold uppercase tracking-widest text-stone-400",children:["Wikidata / Wikipedia",Te&&J?" â ":""]})]}),d&&l.jsx("button",{onClick:()=>{vt(),window.location.reload()},className:"mt-1 text-[10px] text-stone-600 hover:text-red-400 transition-colors uppercase tracking-widest text-left",children:"Clear layer cache"})]})]}),l.jsxs(Xe,{center:he?Ge:[49.5,12],zoom:he?Ae:5,minZoom:4,maxBounds:De,maxBoundsViscosity:1,scrollWheelZoom:!1,zoomControl:!1,keyboard:!1,className:`w-full h-full z-0 absolute inset-0 ${b?"cursor-crosshair":""}`,"aria-label":"Interactive map of Atlantikwall locations",children:[l.jsx(dt,{position:"topright"}),l.jsx(et,{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",attribution:"© OpenStreetMap contributors"}),l.jsx(zt,{}),l.jsx(Ft,{}),l.jsx(Ht,{onZoomChange:Q}),l.jsx(Ut,{panTarget:o}),l.jsx($t,{userLocation:p,nearMeSites:m}),l.jsx(Dt,{active:b,onPick:v}),l.jsx(Vt,{popupTarget:r,onPopupOpened:s,panTarget:o,onPanDone:c}),l.jsx(bt,{showNHLE:$,setListedBuildings:we,setScheduledMonuments:Se,onLoadStart:()=>O("NHLE",!0),onLoadEnd:()=>O("NHLE",!1)}),l.jsx(Mt,{showHAR:D,setHarFeatures:Ne,onLoadStart:()=>O("HAR",!0),onLoadEnd:()=>O("HAR",!1)}),l.jsx(Ot,{showOSM:ue,setOSMFeatures:Pe,onLoadStart:()=>O("OSM",!0),onLoadEnd:()=>O("OSM",!1)}),l.jsx(Gt,{showWikidata:J,setWikidataFeatures:Re,onLoadStart:()=>{O("Wikidata",!0),X(!1)},onLoadEnd:()=>O("Wikidata",!1),onLoadError:()=>X(!0)}),l.jsx(H,{chunkedLoading:!0,maxClusterRadius:60,disableClusteringAtZoom:15,spiderfyOnMaxZoom:!0,showCoverageOnHover:!1,iconCreateFunction:h=>z(N,"#1c1917",h.getChildCount()),children:Ze&&Fe.map(h=>{const C=h._lat??h.coordinates.lat,w=h._lng??h.coordinates.lng;let S=h.town||h.title||"";return h.locationCode&&S.includes(h.locationCode)&&(S=S.replace(h.locationCode,"").replace(/^[-:,]\s*/,"").trim()),l.jsxs(B,{position:[C,w],icon:Wt(h.locationType,h.sectionId),title:S||"Location",opacity:1,ref:y=>{y&&(y.options.siteId=h.id)},eventHandlers:{mouseover:y=>{clearTimeout(k.current),t?.(h.id),y.target._popup?.isOpen()&&y.target.closeTooltip()},mouseout:()=>{k.current=setTimeout(()=>t?.(null),200)},click:y=>{y.originalEvent?.stopPropagation(),n?.(h.id),y.target.openPopup()},popupopen:y=>{y.target.closeTooltip()}},children:[l.jsx(ut,{direction:"top",offset:[0,-16],opacity:1,className:"oob-pin-tooltip",children:S||h.title}),l.jsx(Z,{className:"custom-popup oob-site-popup",autoPanPadding:[20,20],children:l.jsxs("div",{style:{minWidth:180,maxWidth:240},children:[(()=>{const y=h.contentBlocks?.[0],j=h.images?.[0]||y?.mainImages?.[0]||y?.mainImage||null;return j?l.jsx("img",{src:st(j),alt:h.title||"",style:{width:"100%",height:80,objectFit:"cover",borderRadius:4,marginBottom:8,display:"block"},onError:T=>{T.currentTarget.style.display="none"}}):null})(),l.jsx("div",{style:{fontWeight:600,fontSize:13,marginBottom:4,color:"#1c1917"},children:h.title||h.town||"Untitled"}),h.locationCode&&l.jsx("div",{style:{fontSize:11,color:"#57534e",marginBottom:6,fontFamily:"monospace"},children:h.locationCode}),h.locationType&&l.jsx("div",{style:{fontSize:11,color:"#78716c",marginBottom:6},children:h.locationType}),h.aiSummary&&l.jsx("div",{style:{fontSize:11,color:"#57534e",marginBottom:8,lineHeight:1.5,display:"-webkit-box",WebkitLineClamp:6,WebkitBoxOrient:"vertical",overflow:"hidden"},children:h.aiSummary.replace(/<[^>]+>/g,"")}),l.jsx("button",{onClick:y=>{y.stopPropagation(),ne("map_pin_clicked",{location_slug:h.slug||h.id}),i?.(h.slug||h.id,h.id)},style:{fontSize:11,color:"#60a5fa",cursor:"pointer",background:"none",border:"none",padding:0},children:"View details â"})]})})]}
61,h.id)})}),l.jsxs(H,{chunkedLoading:!0,maxClusterRadius:60,disableClusteringAtZoom:12,iconCreateFunction:h=>z(N,"#F59E0B",h.getChildCount()),children:[G(le,h=>{const C=A(h.geometry);return C?{lat:C.y,lng:C.x}:null}).map((h,C)=>{const{attributes:w,geometry:S}=h,y=A(S);if(!y||D&&ee(y.y,y.x,Y))return null;const j=h._lat??y.y,T=h._lng??y.x;return l.jsx(B,{position:[j,T],icon:me("LB"),children:l.jsx(Z,{className:"custom-popup",children:l.jsx(_e,{type:"LB",attr:w,nearby:F(y.y,y.x,I)})})},`lb-${C}`)}),G(ce,h=>{const C=A(h.geometry);return C?{lat:C.y,lng:C.x}:null}).map((h,C)=>{const{attributes:w,geometry:S}=h,y=A(S);if(!y||D&&ee(y.y,y.x,Y))return null;const j=h._lat??y.y,T=h._lng??y.x;return l.jsx(B,{position:[j,T],icon:me("SM"),children:l.jsx(Z,{className:"custom-popup",children:l.jsx(_e,{type:"SM",attr:w,nearby:F(y.y,y.x,I)})})},`sm-${C}`)})]}),l.jsx(H,{chunkedLoading:!0,maxClusterRadius:60,disableClusteringAtZoom:12,iconCreateFunction:h=>z(N,"#EF4444",h.getChildCount()),children:G(Y,h=>{const C=A(h.geometry);return C?{lat:C.y,lng:C.x}:null}).map((h,C)=>{const{attributes:w,geometry:S}=h,y=A(S);if(!y)return null;const j=$?ee(y.y,y.x,We):null,T=h._lat??y.y,Ve=h._lng??y.x;return l.jsx(B,{position:[T,Ve],icon:St(!!j),children:l.jsx(Z,{className:"custom-popup",children:l.jsx(Nt,{attr:w,nearby:F(y.y,y.x,I),nhleAttr:j?.attributes??null})})},`har-${C}`)})}),l.jsx(H,{chunkedLoading:!0,maxClusterRadius:60,disableClusteringAtZoom:12,removeOutsideVisibleBounds:!1,iconCreateFunction:h=>z(N,"#3B82F6",h.getChildCount()),children:G(Ee,h=>{const C=h.lat??h.center?.lat,w=h.lon??h.center?.lon;return C&&w?{lat:C,lng:w}:null}).map(h=>{const C=h.lat??h.center?.lat,w=h.lon??h.center?.lon;if(!C||!w)return null;const S=h._lat??C,y=h._lng??w,j=F(C,w,I,.5);return l.jsx(B,{position:[S,y],icon:Pt,children:l.jsx(Z,{className:"custom-popup",children:l.jsx(It,{el:h,nearby:j})})},`osm-${h.type}-${h.id}`)})}),l.jsx(H,{chunkedLoading:!0,maxClusterRadius:60,disableClusteringAtZoom:12,iconCreateFunction:h=>z(N,"#8B5CF6",h.getChildCount()),children:G(Ie,h=>ie(h.coords?.value)).map((h,C)=>{const w=ie(h.coords?.value);if(!w)return null;const S=h._lat??w.lat,y=h._lng??w.lng,j=F(w.lat,w.lng,I,.5);return l.jsx(B,{position:[S,y],icon:Bt,children:l.jsx(Z,{className:"custom-popup",children:l.jsx(At,{binding:h,nearby:j})})},`wd-${h.item?.value}-${C}`)})}),p&&(()=>{const h=new N.divIcon({className:"",html:'<div style="width:16px;height:16px;border-radius:50%;background:#3B82F6;border:2px solid white;box-shadow:0 0 0 4px rgba(59,130,246,0.25);animation:aw-user-pulse 2s ease-out infinite;"></div>',iconSize:[16,16],iconAnchor:[8,8]});return l.jsx(B,{position:[p.lat,p.lng],icon:h,zIndexOffset:1e3})})(),de.size>0&&l.jsxs("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 z-[400] flex items-center gap-1.5 px-2.5 py-1 rounded-full text-[10px] font-bold uppercase tracking-widest text-stone-300 shadow-lg pointer-events-none",style:{background:"rgba(0,0,0,0.7)",backdropFilter:"blur(4px)"},children:[l.jsxs("svg",{className:"w-3 h-3 animate-spin shrink-0 pointer-events-none",fill:"none",viewBox:"0 0 24 24",children:[l.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),l.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),l.jsx("span",{className:"pointer-events-none",children:[...de].join(" · ")})]}),$&&E<9&&l.jsx("div",{className:"absolute bottom-24 left-1/2 -translate-x-1/2 z-[500] bg-stone-900/90 border border-amber-600/50 text-amber-400 text-xs font-bold uppercase tracking-widest px-4 py-2 rounded-full pointer-events-none shadow-lg whitespace-nowrap",children:"Zoom in over England to load Historic England listings"})]})]})});export{tn as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.