@defra/interactive-map 0.0.29-alpha → 0.0.31-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/context.md +4 -4
- package/docs/api.md +111 -37
- package/docs/assets/css/docusaurus.scss +20 -4
- package/docs/assets/images/basic-map.jpg +0 -0
- package/docs/assets/images/button-first.jpg +0 -0
- package/docs/assets/images/deuteranopia-ozs-map-thumb.jpg +0 -0
- package/docs/assets/images/draw.jpg +0 -0
- package/docs/assets/images/marker-panel.jpg +0 -0
- package/docs/assets/images/night-ozs-map-thumb.jpg +0 -0
- package/docs/assets/images/outdoor-ozs-map-thumb.jpg +0 -0
- package/docs/assets/images/search.jpg +0 -0
- package/docs/assets/images/select-feature.jpg +0 -0
- package/docs/assets/images/style-switcher.jpg +0 -0
- package/docs/assets/images/toggle-marker-label.jpg +0 -0
- package/docs/assets/images/tritanopia-ozs-map-thumb.jpg +0 -0
- package/docs/examples/add-marker-with-panel.mdx +2 -2
- package/docs/examples/basic-map.mdx +2 -2
- package/docs/examples/draw.mdx +271 -0
- package/docs/examples/index.mdx +58 -10
- package/docs/examples/search-control.mdx +71 -0
- package/docs/examples/select-feature.mdx +146 -0
- package/docs/examples/style-switcher.mdx +135 -0
- package/docs/examples/toggle-marker-label.mdx +3 -3
- package/docs/plugins/datasets.md +15 -28
- package/docusaurus.config.cjs +5 -1
- package/package.json +1 -1
- package/plugins/beta/datasets/dist/css/index.css +4 -0
- package/plugins/beta/datasets/dist/esm/im-datasets-ml-adapter.js +1 -0
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/beta/datasets/dist/esm/index.js +1 -1
- package/plugins/beta/datasets/dist/umd/im-datasets-ml-adapter.js +2 -0
- package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +2 -0
- package/plugins/beta/datasets/dist/umd/index.js +2 -0
- package/plugins/beta/datasets/src/adapters/loadLayerAdapter.js +33 -0
- package/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +44 -120
- package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +145 -245
- package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +516 -0
- package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.js +191 -0
- package/plugins/beta/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +441 -0
- package/plugins/beta/datasets/src/api/addDataset.js +2 -5
- package/plugins/beta/datasets/src/api/addDataset.test.js +16 -0
- package/plugins/beta/datasets/src/api/getOpacity.js +14 -14
- package/plugins/beta/datasets/src/api/getOpacity.test.js +72 -0
- package/plugins/beta/datasets/src/api/getStyle.js +8 -9
- package/plugins/beta/datasets/src/api/getStyle.test.js +42 -0
- package/plugins/beta/datasets/src/api/removeDataset.js +7 -7
- package/plugins/beta/datasets/src/api/removeDataset.test.js +45 -0
- package/plugins/beta/datasets/src/api/setData.js +9 -3
- package/plugins/beta/datasets/src/api/setData.test.js +62 -0
- package/plugins/beta/datasets/src/api/setDatasetVisibility.js +5 -30
- package/plugins/beta/datasets/src/api/setDatasetVisibility.test.js +31 -0
- package/plugins/beta/datasets/src/api/setFeatureVisibility.js +3 -21
- package/plugins/beta/datasets/src/api/setFeatureVisibility.test.js +32 -0
- package/plugins/beta/datasets/src/api/setGlobals.js +20 -0
- package/plugins/beta/datasets/src/api/setGlobals.test.js +63 -0
- package/plugins/beta/datasets/src/api/setOpacity.js +8 -27
- package/plugins/beta/datasets/src/api/setOpacity.test.js +31 -0
- package/plugins/beta/datasets/src/api/setStyle.js +5 -21
- package/plugins/beta/datasets/src/api/setStyle.test.js +53 -0
- package/plugins/beta/datasets/src/components/Key/Key.jsx +51 -0
- package/plugins/beta/datasets/src/components/Key/KeyGroupItem.jsx +18 -0
- package/plugins/beta/datasets/src/components/Key/KeyItem.jsx +20 -0
- package/plugins/beta/datasets/src/components/Key/KeySvg.jsx +22 -0
- package/plugins/beta/datasets/src/components/Key/KeySvg.test.jsx +87 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgLine.jsx +19 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgLine.test.jsx +71 -0
- package/plugins/beta/datasets/src/components/{KeySvgPattern.jsx → Key/KeySvgPattern.jsx} +3 -4
- package/plugins/beta/datasets/src/components/Key/KeySvgPattern.test.jsx +55 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgRect.jsx +22 -0
- package/plugins/beta/datasets/src/components/Key/KeySvgRect.test.jsx +85 -0
- package/plugins/beta/datasets/src/components/{KeySvgSymbol.jsx → Key/KeySvgSymbol.jsx} +5 -5
- package/plugins/beta/datasets/src/components/Key/KeySvgSymbol.test.jsx +80 -0
- package/plugins/beta/datasets/src/components/Key/svgProperties.test.js +61 -0
- package/plugins/beta/datasets/src/{panels → components/LayersMenu}/Layers.module.scss +4 -0
- package/plugins/beta/datasets/src/components/LayersMenu/LayersMenu.jsx +33 -0
- package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +31 -0
- package/plugins/beta/datasets/src/components/LayersMenu/LayersMenuGroupWrapper.jsx +19 -0
- package/plugins/beta/datasets/src/datasets.scss +2 -2
- package/plugins/beta/datasets/src/fetch/createDynamicSource.js +8 -8
- package/plugins/beta/datasets/src/{DatasetsInit.jsx → initialise/DatasetsInit.jsx} +19 -21
- package/plugins/beta/datasets/src/{defaults.js → initialise/defaults.js} +17 -2
- package/plugins/beta/datasets/src/initialise/defaults.test.js +127 -0
- package/plugins/beta/datasets/src/{datasets.js → initialise/initialiseDatasets.js} +30 -26
- package/plugins/beta/datasets/src/initialise/initialiseDatasets.test.js +273 -0
- package/plugins/beta/datasets/src/manifest.js +8 -6
- package/plugins/beta/datasets/src/reducers/__data__/demoDatasets.js +253 -0
- package/plugins/beta/datasets/src/reducers/datasetsToMenu.js +78 -0
- package/plugins/beta/datasets/src/reducers/datasetsToMenu.test.js +35 -0
- package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.js +34 -0
- package/plugins/beta/datasets/src/reducers/mappedDatasetsReducer.test.js +117 -0
- package/plugins/beta/datasets/src/reducers/pluginState.js +206 -0
- package/plugins/beta/datasets/src/reducers/pluginState.test.js +386 -0
- package/plugins/beta/datasets/src/registry/__mocks__/datasetRegistry.js +29 -0
- package/plugins/beta/datasets/src/registry/createDataset.js +5 -0
- package/plugins/beta/datasets/src/registry/dataset.js +172 -0
- package/plugins/beta/datasets/src/registry/dataset.test.js +483 -0
- package/plugins/beta/datasets/src/registry/datasetDefinitionCache.js +35 -0
- package/plugins/beta/datasets/src/registry/datasetRegistry.js +116 -0
- package/plugins/beta/datasets/src/registry/datasetRegistry.test.js +335 -0
- package/plugins/beta/datasets/src/registry/dynamicGeoJson.js +17 -0
- package/plugins/beta/datasets/src/registry/globalDataset.js +36 -0
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -1
- package/plugins/beta/draw-ml/src/events.js +13 -1
- package/plugins/beta/draw-ml/src/index.js +1 -1
- package/plugins/beta/draw-ml/src/manifest.js +3 -0
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/src/InteractInit.jsx +2 -2
- package/plugins/interact/src/InteractInit.test.js +1 -1
- package/plugins/interact/src/events.js +2 -29
- package/plugins/interact/src/events.test.js +4 -102
- package/plugins/interact/src/hooks/useAttachEvents.js +3 -4
- package/plugins/interact/src/hooks/useAttachEvents.test.js +1 -3
- package/plugins/interact/src/hooks/useInteractionHandlers.js +10 -1
- package/plugins/interact/src/hooks/useInteractionHandlers.test.js +23 -4
- package/plugins/interact/src/manifest.js +0 -35
- package/plugins/interact/src/manifest.test.js +3 -43
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
- package/providers/beta/esri/src/esriProvider.js +4 -0
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/src/openlayersProvider.js +4 -0
- package/providers/beta/openlayers/src/openlayersProvider.test.js +5 -0
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/src/maplibreProvider.js +6 -4
- package/providers/maplibre/src/maplibreProvider.test.js +5 -0
- package/providers/maplibre/src/utils/highlightFeatures.js +74 -25
- package/providers/maplibre/src/utils/highlightFeatures.test.js +132 -0
- package/providers/maplibre/src/utils/patternImages.js +2 -4
- package/providers/maplibre/src/utils/symbolImages.js +1 -4
- package/rollup.esm.mjs +2 -8
- package/src/App/components/MapButton/MapButton.jsx +16 -1
- package/src/App/components/MapButton/MapButton.module.scss +12 -1
- package/src/App/components/MapButton/MapButton.test.jsx +40 -1
- package/src/App/components/Tooltip/getTooltipPosition.js +2 -2
- package/src/App/hooks/useContinueEnabledEvaluator.js +31 -0
- package/src/App/hooks/useContinueEnabledEvaluator.test.js +118 -0
- package/src/App/hooks/useEvaluateProp.js +15 -15
- package/src/App/hooks/useEvaluateProp.test.js +80 -76
- package/src/App/hooks/useLayoutMeasurements.js +1 -3
- package/src/App/hooks/useResizeObserver.js +12 -1
- package/src/App/hooks/useResizeObserver.test.js +1 -0
- package/src/App/renderer/PluginInits.jsx +2 -0
- package/src/App/renderer/mapButtons.js +21 -1
- package/src/App/renderer/mapButtons.test.js +46 -1
- package/src/App/store/appReducer.js +1 -1
- package/src/App/store/appReducer.test.js +37 -0
- package/src/InteractiveMap/InteractiveMap.js +10 -0
- package/src/InteractiveMap/InteractiveMap.test.js +8 -0
- package/src/InteractiveMap/polyfills.js +37 -6
- package/src/InteractiveMap/polyfills.test.js +132 -101
- package/src/config/appConfig.js +25 -0
- package/src/config/appConfig.test.js +50 -0
- package/src/config/defaults.js +1 -0
- package/src/scss/settings/_dimensions.scss +1 -0
- package/src/services/patternRegistry.js +8 -4
- package/src/types.js +7 -0
- package/src/utils/patternUtils.js +1 -2
- package/src/utils/patternUtils.test.js +9 -0
- package/webpack.dev.mjs +10 -0
- package/webpack.umd.mjs +1 -1
- package/plugins/beta/datasets/dist/adapters/maplibre/esm/im-datasets-ml-adapter.js +0 -1
- package/plugins/beta/datasets/dist/adapters/maplibre/esm/index.js +0 -1
- package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-maplibre-adapter.js +0 -2
- package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-plugin.js +0 -2
- package/plugins/beta/datasets/dist/umd/maplibre/index.js +0 -2
- package/plugins/beta/datasets/src/adapters/maplibre/index.js +0 -18
- package/plugins/beta/datasets/src/adapters/maplibre/layerIds.js +0 -75
- package/plugins/beta/datasets/src/adapters/maplibre/patternImages.js +0 -27
- package/plugins/beta/datasets/src/adapters/maplibre/symbolImages.js +0 -31
- package/plugins/beta/datasets/src/components/KeySvg.jsx +0 -24
- package/plugins/beta/datasets/src/components/KeySvgLine.jsx +0 -19
- package/plugins/beta/datasets/src/components/KeySvgRect.jsx +0 -22
- package/plugins/beta/datasets/src/index.maplibre.umd.js +0 -23
- package/plugins/beta/datasets/src/panels/Key.jsx +0 -62
- package/plugins/beta/datasets/src/panels/Layers.jsx +0 -141
- package/plugins/beta/datasets/src/reducer.js +0 -219
- package/plugins/beta/datasets/src/reducers/keyReducer.js +0 -34
- package/plugins/beta/datasets/src/utils/filters.js +0 -34
- package/plugins/beta/datasets/src/utils/mergeSublayer.js +0 -86
- package/plugins/beta/draw-ml/dist/css/index.css +0 -21
- /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-maplibre-adapter.js.LICENSE.txt → im-datasets-ml-adapter.js.LICENSE.txt} +0 -0
- /package/plugins/beta/datasets/dist/umd/{maplibre/im-datasets-plugin.js.LICENSE.txt → im-datasets-plugin.js.LICENSE.txt} +0 -0
- /package/plugins/beta/datasets/dist/umd/{maplibre/index.js.LICENSE.txt → index.js.LICENSE.txt} +0 -0
- /package/plugins/beta/datasets/src/components/{EmptyKey.jsx → Key/EmptyKey.jsx} +0 -0
- /package/plugins/beta/datasets/src/components/{EmptyKey.test.jsx → Key/EmptyKey.test.jsx} +0 -0
- /package/plugins/beta/datasets/src/{panels → components/Key}/Key.module.scss +0 -0
- /package/plugins/beta/datasets/src/components/{svgProperties.js → Key/svgProperties.js} +0 -0
|
@@ -41,6 +41,10 @@ export default class OpenLayersProvider {
|
|
|
41
41
|
Object.assign(this, mapProviderConfig)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
get name () {
|
|
45
|
+
return 'OpenLayersProvider'
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
async initMap (config) {
|
|
45
49
|
const { container, padding, mapStyle, mapSize, center, zoom, bounds, minZoom, maxZoom, transformRequest, pixelRatio } = config
|
|
46
50
|
this.mapStyleId = mapStyle?.id
|
|
@@ -117,6 +117,11 @@ describe('OpenLayersProvider', () => {
|
|
|
117
117
|
expect(provider.zoomAlignment).toBe('world')
|
|
118
118
|
expect(provider.customProp).toBe('hello')
|
|
119
119
|
})
|
|
120
|
+
|
|
121
|
+
test('it should have a name getter', () => {
|
|
122
|
+
const { provider } = makeProvider()
|
|
123
|
+
expect(provider.name).toBe('OpenLayersProvider')
|
|
124
|
+
})
|
|
120
125
|
})
|
|
121
126
|
|
|
122
127
|
describe('initMap', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/objectWithoutProperties";import a from"@babel/runtime/helpers/asyncToGenerator";var r=400,n=7,i=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];var o=(t,e)=>{var a=null,r=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(a),a=setTimeout(()=>{t(...n)},e)};return r.cancel=()=>{a&&(clearTimeout(a),a=null)},r};function s(t){var{map:e,events:a,eventBus:r,getCenter:n,getZoom:i,getBounds:s,getResolution:l}=t,h=[],u=[],c=()=>{var t=i();return{center:n(),bounds:s(),resolution:l(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},d=(t,e)=>r.emit(t,e),p=()=>d(a.MAP_LOADED);e.on("load",p),h.push(["load",p]);e.once("idle",()=>d(a.MAP_FIRST_IDLE,c()));var g=()=>d(a.MAP_MOVE_START);e.on("movestart",g),h.push(["movestart",g]);var f=o(()=>{d(a.MAP_MOVE_END,c())},500);e.on("moveend",f),h.push(["moveend",f]);var y,m,v,M=(y=()=>{d(a.MAP_MOVE,c())},m=10,v=0,function(){var t=Date.now();t-v>=m&&(v=t,y(...arguments))});e.on("zoom",M),h.push(["zoom",M]);var b=()=>d(a.MAP_RENDER);e.on("render",b),h.push(["render",b]);var w=o(()=>{d(a.MAP_DATA_CHANGE,c())},500),x=t=>{t.isSourceLoaded&&w()};e.on("styledata",w),e.on("sourcedata",x),h.push(["styledata",w],["sourcedata",x]);var P=()=>d(a.MAP_STYLE_CHANGE);e.on("style.load",P),h.push(["style.load",P]);var N=t=>d(a.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]});return e.on("click",N),h.push(["click",N]),u.push(f,M,w),{remove(){u.forEach(t=>t.cancel()),h.forEach(t=>{var[a,r]=t;return e.off(a,r)})}}}let l=" ";class h{static get separator(){return l}static set separator(t){l=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let a=null;switch(e.length){case 3:a=e[0]/1+e[1]/60+e[2]/3600;break;case 2:a=e[0]/1+e[1]/60;break;case 1:a=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(a=-a),Number(a)}static toDms(t,e="d",a=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===a)switch(e){case"d":case"deg":a=4;break;case"dm":case"deg+min":a=2;break;case"dms":case"deg+min+sec":a=0;break;default:e="d",a=4}t=Math.abs(t);let r=null,n=null,i=null,o=null;switch(e){default:case"d":case"deg":n=t.toFixed(a),n<100&&(n="0"+n),n<10&&(n="0"+n),r=n+"°";break;case"dm":case"deg+min":n=Math.floor(t),i=(60*t%60).toFixed(a),60==i&&(i=(0).toFixed(a),n++),n=("000"+n).slice(-3),i<10&&(i="0"+i),r=n+"°"+h.separator+i+"′";break;case"dms":case"deg+min+sec":n=Math.floor(t),i=Math.floor(3600*t/60)%60,o=(3600*t%60).toFixed(a),60==o&&(o=(0).toFixed(a),i++),60==i&&(i=0,n++),n=("000"+n).slice(-3),i=("00"+i).slice(-2),o<10&&(o="0"+o),r=n+"°"+h.separator+i+"′"+h.separator+o+"″"}return r}static toLat(t,e,a){const r=h.toDms(h.wrap90(t),e,a);return null===r?"–":r.slice(1)+h.separator+(t<0?"S":"N")}static toLon(t,e,a){const r=h.toDms(h.wrap180(t),e,a);return null===r?"–":r+h.separator+(t<0?"W":"E")}static toBrng(t,e,a){const r=h.toDms(h.wrap360(t),e,a);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(a.thousands,"⁜").replace(a.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",a.decimal).replace("⁜",a.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=h.wrap360(t);const a=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*a/360)%a*16/a]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t,a=360;return 1*Math.abs(((e-90)%a+a)%a-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const u=Math.PI;class c{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=h.wrap90(Number(t)),this._lon=h.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?h.wrap90(h.parse(t)):h.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?h.wrap90(h.parse(t)):h.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,a;if(2==t.length&&([e,a]=t,e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,a]=t[0].split(","),e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[a,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(a=r.longitude),null!=r.lng&&(a=r.lng),null!=r.lon&&(a=r.lon),e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a))),isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${t.toString()}’`);return new c(e,a)}distanceTo(t,e=6371e3){if(t instanceof c||(t=c.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const a=e,r=this.lat.toRadians(),n=this.lon.toRadians(),i=t.lat.toRadians(),o=i-r,s=t.lon.toRadians()-n,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(r)*Math.cos(i)*Math.sin(s/2)*Math.sin(s/2);return a*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof c||(t=c.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),n=Math.cos(e)*Math.sin(a)-Math.sin(e)*Math.cos(a)*Math.cos(r),i=Math.sin(r)*Math.cos(a),o=Math.atan2(i,n).toDegrees();return h.wrap360(o)}finalBearingTo(t){t instanceof c||(t=c.parse(t));const e=t.initialBearingTo(this)+180;return h.wrap360(e)}midpointTo(t){t instanceof c||(t=c.parse(t));const e=this.lat.toRadians(),a=this.lon.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),i=Math.cos(e),o=0,s=Math.sin(e),l={x:i+Math.cos(r)*Math.cos(n),y:o+Math.cos(r)*Math.sin(n),z:s+Math.sin(r)},h=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=a+Math.atan2(l.y,l.x),d=h.toDegrees(),p=u.toDegrees();return new c(d,p)}intermediatePointTo(t,e){if(t instanceof c||(t=c.parse(t)),this.equals(t))return new c(this.lat,this.lon);const a=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=n-a,s=i-r,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(a)*Math.cos(n)*Math.sin(s/2)*Math.sin(s/2),h=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),u=Math.sin((1-e)*h)/Math.sin(h),d=Math.sin(e*h)/Math.sin(h),p=u*Math.cos(a)*Math.cos(r)+d*Math.cos(n)*Math.cos(i),g=u*Math.cos(a)*Math.sin(r)+d*Math.cos(n)*Math.sin(i),f=u*Math.sin(a)+d*Math.sin(n),y=Math.atan2(f,Math.sqrt(p*p+g*g)),m=Math.atan2(g,p),v=y.toDegrees(),M=m.toDegrees();return new c(v,M)}destinationPoint(t,e,a=6371e3){const r=t/a,n=Number(e).toRadians(),i=this.lat.toRadians(),o=this.lon.toRadians(),s=Math.sin(i)*Math.cos(r)+Math.cos(i)*Math.sin(r)*Math.cos(n),l=Math.asin(s),h=Math.sin(n)*Math.sin(r)*Math.cos(i),u=Math.cos(r)-Math.sin(i)*s,d=o+Math.atan2(h,u),p=l.toDegrees(),g=d.toDegrees();return new c(p,g)}static intersection(t,e,a,r){if(t instanceof c||(t=c.parse(t)),a instanceof c||(a=c.parse(a)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const n=t.lat.toRadians(),i=t.lon.toRadians(),o=a.lat.toRadians(),s=a.lon.toRadians(),l=Number(e).toRadians(),h=Number(r).toRadians(),d=o-n,p=s-i,g=2*Math.asin(Math.sqrt(Math.sin(d/2)*Math.sin(d/2)+Math.cos(n)*Math.cos(o)*Math.sin(p/2)*Math.sin(p/2)));if(Math.abs(g)<Number.EPSILON)return new c(t.lat,t.lon);const f=(Math.sin(o)-Math.sin(n)*Math.cos(g))/(Math.sin(g)*Math.cos(n)),y=(Math.sin(n)-Math.sin(o)*Math.cos(g))/(Math.sin(g)*Math.cos(o)),m=Math.acos(Math.min(Math.max(f,-1),1)),v=Math.acos(Math.min(Math.max(y,-1),1)),M=l-(Math.sin(s-i)>0?m:2*u-m),b=(Math.sin(s-i)>0?2*u-v:v)-h;if(0==Math.sin(M)&&0==Math.sin(b))return null;if(Math.sin(M)*Math.sin(b)<0)return null;const w=-Math.cos(M)*Math.cos(b)+Math.sin(M)*Math.sin(b)*Math.cos(g),x=Math.atan2(Math.sin(g)*Math.sin(M)*Math.sin(b),Math.cos(b)+Math.cos(M)*w),P=Math.asin(Math.min(Math.max(Math.sin(n)*Math.cos(x)+Math.cos(n)*Math.sin(x)*Math.cos(l),-1),1)),N=i+Math.atan2(Math.sin(l)*Math.sin(x)*Math.cos(n),Math.cos(x)-Math.sin(n)*Math.sin(P)),S=P.toDegrees(),E=N.toDegrees();return new c(S,E)}crossTrackDistanceTo(t,e,a=6371e3){t instanceof c||(t=c.parse(t)),e instanceof c||(e=c.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(n)*Math.sin(i-o))*r}alongTrackDistanceTo(t,e,a=6371e3){t instanceof c||(t=c.parse(t)),e instanceof c||(e=c.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians(),s=Math.asin(Math.sin(n)*Math.sin(i-o));return Math.acos(Math.cos(n)/Math.abs(Math.cos(s)))*Math.sign(Math.cos(o-i))*r}maxLatitude(t){const e=Number(t).toRadians(),a=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(a))).toDegrees()}static crossingParallels(t,e,a){if(t.equals(e))return null;const r=Number(a).toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=e.lat.toRadians(),s=e.lon.toRadians()-i,l=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.sin(s),u=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.cos(s)-Math.cos(n)*Math.sin(o)*Math.cos(r),c=Math.cos(n)*Math.cos(o)*Math.sin(r)*Math.sin(s);if(c*c>l*l+u*u)return null;const d=Math.atan2(-u,l),p=Math.acos(c/Math.sqrt(l*l+u*u)),g=i+d+p,f=(i+d-p).toDegrees(),y=g.toDegrees();return{lon1:h.wrap180(f),lon2:h.wrap180(y)}}rhumbDistanceTo(t,e=6371e3){t instanceof c||(t=c.parse(t));const a=e,r=this.lat.toRadians(),n=t.lat.toRadians(),i=n-r;let o=Math.abs(t.lon-this.lon).toRadians();Math.abs(o)>u&&(o=o>0?-(2*u-o):2*u+o);const s=Math.log(Math.tan(n/2+u/4)/Math.tan(r/2+u/4)),l=Math.abs(s)>1e-11?i/s:Math.cos(r);return Math.sqrt(i*i+l*l*o*o)*a}rhumbBearingTo(t){if(t instanceof c||(t=c.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>u&&(r=r>0?-(2*u-r):2*u+r);const n=Math.log(Math.tan(a/2+u/4)/Math.tan(e/2+u/4)),i=Math.atan2(r,n).toDegrees();return h.wrap360(i)}rhumbDestinationPoint(t,e,a=6371e3){const r=this.lat.toRadians(),n=this.lon.toRadians(),i=Number(e).toRadians(),o=t/a,s=o*Math.cos(i);let l=r+s;Math.abs(l)>u/2&&(l=l>0?u-l:-u-l);const h=Math.log(Math.tan(l/2+u/4)/Math.tan(r/2+u/4)),d=Math.abs(h)>1e-11?s/h:Math.cos(r),p=n+o*Math.sin(i)/d,g=l.toDegrees(),f=p.toDegrees();return new c(g,f)}rhumbMidpointTo(t){t instanceof c||(t=c.parse(t));const e=this.lat.toRadians();let a=this.lon.toRadians();const r=t.lat.toRadians(),n=t.lon.toRadians();Math.abs(n-a)>u&&(a+=2*u);const i=(e+r)/2,o=Math.tan(u/4+e/2),s=Math.tan(u/4+r/2),l=Math.tan(u/4+i/2);let h=((n-a)*Math.log(l)+a*Math.log(s)-n*Math.log(o))/Math.log(s/o);isFinite(h)||(h=(a+n)/2);const d=i.toDegrees(),p=h.toDegrees();return new c(d,p)}static areaOf(t,e=6371e3){const a=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const n=t.length-1;let i=0;for(let e=0;e<n;e++){const a=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),n=(t[e+1].lon-t[e].lon).toRadians();i+=2*Math.atan2(Math.tan(n/2)*(Math.tan(a/2)+Math.tan(r/2)),1+Math.tan(a/2)*Math.tan(r/2))}(function(t){let e=0,a=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const n=t[r].initialBearingTo(t[r+1]),i=t[r].finalBearingTo(t[r+1]);e+=(n-a+540)%360-180,e+=(i-n+540)%360-180,a=i}const r=t[0].initialBearingTo(t[1]);e+=(r-a+540)%360-180;return Math.abs(e)<90})(t)&&(i=Math.abs(i)-2*u);const o=Math.abs(i*a*a);return r||t.pop(),o}equals(t){return t instanceof c||(t=c.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON)&&!(Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);if("n"==t)return null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`;return`${h.toLat(this.lat,t,e)}, ${h.toLon(this.lon,t,e)}`}}function d(t,e,a){if(null!==t)for(var r,n,i,o,s,l,h,u,c=0,p=0,g=t.type,f="FeatureCollection"===g,y="Feature"===g,m=f?t.features.length:1,v=0;v<m;v++){s=(u=!!(h=f?t.features[v].geometry:y?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var M=0;M<s;M++){var b=0,w=0;if(null!==(o=u?h.geometries[M]:h)){l=o.coordinates;var x=o.type;switch(c=0,x){case null:break;case"Point":if(!1===e(l,p,v,b,w))return!1;p++,b++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===e(l[r],p,v,b,w))return!1;p++,"MultiPoint"===x&&b++}"LineString"===x&&b++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-c;n++){if(!1===e(l[r][n],p,v,b,w))return!1;p++}"MultiLineString"===x&&b++,"Polygon"===x&&w++}"Polygon"===x&&b++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(w=0,n=0;n<l[r].length;n++){for(i=0;i<l[r][n].length-c;i++){if(!1===e(l[r][n][i],p,v,b,w))return!1;p++}w++}b++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===d(o.geometries[r],e))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var p=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const a=[1/0,1/0,-1/0,-1/0];return d(t,t=>{a[0]>t[0]&&(a[0]=t[0]),a[1]>t[1]&&(a[1]=t[1]),a[2]<t[0]&&(a[2]=t[0]),a[3]<t[1]&&(a[3]=t[1])}),a},g=(t,e)=>{var[a,r]=t,[n,i]=e,o=new c(r,a),s=new c(i,n);return o.distanceTo(s)},f=t=>{var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var a=Number.parseFloat(e.toFixed(1)),r=1===a?"mile":"miles";return"".concat(a," ").concat(r)}var n=Math.round(e);return"".concat(n," miles")},y=(t,e,a)=>{var[r,n]=e,i=a.filter(e=>{var[a,i]=e;return(a!==r||i!==n)&&((t,e,a)=>{switch(t){case"ArrowUp":return a<0&&Math.abs(a)>=Math.abs(e);case"ArrowDown":return a>0&&Math.abs(a)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(a);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(a);default:return!1}})(t,a-r,i-n)});if(!i.length)return a.findIndex(t=>t[0]===r&&t[1]===n);var o=-1,s=1/0;return i.forEach(t=>{var e=t[0]-r,i=t[1]-n,l=e*e+i*i;l<s&&(s=l,o=a.indexOf(t))}),o},m=t=>p(t);function v(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function M(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?v(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var b="highlighted-label";function w(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var{stops:a}=t;if(a.length<2)return a.length>0?a[0][1]:0;for(var r=a[0],n=a[a.length-1],i=1;i<a.length;i++){var o=a[i];if(o[0]>e){n=o,r=a[i-1];break}r=a[i-1],n=o}var[s,l]=r,[h,u]=n;return e<=s?l:e>=h?u:l+(e-s)/(h-s)*(u-l)}(t,e);var[,,a,...r]=t;if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var n=0;n<r.length-2;n+=2){var i=r[n],o=r[n+1],s=r[n+2],l=r[n+3];if(e<=i)return o;if(e<=s)return o+(e-i)/(s-i)*(l-o)}return r[r.length-1]}function x(t,e,a){return e.flatMap(e=>{var r,n=function(t){var e,a;return"string"==typeof t?null===(e=/^{(.+)}$/.exec(t))||void 0===e?void 0:e[1]:Array.isArray(t)?null===(a=t.find(t=>Array.isArray(t)&&"get"===t[0]))||void 0===a?void 0:a[1]:null}(null===(r=e.layout)||void 0===r?void 0:r["text-field"]);return n?a.filter(t=>{var a;return t.layer.id===e.id&&(null===(a=t.properties)||void 0===a?void 0:a[n])}).map(a=>function(t,e,a,r){var n=function(t){var{type:e,coordinates:a}=t;if("Point"===e)return a;if("MultiPoint"===e)return a[0];if(e.includes("LineString")){var r="LineString"===e?a:a[0];return[(r[0][0]+r[r.length-1][0])/2,(r[0][1]+r[r.length-1][1])/2]}if(e.includes("Polygon")){var n="Polygon"===e?a[0]:a[0][0],i=n.reduce((t,e)=>[t[0]+e[0],t[1]+e[1]],[0,0]);return[i[0]/n.length,i[1]/n.length]}return null}(t.geometry);if(!n)return null;var i=r.project({lng:n[0],lat:n[1]});return{text:t.properties[a],x:i.x,y:i.y,feature:t,layer:e}}(a,e,n,t)).filter(Boolean):[]})}function P(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function N(t,e,a){var r;if(null!=e&&null!==(r=e.feature)&&void 0!==r&&r.layer){P(t,a);var{feature:n,layer:i}=e;a.highlightLayerId="highlight-".concat(i.id);var{id:o,type:s,properties:l,geometry:h}=n;t.getSource(b).setData({id:o,type:s,properties:l,geometry:h}),a.highlightedExpr=i.layout["text-size"];var u=t.getZoom(),c=function(t,e,a){return{id:"highlight-".concat(t.id),type:t.type,source:b,layout:M(M({},t.layout),{},{"text-size":e,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:M(M({},t.paint),{},{"text-color":a.text,"text-halo-color":a.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})}}(i,1.5*w(a.highlightedExpr,u),a.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"});t.addLayer(c),t.moveLayer(a.highlightLayerId)}}function S(t){t.getSource(b)||t.addSource(b,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function E(t){t.getStyle().layers.filter(t=>{var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(e=>t.setLayoutProperty(e.id,"symbol-placement","line-center"))}function L(t,e,a,r){var n={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function i(){var e=t.getStyle().layers.filter(t=>"symbol"===t.type),a=t.queryRenderedFeatures({layers:e.map(t=>t.id)});n.labels=x(t,e,a)}function o(){if(i(),!n.labels.length)return null;var e=t.project(t.getCenter()),a=function(t,e){var a;return null===(a=t.reduce((t,a)=>{var r=(a.x-e.x)**2+(a.y-e.y)**2;return!t||r<t.dist?{label:a,dist:r}:t},null))||void 0===a?void 0:a.label}(n.labels,e);return n.currentPixel={x:a.x,y:a.y},N(t,a,n),"".concat(a.text," (").concat(a.layer.id,")")}return E(t),S(t),null==r||r.on(a.MAP_SET_STYLE,e=>{t.once("styledata",()=>t.once("idle",()=>{E(t),S(t),n.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)}))}),t.on("zoom",()=>{if(n.highlightLayerId&&n.highlightedExpr){var e=w(n.highlightedExpr,t.getZoom());t.setLayoutProperty(n.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(t=>"symbol"===t.type).forEach(e=>{t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:i,highlightNextLabel:function(e){if(i(),!n.labels.length)return null;if(!n.currentPixel)return o();var a=function(t,e){if(!e.currentPixel)return null;var a=e.labels.map((t,e)=>({pixel:[t.x,t.y],index:e})).filter(t=>t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y);if(!a.length)return null;var r=a.map(t=>t.pixel),n=y(t,[e.currentPixel.x,e.currentPixel.y],r);return(null==n||n<0||n>=a.length)&&(n=0),e.labels[a[n].index]}(e,n);return a?(n.currentPixel={x:a.x,y:a.y},N(t,a,n),"".concat(a.text," (").concat(a.layer.id,")")):null},highlightLabelAtCenter:o,clearHighlightedLabel:()=>P(t,n)}}function R(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function O(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?R(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var T="icon-image",I="active-highlight",D="active-highlight-inner",j="selected-highlight",A=(t,e)=>{var a,r;return null!==(a=null===(r=t._activeSymbolImageMap)||void 0===r?void 0:r[e])&&void 0!==a?a:null},_=(t,e)=>{var a,r;return null!==(a=null===(r=t._selectedSymbolImageMap)||void 0===r?void 0:r[e])&&void 0!==a?a:null},C=(t,e,a,r)=>{e.forEach(e=>{if(!a.has(e)){var n="".concat(r,"-").concat(e);["".concat(n,"-fill"),"".concat(n,"-line"),"".concat(n,"-symbol")].forEach(e=>{t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})},F=(t,e)=>{var a="_".concat(e.replaceAll("-",""),"Sources");C(t,t[a]||new Set,new Set,e),t[a]=new Set},k=(t,e,a,r,n,i,o)=>{t.getLayer(e)||t.addLayer(O(O({id:e,type:a,source:r},n&&{"source-layer":n}),{},{paint:i})),Object.entries(i).forEach(a=>{var[r,n]=a;t.setPaintProperty(e,r,n)}),t.setFilter(e,o),t.moveLayer(e)},B=(t,e,a,r,n,i,o)=>{var s=t.getLayoutProperty(n,T),l=o(t,s);l&&((t,e,a,r,n,i,o)=>{var s;t.getLayer(e)||t.addLayer(O(O({id:e,type:"symbol",source:a},r&&{"source-layer":r}),{},{layout:{[T]:i,"icon-anchor":null!==(s=t.getLayoutProperty(n,"icon-anchor"))&&void 0!==s?s:"center","icon-allow-overlap":!0}})),t.setLayoutProperty(e,T,i),t.setFilter(e,o),t.moveLayer(e)})(t,"".concat(e,"-symbol"),a,r,n,l,i)},z=(t,e,a,r,n,i)=>{var{ids:o,fillIds:s,idProperty:l,layerId:h,hasFillGeometry:u}=a[e],c=t.getLayer(h),d=c.sourceLayer,p=u?"fill":c.type,g="".concat(n,"-").concat(e),f=r[h];if(f){var{stroke:y,selectionStroke:m,strokeWidth:v,activeStrokeWidth:M,fill:b}=f,w=n===j,x=(t=>t===j||t===D)(n),P=x?m:y,N=x?v:M,S=l?["get",l]:["id"],E=["in",S,["literal",[...o]]];"fill"===p&&((t,e,a,r,n)=>{var{isSelected:i,idExpression:o,fillIds:s,fill:l,lineColor:h,lineWidth:u,filter:c}=n;if(i){var d=["in",o,["literal",[...s]]];k(t,"".concat(e,"-fill"),"fill",a,r,{"fill-color":l},d)}k(t,"".concat(e,"-line"),"line",a,r,{"line-color":h,"line-width":u},c)})(t,g,e,d,{isSelected:w,idExpression:S,fillIds:s,fill:b,lineColor:P,lineWidth:N,filter:E}),"line"===p&&(t.getLayer("".concat(g,"-fill"))&&t.setFilter("".concat(g,"-fill"),["==","id",""]),k(t,"".concat(g,"-line"),"line",e,d,{"line-color":P,"line-width":N},E)),"symbol"===p&&B(t,g,e,d,h,E,i)}},q=(t,e,a,r,n)=>{var i=((t,e)=>{var a={};return null==e||e.forEach(e=>{var{featureId:r,layerId:n,idProperty:i,geometry:o}=e,s=t.getLayer(n);if(s){var l=s.source;a[l]||(a[l]={ids:new Set,fillIds:new Set,idProperty:i,layerId:n,hasFillGeometry:!1}),!o||"Polygon"!==o.type&&"MultiPolygon"!==o.type||(a[l].hasFillGeometry=!0,a[l].fillIds.add(r)),a[l].ids.add(r)}}),a})(t,e),o=new Set(Object.keys(i)),s="_".concat(r.replaceAll("-",""),"Sources"),l=t[s]||new Set;return C(t,l,o,r),t[s]=o,o.forEach(e=>z(t,e,i,a,r,n)),i};var $=(t,e,a)=>{var r=(e.x-a.x)**2+(e.y-a.y)**2;if(0===r)return(t.x-e.x)**2+(t.y-e.y)**2;var n=((t.x-e.x)*(a.x-e.x)+(t.y-e.y)*(a.y-e.y))/r;return n=Math.max(0,Math.min(1,n)),(t.x-(e.x+n*(a.x-e.x)))**2+(t.y-(e.y+n*(a.y-e.y)))**2},W=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{radius:r=10}=a,n=[[e.x-r,e.y-r],[e.x+r,e.y+r]],i=t.queryRenderedFeatures(n);if(0===i.length)return[];var o=new Set(t.queryRenderedFeatures([e.x,e.y]).map(t=>{var e,a=void 0===t.id?JSON.stringify(t.properties):t.id;return"".concat(null===(e=t.layer)||void 0===e?void 0:e.source,":").concat(a)})),s=[];i.forEach(t=>{!1===s.includes(t.layer.id)&&s.push(t.layer.id)});for(var l=new Set,h=[],u=i.length-1;u>=0;u--){var c,d=i[u],p=void 0===d.id?JSON.stringify(d.properties):d.id,g="".concat(null===(c=d.layer)||void 0===c?void 0:c.source,":").concat(p);!1===l.has(g)&&(l.add(g),h.push(d))}var f=t.unproject(e),y=[f.lng,f.lat],m=h.filter(t=>{var e=t.geometry.type;if(e.includes("Polygon"))return("Polygon"===e?[t.geometry.coordinates]:t.geometry.coordinates).some(t=>((t,e)=>{for(var[a,r]=t,n=!1,i=0,o=e.length-1;i<e.length;o=i,i++){var[s,l]=e[i],[h,u]=e[o];l>r!=u>r&&a<(h-s)*(r-l)/(u-l)+s&&(n=!n)}return n})(y,t[0]));if("Point"===e||"MultiPoint"===e){var a,r=void 0===t.id?JSON.stringify(t.properties):t.id;return o.has("".concat(null===(a=t.layer)||void 0===a?void 0:a.source,":").concat(r))}return!0});return m.map(a=>{var r=0,n=a.geometry.type,i=((t,e,a)=>{var{coordinates:r,type:n}=a,i=1/0,o=e=>t.project(e),s=t=>{for(var a=0;a<t.length-1;a++){var r=$(e,o(t[a]),o(t[a+1]));r<i&&(i=r)}};if("Point"===n){var l=o(r);i=(e.x-l.x)**2+(e.y-l.y)**2}else"LineString"===n||"MultiPoint"===n?"LineString"===n?s(r):r.forEach(t=>{var a=o(t),r=(e.x-a.x)**2+(e.y-a.y)**2;r<i&&(i=r)}):"Polygon"===n||"MultiLineString"===n?r.forEach(s):"MultiPolygon"===n&&r.forEach(t=>t.forEach(s));return i})(t,e,a.geometry);return r+=1e6*s.indexOf(a.layer.id),n.includes("Polygon")&&(r-=5e5),{f:a,score:r+=i}}).sort((t,e)=>t.score-e.score).map(t=>{var{f:e}=t;return e})},Z=function(){var t=a(function*(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2;e.length&&(t._activeSymbolImageMap={},t._selectedSymbolImageMap={},yield Promise.all(e.flatMap(e=>{var o=n.getSymbolImageId(e,r,!1,i),s=n.getSymbolImageId(e,r,!0,i);return o&&s&&(t._activeSymbolImageMap[o]=s),["normal","active","selected"].map(function(){var l=a(function*(a){var l="active"===a?s:o;if("selected"===a||l&&!t.hasImage(l)){var h=yield n.rasteriseSymbolImage(e,r,a,i);h&&("selected"===a&&o&&(t._selectedSymbolImageMap[o]=h.imageId),t.hasImage(h.imageId)||t.addImage(h.imageId,h.imageData,{pixelRatio:i}))}});return function(t){return l.apply(this,arguments)}}())})))});return function(e,a,r,n){return t.apply(this,arguments)}}(),G=t=>Math.max(2,2*t),H=(t,e)=>{if(!t)return null;if("string"==typeof t)return t.trim();if("object"==typeof t){if(e&&t[e])return t[e];var a=Object.values(t)[0];return null!=a?a:null}return null},V=new Map,J=function(){var t=a(function*(t,e,a,r){var n=a.getPatternInnerContent(t);if(!n)return null;var i=a.getPatternImageId(t,e,r);if(!i)return null;var o,s,l=V.get(i);if(!l){var h=H(t.fillPatternForegroundColor,e)||"black",u=H(t.fillPatternBackgroundColor,e)||"transparent",c=(o=h,s=u,n.replace(/\{\{foregroundColor\}\}/g,o||"black").replace(/\{\{backgroundColor\}\}/g,s||"transparent")),d='<rect width="16" height="16" fill="'.concat(u,'"/>'),p=G(r),g=Math.round(8*p),f='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(g,'" height="').concat(g,'" viewBox="0 0 16 16">').concat(d).concat(c,"</svg>");l=yield((t,e,a)=>new Promise((r,n)=>{var i="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),o=new Image(e,a);o.onload=()=>{var t=document.createElement("canvas");t.width=e,t.height=a;var n=t.getContext("2d");n.drawImage(o,0,0,e,a),r(n.getImageData(0,0,e,a))},o.onerror=()=>{n(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},o.src=i}))(f,g,g),V.set(i,l)}return{imageId:i,imageData:l}});return function(e,a,r,n){return t.apply(this,arguments)}}(),Y=function(){var t=a(function*(t,e,r,n,i){if(e.length){var o=G(i),s=e.reduce((e,s)=>{var l=n.getPatternImageId(s,r,i);return!l||e[l]||t.hasImage(l)||(e[l]=a(function*(){var e=yield J(s,r,n,i);e&&t.addImage(e.imageId,e.imageData,{pixelRatio:o})})),e},{});yield Promise.all(Object.values(s).map(t=>t()))}});return function(e,a,r,n,i){return t.apply(this,arguments)}}(),K=["container","padding","mapStyle","mapSize","center","zoom","bounds","pixelRatio"];function U(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function X(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?U(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}class Q{constructor(t){var{mapFramework:e,mapProviderConfig:a={},events:r,eventBus:n}=t;this.maplibreModule=e,this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:i,supportsMapSizes:!0},Object.assign(this,a)}initMap(t){var r=this;return a(function*(){var{container:a,padding:n,mapStyle:i,mapSize:o,center:l,zoom:h,bounds:u,pixelRatio:c}=t,d=e(t,K);r.mapStyleId=null==i?void 0:i.id,r.mapSize=o;var{Map:p}=r.maplibreModule,{events:g,eventBus:f}=r,y=new p(X(X({},d),{},{container:a,style:null==i?void 0:i.url,pixelRatio:c,padding:n,center:l,zoom:h,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}));y.touchZoomRotate.disableRotation(),r.map=y,r.map.setPadding(n),u&&y.fitBounds(u,{duration:0}),function(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var a=t.getCanvas();if(a&&(this.target===a||a.contains(this.target)))return}e.call(this)}}(y),function(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block",e.addEventListener("focus",t=>{e.blur(),t.relatedTarget&&t.relatedTarget.focus({preventScroll:!0})})}(y),s({map:y,events:g,eventBus:f,getCenter:r.getCenter.bind(r),getZoom:r.getZoom.bind(r),getBounds:r.getBounds.bind(r),getResolution:r.getResolution.bind(r)}),function(t){var{mapProvider:e,map:a,events:r,eventBus:n}=t,i=t=>{a.once("style.load",()=>{n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:t.id})}),a.setStyle(t.url,{diff:!1})},o=t=>{a.setPixelRatio(t)},s=t=>{var{mapSize:a}=t;e.mapSize=a};n.on(r.MAP_SET_STYLE,i),n.on(r.MAP_SET_PIXEL_RATIO,o),n.on(r.MAP_SIZE_CHANGE,s)}({mapProvider:r,map:y,events:g,eventBus:f}),y.on("load",()=>{r.labelNavigator=L(y,null==i?void 0:i.mapColorScheme,g,f)}),r.eventBus.emit(g.MAP_READY,{map:r.map,mapStyleId:r.mapStyleId,mapSize:r.mapSize,crs:r.crs})})()}destroyMap(){var t,e;this.setHoverCursor([]),null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}setHoverCursor(t){this.map&&(this._onHoverMove=((t,e,a)=>{var r=t.getCanvas();if(a&&t.off("mousemove",a),null==e||!e.length)return r.style.cursor="",null;var n=a=>{var n=e.filter(e=>t.getLayer(e));if(0!==n.length){var{lineLayers:i,otherLayers:o}=((t,e)=>{var a=[],r=[];for(var n of e)if("line"===t.getLayer(n).type){var i=n.endsWith("-stroke")?n.slice(0,-7):null;null!==i&&e.includes(i)||a.push(n)}else r.push(n);return{lineLayers:a,otherLayers:r}})(t,n),{x:s,y:l}=a.point,h=[[s-10,l-10],[s+10,l+10]],u=i.length>0&&t.queryRenderedFeatures(h,{layers:i}).length>0,c=o.length>0&&t.queryRenderedFeatures(a.point,{layers:o}).length>0;r.style.cursor=u||c?"pointer":""}else r.style.cursor=""};return t.on("mousemove",n),n})(this.map,t,this._onHoverMove))}setView(t){var{center:e,zoom:a}=t;this.map.flyTo({center:e||this.getCenter(),zoom:a||this.getZoom(),duration:this.map.isStyleLoaded()?r:0})}zoomIn(t){this.map.easeTo({zoom:this.getZoom()+t,duration:r})}zoomOut(t){this.map.easeTo({zoom:this.getZoom()-t,duration:r})}panBy(t){this.map.panBy(t,{duration:r})}fitToBounds(t){var e=Array.isArray(t)?t:m(t),a=this.map.isStyleLoaded()?r:0;this.map.fitBounds(e,{duration:a})}setPadding(t){this.map.setPadding(t)}updateHighlightedFeatures(t,e,a){var{LngLatBounds:r}=this.maplibreModule;return function(t){var{LngLatBounds:e,map:a,selectedFeatures:r,activeFeatures:n,stylesMap:i}=t;if(!a)return null;null!=n&&n.length?(q(a,n,i,I,A),q(a,n,i,D,_)):(F(a,I),F(a,D));var o={};null!=r&&r.length?o=q(a,r,i,j,_):F(a,j);var s=[];return Object.entries(o).forEach(t=>{var[,{ids:e,idProperty:r,layerId:n}]=t;s.push(...a.queryRenderedFeatures({layers:[n]}).filter(t=>{var a;return e.has(r?null===(a=t.properties)||void 0===a?void 0:a[r]:t.id)}))}),((t,e)=>{if(!e.length)return null;var a=new t;return e.forEach(t=>{var e=t=>"number"==typeof t[0]?a.extend(t):t.forEach(e);e(t.geometry.coordinates)}),[a.getWest(),a.getSouth(),a.getEast(),a.getNorth()]})(e,s)}({LngLatBounds:r,map:this.map,selectedFeatures:t,activeFeatures:e,stylesMap:a})}highlightNextLabel(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}highlightLabelAtCenter(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}clearHighlightedLabel(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}getCenter(){var t=this.map.getCenter();return[Number(t.lng.toFixed(n)),Number(t.lat.toFixed(n))]}getZoom(){return Number(this.map.getZoom().toFixed(n))}getBounds(){return this.map.getBounds().toArray().flat(1)}getFeaturesAtPoint(t,e){return W(this.map,t,e)}getVisibleFeatures(t){var e=t.filter(t=>this.map.getLayer(t));return e.length?this.map.queryRenderedFeatures(void 0,{layers:e}):[]}addSymbolsToMap(t,e,r){var n=this;return a(function*(){var a=n.map.getPixelRatio()||1;return Z(n.map,t,e,r,a)})()}addPatternsToMap(t,e,r){var n=this;return a(function*(){var a=n.map.getPixelRatio()||1;return Y(n.map,t,e,r,a)})()}getAreaDimensions(){var{LngLatBounds:t}=this.maplibreModule;return(t=>{var e,a,r,n;if(t&&"function"==typeof t.getWest)e=t.getWest(),a=t.getSouth(),r=t.getEast(),n=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";[[e,a],[r,n]]=t}var i=g([e,a],[r,a]),o=g([e,a],[e,n]),s=f(i),l=f(o);return"".concat(l," by ").concat(s)})(((t,e)=>{var{width:a,height:r}=e.getContainer().getBoundingClientRect(),n=e.getPadding(),i=[n.left,r-n.bottom],o=[a-n.right,n.top];return new t(e.unproject(i),e.unproject(o))})(t,this.map))}getCardinalMove(t,e){return((t,e)=>{var[a,r]=t,[n,i]=e,o=i-r,s=n-a,l=[];if(Math.abs(o)>1e-4){var h=Math.round(g([a,r],[a,i]));l.push("".concat(o>0?"north":"south"," ").concat(f(h)))}if(Math.abs(s)>1e-4){var u=Math.round(g([a,r],[n,r]));l.push("".concat(s>0?"east":"west"," ").concat(f(u)))}return l.join(", ")})(t,e)}getResolution(){return t=this.map.getCenter(),e=this.map.getZoom(),a=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(a*Math.PI/180)/(512*r);var t,e,a,r}mapToScreen(t){return this.map.project(t)}screenToMap(t){var{lng:e,lat:a}=this.map.unproject([t.x,t.y]);return[e,a]}isGeometryObscured(t,e){return((t,e,a)=>{var r=a.getContainer().getBoundingClientRect(),[n,i,o,s]=m(t),l=[a.project([n,i]),a.project([n,s]),a.project([o,i]),a.project([o,s])],h=Math.min(...l.map(t=>t.x)),u=Math.max(...l.map(t=>t.x)),c=Math.min(...l.map(t=>t.y)),d=Math.max(...l.map(t=>t.y)),p=e.left-r.left,g=e.top-r.top,f=e.right-r.left,y=e.bottom-r.top;return h<f&&u>p&&c<y&&d>g})(t,e,this.map)}}export{Q as default};
|
|
1
|
+
import t from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/objectWithoutProperties";import a from"@babel/runtime/helpers/asyncToGenerator";var r=400,n=7,i=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];var o=(t,e)=>{var a=null,r=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];clearTimeout(a),a=setTimeout(()=>{t(...n)},e)};return r.cancel=()=>{a&&(clearTimeout(a),a=null)},r};function s(t){var{map:e,events:a,eventBus:r,getCenter:n,getZoom:i,getBounds:s,getResolution:l}=t,h=[],u=[],c=()=>{var t=i();return{center:n(),bounds:s(),resolution:l(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},d=(t,e)=>r.emit(t,e),p=()=>d(a.MAP_LOADED);e.on("load",p),h.push(["load",p]);e.once("idle",()=>d(a.MAP_FIRST_IDLE,c()));var g=()=>d(a.MAP_MOVE_START);e.on("movestart",g),h.push(["movestart",g]);var f=o(()=>{d(a.MAP_MOVE_END,c())},500);e.on("moveend",f),h.push(["moveend",f]);var y,m,v,M=(y=()=>{d(a.MAP_MOVE,c())},m=10,v=0,function(){var t=Date.now();t-v>=m&&(v=t,y(...arguments))});e.on("zoom",M),h.push(["zoom",M]);var b=()=>d(a.MAP_RENDER);e.on("render",b),h.push(["render",b]);var w=o(()=>{d(a.MAP_DATA_CHANGE,c())},500),x=t=>{t.isSourceLoaded&&w()};e.on("styledata",w),e.on("sourcedata",x),h.push(["styledata",w],["sourcedata",x]);var P=()=>d(a.MAP_STYLE_CHANGE);e.on("style.load",P),h.push(["style.load",P]);var N=t=>d(a.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]});return e.on("click",N),h.push(["click",N]),u.push(f,M,w),{remove(){u.forEach(t=>t.cancel()),h.forEach(t=>{var[a,r]=t;return e.off(a,r)})}}}let l=" ";class h{static get separator(){return l}static set separator(t){l=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let a=null;switch(e.length){case 3:a=e[0]/1+e[1]/60+e[2]/3600;break;case 2:a=e[0]/1+e[1]/60;break;case 1:a=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(a=-a),Number(a)}static toDms(t,e="d",a=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===a)switch(e){case"d":case"deg":a=4;break;case"dm":case"deg+min":a=2;break;case"dms":case"deg+min+sec":a=0;break;default:e="d",a=4}t=Math.abs(t);let r=null,n=null,i=null,o=null;switch(e){default:case"d":case"deg":n=t.toFixed(a),n<100&&(n="0"+n),n<10&&(n="0"+n),r=n+"°";break;case"dm":case"deg+min":n=Math.floor(t),i=(60*t%60).toFixed(a),60==i&&(i=(0).toFixed(a),n++),n=("000"+n).slice(-3),i<10&&(i="0"+i),r=n+"°"+h.separator+i+"′";break;case"dms":case"deg+min+sec":n=Math.floor(t),i=Math.floor(3600*t/60)%60,o=(3600*t%60).toFixed(a),60==o&&(o=(0).toFixed(a),i++),60==i&&(i=0,n++),n=("000"+n).slice(-3),i=("00"+i).slice(-2),o<10&&(o="0"+o),r=n+"°"+h.separator+i+"′"+h.separator+o+"″"}return r}static toLat(t,e,a){const r=h.toDms(h.wrap90(t),e,a);return null===r?"–":r.slice(1)+h.separator+(t<0?"S":"N")}static toLon(t,e,a){const r=h.toDms(h.wrap180(t),e,a);return null===r?"–":r+h.separator+(t<0?"W":"E")}static toBrng(t,e,a){const r=h.toDms(h.wrap360(t),e,a);return null===r?"–":r.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(a.thousands,"⁜").replace(a.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),a={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",a.decimal).replace("⁜",a.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=h.wrap360(t);const a=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*a/360)%a*16/a]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t,a=360;return 1*Math.abs(((e-90)%a+a)%a-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const u=Math.PI;class c{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=h.wrap90(Number(t)),this._lon=h.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?h.wrap90(h.parse(t)):h.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?h.wrap90(h.parse(t)):h.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?h.wrap180(h.parse(t)):h.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,a;if(2==t.length&&([e,a]=t,e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,a]=t[0].split(","),e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a)),isNaN(e)||isNaN(a)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const r=t[0];if("Point"==r.type&&Array.isArray(r.coordinates)?[a,e]=r.coordinates:(null!=r.latitude&&(e=r.latitude),null!=r.lat&&(e=r.lat),null!=r.longitude&&(a=r.longitude),null!=r.lng&&(a=r.lng),null!=r.lon&&(a=r.lon),e=h.wrap90(h.parse(e)),a=h.wrap180(h.parse(a))),isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(a))throw new TypeError(`invalid point ‘${t.toString()}’`);return new c(e,a)}distanceTo(t,e=6371e3){if(t instanceof c||(t=c.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const a=e,r=this.lat.toRadians(),n=this.lon.toRadians(),i=t.lat.toRadians(),o=i-r,s=t.lon.toRadians()-n,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(r)*Math.cos(i)*Math.sin(s/2)*Math.sin(s/2);return a*(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)))}initialBearingTo(t){if(t instanceof c||(t=c.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians(),r=(t.lon-this.lon).toRadians(),n=Math.cos(e)*Math.sin(a)-Math.sin(e)*Math.cos(a)*Math.cos(r),i=Math.sin(r)*Math.cos(a),o=Math.atan2(i,n).toDegrees();return h.wrap360(o)}finalBearingTo(t){t instanceof c||(t=c.parse(t));const e=t.initialBearingTo(this)+180;return h.wrap360(e)}midpointTo(t){t instanceof c||(t=c.parse(t));const e=this.lat.toRadians(),a=this.lon.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),i=Math.cos(e),o=0,s=Math.sin(e),l={x:i+Math.cos(r)*Math.cos(n),y:o+Math.cos(r)*Math.sin(n),z:s+Math.sin(r)},h=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=a+Math.atan2(l.y,l.x),d=h.toDegrees(),p=u.toDegrees();return new c(d,p)}intermediatePointTo(t,e){if(t instanceof c||(t=c.parse(t)),this.equals(t))return new c(this.lat,this.lon);const a=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=n-a,s=i-r,l=Math.sin(o/2)*Math.sin(o/2)+Math.cos(a)*Math.cos(n)*Math.sin(s/2)*Math.sin(s/2),h=2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),u=Math.sin((1-e)*h)/Math.sin(h),d=Math.sin(e*h)/Math.sin(h),p=u*Math.cos(a)*Math.cos(r)+d*Math.cos(n)*Math.cos(i),g=u*Math.cos(a)*Math.sin(r)+d*Math.cos(n)*Math.sin(i),f=u*Math.sin(a)+d*Math.sin(n),y=Math.atan2(f,Math.sqrt(p*p+g*g)),m=Math.atan2(g,p),v=y.toDegrees(),M=m.toDegrees();return new c(v,M)}destinationPoint(t,e,a=6371e3){const r=t/a,n=Number(e).toRadians(),i=this.lat.toRadians(),o=this.lon.toRadians(),s=Math.sin(i)*Math.cos(r)+Math.cos(i)*Math.sin(r)*Math.cos(n),l=Math.asin(s),h=Math.sin(n)*Math.sin(r)*Math.cos(i),u=Math.cos(r)-Math.sin(i)*s,d=o+Math.atan2(h,u),p=l.toDegrees(),g=d.toDegrees();return new c(p,g)}static intersection(t,e,a,r){if(t instanceof c||(t=c.parse(t)),a instanceof c||(a=c.parse(a)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(r))throw new TypeError(`invalid brng2 ‘${r}’`);const n=t.lat.toRadians(),i=t.lon.toRadians(),o=a.lat.toRadians(),s=a.lon.toRadians(),l=Number(e).toRadians(),h=Number(r).toRadians(),d=o-n,p=s-i,g=2*Math.asin(Math.sqrt(Math.sin(d/2)*Math.sin(d/2)+Math.cos(n)*Math.cos(o)*Math.sin(p/2)*Math.sin(p/2)));if(Math.abs(g)<Number.EPSILON)return new c(t.lat,t.lon);const f=(Math.sin(o)-Math.sin(n)*Math.cos(g))/(Math.sin(g)*Math.cos(n)),y=(Math.sin(n)-Math.sin(o)*Math.cos(g))/(Math.sin(g)*Math.cos(o)),m=Math.acos(Math.min(Math.max(f,-1),1)),v=Math.acos(Math.min(Math.max(y,-1),1)),M=l-(Math.sin(s-i)>0?m:2*u-m),b=(Math.sin(s-i)>0?2*u-v:v)-h;if(0==Math.sin(M)&&0==Math.sin(b))return null;if(Math.sin(M)*Math.sin(b)<0)return null;const w=-Math.cos(M)*Math.cos(b)+Math.sin(M)*Math.sin(b)*Math.cos(g),x=Math.atan2(Math.sin(g)*Math.sin(M)*Math.sin(b),Math.cos(b)+Math.cos(M)*w),P=Math.asin(Math.min(Math.max(Math.sin(n)*Math.cos(x)+Math.cos(n)*Math.sin(x)*Math.cos(l),-1),1)),N=i+Math.atan2(Math.sin(l)*Math.sin(x)*Math.cos(n),Math.cos(x)-Math.sin(n)*Math.sin(P)),S=P.toDegrees(),E=N.toDegrees();return new c(S,E)}crossTrackDistanceTo(t,e,a=6371e3){t instanceof c||(t=c.parse(t)),e instanceof c||(e=c.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(n)*Math.sin(i-o))*r}alongTrackDistanceTo(t,e,a=6371e3){t instanceof c||(t=c.parse(t)),e instanceof c||(e=c.parse(e));const r=a;if(this.equals(t))return 0;const n=t.distanceTo(this,r)/r,i=t.initialBearingTo(this).toRadians(),o=t.initialBearingTo(e).toRadians(),s=Math.asin(Math.sin(n)*Math.sin(i-o));return Math.acos(Math.cos(n)/Math.abs(Math.cos(s)))*Math.sign(Math.cos(o-i))*r}maxLatitude(t){const e=Number(t).toRadians(),a=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(a))).toDegrees()}static crossingParallels(t,e,a){if(t.equals(e))return null;const r=Number(a).toRadians(),n=t.lat.toRadians(),i=t.lon.toRadians(),o=e.lat.toRadians(),s=e.lon.toRadians()-i,l=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.sin(s),u=Math.sin(n)*Math.cos(o)*Math.cos(r)*Math.cos(s)-Math.cos(n)*Math.sin(o)*Math.cos(r),c=Math.cos(n)*Math.cos(o)*Math.sin(r)*Math.sin(s);if(c*c>l*l+u*u)return null;const d=Math.atan2(-u,l),p=Math.acos(c/Math.sqrt(l*l+u*u)),g=i+d+p,f=(i+d-p).toDegrees(),y=g.toDegrees();return{lon1:h.wrap180(f),lon2:h.wrap180(y)}}rhumbDistanceTo(t,e=6371e3){t instanceof c||(t=c.parse(t));const a=e,r=this.lat.toRadians(),n=t.lat.toRadians(),i=n-r;let o=Math.abs(t.lon-this.lon).toRadians();Math.abs(o)>u&&(o=o>0?-(2*u-o):2*u+o);const s=Math.log(Math.tan(n/2+u/4)/Math.tan(r/2+u/4)),l=Math.abs(s)>1e-11?i/s:Math.cos(r);return Math.sqrt(i*i+l*l*o*o)*a}rhumbBearingTo(t){if(t instanceof c||(t=c.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),a=t.lat.toRadians();let r=(t.lon-this.lon).toRadians();Math.abs(r)>u&&(r=r>0?-(2*u-r):2*u+r);const n=Math.log(Math.tan(a/2+u/4)/Math.tan(e/2+u/4)),i=Math.atan2(r,n).toDegrees();return h.wrap360(i)}rhumbDestinationPoint(t,e,a=6371e3){const r=this.lat.toRadians(),n=this.lon.toRadians(),i=Number(e).toRadians(),o=t/a,s=o*Math.cos(i);let l=r+s;Math.abs(l)>u/2&&(l=l>0?u-l:-u-l);const h=Math.log(Math.tan(l/2+u/4)/Math.tan(r/2+u/4)),d=Math.abs(h)>1e-11?s/h:Math.cos(r),p=n+o*Math.sin(i)/d,g=l.toDegrees(),f=p.toDegrees();return new c(g,f)}rhumbMidpointTo(t){t instanceof c||(t=c.parse(t));const e=this.lat.toRadians();let a=this.lon.toRadians();const r=t.lat.toRadians(),n=t.lon.toRadians();Math.abs(n-a)>u&&(a+=2*u);const i=(e+r)/2,o=Math.tan(u/4+e/2),s=Math.tan(u/4+r/2),l=Math.tan(u/4+i/2);let h=((n-a)*Math.log(l)+a*Math.log(s)-n*Math.log(o))/Math.log(s/o);isFinite(h)||(h=(a+n)/2);const d=i.toDegrees(),p=h.toDegrees();return new c(d,p)}static areaOf(t,e=6371e3){const a=e,r=t[0].equals(t[t.length-1]);r||t.push(t[0]);const n=t.length-1;let i=0;for(let e=0;e<n;e++){const a=t[e].lat.toRadians(),r=t[e+1].lat.toRadians(),n=(t[e+1].lon-t[e].lon).toRadians();i+=2*Math.atan2(Math.tan(n/2)*(Math.tan(a/2)+Math.tan(r/2)),1+Math.tan(a/2)*Math.tan(r/2))}(function(t){let e=0,a=t[0].initialBearingTo(t[1]);for(let r=0;r<t.length-1;r++){const n=t[r].initialBearingTo(t[r+1]),i=t[r].finalBearingTo(t[r+1]);e+=(n-a+540)%360-180,e+=(i-n+540)%360-180,a=i}const r=t[0].initialBearingTo(t[1]);e+=(r-a+540)%360-180;return Math.abs(e)<90})(t)&&(i=Math.abs(i)-2*u);const o=Math.abs(i*a*a);return r||t.pop(),o}equals(t){return t instanceof c||(t=c.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON)&&!(Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);if("n"==t)return null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`;return`${h.toLat(this.lat,t,e)}, ${h.toLon(this.lon,t,e)}`}}function d(t,e,a){if(null!==t)for(var r,n,i,o,s,l,h,u,c=0,p=0,g=t.type,f="FeatureCollection"===g,y="Feature"===g,m=f?t.features.length:1,v=0;v<m;v++){s=(u=!!(h=f?t.features[v].geometry:y?t.geometry:t)&&"GeometryCollection"===h.type)?h.geometries.length:1;for(var M=0;M<s;M++){var b=0,w=0;if(null!==(o=u?h.geometries[M]:h)){l=o.coordinates;var x=o.type;switch(c=0,x){case null:break;case"Point":if(!1===e(l,p,v,b,w))return!1;p++,b++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===e(l[r],p,v,b,w))return!1;p++,"MultiPoint"===x&&b++}"LineString"===x&&b++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(n=0;n<l[r].length-c;n++){if(!1===e(l[r][n],p,v,b,w))return!1;p++}"MultiLineString"===x&&b++,"Polygon"===x&&w++}"Polygon"===x&&b++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(w=0,n=0;n<l[r].length;n++){for(i=0;i<l[r][n].length-c;i++){if(!1===e(l[r][n][i],p,v,b,w))return!1;p++}w++}b++}break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===d(o.geometries[r],e))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var p=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const a=[1/0,1/0,-1/0,-1/0];return d(t,t=>{a[0]>t[0]&&(a[0]=t[0]),a[1]>t[1]&&(a[1]=t[1]),a[2]<t[0]&&(a[2]=t[0]),a[3]<t[1]&&(a[3]=t[1])}),a},g=(t,e)=>{var[a,r]=t,[n,i]=e,o=new c(r,a),s=new c(i,n);return o.distanceTo(s)},f=t=>{var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var a=Number.parseFloat(e.toFixed(1)),r=1===a?"mile":"miles";return"".concat(a," ").concat(r)}var n=Math.round(e);return"".concat(n," miles")},y=(t,e,a)=>{var[r,n]=e,i=a.filter(e=>{var[a,i]=e;return(a!==r||i!==n)&&((t,e,a)=>{switch(t){case"ArrowUp":return a<0&&Math.abs(a)>=Math.abs(e);case"ArrowDown":return a>0&&Math.abs(a)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(a);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(a);default:return!1}})(t,a-r,i-n)});if(!i.length)return a.findIndex(t=>t[0]===r&&t[1]===n);var o=-1,s=1/0;return i.forEach(t=>{var e=t[0]-r,i=t[1]-n,l=e*e+i*i;l<s&&(s=l,o=a.indexOf(t))}),o},m=t=>p(t);function v(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function M(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?v(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var b="highlighted-label";function w(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var{stops:a}=t;if(a.length<2)return a.length>0?a[0][1]:0;for(var r=a[0],n=a[a.length-1],i=1;i<a.length;i++){var o=a[i];if(o[0]>e){n=o,r=a[i-1];break}r=a[i-1],n=o}var[s,l]=r,[h,u]=n;return e<=s?l:e>=h?u:l+(e-s)/(h-s)*(u-l)}(t,e);var[,,a,...r]=t;if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var n=0;n<r.length-2;n+=2){var i=r[n],o=r[n+1],s=r[n+2],l=r[n+3];if(e<=i)return o;if(e<=s)return o+(e-i)/(s-i)*(l-o)}return r[r.length-1]}function x(t,e,a){return e.flatMap(e=>{var r,n=function(t){var e,a;return"string"==typeof t?null===(e=/^{(.+)}$/.exec(t))||void 0===e?void 0:e[1]:Array.isArray(t)?null===(a=t.find(t=>Array.isArray(t)&&"get"===t[0]))||void 0===a?void 0:a[1]:null}(null===(r=e.layout)||void 0===r?void 0:r["text-field"]);return n?a.filter(t=>{var a;return t.layer.id===e.id&&(null===(a=t.properties)||void 0===a?void 0:a[n])}).map(a=>function(t,e,a,r){var n=function(t){var{type:e,coordinates:a}=t;if("Point"===e)return a;if("MultiPoint"===e)return a[0];if(e.includes("LineString")){var r="LineString"===e?a:a[0];return[(r[0][0]+r[r.length-1][0])/2,(r[0][1]+r[r.length-1][1])/2]}if(e.includes("Polygon")){var n="Polygon"===e?a[0]:a[0][0],i=n.reduce((t,e)=>[t[0]+e[0],t[1]+e[1]],[0,0]);return[i[0]/n.length,i[1]/n.length]}return null}(t.geometry);if(!n)return null;var i=r.project({lng:n[0],lat:n[1]});return{text:t.properties[a],x:i.x,y:i.y,feature:t,layer:e}}(a,e,n,t)).filter(Boolean):[]})}function P(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function N(t,e,a){var r;if(null!=e&&null!==(r=e.feature)&&void 0!==r&&r.layer){P(t,a);var{feature:n,layer:i}=e;a.highlightLayerId="highlight-".concat(i.id);var{id:o,type:s,properties:l,geometry:h}=n;t.getSource(b).setData({id:o,type:s,properties:l,geometry:h}),a.highlightedExpr=i.layout["text-size"];var u=t.getZoom(),c=function(t,e,a){return{id:"highlight-".concat(t.id),type:t.type,source:b,layout:M(M({},t.layout),{},{"text-size":e,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:M(M({},t.paint),{},{"text-color":a.text,"text-halo-color":a.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})}}(i,1.5*w(a.highlightedExpr,u),a.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"});t.addLayer(c),t.moveLayer(a.highlightLayerId)}}function S(t){t.getSource(b)||t.addSource(b,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function E(t){t.getStyle().layers.filter(t=>{var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(e=>t.setLayoutProperty(e.id,"symbol-placement","line-center"))}function L(t,e,a,r){var n={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function i(){var e=t.getStyle().layers.filter(t=>"symbol"===t.type),a=t.queryRenderedFeatures({layers:e.map(t=>t.id)});n.labels=x(t,e,a)}function o(){if(i(),!n.labels.length)return null;var e=t.project(t.getCenter()),a=function(t,e){var a;return null===(a=t.reduce((t,a)=>{var r=(a.x-e.x)**2+(a.y-e.y)**2;return!t||r<t.dist?{label:a,dist:r}:t},null))||void 0===a?void 0:a.label}(n.labels,e);return n.currentPixel={x:a.x,y:a.y},N(t,a,n),"".concat(a.text," (").concat(a.layer.id,")")}return E(t),S(t),null==r||r.on(a.MAP_SET_STYLE,e=>{t.once("styledata",()=>t.once("idle",()=>{E(t),S(t),n.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)}))}),t.on("zoom",()=>{if(n.highlightLayerId&&n.highlightedExpr){var e=w(n.highlightedExpr,t.getZoom());t.setLayoutProperty(n.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(t=>"symbol"===t.type).forEach(e=>{t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:i,highlightNextLabel:function(e){if(i(),!n.labels.length)return null;if(!n.currentPixel)return o();var a=function(t,e){if(!e.currentPixel)return null;var a=e.labels.map((t,e)=>({pixel:[t.x,t.y],index:e})).filter(t=>t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y);if(!a.length)return null;var r=a.map(t=>t.pixel),n=y(t,[e.currentPixel.x,e.currentPixel.y],r);return(null==n||n<0||n>=a.length)&&(n=0),e.labels[a[n].index]}(e,n);return a?(n.currentPixel={x:a.x,y:a.y},N(t,a,n),"".concat(a.text," (").concat(a.layer.id,")")):null},highlightLabelAtCenter:o,clearHighlightedLabel:()=>P(t,n)}}function R(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function O(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?R(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var I="icon-image",T="active-highlight",D="active-highlight-inner",A="selected-highlight",j=(t,e)=>{var a,r;return null!==(a=null===(r=t._activeSymbolImageMap)||void 0===r?void 0:r[e])&&void 0!==a?a:null},_=(t,e)=>{var a,r;return null!==(a=null===(r=t._selectedSymbolImageMap)||void 0===r?void 0:r[e])&&void 0!==a?a:null},C=(t,e,a,r)=>{e.forEach(e=>{if(!a.has(e)){var n="".concat(r,"-").concat(e);["".concat(n,"-fill"),"".concat(n,"-line"),"".concat(n,"-symbol")].forEach(e=>{t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})},k=(t,e)=>{var a="_".concat(e.replaceAll("-",""),"Sources");C(t,t[a]||new Set,new Set,e),t[a]=new Set},F=(t,e,a,r,n,i,o)=>{!!t.getLayer(e)||t.addLayer(O(O({id:e,type:a,source:r},n&&{"source-layer":n}),{},{paint:i})),Object.entries(i).forEach(a=>{var[r,n]=a;t.setPaintProperty(e,r,n)}),t.setFilter(e,o),t.moveLayer(e)},B=(t,e,a,r,n,i,o)=>{var s=t.getLayoutProperty(n,I),l=o(t,s);l&&((t,e,a,r,n,i,o)=>{var s;t.getLayer(e)||t.addLayer(O(O({id:e,type:"symbol",source:a},r&&{"source-layer":r}),{},{layout:{[I]:i,"icon-anchor":null!==(s=t.getLayoutProperty(n,"icon-anchor"))&&void 0!==s?s:"center","icon-allow-overlap":!0}})),t.setLayoutProperty(e,I,i),t.setFilter(e,o),t.moveLayer(e)})(t,"".concat(e,"-symbol"),a,r,n,l,i)},z=(t,e,a,r,n,i)=>{var{ids:o,fillIds:s,idProperty:l,layerId:h,hasFillGeometry:u}=a[e],c=t.getLayer(h);if(c&&r[h]){var d=r[h],p=c.sourceLayer,g=u?"fill":c.type,f="".concat(n,"-").concat(e),{fill:y}=d,m=n===A,v=(t=>t===A||t===D)(n),{lineColor:M,lineWidth:b}=((t,e)=>({lineColor:e?t.selectionStroke:t.stroke,lineWidth:e?t.strokeWidth:t.activeStrokeWidth}))(d,v),w=l?["get",l]:["id"],x=["in",w,["literal",Array.from(o)]];if("fill-extrusion"!==c.type)switch(g){case"fill":((t,e,a,r,n)=>{var{isSelected:i,idExpression:o,fillIds:s,fill:l,lineColor:h,lineWidth:u,filter:c}=n;if(i){var d=[];s.forEach(t=>d.push(t));var p=["in",o,["literal",d]];F(t,"".concat(e,"-fill"),"fill",a,r,{"fill-color":l},p)}F(t,"".concat(e,"-line"),"line",a,r,{"line-color":h,"line-width":u},c)})(t,f,e,p,{isSelected:m,idExpression:w,fillIds:s,fill:y,lineColor:M,lineWidth:b,filter:x});break;case"line":((t,e,a,r,n,i,o)=>{t.getLayer("".concat(e,"-fill"))&&t.setFilter("".concat(e,"-fill"),["==","id",""]),F(t,"".concat(e,"-line"),"line",a,r,{"line-color":n,"line-width":i},o)})(t,f,e,p,M,b,x);break;case"symbol":((t,e,a,r,n,i,o)=>{B(t,e,a,r,n,i,o)})(t,f,e,p,h,x,i)}else((t,e,a,r)=>{var{ids:n,lineColor:i,lineWidth:o,idExpression:s}=r,l=[];n.forEach(t=>l.push(t));var h=["in",s,["literal",l]],{source:u,sourceLayer:c}=t.getLayer(a);F(t,"".concat(e,"-line"),"line",u,c,{"line-color":i,"line-width":o},h)})(t,f,h,{ids:o,lineColor:M,lineWidth:b,idExpression:w})}},W=(t,e,a,r,n)=>{var i=((t,e)=>{var a={};return null==e||e.forEach(e=>{var{featureId:r,layerId:n,idProperty:i,geometry:o}=e,s=t.getLayer(n);if(s){var l=s.source;a[l]||(a[l]={ids:new Set,fillIds:new Set,idProperty:i,layerId:n,hasFillGeometry:!1}),!o||"Polygon"!==o.type&&"MultiPolygon"!==o.type||(a[l].hasFillGeometry=!0,a[l].fillIds.add(r)),a[l].ids.add(r)}}),a})(t,e),o=new Set(Object.keys(i)),s="_".concat(r.replaceAll("-",""),"Sources"),l=t[s]||new Set;return C(t,l,o,r),t[s]=o,o.forEach(e=>z(t,e,i,a,r,n)),i};var q=(t,e,a)=>{var r=(e.x-a.x)**2+(e.y-a.y)**2;if(0===r)return(t.x-e.x)**2+(t.y-e.y)**2;var n=((t.x-e.x)*(a.x-e.x)+(t.y-e.y)*(a.y-e.y))/r;return n=Math.max(0,Math.min(1,n)),(t.x-(e.x+n*(a.x-e.x)))**2+(t.y-(e.y+n*(a.y-e.y)))**2},$=function(t,e){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{radius:r=10}=a,n=[[e.x-r,e.y-r],[e.x+r,e.y+r]],i=t.queryRenderedFeatures(n);if(0===i.length)return[];var o=new Set(t.queryRenderedFeatures([e.x,e.y]).map(t=>{var e,a=void 0===t.id?JSON.stringify(t.properties):t.id;return"".concat(null===(e=t.layer)||void 0===e?void 0:e.source,":").concat(a)})),s=[];i.forEach(t=>{!1===s.includes(t.layer.id)&&s.push(t.layer.id)});for(var l=new Set,h=[],u=i.length-1;u>=0;u--){var c,d=i[u],p=void 0===d.id?JSON.stringify(d.properties):d.id,g="".concat(null===(c=d.layer)||void 0===c?void 0:c.source,":").concat(p);!1===l.has(g)&&(l.add(g),h.push(d))}var f=t.unproject(e),y=[f.lng,f.lat],m=h.filter(t=>{var e=t.geometry.type;if(e.includes("Polygon"))return("Polygon"===e?[t.geometry.coordinates]:t.geometry.coordinates).some(t=>((t,e)=>{for(var[a,r]=t,n=!1,i=0,o=e.length-1;i<e.length;o=i,i++){var[s,l]=e[i],[h,u]=e[o];l>r!=u>r&&a<(h-s)*(r-l)/(u-l)+s&&(n=!n)}return n})(y,t[0]));if("Point"===e||"MultiPoint"===e){var a,r=void 0===t.id?JSON.stringify(t.properties):t.id;return o.has("".concat(null===(a=t.layer)||void 0===a?void 0:a.source,":").concat(r))}return!0});return m.map(a=>{var r=0,n=a.geometry.type,i=((t,e,a)=>{var{coordinates:r,type:n}=a,i=1/0,o=e=>t.project(e),s=t=>{for(var a=0;a<t.length-1;a++){var r=q(e,o(t[a]),o(t[a+1]));r<i&&(i=r)}};if("Point"===n){var l=o(r);i=(e.x-l.x)**2+(e.y-l.y)**2}else"LineString"===n||"MultiPoint"===n?"LineString"===n?s(r):r.forEach(t=>{var a=o(t),r=(e.x-a.x)**2+(e.y-a.y)**2;r<i&&(i=r)}):"Polygon"===n||"MultiLineString"===n?r.forEach(s):"MultiPolygon"===n&&r.forEach(t=>t.forEach(s));return i})(t,e,a.geometry);return r+=1e6*s.indexOf(a.layer.id),n.includes("Polygon")&&(r-=5e5),{f:a,score:r+=i}}).sort((t,e)=>t.score-e.score).map(t=>{var{f:e}=t;return e})},Z=function(){var t=a(function*(t,e,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2;e.length&&(t._activeSymbolImageMap={},t._selectedSymbolImageMap={},yield Promise.all(e.flatMap(e=>{var o=n.getSymbolImageId(e,r,!1,i),s=n.getSymbolImageId(e,r,!0,i);return o&&s&&(t._activeSymbolImageMap[o]=s),["normal","active","selected"].map(function(){var l=a(function*(a){var l="active"===a?s:o;if("selected"===a||l&&!t.hasImage(l)){var h=yield n.rasteriseSymbolImage(e,r,a,i);h&&("selected"===a&&o&&(t._selectedSymbolImageMap[o]=h.imageId),t.hasImage(h.imageId)||t.addImage(h.imageId,h.imageData,{pixelRatio:i}))}});return function(t){return l.apply(this,arguments)}}())})))});return function(e,a,r,n){return t.apply(this,arguments)}}(),G=t=>Math.max(2,2*t),H=(t,e)=>{if(!t)return null;if("string"==typeof t)return t.trim();if("object"==typeof t){if(e&&t[e])return t[e];var a=Object.values(t)[0];return null!=a?a:null}return null},V=new Map,J=function(){var t=a(function*(t,e,a,r){var n=a.getPatternInnerContent(t);if(!n)return null;var i=a.getPatternImageId(t,e,r);if(!i)return null;var o,s,l=V.get(i);if(!l){var h=H(t.fillPatternForegroundColor,e)||"black",u=H(t.fillPatternBackgroundColor,e)||"transparent",c=(o=h,s=u,n.replace(/\{\{foregroundColor\}\}/g,o||"black").replace(/\{\{backgroundColor\}\}/g,s||"transparent")),d='<rect width="16" height="16" fill="'.concat(u,'"/>'),p=G(r),g=Math.round(8*p),f='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(g,'" height="').concat(g,'" viewBox="0 0 16 16">').concat(d).concat(c,"</svg>");l=yield((t,e,a)=>new Promise((r,n)=>{var i="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),o=new Image(e,a);o.onload=()=>{var t=document.createElement("canvas");t.width=e,t.height=a;var n=t.getContext("2d");n.drawImage(o,0,0,e,a),r(n.getImageData(0,0,e,a))},o.onerror=()=>{n(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},o.src=i}))(f,g,g),V.set(i,l)}return{imageId:i,imageData:l}});return function(e,a,r,n){return t.apply(this,arguments)}}(),Y=function(){var t=a(function*(t,e,r,n,i){if(e.length){var o=G(i),s=e.reduce((e,s)=>{var l=n.getPatternImageId(s,r,i);return!l||e[l]||t.hasImage(l)||(e[l]=a(function*(){var e=yield J(s,r,n,i);e&&!t.hasImage(e.imageId)&&t.addImage(e.imageId,e.imageData,{pixelRatio:o})})),e},{});yield Promise.all(Object.values(s).map(t=>t()))}});return function(e,a,r,n,i){return t.apply(this,arguments)}}(),K=["container","padding","mapStyle","mapSize","center","zoom","bounds","pixelRatio"];function U(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,r)}return a}function X(e){for(var a=1;a<arguments.length;a++){var r=null!=arguments[a]?arguments[a]:{};a%2?U(Object(r),!0).forEach(function(a){t(e,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}class Q{constructor(t){var{mapFramework:e,mapProviderConfig:a={},events:r,eventBus:n}=t;this.maplibreModule=e,this.events=r,this.eventBus=n,this.capabilities={supportedShortcuts:i,supportsMapSizes:!0},Object.assign(this,a)}get name(){return"MapLibreProvider"}initMap(t){var r=this;return a(function*(){var{container:a,padding:n,mapStyle:i,mapSize:o,center:l,zoom:h,bounds:u,pixelRatio:c}=t,d=e(t,K);r.mapStyleId=null==i?void 0:i.id,r.mapSize=o;var{Map:p}=r.maplibreModule,{events:g,eventBus:f}=r,y=new p(X(X({},d),{},{container:a,style:null==i?void 0:i.url,pixelRatio:c,padding:n,center:l,zoom:h,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}));y.touchZoomRotate.disableRotation(),r.map=y,r.map.setPadding(n),u&&y.fitBounds(u,{duration:0}),function(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var a=t.getCanvas();if(a&&(this.target===a||a.contains(this.target)))return}e.call(this)}}(y),function(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block",e.addEventListener("focus",t=>{e.blur(),t.relatedTarget&&t.relatedTarget.focus({preventScroll:!0})})}(y),s({map:y,events:g,eventBus:f,getCenter:r.getCenter.bind(r),getZoom:r.getZoom.bind(r),getBounds:r.getBounds.bind(r),getResolution:r.getResolution.bind(r)}),function(t){var{mapProvider:e,map:a,events:r,eventBus:n}=t,i=t=>{a.once("style.load",()=>{n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:t.id})}),a.setStyle(t.url,{diff:!1})},o=t=>{a.setPixelRatio(t)},s=t=>{var{mapSize:a}=t;e.mapSize=a};n.on(r.MAP_SET_STYLE,i),n.on(r.MAP_SET_PIXEL_RATIO,o),n.on(r.MAP_SIZE_CHANGE,s)}({mapProvider:r,map:y,events:g,eventBus:f}),y.on("load",()=>{r.labelNavigator=L(y,null==i?void 0:i.mapColorScheme,g,f)}),r.eventBus.emit(g.MAP_READY,{map:r.map,mapStyleId:r.mapStyleId,mapSize:r.mapSize,crs:r.crs})})()}destroyMap(){var t,e;this.setHoverCursor([]),null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}setHoverCursor(t){this.map&&(this._onHoverMove=((t,e,a)=>{var r=t.getCanvas();if(a&&t.off("mousemove",a),null==e||!e.length)return r.style.cursor="",null;var n=a=>{var n=e.filter(e=>t.getLayer(e));if(0!==n.length){var{lineLayers:i,otherLayers:o}=((t,e)=>{var a=[],r=[];for(var n of e)if("line"===t.getLayer(n).type){var i=n.endsWith("-stroke")?n.slice(0,-7):null;null!==i&&e.includes(i)||a.push(n)}else r.push(n);return{lineLayers:a,otherLayers:r}})(t,n),{x:s,y:l}=a.point,h=[[s-10,l-10],[s+10,l+10]],u=i.length>0&&t.queryRenderedFeatures(h,{layers:i}).length>0,c=o.length>0&&t.queryRenderedFeatures(a.point,{layers:o}).length>0;r.style.cursor=u||c?"pointer":""}else r.style.cursor=""};return t.on("mousemove",n),n})(this.map,t,this._onHoverMove))}setView(t){var{center:e,zoom:a}=t;this.map.flyTo({center:e||this.getCenter(),zoom:a||this.getZoom(),duration:this.map.isStyleLoaded()?r:0})}zoomIn(t){this.map.easeTo({zoom:this.getZoom()+t,duration:r})}zoomOut(t){this.map.easeTo({zoom:this.getZoom()-t,duration:r})}panBy(t){this.map.panBy(t,{duration:r})}fitToBounds(t){var e=Array.isArray(t)?t:m(t),a=this.map.isStyleLoaded()?r:0;this.map.fitBounds(e,{duration:a})}setPadding(t){this.map.setPadding(t)}updateHighlightedFeatures(t,e,a){var{LngLatBounds:r}=this.maplibreModule;return function(t){var{LngLatBounds:e,map:a,selectedFeatures:r,activeFeatures:n,stylesMap:i}=t;if(!a)return null;null!=n&&n.length?(W(a,n,i,T,j),W(a,n,i,D,_)):(k(a,T),k(a,D));var o={};null!=r&&r.length?o=W(a,r,i,A,_):k(a,A);var s=[];return Object.entries(o).forEach(t=>{var[,{ids:e,idProperty:r,layerId:n}]=t;s.push(...a.queryRenderedFeatures({layers:[n]}).filter(t=>{var a;return e.has(r?null===(a=t.properties)||void 0===a?void 0:a[r]:t.id)}))}),((t,e)=>{if(!e.length)return null;var a=new t;return e.forEach(t=>{var e=t=>"number"==typeof t[0]?a.extend(t):t.forEach(e);e(t.geometry.coordinates)}),[a.getWest(),a.getSouth(),a.getEast(),a.getNorth()]})(e,s)}({LngLatBounds:r,map:this.map,selectedFeatures:t,activeFeatures:e,stylesMap:a})}highlightNextLabel(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}highlightLabelAtCenter(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}clearHighlightedLabel(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}getCenter(){var t=this.map.getCenter();return[Number(t.lng.toFixed(n)),Number(t.lat.toFixed(n))]}getZoom(){return Number(this.map.getZoom().toFixed(n))}getBounds(){return this.map.getBounds().toArray().flat(1)}getFeaturesAtPoint(t,e){return $(this.map,t,e)}getVisibleFeatures(t){var e=t.filter(t=>this.map.getLayer(t));return e.length?this.map.queryRenderedFeatures(void 0,{layers:e}):[]}addSymbolsToMap(t,e,r){var n=this;return a(function*(){var a=n.map.getPixelRatio()||1;return Z(n.map,t,e,r,a)})()}addPatternsToMap(t,e,r){var n=this;return a(function*(){var a=n.map.getPixelRatio()||1;return Y(n.map,t,e,r,a)})()}getAreaDimensions(){var{LngLatBounds:t}=this.maplibreModule;return(t=>{var e,a,r,n;if(t&&"function"==typeof t.getWest)e=t.getWest(),a=t.getSouth(),r=t.getEast(),n=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";[[e,a],[r,n]]=t}var i=g([e,a],[r,a]),o=g([e,a],[e,n]),s=f(i),l=f(o);return"".concat(l," by ").concat(s)})(((t,e)=>{var{width:a,height:r}=e.getContainer().getBoundingClientRect(),n=e.getPadding(),i=[n.left,r-n.bottom],o=[a-n.right,n.top];return new t(e.unproject(i),e.unproject(o))})(t,this.map))}getCardinalMove(t,e){return((t,e)=>{var[a,r]=t,[n,i]=e,o=i-r,s=n-a,l=[];if(Math.abs(o)>1e-4){var h=Math.round(g([a,r],[a,i]));l.push("".concat(o>0?"north":"south"," ").concat(f(h)))}if(Math.abs(s)>1e-4){var u=Math.round(g([a,r],[n,r]));l.push("".concat(s>0?"east":"west"," ").concat(f(u)))}return l.join(", ")})(t,e)}getResolution(){return t=this.map.getCenter(),e=this.map.getZoom(),a=t.lat,r=Math.pow(2,e),40075016.686*Math.cos(a*Math.PI/180)/(512*r);var t,e,a,r}mapToScreen(t){return this.map.project(t)}screenToMap(t){var{lng:e,lat:a}=this.map.unproject([t.x,t.y]);return[e,a]}isGeometryObscured(t,e){return((t,e,a)=>{var r=a.getContainer().getBoundingClientRect(),[n,i,o,s]=m(t),l=[a.project([n,i]),a.project([n,s]),a.project([o,i]),a.project([o,s])],h=Math.min(...l.map(t=>t.x)),u=Math.max(...l.map(t=>t.x)),c=Math.min(...l.map(t=>t.y)),d=Math.max(...l.map(t=>t.y)),p=e.left-r.left,g=e.top-r.top,f=e.right-r.left,y=e.bottom-r.top;return h<f&&u>p&&c<y&&d>g})(t,e,this.map)}}export{Q as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-maplibre-provider.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[772],{419(t,e,r){r.r(e),r.d(e,{default:()=>Ft});var n=400,o=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function a(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block",e.addEventListener("focus",function(t){e.blur(),t.relatedTarget&&t.relatedTarget.focus({preventScroll:!0})})}function i(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var r=t.getCanvas();if(r&&(this.target===r||r.contains(this.target)))return}e.call(this)}}var l=function(t,e){var r=null,n=function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];clearTimeout(r),r=setTimeout(function(){t.apply(void 0,o)},e)};return n.cancel=function(){r&&(clearTimeout(r),r=null)},n};function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function s(t){var e=t.map,r=t.events,n=t.eventBus,o=t.getCenter,a=t.getZoom,i=t.getBounds,s=t.getResolution,c=[],f=[],h=function(){var t=a();return{center:o(),bounds:i(),resolution:s(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return n.emit(t,e)},y=function(){return p(r.MAP_LOADED)};e.on("load",y),c.push(["load",y]),e.once("idle",function(){return p(r.MAP_FIRST_IDLE,h())});var d=function(){return p(r.MAP_MOVE_START)};e.on("movestart",d),c.push(["movestart",d]);var g=l(function(){p(r.MAP_MOVE_END,h())},500);e.on("moveend",g),c.push(["moveend",g]);var v,m,b=(v=function(){p(r.MAP_MOVE,h())},m=0,function(){var t=Date.now();t-m>=10&&(m=t,v.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]);var M=function(){return p(r.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=l(function(){p(r.MAP_DATA_CHANGE,h())},500),S=function(t){t.isSourceLoaded&&w()};e.on("styledata",w),e.on("sourcedata",S),c.push(["styledata",w],["sourcedata",S]);var P=function(){return p(r.MAP_STYLE_CHANGE)};e.on("style.load",P),c.push(["style.load",P]);var x=function(t){return p(r.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",x),c.push(["click",x]),f.push(g,b,w),{remove:function(){f.forEach(function(t){return t.cancel()}),c.forEach(function(t){var r,n,o=(n=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],i=o[1];return e.off(a,i)})}}}function c(t){var e=t.mapProvider,r=t.map,n=t.events,o=t.eventBus,a=function(t){r.once("style.load",function(){o.emit(n.MAP_STYLE_CHANGE,{mapStyleId:t.id})}),r.setStyle(t.url,{diff:!1})},i=function(t){r.setPixelRatio(t)},l=function(t){var r=t.mapSize;e.mapSize=r};return o.on(n.MAP_SET_STYLE,a),o.on(n.MAP_SET_PIXEL_RATIO,i),o.on(n.MAP_SIZE_CHANGE,l),{remove:function(){o.off(n.MAP_SET_STYLE,a),o.off(n.MAP_SET_PIXEL_RATIO,i),o.off(n.MAP_SIZE_CHANGE,l)}}}let f=" ";class h{static get separator(){return f}static set separator(t){f=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,o=null,a=null,i=null;switch(e){default:case"d":case"deg":o=t.toFixed(r),o<100&&(o="0"+o),o<10&&(o="0"+o),n=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),a=(60*t%60).toFixed(r),60==a&&(a=(0).toFixed(r),o++),o=("000"+o).slice(-3),a<10&&(a="0"+a),n=o+"°"+h.separator+a+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),a=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),a++),60==a&&(a=0,o++),o=("000"+o).slice(-3),a=("00"+a).slice(-2),i<10&&(i="0"+i),n=o+"°"+h.separator+a+"′"+h.separator+i+"″"}return n}static toLat(t,e,r){const n=h.toDms(h.wrap90(t),e,r);return null===n?"–":n.slice(1)+h.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=h.toDms(h.wrap180(t),e,r);return null===n?"–":n+h.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=h.toDms(h.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=h.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const p=h,y=Math.PI;class d{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=p.wrap90(Number(t)),this._lon=p.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,r;if(2==t.length&&([e,r]=t,e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,r]=t[0].split(","),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const n=t[0];if("Point"==n.type&&Array.isArray(n.coordinates)?[r,e]=n.coordinates:(null!=n.latitude&&(e=n.latitude),null!=n.lat&&(e=n.lat),null!=n.longitude&&(r=n.longitude),null!=n.lng&&(r=n.lng),null!=n.lon&&(r=n.lon),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r))),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${t.toString()}’`);return new d(e,r)}distanceTo(t,e=6371e3){if(t instanceof d||(t=d.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const r=e,n=this.lat.toRadians(),o=this.lon.toRadians(),a=t.lat.toRadians(),i=a-n,l=t.lon.toRadians()-o,u=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2);return r*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))}initialBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),o=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n),a=Math.sin(n)*Math.cos(r),i=Math.atan2(a,o).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof d||(t=d.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),o=(t.lon-this.lon).toRadians(),a=Math.cos(e),i=Math.sin(e),l={x:a+Math.cos(n)*Math.cos(o),y:0+Math.cos(n)*Math.sin(o),z:i+Math.sin(n)},u=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),s=r+Math.atan2(l.y,l.x),c=u.toDegrees(),f=s.toDegrees();return new d(c,f)}intermediatePointTo(t,e){if(t instanceof d||(t=d.parse(t)),this.equals(t))return new d(this.lat,this.lon);const r=this.lat.toRadians(),n=this.lon.toRadians(),o=t.lat.toRadians(),a=t.lon.toRadians(),i=o-r,l=a-n,u=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2),s=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),c=Math.sin((1-e)*s)/Math.sin(s),f=Math.sin(e*s)/Math.sin(s),h=c*Math.cos(r)*Math.cos(n)+f*Math.cos(o)*Math.cos(a),p=c*Math.cos(r)*Math.sin(n)+f*Math.cos(o)*Math.sin(a),y=c*Math.sin(r)+f*Math.sin(o),g=Math.atan2(y,Math.sqrt(h*h+p*p)),v=Math.atan2(p,h),m=g.toDegrees(),b=v.toDegrees();return new d(m,b)}destinationPoint(t,e,r=6371e3){const n=t/r,o=Number(e).toRadians(),a=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(a)*Math.cos(n)+Math.cos(a)*Math.sin(n)*Math.cos(o),u=Math.asin(l),s=Math.sin(o)*Math.sin(n)*Math.cos(a),c=Math.cos(n)-Math.sin(a)*l,f=i+Math.atan2(s,c),h=u.toDegrees(),p=f.toDegrees();return new d(h,p)}static intersection(t,e,r,n){if(t instanceof d||(t=d.parse(t)),r instanceof d||(r=d.parse(r)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(n))throw new TypeError(`invalid brng2 ‘${n}’`);const o=t.lat.toRadians(),a=t.lon.toRadians(),i=r.lat.toRadians(),l=r.lon.toRadians(),u=Number(e).toRadians(),s=Number(n).toRadians(),c=i-o,f=l-a,h=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(o)*Math.cos(i)*Math.sin(f/2)*Math.sin(f/2)));if(Math.abs(h)<Number.EPSILON)return new d(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(o)*Math.cos(h))/(Math.sin(h)*Math.cos(o)),g=(Math.sin(o)-Math.sin(i)*Math.cos(h))/(Math.sin(h)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=u-(Math.sin(l-a)>0?v:2*y-v),M=(Math.sin(l-a)>0?2*y-m:m)-s;if(0==Math.sin(b)&&0==Math.sin(M))return null;if(Math.sin(b)*Math.sin(M)<0)return null;const w=-Math.cos(b)*Math.cos(M)+Math.sin(b)*Math.sin(M)*Math.cos(h),S=Math.atan2(Math.sin(h)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),P=Math.asin(Math.min(Math.max(Math.sin(o)*Math.cos(S)+Math.cos(o)*Math.sin(S)*Math.cos(u),-1),1)),x=a+Math.atan2(Math.sin(u)*Math.sin(S)*Math.cos(o),Math.cos(S)-Math.sin(o)*Math.sin(P)),O=P.toDegrees(),E=x.toDegrees();return new d(O,E)}crossTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const o=t.distanceTo(this,n)/n,a=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(o)*Math.sin(a-i))*n}alongTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const o=t.distanceTo(this,n)/n,a=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(o)*Math.sin(a-i));return Math.acos(Math.cos(o)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-a))*n}maxLatitude(t){const e=Number(t).toRadians(),r=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(r))).toDegrees()}static crossingParallels(t,e,r){if(t.equals(e))return null;const n=Number(r).toRadians(),o=t.lat.toRadians(),a=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-a,u=Math.sin(o)*Math.cos(i)*Math.cos(n)*Math.sin(l),s=Math.sin(o)*Math.cos(i)*Math.cos(n)*Math.cos(l)-Math.cos(o)*Math.sin(i)*Math.cos(n),c=Math.cos(o)*Math.cos(i)*Math.sin(n)*Math.sin(l);if(c*c>u*u+s*s)return null;const f=Math.atan2(-s,u),h=Math.acos(c/Math.sqrt(u*u+s*s)),y=a+f+h,d=(a+f-h).toDegrees(),g=y.toDegrees();return{lon1:p.wrap180(d),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof d||(t=d.parse(t));const r=e,n=this.lat.toRadians(),o=t.lat.toRadians(),a=o-n;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>y&&(i=i>0?-(2*y-i):2*y+i);const l=Math.log(Math.tan(o/2+y/4)/Math.tan(n/2+y/4)),u=Math.abs(l)>1e-11?a/l:Math.cos(n);return Math.sqrt(a*a+u*u*i*i)*r}rhumbBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians();let n=(t.lon-this.lon).toRadians();Math.abs(n)>y&&(n=n>0?-(2*y-n):2*y+n);const o=Math.log(Math.tan(r/2+y/4)/Math.tan(e/2+y/4)),a=Math.atan2(n,o).toDegrees();return p.wrap360(a)}rhumbDestinationPoint(t,e,r=6371e3){const n=this.lat.toRadians(),o=this.lon.toRadians(),a=Number(e).toRadians(),i=t/r,l=i*Math.cos(a);let u=n+l;Math.abs(u)>y/2&&(u=u>0?y-u:-y-u);const s=Math.log(Math.tan(u/2+y/4)/Math.tan(n/2+y/4)),c=Math.abs(s)>1e-11?l/s:Math.cos(n),f=o+i*Math.sin(a)/c,h=u.toDegrees(),p=f.toDegrees();return new d(h,p)}rhumbMidpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians();let r=this.lon.toRadians();const n=t.lat.toRadians(),o=t.lon.toRadians();Math.abs(o-r)>y&&(r+=2*y);const a=(e+n)/2,i=Math.tan(y/4+e/2),l=Math.tan(y/4+n/2),u=Math.tan(y/4+a/2);let s=((o-r)*Math.log(u)+r*Math.log(l)-o*Math.log(i))/Math.log(l/i);isFinite(s)||(s=(r+o)/2);const c=a.toDegrees(),f=s.toDegrees();return new d(c,f)}static areaOf(t,e=6371e3){const r=e,n=t[0].equals(t[t.length-1]);n||t.push(t[0]);const o=t.length-1;let a=0;for(let e=0;e<o;e++){const r=t[e].lat.toRadians(),n=t[e+1].lat.toRadians(),o=(t[e+1].lon-t[e].lon).toRadians();a+=2*Math.atan2(Math.tan(o/2)*(Math.tan(r/2)+Math.tan(n/2)),1+Math.tan(r/2)*Math.tan(n/2))}(function(t){let e=0,r=t[0].initialBearingTo(t[1]);for(let n=0;n<t.length-1;n++){const o=t[n].initialBearingTo(t[n+1]),a=t[n].finalBearingTo(t[n+1]);e+=(o-r+540)%360-180,e+=(a-o+540)%360-180,r=a}return e+=(t[0].initialBearingTo(t[1])-r+540)%360-180,Math.abs(e)<90})(t)&&(a=Math.abs(a)-2*y);const i=Math.abs(a*r*r);return n||t.pop(),i}equals(t){return t instanceof d||(t=d.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`):`${p.toLat(this.lat,t,e)}, ${p.toLon(this.lon,t,e)}`}}function g(t,e,r){if(null!==t)for(var n,o,a,i,l,u,s,c,f=0,h=0,p=t.type,y="FeatureCollection"===p,d="Feature"===p,v=y?t.features.length:1,m=0;m<v;m++){l=(c=!!(s=y?t.features[m].geometry:d?t.geometry:t)&&"GeometryCollection"===s.type)?s.geometries.length:1;for(var b=0;b<l;b++){var M=0,w=0;if(null!==(i=c?s.geometries[b]:s)){u=i.coordinates;var S=i.type;switch(f=!r||"Polygon"!==S&&"MultiPolygon"!==S?0:1,S){case null:break;case"Point":if(!1===e(u,h,m,M,w))return!1;h++,M++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],h,m,M,w))return!1;h++,"MultiPoint"===S&&M++}"LineString"===S&&M++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(o=0;o<u[n].length-f;o++){if(!1===e(u[n][o],h,m,M,w))return!1;h++}"MultiLineString"===S&&M++,"Polygon"===S&&w++}"Polygon"===S&&M++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(w=0,o=0;o<u[n].length;o++){for(a=0;a<u[n][o].length-f;a++){if(!1===e(u[n][o][a],h,m,M,w))return!1;h++}w++}M++}break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===g(i.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var v=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const r=[1/0,1/0,-1/0,-1/0];return g(t,t=>{r[0]>t[0]&&(r[0]=t[0]),r[1]>t[1]&&(r[1]=t[1]),r[2]<t[0]&&(r[2]=t[0]),r[3]<t[1]&&(r[3]=t[1])}),r};function m(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||M(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(t,e){if(t){if("string"==typeof t)return w(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var S=function(t,e){var r=b(t,2),n=r[0],o=r[1],a=b(e,2),i=a[0],l=a[1],u=new d(o,n),s=new d(l,i);return u.distanceTo(s)},P=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var r=Number.parseFloat(e.toFixed(1)),n=1===r?"mile":"miles";return"".concat(r," ").concat(n)}var o=Math.round(e);return"".concat(o," miles")},x=function(t){return v(t)};function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=N(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function I(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var L="highlighted-label";function k(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var r=t.stops;if(r.length<2)return r.length>0?r[0][1]:0;for(var n=r[0],o=r[r.length-1],a=1;a<r.length;a++){var i=r[a];if(i[0]>e){o=i,n=r[a-1];break}n=r[a-1],o=i}var l=O(n,2),u=l[0],s=l[1],c=O(o,2),f=c[0],h=c[1];return e<=u?s:e>=f?h:s+(e-u)/(f-u)*(h-s)}(t,e);var r,n=function(t){if(Array.isArray(t))return t}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return I(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[2],a=I(n).slice(3);if("zoom"!==o[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<a.length-2;i+=2){var l=a[i],u=a[i+1],s=a[i+2],c=a[i+3];if(e<=l)return u;if(e<=s)return u+(e-l)/(s-l)*(c-u)}return a[a.length-1]}function R(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function _(t,e,r){var n,o,a,i;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){R(t,r);var l=e.feature,u=e.layer;r.highlightLayerId="highlight-".concat(u.id);var s=l.id,c=l.type,f=l.properties,h=l.geometry;t.getSource(L).setData({id:s,type:c,properties:f,geometry:h}),r.highlightedExpr=u.layout["text-size"];var p=t.getZoom(),y=(o=u,a=1.5*k(r.highlightedExpr,p),i=r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(o.id),type:o.type,source:L,layout:A(A({},o.layout),{},{"text-size":a,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:A(A({},o.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(y),t.moveLayer(r.highlightLayerId)}}function D(t){t.getSource(L)||t.addSource(L,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function C(t){t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){return t.setLayoutProperty(e.id,"symbol-placement","line-center")})}function F(t,e,r,n){var o={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function a(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),r=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});o.labels=function(t,e,r){return e.flatMap(function(e){var n,o,a,i,l="string"==typeof(o=null===(n=e.layout)||void 0===n?void 0:n["text-field"])?null===(a=/^{(.+)}$/.exec(o))||void 0===a?void 0:a[1]:Array.isArray(o)?null===(i=o.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===i?void 0:i[1]:null;return l?r.filter(function(t){var r;return t.layer.id===e.id&&(null===(r=t.properties)||void 0===r?void 0:r[l])}).map(function(r){return function(t,e,r,n){var o=function(t){var e=t.type,r=t.coordinates;if("Point"===e)return r;if("MultiPoint"===e)return r[0];if(e.includes("LineString")){var n="LineString"===e?r:r[0];return[(n[0][0]+n[n.length-1][0])/2,(n[0][1]+n[n.length-1][1])/2]}if(e.includes("Polygon")){var o="Polygon"===e?r[0]:r[0][0],a=o.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[a[0]/o.length,a[1]/o.length]}return null}(t.geometry);if(!o)return null;var a=n.project({lng:o[0],lat:o[1]});return{text:t.properties[r],x:a.x,y:a.y,feature:t,layer:e}}(r,e,l,t)}).filter(Boolean):[]})}(t,e,r)}function i(){if(a(),!o.labels.length)return null;var e=t.project(t.getCenter()),r=function(t,e){var r;return null===(r=t.reduce(function(t,r){var n=Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2);return!t||n<t.dist?{label:r,dist:n}:t},null))||void 0===r?void 0:r.label}(o.labels,e);return o.currentPixel={x:r.x,y:r.y},_(t,r,o),"".concat(r.text," (").concat(r.layer.id,")")}return C(t),D(t),null==n||n.on(r.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){C(t),D(t),o.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(o.highlightLayerId&&o.highlightedExpr){var e=k(o.highlightedExpr,t.getZoom());t.setLayoutProperty(o.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(function(t){return"symbol"===t.type}).forEach(function(e){t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:a,highlightNextLabel:function(e){if(a(),!o.labels.length)return null;if(!o.currentPixel)return i();var r=function(t,e){if(!e.currentPixel)return null;var r=e.labels.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y});if(!r.length)return null;var n=r.map(function(t){return t.pixel}),o=function(t,e,r){var n=b(e,2),o=n[0],a=n[1],i=r.filter(function(e){var r=b(e,2),n=r[0],i=r[1];return(n!==o||i!==a)&&function(t,e,r){switch(t){case"ArrowUp":return r<0&&Math.abs(r)>=Math.abs(e);case"ArrowDown":return r>0&&Math.abs(r)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(r);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(r);default:return!1}}(t,n-o,i-a)});if(!i.length)return r.findIndex(function(t){return t[0]===o&&t[1]===a});var l=-1,u=1/0;return i.forEach(function(t){var e=t[0]-o,n=t[1]-a,i=e*e+n*n;i<u&&(u=i,l=r.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],n);return(null==o||o<0||o>=r.length)&&(o=0),e.labels[r[o].index]}(e,o);return r?(o.currentPixel={x:r.x,y:r.y},_(t,r,o),"".concat(r.text," (").concat(r.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return R(t,o)}}}function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function G(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||z(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||z(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(t,e){if(t){if("string"==typeof t)return q(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function W(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?W(Object(r),!0).forEach(function(e){H(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):W(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function H(t,e,r){return(e=function(t){var e=function(t){if("object"!=B(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var U="icon-image",V="active-highlight",Y="active-highlight-inner",J="selected-highlight",K=function(t,e){var r,n;return null!==(r=null===(n=t._activeSymbolImageMap)||void 0===n?void 0:n[e])&&void 0!==r?r:null},X=function(t,e){var r,n;return null!==(r=null===(n=t._selectedSymbolImageMap)||void 0===n?void 0:n[e])&&void 0!==r?r:null},Q=function(t,e,r,n){e.forEach(function(e){if(!r.has(e)){var o="".concat(n,"-").concat(e);["".concat(o,"-fill"),"".concat(o,"-line"),"".concat(o,"-symbol")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})},tt=function(t,e){var r="_".concat(e.replaceAll("-",""),"Sources");Q(t,t[r]||new Set,new Set,e),t[r]=new Set},et=function(t,e,r,n,o,a,i){t.getLayer(e)||t.addLayer(Z(Z({id:e,type:r,source:n},o&&{"source-layer":o}),{},{paint:a})),Object.entries(a).forEach(function(r){var n=$(r,2),o=n[0],a=n[1];t.setPaintProperty(e,o,a)}),t.setFilter(e,i),t.moveLayer(e)},rt=function(t,e,r,n,o,a){var i=r[e],l=i.ids,u=i.fillIds,s=i.idProperty,c=i.layerId,f=i.hasFillGeometry,h=t.getLayer(c),p=h.sourceLayer,y=f?"fill":h.type,d="".concat(o,"-").concat(e),g=n[c];if(g){var v=g.stroke,m=g.selectionStroke,b=g.strokeWidth,M=g.activeStrokeWidth,w=g.fill,S=o===J,P=function(t){return t===J||t===Y}(o),x=P?m:v,O=P?b:M,E=s?["get",s]:["id"],N=["in",E,["literal",G(l)]];"fill"===y&&function(t,e,r,n,o){var a=o.fill,i=o.lineColor,l=o.lineWidth,u=o.filter;if(o.isSelected){var s=["in",o.idExpression,["literal",G(o.fillIds)]];et(t,"".concat(e,"-fill"),"fill",r,n,{"fill-color":a},s)}et(t,"".concat(e,"-line"),"line",r,n,{"line-color":i,"line-width":l},u)}(t,d,e,p,{isSelected:S,idExpression:E,fillIds:u,fill:w,lineColor:x,lineWidth:O,filter:N}),"line"===y&&(t.getLayer("".concat(d,"-fill"))&&t.setFilter("".concat(d,"-fill"),["==","id",""]),et(t,"".concat(d,"-line"),"line",e,p,{"line-color":x,"line-width":O},N)),"symbol"===y&&function(t,e,r,n,o,a,i){var l=t.getLayoutProperty(o,U),u=i(t,l);u&&function(t,e,r,n,o,a,i){var l;t.getLayer(e)||t.addLayer(Z(Z({id:e,type:"symbol",source:r},n&&{"source-layer":n}),{},{layout:H(H(H({},U,a),"icon-anchor",null!==(l=t.getLayoutProperty(o,"icon-anchor"))&&void 0!==l?l:"center"),"icon-allow-overlap",!0)})),t.setLayoutProperty(e,U,a),t.setFilter(e,i),t.moveLayer(e)}(t,"".concat(e,"-symbol"),r,n,o,u,a)}(t,d,e,p,c,N,a)}},nt=function(t,e,r,n,o){var a=function(t,e){var r={};return null==e||e.forEach(function(e){var n=e.featureId,o=e.layerId,a=e.idProperty,i=e.geometry,l=t.getLayer(o);if(l){var u=l.source;r[u]||(r[u]={ids:new Set,fillIds:new Set,idProperty:a,layerId:o,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(r[u].hasFillGeometry=!0,r[u].fillIds.add(n)),r[u].ids.add(n)}}),r}(t,e),i=new Set(Object.keys(a)),l="_".concat(n.replaceAll("-",""),"Sources"),u=t[l]||new Set;return Q(t,u,i,n),t[l]=i,i.forEach(function(e){return rt(t,e,a,r,n,o)}),a};function ot(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return at(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?at(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function at(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var it=function(t,e,r){var n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);if(0===n)return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2);var o=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return o=Math.max(0,Math.min(1,o)),Math.pow(t.x-(e.x+o*(r.x-e.x)),2)+Math.pow(t.y-(e.y+o*(r.y-e.y)),2)};function lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var ut=function(t,e,r){var n=t.getCanvas();if(r&&t.off("mousemove",r),null==e||!e.length)return n.style.cursor="",null;var o=function(r){var o=e.filter(function(e){return t.getLayer(e)});if(0!==o.length){var a=function(t,e){var r,n=[],o=[],a=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return lt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lt(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}(e);try{for(a.s();!(r=a.n()).done;){var i=r.value;if("line"===t.getLayer(i).type){var l=i.endsWith("-stroke")?i.slice(0,-7):null;null!==l&&e.includes(l)||n.push(i)}else o.push(i)}}catch(t){a.e(t)}finally{a.f()}return{lineLayers:n,otherLayers:o}}(t,o),i=a.lineLayers,l=a.otherLayers,u=r.point,s=u.x,c=u.y,f=[[s-10,c-10],[s+10,c+10]],h=i.length>0&&t.queryRenderedFeatures(f,{layers:i}).length>0,p=l.length>0&&t.queryRenderedFeatures(r.point,{layers:l}).length>0;n.style.cursor=h||p?"pointer":""}else n.style.cursor=""};return t.on("mousemove",o),o};function st(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof l?n:l,s=Object.create(u.prototype);return ct(s,"_invoke",function(r,n,o){var a,l,u,s=0,c=o||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return a=e,l=0,u=t,h.n=r,i}};function p(r,n){for(l=r,u=n,e=0;!f&&s&&!o&&e<c.length;e++){var o,a=c[e],p=h.p,y=a[2];r>3?(o=y===n)&&(u=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=t):a[0]<=p&&((o=r<2&&p<a[1])?(l=0,h.v=n,h.n=a[1]):p<y&&(o=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,l=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),l=c,u=y;(e=l<2?t:u)||!f;){a||(l?l<3?(l>1&&(h.n=-1),p(l,u)):h.n=u:h.v=u);try{if(s=2,a){if(l||(o="next"),e=a[o]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,l<2&&(l=0)}else 1===l&&(e=a.return)&&e.call(a),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=t}else if((e=(f=h.n<0)?u:r.call(n,h))!==i)break}catch(e){a=t,l=1,u=e}finally{s=1}}return{value:e,done:f}}}(r,o,a),!0),s}var i={};function l(){}function u(){}function s(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(ct(e={},n,function(){return this}),e),f=s.prototype=l.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,ct(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,ct(f,"constructor",s),ct(s,"constructor",u),u.displayName="GeneratorFunction",ct(s,o,"GeneratorFunction"),ct(f),ct(f,o,"Generator"),ct(f,n,function(){return this}),ct(f,"toString",function(){return"[object Generator]"}),(st=function(){return{w:a,m:h}})()}function ct(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ct=function(t,e,r,n){function a(e,r){ct(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},ct(t,e,r,n)}function ft(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function ht(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){ft(a,n,o,i,l,"next",t)}function l(t){ft(a,n,o,i,l,"throw",t)}i(void 0)})}}var pt=function(){var t=ht(st().m(function t(e,r,n,o){var a,i=arguments;return st().w(function(t){for(;;)switch(t.n){case 0:if(a=i.length>4&&void 0!==i[4]?i[4]:2,r.length){t.n=1;break}return t.a(2);case 1:return e._activeSymbolImageMap={},e._selectedSymbolImageMap={},t.n=2,Promise.all(r.flatMap(function(t){var r=o.getSymbolImageId(t,n,!1,a),i=o.getSymbolImageId(t,n,!0,a);return r&&i&&(e._activeSymbolImageMap[r]=i),["normal","active","selected"].map(function(){var l=ht(st().m(function l(u){var s,c;return st().w(function(l){for(;;)switch(l.n){case 0:if(s="active"===u?i:r,"selected"===u||s&&!e.hasImage(s)){l.n=1;break}return l.a(2);case 1:return l.n=2,o.rasteriseSymbolImage(t,n,u,a);case 2:(c=l.v)&&("selected"===u&&r&&(e._selectedSymbolImageMap[r]=c.imageId),e.hasImage(c.imageId)||e.addImage(c.imageId,c.imageData,{pixelRatio:a}));case 3:return l.a(2)}},l)}));return function(t){return l.apply(this,arguments)}}())}));case 2:return t.a(2)}},t)}));return function(e,r,n,o){return t.apply(this,arguments)}}(),yt=function(t){return Math.max(2,2*t)},dt=function(t,e,r){return t.replace(/\{\{foregroundColor\}\}/g,e||"black").replace(/\{\{backgroundColor\}\}/g,r||"transparent")};function gt(t){return gt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt(t)}var vt=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===gt(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null},mt=function(t,e,r){return new Promise(function(n,o){var a="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),i=new Image(e,r);i.onload=function(){var t=document.createElement("canvas");t.width=e,t.height=r;var o=t.getContext("2d");o.drawImage(i,0,0,e,r),n(o.getImageData(0,0,e,r))},i.onerror=function(){o(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},i.src=a})};function bt(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof l?n:l,s=Object.create(u.prototype);return Mt(s,"_invoke",function(r,n,o){var a,l,u,s=0,c=o||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return a=e,l=0,u=t,h.n=r,i}};function p(r,n){for(l=r,u=n,e=0;!f&&s&&!o&&e<c.length;e++){var o,a=c[e],p=h.p,y=a[2];r>3?(o=y===n)&&(u=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=t):a[0]<=p&&((o=r<2&&p<a[1])?(l=0,h.v=n,h.n=a[1]):p<y&&(o=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,l=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),l=c,u=y;(e=l<2?t:u)||!f;){a||(l?l<3?(l>1&&(h.n=-1),p(l,u)):h.n=u:h.v=u);try{if(s=2,a){if(l||(o="next"),e=a[o]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,l<2&&(l=0)}else 1===l&&(e=a.return)&&e.call(a),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=t}else if((e=(f=h.n<0)?u:r.call(n,h))!==i)break}catch(e){a=t,l=1,u=e}finally{s=1}}return{value:e,done:f}}}(r,o,a),!0),s}var i={};function l(){}function u(){}function s(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(Mt(e={},n,function(){return this}),e),f=s.prototype=l.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,Mt(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,Mt(f,"constructor",s),Mt(s,"constructor",u),u.displayName="GeneratorFunction",Mt(s,o,"GeneratorFunction"),Mt(f),Mt(f,o,"Generator"),Mt(f,n,function(){return this}),Mt(f,"toString",function(){return"[object Generator]"}),(bt=function(){return{w:a,m:h}})()}function Mt(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Mt=function(t,e,r,n){function a(e,r){Mt(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},Mt(t,e,r,n)}function wt(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function St(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){wt(a,n,o,i,l,"next",t)}function l(t){wt(a,n,o,i,l,"throw",t)}i(void 0)})}}var Pt=new Map,xt=function(){var t=St(bt().m(function t(e,r,n,o){var a,i,l,u,s,c,f,h,p,y;return bt().w(function(t){for(;;)switch(t.n){case 0:if(a=n.getPatternInnerContent(e)){t.n=1;break}return t.a(2,null);case 1:if(i=n.getPatternImageId(e,r,o)){t.n=2;break}return t.a(2,null);case 2:if(l=Pt.get(i)){t.n=4;break}return u=vt(e.fillPatternForegroundColor,r)||"black",s=vt(e.fillPatternBackgroundColor,r)||"transparent",c=dt(a,u,s),f='<rect width="16" height="16" fill="'.concat(s,'"/>'),h=yt(o),p=Math.round(8*h),y='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(p,'" height="').concat(p,'" viewBox="0 0 16 16">').concat(f).concat(c,"</svg>"),t.n=3,mt(y,p,p);case 3:l=t.v,Pt.set(i,l);case 4:return t.a(2,{imageId:i,imageData:l})}},t)}));return function(e,r,n,o){return t.apply(this,arguments)}}(),Ot=function(){var t=St(bt().m(function t(e,r,n,o,a){var i,l;return bt().w(function(t){for(;;)switch(t.n){case 0:if(r.length){t.n=1;break}return t.a(2);case 1:return i=yt(a),l=r.reduce(function(t,r){var l=o.getPatternImageId(r,n,a);return!l||t[l]||e.hasImage(l)||(t[l]=St(bt().m(function t(){var l;return bt().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,xt(r,n,o,a);case 1:(l=t.v)&&e.addImage(l.imageId,l.imageData,{pixelRatio:i});case 2:return t.a(2)}},t)}))),t},{}),t.n=2,Promise.all(Object.values(l).map(function(t){return t()}));case 2:return t.a(2)}},t)}));return function(e,r,n,o,a){return t.apply(this,arguments)}}(),Et=["container","padding","mapStyle","mapSize","center","zoom","bounds","pixelRatio"];function Nt(t){return Nt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nt(t)}function jt(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof l?n:l,s=Object.create(u.prototype);return At(s,"_invoke",function(r,n,o){var a,l,u,s=0,c=o||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return a=e,l=0,u=t,h.n=r,i}};function p(r,n){for(l=r,u=n,e=0;!f&&s&&!o&&e<c.length;e++){var o,a=c[e],p=h.p,y=a[2];r>3?(o=y===n)&&(u=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=t):a[0]<=p&&((o=r<2&&p<a[1])?(l=0,h.v=n,h.n=a[1]):p<y&&(o=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,l=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),l=c,u=y;(e=l<2?t:u)||!f;){a||(l?l<3?(l>1&&(h.n=-1),p(l,u)):h.n=u:h.v=u);try{if(s=2,a){if(l||(o="next"),e=a[o]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,l<2&&(l=0)}else 1===l&&(e=a.return)&&e.call(a),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=t}else if((e=(f=h.n<0)?u:r.call(n,h))!==i)break}catch(e){a=t,l=1,u=e}finally{s=1}}return{value:e,done:f}}}(r,o,a),!0),s}var i={};function l(){}function u(){}function s(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(At(e={},n,function(){return this}),e),f=s.prototype=l.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,At(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,At(f,"constructor",s),At(s,"constructor",u),u.displayName="GeneratorFunction",At(s,o,"GeneratorFunction"),At(f),At(f,o,"Generator"),At(f,n,function(){return this}),At(f,"toString",function(){return"[object Generator]"}),(jt=function(){return{w:a,m:h}})()}function At(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}At=function(t,e,r,n){function a(e,r){At(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},At(t,e,r,n)}function Tt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function It(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Tt(Object(r),!0).forEach(function(e){Lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Tt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Lt(t,e,r){return(e=Ct(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kt(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function Rt(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function _t(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){Rt(a,n,o,i,l,"next",t)}function l(t){Rt(a,n,o,i,l,"throw",t)}i(void 0)})}}function Dt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ct(n.key),n)}}function Ct(t){var e=function(t){if("object"!=Nt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Nt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Nt(e)?e:e+""}var Ft=function(){return t=function t(e){var r=e.mapFramework,n=e.mapProviderConfig,a=void 0===n?{}:n,i=e.events,l=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=r,this.events=i,this.eventBus=l,this.capabilities={supportedShortcuts:o,supportsMapSizes:!0},Object.assign(this,a)},e=[{key:"initMap",value:(u=_t(jt().m(function t(e){var r,n,o,l,u,f,h,p,y,d,g,v,m,b=this;return jt().w(function(t){for(;;)switch(t.n){case 0:r=e.container,n=e.padding,o=e.mapStyle,l=e.mapSize,u=e.center,f=e.zoom,h=e.bounds,p=e.pixelRatio,y=kt(e,Et),this.mapStyleId=null==o?void 0:o.id,this.mapSize=l,d=this.maplibreModule.Map,g=this.events,v=this.eventBus,(m=new d(It(It({},y),{},{container:r,style:null==o?void 0:o.url,pixelRatio:p,padding:n,center:u,zoom:f,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=m,this.map.setPadding(n),h&&m.fitBounds(h,{duration:0}),i(m),a(m),s({map:m,events:g,eventBus:v,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({mapProvider:this,map:m,events:g,eventBus:v}),m.on("load",function(){b.labelNavigator=F(m,null==o?void 0:o.mapColorScheme,g,v)}),this.eventBus.emit(g.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 1:return t.a(2)}},t,this)})),function(t){return u.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;this.setHoverCursor([]),null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}},{key:"setHoverCursor",value:function(t){this.map&&(this._onHoverMove=ut(this.map,t,this._onHoverMove))}},{key:"setView",value:function(t){var e=t.center,r=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:this.map.isStyleLoaded()?n:0})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:n})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:n})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:n})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:x(t),r=this.map.isStyleLoaded()?n:0;this.map.fitBounds(e,{duration:r})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e,r){return function(t){var e=t.LngLatBounds,r=t.map,n=t.selectedFeatures,o=t.activeFeatures,a=t.stylesMap;if(!r)return null;null!=o&&o.length?(nt(r,o,a,V,K),nt(r,o,a,Y,X)):(tt(r,V),tt(r,Y));var i={};null!=n&&n.length?i=nt(r,n,a,J,X):tt(r,J);var l=[];return Object.entries(i).forEach(function(t){var e=$(t,2)[1],n=e.ids,o=e.idProperty,a=e.layerId;l.push.apply(l,G(r.queryRenderedFeatures({layers:[a]}).filter(function(t){var e;return n.has(o?null===(e=t.properties)||void 0===e?void 0:e[o]:t.id)})))}),function(t,e){if(!e.length)return null;var r=new t;return e.forEach(function(t){var e=function(t){return"number"==typeof t[0]?r.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[r.getWest(),r.getSouth(),r.getEast(),r.getNorth()]}(e,l)}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,activeFeatures:e,stylesMap:r})}},{key:"highlightNextLabel",value:function(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}},{key:"highlightLabelAtCenter",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}},{key:"clearHighlightedLabel",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}},{key:"getCenter",value:function(){var t=this.map.getCenter();return[Number(t.lng.toFixed(7)),Number(t.lat.toFixed(7))]}},{key:"getZoom",value:function(){return Number(this.map.getZoom().toFixed(7))}},{key:"getBounds",value:function(){return this.map.getBounds().toArray().flat(1)}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===r?10:r,o=[[e.x-n,e.y-n],[e.x+n,e.y+n]],a=t.queryRenderedFeatures(o);if(0===a.length)return[];var i=new Set(t.queryRenderedFeatures([e.x,e.y]).map(function(t){var e,r=void 0===t.id?JSON.stringify(t.properties):t.id;return"".concat(null===(e=t.layer)||void 0===e?void 0:e.source,":").concat(r)})),l=[];a.forEach(function(t){!1===l.includes(t.layer.id)&&l.push(t.layer.id)});for(var u=new Set,s=[],c=a.length-1;c>=0;c--){var f,h=a[c],p=void 0===h.id?JSON.stringify(h.properties):h.id,y="".concat(null===(f=h.layer)||void 0===f?void 0:f.source,":").concat(p);!1===u.has(y)&&(u.add(y),s.push(h))}var d=t.unproject(e),g=[d.lng,d.lat],v=s.filter(function(t){var e=t.geometry.type;if(e.includes("Polygon"))return("Polygon"===e?[t.geometry.coordinates]:t.geometry.coordinates).some(function(t){return function(t,e){for(var r=ot(t,2),n=r[0],o=r[1],a=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var u=ot(e[i],2),s=u[0],c=u[1],f=ot(e[l],2),h=f[0],p=f[1];c>o!=p>o&&n<(h-s)*(o-c)/(p-c)+s&&(a=!a)}return a}(g,t[0])});if("Point"===e||"MultiPoint"===e){var r,n=void 0===t.id?JSON.stringify(t.properties):t.id;return i.has("".concat(null===(r=t.layer)||void 0===r?void 0:r.source,":").concat(n))}return!0});return v.map(function(r){var n=0,o=r.geometry.type,a=function(t,e,r){var n=r.coordinates,o=r.type,a=1/0,i=function(e){return t.project(e)},l=function(t){for(var r=0;r<t.length-1;r++){var n=it(e,i(t[r]),i(t[r+1]));n<a&&(a=n)}};if("Point"===o){var u=i(n);a=Math.pow(e.x-u.x,2)+Math.pow(e.y-u.y,2)}else"LineString"===o||"MultiPoint"===o?"LineString"===o?l(n):n.forEach(function(t){var r=i(t),n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);n<a&&(a=n)}):"Polygon"===o||"MultiLineString"===o?n.forEach(l):"MultiPolygon"===o&&n.forEach(function(t){return t.forEach(l)});return a}(t,e,r.geometry);return n+=1e6*l.indexOf(r.layer.id),o.includes("Polygon")&&(n-=5e5),{f:r,score:n+=a}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getVisibleFeatures",value:function(t){var e=this,r=t.filter(function(t){return e.map.getLayer(t)});return r.length?this.map.queryRenderedFeatures(void 0,{layers:r}):[]}},{key:"addSymbolsToMap",value:(l=_t(jt().m(function t(e,r,n){var o;return jt().w(function(t){for(;;)if(0===t.n)return o=this.map.getPixelRatio()||1,t.a(2,pt(this.map,e,r,n,o))},t,this)})),function(t,e,r){return l.apply(this,arguments)})},{key:"addPatternsToMap",value:(r=_t(jt().m(function t(e,r,n){var o;return jt().w(function(t){for(;;)if(0===t.n)return o=this.map.getPixelRatio()||1,t.a(2,Ot(this.map,e,r,n,o))},t,this)})),function(t,e,n){return r.apply(this,arguments)})},{key:"getAreaDimensions",value:function(){return function(t){var e,r,n,o;if(t&&"function"==typeof t.getWest)e=t.getWest(),r=t.getSouth(),n=t.getEast(),o=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var a=b(t,2),i=b(a[0],2);e=i[0],r=i[1];var l=b(a[1],2);n=l[0],o=l[1]}var u=S([e,r],[n,r]),s=S([e,r],[e,o]),c=P(u),f=P(s);return"".concat(f," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,r=e.getContainer().getBoundingClientRect(),n=r.width,o=r.height,a=e.getPadding(),i=[a.left,o-a.bottom],l=[n-a.right,a.top],new t(e.unproject(i),e.unproject(l))));var t,e,r,n,o,a,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var r=b(t,2),n=r[0],o=r[1],a=b(e,2),i=a[0],l=a[1],u=l-o,s=i-n,c=[];if(Math.abs(u)>1e-4){var f=Math.round(S([n,o],[n,l]));c.push("".concat(u>0?"north":"south"," ").concat(P(f)))}if(Math.abs(s)>1e-4){var h=Math.round(S([n,o],[i,o]));c.push("".concat(s>0?"east":"west"," ").concat(P(h)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),r=t.lat,n=Math.pow(2,e),40075016.686*Math.cos(r*Math.PI/180)/(512*n);var t,e,r,n}},{key:"mapToScreen",value:function(t){return this.map.project(t)}},{key:"screenToMap",value:function(t){var e=this.map.unproject([t.x,t.y]);return[e.lng,e.lat]}},{key:"isGeometryObscured",value:function(t,e){return function(t,e,r){var n=r.getContainer().getBoundingClientRect(),o=b(x(t),4),a=o[0],i=o[1],l=o[2],u=o[3],s=[r.project([a,i]),r.project([a,u]),r.project([l,i]),r.project([l,u])],c=Math.min.apply(Math,m(s.map(function(t){return t.x}))),f=Math.max.apply(Math,m(s.map(function(t){return t.x}))),h=Math.min.apply(Math,m(s.map(function(t){return t.y}))),p=Math.max.apply(Math,m(s.map(function(t){return t.y}))),y=e.left-n.left,d=e.top-n.top,g=e.right-n.left,v=e.bottom-n.top;return c<g&&f>y&&h<v&&p>d}(t,e,this.map)}}],e&&Dt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,l,u}()}}]);
|
|
2
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[772],{419(t,e,r){r.r(e),r.d(e,{default:()=>Dt});var n=400,o=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function a(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block",e.addEventListener("focus",function(t){e.blur(),t.relatedTarget&&t.relatedTarget.focus({preventScroll:!0})})}function i(t){var e=Event.prototype.preventDefault;Event.prototype.preventDefault=function(){if(("touchmove"===this.type||"touchstart"===this.type)&&!this.cancelable){var r=t.getCanvas();if(r&&(this.target===r||r.contains(this.target)))return}e.call(this)}}var l=function(t,e){var r=null,n=function(){for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];clearTimeout(r),r=setTimeout(function(){t.apply(void 0,o)},e)};return n.cancel=function(){r&&(clearTimeout(r),r=null)},n};function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function s(t){var e=t.map,r=t.events,n=t.eventBus,o=t.getCenter,a=t.getZoom,i=t.getBounds,s=t.getResolution,c=[],f=[],h=function(){var t=a();return{center:o(),bounds:i(),resolution:s(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return n.emit(t,e)},y=function(){return p(r.MAP_LOADED)};e.on("load",y),c.push(["load",y]),e.once("idle",function(){return p(r.MAP_FIRST_IDLE,h())});var d=function(){return p(r.MAP_MOVE_START)};e.on("movestart",d),c.push(["movestart",d]);var g=l(function(){p(r.MAP_MOVE_END,h())},500);e.on("moveend",g),c.push(["moveend",g]);var v,m,b=(v=function(){p(r.MAP_MOVE,h())},m=0,function(){var t=Date.now();t-m>=10&&(m=t,v.apply(void 0,arguments))});e.on("zoom",b),c.push(["zoom",b]);var M=function(){return p(r.MAP_RENDER)};e.on("render",M),c.push(["render",M]);var w=l(function(){p(r.MAP_DATA_CHANGE,h())},500),S=function(t){t.isSourceLoaded&&w()};e.on("styledata",w),e.on("sourcedata",S),c.push(["styledata",w],["sourcedata",S]);var P=function(){return p(r.MAP_STYLE_CHANGE)};e.on("style.load",P),c.push(["style.load",P]);var x=function(t){return p(r.MAP_CLICK,{point:t.point,coords:[t.lngLat.lng,t.lngLat.lat]})};return e.on("click",x),c.push(["click",x]),f.push(g,b,w),{remove:function(){f.forEach(function(t){return t.cancel()}),c.forEach(function(t){var r,n,o=(n=2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=o[0],i=o[1];return e.off(a,i)})}}}function c(t){var e=t.mapProvider,r=t.map,n=t.events,o=t.eventBus,a=function(t){r.once("style.load",function(){o.emit(n.MAP_STYLE_CHANGE,{mapStyleId:t.id})}),r.setStyle(t.url,{diff:!1})},i=function(t){r.setPixelRatio(t)},l=function(t){var r=t.mapSize;e.mapSize=r};return o.on(n.MAP_SET_STYLE,a),o.on(n.MAP_SET_PIXEL_RATIO,i),o.on(n.MAP_SIZE_CHANGE,l),{remove:function(){o.off(n.MAP_SET_STYLE,a),o.off(n.MAP_SET_PIXEL_RATIO,i),o.off(n.MAP_SIZE_CHANGE,l)}}}let f=" ";class h{static get separator(){return f}static set separator(t){f=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,o=null,a=null,i=null;switch(e){default:case"d":case"deg":o=t.toFixed(r),o<100&&(o="0"+o),o<10&&(o="0"+o),n=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),a=(60*t%60).toFixed(r),60==a&&(a=(0).toFixed(r),o++),o=("000"+o).slice(-3),a<10&&(a="0"+a),n=o+"°"+h.separator+a+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),a=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),a++),60==a&&(a=0,o++),o=("000"+o).slice(-3),a=("00"+a).slice(-2),i<10&&(i="0"+i),n=o+"°"+h.separator+a+"′"+h.separator+i+"″"}return n}static toLat(t,e,r){const n=h.toDms(h.wrap90(t),e,r);return null===n?"–":n.slice(1)+h.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=h.toDms(h.wrap180(t),e,r);return null===n?"–":n+h.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=h.toDms(h.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=h.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const p=h,y=Math.PI;class d{constructor(t,e){if(isNaN(t))throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e))throw new TypeError(`invalid lon ‘${e}’`);this._lat=p.wrap90(Number(t)),this._lon=p.wrap180(Number(e))}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?p.wrap90(p.parse(t)):p.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?p.wrap180(p.parse(t)):p.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}static get metresToKm(){return.001}static get metresToMiles(){return 1/1609.344}static get metresToNauticalMiles(){return 1/1852}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");if(null===t[0]||null===t[1])throw new TypeError("invalid (null) point");let e,r;if(2==t.length&&([e,r]=t,e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);if(1==t.length&&"string"==typeof t[0]&&([e,r]=t[0].split(","),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r)),isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(1==t.length&&"object"==typeof t[0]){const n=t[0];if("Point"==n.type&&Array.isArray(n.coordinates)?[r,e]=n.coordinates:(null!=n.latitude&&(e=n.latitude),null!=n.lat&&(e=n.lat),null!=n.longitude&&(r=n.longitude),null!=n.lng&&(r=n.lng),null!=n.lon&&(r=n.lon),e=p.wrap90(p.parse(e)),r=p.wrap180(p.parse(r))),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if(isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${t.toString()}’`);return new d(e,r)}distanceTo(t,e=6371e3){if(t instanceof d||(t=d.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const r=e,n=this.lat.toRadians(),o=this.lon.toRadians(),a=t.lat.toRadians(),i=a-n,l=t.lon.toRadians()-o,u=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2);return r*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))}initialBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),o=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n),a=Math.sin(n)*Math.cos(r),i=Math.atan2(a,o).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof d||(t=d.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),o=(t.lon-this.lon).toRadians(),a=Math.cos(e),i=Math.sin(e),l={x:a+Math.cos(n)*Math.cos(o),y:0+Math.cos(n)*Math.sin(o),z:i+Math.sin(n)},u=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),s=r+Math.atan2(l.y,l.x),c=u.toDegrees(),f=s.toDegrees();return new d(c,f)}intermediatePointTo(t,e){if(t instanceof d||(t=d.parse(t)),this.equals(t))return new d(this.lat,this.lon);const r=this.lat.toRadians(),n=this.lon.toRadians(),o=t.lat.toRadians(),a=t.lon.toRadians(),i=o-r,l=a-n,u=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2),s=2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),c=Math.sin((1-e)*s)/Math.sin(s),f=Math.sin(e*s)/Math.sin(s),h=c*Math.cos(r)*Math.cos(n)+f*Math.cos(o)*Math.cos(a),p=c*Math.cos(r)*Math.sin(n)+f*Math.cos(o)*Math.sin(a),y=c*Math.sin(r)+f*Math.sin(o),g=Math.atan2(y,Math.sqrt(h*h+p*p)),v=Math.atan2(p,h),m=g.toDegrees(),b=v.toDegrees();return new d(m,b)}destinationPoint(t,e,r=6371e3){const n=t/r,o=Number(e).toRadians(),a=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(a)*Math.cos(n)+Math.cos(a)*Math.sin(n)*Math.cos(o),u=Math.asin(l),s=Math.sin(o)*Math.sin(n)*Math.cos(a),c=Math.cos(n)-Math.sin(a)*l,f=i+Math.atan2(s,c),h=u.toDegrees(),p=f.toDegrees();return new d(h,p)}static intersection(t,e,r,n){if(t instanceof d||(t=d.parse(t)),r instanceof d||(r=d.parse(r)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(n))throw new TypeError(`invalid brng2 ‘${n}’`);const o=t.lat.toRadians(),a=t.lon.toRadians(),i=r.lat.toRadians(),l=r.lon.toRadians(),u=Number(e).toRadians(),s=Number(n).toRadians(),c=i-o,f=l-a,h=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(o)*Math.cos(i)*Math.sin(f/2)*Math.sin(f/2)));if(Math.abs(h)<Number.EPSILON)return new d(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(o)*Math.cos(h))/(Math.sin(h)*Math.cos(o)),g=(Math.sin(o)-Math.sin(i)*Math.cos(h))/(Math.sin(h)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=u-(Math.sin(l-a)>0?v:2*y-v),M=(Math.sin(l-a)>0?2*y-m:m)-s;if(0==Math.sin(b)&&0==Math.sin(M))return null;if(Math.sin(b)*Math.sin(M)<0)return null;const w=-Math.cos(b)*Math.cos(M)+Math.sin(b)*Math.sin(M)*Math.cos(h),S=Math.atan2(Math.sin(h)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),P=Math.asin(Math.min(Math.max(Math.sin(o)*Math.cos(S)+Math.cos(o)*Math.sin(S)*Math.cos(u),-1),1)),x=a+Math.atan2(Math.sin(u)*Math.sin(S)*Math.cos(o),Math.cos(S)-Math.sin(o)*Math.sin(P)),O=P.toDegrees(),E=x.toDegrees();return new d(O,E)}crossTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const o=t.distanceTo(this,n)/n,a=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(o)*Math.sin(a-i))*n}alongTrackDistanceTo(t,e,r=6371e3){t instanceof d||(t=d.parse(t)),e instanceof d||(e=d.parse(e));const n=r;if(this.equals(t))return 0;const o=t.distanceTo(this,n)/n,a=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(o)*Math.sin(a-i));return Math.acos(Math.cos(o)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-a))*n}maxLatitude(t){const e=Number(t).toRadians(),r=this.lat.toRadians();return Math.acos(Math.abs(Math.sin(e)*Math.cos(r))).toDegrees()}static crossingParallels(t,e,r){if(t.equals(e))return null;const n=Number(r).toRadians(),o=t.lat.toRadians(),a=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-a,u=Math.sin(o)*Math.cos(i)*Math.cos(n)*Math.sin(l),s=Math.sin(o)*Math.cos(i)*Math.cos(n)*Math.cos(l)-Math.cos(o)*Math.sin(i)*Math.cos(n),c=Math.cos(o)*Math.cos(i)*Math.sin(n)*Math.sin(l);if(c*c>u*u+s*s)return null;const f=Math.atan2(-s,u),h=Math.acos(c/Math.sqrt(u*u+s*s)),y=a+f+h,d=(a+f-h).toDegrees(),g=y.toDegrees();return{lon1:p.wrap180(d),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof d||(t=d.parse(t));const r=e,n=this.lat.toRadians(),o=t.lat.toRadians(),a=o-n;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>y&&(i=i>0?-(2*y-i):2*y+i);const l=Math.log(Math.tan(o/2+y/4)/Math.tan(n/2+y/4)),u=Math.abs(l)>1e-11?a/l:Math.cos(n);return Math.sqrt(a*a+u*u*i*i)*r}rhumbBearingTo(t){if(t instanceof d||(t=d.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians();let n=(t.lon-this.lon).toRadians();Math.abs(n)>y&&(n=n>0?-(2*y-n):2*y+n);const o=Math.log(Math.tan(r/2+y/4)/Math.tan(e/2+y/4)),a=Math.atan2(n,o).toDegrees();return p.wrap360(a)}rhumbDestinationPoint(t,e,r=6371e3){const n=this.lat.toRadians(),o=this.lon.toRadians(),a=Number(e).toRadians(),i=t/r,l=i*Math.cos(a);let u=n+l;Math.abs(u)>y/2&&(u=u>0?y-u:-y-u);const s=Math.log(Math.tan(u/2+y/4)/Math.tan(n/2+y/4)),c=Math.abs(s)>1e-11?l/s:Math.cos(n),f=o+i*Math.sin(a)/c,h=u.toDegrees(),p=f.toDegrees();return new d(h,p)}rhumbMidpointTo(t){t instanceof d||(t=d.parse(t));const e=this.lat.toRadians();let r=this.lon.toRadians();const n=t.lat.toRadians(),o=t.lon.toRadians();Math.abs(o-r)>y&&(r+=2*y);const a=(e+n)/2,i=Math.tan(y/4+e/2),l=Math.tan(y/4+n/2),u=Math.tan(y/4+a/2);let s=((o-r)*Math.log(u)+r*Math.log(l)-o*Math.log(i))/Math.log(l/i);isFinite(s)||(s=(r+o)/2);const c=a.toDegrees(),f=s.toDegrees();return new d(c,f)}static areaOf(t,e=6371e3){const r=e,n=t[0].equals(t[t.length-1]);n||t.push(t[0]);const o=t.length-1;let a=0;for(let e=0;e<o;e++){const r=t[e].lat.toRadians(),n=t[e+1].lat.toRadians(),o=(t[e+1].lon-t[e].lon).toRadians();a+=2*Math.atan2(Math.tan(o/2)*(Math.tan(r/2)+Math.tan(n/2)),1+Math.tan(r/2)*Math.tan(n/2))}(function(t){let e=0,r=t[0].initialBearingTo(t[1]);for(let n=0;n<t.length-1;n++){const o=t[n].initialBearingTo(t[n+1]),a=t[n].finalBearingTo(t[n+1]);e+=(o-r+540)%360-180,e+=(a-o+540)%360-180,r=a}return e+=(t[0].initialBearingTo(t[1])-r+540)%360-180,Math.abs(e)<90})(t)&&(a=Math.abs(a)-2*y);const i=Math.abs(a*r*r);return n||t.pop(),i}equals(t){return t instanceof d||(t=d.parse(t)),!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON)}toGeoJSON(){return{type:"Point",coordinates:[this.lon,this.lat]}}toString(t="d",e=void 0){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)},${this.lon.toFixed(e)}`):`${p.toLat(this.lat,t,e)}, ${p.toLon(this.lon,t,e)}`}}function g(t,e,r){if(null!==t)for(var n,o,a,i,l,u,s,c,f=0,h=0,p=t.type,y="FeatureCollection"===p,d="Feature"===p,v=y?t.features.length:1,m=0;m<v;m++){l=(c=!!(s=y?t.features[m].geometry:d?t.geometry:t)&&"GeometryCollection"===s.type)?s.geometries.length:1;for(var b=0;b<l;b++){var M=0,w=0;if(null!==(i=c?s.geometries[b]:s)){u=i.coordinates;var S=i.type;switch(f=!r||"Polygon"!==S&&"MultiPolygon"!==S?0:1,S){case null:break;case"Point":if(!1===e(u,h,m,M,w))return!1;h++,M++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(!1===e(u[n],h,m,M,w))return!1;h++,"MultiPoint"===S&&M++}"LineString"===S&&M++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(o=0;o<u[n].length-f;o++){if(!1===e(u[n][o],h,m,M,w))return!1;h++}"MultiLineString"===S&&M++,"Polygon"===S&&w++}"Polygon"===S&&M++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(w=0,o=0;o<u[n].length;o++){for(a=0;a<u[n][o].length-f;a++){if(!1===e(u[n][o][a],h,m,M,w))return!1;h++}w++}M++}break;case"GeometryCollection":for(n=0;n<i.geometries.length;n++)if(!1===g(i.geometries[n],e,r))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var v=function(t,e={}){if(null!=t.bbox&&!0!==e.recompute)return t.bbox;const r=[1/0,1/0,-1/0,-1/0];return g(t,t=>{r[0]>t[0]&&(r[0]=t[0]),r[1]>t[1]&&(r[1]=t[1]),r[2]<t[0]&&(r[2]=t[0]),r[3]<t[1]&&(r[3]=t[1])}),r};function m(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||M(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||M(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(t,e){if(t){if("string"==typeof t)return w(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(t,e):void 0}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var S=function(t,e){var r=b(t,2),n=r[0],o=r[1],a=b(e,2),i=a[0],l=a[1],u=new d(o,n),s=new d(l,i);return u.distanceTo(s)},P=function(t){var e=t/1609.344;if(e<.5)return"".concat(Math.round(t),"m");if(e<10){var r=Number.parseFloat(e.toFixed(1)),n=1===r?"mile":"miles";return"".concat(r," ").concat(n)}var o=Math.round(e);return"".concat(o," miles")},x=function(t){return v(t)};function O(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return E(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?E(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function N(t){return N="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},N(t)}function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function A(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach(function(e){T(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function T(t,e,r){return(e=function(t){var e=function(t){if("object"!=N(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=N(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==N(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function I(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var L="highlighted-label";function k(t,e){if("number"==typeof t)return t;if(!Array.isArray(t)||"interpolate"!==t[0])return function(t,e){var r=t.stops;if(r.length<2)return r.length>0?r[0][1]:0;for(var n=r[0],o=r[r.length-1],a=1;a<r.length;a++){var i=r[a];if(i[0]>e){o=i,n=r[a-1];break}n=r[a-1],o=i}var l=O(n,2),u=l[0],s=l[1],c=O(o,2),f=c[0],h=c[1];return e<=u?s:e>=f?h:s+(e-u)/(f-u)*(h-s)}(t,e);var r,n=function(t){if(Array.isArray(t))return t}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return I(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?I(t,e):void 0}}(r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=n[2],a=I(n).slice(3);if("zoom"!==o[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<a.length-2;i+=2){var l=a[i],u=a[i+1],s=a[i+2],c=a[i+3];if(e<=l)return u;if(e<=s)return u+(e-l)/(s-l)*(c-u)}return a[a.length-1]}function R(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function _(t,e,r){var n,o,a,i;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){R(t,r);var l=e.feature,u=e.layer;r.highlightLayerId="highlight-".concat(u.id);var s=l.id,c=l.type,f=l.properties,h=l.geometry;t.getSource(L).setData({id:s,type:c,properties:f,geometry:h}),r.highlightedExpr=u.layout["text-size"];var p=t.getZoom(),y=(o=u,a=1.5*k(r.highlightedExpr,p),i=r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(o.id),type:o.type,source:L,layout:A(A({},o.layout),{},{"text-size":a,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:A(A({},o.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(y),t.moveLayer(r.highlightLayerId)}}function C(t){t.getSource(L)||t.addSource(L,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function D(t){t.getStyle().layers.filter(function(t){var e;return"line"===(null===(e=t.layout)||void 0===e?void 0:e["symbol-placement"])}).forEach(function(e){return t.setLayoutProperty(e.id,"symbol-placement","line-center")})}function F(t,e,r,n){var o={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function a(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),r=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});o.labels=function(t,e,r){return e.flatMap(function(e){var n,o,a,i,l="string"==typeof(o=null===(n=e.layout)||void 0===n?void 0:n["text-field"])?null===(a=/^{(.+)}$/.exec(o))||void 0===a?void 0:a[1]:Array.isArray(o)?null===(i=o.find(function(t){return Array.isArray(t)&&"get"===t[0]}))||void 0===i?void 0:i[1]:null;return l?r.filter(function(t){var r;return t.layer.id===e.id&&(null===(r=t.properties)||void 0===r?void 0:r[l])}).map(function(r){return function(t,e,r,n){var o=function(t){var e=t.type,r=t.coordinates;if("Point"===e)return r;if("MultiPoint"===e)return r[0];if(e.includes("LineString")){var n="LineString"===e?r:r[0];return[(n[0][0]+n[n.length-1][0])/2,(n[0][1]+n[n.length-1][1])/2]}if(e.includes("Polygon")){var o="Polygon"===e?r[0]:r[0][0],a=o.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[a[0]/o.length,a[1]/o.length]}return null}(t.geometry);if(!o)return null;var a=n.project({lng:o[0],lat:o[1]});return{text:t.properties[r],x:a.x,y:a.y,feature:t,layer:e}}(r,e,l,t)}).filter(Boolean):[]})}(t,e,r)}function i(){if(a(),!o.labels.length)return null;var e=t.project(t.getCenter()),r=function(t,e){var r;return null===(r=t.reduce(function(t,r){var n=Math.pow(r.x-e.x,2)+Math.pow(r.y-e.y,2);return!t||n<t.dist?{label:r,dist:n}:t},null))||void 0===r?void 0:r.label}(o.labels,e);return o.currentPixel={x:r.x,y:r.y},_(t,r,o),"".concat(r.text," (").concat(r.layer.id,")")}return D(t),C(t),null==n||n.on(r.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){D(t),C(t),o.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(o.highlightLayerId&&o.highlightedExpr){var e=k(o.highlightedExpr,t.getZoom());t.setLayoutProperty(o.highlightLayerId,"text-size",1.5*e)}}),function(t){t.getStyle().layers.filter(function(t){return"symbol"===t.type}).forEach(function(e){t.setPaintProperty(e.id,"text-opacity",["case",["boolean",["feature-state","highlighted"],!1],0,1])})}(t),{refreshLabels:a,highlightNextLabel:function(e){if(a(),!o.labels.length)return null;if(!o.currentPixel)return i();var r=function(t,e){if(!e.currentPixel)return null;var r=e.labels.map(function(t,e){return{pixel:[t.x,t.y],index:e}}).filter(function(t){return t.pixel[0]!==e.currentPixel.x||t.pixel[1]!==e.currentPixel.y});if(!r.length)return null;var n=r.map(function(t){return t.pixel}),o=function(t,e,r){var n=b(e,2),o=n[0],a=n[1],i=r.filter(function(e){var r=b(e,2),n=r[0],i=r[1];return(n!==o||i!==a)&&function(t,e,r){switch(t){case"ArrowUp":return r<0&&Math.abs(r)>=Math.abs(e);case"ArrowDown":return r>0&&Math.abs(r)>=Math.abs(e);case"ArrowLeft":return e<0&&Math.abs(e)>Math.abs(r);case"ArrowRight":return e>0&&Math.abs(e)>Math.abs(r);default:return!1}}(t,n-o,i-a)});if(!i.length)return r.findIndex(function(t){return t[0]===o&&t[1]===a});var l=-1,u=1/0;return i.forEach(function(t){var e=t[0]-o,n=t[1]-a,i=e*e+n*n;i<u&&(u=i,l=r.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],n);return(null==o||o<0||o>=r.length)&&(o=0),e.labels[r[o].index]}(e,o);return r?(o.currentPixel={x:r.x,y:r.y},_(t,r,o),"".concat(r.text," (").concat(r.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return R(t,o)}}}function B(t){return B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},B(t)}function G(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||$(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(t,e){if(t){if("string"==typeof t)return z(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?z(t,e):void 0}}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function W(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?q(Object(r),!0).forEach(function(e){Z(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Z(t,e,r){return(e=function(t){var e=function(t){if("object"!=B(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==B(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var H="icon-image",U="active-highlight",V="active-highlight-inner",Y="selected-highlight",J=function(t,e){var r,n;return null!==(r=null===(n=t._activeSymbolImageMap)||void 0===n?void 0:n[e])&&void 0!==r?r:null},K=function(t,e){var r,n;return null!==(r=null===(n=t._selectedSymbolImageMap)||void 0===n?void 0:n[e])&&void 0!==r?r:null},X=function(t,e,r,n){e.forEach(function(e){if(!r.has(e)){var o="".concat(n,"-").concat(e);["".concat(o,"-fill"),"".concat(o,"-line"),"".concat(o,"-symbol")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})},Q=function(t,e){var r="_".concat(e.replaceAll("-",""),"Sources");X(t,t[r]||new Set,new Set,e),t[r]=new Set},tt=function(t,e,r,n,o,a,i){!!t.getLayer(e)||t.addLayer(W(W({id:e,type:r,source:n},o&&{"source-layer":o}),{},{paint:a})),Object.entries(a).forEach(function(r){var n=G(r,2),o=n[0],a=n[1];t.setPaintProperty(e,o,a)}),t.setFilter(e,i),t.moveLayer(e)},et=function(t,e,r,n,o,a){var i=r[e],l=i.ids,u=i.fillIds,s=i.idProperty,c=i.layerId,f=i.hasFillGeometry,h=t.getLayer(c);if(h&&n[c]){var p=n[c],y=h.sourceLayer,d=f?"fill":h.type,g="".concat(o,"-").concat(e),v=p.fill,m=o===Y,b=function(t){return t===Y||t===V}(o),M=function(t,e){return{lineColor:e?t.selectionStroke:t.stroke,lineWidth:e?t.strokeWidth:t.activeStrokeWidth}}(p,b),w=M.lineColor,S=M.lineWidth,P=s?["get",s]:["id"],x=["in",P,["literal",Array.from(l)]];if("fill-extrusion"!==h.type)switch(d){case"fill":!function(t,e,r,n,o){var a=o.idExpression,i=o.fill,l=o.lineColor,u=o.lineWidth,s=o.filter;if(o.isSelected){var c=[];o.fillIds.forEach(function(t){return c.push(t)});var f=["in",a,["literal",c]];tt(t,"".concat(e,"-fill"),"fill",r,n,{"fill-color":i},f)}tt(t,"".concat(e,"-line"),"line",r,n,{"line-color":l,"line-width":u},s)}(t,g,e,y,{isSelected:m,idExpression:P,fillIds:u,fill:v,lineColor:w,lineWidth:S,filter:x});break;case"line":!function(t,e,r,n,o,a,i){t.getLayer("".concat(e,"-fill"))&&t.setFilter("".concat(e,"-fill"),["==","id",""]),tt(t,"".concat(e,"-line"),"line",r,n,{"line-color":o,"line-width":a},i)}(t,g,e,y,w,S,x);break;case"symbol":!function(t,e,r,n,o,a,i){!function(t,e,r,n,o,a,i){var l=t.getLayoutProperty(o,H),u=i(t,l);u&&function(t,e,r,n,o,a,i){var l;t.getLayer(e)||t.addLayer(W(W({id:e,type:"symbol",source:r},n&&{"source-layer":n}),{},{layout:Z(Z(Z({},H,a),"icon-anchor",null!==(l=t.getLayoutProperty(o,"icon-anchor"))&&void 0!==l?l:"center"),"icon-allow-overlap",!0)})),t.setLayoutProperty(e,H,a),t.setFilter(e,i),t.moveLayer(e)}(t,"".concat(e,"-symbol"),r,n,o,u,a)}(t,e,r,n,o,a,i)}(t,g,e,y,c,x,a)}else!function(t,e,r,n){var o=n.lineColor,a=n.lineWidth,i=n.idExpression,l=[];n.ids.forEach(function(t){return l.push(t)});var u=["in",i,["literal",l]],s=t.getLayer(r),c=s.source,f=s.sourceLayer;tt(t,"".concat(e,"-line"),"line",c,f,{"line-color":o,"line-width":a},u)}(t,g,c,{ids:l,lineColor:w,lineWidth:S,idExpression:P})}},rt=function(t,e,r,n,o){var a=function(t,e){var r={};return null==e||e.forEach(function(e){var n=e.featureId,o=e.layerId,a=e.idProperty,i=e.geometry,l=t.getLayer(o);if(l){var u=l.source;r[u]||(r[u]={ids:new Set,fillIds:new Set,idProperty:a,layerId:o,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(r[u].hasFillGeometry=!0,r[u].fillIds.add(n)),r[u].ids.add(n)}}),r}(t,e),i=new Set(Object.keys(a)),l="_".concat(n.replaceAll("-",""),"Sources"),u=t[l]||new Set;return X(t,u,i,n),t[l]=i,i.forEach(function(e){return et(t,e,a,r,n,o)}),a};function nt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,l=[],u=!0,s=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=a.call(r)).done)&&(l.push(n.value),l.length!==e);u=!0);}catch(t){s=!0,o=t}finally{try{if(!u&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ot(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ot(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var at=function(t,e,r){var n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);if(0===n)return Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2);var o=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return o=Math.max(0,Math.min(1,o)),Math.pow(t.x-(e.x+o*(r.x-e.x)),2)+Math.pow(t.y-(e.y+o*(r.y-e.y)),2)};function it(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var lt=function(t,e,r){var n=t.getCanvas();if(r&&t.off("mousemove",r),null==e||!e.length)return n.style.cursor="",null;var o=function(r){var o=e.filter(function(e){return t.getLayer(e)});if(0!==o.length){var a=function(t,e){var r,n=[],o=[],a=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return it(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?it(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return i=t.done,t},e:function(t){l=!0,a=t},f:function(){try{i||null==r.return||r.return()}finally{if(l)throw a}}}}(e);try{for(a.s();!(r=a.n()).done;){var i=r.value;if("line"===t.getLayer(i).type){var l=i.endsWith("-stroke")?i.slice(0,-7):null;null!==l&&e.includes(l)||n.push(i)}else o.push(i)}}catch(t){a.e(t)}finally{a.f()}return{lineLayers:n,otherLayers:o}}(t,o),i=a.lineLayers,l=a.otherLayers,u=r.point,s=u.x,c=u.y,f=[[s-10,c-10],[s+10,c+10]],h=i.length>0&&t.queryRenderedFeatures(f,{layers:i}).length>0,p=l.length>0&&t.queryRenderedFeatures(r.point,{layers:l}).length>0;n.style.cursor=h||p?"pointer":""}else n.style.cursor=""};return t.on("mousemove",o),o};function ut(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof l?n:l,s=Object.create(u.prototype);return st(s,"_invoke",function(r,n,o){var a,l,u,s=0,c=o||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return a=e,l=0,u=t,h.n=r,i}};function p(r,n){for(l=r,u=n,e=0;!f&&s&&!o&&e<c.length;e++){var o,a=c[e],p=h.p,y=a[2];r>3?(o=y===n)&&(u=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=t):a[0]<=p&&((o=r<2&&p<a[1])?(l=0,h.v=n,h.n=a[1]):p<y&&(o=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,l=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),l=c,u=y;(e=l<2?t:u)||!f;){a||(l?l<3?(l>1&&(h.n=-1),p(l,u)):h.n=u:h.v=u);try{if(s=2,a){if(l||(o="next"),e=a[o]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,l<2&&(l=0)}else 1===l&&(e=a.return)&&e.call(a),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=t}else if((e=(f=h.n<0)?u:r.call(n,h))!==i)break}catch(e){a=t,l=1,u=e}finally{s=1}}return{value:e,done:f}}}(r,o,a),!0),s}var i={};function l(){}function u(){}function s(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(st(e={},n,function(){return this}),e),f=s.prototype=l.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,st(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,st(f,"constructor",s),st(s,"constructor",u),u.displayName="GeneratorFunction",st(s,o,"GeneratorFunction"),st(f),st(f,o,"Generator"),st(f,n,function(){return this}),st(f,"toString",function(){return"[object Generator]"}),(ut=function(){return{w:a,m:h}})()}function st(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}st=function(t,e,r,n){function a(e,r){st(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},st(t,e,r,n)}function ct(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function ft(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){ct(a,n,o,i,l,"next",t)}function l(t){ct(a,n,o,i,l,"throw",t)}i(void 0)})}}var ht=function(){var t=ft(ut().m(function t(e,r,n,o){var a,i=arguments;return ut().w(function(t){for(;;)switch(t.n){case 0:if(a=i.length>4&&void 0!==i[4]?i[4]:2,r.length){t.n=1;break}return t.a(2);case 1:return e._activeSymbolImageMap={},e._selectedSymbolImageMap={},t.n=2,Promise.all(r.flatMap(function(t){var r=o.getSymbolImageId(t,n,!1,a),i=o.getSymbolImageId(t,n,!0,a);return r&&i&&(e._activeSymbolImageMap[r]=i),["normal","active","selected"].map(function(){var l=ft(ut().m(function l(u){var s,c;return ut().w(function(l){for(;;)switch(l.n){case 0:if(s="active"===u?i:r,"selected"===u||s&&!e.hasImage(s)){l.n=1;break}return l.a(2);case 1:return l.n=2,o.rasteriseSymbolImage(t,n,u,a);case 2:(c=l.v)&&("selected"===u&&r&&(e._selectedSymbolImageMap[r]=c.imageId),e.hasImage(c.imageId)||e.addImage(c.imageId,c.imageData,{pixelRatio:a}));case 3:return l.a(2)}},l)}));return function(t){return l.apply(this,arguments)}}())}));case 2:return t.a(2)}},t)}));return function(e,r,n,o){return t.apply(this,arguments)}}(),pt=function(t){return Math.max(2,2*t)},yt=function(t,e,r){return t.replace(/\{\{foregroundColor\}\}/g,e||"black").replace(/\{\{backgroundColor\}\}/g,r||"transparent")};function dt(t){return dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dt(t)}var gt=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===dt(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null},vt=function(t,e,r){return new Promise(function(n,o){var a="data:image/svg+xml;charset=utf-8,".concat(encodeURIComponent(t)),i=new Image(e,r);i.onload=function(){var t=document.createElement("canvas");t.width=e,t.height=r;var o=t.getContext("2d");o.drawImage(i,0,0,e,r),n(o.getImageData(0,0,e,r))},i.onerror=function(){o(new Error("Failed to rasterise SVG: ".concat(t.slice(0,80))))},i.src=a})};function mt(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof l?n:l,s=Object.create(u.prototype);return bt(s,"_invoke",function(r,n,o){var a,l,u,s=0,c=o||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return a=e,l=0,u=t,h.n=r,i}};function p(r,n){for(l=r,u=n,e=0;!f&&s&&!o&&e<c.length;e++){var o,a=c[e],p=h.p,y=a[2];r>3?(o=y===n)&&(u=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=t):a[0]<=p&&((o=r<2&&p<a[1])?(l=0,h.v=n,h.n=a[1]):p<y&&(o=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,l=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),l=c,u=y;(e=l<2?t:u)||!f;){a||(l?l<3?(l>1&&(h.n=-1),p(l,u)):h.n=u:h.v=u);try{if(s=2,a){if(l||(o="next"),e=a[o]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,l<2&&(l=0)}else 1===l&&(e=a.return)&&e.call(a),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=t}else if((e=(f=h.n<0)?u:r.call(n,h))!==i)break}catch(e){a=t,l=1,u=e}finally{s=1}}return{value:e,done:f}}}(r,o,a),!0),s}var i={};function l(){}function u(){}function s(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(bt(e={},n,function(){return this}),e),f=s.prototype=l.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,bt(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,bt(f,"constructor",s),bt(s,"constructor",u),u.displayName="GeneratorFunction",bt(s,o,"GeneratorFunction"),bt(f),bt(f,o,"Generator"),bt(f,n,function(){return this}),bt(f,"toString",function(){return"[object Generator]"}),(mt=function(){return{w:a,m:h}})()}function bt(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}bt=function(t,e,r,n){function a(e,r){bt(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},bt(t,e,r,n)}function Mt(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function wt(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){Mt(a,n,o,i,l,"next",t)}function l(t){Mt(a,n,o,i,l,"throw",t)}i(void 0)})}}var St=new Map,Pt=function(){var t=wt(mt().m(function t(e,r,n,o){var a,i,l,u,s,c,f,h,p,y;return mt().w(function(t){for(;;)switch(t.n){case 0:if(a=n.getPatternInnerContent(e)){t.n=1;break}return t.a(2,null);case 1:if(i=n.getPatternImageId(e,r,o)){t.n=2;break}return t.a(2,null);case 2:if(l=St.get(i)){t.n=4;break}return u=gt(e.fillPatternForegroundColor,r)||"black",s=gt(e.fillPatternBackgroundColor,r)||"transparent",c=yt(a,u,s),f='<rect width="16" height="16" fill="'.concat(s,'"/>'),h=pt(o),p=Math.round(8*h),y='<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(p,'" height="').concat(p,'" viewBox="0 0 16 16">').concat(f).concat(c,"</svg>"),t.n=3,vt(y,p,p);case 3:l=t.v,St.set(i,l);case 4:return t.a(2,{imageId:i,imageData:l})}},t)}));return function(e,r,n,o){return t.apply(this,arguments)}}(),xt=function(){var t=wt(mt().m(function t(e,r,n,o,a){var i,l;return mt().w(function(t){for(;;)switch(t.n){case 0:if(r.length){t.n=1;break}return t.a(2);case 1:return i=pt(a),l=r.reduce(function(t,r){var l=o.getPatternImageId(r,n,a);return!l||t[l]||e.hasImage(l)||(t[l]=wt(mt().m(function t(){var l;return mt().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,Pt(r,n,o,a);case 1:(l=t.v)&&!e.hasImage(l.imageId)&&e.addImage(l.imageId,l.imageData,{pixelRatio:i});case 2:return t.a(2)}},t)}))),t},{}),t.n=2,Promise.all(Object.values(l).map(function(t){return t()}));case 2:return t.a(2)}},t)}));return function(e,r,n,o,a){return t.apply(this,arguments)}}(),Ot=["container","padding","mapStyle","mapSize","center","zoom","bounds","pixelRatio"];function Et(t){return Et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Et(t)}function Nt(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof l?n:l,s=Object.create(u.prototype);return jt(s,"_invoke",function(r,n,o){var a,l,u,s=0,c=o||[],f=!1,h={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return a=e,l=0,u=t,h.n=r,i}};function p(r,n){for(l=r,u=n,e=0;!f&&s&&!o&&e<c.length;e++){var o,a=c[e],p=h.p,y=a[2];r>3?(o=y===n)&&(u=a[(l=a[4])?5:(l=3,3)],a[4]=a[5]=t):a[0]<=p&&((o=r<2&&p<a[1])?(l=0,h.v=n,h.n=a[1]):p<y&&(o=r<3||a[0]>n||n>y)&&(a[4]=r,a[5]=n,h.n=y,l=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===c&&p(c,y),l=c,u=y;(e=l<2?t:u)||!f;){a||(l?l<3?(l>1&&(h.n=-1),p(l,u)):h.n=u:h.v=u);try{if(s=2,a){if(l||(o="next"),e=a[o]){if(!(e=e.call(a,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,l<2&&(l=0)}else 1===l&&(e=a.return)&&e.call(a),l<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),l=1);a=t}else if((e=(f=h.n<0)?u:r.call(n,h))!==i)break}catch(e){a=t,l=1,u=e}finally{s=1}}return{value:e,done:f}}}(r,o,a),!0),s}var i={};function l(){}function u(){}function s(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(jt(e={},n,function(){return this}),e),f=s.prototype=l.prototype=Object.create(c);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,jt(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=s,jt(f,"constructor",s),jt(s,"constructor",u),u.displayName="GeneratorFunction",jt(s,o,"GeneratorFunction"),jt(f),jt(f,o,"Generator"),jt(f,n,function(){return this}),jt(f,"toString",function(){return"[object Generator]"}),(Nt=function(){return{w:a,m:h}})()}function jt(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}jt=function(t,e,r,n){function a(e,r){jt(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},jt(t,e,r,n)}function At(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Tt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?At(Object(r),!0).forEach(function(e){It(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):At(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function It(t,e,r){return(e=Ct(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Lt(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function kt(t,e,r,n,o,a,i){try{var l=t[a](i),u=l.value}catch(t){return void r(t)}l.done?e(u):Promise.resolve(u).then(n,o)}function Rt(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){kt(a,n,o,i,l,"next",t)}function l(t){kt(a,n,o,i,l,"throw",t)}i(void 0)})}}function _t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ct(n.key),n)}}function Ct(t){var e=function(t){if("object"!=Et(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Et(e)?e:e+""}var Dt=function(){return t=function t(e){var r=e.mapFramework,n=e.mapProviderConfig,a=void 0===n?{}:n,i=e.events,l=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.maplibreModule=r,this.events=i,this.eventBus=l,this.capabilities={supportedShortcuts:o,supportsMapSizes:!0},Object.assign(this,a)},e=[{key:"name",get:function(){return"MapLibreProvider"}},{key:"initMap",value:(u=Rt(Nt().m(function t(e){var r,n,o,l,u,f,h,p,y,d,g,v,m,b=this;return Nt().w(function(t){for(;;)switch(t.n){case 0:r=e.container,n=e.padding,o=e.mapStyle,l=e.mapSize,u=e.center,f=e.zoom,h=e.bounds,p=e.pixelRatio,y=Lt(e,Ot),this.mapStyleId=null==o?void 0:o.id,this.mapSize=l,d=this.maplibreModule.Map,g=this.events,v=this.eventBus,(m=new d(Tt(Tt({},y),{},{container:r,style:null==o?void 0:o.url,pixelRatio:p,padding:n,center:u,zoom:f,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=m,this.map.setPadding(n),h&&m.fitBounds(h,{duration:0}),i(m),a(m),s({map:m,events:g,eventBus:v,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({mapProvider:this,map:m,events:g,eventBus:v}),m.on("load",function(){b.labelNavigator=F(m,null==o?void 0:o.mapColorScheme,g,v)}),this.eventBus.emit(g.MAP_READY,{map:this.map,mapStyleId:this.mapStyleId,mapSize:this.mapSize,crs:this.crs});case 1:return t.a(2)}},t,this)})),function(t){return u.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;this.setHoverCursor([]),null===(t=this.mapEvents)||void 0===t||t.remove(),null===(e=this.appEvents)||void 0===e||e.remove(),this.mapEvents=null,this.appEvents=null,this.map.remove()}},{key:"setHoverCursor",value:function(t){this.map&&(this._onHoverMove=lt(this.map,t,this._onHoverMove))}},{key:"setView",value:function(t){var e=t.center,r=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:this.map.isStyleLoaded()?n:0})}},{key:"zoomIn",value:function(t){this.map.easeTo({zoom:this.getZoom()+t,duration:n})}},{key:"zoomOut",value:function(t){this.map.easeTo({zoom:this.getZoom()-t,duration:n})}},{key:"panBy",value:function(t){this.map.panBy(t,{duration:n})}},{key:"fitToBounds",value:function(t){var e=Array.isArray(t)?t:x(t),r=this.map.isStyleLoaded()?n:0;this.map.fitBounds(e,{duration:r})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e,r){return function(t){var e=t.LngLatBounds,r=t.map,n=t.selectedFeatures,o=t.activeFeatures,a=t.stylesMap;if(!r)return null;null!=o&&o.length?(rt(r,o,a,U,J),rt(r,o,a,V,K)):(Q(r,U),Q(r,V));var i={};null!=n&&n.length?i=rt(r,n,a,Y,K):Q(r,Y);var l=[];return Object.entries(i).forEach(function(t){var e=G(t,2)[1],n=e.ids,o=e.idProperty,a=e.layerId;l.push.apply(l,function(t){return function(t){if(Array.isArray(t))return z(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||$(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(r.queryRenderedFeatures({layers:[a]}).filter(function(t){var e;return n.has(o?null===(e=t.properties)||void 0===e?void 0:e[o]:t.id)})))}),function(t,e){if(!e.length)return null;var r=new t;return e.forEach(function(t){var e=function(t){return"number"==typeof t[0]?r.extend(t):t.forEach(e)};e(t.geometry.coordinates)}),[r.getWest(),r.getSouth(),r.getEast(),r.getNorth()]}(e,l)}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,activeFeatures:e,stylesMap:r})}},{key:"highlightNextLabel",value:function(t){var e;return(null===(e=this.labelNavigator)||void 0===e?void 0:e.highlightNextLabel(t))||null}},{key:"highlightLabelAtCenter",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.highlightLabelAtCenter())||null}},{key:"clearHighlightedLabel",value:function(){var t;return(null===(t=this.labelNavigator)||void 0===t?void 0:t.clearHighlightedLabel())||null}},{key:"getCenter",value:function(){var t=this.map.getCenter();return[Number(t.lng.toFixed(7)),Number(t.lat.toFixed(7))]}},{key:"getZoom",value:function(){return Number(this.map.getZoom().toFixed(7))}},{key:"getBounds",value:function(){return this.map.getBounds().toArray().flat(1)}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){var r=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).radius,n=void 0===r?10:r,o=[[e.x-n,e.y-n],[e.x+n,e.y+n]],a=t.queryRenderedFeatures(o);if(0===a.length)return[];var i=new Set(t.queryRenderedFeatures([e.x,e.y]).map(function(t){var e,r=void 0===t.id?JSON.stringify(t.properties):t.id;return"".concat(null===(e=t.layer)||void 0===e?void 0:e.source,":").concat(r)})),l=[];a.forEach(function(t){!1===l.includes(t.layer.id)&&l.push(t.layer.id)});for(var u=new Set,s=[],c=a.length-1;c>=0;c--){var f,h=a[c],p=void 0===h.id?JSON.stringify(h.properties):h.id,y="".concat(null===(f=h.layer)||void 0===f?void 0:f.source,":").concat(p);!1===u.has(y)&&(u.add(y),s.push(h))}var d=t.unproject(e),g=[d.lng,d.lat],v=s.filter(function(t){var e=t.geometry.type;if(e.includes("Polygon"))return("Polygon"===e?[t.geometry.coordinates]:t.geometry.coordinates).some(function(t){return function(t,e){for(var r=nt(t,2),n=r[0],o=r[1],a=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var u=nt(e[i],2),s=u[0],c=u[1],f=nt(e[l],2),h=f[0],p=f[1];c>o!=p>o&&n<(h-s)*(o-c)/(p-c)+s&&(a=!a)}return a}(g,t[0])});if("Point"===e||"MultiPoint"===e){var r,n=void 0===t.id?JSON.stringify(t.properties):t.id;return i.has("".concat(null===(r=t.layer)||void 0===r?void 0:r.source,":").concat(n))}return!0});return v.map(function(r){var n=0,o=r.geometry.type,a=function(t,e,r){var n=r.coordinates,o=r.type,a=1/0,i=function(e){return t.project(e)},l=function(t){for(var r=0;r<t.length-1;r++){var n=at(e,i(t[r]),i(t[r+1]));n<a&&(a=n)}};if("Point"===o){var u=i(n);a=Math.pow(e.x-u.x,2)+Math.pow(e.y-u.y,2)}else"LineString"===o||"MultiPoint"===o?"LineString"===o?l(n):n.forEach(function(t){var r=i(t),n=Math.pow(e.x-r.x,2)+Math.pow(e.y-r.y,2);n<a&&(a=n)}):"Polygon"===o||"MultiLineString"===o?n.forEach(l):"MultiPolygon"===o&&n.forEach(function(t){return t.forEach(l)});return a}(t,e,r.geometry);return n+=1e6*l.indexOf(r.layer.id),o.includes("Polygon")&&(n-=5e5),{f:r,score:n+=a}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getVisibleFeatures",value:function(t){var e=this,r=t.filter(function(t){return e.map.getLayer(t)});return r.length?this.map.queryRenderedFeatures(void 0,{layers:r}):[]}},{key:"addSymbolsToMap",value:(l=Rt(Nt().m(function t(e,r,n){var o;return Nt().w(function(t){for(;;)if(0===t.n)return o=this.map.getPixelRatio()||1,t.a(2,ht(this.map,e,r,n,o))},t,this)})),function(t,e,r){return l.apply(this,arguments)})},{key:"addPatternsToMap",value:(r=Rt(Nt().m(function t(e,r,n){var o;return Nt().w(function(t){for(;;)if(0===t.n)return o=this.map.getPixelRatio()||1,t.a(2,xt(this.map,e,r,n,o))},t,this)})),function(t,e,n){return r.apply(this,arguments)})},{key:"getAreaDimensions",value:function(){return function(t){var e,r,n,o;if(t&&"function"==typeof t.getWest)e=t.getWest(),r=t.getSouth(),n=t.getEast(),o=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var a=b(t,2),i=b(a[0],2);e=i[0],r=i[1];var l=b(a[1],2);n=l[0],o=l[1]}var u=S([e,r],[n,r]),s=S([e,r],[e,o]),c=P(u),f=P(s);return"".concat(f," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,r=e.getContainer().getBoundingClientRect(),n=r.width,o=r.height,a=e.getPadding(),i=[a.left,o-a.bottom],l=[n-a.right,a.top],new t(e.unproject(i),e.unproject(l))));var t,e,r,n,o,a,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var r=b(t,2),n=r[0],o=r[1],a=b(e,2),i=a[0],l=a[1],u=l-o,s=i-n,c=[];if(Math.abs(u)>1e-4){var f=Math.round(S([n,o],[n,l]));c.push("".concat(u>0?"north":"south"," ").concat(P(f)))}if(Math.abs(s)>1e-4){var h=Math.round(S([n,o],[i,o]));c.push("".concat(s>0?"east":"west"," ").concat(P(h)))}return c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return t=this.map.getCenter(),e=this.map.getZoom(),r=t.lat,n=Math.pow(2,e),40075016.686*Math.cos(r*Math.PI/180)/(512*n);var t,e,r,n}},{key:"mapToScreen",value:function(t){return this.map.project(t)}},{key:"screenToMap",value:function(t){var e=this.map.unproject([t.x,t.y]);return[e.lng,e.lat]}},{key:"isGeometryObscured",value:function(t,e){return function(t,e,r){var n=r.getContainer().getBoundingClientRect(),o=b(x(t),4),a=o[0],i=o[1],l=o[2],u=o[3],s=[r.project([a,i]),r.project([a,u]),r.project([l,i]),r.project([l,u])],c=Math.min.apply(Math,m(s.map(function(t){return t.x}))),f=Math.max.apply(Math,m(s.map(function(t){return t.x}))),h=Math.min.apply(Math,m(s.map(function(t){return t.y}))),p=Math.max.apply(Math,m(s.map(function(t){return t.y}))),y=e.left-n.left,d=e.top-n.top,g=e.right-n.left,v=e.bottom-n.top;return c<g&&f>y&&h<v&&p>d}(t,e,this.map)}}],e&&_t(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,l,u}()}}]);
|
|
@@ -40,6 +40,10 @@ export default class MapLibreProvider {
|
|
|
40
40
|
Object.assign(this, mapProviderConfig)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
get name () {
|
|
44
|
+
return 'MapLibreProvider'
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
/**
|
|
44
48
|
* Initialize the map.
|
|
45
49
|
*
|
|
@@ -317,8 +321,7 @@ export default class MapLibreProvider {
|
|
|
317
321
|
* The pixel ratio is computed as device pixel ratio × map size scale factor so symbols
|
|
318
322
|
* are rasterised at the correct resolution for the current device DPI and map size.
|
|
319
323
|
*
|
|
320
|
-
* @param {Object[]} symbolConfigs -
|
|
321
|
-
* Callers are responsible for sublayer merging before passing configs here.
|
|
324
|
+
* @param {Object[]} symbolConfigs - an array of symbol configs
|
|
322
325
|
* @param {Object} mapStyle - Current map style config (provides id, selectedColor, haloColor)
|
|
323
326
|
* @param {Object} symbolRegistry
|
|
324
327
|
* @returns {Promise<void>}
|
|
@@ -333,8 +336,7 @@ export default class MapLibreProvider {
|
|
|
333
336
|
* Delegates to the shared pattern image utility so any plugin's MapLibre adapter can
|
|
334
337
|
* register patterns without importing provider internals directly.
|
|
335
338
|
*
|
|
336
|
-
* @param {Object[]} patternConfigs -
|
|
337
|
-
* Callers are responsible for sublayer merging before passing configs here.
|
|
339
|
+
* @param {Object[]} patternConfigs - an array of pattern configs
|
|
338
340
|
* @param {string} mapStyleId
|
|
339
341
|
* @param {Object} patternRegistry
|
|
340
342
|
* @returns {Promise<void>}
|
|
@@ -86,6 +86,11 @@ describe('MapLibreProvider', () => {
|
|
|
86
86
|
...extra
|
|
87
87
|
})
|
|
88
88
|
|
|
89
|
+
test('it should have a name getter', () => {
|
|
90
|
+
const p = makeProvider()
|
|
91
|
+
expect(p.name).toBe('MapLibreProvider')
|
|
92
|
+
})
|
|
93
|
+
|
|
89
94
|
test('constructor spreads mapProviderConfig and sets capabilities', () => {
|
|
90
95
|
const p = makeProvider({ mapProviderConfig: { crs: 'EPSG:4326', tileSize: 512 } })
|
|
91
96
|
expect(p.crs).toBe('EPSG:4326')
|