@defra/interactive-map 0.0.5-alpha → 0.0.7-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/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api.md +10 -5
- package/package.json +56 -4
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +2 -0
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js.LICENSE.txt +1 -0
- package/plugins/beta/draw-es/dist/esm/index.js +2 -0
- package/plugins/beta/draw-es/dist/esm/index.js.LICENSE.txt +1 -0
- package/plugins/beta/draw-ml/dist/css/index.css +1 -1
- 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/DrawInit.jsx +15 -0
- package/plugins/beta/draw-ml/src/api/deleteFeature.js +4 -4
- package/plugins/beta/draw-ml/src/api/editFeature.js +10 -5
- package/plugins/beta/draw-ml/src/draw.scss +1 -0
- package/plugins/beta/draw-ml/src/events.js +2 -0
- package/plugins/beta/draw-ml/src/manifest.js +18 -43
- package/plugins/beta/draw-ml/src/modes/createDrawMode.js +35 -1
- package/plugins/beta/draw-ml/src/modes/editVertexMode.js +17 -1
- package/plugins/interact/dist/css/index.css +1 -1
- 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/defaults.js +1 -0
- package/plugins/interact/src/events.js +6 -1
- package/plugins/interact/src/events.test.js +19 -5
- package/plugins/interact/src/hooks/useInteractionHandlers.js +7 -2
- package/plugins/interact/src/hooks/useInteractionHandlers.test.js +28 -0
- package/plugins/interact/src/interact.scss +1 -0
- package/plugins/interact/src/manifest.js +22 -16
- package/plugins/interact/src/manifest.test.js +1 -1
- package/plugins/interact/src/reducer.js +1 -0
- package/plugins/interact/src/reducer.test.js +1 -0
- package/plugins/interact/src/utils/spatial.js +4 -0
- package/plugins/interact/src/utils/spatial.test.js +8 -1
- package/providers/beta/esri/dist/css/im-esri-provider.css +1 -0
- package/providers/beta/esri/dist/esm/im-esri-provider.js +2 -0
- package/providers/beta/esri/dist/esm/im-esri-provider.js.LICENSE.txt +1 -0
- package/providers/beta/esri/dist/esm/index.js +2 -0
- package/providers/beta/esri/dist/esm/index.js.LICENSE.txt +1 -0
- package/providers/beta/esri/src/esriProvider.js +12 -0
- package/providers/beta/esri/src/mapEvents.js +2 -2
- 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 +11 -1
- package/providers/maplibre/src/utils/highlightFeatures.js +6 -2
- package/src/App/components/Actions/Actions.jsx +2 -1
- package/src/App/components/Actions/Actions.module.scss +14 -0
- package/src/App/components/Actions/Actions.test.jsx +2 -2
- package/src/App/components/MapButton/MapButton.module.scss +19 -6
- package/src/App/components/PopupMenu/PopupMenu.jsx +69 -14
- package/src/App/components/PopupMenu/PopupMenu.module.scss +70 -7
- package/src/App/components/PopupMenu/PopupMenu.test.jsx +102 -16
- package/src/App/hooks/useButtonStateEvaluator.js +2 -2
- package/src/App/hooks/useInterfaceAPI.js +26 -32
- package/src/App/registry/pluginRegistry.js +2 -2
- package/src/App/renderer/mapButtons.js +6 -1
- package/src/App/renderer/mapButtons.test.js +20 -0
- package/src/App/store/AppProvider.jsx +18 -18
- package/src/App/store/MapProvider.jsx +2 -2
- package/src/App/store/appActionsMap.js +3 -0
- package/src/App/store/appActionsMap.test.js +5 -0
- package/src/App/store/mapActionsMap.js +3 -2
- package/src/App/store/mapReducer.js +1 -0
- package/src/scss/settings/_colors.scss +1 -1
- package/src/scss/settings/_dimensions.scss +3 -2
- package/src/utils/detectInterfaceType.js +2 -1
- package/webpack.esm.mjs +19 -10
|
@@ -4,6 +4,7 @@ describe('attachEvents', () => {
|
|
|
4
4
|
let createParams, cleanup
|
|
5
5
|
|
|
6
6
|
beforeEach(() => {
|
|
7
|
+
jest.useFakeTimers()
|
|
7
8
|
// factory function to create fresh params for each test
|
|
8
9
|
createParams = () => ({
|
|
9
10
|
appState: { layoutRefs: { viewportRef: { current: document.body } }, disabledButtons: new Set() },
|
|
@@ -20,7 +21,10 @@ describe('attachEvents', () => {
|
|
|
20
21
|
})
|
|
21
22
|
})
|
|
22
23
|
|
|
23
|
-
afterEach(() =>
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
cleanup?.()
|
|
26
|
+
jest.useRealTimers()
|
|
27
|
+
})
|
|
24
28
|
|
|
25
29
|
it('keyboard Enter triggers only on viewport', () => {
|
|
26
30
|
const params = createParams()
|
|
@@ -61,15 +65,25 @@ describe('attachEvents', () => {
|
|
|
61
65
|
expect(params.handleInteraction).not.toHaveBeenCalled()
|
|
62
66
|
})
|
|
63
67
|
|
|
64
|
-
it('map click triggers interaction', () => {
|
|
68
|
+
it('map click triggers interaction after timer fires', () => {
|
|
65
69
|
const params = createParams()
|
|
66
70
|
cleanup = attachEvents(params)
|
|
71
|
+
jest.runAllTimers()
|
|
67
72
|
|
|
68
73
|
const handler = params.eventBus.on.mock.calls.find(c => c[0]==='map:click')[1]
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
handler({ point:{x:1,y:2}, coords:[3,4] })
|
|
75
|
+
|
|
76
|
+
expect(params.handleInteraction).toHaveBeenCalledWith({ point:{x:1,y:2}, coords:[3,4] })
|
|
77
|
+
})
|
|
71
78
|
|
|
72
|
-
|
|
79
|
+
it('map click is suppressed immediately after enable before timer fires', () => {
|
|
80
|
+
const params = createParams()
|
|
81
|
+
cleanup = attachEvents(params)
|
|
82
|
+
|
|
83
|
+
const handler = params.eventBus.on.mock.calls.find(c => c[0]==='map:click')[1]
|
|
84
|
+
handler({ point:{x:1,y:2}, coords:[3,4] })
|
|
85
|
+
|
|
86
|
+
expect(params.handleInteraction).not.toHaveBeenCalled()
|
|
73
87
|
})
|
|
74
88
|
|
|
75
89
|
it('selectAtTarget triggers crosshair interaction', () => {
|
|
@@ -37,7 +37,7 @@ export const useInteractionHandlers = ({
|
|
|
37
37
|
mapProvider,
|
|
38
38
|
}) => {
|
|
39
39
|
const { markers } = mapState
|
|
40
|
-
const { dispatch, dataLayers, interactionMode, multiSelect, contiguous, markerColor, tolerance, selectedFeatures, selectionBounds } = pluginState
|
|
40
|
+
const { dispatch, dataLayers, interactionMode, multiSelect, contiguous, markerColor, tolerance, selectedFeatures, selectionBounds, deselectOnClickOutside } = pluginState
|
|
41
41
|
const { eventBus } = services
|
|
42
42
|
const layerConfigMap = buildLayerConfigMap(dataLayers)
|
|
43
43
|
|
|
@@ -64,6 +64,10 @@ export const useInteractionHandlers = ({
|
|
|
64
64
|
dispatch({ type: 'CLEAR_SELECTED_FEATURES' })
|
|
65
65
|
markers.add('location', coords, { color: markerColor })
|
|
66
66
|
eventBus.emit('interact:markerchange', { coords })
|
|
67
|
+
} else if (deselectOnClickOutside) {
|
|
68
|
+
dispatch({ type: 'CLEAR_SELECTED_FEATURES' })
|
|
69
|
+
} else {
|
|
70
|
+
// No action
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
// Internal helper to keep complexity low
|
|
@@ -102,7 +106,8 @@ export const useInteractionHandlers = ({
|
|
|
102
106
|
layerConfigMap,
|
|
103
107
|
pluginState?.debug,
|
|
104
108
|
tolerance,
|
|
105
|
-
markerColor
|
|
109
|
+
markerColor,
|
|
110
|
+
deselectOnClickOutside
|
|
106
111
|
])
|
|
107
112
|
|
|
108
113
|
useSelectionChangeEmitter(eventBus, selectedFeatures, selectionBounds)
|
|
@@ -219,6 +219,34 @@ describe('contiguous selection', () => {
|
|
|
219
219
|
})
|
|
220
220
|
})
|
|
221
221
|
|
|
222
|
+
/* ------------------------------------------------------------------ */
|
|
223
|
+
/* deselectOnClickOutside */
|
|
224
|
+
/* ------------------------------------------------------------------ */
|
|
225
|
+
|
|
226
|
+
describe('deselectOnClickOutside', () => {
|
|
227
|
+
beforeEach(() => {
|
|
228
|
+
featureQueries.getFeaturesAtPoint.mockReturnValue([])
|
|
229
|
+
featureQueries.findMatchingFeature.mockReturnValue(null)
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
it('clears selection when clicking outside a feature in select mode', () => {
|
|
233
|
+
const { result, deps } = setup({ deselectOnClickOutside: true })
|
|
234
|
+
|
|
235
|
+
click(result)
|
|
236
|
+
|
|
237
|
+
expect(deps.pluginState.dispatch).toHaveBeenCalledWith({ type: 'CLEAR_SELECTED_FEATURES' })
|
|
238
|
+
expect(deps.mapState.markers.add).not.toHaveBeenCalled()
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
it('does not clear selection when deselectOnClickOutside is false', () => {
|
|
242
|
+
const { result, deps } = setup({ deselectOnClickOutside: false })
|
|
243
|
+
|
|
244
|
+
click(result)
|
|
245
|
+
|
|
246
|
+
expect(deps.pluginState.dispatch).not.toHaveBeenCalled()
|
|
247
|
+
})
|
|
248
|
+
})
|
|
249
|
+
|
|
222
250
|
/* ------------------------------------------------------------------ */
|
|
223
251
|
/* Marker condition guard (FULL COVERAGE) */
|
|
224
252
|
/* ------------------------------------------------------------------ */
|
|
@@ -16,28 +16,28 @@ export const manifest = {
|
|
|
16
16
|
},
|
|
17
17
|
|
|
18
18
|
buttons: [{
|
|
19
|
-
id: '
|
|
20
|
-
label: '
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
id: 'selectAtTarget',
|
|
20
|
+
label: 'Select',
|
|
21
|
+
iconId: 'select',
|
|
22
|
+
variant: 'touch',
|
|
23
|
+
hiddenWhen: ({ appState, pluginState }) => !pluginState.enabled || appState.interfaceType !== 'touch',
|
|
24
24
|
mobile: {
|
|
25
25
|
slot: 'actions',
|
|
26
|
-
showLabel:
|
|
26
|
+
showLabel: false
|
|
27
27
|
},
|
|
28
28
|
tablet: {
|
|
29
29
|
slot: 'actions',
|
|
30
|
-
showLabel:
|
|
30
|
+
showLabel: false
|
|
31
31
|
},
|
|
32
32
|
desktop: {
|
|
33
33
|
slot: 'actions',
|
|
34
|
-
showLabel:
|
|
34
|
+
showLabel: false
|
|
35
35
|
}
|
|
36
36
|
},{
|
|
37
|
-
id: '
|
|
38
|
-
label: '
|
|
39
|
-
variant: '
|
|
40
|
-
hiddenWhen: ({ appState, pluginState }) => !pluginState.enabled || !['
|
|
37
|
+
id: 'selectCancel',
|
|
38
|
+
label: 'Back',
|
|
39
|
+
variant: 'tertiary',
|
|
40
|
+
hiddenWhen: ({ appConfig, appState, pluginState }) => !pluginState.enabled || !(['hybrid', 'buttonFirst'].includes(appConfig.behaviour) && appState.isFullscreen),
|
|
41
41
|
mobile: {
|
|
42
42
|
slot: 'actions',
|
|
43
43
|
showLabel: true
|
|
@@ -51,10 +51,11 @@ export const manifest = {
|
|
|
51
51
|
showLabel: true
|
|
52
52
|
}
|
|
53
53
|
},{
|
|
54
|
-
id: '
|
|
55
|
-
label: '
|
|
56
|
-
variant: '
|
|
57
|
-
|
|
54
|
+
id: 'selectDone',
|
|
55
|
+
label: 'Continue',
|
|
56
|
+
variant: 'primary',
|
|
57
|
+
excludeWhen: ({ appState, pluginState }) => !pluginState.enabled || !appState.isFullscreen,
|
|
58
|
+
enableWhen: ({ mapState, pluginState }) => !!mapState.markers.items.some(m => m.id === 'location') || !!pluginState.selectionBounds,
|
|
58
59
|
mobile: {
|
|
59
60
|
slot: 'actions',
|
|
60
61
|
showLabel: true
|
|
@@ -76,6 +77,11 @@ export const manifest = {
|
|
|
76
77
|
command: '<kbd>Enter</kbd></dd>'
|
|
77
78
|
}],
|
|
78
79
|
|
|
80
|
+
icons: [{
|
|
81
|
+
id: 'select',
|
|
82
|
+
svgContent: '<path d="M22 14a8 8 0 0 1-8 8"/><path d="M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1"/><path d="M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10"/><path d="M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/>'
|
|
83
|
+
}],
|
|
84
|
+
|
|
79
85
|
api: {
|
|
80
86
|
enable,
|
|
81
87
|
disable,
|
|
@@ -26,7 +26,7 @@ describe('manifest', () => {
|
|
|
26
26
|
manifest.buttons.forEach(b => {
|
|
27
27
|
['mobile','tablet','desktop'].forEach(dev => {
|
|
28
28
|
expect(b[dev].slot).toBe('actions')
|
|
29
|
-
expect(b[dev].showLabel).toBe(
|
|
29
|
+
expect(typeof b[dev].showLabel).toBe('boolean')
|
|
30
30
|
})
|
|
31
31
|
})
|
|
32
32
|
})
|
|
@@ -80,13 +80,20 @@ describe('areAllContiguous', () => {
|
|
|
80
80
|
const C = poly([[4,0],[6,0],[6,2],[4,2],[4,0]]) // touches B
|
|
81
81
|
const D = poly([[10,10],[12,10],[12,12],[10,12],[10,10]]) // isolated
|
|
82
82
|
|
|
83
|
+
const noGeom = { geometry: undefined }
|
|
84
|
+
const noType = { geometry: {} }
|
|
85
|
+
|
|
83
86
|
it.each([
|
|
84
87
|
[[], false],
|
|
85
88
|
[[A], false],
|
|
86
89
|
[[A, B], true],
|
|
87
90
|
[[A, B, C], true],
|
|
88
91
|
[[A, D], false],
|
|
89
|
-
[[A, B, D], false]
|
|
92
|
+
[[A, B, D], false],
|
|
93
|
+
[[noGeom, A], false],
|
|
94
|
+
[[A, noGeom], false],
|
|
95
|
+
[[noGeom, noGeom], false],
|
|
96
|
+
[[noType, A], false]
|
|
90
97
|
])('returns expected result for %# features', (features, expected) => {
|
|
91
98
|
expect(areAllContiguous(features)).toBe(expected)
|
|
92
99
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{font-family:inherit !important;text-rendering:auto !important;-webkit-font-smoothing:auto !important;-moz-osx-font-smoothing:auto !important}:root:not(.esri-ui):not([class*=calcite]):not([class*=esri]){--calcite-font-family: inherit !important;--calcite-sans-family: inherit !important}body,html{font-family:inherit !important;text-rendering:auto !important;-webkit-font-smoothing:auto !important;-moz-osx-font-smoothing:auto !important}.your-map-container{font-family:var(--calcite-font-family)}:not(.esri-view):not(.esri-ui):not([class*=calcite]):not([class*=esri]).calcite-typography,:not(.esri-view):not(.esri-ui):not([class*=calcite]):not([class*=esri]) .calcite-typography{font-family:inherit !important;font-size:inherit !important;font-weight:inherit !important;letter-spacing:inherit !important;line-height:inherit !important}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see im-esri-provider.js.LICENSE.txt */
|
|
2
|
+
export const __webpack_esm_id__="im-esri-provider";export const __webpack_esm_ids__=["im-esri-provider"];export const __webpack_esm_modules__={"./providers/beta/esri/src/esriProvider.js"(t,e,n){n.d(e,{default:()=>D}),n.r(e);var r=n("@arcgis/core/config.js"),o=n("@arcgis/core/Map.js"),i=n("@arcgis/core/views/MapView.js"),a=n("@arcgis/core/layers/VectorTileLayer.js"),u={animationDuration:200},c=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];function s(t){var e=t.baseTileLayer,n=t.events,r=t.eventBus,o=function(t){e.loadStyle(t.url).then(function(){r.emit(n.MAP_STYLE_CHANGE,t)})};return r.on(n.MAP_SET_STYLE,o),{remove:function(){r.off(n.MAP_SET_STYLE,o)}}}var l=n("@arcgis/core/core/reactiveUtils.js"),f=function(t,e){var n=null,r=function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];clearTimeout(n),n=setTimeout(function(){t.apply(void 0,o)},e)};return r.cancel=function(){n&&(clearTimeout(n),n=null)},r};function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function p(t){var e=t.mapProvider,n=t.view,r=t.baseTileLayer,o=t.events,i=t.eventBus,a=t.getZoom,u=t.getCenter,c=t.getBounds,s=t.getResolution,p=!1,y=[],m=[],h=function(t){var e=function(){if(p||!n||n.destroyed||!n.extent)return null;var t=n.constraints,e=t.maxZoom,r=t.minZoom;return{center:u(),bounds:c(),resolution:s(),zoom:a(),isAtMaxZoom:n.zoom+.01>=e,isAtMinZoom:n.zoom-.01<=r}}();e&&i.emit(t,e)};(0,l.when)(function(){return r.loaded&&n.resolution>0},function(){return h(o.MAP_LOADED)}),(0,l.once)(function(){return n.ready}).then(function(){p||i.emit(o.MAP_READY,e.getMapAPI())}),(0,l.once)(function(){return n.stationary}).then(function(){return h(o.MAP_FIRST_IDLE)});var d=f(function(){return h(o.MAP_MOVE_END)},500);m.push(d),y.push((0,l.watch)(function(){return[n.interacting,n.animation]},function(t){var e,n,r=(n=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(e,n)||function(t,e){if(t){if("string"==typeof t)return v(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(t,e):void 0}}(e,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=r[0],u=r[1];(a||u)&&i.emit(o.MAP_MOVE_START),a||u||d()}));var b,g,w=(b=function(){return h(o.MAP_MOVE)},g=0,function(){var t=Date.now();t-g>=10&&(g=t,b.apply(void 0,arguments))});m.push(w),y.push((0,l.watch)(function(){return n.zoom},w)),y.push((0,l.watch)(function(){return n.extent},function(){return i.emit(o.MAP_RENDER)},{initial:!1}));var x=f(function(){return h(o.MAP_DATA_CHANGE)},500);return m.push(x),y.push((0,l.watch)(function(){return n.updating},function(t){return!t&&x()})),y.push(n.on("click",function(t){var e=t.mapPoint,n={x:t.x,y:t.y};i.emit(o.MAP_CLICK,{point:n,coords:[e.x,e.y]})})),{remove:function(){p=!0,m.forEach(function(t){return t.cancel()}),y.forEach(function(t){return t.remove()})}}}var y=n("@arcgis/core/geometry/Extent.js");function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,o,i,a,u=[],c=!0,s=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(u.push(r.value),u.length!==e);c=!0);}catch(t){s=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(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 h(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var d=function(t){var e=1609.344,n=t/e;if(n<.5/e)return"".concat(Math.round(t),"m");if(n<10){var r=Number.parseFloat(n.toFixed(1)),o=1===r?"mile":"miles";return"".concat(r," ").concat(o)}var i=Math.round(n),a=1===i?"mile":"miles";return"".concat(i," ").concat(a)},b={top:0,right:0,bottom:0,left:0};function g(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return w(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,v={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,u=0,c=t,v.n=n,a}};function p(n,r){for(u=n,c=r,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=v.p,y=i[2];n>3?(o=y===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,v.v=r,v.n=i[1]):p<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,v.n=y,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),u=l,c=y;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(v.n=-1),p(u,c)):v.n=c:v.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=v.n<0)?c:n.call(r,v))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(w(e={},r,function(){return this}),e),f=s.prototype=u.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,w(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,w(f,"constructor",s),w(s,"constructor",c),c.displayName="GeneratorFunction",w(s,o,"GeneratorFunction"),w(f),w(f,o,"Generator"),w(f,r,function(){return this}),w(f,"toString",function(){return"[object Generator]"}),(g=function(){return{w:i,m:v}})()}function w(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}w=function(t,e,n,r){function i(e,n){w(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},w(t,e,n,r)}function x(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function _(){var t;return t=g().m(function t(e,n){var r,o;return g().w(function(t){for(;;)switch(t.n){case 0:if(e&&n){t.n=1;break}return t.a(2,[]);case 1:if((r=e.map.layers.filter(function(t){return t instanceof a.default})).length){t.n=2;break}return t.a(2,[]);case 2:return t.n=3,e.hitTest(n,{include:r.toArray()});case 3:return o=t.v,t.a(2,o.results.map(function(t){return{layerId:t.layer.id,layerTitle:t.layer.title||t.layer.id,type:t.layer.type,geometry:t.graphic.geometry,symbol:t.graphic.symbol}}))}},t)}),_=function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(t){x(i,r,o,a,u,"next",t)}function u(t){x(i,r,o,a,u,"throw",t)}a(void 0)})},_.apply(this,arguments)}var T=n("@arcgis/core/geometry/Point.js"),S=function(t){return t?new y.default({xmin:t[0],ymin:t[1],xmax:t[2],ymax:t[3],spatialReference:{wkid:27700}}):void 0},E=function(t){return t?new T.default({x:t[0],y:t[1],spatialReference:{wkid:27700}}):void 0},A=function(t){if(t){var e=t.querySelector(".esri-view-surface");e.removeAttribute("role"),e.tabIndex=-1,e.style["outline-color"]="transparent",e.style.touchAction="none"}},j=["container","padding","mapStyle","maxExtent"];function M(t){return M="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},M(t)}function O(){var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function i(n,r,o,i){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return P(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=o||[],f=!1,v={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return i=e,u=0,c=t,v.n=n,a}};function p(n,r){for(u=n,c=r,e=0;!f&&s&&!o&&e<l.length;e++){var o,i=l[e],p=v.p,y=i[2];n>3?(o=y===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=n<2&&p<i[1])?(u=0,v.v=r,v.n=i[1]):p<y&&(o=n<3||i[0]>r||r>y)&&(i[4]=n,i[5]=r,v.n=y,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,l,y){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&p(l,y),u=l,c=y;(e=u<2?t:c)||!f;){i||(u?u<3?(u>1&&(v.n=-1),p(u,c)):v.n=c:v.v=c);try{if(s=2,i){if(u||(o="next"),e=i[o]){if(!(e=e.call(i,c)))throw TypeError("iterator result is not an object");if(!e.done)return e;c=e.value,u<2&&(u=0)}else 1===u&&(e=i.return)&&e.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=t}else if((e=(f=v.n<0)?c:n.call(r,v))!==a)break}catch(e){i=t,u=1,c=e}finally{s=1}}return{value:e,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):(P(e={},r,function(){return this}),e),f=s.prototype=u.prototype=Object.create(l);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,s):(t.__proto__=s,P(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return c.prototype=s,P(f,"constructor",s),P(s,"constructor",c),c.displayName="GeneratorFunction",P(s,o,"GeneratorFunction"),P(f),P(f,o,"Generator"),P(f,r,function(){return this}),P(f,"toString",function(){return"[object Generator]"}),(O=function(){return{w:i,m:v}})()}function P(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}P=function(t,e,n,r){function i(e,n){P(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(i("next",0),i("throw",1),i("return",2))},P(t,e,n,r)}function k(t,e){if(null==t)return{};var n,r,o=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}function z(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,B(r.key),r)}}function B(t){var e=function(t){if("object"!=M(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==M(e)?e:e+""}var D=function(){return t=function t(e){var n=e.mapProviderConfig,r=void 0===n?{}:n,o=e.events,i=e.eventBus;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.events=o,this.eventBus=i,this.capabilities={supportedShortcuts:c,supportsMapSizes:!1},Object.assign(this,r),this.mapEventHandles=[],this.appEventHandles=[]},e=[{key:"initMap",value:(n=O().m(function t(e){var n,u,c,l,f,v,y,m,h,d;return O().w(function(t){for(;;)switch(t.n){case 0:if(n=e.container,u=e.padding,c=e.mapStyle,l=e.maxExtent,k(e,j),f=this.events,v=this.eventBus,!this.setupConfig){t.n=1;break}return t.n=1,this.setupConfig(r.default);case 1:y=new a.default({id:"baselayer",url:c.url,visible:!0}),m=new o.default({layers:[y]}),h=l?S(l):null,d=new i.default({spatialReference:27700,container:n,map:m,zoom:e.zoom,center:E(e.center),maxExtent:l,constraints:{snapToZoom:!1,minZoom:e.minZoom,maxZoom:e.maxZoom,maxScale:0,geometry:h,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1}),A(d.container),d.padding=u,e.bounds&&d.when(function(){return d.goTo(S(e.bounds),{duration:0})}),this.mapEventHandles=p({mapProvider:this,map:m,view:d,baseTileLayer:y,events:f,eventBus:v,getZoom:this.getZoom.bind(this),getCenter:this.getCenter.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),this.appEventHandles=s({baseTileLayer:y,events:f,eventBus:v})||[],this.map=m,this.view=d,this.baseTileLayer=y;case 2:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(r,o){var i=n.apply(t,e);function a(t){z(i,r,o,a,u,"next",t)}function u(t){z(i,r,o,a,u,"throw",t)}a(void 0)})},function(t){return l.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;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.view&&(this.view.container=null,this.view.destroy(),this.view=null),this.map&&(this.map.removeAll(),this.map=null)}},{key:"getMapAPI",value:function(){return{map:this.map,view:this.view,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}},{key:"setView",value:function(t){var e,n=t.center,r=t.zoom;null===(e=this.view.animation)||void 0===e||e.destroy(),this.view.goTo({center:n,zoom:r,duration:u.animationDuration})}},{key:"zoomIn",value:function(t){var e;null===(e=this.view.animation)||void 0===e||e.destroy(),this.view.goTo({zoom:this.view.zoom+t,duration:u.animationDuration})}},{key:"zoomOut",value:function(t){var e;null===(e=this.view.animation)||void 0===e||e.destroy(),this.view.goTo({zoom:this.view.zoom-t,duration:u.animationDuration})}},{key:"panBy",value:function(t){var e=this.view.toScreen(this.view.center),n=e.x,r=e.y,o={x:n+t[0],y:r+t[1]},i=this.view.toMap(o);this.view.goTo({center:i,duration:u.animationDuration})}},{key:"fitToBounds",value:function(t){this.view.goTo(S(t),{duration:u.DELAY})}},{key:"setPadding",value:function(t){this.view.padding=t}},{key:"getCenter",value:function(){var t=this.view.center;return[t.x,t.y].map(function(t){return Math.round(100*t)/100})}},{key:"getZoom",value:function(){return this.view.zoom}},{key:"getBounds",value:function(){var t=this.view.extent;return[t.xmin,t.ymin,t.xmax,t.ymax].map(function(t){return Math.round(100*t)/100})}},{key:"getFeaturesAtPoint",value:function(t,e){return function(t,e){return _.apply(this,arguments)}(this.view,t)}},{key:"getAreaDimensions",value:function(){return function(t){if(!(t&&t instanceof y.default))return"";var e=t.xmin,n=t.ymin,r=t.xmax,o=t.ymax-n,i=d(r-e),a=d(o);return"".concat(a," by ").concat(i)}(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b;if(!t.container)return null;var n=t.container.getBoundingClientRect(),r=n.width,o=n.height,i={x:e.left,y:o-e.bottom},a={x:r-e.right,y:e.top},u=t.toMap(i),c=t.toMap(a);return new y.default({xmin:u.x,ymin:u.y,xmax:c.x,ymax:c.y,spatialReference:u.spatialReference})}(this.view))}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var n=m(t,2),r=n[0],o=n[1],i=m(e,2),a=i[0]-r,u=i[1]-o,c=[];return Math.abs(u)>.1&&c.push("".concat(u>0?"north":"south"," ").concat(d(Math.abs(u)))),Math.abs(a)>.1&&c.push("".concat(a>0?"east":"west"," ").concat(d(Math.abs(a)))),c.join(", ")}(t,e)}},{key:"getResolution",value:function(){return this.view.resolution}},{key:"mapToScreen",value:function(t){var e=E(t),n=this.view.toScreen(e);return{x:n.x,y:n.y}}},{key:"screenToMap",value:function(t){var e=this.view.toMap(t);return[e.x,e.y]}}],e&&C(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n,l}()}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
+
import*as e from"@arcgis/core/Map.js";import*as r from"@arcgis/core/config.js";import*as t from"@arcgis/core/core/reactiveUtils.js";import*as o from"@arcgis/core/geometry/Extent.js";import*as n from"@arcgis/core/geometry/Point.js";import*as i from"@arcgis/core/layers/VectorTileLayer.js";import*as a from"@arcgis/core/views/MapView.js";var c,u,s={"@arcgis/core/Map.js"(r,t,o){var n,i;r.exports=(n={default:()=>e.default},i={},o.d(i,n),i)},"@arcgis/core/config.js"(e,t,o){var n,i;e.exports=(n={default:()=>r.default},i={},o.d(i,n),i)},"@arcgis/core/core/reactiveUtils.js"(e,r,o){var n,i;e.exports=(n={once:()=>t.once,watch:()=>t.watch,when:()=>t.when},i={},o.d(i,n),i)},"@arcgis/core/geometry/Extent.js"(e,r,t){var n,i;e.exports=(n={default:()=>o.default},i={},t.d(i,n),i)},"@arcgis/core/geometry/Point.js"(e,r,t){var o,i;e.exports=(o={default:()=>n.default},i={},t.d(i,o),i)},"@arcgis/core/layers/VectorTileLayer.js"(e,r,t){var o,n;e.exports=(o={default:()=>i.default},n={},t.d(n,o),n)},"@arcgis/core/views/MapView.js"(e,r,t){var o,n;e.exports=(o={default:()=>a.default},n={},t.d(n,o),n)}},f={};function l(e){var r=f[e];if(void 0!==r)return r.exports;var t=f[e]={exports:{}};return s[e](t,t.exports,l),t.exports}function p(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=Array(r);t<r;t++)o[t]=e[t];return o}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function y(){var e,r,t="function"==typeof Symbol?Symbol:{},o=t.iterator||"@@iterator",n=t.toStringTag||"@@toStringTag";function i(t,o,n,i){var u=o&&o.prototype instanceof c?o:c,s=Object.create(u.prototype);return m(s,"_invoke",function(t,o,n){var i,c,u,s=0,f=n||[],l=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(r,t){return i=r,c=0,u=e,p.n=t,a}};function d(t,o){for(c=t,u=o,r=0;!l&&s&&!n&&r<f.length;r++){var n,i=f[r],d=p.p,y=i[2];t>3?(n=y===o)&&(u=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=e):i[0]<=d&&((n=t<2&&d<i[1])?(c=0,p.v=o,p.n=i[1]):d<y&&(n=t<3||i[0]>o||o>y)&&(i[4]=t,i[5]=o,p.n=y,c=0))}if(n||t>1)return a;throw l=!0,o}return function(n,f,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&d(f,y),c=f,u=y;(r=c<2?e:u)||!l;){i||(c?c<3?(c>1&&(p.n=-1),d(c,u)):p.n=u:p.v=u);try{if(s=2,i){if(c||(n="next"),r=i[n]){if(!(r=r.call(i,u)))throw TypeError("iterator result is not an object");if(!r.done)return r;u=r.value,c<2&&(c=0)}else 1===c&&(r=i.return)&&r.call(i),c<2&&(u=TypeError("The iterator does not provide a '"+n+"' method"),c=1);i=e}else if((r=(l=p.n<0)?u:t.call(o,p))!==a)break}catch(r){i=e,c=1,u=r}finally{s=1}}return{value:r,done:l}}}(t,n,i),!0),s}var a={};function c(){}function u(){}function s(){}r=Object.getPrototypeOf;var f=[][o]?r(r([][o]())):(m(r={},o,function(){return this}),r),l=s.prototype=c.prototype=Object.create(f);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,m(e,n,"GeneratorFunction")),e.prototype=Object.create(l),e}return u.prototype=s,m(l,"constructor",s),m(s,"constructor",u),u.displayName="GeneratorFunction",m(s,n,"GeneratorFunction"),m(l),m(l,n,"Generator"),m(l,o,function(){return this}),m(l,"toString",function(){return"[object Generator]"}),(y=function(){return{w:i,m:p}})()}function m(e,r,t,o){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}m=function(e,r,t,o){function i(r,t){m(e,r,function(e){return this._invoke(r,t,e)})}r?n?n(e,r,{value:t,enumerable:!o,configurable:!o,writable:!o}):e[r]=t:(i("next",0),i("throw",1),i("return",2))},m(e,r,t,o)}function v(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?v(Object(t),!0).forEach(function(r){g(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):v(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function g(e,r,t){return(r=function(e){var r=function(e){if("object"!=d(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,"string");if("object"!=d(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==d(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function h(e,r,t,o,n,i,a){try{var c=e[i](a),u=c.value}catch(e){return void t(e)}c.done?r(u):Promise.resolve(u).then(o,n)}l.m=s,l.d=(e,r)=>{for(var t in r)l.o(r,t)&&!l.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},l.f={},l.e=e=>Promise.all(Object.keys(l.f).reduce((r,t)=>(l.f[t](e,r),r),[])),l.u=e=>"../esm/"+e+".js",l.miniCssF=e=>"../css/"+e+".css",l.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),l.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),l.p=e+"../css/"})(),(()=>{if("undefined"!=typeof document){var e={index:0};l.f.miniCss=(r,t)=>{e[r]?t.push(e[r]):0!==e[r]&&{"im-esri-provider":1}[r]&&t.push(e[r]=(e=>new Promise((r,t)=>{var o=l.miniCssF(e),n=l.p+o;if(((e,r)=>{for(var t=document.getElementsByTagName("link"),o=0;o<t.length;o++){var n=(a=t[o]).getAttribute("data-href")||a.getAttribute("href");if("stylesheet"===a.rel&&(n===e||n===r))return a}var i=document.getElementsByTagName("style");for(o=0;o<i.length;o++){var a;if((n=(a=i[o]).getAttribute("data-href"))===e||n===r)return a}})(o,n))return r();((e,r,t,o,n)=>{var i=document.createElement("link");i.rel="stylesheet",i.type="text/css",l.nc&&(i.nonce=l.nc),i.onerror=i.onload=t=>{if(i.onerror=i.onload=null,"load"===t.type)o();else{var a=t&&t.type,c=t&&t.target&&t.target.href||r,u=new Error("Loading CSS chunk "+e+" failed.\n("+a+": "+c+")");u.name="ChunkLoadError",u.code="CSS_CHUNK_LOAD_FAILED",u.type=a,u.request=c,i.parentNode&&i.parentNode.removeChild(i),n(u)}},i.href=r,document.head.appendChild(i)})(e,n,0,r,t)}))(r).then(()=>{e[r]=0},t=>{throw delete e[r],t}))}}})(),c={index:0},u=e=>{var r,t,{__webpack_esm_ids__:o,__webpack_esm_modules__:n,__webpack_esm_runtime__:i}=e,a=0;for(r in n)l.o(n,r)&&(l.m[r]=n[r]);for(i&&i(l);a<o.length;a++)t=o[a],l.o(c,t)&&c[t]&&c[t][0](),c[o[a]]=0},l.f.j=(e,r)=>{var t=l.o(c,e)?c[e]:void 0;if(0!==t)if(t)r.push(t[1]);else{var o=import("../css/"+l.u(e)).then(u,r=>{throw 0!==c[e]&&(c[e]=void 0),r});o=Promise.race([o,new Promise(r=>t=c[e]=[r])]),r.push(t[1]=o)}};var w=document.documentMode,j={isSupported:!!Array.prototype.findLast,error:"Array.FindLast() is not supported"},O=function(){if(!window.WebGLRenderingContext)return{isEnabled:!1,error:"WebGL is not supported"};var e,r=document.createElement("canvas"),t=!1,o=function(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,r){if(e){if("string"==typeof e)return p(e,r);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?p(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}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 i,a=!0,c=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(c)throw i}}}}(["webgl2","webgl1"]);try{for(o.s();!(e=o.n()).done;){var n=e.value;try{if((t=r.getContext(n))&&"function"==typeof t.getParameter)return{isEnabled:!0}}catch(e){}}}catch(e){o.e(e)}finally{o.f()}return{isEnabled:!1,error:"WebGL is supported, but disabled"}}();function P(){var e,r,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{checkDeviceCapabilities:function(){return{isSupported:j.isSupported&&O.isEnabled&&!w,error:"Internet Explorer is not supported"}},load:(e=y().m(function e(){var r,o,n;return y().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=b(b({},t),{},{crs:"EPSG:27700"}),e.p=1,e.n=2,l.e("im-esri-provider").then(l.bind(l,"./providers/beta/esri/src/esriProvider.js"));case 2:return o=e.v.default,e.a(2,{MapProvider:o,mapProviderConfig:r});case 3:throw e.p=3,n=e.v,console.error("Failed to load map provider",n),n;case 4:return e.a(2)}},e,null,[[1,3]])}),r=function(){var r=this,t=arguments;return new Promise(function(o,n){var i=e.apply(r,t);function a(e){h(i,o,n,a,c,"next",e)}function c(e){h(i,o,n,a,c,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})}}export{P as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
@@ -68,6 +68,7 @@ export default class EsriProvider {
|
|
|
68
68
|
|
|
69
69
|
// Attach map events and store handles
|
|
70
70
|
this.mapEventHandles = attachMapEvents({
|
|
71
|
+
mapProvider: this,
|
|
71
72
|
map,
|
|
72
73
|
view,
|
|
73
74
|
baseTileLayer,
|
|
@@ -111,6 +112,17 @@ export default class EsriProvider {
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
/** Returns the public API exposed via the map:ready event. */
|
|
116
|
+
getMapAPI () {
|
|
117
|
+
return {
|
|
118
|
+
map: this.map,
|
|
119
|
+
view: this.view,
|
|
120
|
+
crs: this.crs,
|
|
121
|
+
fitToBounds: this.fitToBounds.bind(this),
|
|
122
|
+
setView: this.setView.bind(this)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
114
126
|
// ==========================
|
|
115
127
|
// Side-effects
|
|
116
128
|
// ==========================
|
|
@@ -7,7 +7,7 @@ const MOVE_THROTTLE_TIME = 10
|
|
|
7
7
|
const ZOOM_TOLERANCE = 0.01
|
|
8
8
|
|
|
9
9
|
export function attachMapEvents ({
|
|
10
|
-
|
|
10
|
+
mapProvider,
|
|
11
11
|
view,
|
|
12
12
|
baseTileLayer,
|
|
13
13
|
events,
|
|
@@ -54,7 +54,7 @@ export function attachMapEvents ({
|
|
|
54
54
|
// ready
|
|
55
55
|
once(() => view.ready).then(() => {
|
|
56
56
|
if (!destroyed) {
|
|
57
|
-
eventBus.emit(events.MAP_READY,
|
|
57
|
+
eventBus.emit(events.MAP_READY, mapProvider.getMapAPI())
|
|
58
58
|
}
|
|
59
59
|
})
|
|
60
60
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-maplibre-provider.js.LICENSE.txt */
|
|
2
|
-
export const __webpack_esm_id__="im-maplibre-provider";export const __webpack_esm_ids__=["im-maplibre-provider"];export const __webpack_esm_modules__={"./providers/maplibre/src/maplibreProvider.js"(t,e,r){r.d(e,{default:()=>rt}),r.r(e);var n=400,a=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function o(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}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,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){t.apply(void 0,a)},e)};return n.cancel=function(){r&&(clearTimeout(r),r=null)},n};function s(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 u(t){var e=t.map,r=t.events,n=t.eventBus,a=t.getCenter,o=t.getZoom,i=t.getBounds,u=t.getResolution,c=[],h=[],f=function(){var t=o();return{center:a(),bounds:i(),resolution:u(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return n.emit(t,e)},d=function(){return p(r.MAP_LOADED)};e.on("load",d),c.push(["load",d]),e.once("idle",function(){return p(r.MAP_FIRST_IDLE,f())});var y=function(){return p(r.MAP_MOVE_START)};e.on("movestart",y),c.push(["movestart",y]);var g=l(function(){p(r.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var v,m,b=(v=function(){p(r.MAP_MOVE,f())},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]),h.push(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,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(r.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);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]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var r,n,a=(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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return s(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)?s(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.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,r=t.events,n=t.eventBus,a=function(t){e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return n.on(r.MAP_SET_STYLE,a),n.on(r.MAP_SET_PIXEL_RATIO,o),{remove:function(){n.off(r.MAP_SET_STYLE,a),n.off(r.MAP_SET_PIXEL_RATIO,o)}}}let h=" ";class f{static get separator(){return h}static set separator(t){h=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,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(r),60==o&&(o=(0).toFixed(r),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),n=a+"°"+f.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),n=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return n}static toLat(t,e,r){const n=f.toDms(f.wrap90(t),e,r);return null===n?"–":n.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=f.toDms(f.wrap180(t),e,r);return null===n?"–":n+f.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=f.toDms(f.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=f.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=f,d=Math.PI;class y{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 y(e,r)}distanceTo(t,e=6371e3){if(t instanceof y||(t=y.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const r=e,n=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-n,l=t.lon.toRadians()-a,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2);return r*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}initialBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n),o=Math.sin(n)*Math.cos(r),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof y||(t=y.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),l={x:o+Math.cos(n)*Math.cos(a),y:0+Math.cos(n)*Math.sin(a),z:i+Math.sin(n)},s=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=r+Math.atan2(l.y,l.x),c=s.toDegrees(),h=u.toDegrees();return new y(c,h)}intermediatePointTo(t,e){if(t instanceof y||(t=y.parse(t)),this.equals(t))return new y(this.lat,this.lon);const r=this.lat.toRadians(),n=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-r,l=o-n,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2),u=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(r)*Math.cos(n)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(r)*Math.sin(n)+h*Math.cos(a)*Math.sin(o),d=c*Math.sin(r)+h*Math.sin(a),g=Math.atan2(d,Math.sqrt(f*f+p*p)),v=Math.atan2(p,f),m=g.toDegrees(),b=v.toDegrees();return new y(m,b)}destinationPoint(t,e,r=6371e3){const n=t/r,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(o)*Math.cos(n)+Math.cos(o)*Math.sin(n)*Math.cos(a),s=Math.asin(l),u=Math.sin(a)*Math.sin(n)*Math.cos(o),c=Math.cos(n)-Math.sin(o)*l,h=i+Math.atan2(u,c),f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}static intersection(t,e,r,n){if(t instanceof y||(t=y.parse(t)),r instanceof y||(r=y.parse(r)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(n))throw new TypeError(`invalid brng2 ‘${n}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=r.lat.toRadians(),l=r.lon.toRadians(),s=Number(e).toRadians(),u=Number(n).toRadians(),c=i-a,h=l-o,f=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(a)*Math.cos(i)*Math.sin(h/2)*Math.sin(h/2)));if(Math.abs(f)<Number.EPSILON)return new y(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(a)*Math.cos(f))/(Math.sin(f)*Math.cos(a)),g=(Math.sin(a)-Math.sin(i)*Math.cos(f))/(Math.sin(f)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=s-(Math.sin(l-o)>0?v:2*d-v),M=(Math.sin(l-o)>0?2*d-m:m)-u;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(f),S=Math.atan2(Math.sin(f)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),x=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(s),-1),1)),N=o+Math.atan2(Math.sin(s)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(x)),P=x.toDegrees(),O=N.toDegrees();return new y(P,O)}crossTrackDistanceTo(t,e,r=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*n}alongTrackDistanceTo(t,e,r=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-o))*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(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.sin(l),u=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.cos(l)-Math.cos(a)*Math.sin(i)*Math.cos(n),c=Math.cos(a)*Math.cos(i)*Math.sin(n)*Math.sin(l);if(c*c>s*s+u*u)return null;const h=Math.atan2(-u,s),f=Math.acos(c/Math.sqrt(s*s+u*u)),d=o+h+f,y=(o+h-f).toDegrees(),g=d.toDegrees();return{lon1:p.wrap180(y),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof y||(t=y.parse(t));const r=e,n=this.lat.toRadians(),a=t.lat.toRadians(),o=a-n;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>d&&(i=i>0?-(2*d-i):2*d+i);const l=Math.log(Math.tan(a/2+d/4)/Math.tan(n/2+d/4)),s=Math.abs(l)>1e-11?o/l:Math.cos(n);return Math.sqrt(o*o+s*s*i*i)*r}rhumbBearingTo(t){if(t instanceof y||(t=y.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)>d&&(n=n>0?-(2*d-n):2*d+n);const a=Math.log(Math.tan(r/2+d/4)/Math.tan(e/2+d/4)),o=Math.atan2(n,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,r=6371e3){const n=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/r,l=i*Math.cos(o);let s=n+l;Math.abs(s)>d/2&&(s=s>0?d-s:-d-s);const u=Math.log(Math.tan(s/2+d/4)/Math.tan(n/2+d/4)),c=Math.abs(u)>1e-11?l/u:Math.cos(n),h=a+i*Math.sin(o)/c,f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}rhumbMidpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians();let r=this.lon.toRadians();const n=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-r)>d&&(r+=2*d);const o=(e+n)/2,i=Math.tan(d/4+e/2),l=Math.tan(d/4+n/2),s=Math.tan(d/4+o/2);let u=((a-r)*Math.log(s)+r*Math.log(l)-a*Math.log(i))/Math.log(l/i);isFinite(u)||(u=(r+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new y(c,h)}static areaOf(t,e=6371e3){const r=e,n=t[0].equals(t[t.length-1]);n||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const r=t[e].lat.toRadians(),n=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/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 a=t[n].initialBearingTo(t[n+1]),o=t[n].finalBearingTo(t[n+1]);e+=(a-r+540)%360-180,e+=(o-a+540)%360-180,r=o}return e+=(t[0].initialBearingTo(t[1])-r+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*d);const i=Math.abs(o*r*r);return n||t.pop(),i}equals(t){return t instanceof y||(t=y.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){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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return v(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)?v(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 v(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 m=function(t,e){var r=g(t,2),n=r[0],a=r[1],o=g(e,2),i=o[0],l=o[1],s=new y(a,n),u=new y(l,i);return s.distanceTo(u)},b=function(t){var e=1609.344,r=t/e;if(r<.5/e)return"".concat(Math.round(t),"m");if(r<10){var n=Number.parseFloat(r.toFixed(1)),a=1===n?"mile":"miles";return"".concat(n," ").concat(a)}var o=Math.round(r),i=1===o?"mile":"miles";return"".concat(o," ").concat(i)};function M(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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(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}}(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 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}function S(t){return S="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},S(t)}function x(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 N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach(function(e){P(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function P(t,e,r){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function O(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 E="highlighted-label";function j(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],a=r[r.length-1],o=1;o<r.length;o++){var i=r[o];if(i[0]>e){a=i,n=r[o-1];break}n=r[o-1],a=i}var l=M(n,2),s=l[0],u=l[1],c=M(a,2),h=c[0],f=c[1];return e<=s?u:e>=h?f:u+(e-s)/(h-s)*(f-u)}(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 O(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)?O(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.")}(),a=n[2],o=O(n).slice(3);if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<o.length-2;i+=2){var l=o[i],s=o[i+1],u=o[i+2],c=o[i+3];if(e<=l)return s;if(e<=u)return s+(e-l)/(u-l)*(c-s)}return o[o.length-1]}function A(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function T(t,e,r){var n,a,o,i;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){A(t,r);var l=e.feature,s=e.layer;r.highlightLayerId="highlight-".concat(s.id);var u=l.id,c=l.type,h=l.properties,f=l.geometry;t.getSource(E).setData({id:u,type:c,properties:h,geometry:f}),r.highlightedExpr=s.layout["text-size"];var p=t.getZoom(),d=(a=s,o=1.5*j(r.highlightedExpr,p),i=r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(a.id),type:a.type,source:E,layout:N(N({},a.layout),{},{"text-size":o,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:N(N({},a.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(d),t.moveLayer(r.highlightLayerId)}}function R(t){t.getSource(E)||t.addSource(E,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function L(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 _(t,e,r,n){var a={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function o(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),r=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});a.labels=function(t,e,r){return e.flatMap(function(e){var n,a,o,i,l="string"==typeof(a=null===(n=e.layout)||void 0===n?void 0:n["text-field"])?null===(o=/^{(.+)}$/.exec(a))||void 0===o?void 0:o[1]:Array.isArray(a)?null===(i=a.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 a=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 a="Polygon"===e?r[0]:r[0][0],o=a.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[o[0]/a.length,o[1]/a.length]}return null}(t.geometry);if(!a)return null;var o=n.project({lng:a[0],lat:a[1]});return{text:t.properties[r],x:o.x,y:o.y,feature:t,layer:e}}(r,e,l,t)}).filter(Boolean):[]})}(t,e,r)}function i(){if(o(),!a.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}(a.labels,e);return r&&(a.currentPixel={x:r.x,y:r.y}),T(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")}return L(t),R(t),null==n||n.on(r.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){L(t),R(t),a.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(a.highlightLayerId&&a.highlightedExpr){var e=j(a.highlightedExpr,t.getZoom());t.setLayoutProperty(a.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:o,highlightNextLabel:function(e){if(o(),!a.labels.length)return null;if(!a.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}),a=function(t,e,r){var n=g(e,2),a=n[0],o=n[1],i=r.filter(function(e){var r=g(e,2),n=r[0],i=r[1];return(n!==a||i!==o)&&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-a,i-o)});if(!i.length)return r.findIndex(function(t){return t[0]===a&&t[1]===o});var l=-1,s=1/0;return i.forEach(function(t){var e=t[0]-a,n=t[1]-o,i=e*e+n*n;i<s&&(s=i,l=r.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],n);return(null==a||a<0||a>=r.length)&&(a=0),e.labels[r[a].index]}(e,a);return r?(a.currentPixel={x:r.x,y:r.y},T(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return A(t,a)}}}function k(t){return k="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},k(t)}function D(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||I(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 I(t,e){if(t){if("string"==typeof t)return B(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)?B(t,e):void 0}}function B(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 C(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 F(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach(function(e){$(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function $(t,e,r){return(e=function(t){var e=function(t){if("object"!=k(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var z=function(t,e,r,n,a,o,i){t.getLayer(e)||t.addLayer(F(F({id:e,type:r,source:n},a&&{"source-layer":a}),{},{paint:o})),Object.entries(o).forEach(function(r){var n,a,o=(a=2,function(t){if(Array.isArray(t))return t}(n=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,a)||I(n,a)||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.")}()),i=o[0],l=o[1];t.setPaintProperty(e,i,l)}),t.setFilter(e,i)};function q(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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||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}}(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){(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 W=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 a=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return a=Math.max(0,Math.min(1,a)),Math.pow(t.x-(e.x+a*(r.x-e.x)),2)+Math.pow(t.y-(e.y+a*(r.y-e.y)),2)},G=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function H(t){return H="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},H(t)}function U(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var s=n&&n.prototype instanceof l?n:l,u=Object.create(s.prototype);return Y(u,"_invoke",function(r,n,a){var o,l,s,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return o=e,l=0,s=t,f.n=r,i}};function p(r,n){for(l=r,s=n,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,d=o[2];r>3?(a=d===n)&&(s=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=r<2&&p<o[1])?(l=0,f.v=n,f.n=o[1]):p<d&&(a=r<3||o[0]>n||n>d)&&(o[4]=r,o[5]=n,f.n=d,l=0))}if(a||r>1)return i;throw h=!0,n}return function(a,c,d){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,d),l=c,s=d;(e=l<2?t:s)||!h;){o||(l?l<3?(l>1&&(f.n=-1),p(l,s)):f.n=s:f.v=s);try{if(u=2,o){if(l||(a="next"),e=o[a]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,l<2&&(l=0)}else 1===l&&(e=o.return)&&e.call(o),l<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=t}else if((e=(h=f.n<0)?s:r.call(n,f))!==i)break}catch(e){o=t,l=1,s=e}finally{u=1}}return{value:e,done:h}}}(r,a,o),!0),u}var i={};function l(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(Y(e={},n,function(){return this}),e),h=u.prototype=l.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,Y(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=u,Y(h,"constructor",u),Y(u,"constructor",s),s.displayName="GeneratorFunction",Y(u,a,"GeneratorFunction"),Y(h),Y(h,a,"Generator"),Y(h,n,function(){return this}),Y(h,"toString",function(){return"[object Generator]"}),(U=function(){return{w:o,m:f}})()}function Y(t,e,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}Y=function(t,e,r,n){function o(e,r){Y(t,e,function(t){return this._invoke(e,r,t)})}e?a?a(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))},Y(t,e,r,n)}function V(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 J(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?V(Object(r),!0).forEach(function(e){K(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function K(t,e,r){return(e=et(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function X(t,e){if(null==t)return{};var r,n,a=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 o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function Q(t,e,r,n,a,o,i){try{var l=t[o](i),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,a)}function tt(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,et(n.key),n)}}function et(t){var e=function(t){if("object"!=H(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:e+""}var rt=function(){return t=function t(e){var r=e.mapFramework,n=e.mapProviderConfig,o=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:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(r=U().m(function t(e){var r,n,a,l,s,h,f,p,d,y,g,v,m=this;return U().w(function(t){for(;;)switch(t.n){case 0:r=e.container,n=e.padding,a=e.mapStyle,l=e.center,s=e.zoom,h=e.bounds,f=e.pixelRatio,p=X(e,G),d=this.maplibreModule.Map,y=this.events,g=this.eventBus,(v=new d(J(J({},p),{},{container:r,style:null==a?void 0:a.url,pixelRatio:f,padding:n,center:l,zoom:s,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(n),h&&v.fitBounds(h,{duration:0}),i(v),o(v),u({map:v,events:y,eventBus:g,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({map:v,events:y,eventBus:g}),v.on("load",function(){m.labelNavigator=_(v,null==a?void 0:a.mapColorScheme,y,g)}),this.eventBus.emit(y.MAP_READY,{map:v});case 1:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(n,a){var o=r.apply(t,e);function i(t){Q(o,n,a,i,l,"next",t)}function l(t){Q(o,n,a,i,l,"throw",t)}i(void 0)})},function(t){return l.apply(this,arguments)})},{key:"destroyMap",value:function(){var t,e;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:"setView",value:function(t){var e=t.center,r=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:n})}},{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){this.map.fitBounds(t,{duration:n})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,r=t.map,n=t.selectedFeatures,a=t.stylesMap;if(!r)return null;var o=function(t,e){var r={};return null==e||e.forEach(function(e){var n=e.featureId,a=e.layerId,o=e.idProperty,i=e.geometry,l=t.getLayer(a);if(l){var s=l.source;r[s]||(r[s]={ids:new Set,idProperty:o,layerId:a,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(r[s].hasFillGeometry=!0),r[s].ids.add(n)}}),r}(r,n),i=[],l=new Set(Object.keys(o)),s=r._highlightedSources||new Set;return function(t,e,r){e.forEach(function(e){if(!r.has(e)){var n="highlight-".concat(e);["".concat(n,"-fill"),"".concat(n,"-line")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})}(r,s,l),r._highlightedSources=l,l.forEach(function(t){var e=o[t],n=e.ids,l=e.idProperty,s=e.layerId,u=e.hasFillGeometry,c=r.getLayer(s),h=c.sourceLayer,f=u?"fill":c.type,p="highlight-".concat(t),d=a[s],y=d.stroke,g=d.strokeWidth,v=d.fill,m=["in",l?["get",l]:["id"],["literal",D(n)]],b={"line-color":y,"line-width":g};"fill"===f&&(z(r,"".concat(p,"-fill"),"fill",t,h,{"fill-color":v},m),z(r,"".concat(p,"-line"),"line",t,h,b,m)),"line"===f&&(r.getLayer("".concat(p,"-fill"))&&r.setFilter("".concat(p,"-fill"),["==","id",""]),z(r,"".concat(p,"-line"),"line",t,h,b,m)),i.push.apply(i,D(r.queryRenderedFeatures({layers:[s]}).filter(function(t){var e;return n.has(l?null===(e=t.properties)||void 0===e?void 0:e[l]: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,i)}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,stylesMap:e})}},{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,a=[[e.x-n,e.y-n],[e.x+n,e.y+n]],o=t.queryRenderedFeatures(a);if(0===o.length)return[];var i=[];o.forEach(function(t){!1===i.includes(t.layer.id)&&i.push(t.layer.id)});for(var l=new Set,s=[],u=o.length-1;u>=0;u--){var c=o[u],h=void 0===c.id?JSON.stringify(c.properties):c.id;!1===l.has(h)&&(l.add(h),s.push(c))}var f=t.unproject(e),p=[f.lng,f.lat];return s.map(function(r){var n=0,a=r.geometry.type,o=function(t,e,r){var n=r.coordinates,a=r.type,o=1/0,i=function(e){return t.project(e)},l=function(t){for(var r=0;r<t.length-1;r++){var n=W(e,i(t[r]),i(t[r+1]));n<o&&(o=n)}};if("Point"===a){var s=i(n);o=Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)}else"LineString"===a||"MultiPoint"===a?"LineString"===a?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<o&&(o=n)}):"Polygon"===a||"MultiLineString"===a?n.forEach(l):"MultiPolygon"===a&&n.forEach(function(t){return t.forEach(l)});return o}(t,e,r.geometry);if(n+=1e6*i.indexOf(r.layer.id),a.includes("Polygon")){var l=("Polygon"===a?[r.geometry.coordinates]:r.geometry.coordinates).some(function(t){return function(t,e){for(var r=q(t,2),n=r[0],a=r[1],o=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var s=q(e[i],2),u=s[0],c=s[1],h=q(e[l],2),f=h[0],p=h[1];c>a!=p>a&&n<(f-u)*(a-c)/(p-c)+u&&(o=!o)}return o}(p,t[0])});!0===l?n-=5e5:n+=1e5}return{f:r,score:n+=o}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getAreaDimensions",value:function(){return function(t){var e,r,n,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),r=t.getSouth(),n=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=g(t,2),i=g(o[0],2);e=i[0],r=i[1];var l=g(o[1],2);n=l[0],a=l[1]}var s=m([e,r],[n,r]),u=m([e,r],[e,a]),c=b(s),h=b(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,r=e.getContainer().getBoundingClientRect(),n=r.width,a=r.height,o=e.getPadding(),i=[o.left,a-o.bottom],l=[n-o.right,o.top],new t(e.unproject(i),e.unproject(l))));var t,e,r,n,a,o,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var r=g(t,2),n=r[0],a=r[1],o=g(e,2),i=o[0],l=o[1],s=l-a,u=i-n,c=[];if(Math.abs(s)>1e-4){var h=Math.round(m([n,a],[n,l]));c.push("".concat(s>0?"north":"south"," ").concat(b(h)))}if(Math.abs(u)>1e-4){var f=Math.round(m([n,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(b(f)))}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]}}],e&&tt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,l}()}};
|
|
2
|
+
export const __webpack_esm_id__="im-maplibre-provider";export const __webpack_esm_ids__=["im-maplibre-provider"];export const __webpack_esm_modules__={"./providers/maplibre/src/maplibreProvider.js"(t,e,r){r.d(e,{default:()=>rt}),r.r(e);var n=400,a=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom","highlightLabelAtCenter","highlightNextLabel"];function o(t){var e=t.getCanvas();e.removeAttribute("role"),e.setAttribute("tabindex",-1),e.removeAttribute("aria-label"),e.style.display="block"}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,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){t.apply(void 0,a)},e)};return n.cancel=function(){r&&(clearTimeout(r),r=null)},n};function s(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 u(t){var e=t.map,r=t.events,n=t.eventBus,a=t.getCenter,o=t.getZoom,i=t.getBounds,u=t.getResolution,c=[],h=[],f=function(){var t=o();return{center:a(),bounds:i(),resolution:u(),zoom:t,isAtMaxZoom:e.getMaxZoom()<=t,isAtMinZoom:e.getMinZoom()>=t}},p=function(t,e){return n.emit(t,e)},d=function(){return p(r.MAP_LOADED)};e.on("load",d),c.push(["load",d]),e.once("idle",function(){return p(r.MAP_FIRST_IDLE,f())});var y=function(){return p(r.MAP_MOVE_START)};e.on("movestart",y),c.push(["movestart",y]);var g=l(function(){p(r.MAP_MOVE_END,f())},500);e.on("moveend",g),c.push(["moveend",g]),h.push(g);var v,m,b=(v=function(){p(r.MAP_MOVE,f())},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]),h.push(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,f())},500);e.on("styledata",w),c.push(["styledata",w]),h.push(w);var S=function(){return p(r.MAP_STYLE_CHANGE)};e.on("style.load",S),c.push(["style.load",S]);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]),{remove:function(){h.forEach(function(t){return t.cancel()}),c.forEach(function(t){var r,n,a=(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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(r,n)||function(t,e){if(t){if("string"==typeof t)return s(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)?s(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.")}()),o=a[0],i=a[1];return e.off(o,i)})}}}function c(t){var e=t.map,r=t.events,n=t.eventBus,a=function(t){e.setStyle(t.url,{diff:!1})},o=function(t){e.setPixelRatio(t)};return n.on(r.MAP_SET_STYLE,a),n.on(r.MAP_SET_PIXEL_RATIO,o),{remove:function(){n.off(r.MAP_SET_STYLE,a),n.off(r.MAP_SET_PIXEL_RATIO,o)}}}let h=" ";class f{static get separator(){return h}static set separator(t){h=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,a=null,o=null,i=null;switch(e){default:case"d":case"deg":a=t.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(t),o=(60*t%60).toFixed(r),60==o&&(o=(0).toFixed(r),a++),a=("000"+a).slice(-3),o<10&&(o="0"+o),n=a+"°"+f.separator+o+"′";break;case"dms":case"deg+min+sec":a=Math.floor(t),o=Math.floor(3600*t/60)%60,i=(3600*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),o++),60==o&&(o=0,a++),a=("000"+a).slice(-3),o=("00"+o).slice(-2),i<10&&(i="0"+i),n=a+"°"+f.separator+o+"′"+f.separator+i+"″"}return n}static toLat(t,e,r){const n=f.toDms(f.wrap90(t),e,r);return null===n?"–":n.slice(1)+f.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=f.toDms(f.wrap180(t),e,r);return null===n?"–":n+f.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=f.toDms(f.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=f.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=f,d=Math.PI;class y{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 y(e,r)}distanceTo(t,e=6371e3){if(t instanceof y||(t=y.parse(t)),isNaN(e))throw new TypeError(`invalid radius ‘${e}’`);const r=e,n=this.lat.toRadians(),a=this.lon.toRadians(),o=t.lat.toRadians(),i=o-n,l=t.lon.toRadians()-a,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(n)*Math.cos(o)*Math.sin(l/2)*Math.sin(l/2);return r*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}initialBearingTo(t){if(t instanceof y||(t=y.parse(t)),this.equals(t))return NaN;const e=this.lat.toRadians(),r=t.lat.toRadians(),n=(t.lon-this.lon).toRadians(),a=Math.cos(e)*Math.sin(r)-Math.sin(e)*Math.cos(r)*Math.cos(n),o=Math.sin(n)*Math.cos(r),i=Math.atan2(o,a).toDegrees();return p.wrap360(i)}finalBearingTo(t){t instanceof y||(t=y.parse(t));const e=t.initialBearingTo(this)+180;return p.wrap360(e)}midpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians(),r=this.lon.toRadians(),n=t.lat.toRadians(),a=(t.lon-this.lon).toRadians(),o=Math.cos(e),i=Math.sin(e),l={x:o+Math.cos(n)*Math.cos(a),y:0+Math.cos(n)*Math.sin(a),z:i+Math.sin(n)},s=Math.atan2(l.z,Math.sqrt(l.x*l.x+l.y*l.y)),u=r+Math.atan2(l.y,l.x),c=s.toDegrees(),h=u.toDegrees();return new y(c,h)}intermediatePointTo(t,e){if(t instanceof y||(t=y.parse(t)),this.equals(t))return new y(this.lat,this.lon);const r=this.lat.toRadians(),n=this.lon.toRadians(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=a-r,l=o-n,s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(r)*Math.cos(a)*Math.sin(l/2)*Math.sin(l/2),u=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)),c=Math.sin((1-e)*u)/Math.sin(u),h=Math.sin(e*u)/Math.sin(u),f=c*Math.cos(r)*Math.cos(n)+h*Math.cos(a)*Math.cos(o),p=c*Math.cos(r)*Math.sin(n)+h*Math.cos(a)*Math.sin(o),d=c*Math.sin(r)+h*Math.sin(a),g=Math.atan2(d,Math.sqrt(f*f+p*p)),v=Math.atan2(p,f),m=g.toDegrees(),b=v.toDegrees();return new y(m,b)}destinationPoint(t,e,r=6371e3){const n=t/r,a=Number(e).toRadians(),o=this.lat.toRadians(),i=this.lon.toRadians(),l=Math.sin(o)*Math.cos(n)+Math.cos(o)*Math.sin(n)*Math.cos(a),s=Math.asin(l),u=Math.sin(a)*Math.sin(n)*Math.cos(o),c=Math.cos(n)-Math.sin(o)*l,h=i+Math.atan2(u,c),f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}static intersection(t,e,r,n){if(t instanceof y||(t=y.parse(t)),r instanceof y||(r=y.parse(r)),isNaN(e))throw new TypeError(`invalid brng1 ‘${e}’`);if(isNaN(n))throw new TypeError(`invalid brng2 ‘${n}’`);const a=t.lat.toRadians(),o=t.lon.toRadians(),i=r.lat.toRadians(),l=r.lon.toRadians(),s=Number(e).toRadians(),u=Number(n).toRadians(),c=i-a,h=l-o,f=2*Math.asin(Math.sqrt(Math.sin(c/2)*Math.sin(c/2)+Math.cos(a)*Math.cos(i)*Math.sin(h/2)*Math.sin(h/2)));if(Math.abs(f)<Number.EPSILON)return new y(t.lat,t.lon);const p=(Math.sin(i)-Math.sin(a)*Math.cos(f))/(Math.sin(f)*Math.cos(a)),g=(Math.sin(a)-Math.sin(i)*Math.cos(f))/(Math.sin(f)*Math.cos(i)),v=Math.acos(Math.min(Math.max(p,-1),1)),m=Math.acos(Math.min(Math.max(g,-1),1)),b=s-(Math.sin(l-o)>0?v:2*d-v),M=(Math.sin(l-o)>0?2*d-m:m)-u;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(f),S=Math.atan2(Math.sin(f)*Math.sin(b)*Math.sin(M),Math.cos(M)+Math.cos(b)*w),x=Math.asin(Math.min(Math.max(Math.sin(a)*Math.cos(S)+Math.cos(a)*Math.sin(S)*Math.cos(s),-1),1)),N=o+Math.atan2(Math.sin(s)*Math.sin(S)*Math.cos(a),Math.cos(S)-Math.sin(a)*Math.sin(x)),P=x.toDegrees(),O=N.toDegrees();return new y(P,O)}crossTrackDistanceTo(t,e,r=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians();return Math.asin(Math.sin(a)*Math.sin(o-i))*n}alongTrackDistanceTo(t,e,r=6371e3){t instanceof y||(t=y.parse(t)),e instanceof y||(e=y.parse(e));const n=r;if(this.equals(t))return 0;const a=t.distanceTo(this,n)/n,o=t.initialBearingTo(this).toRadians(),i=t.initialBearingTo(e).toRadians(),l=Math.asin(Math.sin(a)*Math.sin(o-i));return Math.acos(Math.cos(a)/Math.abs(Math.cos(l)))*Math.sign(Math.cos(i-o))*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(),a=t.lat.toRadians(),o=t.lon.toRadians(),i=e.lat.toRadians(),l=e.lon.toRadians()-o,s=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.sin(l),u=Math.sin(a)*Math.cos(i)*Math.cos(n)*Math.cos(l)-Math.cos(a)*Math.sin(i)*Math.cos(n),c=Math.cos(a)*Math.cos(i)*Math.sin(n)*Math.sin(l);if(c*c>s*s+u*u)return null;const h=Math.atan2(-u,s),f=Math.acos(c/Math.sqrt(s*s+u*u)),d=o+h+f,y=(o+h-f).toDegrees(),g=d.toDegrees();return{lon1:p.wrap180(y),lon2:p.wrap180(g)}}rhumbDistanceTo(t,e=6371e3){t instanceof y||(t=y.parse(t));const r=e,n=this.lat.toRadians(),a=t.lat.toRadians(),o=a-n;let i=Math.abs(t.lon-this.lon).toRadians();Math.abs(i)>d&&(i=i>0?-(2*d-i):2*d+i);const l=Math.log(Math.tan(a/2+d/4)/Math.tan(n/2+d/4)),s=Math.abs(l)>1e-11?o/l:Math.cos(n);return Math.sqrt(o*o+s*s*i*i)*r}rhumbBearingTo(t){if(t instanceof y||(t=y.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)>d&&(n=n>0?-(2*d-n):2*d+n);const a=Math.log(Math.tan(r/2+d/4)/Math.tan(e/2+d/4)),o=Math.atan2(n,a).toDegrees();return p.wrap360(o)}rhumbDestinationPoint(t,e,r=6371e3){const n=this.lat.toRadians(),a=this.lon.toRadians(),o=Number(e).toRadians(),i=t/r,l=i*Math.cos(o);let s=n+l;Math.abs(s)>d/2&&(s=s>0?d-s:-d-s);const u=Math.log(Math.tan(s/2+d/4)/Math.tan(n/2+d/4)),c=Math.abs(u)>1e-11?l/u:Math.cos(n),h=a+i*Math.sin(o)/c,f=s.toDegrees(),p=h.toDegrees();return new y(f,p)}rhumbMidpointTo(t){t instanceof y||(t=y.parse(t));const e=this.lat.toRadians();let r=this.lon.toRadians();const n=t.lat.toRadians(),a=t.lon.toRadians();Math.abs(a-r)>d&&(r+=2*d);const o=(e+n)/2,i=Math.tan(d/4+e/2),l=Math.tan(d/4+n/2),s=Math.tan(d/4+o/2);let u=((a-r)*Math.log(s)+r*Math.log(l)-a*Math.log(i))/Math.log(l/i);isFinite(u)||(u=(r+a)/2);const c=o.toDegrees(),h=u.toDegrees();return new y(c,h)}static areaOf(t,e=6371e3){const r=e,n=t[0].equals(t[t.length-1]);n||t.push(t[0]);const a=t.length-1;let o=0;for(let e=0;e<a;e++){const r=t[e].lat.toRadians(),n=t[e+1].lat.toRadians(),a=(t[e+1].lon-t[e].lon).toRadians();o+=2*Math.atan2(Math.tan(a/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 a=t[n].initialBearingTo(t[n+1]),o=t[n].finalBearingTo(t[n+1]);e+=(a-r+540)%360-180,e+=(o-a+540)%360-180,r=o}return e+=(t[0].initialBearingTo(t[1])-r+540)%360-180,Math.abs(e)<90})(t)&&(o=Math.abs(o)-2*d);const i=Math.abs(o*r*r);return n||t.pop(),i}equals(t){return t instanceof y||(t=y.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){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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return v(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)?v(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 v(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 m=function(t,e){var r=g(t,2),n=r[0],a=r[1],o=g(e,2),i=o[0],l=o[1],s=new y(a,n),u=new y(l,i);return s.distanceTo(u)},b=function(t){var e=1609.344,r=t/e;if(r<.5/e)return"".concat(Math.round(t),"m");if(r<10){var n=Number.parseFloat(r.toFixed(1)),a=1===n?"mile":"miles";return"".concat(n," ").concat(a)}var o=Math.round(r),i=1===o?"mile":"miles";return"".concat(o," ").concat(i)};function M(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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||function(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}}(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 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}function S(t){return S="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},S(t)}function x(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 N(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach(function(e){P(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function P(t,e,r){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function O(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 E="highlighted-label";function j(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],a=r[r.length-1],o=1;o<r.length;o++){var i=r[o];if(i[0]>e){a=i,n=r[o-1];break}n=r[o-1],a=i}var l=M(n,2),s=l[0],u=l[1],c=M(a,2),h=c[0],f=c[1];return e<=s?u:e>=h?f:u+(e-s)/(h-s)*(f-u)}(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 O(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)?O(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.")}(),a=n[2],o=O(n).slice(3);if("zoom"!==a[0])throw new Error("Only zoom-based expressions supported");for(var i=0;i<o.length-2;i+=2){var l=o[i],s=o[i+1],u=o[i+2],c=o[i+3];if(e<=l)return s;if(e<=u)return s+(e-l)/(u-l)*(c-s)}return o[o.length-1]}function A(t,e){if(e.highlightLayerId&&t.getLayer(e.highlightLayerId)){try{t.removeLayer(e.highlightLayerId)}catch(t){}e.highlightLayerId=null,e.highlightedExpr=null}}function T(t,e,r){var n,a,o,i;if(null!=e&&null!==(n=e.feature)&&void 0!==n&&n.layer){A(t,r);var l=e.feature,s=e.layer;r.highlightLayerId="highlight-".concat(s.id);var u=l.id,c=l.type,h=l.properties,f=l.geometry;t.getSource(E).setData({id:u,type:c,properties:h,geometry:f}),r.highlightedExpr=s.layout["text-size"];var p=t.getZoom(),d=(a=s,o=1.5*j(r.highlightedExpr,p),i=r.isDarkStyle?{text:"#ffffff",halo:"#000000"}:{text:"#000000",halo:"#ffffff"},{id:"highlight-".concat(a.id),type:a.type,source:E,layout:N(N({},a.layout),{},{"text-size":o,"text-allow-overlap":!0,"text-ignore-placement":!0,"text-max-angle":90}),paint:N(N({},a.paint),{},{"text-color":i.text,"text-halo-color":i.halo,"text-halo-width":3,"text-halo-blur":1,"text-opacity":1})});t.addLayer(d),t.moveLayer(r.highlightLayerId)}}function R(t){t.getSource(E)||t.addSource(E,{type:"geojson",data:{type:"FeatureCollection",features:[]}})}function L(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 _(t,e,r,n){var a={isDarkStyle:"dark"===e,labels:[],currentPixel:null,highlightLayerId:null,highlightedExpr:null};function o(){var e=t.getStyle().layers.filter(function(t){return"symbol"===t.type}),r=t.queryRenderedFeatures({layers:e.map(function(t){return t.id})});a.labels=function(t,e,r){return e.flatMap(function(e){var n,a,o,i,l="string"==typeof(a=null===(n=e.layout)||void 0===n?void 0:n["text-field"])?null===(o=/^{(.+)}$/.exec(a))||void 0===o?void 0:o[1]:Array.isArray(a)?null===(i=a.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 a=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 a="Polygon"===e?r[0]:r[0][0],o=a.reduce(function(t,e){return[t[0]+e[0],t[1]+e[1]]},[0,0]);return[o[0]/a.length,o[1]/a.length]}return null}(t.geometry);if(!a)return null;var o=n.project({lng:a[0],lat:a[1]});return{text:t.properties[r],x:o.x,y:o.y,feature:t,layer:e}}(r,e,l,t)}).filter(Boolean):[]})}(t,e,r)}function i(){if(o(),!a.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}(a.labels,e);return r&&(a.currentPixel={x:r.x,y:r.y}),T(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")}return L(t),R(t),null==n||n.on(r.MAP_SET_STYLE,function(e){t.once("styledata",function(){return t.once("idle",function(){L(t),R(t),a.isDarkStyle="dark"===(null==e?void 0:e.mapColorScheme)})})}),t.on("zoom",function(){if(a.highlightLayerId&&a.highlightedExpr){var e=j(a.highlightedExpr,t.getZoom());t.setLayoutProperty(a.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:o,highlightNextLabel:function(e){if(o(),!a.labels.length)return null;if(!a.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}),a=function(t,e,r){var n=g(e,2),a=n[0],o=n[1],i=r.filter(function(e){var r=g(e,2),n=r[0],i=r[1];return(n!==a||i!==o)&&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-a,i-o)});if(!i.length)return r.findIndex(function(t){return t[0]===a&&t[1]===o});var l=-1,s=1/0;return i.forEach(function(t){var e=t[0]-a,n=t[1]-o,i=e*e+n*n;i<s&&(s=i,l=r.indexOf(t))}),l}(t,[e.currentPixel.x,e.currentPixel.y],n);return(null==a||a<0||a>=r.length)&&(a=0),e.labels[r[a].index]}(e,a);return r?(a.currentPixel={x:r.x,y:r.y},T(t,r,a),"".concat(r.text," (").concat(r.layer.id,")")):null},highlightLabelAtCenter:i,clearHighlightedLabel:function(){return A(t,a)}}}function k(t){return k="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},k(t)}function D(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||I(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 I(t,e){if(t){if("string"==typeof t)return B(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)?B(t,e):void 0}}function B(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 C(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 F(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach(function(e){$(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function $(t,e,r){return(e=function(t){var e=function(t){if("object"!=k(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=k(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==k(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var z=function(t,e,r,n,a,o,i){t.getLayer(e)||t.addLayer(F(F({id:e,type:r,source:n},a&&{"source-layer":a}),{},{paint:o})),Object.entries(o).forEach(function(r){var n,a,o=(a=2,function(t){if(Array.isArray(t))return t}(n=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(n,a)||I(n,a)||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.")}()),i=o[0],l=o[1];t.setPaintProperty(e,i,l)}),t.setFilter(e,i)};function q(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,a,o,i,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,a=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw a}}return l}}(t,e)||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}}(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){(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 W=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 a=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return a=Math.max(0,Math.min(1,a)),Math.pow(t.x-(e.x+a*(r.x-e.x)),2)+Math.pow(t.y-(e.y+a*(r.y-e.y)),2)},G=["container","padding","mapStyle","center","zoom","bounds","pixelRatio"];function H(t){return H="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},H(t)}function U(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function o(r,n,a,o){var s=n&&n.prototype instanceof l?n:l,u=Object.create(s.prototype);return V(u,"_invoke",function(r,n,a){var o,l,s,u=0,c=a||[],h=!1,f={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,r){return o=e,l=0,s=t,f.n=r,i}};function p(r,n){for(l=r,s=n,e=0;!h&&u&&!a&&e<c.length;e++){var a,o=c[e],p=f.p,d=o[2];r>3?(a=d===n)&&(s=o[(l=o[4])?5:(l=3,3)],o[4]=o[5]=t):o[0]<=p&&((a=r<2&&p<o[1])?(l=0,f.v=n,f.n=o[1]):p<d&&(a=r<3||o[0]>n||n>d)&&(o[4]=r,o[5]=n,f.n=d,l=0))}if(a||r>1)return i;throw h=!0,n}return function(a,c,d){if(u>1)throw TypeError("Generator is already running");for(h&&1===c&&p(c,d),l=c,s=d;(e=l<2?t:s)||!h;){o||(l?l<3?(l>1&&(f.n=-1),p(l,s)):f.n=s:f.v=s);try{if(u=2,o){if(l||(a="next"),e=o[a]){if(!(e=e.call(o,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,l<2&&(l=0)}else 1===l&&(e=o.return)&&e.call(o),l<2&&(s=TypeError("The iterator does not provide a '"+a+"' method"),l=1);o=t}else if((e=(h=f.n<0)?s:r.call(n,f))!==i)break}catch(e){o=t,l=1,s=e}finally{u=1}}return{value:e,done:h}}}(r,a,o),!0),u}var i={};function l(){}function s(){}function u(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(V(e={},n,function(){return this}),e),h=u.prototype=l.prototype=Object.create(c);function f(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,u):(t.__proto__=u,V(t,a,"GeneratorFunction")),t.prototype=Object.create(h),t}return s.prototype=u,V(h,"constructor",u),V(u,"constructor",s),s.displayName="GeneratorFunction",V(u,a,"GeneratorFunction"),V(h),V(h,a,"Generator"),V(h,n,function(){return this}),V(h,"toString",function(){return"[object Generator]"}),(U=function(){return{w:o,m:f}})()}function V(t,e,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(t){a=0}V=function(t,e,r,n){function o(e,r){V(t,e,function(t){return this._invoke(e,r,t)})}e?a?a(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(o("next",0),o("throw",1),o("return",2))},V(t,e,r,n)}function Y(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 J(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Y(Object(r),!0).forEach(function(e){K(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function K(t,e,r){return(e=et(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function X(t,e){if(null==t)return{};var r,n,a=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 o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function Q(t,e,r,n,a,o,i){try{var l=t[o](i),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,a)}function tt(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,et(n.key),n)}}function et(t){var e=function(t){if("object"!=H(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=H(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==H(e)?e:e+""}var rt=function(){return t=function t(e){var r=e.mapFramework,n=e.mapProviderConfig,o=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:a,supportsMapSizes:!0},Object.assign(this,o)},e=[{key:"initMap",value:(r=U().m(function t(e){var r,n,a,l,s,h,f,p,d,y,g,v,m=this;return U().w(function(t){for(;;)switch(t.n){case 0:r=e.container,n=e.padding,a=e.mapStyle,l=e.center,s=e.zoom,h=e.bounds,f=e.pixelRatio,p=X(e,G),d=this.maplibreModule.Map,y=this.events,g=this.eventBus,(v=new d(J(J({},p),{},{container:r,style:null==a?void 0:a.url,pixelRatio:f,padding:n,center:l,zoom:s,fadeDuration:0,attributionControl:!1,dragRotate:!1,doubleClickZoom:!1}))).touchZoomRotate.disableRotation(),this.map=v,this.map.setPadding(n),h&&v.fitBounds(h,{duration:0}),i(v),o(v),u({map:v,events:y,eventBus:g,getCenter:this.getCenter.bind(this),getZoom:this.getZoom.bind(this),getBounds:this.getBounds.bind(this),getResolution:this.getResolution.bind(this)}),c({map:v,events:y,eventBus:g}),v.on("load",function(){m.labelNavigator=_(v,null==a?void 0:a.mapColorScheme,y,g)}),this.eventBus.emit(y.MAP_READY,this.getMapAPI());case 1:return t.a(2)}},t,this)}),l=function(){var t=this,e=arguments;return new Promise(function(n,a){var o=r.apply(t,e);function i(t){Q(o,n,a,i,l,"next",t)}function l(t){Q(o,n,a,i,l,"throw",t)}i(void 0)})},function(t){return l.apply(this,arguments)})},{key:"getMapAPI",value:function(){return{map:this.map,crs:this.crs,fitToBounds:this.fitToBounds.bind(this),setView:this.setView.bind(this)}}},{key:"destroyMap",value:function(){var t,e;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:"setView",value:function(t){var e=t.center,r=t.zoom;this.map.flyTo({center:e||this.getCenter(),zoom:r||this.getZoom(),duration:n})}},{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){this.map.fitBounds(t,{duration:n})}},{key:"setPadding",value:function(t){this.map.setPadding(t)}},{key:"updateHighlightedFeatures",value:function(t,e){return function(t){var e=t.LngLatBounds,r=t.map,n=t.selectedFeatures,a=t.stylesMap;if(!r)return null;var o=function(t,e){var r={};return null==e||e.forEach(function(e){var n=e.featureId,a=e.layerId,o=e.idProperty,i=e.geometry,l=t.getLayer(a);if(l){var s=l.source;r[s]||(r[s]={ids:new Set,fillIds:new Set,idProperty:o,layerId:a,hasFillGeometry:!1}),!i||"Polygon"!==i.type&&"MultiPolygon"!==i.type||(r[s].hasFillGeometry=!0,r[s].fillIds.add(n)),r[s].ids.add(n)}}),r}(r,n),i=[],l=new Set(Object.keys(o)),s=r._highlightedSources||new Set;return function(t,e,r){e.forEach(function(e){if(!r.has(e)){var n="highlight-".concat(e);["".concat(n,"-fill"),"".concat(n,"-line")].forEach(function(e){t.getLayer(e)&&t.setFilter(e,["==","id",""])})}})}(r,s,l),r._highlightedSources=l,l.forEach(function(t){var e=o[t],n=e.ids,l=e.fillIds,s=e.idProperty,u=e.layerId,c=e.hasFillGeometry,h=r.getLayer(u),f=h.sourceLayer,p=c?"fill":h.type,d="highlight-".concat(t),y=a[u],g=y.stroke,v=y.strokeWidth,m=y.fill,b=s?["get",s]:["id"],M=["in",b,["literal",D(n)]],w=["in",b,["literal",D(l)]],S={"line-color":g,"line-width":v};"fill"===p&&(z(r,"".concat(d,"-fill"),"fill",t,f,{"fill-color":m},w),z(r,"".concat(d,"-line"),"line",t,f,S,M)),"line"===p&&(r.getLayer("".concat(d,"-fill"))&&r.setFilter("".concat(d,"-fill"),["==","id",""]),z(r,"".concat(d,"-line"),"line",t,f,S,M)),i.push.apply(i,D(r.queryRenderedFeatures({layers:[u]}).filter(function(t){var e;return n.has(s?null===(e=t.properties)||void 0===e?void 0:e[s]: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,i)}({LngLatBounds:this.maplibreModule.LngLatBounds,map:this.map,selectedFeatures:t,stylesMap:e})}},{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,a=[[e.x-n,e.y-n],[e.x+n,e.y+n]],o=t.queryRenderedFeatures(a);if(0===o.length)return[];var i=[];o.forEach(function(t){!1===i.includes(t.layer.id)&&i.push(t.layer.id)});for(var l=new Set,s=[],u=o.length-1;u>=0;u--){var c=o[u],h=void 0===c.id?JSON.stringify(c.properties):c.id;!1===l.has(h)&&(l.add(h),s.push(c))}var f=t.unproject(e),p=[f.lng,f.lat];return s.map(function(r){var n=0,a=r.geometry.type,o=function(t,e,r){var n=r.coordinates,a=r.type,o=1/0,i=function(e){return t.project(e)},l=function(t){for(var r=0;r<t.length-1;r++){var n=W(e,i(t[r]),i(t[r+1]));n<o&&(o=n)}};if("Point"===a){var s=i(n);o=Math.pow(e.x-s.x,2)+Math.pow(e.y-s.y,2)}else"LineString"===a||"MultiPoint"===a?"LineString"===a?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<o&&(o=n)}):"Polygon"===a||"MultiLineString"===a?n.forEach(l):"MultiPolygon"===a&&n.forEach(function(t){return t.forEach(l)});return o}(t,e,r.geometry);if(n+=1e6*i.indexOf(r.layer.id),a.includes("Polygon")){var l=("Polygon"===a?[r.geometry.coordinates]:r.geometry.coordinates).some(function(t){return function(t,e){for(var r=q(t,2),n=r[0],a=r[1],o=!1,i=0,l=e.length-1;i<e.length;l=i,i++){var s=q(e[i],2),u=s[0],c=s[1],h=q(e[l],2),f=h[0],p=h[1];c>a!=p>a&&n<(f-u)*(a-c)/(p-c)+u&&(o=!o)}return o}(p,t[0])});!0===l?n-=5e5:n+=1e5}return{f:r,score:n+=o}}).sort(function(t,e){return t.score-e.score}).map(function(t){return t.f})}(this.map,t,e)}},{key:"getAreaDimensions",value:function(){return function(t){var e,r,n,a;if(t&&"function"==typeof t.getWest)e=t.getWest(),r=t.getSouth(),n=t.getEast(),a=t.getNorth();else{if(!Array.isArray(t)||2!==t.length)return"";var o=g(t,2),i=g(o[0],2);e=i[0],r=i[1];var l=g(o[1],2);n=l[0],a=l[1]}var s=m([e,r],[n,r]),u=m([e,r],[e,a]),c=b(s),h=b(u);return"".concat(h," by ").concat(c)}((t=this.maplibreModule.LngLatBounds,e=this.map,r=e.getContainer().getBoundingClientRect(),n=r.width,a=r.height,o=e.getPadding(),i=[o.left,a-o.bottom],l=[n-o.right,o.top],new t(e.unproject(i),e.unproject(l))));var t,e,r,n,a,o,i,l}},{key:"getCardinalMove",value:function(t,e){return function(t,e){var r=g(t,2),n=r[0],a=r[1],o=g(e,2),i=o[0],l=o[1],s=l-a,u=i-n,c=[];if(Math.abs(s)>1e-4){var h=Math.round(m([n,a],[n,l]));c.push("".concat(s>0?"north":"south"," ").concat(b(h)))}if(Math.abs(u)>1e-4){var f=Math.round(m([n,a],[i,a]));c.push("".concat(u>0?"east":"west"," ").concat(b(f)))}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]}}],e&&tt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r,l}()}};
|