@defra/interactive-map 0.0.44-alpha → 0.0.46-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.
Files changed (40) hide show
  1. package/assets/templates/add-polygons.njk +6 -6
  2. package/assets/templates/select-feature.njk +72 -15
  3. package/dist/css/index.css +1 -1
  4. package/dist/esm/im-core.js +1 -1
  5. package/dist/umd/im-core.js +1 -1
  6. package/docs/examples/add-marker-with-panel.mdx +4 -0
  7. package/docs/examples/add-polygons.mdx +16 -12
  8. package/docs/examples/add-symbols.mdx +4 -0
  9. package/docs/examples/basic-map.mdx +4 -0
  10. package/docs/examples/button-map.mdx +4 -0
  11. package/docs/examples/draw-tools.mdx +4 -0
  12. package/docs/examples/place-marker.mdx +4 -0
  13. package/docs/examples/search-control.mdx +4 -0
  14. package/docs/examples/select-feature.mdx +4 -0
  15. package/docs/examples/style-switcher.mdx +36 -44
  16. package/docs/examples/toggle-marker-label.mdx +4 -0
  17. package/package.json +1 -1
  18. package/plugins/search/dist/esm/im-search-plugin.js +1 -1
  19. package/plugins/search/dist/umd/im-search-plugin.js +1 -1
  20. package/plugins/search/src/components/Form/Form.jsx +3 -3
  21. package/plugins/search/src/components/Suggestions/Suggestions.jsx +2 -2
  22. package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +1 -1
  23. package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
  24. package/providers/beta/esri/src/utils/spatial.js +15 -13
  25. package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  26. package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  27. package/providers/beta/openlayers/src/utils/spatial.js +16 -14
  28. package/providers/beta/openlayers/src/utils/spatial.test.js +10 -6
  29. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  30. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  31. package/providers/maplibre/src/maplibreProvider.js +1 -1
  32. package/providers/maplibre/src/utils/labels.js +3 -3
  33. package/providers/maplibre/src/utils/labels.test.js +2 -2
  34. package/providers/maplibre/src/utils/spatial.js +19 -17
  35. package/providers/maplibre/src/utils/spatial.test.js +8 -5
  36. package/src/App/components/Panel/Panel.module.scss +4 -0
  37. package/src/config/appConfig.js +1 -1
  38. package/src/scss/tools/_govuk-content.scss +29 -0
  39. package/src/scss/tools/_index.scss +2 -1
  40. package/src/types.js +2 -2
@@ -25,6 +25,8 @@ Add markers to the map and allow users to select them. Selecting a marker fires
25
25
  mapProvider: maplibreProvider(),
26
26
  mapStyle: {
27
27
  url: 'https://your-tile-url/style.json',
28
+ logo: '/path/to/logo.svg',
29
+ logoAltText: 'Your logo alt text',
28
30
  attribution: 'Your tile attribution'
29
31
  },
30
32
  center: [-2.96, 54.43],
@@ -81,6 +83,8 @@ Add markers to the map and allow users to select them. Selecting a marker fires
81
83
  mapProvider: defra.maplibreProvider(),
82
84
  mapStyle: {
83
85
  url: 'https://your-tile-url/style.json',
86
+ logo: '/path/to/logo.svg',
87
+ logoAltText: 'Your logo alt text',
84
88
  attribution: 'Your tile attribution'
85
89
  },
86
90
  center: [-2.96, 54.43],
@@ -72,9 +72,9 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
72
72
  label: 'Arable',
73
73
  filter: ['==', ['get', 'land_use'], 'Arable'],
74
74
  style: {
75
- stroke: '#6D4C41',
75
+ stroke: '#573C34',
76
76
  fillPattern: 'horizontal-hatch',
77
- fillPatternForegroundColor: '#6D4C41',
77
+ fillPatternForegroundColor: '#573C34',
78
78
  fillPatternBackgroundColor: 'transparent'
79
79
  }
80
80
  }, {
@@ -82,9 +82,9 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
82
82
  label: 'Permanent grassland',
83
83
  filter: ['==', ['get', 'land_use'], 'Permanent grassland'],
84
84
  style: {
85
- stroke: '#00897B',
85
+ stroke: '#005149',
86
86
  fillPattern: 'diagonal-cross-hatch',
87
- fillPatternForegroundColor: '#00897B',
87
+ fillPatternForegroundColor: '#005149',
88
88
  fillPatternBackgroundColor: 'transparent'
89
89
  }
90
90
  }, {
@@ -92,9 +92,9 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
92
92
  label: 'Woodland',
93
93
  filter: ['==', ['get', 'land_use'], 'Woodland'],
94
94
  style: {
95
- stroke: '#2E7D32',
95
+ stroke: '#1E5020',
96
96
  fillPattern: 'dot',
97
- fillPatternForegroundColor: '#2E7D32',
97
+ fillPatternForegroundColor: '#1E5020',
98
98
  fillPatternBackgroundColor: 'transparent'
99
99
  }
100
100
  }]
@@ -108,6 +108,8 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
108
108
  mapProvider: maplibreProvider(),
109
109
  mapStyle: {
110
110
  url: 'https://your-tile-url/style.json',
111
+ logo: '/path/to/logo.svg',
112
+ logoAltText: 'Your logo alt text',
111
113
  attribution: 'Your tile attribution'
112
114
  },
113
115
  center: [-2.464, 54.558],
@@ -182,9 +184,9 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
182
184
  label: 'Arable',
183
185
  filter: ['==', ['get', 'land_use'], 'Arable'],
184
186
  style: {
185
- stroke: '#6D4C41',
187
+ stroke: '#573C34',
186
188
  fillPattern: 'horizontal-hatch',
187
- fillPatternForegroundColor: '#6D4C41',
189
+ fillPatternForegroundColor: '#573C34',
188
190
  fillPatternBackgroundColor: 'transparent'
189
191
  }
190
192
  }, {
@@ -192,9 +194,9 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
192
194
  label: 'Permanent grassland',
193
195
  filter: ['==', ['get', 'land_use'], 'Permanent grassland'],
194
196
  style: {
195
- stroke: '#00897B',
197
+ stroke: '#005149',
196
198
  fillPattern: 'diagonal-cross-hatch',
197
- fillPatternForegroundColor: '#00897B',
199
+ fillPatternForegroundColor: '#005149',
198
200
  fillPatternBackgroundColor: 'transparent'
199
201
  }
200
202
  }, {
@@ -202,9 +204,9 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
202
204
  label: 'Woodland',
203
205
  filter: ['==', ['get', 'land_use'], 'Woodland'],
204
206
  style: {
205
- stroke: '#2E7D32',
207
+ stroke: '#1E5020',
206
208
  fillPattern: 'dot',
207
- fillPatternForegroundColor: '#2E7D32',
209
+ fillPatternForegroundColor: '#1E5020',
208
210
  fillPatternBackgroundColor: 'transparent'
209
211
  }
210
212
  }]
@@ -218,6 +220,8 @@ Use the datasets plugin to overlay GeoJSON polygon data on your map. This exampl
218
220
  mapProvider: defra.maplibreProvider(),
219
221
  mapStyle: {
220
222
  url: 'https://your-tile-url/style.json',
223
+ logo: '/path/to/logo.svg',
224
+ logoAltText: 'Your logo alt text',
221
225
  attribution: 'Your tile attribution'
222
226
  },
223
227
  center: [-2.464, 54.558],
@@ -84,6 +84,8 @@ Use the datasets plugin to overlay GeoJSON data on your map. Each dataset can co
84
84
  mapProvider: maplibreProvider(),
85
85
  mapStyle: {
86
86
  url: 'https://your-tile-url/style.json',
87
+ logo: '/path/to/logo.svg',
88
+ logoAltText: 'Your logo alt text',
87
89
  attribution: 'Your tile attribution'
88
90
  },
89
91
  center: [-2.4608, 54.5574],
@@ -170,6 +172,8 @@ Use the datasets plugin to overlay GeoJSON data on your map. Each dataset can co
170
172
  mapProvider: defra.maplibreProvider(),
171
173
  mapStyle: {
172
174
  url: 'https://your-tile-url/style.json',
175
+ logo: '/path/to/logo.svg',
176
+ logoAltText: 'Your logo alt text',
173
177
  attribution: 'Your tile attribution'
174
178
  },
175
179
  center: [-2.4608, 54.5574],
@@ -20,6 +20,8 @@ Embed an interactive map directly on the page, allowing users to explore and int
20
20
  mapProvider: maplibreProvider(),
21
21
  mapStyle: {
22
22
  url: 'https://your-tile-url/style.json',
23
+ logo: '/path/to/logo.svg',
24
+ logoAltText: 'Your logo alt text',
23
25
  attribution: 'Your tile attribution'
24
26
  },
25
27
  center: [-1.6, 53.1],
@@ -41,6 +43,8 @@ Embed an interactive map directly on the page, allowing users to explore and int
41
43
  mapProvider: defra.maplibreProvider(),
42
44
  mapStyle: {
43
45
  url: 'https://your-tile-url/style.json',
46
+ logo: '/path/to/logo.svg',
47
+ logoAltText: 'Your logo alt text',
44
48
  attribution: 'Your tile attribution'
45
49
  },
46
50
  center: [-1.6, 53.1],
@@ -20,6 +20,8 @@ Trigger the map to show on button press, allowing users to access the map when n
20
20
  mapProvider: maplibreProvider(),
21
21
  mapStyle: {
22
22
  url: 'https://your-tile-url/style.json',
23
+ logo: '/path/to/logo.svg',
24
+ logoAltText: 'Your logo alt text',
23
25
  attribution: 'Your tile attribution'
24
26
  },
25
27
  center: [-1.6, 53.1],
@@ -41,6 +43,8 @@ Trigger the map to show on button press, allowing users to access the map when n
41
43
  mapProvider: defra.maplibreProvider(),
42
44
  mapStyle: {
43
45
  url: 'https://your-tile-url/style.json',
46
+ logo: '/path/to/logo.svg',
47
+ logoAltText: 'Your logo alt text',
44
48
  attribution: 'Your tile attribution'
45
49
  },
46
50
  center: [-1.6, 53.1],
@@ -43,6 +43,8 @@ This example configures snapping (`snapLayers`) against the base map style's woo
43
43
  mapProvider: maplibreProvider(),
44
44
  mapStyle: {
45
45
  url: 'https://your-tile-url/style.json',
46
+ logo: '/path/to/logo.svg',
47
+ logoAltText: 'Your logo alt text',
46
48
  attribution: 'Your tile attribution'
47
49
  },
48
50
  center: [-0.1276, 51.5074],
@@ -174,6 +176,8 @@ This example configures snapping (`snapLayers`) against the base map style's woo
174
176
  mapProvider: defra.maplibreProvider(),
175
177
  mapStyle: {
176
178
  url: 'https://your-tile-url/style.json',
179
+ logo: '/path/to/logo.svg',
180
+ logoAltText: 'Your logo alt text',
177
181
  attribution: 'Your tile attribution'
178
182
  },
179
183
  center: [-0.1276, 51.5074],
@@ -30,6 +30,8 @@ Two patterns work together in this example:
30
30
  mapProvider: maplibreProvider(),
31
31
  mapStyle: {
32
32
  url: 'https://your-tile-url/style.json',
33
+ logo: '/path/to/logo.svg',
34
+ logoAltText: 'Your logo alt text',
33
35
  attribution: 'Your tile attribution'
34
36
  },
35
37
  center: [-0.1276, 51.5074],
@@ -103,6 +105,8 @@ Two patterns work together in this example:
103
105
  mapProvider: defra.maplibreProvider(),
104
106
  mapStyle: {
105
107
  url: 'https://your-tile-url/style.json',
108
+ logo: '/path/to/logo.svg',
109
+ logoAltText: 'Your logo alt text',
106
110
  attribution: 'Your tile attribution'
107
111
  },
108
112
  center: [-0.1276, 51.5074],
@@ -30,6 +30,8 @@ This requires an OS Data Hub API key. Embedding the key in the URL is the simple
30
30
  mapProvider: maplibreProvider(),
31
31
  mapStyle: {
32
32
  url: 'https://your-tile-url/style.json',
33
+ logo: '/path/to/logo.svg',
34
+ logoAltText: 'Your logo alt text',
33
35
  attribution: 'Your tile attribution'
34
36
  },
35
37
  center: [-1.6, 53.1],
@@ -58,6 +60,8 @@ This requires an OS Data Hub API key. Embedding the key in the URL is the simple
58
60
  mapProvider: defra.maplibreProvider(),
59
61
  mapStyle: {
60
62
  url: 'https://your-tile-url/style.json',
63
+ logo: '/path/to/logo.svg',
64
+ logoAltText: 'Your logo alt text',
61
65
  attribution: 'Your tile attribution'
62
66
  },
63
67
  center: [-1.6, 53.1],
@@ -92,6 +92,8 @@ The layer ID used here (`field-parcels`) comes from the datasets plugin — a da
92
92
  mapProvider: maplibreProvider(),
93
93
  mapStyle: {
94
94
  url: 'https://your-tile-url/style.json',
95
+ logo: '/path/to/logo.svg',
96
+ logoAltText: 'Your logo alt text',
95
97
  attribution: 'Your tile attribution'
96
98
  },
97
99
  center: [-2.464, 54.558],
@@ -212,6 +214,8 @@ The layer ID used here (`field-parcels`) comes from the datasets plugin — a da
212
214
  mapProvider: defra.maplibreProvider(),
213
215
  mapStyle: {
214
216
  url: 'https://your-tile-url/style.json',
217
+ logo: '/path/to/logo.svg',
218
+ logoAltText: 'Your logo alt text',
215
219
  attribution: 'Your tile attribution'
216
220
  },
217
221
  center: [-2.464, 54.558],
@@ -20,40 +20,36 @@ The live demo uses OS Open Zoomstack tiles from OS Labs, which do not require an
20
20
  import maplibreProvider from '@defra/interactive-map/providers/maplibre'
21
21
  import createMapStylesPlugin from '@defra/interactive-map/plugins/map-styles'
22
22
 
23
- const attribution = 'Contains OS data © Crown copyright and database rights 2025'
24
-
25
23
  const mapStyles = [
26
24
  {
27
25
  id: 'outdoor',
28
26
  label: 'Outdoor',
29
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-outdoor/style.json',
27
+ url: 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Open_Outdoor.json',
30
28
  thumbnail: '/path/to/outdoor-thumbnail.jpg',
31
- attribution,
29
+ logo: '/path/to/outdoor-logo.svg',
30
+ logoAltText: 'Ordnance Survey logo',
31
+ attribution: 'Contains OS data © Crown copyright and database rights 2025',
32
32
  backgroundColor: '#f5f5f0'
33
33
  },
34
34
  {
35
- id: 'night',
36
- label: 'Night',
37
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-night/style.json',
38
- thumbnail: '/path/to/night-thumbnail.jpg',
39
- attribution,
35
+ id: 'dark',
36
+ label: 'Dark',
37
+ url: 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Open_Dark.json',
38
+ thumbnail: '/path/to/dark-thumbnail.jpg',
39
+ logo: '/path/to/dark-logo.svg',
40
+ logoAltText: 'Ordnance Survey logo',
41
+ attribution: 'Contains OS data © Crown copyright and database rights 2025',
40
42
  mapColorScheme: 'dark',
41
43
  appColorScheme: 'dark'
42
44
  },
43
45
  {
44
- id: 'deuteranopia',
45
- label: 'Deuteranopia',
46
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-deuteranopia/style.json',
47
- thumbnail: '/path/to/deuteranopia-thumbnail.jpg',
48
- attribution,
49
- backgroundColor: '#f5f5f0'
50
- },
51
- {
52
- id: 'tritanopia',
53
- label: 'Tritanopia',
54
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-tritanopia/style.json',
55
- thumbnail: '/path/to/tritanopia-thumbnail.jpg',
56
- attribution,
46
+ id: 'blackWhite',
47
+ label: 'Black/White',
48
+ url: 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Open_Black_and_White.json',
49
+ thumbnail: '/path/to/black-white-thumbnail.jpg',
50
+ logo: '/path/to/black-white-logo.svg',
51
+ logoAltText: 'Ordnance Survey logo',
52
+ attribution: 'Contains OS data © Crown copyright and database rights 2025',
57
53
  backgroundColor: '#f5f5f0'
58
54
  }
59
55
  ]
@@ -80,40 +76,36 @@ The live demo uses OS Open Zoomstack tiles from OS Labs, which do not require an
80
76
  <script src="/your-assets-path/map-styles-plugin/index.js"></script>
81
77
 
82
78
  <script>
83
- const attribution = 'Contains OS data © Crown copyright and database rights 2025'
84
-
85
79
  const mapStyles = [
86
80
  {
87
81
  id: 'outdoor',
88
82
  label: 'Outdoor',
89
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-outdoor/style.json',
83
+ url: 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Open_Outdoor.json',
90
84
  thumbnail: '/path/to/outdoor-thumbnail.jpg',
91
- attribution,
85
+ logo: '/path/to/outdoor-logo.svg',
86
+ logoAltText: 'Ordnance Survey logo',
87
+ attribution: 'Contains OS data © Crown copyright and database rights 2025',
92
88
  backgroundColor: '#f5f5f0'
93
89
  },
94
90
  {
95
- id: 'night',
96
- label: 'Night',
97
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-night/style.json',
98
- thumbnail: '/path/to/night-thumbnail.jpg',
99
- attribution,
91
+ id: 'dark',
92
+ label: 'Dark',
93
+ url: 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Open_Dark.json',
94
+ thumbnail: '/path/to/dark-thumbnail.jpg',
95
+ logo: '/path/to/dark-logo.svg',
96
+ logoAltText: 'Ordnance Survey logo',
97
+ attribution: 'Contains OS data © Crown copyright and database rights 2025',
100
98
  mapColorScheme: 'dark',
101
99
  appColorScheme: 'dark'
102
100
  },
103
101
  {
104
- id: 'deuteranopia',
105
- label: 'Deuteranopia',
106
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-deuteranopia/style.json',
107
- thumbnail: '/path/to/deuteranopia-thumbnail.jpg',
108
- attribution,
109
- backgroundColor: '#f5f5f0'
110
- },
111
- {
112
- id: 'tritanopia',
113
- label: 'Tritanopia',
114
- url: 'https://labs.os.uk/tiles/styles/open-zoomstack-tritanopia/style.json',
115
- thumbnail: '/path/to/tritanopia-thumbnail.jpg',
116
- attribution,
102
+ id: 'blackWhite',
103
+ label: 'Black/White',
104
+ url: 'https://raw.githubusercontent.com/OrdnanceSurvey/OS-Vector-Tile-API-Stylesheets/main/OS_VTS_3857_Open_Black_and_White.json',
105
+ thumbnail: '/path/to/black-white-thumbnail.jpg',
106
+ logo: '/path/to/black-white-logo.svg',
107
+ logoAltText: 'Ordnance Survey logo',
108
+ attribution: 'Contains OS data © Crown copyright and database rights 2025',
117
109
  backgroundColor: '#f5f5f0'
118
110
  }
119
111
  ]
@@ -25,6 +25,8 @@ Add a marker with a hidden label, then use the interact plugin to show the label
25
25
  mapProvider: maplibreProvider(),
26
26
  mapStyle: {
27
27
  url: 'https://your-tile-url/style.json',
28
+ logo: '/path/to/logo.svg',
29
+ logoAltText: 'Your logo alt text',
28
30
  attribution: 'Your tile attribution'
29
31
  },
30
32
  center: [-2.96, 54.43],
@@ -64,6 +66,8 @@ Add a marker with a hidden label, then use the interact plugin to show the label
64
66
  mapProvider: defra.maplibreProvider(),
65
67
  mapStyle: {
66
68
  url: 'https://your-tile-url/style.json',
69
+ logo: '/path/to/logo.svg',
70
+ logoAltText: 'Your logo alt text',
67
71
  attribution: 'Your tile attribution'
68
72
  },
69
73
  center: [-2.96, 54.43],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/interactive-map",
3
- "version": "0.0.44-alpha",
3
+ "version": "0.0.46-alpha",
4
4
  "description": "An accessible map component",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +1 @@
1
- import{useEffect as e,useRef as t,useLayoutEffect as r}from"preact/compat";import{jsx as n,jsxs as a}from"preact/jsx-runtime";import s from"@babel/runtime/helpers/defineProperty";import i from"@babel/runtime/helpers/objectWithoutProperties";import o from"@babel/runtime/helpers/taggedTemplateLiteral";import l from"@babel/runtime/helpers/asyncToGenerator";var c={expanded:!1,showMarker:!0,placeholder:"Search",minSearchLength:3,maxSuggestions:8,noResultsMessage:"No results available",searchErrorMessage:"Sorry, there was a problem with search"};function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var d={TOGGLE_EXPANDED:(e,t)=>h(h({},e),{},{isExpanded:t,areSuggestionsVisible:t,hasFetchedSuggestions:!1,hasSearchError:!1}),SET_KEYBOARD_FOCUS_WITHIN:(e,t)=>h(h({},e),{},{hasKeyboardFocusWithin:t,areSuggestionsVisible:!0}),INPUT_BLUR:(e,t)=>h(h({},e),{},{hasKeyboardFocusWithin:!1,areSuggestionsVisible:e.areSuggestionsVisible&&"keyboard"!==t,selectedIndex:-1}),SET_VALUE:(e,t)=>h(h({},e),{},{value:t}),UPDATE_SUGGESTIONS:(e,t)=>h(h({},e),{},{suggestions:t.results,hasFetchedSuggestions:!0,hasSearchError:t.hasError}),SHOW_SUGGESTIONS:e=>h(h({},e),{},{areSuggestionsVisible:!0,hasFetchedSuggestions:!1,hasSearchError:!1}),HIDE_SUGGESTIONS:e=>h(h({},e),{},{areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1}),SET_SELECTED:(e,t)=>h(h({},e),{},{selectedIndex:t,areSuggestionsVisible:t>=0})},p=e=>{var{id:t,pluginState:r,handleSuggestionClick:a}=e;return n("ul",{id:"".concat(t,"-search-suggestions"),role:"listbox","aria-labelledby":"".concat(t,"-search"),className:"im-c-search-suggestions",style:r.areSuggestionsVisible&&r.suggestions.length?void 0:{display:"none"},children:r.suggestions.map((e,s)=>n("li",{id:"".concat(t,"-search-suggestion-").concat(s),className:"im-c-search-suggestions__item",role:"option","aria-selected":r.selectedIndex===s,"aria-setsize":r.suggestions.length,"aria-posinset":s+1,onClick:()=>a(e),children:n("span",{className:"im-c-search-suggestions__label",dangerouslySetInnerHTML:{__html:e.marked}})},e.id))})};function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var m=(e,t,r)=>function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({display:e.expanded||t.isExpanded?"flex":void 0},"mobile"!==r.breakpoint&&(null==e?void 0:e.width)&&{width:e.width}),f=t=>{var{id:r,pluginState:s,pluginConfig:i,appState:o,inputRef:l,events:c,services:u,children:h}=t,{areSuggestionsVisible:d,hasFetchedSuggestions:g,hasSearchError:f,suggestions:y=[]}=s,{noResultsMessage:b,searchErrorMessage:E}=i;e(()=>{d&&g&&u.announce(((e,t,r,n)=>{if(t)return r;if(0===e)return n;var a=1===e?"result":"results";return"".concat(e," ").concat(a," available")})(y.length,f,E,b))},[y,g]);var v=["im-c-search-form",i.expanded&&"im-c-search-form--default-expanded","im-c-panel"].filter(Boolean).join(" "),w=d&&g&&(f||!y.length);return a("form",{id:"".concat(r,"-search-form"),role:"search",className:v,style:m(i,s,o),"aria-controls":"".concat(r,"-viewport"),onSubmit:e=>c.handleSubmit(e,o,s),children:[n("button",{type:"submit",style:{display:"none"},"aria-hidden":"true",tabIndex:-1,children:"Submit"}),a("div",{className:"im-c-search__input-container".concat(s.hasKeyboardFocusWithin?" im-c-search__input-container--keyboard-focus-within":""),children:[n("label",{htmlFor:"".concat(r,"-search"),className:"im-u-visually-hidden",children:i.placeholder}),n("input",{id:"".concat(r,"-search"),className:"im-c-search__input",type:"search",role:"combobox","aria-expanded":s.suggestionsVisible,"aria-controls":"".concat(r,"-search-suggestions"),"aria-activedescendant":s.selectedIndex>=0?"".concat(r,"-search-suggestion-").concat(s.selectedIndex):void 0,"aria-describedby":s.value?void 0:"".concat(r,"-search-hint"),"aria-autocomplete":"list",autoComplete:"off",placeholder:i.placeholder,name:"".concat(r,"-search"),spellCheck:!1,enterKeyHint:"search",value:s.value,onClick:c.handleInputClick,onChange:c.handleInputChange,onFocus:()=>c.handleInputFocus(o.interfaceType),onBlur:()=>c.handleInputBlur(o.interfaceType),onKeyDown:e=>c.handleInputKeyDown(e,s),ref:l}),n("span",{id:"".concat(r,"-search-hint"),className:"im-c-search__hint",children:"When search results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."}),h]}),w&&n("div",{className:"im-c-search__status","aria-hidden":"true",children:f?E:b}),n(p,{id:r,appState:o,pluginState:s,handleSuggestionClick:e=>c.handleSuggestionClick(e,o)})]})},y=e=>{var{defaultExpanded:t,onClick:r,closeIcon:a}=e;return n("button",{"aria-label":"Close search",className:"im-c-map-button im-c-search-close-button",type:"button",onClick:r,style:t?{display:"none"}:void 0,children:a&&n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:a}})})},b=e=>{var{defaultExpanded:t,submitIcon:r}=e;return n("button",{"aria-label":"Search",className:"im-c-map-button im-c-search-submit-button",type:"submit",style:t?void 0:{display:"none"},children:r&&n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:r}})})};let E=" ";class v{static get separator(){return E}static set separator(e){E=e}static parse(e){if(!isNaN(parseFloat(e))&&isFinite(e))return Number(e);const t=String(e).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==t[t.length-1]&&t.splice(t.length-1),""==t)return NaN;let r=null;switch(t.length){case 3:r=t[0]/1+t[1]/60+t[2]/3600;break;case 2:r=t[0]/1+t[1]/60;break;case 1:r=t[0];break;default:return NaN}return/^-|[WS]$/i.test(e.trim())&&(r=-r),Number(r)}static toDms(e,t="d",r=void 0){if(isNaN(e))return null;if("string"==typeof e&&""==e.trim())return null;if("boolean"==typeof e)return null;if(e==1/0)return null;if(null==e)return null;if(void 0===r)switch(t){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:t="d",r=4}e=Math.abs(e);let n=null,a=null,s=null,i=null;switch(t){default:case"d":case"deg":a=e.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(e),s=(60*e%60).toFixed(r),60==s&&(s=(0).toFixed(r),a++),a=("000"+a).slice(-3),s<10&&(s="0"+s),n=a+"°"+v.separator+s+"′";break;case"dms":case"deg+min+sec":a=Math.floor(e),s=Math.floor(3600*e/60)%60,i=(3600*e%60).toFixed(r),60==i&&(i=(0).toFixed(r),s++),60==s&&(s=0,a++),a=("000"+a).slice(-3),s=("00"+s).slice(-2),i<10&&(i="0"+i),n=a+"°"+v.separator+s+"′"+v.separator+i+"″"}return n}static toLat(e,t,r){const n=v.toDms(v.wrap90(e),t,r);return null===n?"–":n.slice(1)+v.separator+(e<0?"S":"N")}static toLon(e,t,r){const n=v.toDms(v.wrap180(e),t,r);return null===n?"–":n+v.separator+(e<0?"W":"E")}static toBrng(e,t,r){const n=v.toDms(v.wrap360(e),t,r);return null===n?"–":n.replace("360","0")}static fromLocale(e){const t=123456.789.toLocaleString(),r={thousands:t.slice(3,4),decimal:t.slice(7,8)};return e.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(e){const t=123456.789.toLocaleString(),r={thousands:t.slice(3,4),decimal:t.slice(7,8)};return e.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(e,t=3){if(![1,2,3].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);e=v.wrap360(e);const r=4*2**(t-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(e*r/360)%r*16/r]}static wrap90(e){if(-90<=e&&e<=90)return e;const t=e,r=360;return 1*Math.abs(((t-90)%r+r)%r-180)-90}static wrap180(e){if(-180<=e&&e<=180)return e;const t=360;return((360*e/t-180)%t+t)%t-180}static wrap360(e){if(0<=e&&e<360)return e;const t=360;return(360*e/t%t+t)%t}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};class w{constructor(e,t,r){if(isNaN(e)||isNaN(t)||isNaN(r))throw new TypeError(`invalid vector [${e},${t},${r}]`);this.x=Number(e),this.y=Number(t),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");return new w(this.x+e.x,this.y+e.y,this.z+e.z)}minus(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");return new w(this.x-e.x,this.y-e.y,this.z-e.z)}times(e){if(isNaN(e))throw new TypeError(`invalid scalar value ‘${e}’`);return new w(this.x*e,this.y*e,this.z*e)}dividedBy(e){if(isNaN(e))throw new TypeError(`invalid scalar value ‘${e}’`);return new w(this.x/e,this.y/e,this.z/e)}dot(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");const t=this.y*e.z-this.z*e.y,r=this.z*e.x-this.x*e.z,n=this.x*e.y-this.y*e.x;return new w(t,r,n)}negate(){return new w(-this.x,-this.y,-this.z)}unit(){const e=this.length;if(1==e)return this;if(0==e)return this;const t=this.x/e,r=this.y/e,n=this.z/e;return new w(t,r,n)}angleTo(e,t=void 0){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");if(!(t instanceof w||null==t))throw new TypeError("n is not Vector3d object");const r=null==t||this.cross(e).dot(t)>=0?1:-1,n=this.cross(e).length*r,a=this.dot(e);return Math.atan2(n,a)}rotateAround(e,t){if(!(e instanceof w))throw new TypeError("axis is not Vector3d object");const r=t.toRadians(),n=this.unit(),a=e.unit(),s=Math.sin(r),i=Math.cos(r),o=1-i,l=a.x,c=a.y,u=a.z,h=[[o*l*l+i,o*l*c-s*u,o*l*u+s*c],[o*l*c+s*u,o*c*c+i,o*c*u-s*l],[o*l*u-s*c,o*c*u+s*l,o*u*u+i]],d=[h[0][0]*n.x+h[0][1]*n.y+h[0][2]*n.z,h[1][0]*n.x+h[1][1]*n.y+h[1][2]*n.z,h[2][0]*n.x+h[2][1]*n.y+h[2][2]*n.z];return new w(d[0],d[1],d[2])}toString(e=3){return`[${this.x.toFixed(e)},${this.y.toFixed(e)},${this.z.toFixed(e)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const S={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},O={WGS84:{ellipsoid:S.WGS84}};Object.freeze(S.WGS84),Object.freeze(O.WGS84);class N{constructor(e,t,r=0){if(isNaN(e)||null==e)throw new TypeError(`invalid lat ‘${e}’`);if(isNaN(t)||null==t)throw new TypeError(`invalid lon ‘${t}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=v.wrap90(Number(e)),this._lon=v.wrap180(Number(t)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(e){if(this._lat=isNaN(e)?v.wrap90(v.parse(e)):v.wrap90(Number(e)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${e}’`)}set latitude(e){if(this._lat=isNaN(e)?v.wrap90(v.parse(e)):v.wrap90(Number(e)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${e}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(e){if(this._lon=isNaN(e)?v.wrap180(v.parse(e)):v.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${e}’`)}set lng(e){if(this._lon=isNaN(e)?v.wrap180(v.parse(e)):v.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${e}’`)}set longitude(e){if(this._lon=isNaN(e)?v.wrap180(v.parse(e)):v.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${e}’`)}get height(){return this._height}set height(e){if(this._height=Number(e),isNaN(this._height))throw new TypeError(`invalid height ‘${e}’`)}get datum(){return this._datum}set datum(e){this._datum=e}static get ellipsoids(){return S}static get datums(){return O}static parse(...e){if(0==e.length)throw new TypeError("invalid (empty) point");let t,r,n;if("object"==typeof e[0]&&(1==e.length||!isNaN(parseFloat(e[1])))){const a=e[0];if("Point"==a.type&&Array.isArray(a.coordinates)?([r,t,n]=a.coordinates,n=n||0):(null!=a.latitude&&(t=a.latitude),null!=a.lat&&(t=a.lat),null!=a.longitude&&(r=a.longitude),null!=a.lng&&(r=a.lng),null!=a.lon&&(r=a.lon),null!=a.height&&(n=a.height),t=v.wrap90(v.parse(t)),r=v.wrap180(v.parse(r))),null!=e[1]&&(n=e[1]),isNaN(t)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(e[0])}’`)}if("string"==typeof e[0]&&2==e[0].split(",").length&&([t,r]=e[0].split(","),t=v.wrap90(v.parse(t)),r=v.wrap180(v.parse(r)),n=e[1]||0,isNaN(t)||isNaN(r)))throw new TypeError(`invalid point ‘${e[0]}’`);if(null==t&&null==r&&([t,r]=e,t=v.wrap90(v.parse(t)),r=v.wrap180(v.parse(r)),n=e[2]||0,isNaN(t)||isNaN(r)))throw new TypeError(`invalid point ‘${e.toString()}’`);return new this(t,r,n)}toCartesian(){const e=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:S.WGS84,t=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:a,f:s}=e,i=Math.sin(t),o=Math.cos(t),l=Math.sin(r),c=Math.cos(r),u=2*s-s*s,h=a/Math.sqrt(1-u*i*i);return new T((h+n)*o*c,(h+n)*o*l,(h*(1-u)+n)*i)}equals(e){if(!(e instanceof N))throw new TypeError(`invalid point ‘${e}’`);return!(Math.abs(this.lat-e.lat)>Number.EPSILON)&&(!(Math.abs(this.lon-e.lon)>Number.EPSILON)&&(!(Math.abs(this.height-e.height)>Number.EPSILON)&&(this.datum==e.datum&&(this.referenceFrame==e.referenceFrame&&this.epoch==e.epoch))))}toString(e="d",t=void 0,r=null){if(!["d","dm","dms","n"].includes(e))throw new RangeError(`invalid format ‘${e}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";if("n"==e){null==t&&(t=4);return`${this.lat.toFixed(t)}, ${this.lon.toFixed(t)}${null==r?"":n}`}return`${v.toLat(this.lat,e,t)}, ${v.toLon(this.lon,e,t)}${null==r?"":n}`}}class T extends w{constructor(e,t,r){super(e,t,r)}toLatLon(e=S.WGS84){if(!e||!e.a)throw new TypeError(`invalid ellipsoid ‘${e}’`);const{x:t,y:r,z:n}=this,{a:a,b:s,f:i}=e,o=2*i-i*i,l=o/(1-o),c=Math.sqrt(t*t+r*r),u=s*n/(a*c)*(1+l*s/Math.sqrt(c*c+n*n)),h=u/Math.sqrt(1+u*u),d=h/u,p=isNaN(d)?0:Math.atan2(n+l*s*h*h*h,c-o*a*d*d*d),g=Math.atan2(r,t),m=Math.sin(p),f=c*Math.cos(p)+n*m-a*a/(a/Math.sqrt(1-o*m*m));return new N(p.toDegrees(),g.toDegrees(),f)}toString(e=0){return`[${this.x.toFixed(e)},${this.y.toFixed(e)},${this.z.toFixed(e)}]`}}const _={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},x={ED50:{ellipsoid:_.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:_.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:_.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:_.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:_.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:_.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:_.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:_.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:_.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:_.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:_.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(_).forEach(e=>Object.freeze(_[e])),Object.keys(x).forEach(e=>{Object.freeze(x[e]),Object.freeze(x[e].transform)});class D extends N{constructor(e,t,r=0,n=x.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(e,t,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return _}static get datums(){return x}static parse(...e){let t=x.WGS84;if((4==e.length||3==e.length&&"object"==typeof e[2])&&(t=e.pop()),!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);const r=super.parse(...e);return r._datum=t,r}convertDatum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);return this.toCartesian().convertDatum(e).toLatLon()}toCartesian(){const e=super.toCartesian();return new M(e.x,e.y,e.z,this.datum)}}class M extends T{constructor(e,t,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(e,t,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);this._datum=e}toLatLon(e=void 0){e&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=e);const t=this.datum||x.WGS84;if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);const r=super.toLatLon(t.ellipsoid);return new D(r.lat,r.lon,r.height,this.datum)}convertDatum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let t=null,r=null;null!=this.datum&&this.datum!=x.WGS84||(t=this,r=e.transform),e==x.WGS84&&(t=this,r=this.datum.transform.map(e=>-e)),null==r&&(t=this.convertDatum(x.WGS84),r=e.transform);const n=t.applyTransform(r);return n.datum=e,n}applyTransform(e){const{x:t,y:r,z:n}=this,a=e[0],s=e[1],i=e[2],o=e[3]/1e6+1,l=(e[4]/3600).toRadians(),c=(e[5]/3600).toRadians(),u=(e[6]/3600).toRadians();return new M(a+t*o-r*u+n*c,s+t*u+r*o-n*l,i-t*c+r*l+n*o)}}const R={trueOrigin:{lat:49,lon:-2},scaleFactor:.9996012717,ellipsoid:D.ellipsoids.Airy1830};class j{constructor(e,t){if(this.easting=Number(e),this.northing=Number(t),isNaN(e)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${e}’`);if(isNaN(t)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${t}’`)}toLatLon(e=D.datums.WGS84){const{easting:t,northing:r}=this,{a:n,b:a}=R.ellipsoid,s=R.trueOrigin.lat.toRadians(),i=R.trueOrigin.lon.toRadians(),o=-1e5,l=R.scaleFactor,c=1-a*a/(n*n),u=(n-a)/(n+a),h=u*u,d=u*u*u;let p=s,g=0;do{p=(r-o-g)/(n*l)+p;g=a*l*((1+u+5/4*h+5/4*d)*(p-s)-(3*u+3*u*u+21/8*d)*Math.sin(p-s)*Math.cos(p+s)+(15/8*h+15/8*d)*Math.sin(2*(p-s))*Math.cos(2*(p+s))-35/24*d*Math.sin(3*(p-s))*Math.cos(3*(p+s)))}while(Math.abs(r-o-g)>=1e-5);const m=Math.cos(p),f=Math.sin(p),y=n*l/Math.sqrt(1-c*f*f),b=n*l*(1-c)/Math.pow(1-c*f*f,1.5),E=y/b-1,v=Math.tan(p),w=v*v,S=w*w,O=1/m,N=y*y*y,T=N*y*y,_=t-4e5,x=_*_,M=x*_,j=x*x,P=M*x;p=p-v/(2*b*y)*x+v/(24*b*N)*(5+3*w+E-9*w*E)*j-v/(720*b*T)*(61+90*w+45*S)*(j*x);const k=i+O/y*_-O/(6*N)*(y/b+2*w)*M+O/(120*T)*(5+28*w+24*S)*P-O/(5040*(T*y*y))*(61+662*w+1320*S+720*(S*w))*(P*x);let C=new G(p.toDegrees(),k.toDegrees(),0,D.datums.OSGB36);return e!=D.datums.OSGB36&&(C=C.convertDatum(e),C=new G(C.lat,C.lon,C.height,C.datum)),C}static parse(e){let t=(e=String(e).trim()).match(/^(\d+),\s*(\d+)$/);if(t)return new j(t[1],t[2]);if(t=e.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!t)throw new Error(`invalid grid reference ‘${e}’`);let r=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=e.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const a=(r-2)%5*5+n%5,s=19-5*Math.floor(r/5)-Math.floor(n/5);let i=e.slice(2).trim().split(/\s+/);if(1==i.length&&(i=[i[0].slice(0,i[0].length/2),i[0].slice(i[0].length/2)]),i[0].length!=i[1].length)throw new Error(`invalid grid reference ‘${e}’`);i[0]=i[0].padEnd(5,"0"),i[1]=i[1].padEnd(5,"0");const o=a+i[0],l=s+i[1];return new j(o,l)}toString(e=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);let{easting:t,northing:r}=this;if(0==e){const e={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${t.toLocaleString("en",e)},${r.toLocaleString("en",e)}`}const n=Math.floor(t/1e5),a=Math.floor(r/1e5);let s=19-a-(19-a)%5+Math.floor((n+10)/5),i=5*(19-a)%25+n%5;s>7&&s++,i>7&&i++;const o=String.fromCharCode(s+"A".charCodeAt(0),i+"A".charCodeAt(0));return t=Math.floor(t%1e5/Math.pow(10,5-e/2)),r=Math.floor(r%1e5/Math.pow(10,5-e/2)),t=t.toString().padStart(e/2,"0"),r=r.toString().padStart(e/2,"0"),`${o} ${t} ${r}`}}class G extends D{toOsGrid(){const e=this.datum==D.datums.OSGB36?this:this.convertDatum(D.datums.OSGB36),t=e.lat.toRadians(),r=e.lon.toRadians(),{a:n,b:a}=R.ellipsoid,s=R.trueOrigin.lat.toRadians(),i=R.trueOrigin.lon.toRadians(),o=R.scaleFactor,l=1-a*a/(n*n),c=(n-a)/(n+a),u=c*c,h=c*c*c,d=Math.cos(t),p=Math.sin(t),g=n*o/Math.sqrt(1-l*p*p),m=n*o*(1-l)/Math.pow(1-l*p*p,1.5),f=g/m-1,y=a*o*((1+c+5/4*u+5/4*h)*(t-s)-(3*c+3*c*c+21/8*h)*Math.sin(t-s)*Math.cos(t+s)+(15/8*u+15/8*h)*Math.sin(2*(t-s))*Math.cos(2*(t+s))-35/24*h*Math.sin(3*(t-s))*Math.cos(3*(t+s))),b=d*d*d,E=b*d*d,v=Math.tan(t)*Math.tan(t),w=v*v,S=r-i,O=S*S,N=O*S,T=N*S,_=T*S;let x=y+-1e5+g/2*p*d*O+g/24*p*b*(5-v+9*f)*T+g/720*p*E*(61-58*v+w)*(_*S),M=4e5+g*d*S+g/6*b*(g/m-v)*N+g/120*E*(5-18*v+w+14*f-58*v*f)*_;x=Number(x.toFixed(3)),M=Number(M.toFixed(3));try{return new j(M,x)}catch(t){throw new Error(`${t.message} from (${e.lat.toFixed(6)},${e.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(e){const t=super.convertDatum(e);return new G(t.lat,t.lon,t.height,t.datum)}}var P;function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var L=500,A=e=>{var t=e.GAZETTEER_ENTRY,r="eng"===t.NAME2_LANG?t.NAME2:t.NAME1;return e.GAZETTEER_ENTRY.NAME1=r,e.GAZETTEER_ENTRY.NAME1_LANG="eng",e},I=(e,t)=>{var r,n,a,s,{MBR_XMIN:i,MBR_YMIN:o,MBR_XMAX:l,MBR_YMAX:c,GEOMETRY_X:u,GEOMETRY_Y:h}=t;if(null==i?(r=u-L,n=h-L,a=u+L,s=h+L):(r=i,n=o,a=l,s=c),"EPSG:27700"===e)return[r,n,a,s];if("EPSG:4326"===e){var d=new j(r,n).toLatLon(),p=new j(a,s).toLatLon();return[d.lon,d.lat,p.lon,p.lat].map(e=>Math.round(1e6*e)/1e6)}throw new Error("Unsupported CRS: ".concat(e))},$=(e,t)=>{var{GEOMETRY_X:r,GEOMETRY_Y:n}=t;if("EPSG:27700"===e)return[r,n];if("EPSG:4326"===e){var a=new j(r,n).toLatLon();return[Math.round(1e6*a.lon)/1e6,Math.round(1e6*a.lat)/1e6]}throw new Error("Unsupported CRS: ".concat(e))},F=function(e,t,r,n){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8;if(!e||e.error||0===(null===(a=e.header)||void 0===a?void 0:a.totalresults))return[];var i=e.results;return i=((e,t)=>{var r=t.toLowerCase().replace(/,/g,"").split(" ");return e.map(A).filter(e=>r.some(r=>{return e.GAZETTEER_ENTRY.NAME1.toLowerCase().includes(r)||(n=(n=t).replace(/\s/g,""),/^(([A-Z]{1,2}\d[A-Z\d]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?\d[A-Z]{2}|BFPO ?\d{1,4}|(KY\d|MSR|VG|AI)[ -]?\d{4}|[A-Z]{2} ?\d{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/i.test(n));var n}))})(i,t),i=((e,t)=>e.filter(e=>{var r,n=null==e||null===(r=e.GAZETTEER_ENTRY)||void 0===r||null===(r=r.COUNTRY)||void 0===r?void 0:r.toLowerCase();return n&&t.includes(n)}))(i=(e=>Array.from(new Map(e.map(e=>[e.GAZETTEER_ENTRY.ID,e])).values()))(i),r),(i=i.slice(0,s)).map(e=>C(C({id:e.GAZETTEER_ENTRY.ID,bounds:I(n,e.GAZETTEER_ENTRY),point:$(n,e.GAZETTEER_ENTRY)},((e,t)=>{var r,n,a,s,{NAME1:i,COUNTY_UNITARY:l,DISTRICT_BOROUGH:c,POSTCODE_DISTRICT:u,LOCAL_TYPE:h}=t,d="".concat(["City","Postcode"].includes(h)?"":u+", ").concat("City"===h?"":l||c),p="".concat(i).concat(d?", "+d:"");return{text:p,marked:(r=p,n=e,a=n.replace(/\s+/g,"").split("").join(String.raw(P||(P=o(["s*"],["\\s*"])))),s=new RegExp("(".concat(a,")"),"i"),r.replace(s,"<mark>$1</mark>"))}})(t,e.GAZETTEER_ENTRY)),{},{type:"os-names"}))};var W=e=>{var{url:t,options:r}=e;return new Request(t,r)},U=function(){var e=l(function*(e,t,r){var n,a={url:null===(n=e.urlTemplate)||void 0===n?void 0:n.replace("{query}",encodeURIComponent(t)),options:{method:"GET"}};if(e.buildRequest){var s=e.buildRequest(t,()=>a);return s instanceof Request?s:W(s)}return W(r?yield r(a,t):a)});return function(t,r,n){return e.apply(this,arguments)}}(),B=function(){var e=l(function*(e,t,r){try{var n=yield fetch(t);if(!n.ok)return console.error("Fetch error for ".concat(e.label||"dataset",": ").concat(n.status)),{error:!0};var a=yield n.json();return e.parseResults(a,r)}catch(t){return console.error("Network error for ".concat(e.label||"dataset",":"),t),{error:!0}}});return function(t,r,n){return e.apply(this,arguments)}}(),z=function(){var e=l(function*(e,t,r,n){var a=(e=>e.replaceAll(/[^a-zA-Z0-9\s\-.,]/g,"").trim())(e),s=t.filter(t=>{var r=!t.includeRegex||t.includeRegex.test(e),n=!!t.excludeRegex&&t.excludeRegex.test(a);return r&&!n}),i=[],o=!1;for(var l of s){var c=yield U(l,a,n),u=yield B(l,c,a);if(null!=u&&u.error?o=!0:null!=u&&u.length&&(i=[...i,...u]),l.exclusive&&i.length)break}return r({type:"UPDATE_SUGGESTIONS",payload:{results:i,hasError:o}}),{results:i,sanitisedValue:a}});return function(t,r,n,a){return e.apply(this,arguments)}}();function V(e){var{mapProvider:t,bounds:r,point:n,markers:a,showMarker:s,markerOptions:i}=e;t.fitToBounds(r),s&&a.add("search",n,i)}function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var H=e=>{var t=0,r=()=>{var n=(e=>{var t;return(null==e||null===(t=e.current)||void 0===t?void 0:t.search)||document.querySelector(".im-c-map-button--search")})(e);n&&(n.focus(),document.activeElement===n)||t<30&&(t+=1,requestAnimationFrame(r))};requestAnimationFrame(r)};function Z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var K=e=>{var{dispatch:t,services:r,mapProvider:n,markers:a,showMarker:i,markerOptions:o,viewportRef:l}=e,c=(e,t)=>{var r;return t>=0?"".concat(null===(r=e[t])||void 0===r?void 0:r.text,". ").concat(t+1," of ").concat(e.length," is highlighted"):"".concat(e.length," suggestions available")};return{handleSuggestionClick(e,c){var u;t({type:"SET_VALUE",payload:e.text}),t({type:"HIDE_SUGGESTIONS"}),t({type:"SET_SELECTED",payload:-1}),"mobile"===c.breakpoint&&(t({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),null===(u=l.current)||void 0===u||u.focus(),V({mapProvider:n,bounds:e.bounds,point:e.point,markers:a,showMarker:i,markerOptions:o}),r.eventBus.emit("search:match",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({query:e.text},e))},handleInputKeyDown(e,n){var{suggestions:a,selectedIndex:s}=n;switch(e.key){case"ArrowDown":if(null==a||!a.length)return;if(e.preventDefault(),s<a.length-1){var i=s+1;r.announce(c(a,i)),t({type:"SET_SELECTED",payload:i}),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!1})}break;case"ArrowUp":if(null==a||!a.length)return;e.preventDefault();var o=s>0?s-1:-1;r.announce(c(a,o)),t({type:"SET_SELECTED",payload:o}),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:o<0});break;case"Escape":e.preventDefault(),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!0}),t({type:"HIDE_SUGGESTIONS"}),t({type:"SET_SELECTED",payload:-1})}}}};function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function J(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Q(e){var t,r,n,a,{dispatch:s,searchContainerRef:i}=e,o=(t=t=>z(t,e.datasets,s,e.transformRequest),r=350,n=null,a=function(){for(var e=arguments.length,a=new Array(e),s=0;s<e;s++)a[s]=arguments[s];clearTimeout(n),n=setTimeout(()=>{t(...a)},r)},a.cancel=()=>{n&&(clearTimeout(n),n=null)},a),u=(e=>{var{dispatch:t,services:r,viewportRef:n,mapProvider:a,markers:s,datasets:i,transformRequest:o,showMarker:u,markerOptions:h}=e,d="";return{handleCloseClick(e,n){t({type:"TOGGLE_EXPANDED",payload:!1}),t({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),t({type:"SET_VALUE",payload:""}),H(null==n?void 0:n.buttonRefs),s.remove("search"),r.eventBus.emit("search:clear"),r.eventBus.emit("search:close")},handleSubmit:(e,p,g)=>l(function*(){e.preventDefault();var{suggestions:l,selectedIndex:m,value:f}=g,y=null==f?void 0:f.trim();if(t({type:"SET_SELECTED",payload:-1}),t({type:"HIDE_SUGGESTIONS"}),m>=0){var b,E=l[m];return t({type:"SET_VALUE",payload:E.text}),null===(b=n.current)||void 0===b||b.focus(),V({mapProvider:a,bounds:E.bounds,point:E.point,markers:s,showMarker:u,markerOptions:h}),void r.eventBus.emit("search:match",q({query:E.text},E))}if(!((null==y?void 0:y.length)<c.minSearchLength)){var v=l;if(!l.length||y!==d){var{results:w,sanitisedValue:S}=yield z(y,i,t,o);v=w,d=S}if(v.length){var O;null===(O=n.current)||void 0===O||O.focus(),"mobile"===p.breakpoint&&(t({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close"));var N=v[0];V({mapProvider:a,bounds:N.bounds,point:N.point,markers:s,showMarker:u,markerOptions:h}),r.eventBus.emit("search:match",q({query:f},N))}}})()}})(e),h=(e=>{var{dispatch:t,debouncedFetchSuggestions:r}=e;return{handleInputClick(){t({type:"SHOW_SUGGESTIONS"})},handleInputFocus(e){t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:"keyboard"===e})},handleInputBlur(e){t({type:"INPUT_BLUR",payload:e})},handleInputChange(e){var n=e.target.value;if(t({type:"SET_VALUE",payload:n}),n.length<c.minSearchLength)return r.cancel(),t({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),void t({type:"HIDE_SUGGESTIONS"});t({type:"SHOW_SUGGESTIONS"}),r(n)}}})(J(J({},e),{},{debouncedFetchSuggestions:o})),d=K(e);return J(J(J(J({},u),h),d),{},{handleOutside(t){i.current.contains(t.target)||(s({type:"TOGGLE_EXPANDED",payload:!1}),e.services.eventBus.emit("search:close"))}})}var ee=["marker"];function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var re={reducer:{initialState:{isExpanded:!1,hasKeyboardFocusWithin:!1,value:"",suggestions:[],areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1,selectedIndex:-1},actions:d},buttons:[{id:"search",label:"Search",iconId:"search",ariaControls:e=>{var{appConfig:t}=e;return"".concat(t.id,"-search-form")},expandedWhen:e=>{var{pluginState:t}=e;return t.isExpanded},excludeWhen:e=>{var{pluginConfig:t}=e;return Boolean(t.expanded)},keepFocus:!0,onClick:(e,t)=>{var{pluginState:r,services:n}=t;r.dispatch({type:"TOGGLE_EXPANDED",payload:!0}),n.eventBus.emit("search:open")},mobile:{slot:"top-right",showLabel:!1},tablet:{slot:"top-left",showLabel:!1},desktop:{slot:"top-left",showLabel:!1}}],controls:[{id:"search",mobile:{slot:"header"},tablet:{slot:"top-left"},desktop:{slot:"top-left"},render:function(o){var{appConfig:l,iconRegistry:c,pluginState:u,pluginConfig:h,appState:d,mapState:p,services:g,mapProvider:m}=o,{id:E}=l,{interfaceType:v}=d,{expanded:w,customDatasets:S,osNamesURL:O,regions:N,maxSuggestions:T}=h,{dispatch:_,isExpanded:x,areSuggestionsVisible:D,suggestions:M}=u,R=c.close,j=c.search,G=t(null),P=t(null),k=d.layoutRefs.viewportRef,C=function(e){var{customDatasets:t=[],osNamesURL:r,crs:n,regions:a=["england","scotland","wales"],maxSuggestions:s}=e;return r?[{name:"osNames",urlTemplate:r,parseResults:(e,t)=>F(e,t,a,n,s),includeRegex:/[a-zA-Z0-9]/,excludeRegex:/^(?:[a-z]{2}\s*(?:\d{3}\s*\d{3}|\d{4}\s*\d{4}|\d{5}\s*\d{5})|\d+\s*,?\s*\d+)$/i},...t]:t}({customDatasets:S,osNamesURL:O,regions:N,maxSuggestions:T,crs:m.crs}),L=t(null);if(!L.current){var{marker:A}=h,I=i(h,ee);L.current=Q(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({dispatch:_,datasets:C,services:g,mapProvider:m,viewportRef:k,searchContainerRef:G,markers:p.markers,markerOptions:A},I))}var $=L.current,W=x||!!(w&&D&&M.length);return e(()=>{var e;x&&(null===(e=P.current)||void 0===e||e.focus())},[x]),r(()=>{if(d.dispatch({type:"TOGGLE_HAS_EXCLUSIVE_CONTROL",payload:x}),W)return k.current.style.pointerEvents="none",document.addEventListener("focusin",$.handleOutside),document.addEventListener("pointerdown",$.handleOutside),()=>{k.current.style.pointerEvents="auto",document.removeEventListener("focusin",$.handleOutside),document.removeEventListener("pointerdown",$.handleOutside)}},[x,v,D,M]),n("div",{className:"im-c-search".concat(w||x?"":" im-c-search--collapsed"),ref:G,children:a(f,{id:E,pluginState:u,pluginConfig:h,appState:d,inputRef:P,events:$,services:g,children:[n(y,{defaultExpanded:w,onClick:e=>$.handleCloseClick(e,d),closeIcon:R}),n(b,{defaultExpanded:w,submitIcon:j})]})})}}],icons:[{id:"search",svgContent:'<path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle>'}]},ne=Object.freeze({__proto__:null,manifest:re});export{c as D,ne as m};
1
+ import{useEffect as e,useRef as t,useLayoutEffect as r}from"preact/compat";import{jsx as n,jsxs as a}from"preact/jsx-runtime";import s from"@babel/runtime/helpers/defineProperty";import i from"@babel/runtime/helpers/objectWithoutProperties";import o from"@babel/runtime/helpers/taggedTemplateLiteral";import l from"@babel/runtime/helpers/asyncToGenerator";var c={expanded:!1,showMarker:!0,placeholder:"Search",minSearchLength:3,maxSuggestions:8,noResultsMessage:"No results available",searchErrorMessage:"Sorry, there was a problem with search"};function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var d={TOGGLE_EXPANDED:(e,t)=>h(h({},e),{},{isExpanded:t,areSuggestionsVisible:t,hasFetchedSuggestions:!1,hasSearchError:!1}),SET_KEYBOARD_FOCUS_WITHIN:(e,t)=>h(h({},e),{},{hasKeyboardFocusWithin:t,areSuggestionsVisible:!0}),INPUT_BLUR:(e,t)=>h(h({},e),{},{hasKeyboardFocusWithin:!1,areSuggestionsVisible:e.areSuggestionsVisible&&"keyboard"!==t,selectedIndex:-1}),SET_VALUE:(e,t)=>h(h({},e),{},{value:t}),UPDATE_SUGGESTIONS:(e,t)=>h(h({},e),{},{suggestions:t.results,hasFetchedSuggestions:!0,hasSearchError:t.hasError}),SHOW_SUGGESTIONS:e=>h(h({},e),{},{areSuggestionsVisible:!0,hasFetchedSuggestions:!1,hasSearchError:!1}),HIDE_SUGGESTIONS:e=>h(h({},e),{},{areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1}),SET_SELECTED:(e,t)=>h(h({},e),{},{selectedIndex:t,areSuggestionsVisible:t>=0})},p=e=>{var{id:t,pluginState:r,handleSuggestionClick:a}=e;return n("ul",{id:"".concat(t,"-search-suggestions"),role:"listbox","aria-labelledby":"".concat(t,"-search-input"),className:"im-c-search-suggestions",style:r.areSuggestionsVisible&&r.suggestions.length?void 0:{display:"none"},children:r.suggestions.map((e,s)=>n("li",{id:"".concat(t,"-search-suggestion-").concat(s),className:"im-c-search-suggestions__item",role:"option","aria-selected":r.selectedIndex===s,"aria-setsize":r.suggestions.length,"aria-posinset":s+1,onClick:()=>a(e),children:n("span",{className:"im-c-search-suggestions__label",dangerouslySetInnerHTML:{__html:e.marked}})},"".concat(t,"-").concat(e.type,"-").concat(e.id)))})};function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var m=(e,t,r)=>function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({display:e.expanded||t.isExpanded?"flex":void 0},"mobile"!==r.breakpoint&&(null==e?void 0:e.width)&&{width:e.width}),f=t=>{var{id:r,pluginState:s,pluginConfig:i,appState:o,inputRef:l,events:c,services:u,children:h}=t,{areSuggestionsVisible:d,hasFetchedSuggestions:g,hasSearchError:f,suggestions:y=[]}=s,{noResultsMessage:b,searchErrorMessage:E}=i;e(()=>{d&&g&&u.announce(((e,t,r,n)=>{if(t)return r;if(0===e)return n;var a=1===e?"result":"results";return"".concat(e," ").concat(a," available")})(y.length,f,E,b))},[y,g]);var v=["im-c-search-form",i.expanded&&"im-c-search-form--default-expanded","im-c-panel"].filter(Boolean).join(" "),w=d&&g&&(f||!y.length);return a("form",{id:"".concat(r,"-search-form"),role:"search",className:v,style:m(i,s,o),"aria-controls":"".concat(r,"-viewport"),onSubmit:e=>c.handleSubmit(e,o,s),children:[n("button",{type:"submit",style:{display:"none"},"aria-hidden":"true",tabIndex:-1,children:"Submit"}),a("div",{className:"im-c-search__input-container".concat(s.hasKeyboardFocusWithin?" im-c-search__input-container--keyboard-focus-within":""),children:[n("label",{htmlFor:"".concat(r,"-search-input"),className:"im-u-visually-hidden",children:i.placeholder}),n("input",{id:"".concat(r,"-search-input"),className:"im-c-search__input",type:"search",role:"combobox","aria-expanded":s.suggestionsVisible,"aria-controls":"".concat(r,"-search-suggestions"),"aria-activedescendant":s.selectedIndex>=0?"".concat(r,"-search-suggestion-").concat(s.selectedIndex):void 0,"aria-describedby":s.value?void 0:"".concat(r,"-search-hint"),"aria-autocomplete":"list",autoComplete:"off",placeholder:i.placeholder,name:"".concat(r,"-search-input"),spellCheck:!1,enterKeyHint:"search",value:s.value,onClick:c.handleInputClick,onChange:c.handleInputChange,onFocus:()=>c.handleInputFocus(o.interfaceType),onBlur:()=>c.handleInputBlur(o.interfaceType),onKeyDown:e=>c.handleInputKeyDown(e,s),ref:l}),n("span",{id:"".concat(r,"-search-hint"),className:"im-c-search__hint",children:"When search results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."}),h]}),w&&n("div",{className:"im-c-search__status","aria-hidden":"true",children:f?E:b}),n(p,{id:r,appState:o,pluginState:s,handleSuggestionClick:e=>c.handleSuggestionClick(e,o)})]})},y=e=>{var{defaultExpanded:t,onClick:r,closeIcon:a}=e;return n("button",{"aria-label":"Close search",className:"im-c-map-button im-c-search-close-button",type:"button",onClick:r,style:t?{display:"none"}:void 0,children:a&&n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:a}})})},b=e=>{var{defaultExpanded:t,submitIcon:r}=e;return n("button",{"aria-label":"Search",className:"im-c-map-button im-c-search-submit-button",type:"submit",style:t?void 0:{display:"none"},children:r&&n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:r}})})};let E=" ";class v{static get separator(){return E}static set separator(e){E=e}static parse(e){if(!isNaN(parseFloat(e))&&isFinite(e))return Number(e);const t=String(e).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==t[t.length-1]&&t.splice(t.length-1),""==t)return NaN;let r=null;switch(t.length){case 3:r=t[0]/1+t[1]/60+t[2]/3600;break;case 2:r=t[0]/1+t[1]/60;break;case 1:r=t[0];break;default:return NaN}return/^-|[WS]$/i.test(e.trim())&&(r=-r),Number(r)}static toDms(e,t="d",r=void 0){if(isNaN(e))return null;if("string"==typeof e&&""==e.trim())return null;if("boolean"==typeof e)return null;if(e==1/0)return null;if(null==e)return null;if(void 0===r)switch(t){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:t="d",r=4}e=Math.abs(e);let n=null,a=null,s=null,i=null;switch(t){default:case"d":case"deg":a=e.toFixed(r),a<100&&(a="0"+a),a<10&&(a="0"+a),n=a+"°";break;case"dm":case"deg+min":a=Math.floor(e),s=(60*e%60).toFixed(r),60==s&&(s=(0).toFixed(r),a++),a=("000"+a).slice(-3),s<10&&(s="0"+s),n=a+"°"+v.separator+s+"′";break;case"dms":case"deg+min+sec":a=Math.floor(e),s=Math.floor(3600*e/60)%60,i=(3600*e%60).toFixed(r),60==i&&(i=(0).toFixed(r),s++),60==s&&(s=0,a++),a=("000"+a).slice(-3),s=("00"+s).slice(-2),i<10&&(i="0"+i),n=a+"°"+v.separator+s+"′"+v.separator+i+"″"}return n}static toLat(e,t,r){const n=v.toDms(v.wrap90(e),t,r);return null===n?"–":n.slice(1)+v.separator+(e<0?"S":"N")}static toLon(e,t,r){const n=v.toDms(v.wrap180(e),t,r);return null===n?"–":n+v.separator+(e<0?"W":"E")}static toBrng(e,t,r){const n=v.toDms(v.wrap360(e),t,r);return null===n?"–":n.replace("360","0")}static fromLocale(e){const t=123456.789.toLocaleString(),r={thousands:t.slice(3,4),decimal:t.slice(7,8)};return e.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(e){const t=123456.789.toLocaleString(),r={thousands:t.slice(3,4),decimal:t.slice(7,8)};return e.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(e,t=3){if(![1,2,3].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);e=v.wrap360(e);const r=4*2**(t-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(e*r/360)%r*16/r]}static wrap90(e){if(-90<=e&&e<=90)return e;const t=e,r=360;return 1*Math.abs(((t-90)%r+r)%r-180)-90}static wrap180(e){if(-180<=e&&e<=180)return e;const t=360;return((360*e/t-180)%t+t)%t-180}static wrap360(e){if(0<=e&&e<360)return e;const t=360;return(360*e/t%t+t)%t}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};class w{constructor(e,t,r){if(isNaN(e)||isNaN(t)||isNaN(r))throw new TypeError(`invalid vector [${e},${t},${r}]`);this.x=Number(e),this.y=Number(t),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");return new w(this.x+e.x,this.y+e.y,this.z+e.z)}minus(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");return new w(this.x-e.x,this.y-e.y,this.z-e.z)}times(e){if(isNaN(e))throw new TypeError(`invalid scalar value ‘${e}’`);return new w(this.x*e,this.y*e,this.z*e)}dividedBy(e){if(isNaN(e))throw new TypeError(`invalid scalar value ‘${e}’`);return new w(this.x/e,this.y/e,this.z/e)}dot(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");return this.x*e.x+this.y*e.y+this.z*e.z}cross(e){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");const t=this.y*e.z-this.z*e.y,r=this.z*e.x-this.x*e.z,n=this.x*e.y-this.y*e.x;return new w(t,r,n)}negate(){return new w(-this.x,-this.y,-this.z)}unit(){const e=this.length;if(1==e)return this;if(0==e)return this;const t=this.x/e,r=this.y/e,n=this.z/e;return new w(t,r,n)}angleTo(e,t=void 0){if(!(e instanceof w))throw new TypeError("v is not Vector3d object");if(!(t instanceof w||null==t))throw new TypeError("n is not Vector3d object");const r=null==t||this.cross(e).dot(t)>=0?1:-1,n=this.cross(e).length*r,a=this.dot(e);return Math.atan2(n,a)}rotateAround(e,t){if(!(e instanceof w))throw new TypeError("axis is not Vector3d object");const r=t.toRadians(),n=this.unit(),a=e.unit(),s=Math.sin(r),i=Math.cos(r),o=1-i,l=a.x,c=a.y,u=a.z,h=[[o*l*l+i,o*l*c-s*u,o*l*u+s*c],[o*l*c+s*u,o*c*c+i,o*c*u-s*l],[o*l*u-s*c,o*c*u+s*l,o*u*u+i]],d=[h[0][0]*n.x+h[0][1]*n.y+h[0][2]*n.z,h[1][0]*n.x+h[1][1]*n.y+h[1][2]*n.z,h[2][0]*n.x+h[2][1]*n.y+h[2][2]*n.z];return new w(d[0],d[1],d[2])}toString(e=3){return`[${this.x.toFixed(e)},${this.y.toFixed(e)},${this.z.toFixed(e)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const S={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},O={WGS84:{ellipsoid:S.WGS84}};Object.freeze(S.WGS84),Object.freeze(O.WGS84);class N{constructor(e,t,r=0){if(isNaN(e)||null==e)throw new TypeError(`invalid lat ‘${e}’`);if(isNaN(t)||null==t)throw new TypeError(`invalid lon ‘${t}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=v.wrap90(Number(e)),this._lon=v.wrap180(Number(t)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(e){if(this._lat=isNaN(e)?v.wrap90(v.parse(e)):v.wrap90(Number(e)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${e}’`)}set latitude(e){if(this._lat=isNaN(e)?v.wrap90(v.parse(e)):v.wrap90(Number(e)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${e}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(e){if(this._lon=isNaN(e)?v.wrap180(v.parse(e)):v.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${e}’`)}set lng(e){if(this._lon=isNaN(e)?v.wrap180(v.parse(e)):v.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${e}’`)}set longitude(e){if(this._lon=isNaN(e)?v.wrap180(v.parse(e)):v.wrap180(Number(e)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${e}’`)}get height(){return this._height}set height(e){if(this._height=Number(e),isNaN(this._height))throw new TypeError(`invalid height ‘${e}’`)}get datum(){return this._datum}set datum(e){this._datum=e}static get ellipsoids(){return S}static get datums(){return O}static parse(...e){if(0==e.length)throw new TypeError("invalid (empty) point");let t,r,n;if("object"==typeof e[0]&&(1==e.length||!isNaN(parseFloat(e[1])))){const a=e[0];if("Point"==a.type&&Array.isArray(a.coordinates)?([r,t,n]=a.coordinates,n=n||0):(null!=a.latitude&&(t=a.latitude),null!=a.lat&&(t=a.lat),null!=a.longitude&&(r=a.longitude),null!=a.lng&&(r=a.lng),null!=a.lon&&(r=a.lon),null!=a.height&&(n=a.height),t=v.wrap90(v.parse(t)),r=v.wrap180(v.parse(r))),null!=e[1]&&(n=e[1]),isNaN(t)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(e[0])}’`)}if("string"==typeof e[0]&&2==e[0].split(",").length&&([t,r]=e[0].split(","),t=v.wrap90(v.parse(t)),r=v.wrap180(v.parse(r)),n=e[1]||0,isNaN(t)||isNaN(r)))throw new TypeError(`invalid point ‘${e[0]}’`);if(null==t&&null==r&&([t,r]=e,t=v.wrap90(v.parse(t)),r=v.wrap180(v.parse(r)),n=e[2]||0,isNaN(t)||isNaN(r)))throw new TypeError(`invalid point ‘${e.toString()}’`);return new this(t,r,n)}toCartesian(){const e=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:S.WGS84,t=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:a,f:s}=e,i=Math.sin(t),o=Math.cos(t),l=Math.sin(r),c=Math.cos(r),u=2*s-s*s,h=a/Math.sqrt(1-u*i*i);return new T((h+n)*o*c,(h+n)*o*l,(h*(1-u)+n)*i)}equals(e){if(!(e instanceof N))throw new TypeError(`invalid point ‘${e}’`);return!(Math.abs(this.lat-e.lat)>Number.EPSILON)&&(!(Math.abs(this.lon-e.lon)>Number.EPSILON)&&(!(Math.abs(this.height-e.height)>Number.EPSILON)&&(this.datum==e.datum&&(this.referenceFrame==e.referenceFrame&&this.epoch==e.epoch))))}toString(e="d",t=void 0,r=null){if(!["d","dm","dms","n"].includes(e))throw new RangeError(`invalid format ‘${e}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";if("n"==e){null==t&&(t=4);return`${this.lat.toFixed(t)}, ${this.lon.toFixed(t)}${null==r?"":n}`}return`${v.toLat(this.lat,e,t)}, ${v.toLon(this.lon,e,t)}${null==r?"":n}`}}class T extends w{constructor(e,t,r){super(e,t,r)}toLatLon(e=S.WGS84){if(!e||!e.a)throw new TypeError(`invalid ellipsoid ‘${e}’`);const{x:t,y:r,z:n}=this,{a:a,b:s,f:i}=e,o=2*i-i*i,l=o/(1-o),c=Math.sqrt(t*t+r*r),u=s*n/(a*c)*(1+l*s/Math.sqrt(c*c+n*n)),h=u/Math.sqrt(1+u*u),d=h/u,p=isNaN(d)?0:Math.atan2(n+l*s*h*h*h,c-o*a*d*d*d),g=Math.atan2(r,t),m=Math.sin(p),f=c*Math.cos(p)+n*m-a*a/(a/Math.sqrt(1-o*m*m));return new N(p.toDegrees(),g.toDegrees(),f)}toString(e=0){return`[${this.x.toFixed(e)},${this.y.toFixed(e)},${this.z.toFixed(e)}]`}}const _={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},x={ED50:{ellipsoid:_.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:_.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:_.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:_.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:_.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:_.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:_.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:_.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:_.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:_.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:_.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(_).forEach(e=>Object.freeze(_[e])),Object.keys(x).forEach(e=>{Object.freeze(x[e]),Object.freeze(x[e].transform)});class D extends N{constructor(e,t,r=0,n=x.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(e,t,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return _}static get datums(){return x}static parse(...e){let t=x.WGS84;if((4==e.length||3==e.length&&"object"==typeof e[2])&&(t=e.pop()),!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);const r=super.parse(...e);return r._datum=t,r}convertDatum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);return this.toCartesian().convertDatum(e).toLatLon()}toCartesian(){const e=super.toCartesian();return new M(e.x,e.y,e.z,this.datum)}}class M extends T{constructor(e,t,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(e,t,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);this._datum=e}toLatLon(e=void 0){e&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=e);const t=this.datum||x.WGS84;if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);const r=super.toLatLon(t.ellipsoid);return new D(r.lat,r.lon,r.height,this.datum)}convertDatum(e){if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let t=null,r=null;null!=this.datum&&this.datum!=x.WGS84||(t=this,r=e.transform),e==x.WGS84&&(t=this,r=this.datum.transform.map(e=>-e)),null==r&&(t=this.convertDatum(x.WGS84),r=e.transform);const n=t.applyTransform(r);return n.datum=e,n}applyTransform(e){const{x:t,y:r,z:n}=this,a=e[0],s=e[1],i=e[2],o=e[3]/1e6+1,l=(e[4]/3600).toRadians(),c=(e[5]/3600).toRadians(),u=(e[6]/3600).toRadians();return new M(a+t*o-r*u+n*c,s+t*u+r*o-n*l,i-t*c+r*l+n*o)}}const R={trueOrigin:{lat:49,lon:-2},scaleFactor:.9996012717,ellipsoid:D.ellipsoids.Airy1830};class j{constructor(e,t){if(this.easting=Number(e),this.northing=Number(t),isNaN(e)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${e}’`);if(isNaN(t)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${t}’`)}toLatLon(e=D.datums.WGS84){const{easting:t,northing:r}=this,{a:n,b:a}=R.ellipsoid,s=R.trueOrigin.lat.toRadians(),i=R.trueOrigin.lon.toRadians(),o=-1e5,l=R.scaleFactor,c=1-a*a/(n*n),u=(n-a)/(n+a),h=u*u,d=u*u*u;let p=s,g=0;do{p=(r-o-g)/(n*l)+p;g=a*l*((1+u+5/4*h+5/4*d)*(p-s)-(3*u+3*u*u+21/8*d)*Math.sin(p-s)*Math.cos(p+s)+(15/8*h+15/8*d)*Math.sin(2*(p-s))*Math.cos(2*(p+s))-35/24*d*Math.sin(3*(p-s))*Math.cos(3*(p+s)))}while(Math.abs(r-o-g)>=1e-5);const m=Math.cos(p),f=Math.sin(p),y=n*l/Math.sqrt(1-c*f*f),b=n*l*(1-c)/Math.pow(1-c*f*f,1.5),E=y/b-1,v=Math.tan(p),w=v*v,S=w*w,O=1/m,N=y*y*y,T=N*y*y,_=t-4e5,x=_*_,M=x*_,j=x*x,P=M*x;p=p-v/(2*b*y)*x+v/(24*b*N)*(5+3*w+E-9*w*E)*j-v/(720*b*T)*(61+90*w+45*S)*(j*x);const k=i+O/y*_-O/(6*N)*(y/b+2*w)*M+O/(120*T)*(5+28*w+24*S)*P-O/(5040*(T*y*y))*(61+662*w+1320*S+720*(S*w))*(P*x);let C=new G(p.toDegrees(),k.toDegrees(),0,D.datums.OSGB36);return e!=D.datums.OSGB36&&(C=C.convertDatum(e),C=new G(C.lat,C.lon,C.height,C.datum)),C}static parse(e){let t=(e=String(e).trim()).match(/^(\d+),\s*(\d+)$/);if(t)return new j(t[1],t[2]);if(t=e.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!t)throw new Error(`invalid grid reference ‘${e}’`);let r=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=e.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const a=(r-2)%5*5+n%5,s=19-5*Math.floor(r/5)-Math.floor(n/5);let i=e.slice(2).trim().split(/\s+/);if(1==i.length&&(i=[i[0].slice(0,i[0].length/2),i[0].slice(i[0].length/2)]),i[0].length!=i[1].length)throw new Error(`invalid grid reference ‘${e}’`);i[0]=i[0].padEnd(5,"0"),i[1]=i[1].padEnd(5,"0");const o=a+i[0],l=s+i[1];return new j(o,l)}toString(e=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);let{easting:t,northing:r}=this;if(0==e){const e={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${t.toLocaleString("en",e)},${r.toLocaleString("en",e)}`}const n=Math.floor(t/1e5),a=Math.floor(r/1e5);let s=19-a-(19-a)%5+Math.floor((n+10)/5),i=5*(19-a)%25+n%5;s>7&&s++,i>7&&i++;const o=String.fromCharCode(s+"A".charCodeAt(0),i+"A".charCodeAt(0));return t=Math.floor(t%1e5/Math.pow(10,5-e/2)),r=Math.floor(r%1e5/Math.pow(10,5-e/2)),t=t.toString().padStart(e/2,"0"),r=r.toString().padStart(e/2,"0"),`${o} ${t} ${r}`}}class G extends D{toOsGrid(){const e=this.datum==D.datums.OSGB36?this:this.convertDatum(D.datums.OSGB36),t=e.lat.toRadians(),r=e.lon.toRadians(),{a:n,b:a}=R.ellipsoid,s=R.trueOrigin.lat.toRadians(),i=R.trueOrigin.lon.toRadians(),o=R.scaleFactor,l=1-a*a/(n*n),c=(n-a)/(n+a),u=c*c,h=c*c*c,d=Math.cos(t),p=Math.sin(t),g=n*o/Math.sqrt(1-l*p*p),m=n*o*(1-l)/Math.pow(1-l*p*p,1.5),f=g/m-1,y=a*o*((1+c+5/4*u+5/4*h)*(t-s)-(3*c+3*c*c+21/8*h)*Math.sin(t-s)*Math.cos(t+s)+(15/8*u+15/8*h)*Math.sin(2*(t-s))*Math.cos(2*(t+s))-35/24*h*Math.sin(3*(t-s))*Math.cos(3*(t+s))),b=d*d*d,E=b*d*d,v=Math.tan(t)*Math.tan(t),w=v*v,S=r-i,O=S*S,N=O*S,T=N*S,_=T*S;let x=y+-1e5+g/2*p*d*O+g/24*p*b*(5-v+9*f)*T+g/720*p*E*(61-58*v+w)*(_*S),M=4e5+g*d*S+g/6*b*(g/m-v)*N+g/120*E*(5-18*v+w+14*f-58*v*f)*_;x=Number(x.toFixed(3)),M=Number(M.toFixed(3));try{return new j(M,x)}catch(t){throw new Error(`${t.message} from (${e.lat.toFixed(6)},${e.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(e){const t=super.convertDatum(e);return new G(t.lat,t.lon,t.height,t.datum)}}var P;function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function C(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var L=500,A=e=>{var t=e.GAZETTEER_ENTRY,r="eng"===t.NAME2_LANG?t.NAME2:t.NAME1;return e.GAZETTEER_ENTRY.NAME1=r,e.GAZETTEER_ENTRY.NAME1_LANG="eng",e},I=(e,t)=>{var r,n,a,s,{MBR_XMIN:i,MBR_YMIN:o,MBR_XMAX:l,MBR_YMAX:c,GEOMETRY_X:u,GEOMETRY_Y:h}=t;if(null==i?(r=u-L,n=h-L,a=u+L,s=h+L):(r=i,n=o,a=l,s=c),"EPSG:27700"===e)return[r,n,a,s];if("EPSG:4326"===e){var d=new j(r,n).toLatLon(),p=new j(a,s).toLatLon();return[d.lon,d.lat,p.lon,p.lat].map(e=>Math.round(1e6*e)/1e6)}throw new Error("Unsupported CRS: ".concat(e))},$=(e,t)=>{var{GEOMETRY_X:r,GEOMETRY_Y:n}=t;if("EPSG:27700"===e)return[r,n];if("EPSG:4326"===e){var a=new j(r,n).toLatLon();return[Math.round(1e6*a.lon)/1e6,Math.round(1e6*a.lat)/1e6]}throw new Error("Unsupported CRS: ".concat(e))},F=function(e,t,r,n){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8;if(!e||e.error||0===(null===(a=e.header)||void 0===a?void 0:a.totalresults))return[];var i=e.results;return i=((e,t)=>{var r=t.toLowerCase().replace(/,/g,"").split(" ");return e.map(A).filter(e=>r.some(r=>{return e.GAZETTEER_ENTRY.NAME1.toLowerCase().includes(r)||(n=(n=t).replace(/\s/g,""),/^(([A-Z]{1,2}\d[A-Z\d]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?\d[A-Z]{2}|BFPO ?\d{1,4}|(KY\d|MSR|VG|AI)[ -]?\d{4}|[A-Z]{2} ?\d{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/i.test(n));var n}))})(i,t),i=((e,t)=>e.filter(e=>{var r,n=null==e||null===(r=e.GAZETTEER_ENTRY)||void 0===r||null===(r=r.COUNTRY)||void 0===r?void 0:r.toLowerCase();return n&&t.includes(n)}))(i=(e=>Array.from(new Map(e.map(e=>[e.GAZETTEER_ENTRY.ID,e])).values()))(i),r),(i=i.slice(0,s)).map(e=>C(C({id:e.GAZETTEER_ENTRY.ID,bounds:I(n,e.GAZETTEER_ENTRY),point:$(n,e.GAZETTEER_ENTRY)},((e,t)=>{var r,n,a,s,{NAME1:i,COUNTY_UNITARY:l,DISTRICT_BOROUGH:c,POSTCODE_DISTRICT:u,LOCAL_TYPE:h}=t,d="".concat(["City","Postcode"].includes(h)?"":u+", ").concat("City"===h?"":l||c),p="".concat(i).concat(d?", "+d:"");return{text:p,marked:(r=p,n=e,a=n.replace(/\s+/g,"").split("").join(String.raw(P||(P=o(["s*"],["\\s*"])))),s=new RegExp("(".concat(a,")"),"i"),r.replace(s,"<mark>$1</mark>"))}})(t,e.GAZETTEER_ENTRY)),{},{type:"os-names"}))};var W=e=>{var{url:t,options:r}=e;return new Request(t,r)},U=function(){var e=l(function*(e,t,r){var n,a={url:null===(n=e.urlTemplate)||void 0===n?void 0:n.replace("{query}",encodeURIComponent(t)),options:{method:"GET"}};if(e.buildRequest){var s=e.buildRequest(t,()=>a);return s instanceof Request?s:W(s)}return W(r?yield r(a,t):a)});return function(t,r,n){return e.apply(this,arguments)}}(),B=function(){var e=l(function*(e,t,r){try{var n=yield fetch(t);if(!n.ok)return console.error("Fetch error for ".concat(e.label||"dataset",": ").concat(n.status)),{error:!0};var a=yield n.json();return e.parseResults(a,r)}catch(t){return console.error("Network error for ".concat(e.label||"dataset",":"),t),{error:!0}}});return function(t,r,n){return e.apply(this,arguments)}}(),z=function(){var e=l(function*(e,t,r,n){var a=(e=>e.replaceAll(/[^a-zA-Z0-9\s\-.,]/g,"").trim())(e),s=t.filter(t=>{var r=!t.includeRegex||t.includeRegex.test(e),n=!!t.excludeRegex&&t.excludeRegex.test(a);return r&&!n}),i=[],o=!1;for(var l of s){var c=yield U(l,a,n),u=yield B(l,c,a);if(null!=u&&u.error?o=!0:null!=u&&u.length&&(i=[...i,...u]),l.exclusive&&i.length)break}return r({type:"UPDATE_SUGGESTIONS",payload:{results:i,hasError:o}}),{results:i,sanitisedValue:a}});return function(t,r,n,a){return e.apply(this,arguments)}}();function V(e){var{mapProvider:t,bounds:r,point:n,markers:a,showMarker:s,markerOptions:i}=e;t.fitToBounds(r),s&&a.add("search",n,i)}function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var H=e=>{var t=0,r=()=>{var n=(e=>{var t;return(null==e||null===(t=e.current)||void 0===t?void 0:t.search)||document.querySelector(".im-c-map-button--search")})(e);n&&(n.focus(),document.activeElement===n)||t<30&&(t+=1,requestAnimationFrame(r))};requestAnimationFrame(r)};function Z(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var K=e=>{var{dispatch:t,services:r,mapProvider:n,markers:a,showMarker:i,markerOptions:o,viewportRef:l}=e,c=(e,t)=>{var r;return t>=0?"".concat(null===(r=e[t])||void 0===r?void 0:r.text,". ").concat(t+1," of ").concat(e.length," is highlighted"):"".concat(e.length," suggestions available")};return{handleSuggestionClick(e,c){var u;t({type:"SET_VALUE",payload:e.text}),t({type:"HIDE_SUGGESTIONS"}),t({type:"SET_SELECTED",payload:-1}),"mobile"===c.breakpoint&&(t({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),null===(u=l.current)||void 0===u||u.focus(),V({mapProvider:n,bounds:e.bounds,point:e.point,markers:a,showMarker:i,markerOptions:o}),r.eventBus.emit("search:match",function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({query:e.text},e))},handleInputKeyDown(e,n){var{suggestions:a,selectedIndex:s}=n;switch(e.key){case"ArrowDown":if(null==a||!a.length)return;if(e.preventDefault(),s<a.length-1){var i=s+1;r.announce(c(a,i)),t({type:"SET_SELECTED",payload:i}),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!1})}break;case"ArrowUp":if(null==a||!a.length)return;e.preventDefault();var o=s>0?s-1:-1;r.announce(c(a,o)),t({type:"SET_SELECTED",payload:o}),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:o<0});break;case"Escape":e.preventDefault(),t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!0}),t({type:"HIDE_SUGGESTIONS"}),t({type:"SET_SELECTED",payload:-1})}}}};function X(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function J(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?X(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):X(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Q(e){var t,r,n,a,{dispatch:s,searchContainerRef:i}=e,o=(t=t=>z(t,e.datasets,s,e.transformRequest),r=350,n=null,a=function(){for(var e=arguments.length,a=new Array(e),s=0;s<e;s++)a[s]=arguments[s];clearTimeout(n),n=setTimeout(()=>{t(...a)},r)},a.cancel=()=>{n&&(clearTimeout(n),n=null)},a),u=(e=>{var{dispatch:t,services:r,viewportRef:n,mapProvider:a,markers:s,datasets:i,transformRequest:o,showMarker:u,markerOptions:h}=e,d="";return{handleCloseClick(e,n){t({type:"TOGGLE_EXPANDED",payload:!1}),t({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),t({type:"SET_VALUE",payload:""}),H(null==n?void 0:n.buttonRefs),s.remove("search"),r.eventBus.emit("search:clear"),r.eventBus.emit("search:close")},handleSubmit:(e,p,g)=>l(function*(){e.preventDefault();var{suggestions:l,selectedIndex:m,value:f}=g,y=null==f?void 0:f.trim();if(t({type:"SET_SELECTED",payload:-1}),t({type:"HIDE_SUGGESTIONS"}),m>=0){var b,E=l[m];return t({type:"SET_VALUE",payload:E.text}),null===(b=n.current)||void 0===b||b.focus(),V({mapProvider:a,bounds:E.bounds,point:E.point,markers:s,showMarker:u,markerOptions:h}),void r.eventBus.emit("search:match",q({query:E.text},E))}if(!((null==y?void 0:y.length)<c.minSearchLength)){var v=l;if(!l.length||y!==d){var{results:w,sanitisedValue:S}=yield z(y,i,t,o);v=w,d=S}if(v.length){var O;null===(O=n.current)||void 0===O||O.focus(),"mobile"===p.breakpoint&&(t({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close"));var N=v[0];V({mapProvider:a,bounds:N.bounds,point:N.point,markers:s,showMarker:u,markerOptions:h}),r.eventBus.emit("search:match",q({query:f},N))}}})()}})(e),h=(e=>{var{dispatch:t,debouncedFetchSuggestions:r}=e;return{handleInputClick(){t({type:"SHOW_SUGGESTIONS"})},handleInputFocus(e){t({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:"keyboard"===e})},handleInputBlur(e){t({type:"INPUT_BLUR",payload:e})},handleInputChange(e){var n=e.target.value;if(t({type:"SET_VALUE",payload:n}),n.length<c.minSearchLength)return r.cancel(),t({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),void t({type:"HIDE_SUGGESTIONS"});t({type:"SHOW_SUGGESTIONS"}),r(n)}}})(J(J({},e),{},{debouncedFetchSuggestions:o})),d=K(e);return J(J(J(J({},u),h),d),{},{handleOutside(t){i.current.contains(t.target)||(s({type:"TOGGLE_EXPANDED",payload:!1}),e.services.eventBus.emit("search:close"))}})}var ee=["marker"];function te(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}var re={reducer:{initialState:{isExpanded:!1,hasKeyboardFocusWithin:!1,value:"",suggestions:[],areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1,selectedIndex:-1},actions:d},buttons:[{id:"search",label:"Search",iconId:"search",ariaControls:e=>{var{appConfig:t}=e;return"".concat(t.id,"-search-form")},expandedWhen:e=>{var{pluginState:t}=e;return t.isExpanded},excludeWhen:e=>{var{pluginConfig:t}=e;return Boolean(t.expanded)},keepFocus:!0,onClick:(e,t)=>{var{pluginState:r,services:n}=t;r.dispatch({type:"TOGGLE_EXPANDED",payload:!0}),n.eventBus.emit("search:open")},mobile:{slot:"top-right",showLabel:!1},tablet:{slot:"top-left",showLabel:!1},desktop:{slot:"top-left",showLabel:!1}}],controls:[{id:"search",mobile:{slot:"header"},tablet:{slot:"top-left"},desktop:{slot:"top-left"},render:function(o){var{appConfig:l,iconRegistry:c,pluginState:u,pluginConfig:h,appState:d,mapState:p,services:g,mapProvider:m}=o,{id:E}=l,{interfaceType:v}=d,{expanded:w,customDatasets:S,osNamesURL:O,regions:N,maxSuggestions:T}=h,{dispatch:_,isExpanded:x,areSuggestionsVisible:D,suggestions:M}=u,R=c.close,j=c.search,G=t(null),P=t(null),k=d.layoutRefs.viewportRef,C=function(e){var{customDatasets:t=[],osNamesURL:r,crs:n,regions:a=["england","scotland","wales"],maxSuggestions:s}=e;return r?[{name:"osNames",urlTemplate:r,parseResults:(e,t)=>F(e,t,a,n,s),includeRegex:/[a-zA-Z0-9]/,excludeRegex:/^(?:[a-z]{2}\s*(?:\d{3}\s*\d{3}|\d{4}\s*\d{4}|\d{5}\s*\d{5})|\d+\s*,?\s*\d+)$/i},...t]:t}({customDatasets:S,osNamesURL:O,regions:N,maxSuggestions:T,crs:m.crs}),L=t(null);if(!L.current){var{marker:A}=h,I=i(h,ee);L.current=Q(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?te(Object(r),!0).forEach(function(t){s(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):te(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({dispatch:_,datasets:C,services:g,mapProvider:m,viewportRef:k,searchContainerRef:G,markers:p.markers,markerOptions:A},I))}var $=L.current,W=x||!!(w&&D&&M.length);return e(()=>{var e;x&&(null===(e=P.current)||void 0===e||e.focus())},[x]),r(()=>{if(d.dispatch({type:"TOGGLE_HAS_EXCLUSIVE_CONTROL",payload:x}),W)return k.current.style.pointerEvents="none",document.addEventListener("focusin",$.handleOutside),document.addEventListener("pointerdown",$.handleOutside),()=>{k.current.style.pointerEvents="auto",document.removeEventListener("focusin",$.handleOutside),document.removeEventListener("pointerdown",$.handleOutside)}},[x,v,D,M]),n("div",{className:"im-c-search".concat(w||x?"":" im-c-search--collapsed"),ref:G,children:a(f,{id:E,pluginState:u,pluginConfig:h,appState:d,inputRef:P,events:$,services:g,children:[n(y,{defaultExpanded:w,onClick:e=>$.handleCloseClick(e,d),closeIcon:R}),n(b,{defaultExpanded:w,submitIcon:j})]})})}}],icons:[{id:"search",svgContent:'<path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle>'}]},ne=Object.freeze({__proto__:null,manifest:re});export{c as D,ne as m};