1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["leaflet.TileLayer.NoGap-CLWz07vm.js","assets/index-D6Oq2mc3.js","react-dom-CNxR51U1.js","core-js-D27xPy6y.js","posthog-js-CH4xgAFf.js","assets/react-dom-CwBLJBHs.css","swiper-PUsOHddC.js","entities-BwoFPVdP.js","assets/swiper-CPVyST0p.css","polyfills.js","assets/index-DB78ZE7R.css","slot-BvISkw5W.js","index-BX-UyYgB.js"])))=>i.map(i=>d[i]); 2import{g as wt,f as Ct}from"./utils-marker-bounds-5XqSJ30w.js";import{l as M,d as xt,r as U,q as Mt}from"./map-factory-view-filled-mobile-B2WN5H9p.js";import{j as bt,as as St,p as kt,aj as Tt,a8 as It,X as At,I as q,at as K,O as Pt,m as Ot,o as Dt,b as X}from"./swiper-PUsOHddC.js";import{A as Ut,h as Et,i as Bt,b as $t,d as Nt,f as Q,B as Wt,e as J,c as Zt,G as Rt}from"./leaflet.TileLayer.NoGap-CLWz07vm.js";import{g as jt}from"./star-2pAPk8YC.js";import{j as I,_ as Y}from"./react-dom-CNxR51U1.js";const Vt={DEFAULT:"https://api.maptiler.com/maps/5a8dceae-b0ed-4fc9-80e3-d4c8d5c76141/256/{z}/{x}/{y}.png?key=oLdHhsrzCltCHWSkt3Qs",TOPO:"https://api.maptiler.com/maps/15da8049-eac8-4cc8-98d5-5591dff9a656/256/{z}/{x}/{y}.png?key=oLdHhsrzCltCHWSkt3Qs",WXTILES:"https://api.maptiler.com/maps/b12917ec-c374-47be-8bb3-409052a57c1a/{z}/{x}/{y}.png?key=oLdHhsrzCltCHWSkt3Qs",SATELLITE:"https://api.maptiler.com/maps/satellite-v4/256/{z}/{x}/{y}.jpg?key=oLdHhsrzCltCHWSkt3Qs"},Gt=(e,r)=>{const s=Vt[e];if(s)return M.tileLayer(s,r)},Ft=(e,r)=>{var s,n,l;if((s=e.attributionControl)==null||s.setPrefix('<a href="https://leafletjs.com" title="A JS library for interactive maps">Leaflet</a>'),r){const t={attribution:r!==xt.WXTILES?"".concat(Ut," ").concat(Et):void 0,zIndex:1},i=Gt(r,t);i&&((l=(n=bt())==null?void 0:n.playwright)!=null&&l.isPlaywright&&i.on("load",()=>{console.log(St)}),e.addLayer(i))}};var N={exports:{}},zt=N.exports,tt;function Ht(){return tt||(tt=1,function(e,r){(function(s,n){n(r)})(zt,function(s){var n=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(t){L.Util.setOptions(this,t),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 i=L.DomUtil.TRANSITION&&this.options.animate;L.extend(this,i?this._withAnimation:this._noAnimation),this._markerCluster=i?L.MarkerCluster:L.MarkerClusterNonAnimated},addLayer:function(t){if(t instanceof L.LayerGroup)return this.addLayers([t]);if(!t.getLatLng)return this._nonPointGroup.addLayer(t),this.fire("layeradd",{layer:t}),this;if(!this._map)return this._needsClustering.push(t),this.fire("layeradd",{layer:t}),this;if(this.hasLayer(t))return this;this._unspiderfy&&this._unspiderfy(),this._addLayer(t,this._maxZoom),this.fire("layeradd",{layer:t}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons();var i=t,a=this._zoom;if(t.__parent)for(;i.__parent._zoom>=a;)i=i.__parent;return this._currentShownBounds.contains(i.getLatLng())&&(this.options.animateAddingMarkers?this._animationAddLayer(t,i):this._animationAddLayerNonAnimated(t,i)),this},removeLayer:function(t){return t instanceof L.LayerGroup?this.removeLayers([t]):t.getLatLng?this._map?t.__parent?(this._unspiderfy&&(this._unspiderfy(),this._unspiderfyLayer(t)),this._removeLayer(t,!0),this.fire("layerremove",{layer:t}),this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),t.off(this._childMarkerEventHandlers,this),this._featureGroup.hasLayer(t)&&(this._featureGroup.removeLayer(t),t.clusterShow&&t.clusterShow()),this):this:(!this._arraySplice(this._needsClustering,t)&&this.hasLayer(t)&&this._needsRemoving.push({layer:t,latlng:t._latlng}),this.fire("layerremove",{layer:t}),this):(this._nonPointGroup.removeLayer(t),this.fire("layerremove",{layer:t}),this)},addLayers:function(t,i){if(!L.Util.isArray(t))return this.addLayer(t);var a=this._featureGroup,o=this._nonPointGroup,h=this.options.chunkedLoading,d=this.options.chunkInterval,u=this.options.chunkProgress,c=t.length,f=0,m=!0,_;if(this._map){var g=new Date().getTime(),p=L.bind(function(){var y=new Date().getTime();for(this._map&&this._unspiderfy&&this._unspiderfy();f<c;f++){if(h&&f%200===0){var x=new Date().getTime()-y;if(x>d)break}if(_=t[f],_ instanceof L.LayerGroup){m&&(t=t.slice(),m=!1),this._extractNonGroupLayers(_,t),c=t.length;continue}if(!_.getLatLng){o.addLayer(_),i||this.fire("layeradd",{layer:_});continue}if(!this.hasLayer(_)&&(this._addLayer(_,this._maxZoom),i||this.fire("layeradd",{layer:_}),_.__parent&&_.__parent.getChildCount()===2)){var C=_.__parent.getAllChildMarkers(),b=C[0]===_?C[1]:C[0];a.removeLayer(b)}}u&&u(f,c,new Date().getTime()-g),f===c?(this._topClusterLevel._recalculateBounds(),this._refreshClustersIcons(),this._topClusterLevel._recursivelyAddChildrenToMap(null,this._zoom,this._currentShownBounds)):setTimeout(p,this.options.chunkDelay)},this);p()}else for(var v=this._needsClustering;f<c;f++){if(_=t[f],_ instanceof L.LayerGroup){m&&(t=t.slice(),m=!1),this._extractNonGroupLayers(_,t),c=t.length;continue}if(!_.getLatLng){o.addLayer(_);continue}this.hasLayer(_)||v.push(_)}return this},removeLayers:function(t){var i,a,o=t.length,h=this._featureGroup,d=this._nonPointGroup,u=!0;if(!this._map){for(i=0;i<o;i++){if(a=t[i],a instanceof L.LayerGroup){u&&(t=t.slice(),u=!1),this._extractNonGroupLayers(a,t),o=t.length;continue}this._arraySplice(this._needsClustering,a),d.removeLayer(a),this.hasLayer(a)&&this._needsRemoving.push({layer:a,latlng:a._latlng}),this.fire("layerremove",{layer:a})}return this}if(this._unspiderfy){this._unspiderfy();var c=t.slice(),f=o;for(i=0;i<f;i++){if(a=c[i],a instanceof L.LayerGroup){this._extractNonGroupLayers(a,c),f=c.length;continue}this._unspiderfyLayer(a)}}for(i=0;i<o;i++){if(a=t[i],a instanceof L.LayerGroup){u&&(t=t.slice(),u=!1),this._extractNonGroupLayers(a,t),o=t.length;continue}if(!a.__parent){d.removeLayer(a),this.fire("layerremove",{layer:a});continue}this._removeLayer(a,!0,!0),this.fire("layerremove",{layer:a}),h.hasLayer(a)&&(h.removeLayer(a),a.clusterShow&&a.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(t){t.off(this._childMarkerEventHandlers,this),delete t.__parent},this),this._map&&this._generateInitialClusters(),this},getBounds:function(){var t=new L.LatLngBounds;this._topClusterLevel&&t.extend(this._topClusterLevel._bounds);for(var i=this._needsClustering.length-1;i>=0;i--)t.extend(this._needsClustering[i].getLatLng());return t.extend(this._nonPointGroup.getBounds()),t},eachLayer:function(t,i){var a=this._needsClustering.slice(),o=this._needsRemoving,h,d,u;for(this._topClusterLevel&&this._topClusterLevel.getAllChildMarkers(a),d=a.length-1;d>=0;d--){for(h=!0,u=o.length-1;u>=0;u--)if(o[u].layer===a[d]){h=!1;break}h&&t.call(i,a[d])}this._nonPointGroup.eachLayer(t,i)},getLayers:function(){var t=[];return this.eachLayer(function(i){t.push(i)}),t},getLayer:function(t){var i=null;return t=parseInt(t,10),this.eachLayer(function(a){L.stamp(a)===t&&(i=a)}),i},hasLayer:function(t){if(!t)return!1;var i,a=this._needsClustering;for(i=a.length-1;i>=0;i--)if(a[i]===t)return!0;for(a=this._needsRemoving,i=a.length-1;i>=0;i--)if(a[i].layer===t)return!1;return!!(t.__parent&&t.__parent._group===this)||this._nonPointGroup.hasLayer(t)},zoomToShowLayer:function(t,i){var a=this._map;typeof i!="function"&&(i=function(){});var o=function(){(a.hasLayer(t)||a.hasLayer(t.__parent))&&!this._inZoomAnimation&&(this._map.off("moveend",o,this),this.off("animationend",o,this),a.hasLayer(t)?i():t.__parent._icon&&(this.once("spiderfied",i,this),t.__parent.spiderfy()))};t._icon&&this._map.getBounds().contains(t.getLatLng())?i():t.__parent._zoom<Math.round(this._map._zoom)?(this._map.on("moveend",o,this),this._map.panTo(t.getLatLng())):(this._map.on("moveend",o,this),this.on("animationend",o,this),t.__parent.zoomToBounds())},onAdd:function(t){this._map=t;var i,a,o;if(!isFinite(this._map.getMaxZoom()))throw"Map has no maxZoom specified";
2for(this._featureGroup.addTo(t),this._nonPointGroup.addTo(t),this._gridClusters||this._generateInitialClusters(),this._maxLat=t.options.crs.projection.MAX_LATITUDE,i=0,a=this._needsRemoving.length;i<a;i++)o=this._needsRemoving[i],o.newlatlng=o.layer._latlng,o.layer._latlng=o.latlng;for(i=0,a=this._needsRemoving.length;i<a;i++)o=this._needsRemoving[i],this._removeLayer(o.layer,!0),o.layer._latlng=o.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(),a=this._needsClustering,this._needsClustering=[],this.addLayers(a,!0)},onRemove:function(t){t.off("zoomend",this._zoomEnd,this),t.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(t){for(var i=t;i&&!i._icon;)i=i.__parent;return i||null},_arraySplice:function(t,i){for(var a=t.length-1;a>=0;a--)if(t[a]===i)return t.splice(a,1),!0},_removeFromGridUnclustered:function(t,i){for(var a=this._map,o=this._gridUnclustered,h=Math.floor(this._map.getMinZoom());i>=h&&o[i].removeObject(t,a.project(t.getLatLng(),i));i--);},_childMarkerDragStart:function(t){t.target.__dragStart=t.target._latlng},_childMarkerMoved:function(t){if(!this._ignoreMove&&!t.target.__dragStart){var i=t.target._popup&&t.target._popup.isOpen();this._moveChild(t.target,t.oldLatLng,t.latlng),i&&t.target.openPopup()}},_moveChild:function(t,i,a){t._latlng=i,this.removeLayer(t),t._latlng=a,this.addLayer(t)},_childMarkerDragEnd:function(t){var i=t.target.__dragStart;delete t.target.__dragStart,i&&this._moveChild(t.target,i,t.target._latlng)},_removeLayer:function(t,i,a){var o=this._gridClusters,h=this._gridUnclustered,d=this._featureGroup,u=this._map,c=Math.floor(this._map.getMinZoom());i&&this._removeFromGridUnclustered(t,this._maxZoom);var f=t.__parent,m=f._markers,_;for(this._arraySplice(m,t);f&&(f._childCount--,f._boundsNeedUpdate=!0,!(f._zoom<c));)i&&f._childCount<=1?(_=f._markers[0]===t?f._markers[1]:f._markers[0],o[f._zoom].removeObject(f,u.project(f._cLatLng,f._zoom)),h[f._zoom].addObject(_,u.project(_.getLatLng(),f._zoom)),this._arraySplice(f.__parent._childClusters,f),f.__parent._markers.push(_),_.__parent=f.__parent,f._icon&&(d.removeLayer(f),a||d.addLayer(_))):f._iconNeedsUpdate=!0,f=f.__parent;delete t.__parent},_isOrIsParent:function(t,i){for(;i;){if(t===i)return!0;i=i.parentNode}return!1},fire:function(t,i,a){if(i&&i.layer instanceof L.MarkerCluster){if(i.originalEvent&&this._isOrIsParent(i.layer._icon,i.originalEvent.relatedTarget))return;t="cluster"+t}L.FeatureGroup.prototype.fire.call(this,t,i,a)},listens:function(t,i){return L.FeatureGroup.prototype.listens.call(this,t,i)||L.FeatureGroup.prototype.listens.call(this,"cluster"+t,i)},_defaultIconCreateFunction:function(t){var i=t.getChildCount(),a=" marker-cluster-";return i<10?a+="small":i<100?a+="medium":a+="large",new L.DivIcon({html:"<div><span>"+i+"</span></div>",className:"marker-cluster"+a,iconSize:new L.Point(40,40)})},_bindEvents:function(){var t=this._map,i=this.options.spiderfyOnMaxZoom,a=this.options.showCoverageOnHover,o=this.options.zoomToBoundsOnClick,h=this.options.spiderfyOnEveryZoom;(i||o||h)&&this.on("clusterclick clusterkeypress",this._zoomOrSpiderfy,this),a&&(this.on("clustermouseover",this._showCoverage,this),this.on("clustermouseout",this._hideCoverage,this),t.on("zoomend",this._hideCoverage,this))},_zoomOrSpiderfy:function(t){var i=t.layer,a=i;if(!(t.type==="clusterkeypress"&&t.originalEvent&&t.originalEvent.keyCode!==13)){for(;a._childClusters.length===1;)a=a._childClusters[0];a._zoom===this._maxZoom&&a._childCount===i._childCount&&this.options.spiderfyOnMaxZoom?i.spiderfy():this.options.zoomToBoundsOnClick&&i.zoomToBounds(),this.options.spiderfyOnEveryZoom&&i.spiderfy(),t.originalEvent&&t.originalEvent.keyCode===13&&this._map._container.focus()}},_showCoverage:function(t){var i=this._map;this._inZoomAnimation||(this._shownPolygon&&i.removeLayer(this._shownPolygon),t.layer.getChildCount()>2&&t.layer!==this._spiderfied&&(this._shownPolygon=new L.Polygon(t.layer.getConvexHull(),this.options.polygonOptions),i.addLayer(this._shownPolygon)))},_hideCoverage:function(){this._shownPolygon&&(this._map.removeLayer(this._shownPolygon),this._shownPolygon=null)},_unbindEvents:function(){var t=this.options.spiderfyOnMaxZoom,i=this.options.showCoverageOnHover,a=this.options.zoomToBoundsOnClick,o=this.options.spiderfyOnEveryZoom,h=this._map;(t||a||o)&&this.off("clusterclick clusterkeypress",this._zoomOrSpiderfy,this),i&&(this.off("clustermouseover",this._showCoverage,this),this.off("clustermouseout",this._hideCoverage,this),h.off("zoomend",this._hideCoverage,this))}
2,_zoomEnd:function(){this._map&&(this._mergeSplitClusters(),this._zoom=Math.round(this._map._zoom),this._currentShownBounds=this._getExpandedVisibleBounds())},_moveEnd:function(){if(!this._inZoomAnimation){var t=this._getExpandedVisibleBounds();this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),this._zoom,t),this._topClusterLevel._recursivelyAddChildrenToMap(null,Math.round(this._map._zoom),t),this._currentShownBounds=t}},_generateInitialClusters:function(){var t=Math.ceil(this._map.getMaxZoom()),i=Math.floor(this._map.getMinZoom()),a=this.options.maxClusterRadius,o=a;typeof a!="function"&&(o=function(){return a}),this.options.disableClusteringAtZoom!==null&&(t=this.options.disableClusteringAtZoom-1),this._maxZoom=t,this._gridClusters={},this._gridUnclustered={};for(var h=t;h>=i;h--)this._gridClusters[h]=new L.DistanceGrid(o(h)),this._gridUnclustered[h]=new L.DistanceGrid(o(h));this._topClusterLevel=new this._markerCluster(this,i-1)},_addLayer:function(t,i){var a=this._gridClusters,o=this._gridUnclustered,h=Math.floor(this._map.getMinZoom()),d,u;for(this.options.singleMarkerMode&&this._overrideMarkerIcon(t),t.on(this._childMarkerEventHandlers,this);i>=h;i--){d=this._map.project(t.getLatLng(),i);var c=a[i].getNearObject(d);if(c){c._addChild(t),t.__parent=c;return}if(c=o[i].getNearObject(d),c){var f=c.__parent;f&&this._removeLayer(c,!1);var m=new this._markerCluster(this,i,c,t);a[i].addObject(m,this._map.project(m._cLatLng,i)),c.__parent=m,t.__parent=m;var _=m;for(u=i-1;u>f._zoom;u--)_=new this._markerCluster(this,u,_),a[u].addObject(_,this._map.project(c.getLatLng(),u));f._addChild(_),this._removeFromGridUnclustered(c,i);return}o[i].addObject(t,d)}this._topClusterLevel._addChild(t),t.__parent=this._topClusterLevel},_refreshClustersIcons:function(){this._featureGroup.eachLayer(function(t){t instanceof L.MarkerCluster&&t._iconNeedsUpdate&&t._updateIcon()})},_enqueue:function(t){this._queue.push(t),this._queueTimeout||(this._queueTimeout=setTimeout(L.bind(this._processQueue,this),300))},_processQueue:function(){for(var t=0;t<this._queue.length;t++)this._queue[t].call(this);this._queue.length=0,clearTimeout(this._queueTimeout),this._queueTimeout=null},_mergeSplitClusters:function(){var t=Math.round(this._map._zoom);this._processQueue(),this._zoom<t&&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,t)):this._zoom>t?(this._animationStart(),this._animationZoomOut(this._zoom,t)):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(t){var i=this._maxLat;return i!==void 0&&(t.getNorth()>=i&&(t._northEast.lat=1/0),t.getSouth()<=-i&&(t._southWest.lat=-1/0)),t},_animationAddLayerNonAnimated:function(t,i){if(i===t)this._featureGroup.addLayer(t);else if(i._childCount===2){i._addToMap();var a=i.getAllChildMarkers();this._featureGroup.removeLayer(a[0]),this._featureGroup.removeLayer(a[1])}else i._updateIcon()},_extractNonGroupLayers:function(t,i){var a=t.getLayers(),o=0,h;for(i=i||[];o<a.length;o++){if(h=a[o],h instanceof L.LayerGroup){this._extractNonGroupLayers(h,i);continue}i.push(h)}return i},_overrideMarkerIcon:function(t){var i=t.options.icon=this.options.iconCreateFunction({getChildCount:function(){return 1},getAllChildMarkers:function(){return[t]}});return i}});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(t,i){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t),this._topClusterLevel._recursivelyAddChildrenToMap(null,i,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationZoomOut:function(t,i){this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t),this._topClusterLevel._recursivelyAddChildrenToMap(null,i,this._getExpandedVisibleBounds()),this.fire("animationend")},_animationAddLayer:function(t,i){this._animationAddLayerNonAnimated(t,i)}},_withAnimation:{_animationStart:function(){this._map._mapPane.className+=" leaflet-cluster-anim",this._inZoomAnimation++},_animationZoomIn:function(t,i){var a=this._getExpandedVisibleBounds(),o=this._featureGroup,h=Math.floor(this._map.getMinZoom()),d;this._ignoreMove=!0,this._topClusterLevel._recursively(a,t,h,function(u){var c=u._latlng,f=u._markers,m;for(a.contains(c)||(c=null),u._isSingleParent()&&t+1===i?(o.removeLayer(u),u._recursivelyAddChildrenToMap(null,i,a)):(u.clusterHide(),u._recursivelyAddChildrenToMap(c,i,a)),d=f.length-1;d>=0;d--)m=f[d],a.contains(m._latlng)||o.removeLayer(m)}),this._forceLayout(),this._topClusterLevel._recursivelyBecomeVisible(a,i),o.eachLayer(function(u){!(u instanceof L.MarkerCluster)&&u._icon&&u.clusterShow()}),this._topClusterLevel._recursively(a,t,i,function(u){u._recursivelyRestoreChildPositions(i)}),this._ignoreMove=!1,this._enqueue(function(){this._topClusterLevel._recursively(a,t,h,function(u){o.removeLayer(u),u.clusterShow()}),this._animationEnd()})},_animationZoomOut:function(t,i){this._animationZoomOutSingle(this._topClusterLevel,t-1,i),this._topClusterLevel._recursivelyAddChildrenToMap(null,i,this._getExpandedVisibleBounds()),this._topClusterLevel._recursivelyRemoveChildrenFromMap(this._currentShownBounds,Math.floor(this._map.getMinZoom()),t,this._getExpandedVisibleBounds())},_animationAddLayer:function(t,i){var a=this,o=this._featureGroup;o.addLayer(t),i!==t&&(i._childCount>2?(i._updateIcon(),this._forceLayout(),this._animationStart(),t._setPos(this._map.latLngToLayerPoint(i.getLatLng())),t.clusterHide(),this._enqueue(function(){o.removeLayer(t),t.clusterShow(),a._animationEnd()})):(this._forceLayout(),a._animationStart(),a._animationZoomOutSingle(i,this._map.getMaxZoom(),this._zoom)))}},_animationZoomOutSingle:function(t,i,a){var o=this._getExpandedVisibleBounds(),h=Math.floor(this._map.getMinZoom());t._recursivelyAnimateChildrenInAndAddSelfToMap(o,h,i+1,a);var d=this;this._forceLayout(),t._recursivelyBecomeVisible(o,a),this._enqueue(function(){if(t._childCount===1){var u=t._markers[0];this._ignoreMove=!0,u.setLatLng(u.getLatLng()),this._ignoreMove=!1,u.clusterShow&&u.clusterShow()}else t._recursively(o,a,h,function(c){c._recursivelyRemoveChildrenFromMap(o,h,i+1)});d._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(t){return new L.MarkerClusterGroup(t)};
2var l=L.MarkerCluster=L.Marker.extend({options:L.Icon.prototype.options,initialize:function(t,i,a,o){L.Marker.prototype.initialize.call(this,a?a._cLatLng||a.getLatLng():new L.LatLng(0,0),{icon:this,pane:t.options.clusterPane}),this._group=t,this._zoom=i,this._markers=[],this._childClusters=[],this._childCount=0,this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._bounds=new L.LatLngBounds,a&&this._addChild(a),o&&this._addChild(o)},getAllChildMarkers:function(t,i){t=t||[];for(var a=this._childClusters.length-1;a>=0;a--)this._childClusters[a].getAllChildMarkers(t,i);for(var o=this._markers.length-1;o>=0;o--)i&&this._markers[o].__dragStart||t.push(this._markers[o]);return t},getChildCount:function(){return this._childCount},zoomToBounds:function(t){for(var i=this._childClusters.slice(),a=this._group._map,o=a.getBoundsZoom(this._bounds),h=this._zoom+1,d=a.getZoom(),u;i.length>0&&o>h;){h++;var c=[];for(u=0;u<i.length;u++)c=c.concat(i[u]._childClusters);i=c}o>h?this._group._map.setView(this._latlng,h):o<=d?this._group._map.setVie
2w(this._latlng,d+1):this._group._map.fitBounds(this._bounds,t)},getBounds:function(){var t=new L.LatLngBounds;return t.extend(this._bounds),t},_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(t,i){this._iconNeedsUpdate=!0,this._boundsNeedUpdate=!0,this._setClusterCenter(t),t instanceof L.MarkerCluster?(i||(this._childClusters.push(t),t.__parent=this),this._childCount+=t._childCount):(i||this._markers.push(t),this._childCount++),this.__parent&&this.__parent._addChild(t,!0)},_setClusterCenter:function(t){this._cLatLng||(this._cLatLng=t._cLatLng||t._latlng)},_resetBounds:function(){var t=this._bounds;t._southWest&&(t._southWest.lat=1/0,t._southWest.lng=1/0),t._northEast&&(t._northEast.lat=-1/0,t._northEast.lng=-1/0)},_recalculateBounds:function(){var t=this._markers,i=this._childClusters,a=0,o=0,h=this._childCount,d,u,c,f;if(h!==0){for(this._resetBounds(),d=0;d<t.length;d++)c=t[d]._latlng,this._bounds.extend(c),a+=c.lat,o+=c.lng;for(d=0;d<i.length;d++)u=i[d],u._boundsNeedUpdate&&u._recalculateBounds(),this._bounds.extend(u._bounds),c=u._wLatLng,f=u._childCount,a+=c.lat*f,o+=c.lng*f;this._latlng=this._wLatLng=new L.LatLng(a/h,o/h),this._boundsNeedUpdate=!1}},_addToMap:function(t){t&&(this._backupLatlng=this._latlng,this.setLatLng(t)),this._group._featureGroup.addLayer(this)},_recursivelyAnimateChildrenIn:function(t,i,a){this._recursively(t,this._group._map.getMinZoom(),a-1,function(o){var h=o._markers,d,u;for(d=h.length-1;d>=0;d--)u=h[d],u._icon&&(u._setPos(i),u.clusterHide())},function(o){var h=o._childClusters,d,u;for(d=h.length-1;d>=0;d--)u=h[d],u._icon&&(u._setPos(i),u.clusterHide())})},_recursivelyAnimateChildrenInAndAddSelfToMap:function(t,i,a,o){this._recursively(t,o,i,function(h){h._recursivelyAnimateChildrenIn(t,h._group._map.latLngToLayerPoint(h.getLatLng()).round(),a),h._isSingleParent()&&a-1===o?(h.clusterShow(),h._recursivelyRemoveChildrenFromMap(t,i,a)):h.clusterHide(),h._addToMap()})},_recursivelyBecomeVisible:function(t,i){this._recursively(t,this._group._map.getMinZoom(),i,null,function(a){a.clusterShow()})},_recursivelyAddChildrenToMap:function(t,i,a){this._recursively(a,this._group._map.getMinZoom()-1,i,function(o){if(i!==o._zoom)for(var h=o._markers.length-1;h>=0;h--){var d=o._markers[h];a.contains(d._latlng)&&(t&&(d._backupLatlng=d.getLatLng(),d.setLatLng(t),d.clusterHide&&d.clusterHide()),o._group._featureGroup.addLayer(d))}},function(o){o._addToMap(t)})},_recursivelyRestoreChildPositions:function(t){for(var i=this._markers.length-1;i>=0;i--){var a=this._markers[i];a._backupLatlng&&(a.setLatLng(a._backupLatlng),delete a._backupLatlng)}if(t-1===this._zoom)for(var o=this._childClusters.length-1;o>=0;o--)this._childClusters[o]._restorePosition();else for(var h=this._childClusters.length-1;h>=0;h--)this._childClusters[h]._recursivelyRestoreChildPositions(t)},_restorePosition:function(){this._backupLatlng&&(this.setLatLng(this._backupLatlng),delete this._backupLatlng)},_recursivelyRemoveChildrenFromMap:function(t,i,a,o){var h,d;this._recursively(t,i-1,a-1,function(u){for(d=u._markers.length-1;d>=0;d--)h=u._markers[d],(!o||!o.contains(h._latlng))&&(u._group._featureGroup.removeLayer(h),h.clusterShow&&h.clusterShow())},function(u){for(d=u._childClusters.length-1;d>=0;d--)h=u._childClusters[d],(!o||!o.contains(h._latlng))&&(u._group._featureGroup.removeLayer(h),h.clusterShow&&h.clusterShow())})},_recursively:function(t,i,a,o,h){var d=this._childClusters,u=this._zoom,c,f;if(i<=u&&(o&&o(this),h&&u===a&&h(this)),u<i||u<a)for(c=d.length-1;c>=0;c--)f=d[c],f._boundsNeedUpdate&&f._recalculateBounds(),t.intersects(f._bounds)&&f._recursively(t,i,a,o,h)},_isSingleParent:function(){return this._childClusters.length>0&&this._childClusters[0]._childCount===this._childCount}});L.Marker.include({clusterHide:function(){var t=this.options.opacity;return this.setOpacity(0),this.options.opacity=t,this},clusterShow:function(){return this.setOpacity(this.options.opacity)}}),L.DistanceGrid=function(t){this._cellSize=t,this._sqCellSize=t*t,this._grid={},this._objectPoint={}},L.DistanceGrid.prototype={addObject:function(t,i){var a=this._getCoord(i.x),o=this._getCoord(i.y),h=this._grid,d=h[o]=h[o]||{},u=d[a]=d[a]||[],c=L.Util.stamp(t);this._objectPoint[c]=i,u.push(t)},updateObject:function(t,i){this.removeObject(t),this.addObject(t,i)},removeObject:function(t,i){var a=this._getCoord(i.x),o=this._getCoord(i.y),h=this._grid,d=h[o]=h[o]||{},u=d[a]=d[a]||[],c,f;for(delete this._objectPoint[L.Util.stamp(t)],c=0,f=u.length;c<f;c++)if(u[c]===t)return u.splice(c,1),f===1&&delete d[a],!0},eachObject:function(t,i){var a,o,h,d,u,c,f,m=this._grid;for(a in m){u=m[a];for(o in u)for(c=u[o],h=0,d=c.length;h<d;h++)f=t.call(i,c[h]),f&&(h--,d--)}},getNearObject:function(t){var i=this._getCoord(t.x),a=this._getCoord(t.y),o,h,d,u,c,f,m,_,g=this._objectPoint,p=this._sqCellSize,v=null;for(o=a-1;o<=a+1;o++)if(u=this._grid[o],u){for(h=i-1;h<=i+1;h++)if(c=u[h],c)for(d=0,f=c.length;d<f;d++)m=c[d],_=this._sqDist(g[L.Util.stamp(m)],t),(_<p||_<=p&&v===null)&&(p=_,v=m)}return v},_getCoord:function(t){var i=Math.floor(t/this._cellSize);return isFinite(i)?i:t},_sqDist:function(t,i){var a=i.x-t.x,o=i.y-t.y;return a*a+o*o}},function(){L.QuickHull={getDistant:function(t,i){var a=i[1].lat-i[0].lat,o=i[0].lng-i[1].lng;return o*(t.lat-i[0].lat)+a*(t.lng-i[0].lng)},findMostDistantPointFromBaseLine:function(t,i){var a=0,o=null,h=[],d,u,c;for(d=i.length-1;d>=0;d--){if(u=i[d],c=this.getDistant(u,t),c>0)h.push(u);else continue;c>a&&(a=c,o=u)}return{maxPoint:o,newPoints:h}},buildConvexHull:function(t,i){var a=[],o=this.findMostDistantPointFromBaseLine(t,i);return o.maxPoint?(a=a.concat(this.buildConvexHull([t[0],o.maxPoint],o.newPoints)),a=a.concat(this.buildConvexHull([o.maxPoint,t[1]],o.newPoints)),a):[t[0]]},getConvexHull:function(t){var i=!1,a=!1,o=!1,h=!1,d=null,u=null,c=null,f=null,m=null,_=null,g;for(g=t.length-1;g>=0;g--){var p=t[g];(i===!1||p.lat>
vendor: 4,675 bytes, line 2
2i)&&(d=p,i=p.lat),(a===!1||p.lat<a)&&(u=p,a=p.lat),(o===!1||p.lng>o)&&(c=p,o=p.lng),(h===!1||p.lng<h)&&(f=p,h=p.lng)}a!==i?(_=u,m=d):(_=f,m=c);var v=[].concat(this.buildConvexHull([_,m],t),this.buildConvexHull([m,_],t));return v}}}(),L.MarkerCluster.include({getConvexHull:function(){var t=this.getAllChildMarkers(),i=[],a,o;for(o=t.length-1;o>=0;o--)a=t[o].getLatLng(),i.push(a);return L.QuickHull.getConvexHull(i)}}),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 t=this.getAllChildMarkers(null,!0),i=this._group,a=i._map,o=a.latLngToLayerPoint(this._latlng),h;this._group._unspiderfy(),this._group._spiderfied=this,this._group.options.spiderfyShapePositions?h=this._group.options.spiderfyShapePositions(t.length,o):t.length>=this._circleSpiralSwitchover?h=this._generatePointsSpiral(t.length,o):(o.y+=10,h=this._generatePointsCircle(t.length,o)),this._animationSpiderfy(t,h)}},unspiderfy:function(t){this._group._inZoomAnimation||(this._animationUnspiderfy(t),this._group._spiderfied=null)},_generatePointsCircle:function(t,i){var a=this._group.options.spiderfyDistanceMultiplier*this._circleFootSeparation*(2+t),o=a/this._2PI,h=this._2PI/t,d=[],u,c;for(o=Math.max(o,35),d.length=t,u=0;u<t;u++)c=this._circleStartAngle+u*h,d[u]=new L.Point(i.x+o*Math.cos(c),i.y+o*Math.sin(c))._round();return d},_generatePointsSpiral:function(t,i){var a=this._group.options.spiderfyDistanceMultiplier,o=a*this._spiralLengthStart,h=a*this._spiralFootSeparation,d=a*this._spiralLengthFactor*this._2PI,u=0,c=[],f;for(c.length=t,f=t;f>=0;f--)f<t&&(c[f]=new L.Point(i.x+o*Math.cos(u),i.y+o*Math.sin(u))._round()),u+=h/o+f*5e-4,o+=d/u;return c},_noanimationUnspiderfy:function(){var t=this._group,i=t._map,a=t._featureGroup,o=this.getAllChildMarkers(null,!0),h,d;for(t._ignoreMove=!0,this.setOpacity(1),d=o.length-1;d>=0;d--)h=o[d],a.removeLayer(h),h._preSpiderfyLatlng&&(h.setLatLng(h._preSpiderfyLatlng),delete h._preSpiderfyLatlng),h.setZIndexOffset&&h.setZIndexOffset(0),h._spiderLeg&&(i.removeLayer(h._spiderLeg),delete h._spiderLeg);t.fire("unspiderfied",{cluster:this,markers:o}),t._ignoreMove=!1,t._spiderfied=null}}),L.MarkerClusterNonAnimated=L.MarkerCluster.extend({_animationSpiderfy:function(t,i){var a=this._group,o=a._map,h=a._featureGroup,d=this._group.options.spiderLegPolylineOptions,u,c,f,m;for(a._ignoreMove=!0,u=0;u<t.length;u++)m=o.layerPointToLatLng(i[u]),c=t[u],f=new L.Polyline([this._latlng,m],d),o.addLayer(f),c._spiderLeg=f,c._preSpiderfyLatlng=c._latlng,c.setLatLng(m),c.setZIndexOffset&&c.setZIndexOffset(1e6),h.addLayer(c);this.setOpacity(.3),a._ignoreMove=!1,a.fire("spiderfied",{cluster:this,markers:t})},_animationUnspiderfy:function(){this._noanimationUnspiderfy()}}),L.MarkerCluster.include({_animationSpiderfy:function(t,i){var a=this,o=this._group,h=o._map,d=o._featureGroup,u=this._latlng,c=h.latLngToLayerPoint(u),f=L.Path.SVG,m=L.extend({},this._group.options.spiderLegPolylineOptions),_=m.opacity,g,p,v,y,x,C;for(_===void 0&&(_=L.MarkerClusterGroup.prototype.options.spiderLegPolylineOptions.opacity),f?(m.opacity=0,m.className=(m.className||"")+" leaflet-cluster-spider-leg"):m.opacity=_,o._ignoreMove=!0,g=0;g<t.length;g++)p=t[g],C=h.layerPointToLatLng(i[g]),v=new L.Polyline([u,C],m),h.addLayer(v),p._spiderLeg=v,f&&(y=v._path,x=y.getTotalLength()+.1,y.style.strokeDasharray=x,y.style.strokeDashoffset=x),p.setZIndexOffset&&p.setZIndexOffset(1e6),p.clusterHide&&p.clusterHide(),d.addLayer(p),p._setPos&&p._setPos(c);for(o._forceLayout(),o._animationStart(),g=t.length-1;g>=0;g--)C=h.layerPointToLatLng(i[g]),p=t[g],p._preSpiderfyLatlng=p._latlng,p.setLatLng(C),p.clusterShow&&p.clusterShow(),f&&(v=p._spiderLeg,y=v._path,y.style.strokeDashoffset=0,v.setStyle({opacity:_}));this.setOpacity(.3),o._ignoreMove=!1,setTimeout(function(){o._animationEnd(),o.fire("spiderfied",{cluster:a,markers:t})},200)},_animationUnspiderfy:function(t){var i=this,a=this._group,o=a._map,h=a._featureGroup,d=t?o._latLngToNewLayerPoint(this._latlng,t.zoom,t.center):o.latLngToLayerPoint(this._latlng),u=this.getAllChildMarkers(null,!0),c=L.Path.SVG,f,m,_,g,p,v;for(a._ignoreMove=!0,a._animationStart(),this.setOpacity(1),m=u.length-1;m>=0;m--)f=u[m],f._preSpiderfyLatlng&&(f.closePopup(),f.setLatLng(f._preSpiderfyLatlng),delete f._preSpiderfyLatlng,v=!0,f._setPos&&(f._setPos(d),v=!1),f.clusterHide&&(f.clusterHide(),v=!1),v&&h.removeLayer(f),c&&(_=f._spiderLeg,g=_._path,p=g.getTotalLength()+.1,g.style.strokeDashoffset=p,_.setStyle({opacity:0}
2)));a._ignoreMove=!1,setTimeout(function(){var y=0;for(m=u.length-1;m>=0;m--)f=u[m],f._spiderLeg&&y++;for(m=u.length-1;m>=0;m--)f=u[m],f._spiderLeg&&(f.clusterShow&&f.clusterShow(),f.setZIndexOffset&&f.setZIndexOffset(0),y>1&&h.removeLayer(f),o.removeLayer(f._spiderLeg),delete f._spiderLeg);a._animationEnd(),a.fire("unspiderfied",{cluster:i,markers:u})},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(t){L.DomUtil.hasClass(this._map._mapPane,"leaflet-touching")||(this._map.off("zoomanim",this._unspiderfyZoomAnim,this),this._unspiderfy(t))},_unspiderfyWrapper:function(){this._unspiderfy()},_unspiderfy:function(t){this._spiderfied&&this._spiderfied.unspiderfy(t)},_noanimationUnspiderfy:function(){this._spiderfied&&this._spiderfied._noanimationUnspiderfy()},_unspiderfyLayer:function(t){t._spiderLeg&&(this._featureGroup.removeLayer(t),t.clusterShow&&t.clusterShow(),t.setZIndexOffset&&t.setZIndexOffset(0),this._map.removeLayer(t._spiderLeg),delete t._spiderLeg)}}),L.MarkerClusterGroup.include({refreshClusters:function(t){return t?t instanceof L.MarkerClusterGroup?t=t._topClusterLevel.getAllChildMarkers():t instanceof L.LayerGroup?t=t._layers:t instanceof L.MarkerCluster?t=t.getAllChildMarkers():t instanceof L.Marker&&(t=[t]):t=this._topClusterLevel.getAllChildMarkers(),this._flagParentsIconsNeedUpdate(t),this._refreshClustersIcons(),this.options.singleMarkerMode&&this._refreshSingleMarkerModeMarkers(t),this},_flagParentsIconsNeedUpdate:function(t){var i,a;for(i in t)for(a=t[i].__parent;a;)a._iconNeedsUpdate=!0,a=a.__parent},_refreshSingleMarkerModeMarkers:function(t){var i,a;for(i in t)a=t[i],this.hasLayer(a)&&a.setIcon(this._overrideMarkerIcon(a))}}),L.Marker.include({refreshIconOptions:function(t,i){var a=this.options.icon;return L.setOptions(a,t),this.setIcon(a),i&&this.__parent&&this.__parent._group.refreshClusters(this),this}}),s.MarkerClusterGroup=n,s.MarkerCluster=l,Object.defineProperty(s,"__esModule",{value:!0})})}(N,N.exports)),N.exports}Ht();const qt=({setMaxZoom:e,boundsZoom:r})=>{if(kt(e))return e;if(e)return Math.max(Math.ceil(r)+1,7.5)},Kt=new M.LatLng(-40.55176549453071,172.42441177368164),Xt=e=>{if(e){if(e.useSimpleTiles)return new M.LatLng(e.imageRes[1]/2,e.imageRes[0]/2);if(e.imageBounds)return M.latLngBounds(e.imageBounds.southWestCnr,e.imageBounds.northEastCnr).getCenter()}return Kt},Qt=e=>e!=null&&e.startsWith("paddleboarding-risk")?"paddleboarding-risk":e!=null&&e.startsWith("kayaking-risk")?"kayaking-risk":e,Jt=(e,r)=>{const s=e.getAllChildMarkers(),n=new Map;return s.forEach((l,t)=>{var a;const i=r.find(o=>Tt.default(o)===l.options.title);if(It(i)){const o=At(i==null?void 0:i.subject);if(o){const h=Bt(o.type).icon;if(h){const d="v1-".concat(h);n.has(d)||n.set(d,I.jsx(q,{icon:h,iconClass:"svg--1em svg-fill-textSlate"},t))}}return}if(i&&(i.type===K.FilterPill||i.type===K.Pill)){const o=(a=i.view)==null?void 0:a.icon;if(o){const h="v2-".concat(Qt(o));n.has(h)||n.set(h,I.jsx(Pt,{icon:o,iconClass:"svg--1em svg-fill-textSlate"},t))}}}),I.jsx("div",{"data-module":"render-cluster-marker",className:"Map-tooltip is-cluster is-below",children:I.jsx("div",{className:"Map-tooltip--position Map-tooltip-content bg-white-85 u-inlineBlock u-posAbs",children:I.jsxs("div",{className:"u-flex",children:[I.jsx("div",{className:"Map-tooltip-content-thumbnail u-flex u-flexJustifyCenter u-flexAlignItemsCenter",children:I.jsx(q,{icon:"location",iconClass:"svg-fill-white",size:30})}),I.jsxs("div",{className:"Map-tooltip-content-text",children:[I.jsxs("span",{className:"h4 u-block",children:[s.length," locations"]}),I.jsx("div",{className:"Map-tooltip-content-text-icons",children:Array.from(n.values())})]})]})})})};M.Map.mergeOptions({gestureHandlingOptions:{text:{},duration:1e3,showOverlay:!0}});let G=!1;const Yt=M.Handler.extend({addHooks:function(){this._handleTouch=this._handleTouch.bind(this),this._setupPluginOptions(),this._setLanguageContent(),this._map._container.addEventListener("touchstart",this._handleTouch),this._map._container.addEventListener("touchmove",this._handleTouch),this._map._container.addEventListener("touchend",this._handleTouch),this._map._container.addEventListener("touchcancel",this._handleTouch),this._map._container.addEventListener("click",this._handleTouch),M.DomEvent.on(this._map._container,"wheel",this._handleScroll,this),M.DomEvent.on(this._map,"mouseover",this._handleMouseOver,this),M.DomEvent.on(this._map,"mouseout",this._handleMouseOut,this),M.DomEvent.on(this._map,"movestart",this._handleDragging,this),M.DomEvent.on(this._map,"move",this._handleDragging,this),M.DomEvent.on(this._map,"moveend",this._handleDragging,this)},removeHooks:function(){this._enableInteractions(),this._map._container.removeEventListener("touchstart",this._handleTouch),this._map._container.removeEventListener("touchmove",this._handleTouch),this._map._container.removeEventListener("touchend",this._handleTouch),this._map._container.removeEventListener("touchcancel",this._handleTouch),this._map._container.removeEventListener("click",this._handleTouch),M.DomEvent.off(this._map._container,"wheel",this._handleScroll,this),M.DomEvent.off(this._map,"mouseover",this._handleMouseOver,this),M.DomEvent.off(this._map,"mouseout",this._handleMouseOut,this),M.DomEvent.off(this._map,"movestart",this._handleDragging,this),M.DomEvent.off(this._map,"move",this._handleDragging,this),M.DomEvent.off(this._map,"moveend",this._handleDragging,this)},_handleDragging:function(e){e.type=="movestart"||e.type=="move"?G=!0:e.type=="moveend"&&(G=!1)},_disableInteractions:function(){this._map.dragging.disable(),this._map.scrollWheelZoom.disable(),this._map.tap&&this._map.tap.disable()},_enableInteractions:function(){this._map.dragging.enable(),this._map.scrollWheelZoom.enable(),this._map.tap&&this._map.tap.enable()},_setupPluginOptions:function(){this._map.options.gestureHandlingText&&(this._map.options.gestureHandlingOptions.text=this._map.options.gestureHandlingText)},_setLanguageContent:function(){let e={touch:"Use two fingers to move the map",scroll:"Use ctrl + scroll to zoom the map",scrollMac:"Use â + scroll to zoom the map"};this._map.options.gestureHandlingOptions&&this._map.options.gestureHandlingOptions.text&&this._map.options.gestureHandlingOptions.text.touch&&this._map.options.gestureHandlingOptions.text.scroll&&this._map.options.gestureHandlingOptions.text.scrollMac&&(e=this._map.options.gestureHandlingOptions.text);var r=!1;navigator.platform.toUpperCase().indexOf("MAC")>=0&&(r=!0);var s=e.scroll;r&&(s=e.scrollMac),this._map._container.setAttribute("data-gesture-handling-touch-content",e.touch),this._map._container.setAttribute("data-gesture-handling-scroll-content",s)},_handleTouch:function(e){var t;for(var r=["leaflet-control-minimap","leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"],s=!1,n=0;n<r.length;n++)e.target instanceof HTMLElement&&M.DomUtil.hasClass(e.target,r[n])&&(s=!0);const l=((t=this._map.options.gestureHandlingOptions)==null?void 0:t.showOverlay)!==!1;if(s){e.target instanceof HTMLElement&&M.DomUtil.hasClass(e.target,"leaflet-interactive")&&e.type==="touchmove"&&e.touches.length===1?(l&&M.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-touch-warning"),this._disableInteractions()):M.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-touch-warning");return}if(e.type!=="touchmove"&&e.type!=="touchstart"){M.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-touch-warning");return}e.touches.length===1?(l&&M.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-touch-warning"),this._disableInteractions()):(e.preventDefault(),this._enableInteractions(),M.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-touch-warning"))},_isScrolling:!1,_handleScroll:function(e){var s;const r=((s=this._map.options.gestureHandlingOptions)==null?void 0:s.showOverlay)!==!1;e.metaKey||e.ctrlKey?(e.preventDefault(),M.DomUtil.removeClass(this._map._container,"leaflet-gesture-handling-scroll-warning"),this._map.scrollWheelZoom.enable()):(r&&M.DomUtil.addClass(this._map._container,"leaflet-gesture-handling-scroll-warning"),this._map.scrollWheelZoom.disable(),clearTimeout(this._isScrolling),this._isScrolling=setTimeout(function(){for(var n=document.getElementsByClassName("leaflet-gesture-handling-scroll-warning"),l=0;l<n.length;l++){const t=n[l];t instanceof HTMLElement&&M.DomUtil.removeClass(t,"leaflet-gesture-handling-scroll-warning")}},this._map.options.gestureHandlingOptions.duration))},_handleMouseOver:function(){this._enableInteractions()},_handleMouseOut:function(){G||this._disableInteractions()}});function te(e){const r="20",s="20";e.Browser.svg&&e.SVG.include({_updateStyle:function(n){var l=n._path,t=n.options;l&&(t.stroke?(l.setAttribute("stroke",t.color),l.setAttribute("stroke-opacity",t.opacity),l.setAttribute("stroke-width",t.weight),l.setAttribute("stroke-linecap",t.lineCap),l.setAttribute("stroke-linejoin",t.lineJoin),t.dashArray?l.setAttribute("stroke-dasharray",t.dashArray):l.removeAttribute("stroke-dasharray"),t.dashOffset?l.setAttribute("stroke-dashoffset",t.dashOffset):l.removeAttribute("stroke-dashoffset")):l.setAttribute("stroke","none"),t.fill?(typeof t.fill=="string"&&t.fill.match(/^url\(/)?this.__fillPattern(n):l.setAttribute("fill",t.fillColor||t.color),l.setAttribute("fill-opacity",t.fillOpacity),l.setAttribute("fill-rule",t.fillRule||"evenodd")):l.setAttribute("fill","none"))},__fillPattern:function(n){var l=n._path,t=n.options;this._defs||(this._defs=e.SVG.create("defs"),this._container.appendChild(this._defs));var i=t.fill.substring(4,t.fill.length-1),a=i+(Math.random()*Math.pow(10,17)+Math.random()*Math.pow(10,17));a+=new Date().getUTCMilliseconds();var o=document.getElementById(a);if(!o){var h=new Image;h.src=i,o=e.SVG.create("pattern"),o.setAttribute("id",a),o.setAttribute("x","0"),o.setAttribute("y","0"),o.setAttribute("patternUnits","userSpaceOnUse"),o.setAttribute("width","24"),o.setAttribute("height","24");var d=e.SVG.create("rect");d.setAttribute("width","24"),d.setAttribute("height","24"),d.setAttribute("x","0"),d.setAttribute("x","0"),d.setAttribute("fill",t.fillColor||t.color),o.appendChild(d),this._defs.appendChild(o);var u=e.SVG.create("image");u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttributeNS("http://www.w3.org/1999/xlink","href",i),u.setAttribute("width","24"),u.setAttribute("height","24"),o.appendChild(u),h.onload=function(){o.setAttribute("width",r),o.setAttribute("height",s),u.setAttribute("width",r),u.setAttribute("height",s)}}l.setAttribute("fill","url(#"+a+")")}})}const ee=()=>{let e;return async()=>
2{if(!e){const s=await Y(()=>import("./leaflet.TileLayer.NoGap-CLWz07vm.js").then(l=>l.z),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),n=await Y(()=>import("./leaflet.TileLayer.NoGap-CLWz07vm.js").then(l=>l.C),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));return s.default(U),n.default(U),te(U),U.Map.addInitHook("addHandler","gestureHandling",Yt),e=U,U}return e}},ie=e=>e?e.reduce((r,{colour:s,lines:n})=>n?[...r,new M.Polyline(n,{color:s||"white",weight:3,opacity:1,smoothFactor:.5})]:r,[]):[];var re=Object.create,ot=Object.defineProperty,ae=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertyNames,ne=Object.getPrototypeOf,oe=Object.prototype.hasOwnProperty,le=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),he=(e,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of se(r))!oe.call(e,l)&&l!==s&&ot(e,l,{get:()=>r[l],enumerable:!(n=ae(r,l))||n.enumerable});return e},ue=(e,r,s)=>(s=e!=null?re(ne(e)):{},he(!e||!e.__esModule?ot(s,"default",{value:e,enumerable:!0}):s,e)),de=le((e,r)=>{r.exports=window.L}),lt={none:["#00000000","#00000000"],diverging_blue_red:["#2166acff","#92c5deff","#f7f7f7ff","#f4a582ff","#b2182bff"],rainbow:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow_zero:["#ff000000","#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow_wrap:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff","#ff0000ff"],rainbow_backwards:["#0000ffff","#00ffffff","#00ff00ff","#ffff00ff","#ff0000ff","#ff00ffff"],rainbow_backwards_zero:["#0000ff00","#0000ffff","#00ffffff","#00ff00ff","#ffff00ff","#ff0000ff","#ff00ffff"],bluebird:["#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bluebird_zero:["#0000ff00","#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],black_white:["#000000ff","#ffffffff"],white_black:["#ffffffff","#000000ff"],reddish:["#ff00ffff","#ff0000ff","#ffff00ff"],greenish:["#ffff00ff","#00ff00ff","#00ffffff"],blueish:["#ff00ffff","#0000ffff","#00ffffff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"],black:["#000000ff","#000000ff"],white:["#ffffffff","#ffffffff"],transparent:["#ffffff00"],peach_red_zero:["#fdd49f00","#fdd49fff","#d7301fff"]},W={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"none",isolineText:!0,isolineTextSizeEm:1.1,isolineTextBackground:!1,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"none",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"diverging_blue_red",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none",gl:{animationIntensity:5,animationSpeed:1,noiseTexturePow:5,vectorFieldFactor:1,wavesCount:4}},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,isolineTextSizeEm:1.1,isolineTextBackground:!1,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"}},ht={comment1:["'degC': ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["'hPa': ['Pa', 1000]' -> hPa = Pa * 1000 + 0 (0 - could be ommited)",0],K:["K",1],kelvin:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"Kg m^-2 s^-1":["kg/m^2/s",1],"Kg m^{-2} s^-1":["kg/m^2/s",1],"mm/h":["kg/m^2/s",.00027777777],"mm/hr":["kg/m^2/s",.00027777777],"W/m^2":["W/m^2",1],"W m^-2":["W/m^2",1],"W m^{-2}":["W/m^2",1],"W/m**2":["W/m^2",1],"W m**-2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],"m s^-1":["m/s",1],"m.s^{-1}":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],"km h^-1":["m/s",.27777777777],"km h**-1":["m/s",.27777777777],mph:["m/s",.44704],"miles/h":["m/s",.44704],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],km:["m",1e3],mile:["m",1609.344],miles:["m",1609.344],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100],degree:["degree",1],radian:["degree",57.3],"mg/m^3":["mg/m^3",1],"mg m^-3":["mg/m^3",1],"mg.m^-3":["mg/m^3",1],"%":["%",1],"(0 - 1)":["%",100]},E={_units:ht,_colorSchemes:lt,_colorStylesUnrolled:W};function fe({colorStyles:e={},units:r={},colorSchemes:s={}}={}){E._units=Object.assign({},ht,r),E._colorSchemes=Object.assign({},s,lt);let n=Object.assign({},e,W);E._colorStylesUnrolled=_e(n),(async()=>{try{await document.fonts.load("32px barbs"),await document.fonts.load("32px arrows")}catch(l){}})()}function ut(){return E._colorStylesUnrolled}function ce(){return E._colorSchemes}function F(e,r,s){let n=_=>_;if(n.trivial=!0,e===r)return n;let l=Object.assign({},E._units,s),t=l[e],i=l[r];if(!t||!i)return n;let[a,o,h]=t,[d,u,c]=i;
2if(a!==d||!o||!u)return n;let f=o/u,m=((h||0)-(c||0))/u;return m?_=>f*_+m:_=>f*_}function _e(e){let r=Object.assign({},W);for(let t in e){let i=e[t];if(Array.isArray(i))for(let a=0;a<i.length;++a)r["".concat(t,"[").concat(a,"]")]=Object.assign({},i[a]);else r[t]=Object.assign({},i)}let s=Object.assign({},W.base),n=(t,i)=>{if(i==="base")return s;let a=t[i];if(!a)return s;(!a.parent||!(a.parent in t))&&(a.parent="base");let o=n(t,a.parent);return Object.assign(a,Object.assign({},o,a,{parent:"base"}))},l={base:s};for(let t in r)l[t]=n(r,t);return l}function dt(e){let r=new Map,s=(n,...l)=>{let t=r.get(n);if(t)return t;let i=e(n,...l);return r.set(n,i),i.catch(a=>a.name==="AbortError"&&r.delete(n)),i};return s.clearCache=()=>r.clear(),s}async function me(e,r){let s=await fetch(e,r);if(s.status!==200&&s.status!==304)throw{name:"Tile loading failed",reason:s.headers.get("x-reason"),status:s.status};return await createImageBitmap(await s.blob(),{premultiplyAlpha:"none"})}var pe=class{constructor(e,r,s,n){this.raw=e,this.dmin=r,this.dmax=s,this.dmul=n,this.radius=0}get integral(){return this.integral_||(this.integral_=Le(this.raw)),this.integral_}};function Z(e,r,s=!0){let n=Object.assign(document.createElement("canvas"),{width:e,height:r,imageSmoothingEnabled:!1}).getContext("2d",{willReadFrequently:s});if(!n)throw new Error("Cannot get canvas context");return n}function ge(e){let{width:r,height:s}=e,n=Z(r,s);return n.drawImage(e,0,0),n.getImageData(0,0,r,s)}async function ft(e,r){return ge(await me(e,r))}function ve(e){e.data[34]<1&&w("Warning: image is in too old format. Check the version of the Splitter.");let r=new Uint16Array(e.data.buffer),s=new Uint16Array(r.length/2);for(let o=0;o<s.length;o++)s[o]=r[o*2];let n=new Uint8Array(8);for(let o=0;o<8;++o)n[o]=e.data[o*4+2];let l=new DataView(n.buffer),t=l.getFloat32(0,!0),i=l.getFloat32(4,!0),a=(i-t)/65535;return new pe(s,t,i,a)}async function ye(e,r){return ve(await ft(e,r))}function Le(e){let r=new Uint32Array(66564),s=new Uint32Array(258*258);r[0]=e[0],s[0]=e[0]?1:0;for(let n=1;n<258;++n){r[n]=e[n]+r[n-1],s[n]=(e[n]?1:0)+s[n-1];let l=258*n;r[l]=e[l]+r[l-258],s[l]=(e[l]?1:0)+s[l-258]}for(let n=1;n<258;++n)for(let l=1;l<258;++l){let t=258*n+l;r[t]=e[t]+r[t-258]+r[t-1]-r[t-259],s[t]=(e[t]?1:0)+s[t-258]+s[t-1]-s[t-259]}return{integral:r,integralNZ:s[66563]===66564?null:s}}function we(e){let{integral:r}=e.integral;e.raw[0]=r[0];for(let s=1;s<258;s++){e.raw[s]=r[s]-r[s-1],e.raw[258*s]=r[258*s]-r[258*(s-1)];for(let n=1;n<258;n++){let l=258*s+n;e.raw[l]=r[l-259]+r[l]-r[l-258]-r[l-1]}}return e}function Ce(e,r){let s=r<0?0:r;if(s===e.radius)return e;if(e.radius=s,!s)return we(e);let{integral:n,integralNZ:l}=e.integral;for(let t=2;t<256;t++)for(let i=2;i<256;i++){let a=258*t+i;if(!e.raw[a])continue;let o=Math.min(s,i-1,256-i),h=Math.min(s,t-1,256-t),d=258*(t-h-1)+i,u=258*(t+h)+i,c;if(l){let v=l[d-o-1],y=l[d+o],x=l[u-o-1],C=l[u+o];c=v+C-y-x}else c=(2*o+1)*(2*h+1);let f=n[d-o-1],m=n[d+o],_=n[u-o-1],g=n[u+o],p=f+g-m-_;e.raw[a]=p/c}for(let t=2;t<256;t++){let i=258+t;if(e.raw[i]){let d=t,u=Math.min(s,d-1,256-d),c=258+d,f;if(l){let y=l[c-u-1];f=0+l[c+u]-0-y}else f=(2*u+1)*2;let m=0,_=0,g=n[c-u-1],p=n[c+u],v=(m+p-_-g)/f;e.raw[i-258]=v,e.raw[i]=v}let a=258*256+t;if(e.raw[a]){let d=t,u=Math.min(s,d-1,256-d),c=258*255+d,f=258*257+d,m=n[c-u-1],_=n[c+u],g=n[f-u-1],p=n[f+u],v=m+p-_-g,y;if(l){let C=l[c-u-1],b=l[c+u],S=l[f-u-1],T=l[f+u];y=C+T-b-S}else y=(2*u+1)*2;let x=v/y;e.raw[a]=x,e.raw[a+258]=x}let o=258*t+1;if(e.raw[o]){let d=t,u=Math.min(s,d-1,256-d),c=258*(d-u-1)+1,f=258*(d+u)+1,m;if(l){let x=l[c];m=0+l[f]-x-0}else m=(2*u+1)*2;let _=0,g=n[c],p=0,v=n[f],y=(_+v-g-p)/m;e.raw[o-1]=y,e.raw[o]=y}let h=258*t+256;if(e.raw[h]){let d=t,u=Math.min(s,d-1,256-d),c=258*(d-u-1)+256,f=258*(d+u)+256,m;if(l){let x=l[c-1],C=l[c+1],b=l[f-1],S=l[f+1];m=x+S-C-b}else m=2*(2*u+1);let _=n[c-1],g=n[c+1],p=n[f-1],v=n[f+1],y=(_+v-g-p)/m;e.raw[h]=y,e.raw[h+1]=y}}return e}function A(e){let r=e>>0&255,s=e>>8&255,n=e>>16&255,l=r.toString(16),t=s.toString(16),i=n.toString(16);return l=l.length===2?l:"0".concat(l),t=t.length===2?t:"0".concat(t),i=i.length===2?i:"0".concat(i),"#".concat(l).concat(t).concat(i)}function O(e){if(e[0]==="#"){if(e.length===4)return+"0xff".concat(e[3]).concat(e[3]).concat(e[2]).concat(e[2]).concat(e[1]).concat(e[1]);if(e.length===7)return+"0xff".concat(e[5]).concat(e[6]).concat(e[3]).concat(e[4]).concat(e[1]).concat(e[2]);if(e.length===9)return+"0x".concat(e[7]).concat(e[8]).concat(e[5]).concat(e[6]).concat(e[3]).concat(e[4]).concat(e[1]).concat(e[2])}return 0}async function B(e,r){let s=await fetch(e,r);if(!s.ok)throw new Error("error:".concat(e," - ").concat(s.statusText));return s.json()}function et(e,r,s){let n=e>>0&255,l=e>>8&255,t=e>>16&255,i=e>>>24,a=r>>0&255,o=r>>8&255,h=r>>16&255,d=r>>>24,u=n+s*(a-n),c=l+s*(o-l),f=t+s*(h-t),m=i+s*(d-i);return u|c<<8|f<<16|m<<24}function xe(e,r,s){let n=[];for(let l=0;l<s;++l)n.push(l*(r-e)/(s-1)+e);return n}var w=(...e)=>{};function ct(e){return e[0]==="#"&&e.length===4?"#".concat(e[1]).concat(e[1]).concat(e[2]).concat(e[2]).concat(e[3]).concat(e[3]):e}function _t(e,{x:r,y:s,z:n}){return e.replace("{x}","".concat(r)).replace("{y}","".concat(s)).replace("{z}","".concat(n))}function z({x:e,y:r,z:s}){return"".concat(s,"-").concat(e,"-").concat(r)}var Me=class{constructor(e){this.wxAPI=e,this.allDatasetsShortMetas={},this.ready=this.updateAll()}updateAll(){return this.ready=B("".concat(this.wxAPI.dataServerURL,"meta.json"),this.wxAPI.requestInit),this.ready.then(e=>{this.allDatasetsShortMetas=e}),this.ready}async updateOne(e){try{let r="".concat(this.wxAPI.dataServerURL+e,"/meta.json"),s=await B(r,this.wxAPI.requestInit);return Object.assign(this.allDatasetsShortMetas,s)}catch(r){return this.updateAll()}}},be=65,Se=class{constructor(e,r){this._qtree={},this._qtreedepth=0,this._ready=this._load(e,r)}get ready(){return this._ready}async _load(e,r){if(e!=="none"){try{let s=await B(e,r);this._qtree=mt(s,{pos:0})}catch(s){let n=s instanceof Error?s.message:String(s);throw new Error("Failed to load QTree: ".concat(n))}this._qtreedepth=pt(this._qtree),w("QTree.load: qtreedepth=".concat(this._qtreedepth))}}check(e){let r=e.z-this._qtreedepth,s=r>=0,n=s?{x:e.x>>r,y:e.y>>r,z:this._qtreedepth}:{...e};
2return ke(this._qtree,n,s)}};function mt(e,r){let s=e.charCodeAt(r.pos)-be;r.pos++;let n=[1,2,4,8].map(l=>s&l?mt(e,r):void 0);return n.some(l=>l)?{nodes:n}:{}}function pt(e){return e!=null&&e.nodes?1+Math.max(...e.nodes.map(pt)):0}function ke(e,r,s){let n=e;for(;n;){if(s&&r.z===0)return"mixed";if(!n.nodes)return"sea";if(r.z===0)return"mixed";r.z--,n=n.nodes[(r.y>>r.z&1)<<1|r.x>>r.z&1]}return"land"}var Te=class{constructor({dataServerURL:e,ext:r="webp",maskURL:s="none",maskChannel:n="R",maskDepth:l=11,qtreeURL:t="none",requestInit:i,colorStyles:a,units:o,colorSchemes:h}){if(fe({colorStyles:a,units:o,colorSchemes:h}),t==="auto"&&(t="".concat(e,"masks/11+1.seamask.qtree")),s==="auto"&&(s="".concat(e,"masks/{z}/{x}/{y}.").concat(r)),this.dataServerURL=e,this.ext=r,this.requestInit=i,this.maskURL=s,this.maskChannel=n==="R"?0:n==="G"?1:n==="B"?2:n==="A"?3:0,this.maskDepth=l,this.maskURL!=="none"){let d=dt(ft);this.loadMaskFunc=u=>d(_t(this.maskURL,u),i)}else this.loadMaskFunc=()=>Promise.reject(new Error("maskURL not defined"));this._allDatasetsManager=new Me(this),this.qtree=new Se(t,i),this.initDone=Promise.all([this._allDatasetsManager.ready,this.qtree.ready]).then(()=>w("WxAPI.constructor initDone"))}async createDatasetManagerOptions(e){await this.initDone,await this._allDatasetsManager.updateOne(e);let r=this._allDatasetsManager.allDatasetsShortMetas[e],s=r==null?void 0:r.instance;if(!s)throw new Error("Dataset/instance not found:".concat(e));let n=r.instanced,l,t="".concat(this.dataServerURL+e,"/");try{l=await B("".concat(t,"metafull.json"),this.requestInit)}catch(o){let h=await B("".concat(t,"instances.json"),this.requestInit);if(!Array.isArray(h)||!h.length)throw new Error("instances.json is not an array or empty");l=await Promise.all(h.reverse().map(async d=>Object.assign(await B("".concat(t+d,"/meta.json"),this.requestInit),{instance:d})))}let i=l[0],a=n&&new Map(l.map(o=>[o.instance,o]));return{datasetName:e,datasetCurrentInstance:s,datasetCurrentMeta:i,instanced:n,metas:a,wxAPI:this}}async getDatasetAllVariables(e){var r;return await this.initDone,(r=this._allDatasetsManager.allDatasetsShortMetas[e])==null?void 0:r.variables}async filterDatasetsByVariableName(e){await this.initDone;let{allDatasetsShortMetas:r}=this._allDatasetsManager;return Object.keys(r).filter(s=>{var n;return(n=r[s])==null?void 0:n.variables.includes(e)})}async getAllDatasetsNames(){return await this.initDone,Object.keys(this._allDatasetsManager.allDatasetsShortMetas)}};function Ie(e){return class extends e{constructor(){super(...arguments),this._animation=!1,this._animationSeed=0,this._needUpdateDSManager=!1}get wxdatasetManager(){return w("WxLayerBaseImplementation.wxdatasetManager (".concat(this.id,")")),this._layer.wxdatasetManager}getCurrentVariableMeta(){return w("WxLayerBaseImplementation.getCurrentVariableMeta (".concat(this.id,")")),{...this._layer.currentVariableMeta}}getDatasetMeta(){return this._layer.wxdatasetManager.getInstanceMeta(this.getTime())}getMetadata(){return w("WxLayerBaseImplementation.getMetadata (".concat(this.id,")")),{...this._layer.currentVariableMeta}}getVariablesNames(){return w("WxLayerBaseImplementation.getVariables (".concat(this.id,")")),[...this._layer.variables]}clearCache(){w("WxLayerBaseImplementation.clearCache (".concat(this.id,")")),this._layer.clearCache()}getCache(){return this._layer.tilesRasterCache}getCurrentStyleObjectCopy(){return w("WxLayerBaseImplementation.getCurrentStyleObjectCopy (".concat(this.id,")")),this._layer.getCurrentStyleObjectCopy()}getTime(){return w("WxLayerBaseImplementation.getTime (".concat(this.id,")")),this._layer.getTime()}getAllTimes(){return w("WxLayerBaseImplementation.getTimes (".concat(this.id,")")),this._layer.wxdatasetManager.getAllTimes()}async setTime(r,s,n){var t;w("WxLayerBaseImplementation.setTime (".concat(this.id,") time=").concat(r));let l=this.getTime();return this._layer.setURLsAndTime(r),await this._reloadVisible(s,n),(t=s==null?void 0:s.signal)!=null&&t.aborted&&this._layer.setURLsAndTime(l),this.getTime()}async preloadTime(r,s){return w("WxLayerBaseImplementation.preloadTime (".concat(this.id,") time=").concat(r)),this._layer.preloadTime(r,this.coveringTiles(),s)}startAnimation(){if(this._animation){w("WxLayerBaseImplementation.startAnimation (".concat(this.id,") already started"));return}if(this._layer.nonanimatable){w("WxLayerBaseImplementation.startAnimation (".concat(this.id,") nonanimatable"));return}w("WxLayerBaseImplementation.startAnimation (".concat(this.id,")")),this._animation=!0;let r=async s=>{if(w("WxLayerBaseImplementation.startAnimation (".concat(this.id,") animationStep")),!this._animation||this._layer.nonanimatable){this._animation=!1;return}this._animationSeed=s,await this._redrawTiles(),requestAnimationFrame(r)};requestAnimationFrame(r)}async stopAnimation(){return w("WxLayerBaseImplementation.stopAnimation (".concat(this.id,")")),this._animation=!1,this._redrawTiles()}async setCoarseLevel(r=2){this._layer.coarseLevel=Math.max(0,Math.min(r,this.wxdatasetManager.getMaxZoom()))}async unsetCoarseLevel(){return this._layer.coarseLevel=0,this._reloadVisible()}async setStyleByName(r,s=!0){return w("WxLayerBaseImplementation.setStyleByName (".concat(this.id,") wxstyleName=").concat(r," reload=").concat(s)),this.updateCurrentStyleObject(ut()[r],s)}
2async updateCurrentStyleObject(r,s=!0,n){if(w("WxLayerBaseImplementation.updateCurrentStyleObject (".concat(this.id,") style=").concat(r," reload=").concat(s)),this._layer.updateCurrentStyleObject(r),this.startAnimation(),s)return this._reloadVisible(n)}_redrawTiles(){return this._redrawRequested?this._redrawRequested:(this._redrawRequested=new Promise(r=>{requestAnimationFrame(()=>{w("WxTileSource _redrawTiles (".concat(this.id,")")),this.update(),r(),this._redrawRequested=void 0})}),this._redrawRequested)}async _reloadVisible(r,s){}coveringTiles(){return[]}update(){}async _loadTileHelper(r,s){if(!this._needUpdateDSManager)try{return await this._layer.loadTile(r,s)}catch(n){if(n.name==="AbortError")throw n;n.reason==="instance-not-found"&&!this._needUpdateDSManager&&(this._needUpdateDSManager=!0,w("WxTileSource.loadTile (".concat(this.id,") instance-not-found. Trying to update wxdatasetManager and load again.")),this.wxdatasetManager.update().then(()=>{this._needUpdateDSManager=!1,this.setTime(this.getTime()).then(()=>this.fire("changed",this))}).catch(l=>{w("WxTileSource.loadTile (".concat(this.id,") instance-not-found. wxdatasetManager update failed."),l)}))}return null}}}function Ae(e,r,s){return e>s?s:e<r?r:e}var Pe=class{constructor(e,r,[s,n],l){var m;this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let t;this.DataToStyle=F(r,e.units,e.extraUnits),this.DataToStyle.trivial&&(e.units=r),l&&(this.DataToKnots=F(r,"knot"));let i=F(e.units,r,e.extraUnits),a=_=>~~(65535*Ae((i(_)-s)/(n-s),0,1));if((m=e.colorMap)!=null&&m.length)t=e.colorMap.sort((_,g)=>_[0]-g[0]).map(([_])=>a(_));else{e.levels||(e.levels=xe(this.DataToStyle(s),this.DataToStyle(n),10)),e.levels.sort((g,p)=>g-p);let _=ce();e.colors||(e.colors=_[e.colorScheme]||["#ffffffff","#000000ff"]),t=e.levels.map(a)}let o=n-s,h=Oe(65536,e);this.ticks=h.ticks;let d=h.ticks[0].data,u=h.ticks[h.ticks.length-1].data-d,c=e.showBelowMin?h.colors[0]:0,f=e.showAboveMax?h.colors[65535]:0;this.colorsI[0]=0;for(let _=1;_<65536;++_){let g=this.DataToStyle(o*_/65535+s),p=Math.round(65535*(g-d)/u);this.colorsI[_]=p<=0?c:p>65535?f:h.colors[p]}for(let _=0;_<t[0];++_)this.levelIndex[_]=0;for(let _=0;_<t.length-1;_++)for(let g=t[_];g<t[_+1]+1;++g)this.levelIndex[g]=_;for(let _=t[t.length-1];_<65536;++_)this.levelIndex[_]=t.length-1}};function it(e){var s;if(e!==0&&-.1<e&&e<.1)return e.toExponential(2);let r=e.toString();return((s=r.split(".")[1])==null?void 0:s.length)>2?e.toFixed(2):r}function Oe(e,r){let s={size:e,showBelowMin:r.showBelowMin,showAboveMax:r.showAboveMax,units:r.units,colors:new Uint32Array(e),ticks:[]},{colorMap:n,levels:l,colors:t}=r,i=r.fill!=="solid";if(n){let c=n[0][0],f=(e-1)/(n[n.length-1][0]-c);s.ticks=n.map(([m,_])=>({data:m,dataString:it(m),color:_,pos:~~((m-c)*f)}));for(let m=0;m<n.length-1;m++){let _=s.ticks[m].pos,g=s.ticks[m+1].pos,p=O(n[m][1]),v=i?O(n[m+1][1]):0;for(let y=_;y<g;++y)s.colors[y]=i?et(p,v,(y-_)/(g-_)):p}return s.colors[e-1]=O(n[n.length-1][1]),s}if(!t||!l)return s;let a=0,o=0,h=-1;for(let c=0;c<e;++c){let f=c*(t.length-1)/e;h!==~~f&&(h=~~f,a=O(t[h]),o=t.length>h+1?O(t[h+1]):a),s.colors[c]=i?et(a,o,f-h):a}s.colors[e-1]=O(t[t.length-1]);let d=l[0],u=(e-1)/(l[l.length-1]-d);return s.ticks=l.map(c=>{let f=~~((c-d)*u);return{data:c,dataString:it(c),pos:f,color:A(s.colors[f])}}),s}var rt=class extends Map{clear(){for(let e of this.values()){if(!e.rd)return;e.rd.gl.deleteTexture(e.rd.vectorTextureU),e.rd.gl.deleteTexture(e.rd.vectorTextureV)}super.clear()}},De=2*Math.PI*6378137/256,R=2*Math.PI*6378137/2;function Ue(e,r){let s=e/R*180,n=r/R*180;return n=180/Math.PI*(2*Math.atan(Math.exp(n*Math.PI/180))-Math.PI/2),[n,s]}function Ee(e,r,s){let n=Be(s),l=e*n-R,t=r*n-R;return[l,t]}function Be(e){return De/2**e}
2function at(e,r,s){let[n,l]=Ue(...Ee(e,r,s));return[l,-n]}function $e(e,r){return[e*256,r*256]}function H(e,r,s){let n=((r-e)%360+540)%360-180;return(e+n*s+360)%360}function Ne(e,r,s,n,l,t,i,a){let o=e,h=r,d=s,u=n;switch((o?1:0)|(h?2:0)|(d?4:0)|(u?8:0)){case 0:return 0;case 1:return o;case 2:return h;case 3:d=o,u=h;break;case 4:return d;case 5:h=o,u=d;break;case 6:u=h+d>>1,o=u;break;case 7:u=h+d>>1;break;case 8:return u;case 9:h=o+u>>1,d=h;break;case 10:o=h,d=u;break;case 11:d=o+u>>1;break;case 12:o=d,h=u;break;case 13:h=o+u>>1;break;case 14:o=h+d>>1;break}o=i+a*o,h=i+a*h,d=i+a*d,u=i+a*u;let c=H(o,h,l),f=H(d,u,l),m=(H(c,f,t)-i)/a;return m<1?1:m}function gt(e,r,s,n,l,t,i,a){switch((e?1:0)|(r?2:0)|(s?4:0)|(n?8:0)){case 7:return l+t<1?l*(r-e)+t*(s-e)+e:0;case 14:return l+t<1?0:l*(n-s)+t*(n-r)+r+s-n;case 11:return t<l?(1-l)*(e-r)+t*(n-r)+r:0;case 13:return t<l?0:(1-l)*(s-n)+t*(s-e)+e+n-s;case 15:return l+t<1?l*(r-e)+t*(s-e)+e:l*(n-s)+t*(n-r)+r+s-n;default:return 0}}function vt(e,r,s){let n=1/2**s.z,l=s.x*256*n-.5,t=s.y*256*n-.5,{raw:i,dmin:a,dmax:o,dmul:h}=r,d={raw:new Uint16Array(258*258),dmin:a,dmax:o,dmul:h},{raw:u}=d;for(let c=-1,f=0,m=t-n+1;c<=256;c++,m+=n){let _=Math.floor(m),g=m-_,p=_*258;for(let v=-1,y=l-n+1;v<=256;v++,f++,y+=n){let x=Math.floor(y),C=y-x,b=x+p,S=i[b],T=i[b+1],k=i[b+258],$=i[b+258+1];u[f]=e(S,T,k,$,C,g,a,h)}}return d}function We(e,r,s){if(!r)return e;let n=d=>d<0?0:d>254?254:d,l=1/2**r.z,t=r.x*256*l-.5,i=r.y*256*l-.5,{data:a}=e,o=new ImageData(256,256),{data:h}=o;for(let d=0,u=s,c=i;d<256;d++,c+=l){let f=~~n(c),m=c-f,_=f*256;for(let g=0,p=t;g<256;g++,u+=4,p+=l){let v=~~n(p),y=p-v,x=(v+_)*4+s,C=a[x],b=a[x+4],S=a[x+4*256],T=a[x+4*256+4],k=gt(C,b,S,T,y,m);h[u]=k>127?255:0}}return o}function Ze(e,r){return r?vt(gt,e,r):e}function Re(e,r){return r?vt(Ne,e,r):e}function je(e,{data:r},s,n){let l=n==="sea",{raw:t}=e;for(let i=s,a=259,o=0;o<256;a+=2,o++)for(let h=0;h<256;h++,a++,i+=4)l===!r[i]&&(t[a]=0);return e}function Ve(e){let[r,s]=$e(e.x,e.y),[n,l]=at(r,s,e.z),[t,i]=at(r+256,s+256,e.z);return{west:n,north:l,east:t,south:i}}function st(e,r){let s=e.z-r;if(s<=0)return{upCoords:e};let n={x:e.x>>>s,y:e.y>>>s,z:r},l={x:e.x&(1<<s)-1,y:e.y&(1<<s)-1,z:s};return{upCoords:n,subCoords:l}}var Ge=class{constructor(e){this._loadDataFunc=dt(ye),this._layer=e}async load(e,r){let s=await this.cacheLoad(e,this._layer.tilesURIs,r);if(!s)return null;let{rawdata:n,subCoords:l,tileType:t}=s,{units:i}=this._layer.currentVariableMeta,a=i==="degree"?Re:Ze,o=d=>a(Ce(d,this._layer.style.blurRadius),l),h=n.map(o);return this._vectorMagnitudesPrepare(h),await this._applyMask(h,e,t,!l&&n.length===1),{data:h,slines:this._createStreamLines(h)}}async cacheLoad(e,r,s){if(!this._checkInsideBoundaries(e))return null;let n=this._checkTypeAndMask(e);if(!n)return null;let{upCoords:l,subCoords:t}=st(e,this._layer.getCoarseMaxZoom()),i=r.map(o=>_t(o,l)),a=Object.assign({},this._layer.wxdatasetManager.wxAPI.requestInit,{signal:s==null?void 0:s.signal});return{rawdata:await Promise.all(i.map(o=>this._loadDataFunc(o,a))),subCoords:t,tileType:n}}clearCache(){this._loadDataFunc.clearCache()}async _applyMask(e,r,s,n){let{style:l}=this._layer;if((l.mask==="land"||l.mask==="sea")&&s==="mixed"){if(n){let{raw:a,dmin:o,dmax:h,dmul:d}=e[0];e[0]={raw:new Uint16Array(a),dmin:o,dmax:h,dmul:d}}let t,{wxAPI:i}=this._layer.wxdatasetManager;try{let{upCoords:a,subCoords:o}=st(r,i.maskDepth);t=await i.loadMaskFunc(a),t=We(t,o,i.maskChannel)}catch(a){l.mask=void 0;return}je(e[0],t,i.maskChannel,l.mask)}}_vectorMagnitudesPrepare(e){if(e.length===1)return;e.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[r,s,n]=e;r.dmax=1.42*Math.max(-s.dmin,s.dmax,-n.dmin,n.dmax),r.dmul=(r.dmax-r.dmin)/65535;for(let l=0;l<258*258;++l){if(!s.raw[l]||!n.raw[l])continue;let t=s.dmin+s.dmul*s.raw[l],i=n.dmin+n.dmul*n.raw[l];r.raw[l]=Math.sqrt(i*i+t*t)/r.dmul}}_checkTypeAndMask(e){let{mask:r}=this._layer.style;if(r==="land"||r==="sea"){let s=this._layer.wxdatasetManager.wxAPI.qtree.check(e);return r===s?void 0:s}return"mixed"}_checkInsideBoundaries(e){let r=this._layer.getBoundaries();if(r!=null&&r.boundaries180){let s=Ve(e),n=l=>!(s.west>l.east||l.west>s.east||s.south>l.north||l.south>s.north);if(!r.boundaries180.some(n))return!1}return!0}_createStreamLines(e){if(e.length!==3)return[];let{style:r}=this._layer;if(r.streamLineColor==="none")return[];let s=[],[n,l,t]=e,i=(r.streamLineSpeedFactor||1)/n.dmax,a=r.addDegrees?.017453292519943*r.addDegrees:0,o=r.streamLineGridStep||64,h=r.streamLineSteps||300;for(let d=0;d<=256;d+=o)for(let u=0;u<=256;
2u+=o){if(!n.raw[1+u+(1+d)*258])continue;let c=[],f=u,m=d,_=-1,g=0,p=0;for(let x=0;x<=h&&f>=0&&f<=256&&m>=0&&m<=256;x++){x%(h/10)||c.push({x:~~f,y:~~m});let C=~~f+1+(~~m+1)*258;if(C!==_){if(!n.raw[C])break;_=C;let b=n.dmin+n.raw[C]*n.dmul,S=l.dmin+l.raw[C]*l.dmul,T=t.dmin+t.raw[C]*t.dmul,k=Math.atan2(S,T)+a;g=i*b*Math.sin(k),p=i*b*Math.cos(k)}f+=g,m-=p}let v=u,y=d;_=-1;for(let x=1;x<=h&&v>=0&&v<=256&&y>=0&&y<=256;x++){x%(h/10)||c.unshift({x:~~v,y:~~y});let C=~~v+1+(~~y+1)*258;if(C!==_){if(!n.raw[C])break;_=C;let b=n.dmin+n.raw[C]*n.dmul,S=l.dmin+l.raw[C]*l.dmul,T=t.dmin+t.raw[C]*t.dmul,k=Math.atan2(S,T)+a;g=i*b*Math.sin(k),p=i*b*Math.cos(k)}v-=g,y+=p}c.length>2&&s.push(c)}return s}},Fe=class{constructor(e){this._layer=e}paint({data:e,ctxFill:r,ctxText:s,ctxStreamLines:n}){let{_layer:l}=this,{units:t}=l.currentVariableMeta,i=new ImageData(256,256),a=new Uint32Array(i.data.buffer);r.clearRect(0,0,256,256),s.clearRect(0,0,256,256),n.clearRect(0,0,256,256),ze(e.data[0],a,l);let o=He(a,e.data[0],l);r.putImageData(i,0,0),qe(o,s,l),Qe(e.data,s,l),Je(e.data[0],s,t,l),Ye(e,s,l)}getPaintedCanvas(e,r,s){return r?(this.imprintVectorAnimationLinesStep(e,s),e.ctxStreamLines.canvas):e.ctxFill.canvas}imprintVectorAnimationLinesStep({data:e,ctxFill:r,ctxStreamLines:s},n){let{_layer:l}=this;s.clearRect(0,0,256,256),s.drawImage(r.canvas,0,0),!(e.slines.length===0||l.style.streamLineStatic||l.style.streamLineColor==="none")&&ti(e,s,l,n)}};function ze(e,r,{CLUT:s,style:n}){let{raw:l}=e,{colorsI:t}=s;if(n.fill!=="none")for(let i=0,a=0,o=259;i<256;++i,o+=2)for(let h=0;h<256;++h,++a,++o)r[a]=t[l[o]];else r.fill(0)}function He(e,r,{CLUT:s,style:n}){let{raw:l}=r,{levelIndex:t,colorsI:i}=s,a=[];if(n.isolineColor!=="none"){let o=n.isolineColor[0]==="#"?O(n.isolineColor):0;for(let h=0,d=0;h<256;h+=1)for(let u=0;u<256;u+=1){let c=(h+1)*258+(u+1),f=l[c],m=l[c+1],_=l[c+258];if(!f||!m||!_)continue;let g=t[f],p=t[m],v=t[_];if(g!==p||g!==v){let y=Math.max(g,p,v),x=Math.max(f,m,_),C=h*256+u;switch(n.isolineColor){case"inverted":e[C]=~i[x]|4278190080;break;case"fill":e[C]=i[x]|4278190080;break;default:e[C]=o;break}n.isolineText&&!(++d%255)&&u>20&&u<235&&h>20&&h<235&&a.push({x:u,y:h,d:f,dr:m,db:_,mli:y})}}}return a}function qe(e,r,{CLUT:s,style:n}){if(e.length){let l=n.isolineTextSizeEm||1.1;r.font="".concat(l.toString(),"em Sans-serif"),r.lineWidth=2,r.strokeStyle="white",r.fillStyle="black",r.textAlign="center",r.textBaseline="middle";let t=r.measureText("-.0123456789"),i=t.actualBoundingBoxAscent+t.actualBoundingBoxDescent,a=1.5*i,o=t.actualBoundingBoxAscent+(a-i)/2,h=1.1,d=l*2.5,u=n.isolineTextBackground?Ke:Xe;for(let{x:c,y:f,d:m,dr:_,db:g,mli:p}of e){let v=Math.atan2(m-_,g-m);r.save(),r.translate(c,f),r.rotate(v<-1.57||v>1.57?v+3.14:v);let y=s.ticks[p].dataString;u(y,r,{height:a,hOffset:o,wScale:h,radii:d}),r.fillText(y,0,0),r.restore()}}}function Ke(e,r,s){r.strokeText(e,0,0)}function Xe(e,r,{height:s,hOffset:n,wScale:l,radii:t}){let i=r.fillStyle;r.fillStyle=r.strokeStyle;let a=l*r.measureText(e).width;r.beginPath(),r.roundRect(-a/2,-n,a,s,t),r.closePath(),r.fill(),r.fillStyle=i}function Qe(e,r,{CLUT:s,style:n}){if(!s.DataToKnots||n.vectorColor==="none"||n.vectorType==="none")return;if(e.length!==3)throw new Error("data.length !== 3");let[l,t,i]=e;switch(n.vectorType){case"barbs":r.font="40px barbs";break;case"arrows":r.font="50px arrows";break;default:r.font=n.vectorType}r.textAlign="center",r.textBaseline="middle",r.fillStyle=n.vectorColor;let a=n.addDegrees?.017453292519943*n.addDegrees:0,o=32;for(let h=o/2;h<256;h+=o)for(let d=o/2;d<256;d+=o){let u=d+1+(h+1)*258;if(!l.raw[u])continue;let c=Math.atan2(t.dmin+t.raw[u]*t.dmul,i.dmin+i.raw[u]*i.dmul),f=l.dmin+l.raw[u]*l.dmul,m=n.vectorType!=="barbs"?n.vectorFactor*.5:.2,_=Math.min(~~(s.DataToKnots(f)*m),25)+65,g=String.fromCharCode(_);switch(n.vectorColor){case"inverted":r.fillStyle=A(~s.colorsI[l.raw[u]]);break;case"fill":r.fillStyle=A(s.colorsI[l.raw[u]]);break}r.save(),r.translate(d,h),r.rotate(c+a),r.fillText(g,0,0),r.restore()}}function Je(e,r,s,{CLUT:n,style:l}){if(s!=="degree")return;let t=.017453292519943*l.addDegrees;r.font="50px arrows",r.textAlign="center",r.textBaseline="middle",r.fillStyle=l.vectorColor;let i="L",a=32;for(let o=a/2;o<256;o+=a)for(let h=a/2;h<256;h+=a){let d=h+1+(o+1)*258;if(!e.raw[d])continue;let u=(e.dmin+e.raw[d]*e.dmul+180)*.01745329251;switch(l.vectorColor){case"inverted":r.fillStyle=A(~n.colorsI[e.raw[d]]);break;case"fill":r.fillStyle=A(n.colorsI[e.raw[d]]);break}r.save(),r.translate(h,o),r.rotate(u+t),r.fillText(i,0,0),r.restore(
2)}}function Ye(e,r,{CLUT:s,style:n}){let{data:l,slines:t}=e;if(!t.length||!n.streamLineStatic||n.streamLineColor==="none")return;let i=l[0];r.lineWidth=1,n.streamLineColor[0]==="#"&&(r.strokeStyle=ct(n.streamLineColor));for(let a=t.length;a--;){let o=t[a];for(let h=0;h<o.length-1;++h){let d=o[h],u=o[h+1],c=d.x+1+(d.y+1)*258;switch(n.streamLineColor){case"inverted":r.strokeStyle=A(~s.colorsI[i.raw[c]]);break;case"fill":r.strokeStyle=A(s.colorsI[i.raw[c]]);break}r.beginPath(),r.moveTo(d.x,d.y),r.lineTo(u.x,u.y),r.stroke()}}}function ti(e,r,{CLUT:s,style:n},l){let{data:t,slines:i}=e,a=t[0],o=n.streamLineColor[0]==="#"?ct(n.streamLineColor).substring(0,7):"#000000",h=l>>5;for(let d=0;d<i.length;++d){let u=i[d],c=u.length-1,f=(h+(1+u[0].x)*(1+u[0].y))%30;for(let m=0;m<c;++m){let _=u[m],g=u[m+1],p=1-(f-m)/c;(p<0||p>1)&&(p=0);let v=(~~(p*255)).toString(16).padStart(2,"0"),y=1+~~((1.2-p)*5);r.lineWidth=y;let x=_.x+1+(_.y+1)*258;switch(n.streamLineColor){case"inverted":o=A(~s.colorsI[a.raw[x]]);break;case"fill":o=A(s.colorsI[a.raw[x]]);break}r.strokeStyle=o+v,r.beginPath(),r.moveTo(_.x,_.y),r.lineTo(g.x,g.y),r.stroke()}}}var ei=class{constructor(e){var l;if(this.tilesRasterCache=new rt,this.coarseLevel=0,this._painter=new Fe(this),this._loader=new Ge(this),w("WxLayer.constructor:\n datasetName: ".concat(e.wxdatasetManager.datasetName,",\n variables: ").concat(e.variables.join(", "),",\n wxstyleName: ").concat(e.wxstyleName,",\n wxstyle: ").concat(JSON.stringify(e.wxstyle),",\n time: ").concat(e.time)),!((l=e.variables)!=null&&l.length)||e.variables.length>2)throw new Error("datasetName: ".concat(e.wxdatasetManager.datasetName,": only 1 or 2 variables are supported but ").concat(e.variables," was given"));for(let t of e.variables)if(!e.wxdatasetManager.isVariableValid(t))throw new Error("datasetName: ".concat(e.wxdatasetManager.datasetName,": variable ").concat(t," is not valid"));this.variables=e.variables,this.wxdatasetManager=e.wxdatasetManager,[this.tilesURIs,this._time]=this._createURLsAndTime(e.time);let r=ut(),s=r.base,n=e.wxstyleName&&r[e.wxstyleName];this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT({...s,...n,...e.wxstyle})}get nonanimatable(){return this.variables.length<2||this.style.streamLineStatic||this.style.streamLineColor==="none"}getMaxZoom(){return this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).maxZoom:this.wxdatasetManager.getMaxZoom()}getCoarseMaxZoom(){return this.getMaxZoom()-this.coarseLevel}getBoundaries(){return this.wxdatasetManager.isInstanced()?this.wxdatasetManager.getInstanceMeta(this.getTime()).boundaries:this.wxdatasetManager.getBoundaries()}getTime(){return this._time}clearCache(){this.tilesRasterCache.clear(),this._loader.clearCache()}getCurrentStyleObjectCopy(){return Object.assign({},this.style)}updateCurrentStyleObject(e){w("WxLayer.updateCurrentStyleObject ".concat(JSON.stringify(e))),[this.style,this.CLUT]=this._createStyleAndCLUT(e)}getTileData(e,r){let s=this.tilesRasterCache.get(z(e));if(!s)return;let n=this._getPixelInfo(r,s.data.data);if(!n)return;let{raw:l,data:t}=n,i=l.map(h=>this.CLUT.colorsI[h]),a=i.map(A),o=t.map(h=>this.CLUT.DataToStyle(h));return{data:t,raw:l,rgba:i,hexColor:a,inStyleUnits:o,tilePoint:r,styleUnits:this.style.units,dataUnits:this.currentVariableMeta.units}}setURLsAndTime(e){[this.tilesURIs,this._time]=this._createURLsAndTime(e),this.wxdatasetManager.isInstanced()&&(this.currentVariableMeta=this._getCurrentVariableMeta(),[this.style,this.CLUT]=this._createStyleAndCLUT())}getPaintedCanvas(e,r,s){return this._painter.getPaintedCanvas(e,r,s)}async loadTile(e,r){return this._loadCacheDrawTile(e,this.tilesRasterCache,r)}
2async preloadTime(e,r,s){let[n]=this._createURLsAndTime(e);await Promise.allSettled(r.map(l=>this._loader.cacheLoad(l,n,s)))}async reloadTiles(e,r){var n;let s=new rt;await Promise.allSettled(e.map(l=>this._loadCacheDrawTile(l,s,r))),(n=r==null?void 0:r.signal)!=null&&n.aborted?s.clear():(this.tilesRasterCache.clear(),this.tilesRasterCache=s)}async _loadCacheDrawTile(e,r,s){let n=r.get(z(e));if(n)return n;let l=await this._loader.load(e,s);if(!l)return null;let t=Z(256,256),i=t,a=this.variables.length===2?Z(256,256):t,o={ctxFill:t,ctxText:i,ctxStreamLines:a,data:l};return this._painter.paint(o),r.set(z(e),o),o}_getCurrentVariableMeta(){let e=this.variables.map(t=>{let i=this.wxdatasetManager.getInstanceVariableMeta(t,this._time);if(!i)throw new Error("datasetName ".concat(this.wxdatasetManager.datasetName,": variable ").concat(t," is not valid"));return i}),{min:r,max:s,units:n,vector:l}=e[0];return this.variables.length>1&&(r=0,s=1.42*Math.max(-e[0].min,e[0].max,-e[1].min,e[1].max)),{min:r,max:s,units:n,vector:l}}_getPixelInfo({x:e,y:r},s){var l,t;let n=(r+1)*258+(e+1);if((t=(l=s==null?void 0:s[0])==null?void 0:l.raw)!=null&&t[n])return{raw:s.map(i=>i.raw[n]),data:s.map(i=>i.raw[n]*i.dmul+i.dmin)}}_createStyleAndCLUT(e){let r=Object.assign({},this.style,e),s=this._prepareCLUT(r);return[r,s]}_prepareCLUT(e){let{min:r,max:s,units:n}=this.currentVariableMeta;return new Pe(e,n,[r,s],this.variables.length===2)}_createURLsAndTime(e){let r=this.wxdatasetManager.getNearestValidTime(e);return[this.variables.map(s=>this.wxdatasetManager.createURI(s,r)),r]}},ii=ue(de()),ri=class extends ii.default.GridLayer{constructor(e,r){super(e),this.id=e.id,this._layer=new ei(r)}},ai=Ie(ri),nt=class{constructor(e,r,s){this.coords=e,this.ctx=r,this.raster_data=s,this.draw(s==null?void 0:s.ctxFill.canvas)}draw(e){this.ctx.clearRect(0,0,256,256),e&&this.ctx.drawImage(e,0,0)}},yt=class extends ai{constructor(e,r){super(r,e)}getLayerInfoAtLatLon(e,r){if(w("WxTileSource getLayerInfoAtLatLon (".concat(this._layer.wxdatasetManager.datasetName,")"),e),!this._map)return;let s=Math.round(this._map.getZoom()),n=this._map.project(e,s),l=n.divideBy(256).floor(),t=n.subtract(l.multiplyBy(256)).floor();return this._layer.getTileData({x:l.x,y:l.y,z:s},t)}async _reloadVisible(e){var r;if(w("WxTileSource _reloadVisible (".concat(this._layer.wxdatasetManager.datasetName,")")),await this._layer.reloadTiles(this.coveringTiles(),e),(r=e==null?void 0:e.signal)==null?void 0:r.aborted){w("WxTileSource _reloadVisible (".concat(this._layer.wxdatasetManager.datasetName,") aborted"));return}return await Promise.allSettled(this._ForEachWxTile(async s=>{s.raster_data=null,s.raster_data=await this._layer.loadTile(s.coords)},"_reloadVisible")),this._redrawTiles()}coveringTiles(){var r;w("WxTileSource coveringTiles (".concat(this._layer.wxdatasetManager.datasetName,")"));let e=[];for(let s in this._tiles){let n=(r=this._tiles[s].el)==null?void 0:r.wxtile;n&&e.push(n.coords)}return e}update(){w("WxTileSource update (".concat(this._layer.wxdatasetManager.datasetName,")")),this._ForEachWxTile(e=>{e.draw(e.raster_data&&this._layer.getPaintedCanvas(e.raster_data,this._animation,this._animationSeed))},"_redrawTiles")}_ForEachWxTile(e,r){var n;w("WxTileSource _ForEachWxTile (".concat(this._layer.wxdatasetManager.datasetName,") func=").concat(r));let s=[];for(let l in this._tiles){let t=(n=this._tiles[l].el)==null?void 0:n.wxtile;t&&s.push(e(t))}return s}createTile(e,r){let s=Z(256,256),n=s.canvas;return this._loadTileHelper(e).then(l=>{n.wxtile=new nt(e,s,l)}).catch(()=>{n.wxtile=new nt(e,s,null)}).finally(r),n}onRemove(e){return super.onRemove(e),w("WxTileSource onRemove (".concat(this._layer.wxdatasetManager.datasetName,")")),this._animation=!1,this}},si=class{constructor({datasetName:e,datasetCurrentInstance:r,instanced:s,datasetCurrentMeta:n,metas:l,wxAPI:t}){this.datasetName=e,this._instanced=s,this._datasetCurrentInstance=r,this._datasetCurrentMeta=n,this._metas=l,this.wxAPI=t,w("WxDataSetManager.constructor: ".concat(this.datasetName))}getNearestValidTime(e=Date()){w("WxDataSetManager.getValidTime: ".concat(this.datasetName,", ").concat(e));let r=this.getAllTimes();if(e==="")return r[r.length-1];if(typeof e=="string"){let n=r.indexOf(e);if(n!==-1)return r[n]}if(typeof e=="number"){if(e<=0)return r[0];if(e<r.length)return r[e]}let s=new Date(e).getTime();return Number.isNaN(s)?r[r.length-1]:r.find(n=>new Date(n).getTime()>=s)||r[r.length-1]}getAllTimes(){return w("WxDataSetManager.getTimes: ".concat(this.datasetName)),this._instanced||this._datasetCurrentMeta.times}getAllVariables(){return w("WxDataSetManager.getVariables: ".concat(this.datasetName)),this._datasetCurrentMeta.variables}getVariableCurrentMeta(e){return w("WxDataSetManager.getVariableCurrentMeta: ".concat(this.datasetName,", ").concat(e)),this._datasetCurrentMeta.variablesMeta[e]}getInstanceVariableMeta(e,r){return w("WxDataSetManager.getInstanceVariableMeta: ".concat(this.datasetName,", ").concat(e,", ").concat(r)),this.getInstanceMeta(r).variablesMeta[e]}getMaxZoom(){return w("WxDataSetManager.getMaxZoom: ".concat(this.datasetName)),this._datasetCurrentMeta.maxZoom}getBoundaries(){return w("WxDataSetManager.getBoundaries: ".concat(this.datasetName)),this._datasetCurrentMeta.boundaries}getInstanceMeta(e){var r;return w("WxDataSetManager.getInstanceMeta: ".concat(this.datasetName,", ").concat(e)),e&&((r=this._metas)==null?void 0:r.get(e))||this._datasetCurrentMeta}createURI(e,r,s="webp"){if(w("WxDataSetManager.createURI: ".concat(this.datasetName,", ").concat(e,", ").concat(r)),!this.isVariableValid(e))throw new Error("in dataset ".concat(this.datasetName," variable ").concat(e," not found"));let n=this._instanced?r:this._datasetCurrentInstance;return"".concat(this.wxAPI.dataServerURL+this.datasetName,"/").concat(n,"/").concat(e,"/").concat(r,"/{z}/{x}/{y}
2.").concat(s)}isVariableValid(e){return w("WxDataSetManager.checkVariableValid: ".concat(this.datasetName,", ").concat(e)),this._datasetCurrentMeta.variablesMeta[e]!==void 0}async update(){let e=await this.wxAPI.createDatasetManagerOptions(this.datasetName);this._datasetCurrentInstance=e.datasetCurrentInstance,this._instanced=e.instanced,this._datasetCurrentMeta=e.datasetCurrentMeta,this._metas=e.metas}isInstanced(){return this._instanced!==void 0}_checkCombineVariableIfVector(e){w("WxDataSetManager._checkCombineVariableIfVector: ".concat(this.datasetName,", ").concat(e));let r=this._datasetCurrentMeta.variablesMeta[e];if(!r)throw new Error("in dataset ".concat(this.datasetName," variable ").concat(e," not found"));return r.vector||[e]}},ni=class extends si{createSourceLayer(e,r){w("WxDataSetManager.createSourceLayer: ".concat(this.datasetName));let s={...e,variables:this._checkCombineVariableIfVector(e.variable),wxdatasetManager:this};return new yt(s,r)}},oi=class extends Te{async createDatasetManager(e){let r=await this.createDatasetManagerOptions(e);return new ni(r)}};const li=e=>{var r;if(e)return{...e,colorMap:(r=e.colorMap)==null?void 0:r.map(([s,n])=>[s,n])}},Li=(e,r,s=Date.now())=>{const n=r==null?void 0:r.showWhen,l=r==null?void 0:r.timeWindowDays,i=typeof l=="number"&&Number.isFinite(l)&&l>0?l*24*60*60*1e3:void 0;return e.filter(a=>n==="past"?a>s?!1:i?a>=s-i:!0:n==="future"?a<=s?!1:i?a<=s+i:!0:!0)},hi=async e=>await new oi({dataServerURL:"https://tiles.metoceanapi.com/data/",requestInit:{headers:new Headers({"x-api-key":"DdWpFDuHhiQDfXDVrSmxvi"})},maskURL:"auto",maskChannel:"R",qtreeURL:"auto"}).createDatasetManager(e),ui=(e,r)=>{if(e.getVariableCurrentMeta(r))return[r];const n=e.getAllVariables();throw Ot.error("Variable ".concat(r," is not valid for the dataset, use ").concat(n.join(", "))),new Error("Variable ".concat(r," is not valid for the dataset, use ").concat(n.join(", ")))},di=async({wxdatasetManager:e,wxStyle:r,variable:s})=>{const n={opacity:1,attribution:"WxTiles",id:"wxsource"},l=ui(e,s);if(l){const t=r==null?void 0:r.name,i=r!=null&&r.name?li(r):void 0,a=e.getNearestValidTime(new Date),o={wxdatasetManager:e,variables:l,time:a,wxstyleName:t,wxstyle:i},h=new yt(o,n);return h.setCoarseLevel(0),h}},fi=(e,r,s)=>{var l,t;const n=Mt(r);if(n){const i=n.getCenter(),a=e.getBoundsZoom(n);e.setView(i,a,{animate:!1})}else{const i=(l=s==null?void 0:s.center)!=null?l:Xt(r),a=(t=s==null?void 0:s.zoom)!=null?t:$t;e.setView(i,a,{animate:!1})}},ci=async({lcMap:e,navigation:r})=>{const n=await(await ee())();n.showGraticule=g=>{g&&i&&n.latlngGraticule(Rt).addTo(i)},n.buildClusterGroup=g=>n.markerClusterGroup({showCoverageOnHover:!1,removeOutsideVisibleBounds:!1,iconCreateFunction:function(v){const y=Jt(v,g);return jt({html:y,leafletLib:n})}});let l,t,i,a=null;const o=()=>n,h=()=>i,d=()=>{var g;i&&((g=i.gestureHandling)!=null&&g.enabled()&&i.gestureHandling.disable(),i.remove(),a==null||a.stop(),i.off(),i=void 0,e==null||e(void 0),l==null||l())},u=({bounds:g,setMaxZoom:p,fixToBounds:v})=>{if(!!(a!=null&&a.getBounds()))return;const{container:x,config:C}=t!=null?t:{};if(x&&C&&i&&g){i.options.minZoom=void 0,i.options.maxZoom=void 0,i.options.maxBounds=void 0,i.options.zoomSnap=0;const b=i.getBoundsZoom(g),S=qt({setMaxZoom:p,boundsZoom:b});S&&i.setMaxZoom(S),i.setMinZoom(X(v)&&v?b:J),i.setMaxBounds(X(v)&&v?g:Q),i.setView(g.getCenter(),b,{animate:!1})}};return{drawMap:(g,p)=>{var v,y,x,C;if(i&&d(),l=p,!i){t=g;const{container:b,config:S,polylines:T,mapProjection:k,gestureHandling:$,mapTopoLayer:j,urlCoordsOff:V}=g,P=wt({ignoreStoredCoords:V,mapProjection:k,config:S}),Lt={boxZoom:!1,doubleClickZoom:!0,tapHold:!1,center:P.center,zoom:P.zoom,touchZoom:!0,maxBounds:P.type==="projection"&&P.projection.fixToBounds?P.bounds:Q,minZoom:J,maxZoom:S.maxZoom||Nt,scrollWheelZoom:!1,maxBoundsViscosity:Wt,zoomDelta:1,zoomSnap:0,crs:k!=null&&k.useSimpleTiles?M.CRS.Simple:M.CRS.EPSG3857},D=n.map(b,Lt);i=D,e==null||e(D),V||(a=Ct({map:D,navigation:r})),P.type==="projection"&&u({bounds:P.bounds,setMaxZoom:(y=(v=P.projection)==null?void 0:v.setMaxZoom)!=null?y:!0,fixToBounds:(x=P.projection)==null?void 0:x.fixToBounds}
2),$&&((C=D.gestureHandling)==null||C.enable()),Ft(D,j),ie(T).map(D.addLayer),a==null||a.start()}},getLib:o,getMap:h,clearMap:d,resetMap:()=>{i&&fi(i,t==null?void 0:t.mapProjection,t==null?void 0:t.config)},resetMap2Bounds:u,getMapOptions:()=>t,getWXApi:async({api:g,tiles:p})=>{const v=async b=>await Promise.all(p.map(async T=>{const{tileStyle:k,variable:$}=T,j=Zt(k);return di({wxdatasetManager:b,variable:$,wxStyle:j})})),y=await hi(g);return{tileSources:(await v(y)).filter(Dt),datasetManager:y}}}},wi=Object.freeze(Object.defineProperty({__proto__:null,default:ci},Symbol.toStringTag,{value:"Module"}));export{yt as B,Ft as a,wi as d,Li as f,oi as h,ee as l,fi as r}; 3//# sourceMappingURL=draw-map-CYqqX2AK.js.map
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.