@defra/interactive-map 0.0.3-alpha → 0.0.4-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/README.md +16 -57
- 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/button-definition.md +176 -0
- package/docs/api/context.md +124 -0
- package/docs/api/control-definition.md +72 -0
- package/docs/api/icon-definition.md +28 -0
- package/docs/api/map-style-config.md +76 -0
- package/docs/api/marker-config.md +51 -0
- package/docs/api/panel-definition.md +117 -0
- package/docs/api/slots.md +25 -0
- package/docs/api.md +713 -0
- package/docs/architecture.md +139 -0
- package/docs/building-a-plugin.md +149 -0
- package/docs/getting-started.md +46 -0
- package/docs/govuk-prototype.md +0 -0
- package/docs/plugins/interact.md +205 -0
- package/docs/plugins/map-styles.md +84 -0
- package/docs/plugins/plugin-context.md +67 -0
- package/docs/plugins/plugin-descriptor.md +71 -0
- package/docs/plugins/plugin-manifest.md +118 -0
- package/docs/plugins/scale-bar.md +62 -0
- package/docs/plugins/search.md +162 -0
- package/docs/plugins.md +116 -0
- package/govuk-prototype-kit.config.json +7 -7
- package/package.json +14 -1
- package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -0
- package/plugins/beta/datasets/dist/esm/index.js +2 -0
- package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +1 -0
- package/plugins/beta/datasets/dist/umd/index.js +2 -0
- package/plugins/{datasets → beta/datasets}/src/manifest.js +1 -1
- package/plugins/{datasets → beta/datasets}/src/mapLayers.js +1 -1
- package/plugins/{datasets → beta/datasets}/src/panels/Key.jsx +1 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +1 -0
- package/plugins/beta/draw-ml/dist/esm/index.js +2 -0
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +1 -0
- package/plugins/beta/draw-ml/dist/umd/index.js +2 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/api/editFeature.js +1 -1
- package/plugins/beta/draw-ml/src/api/merge.js +9 -0
- package/plugins/beta/draw-ml/src/api/newLine.js +43 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/api/newPolygon.js +5 -5
- package/plugins/beta/draw-ml/src/api/split.js +81 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/defaults.js +2 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/events.js +105 -3
- package/plugins/{draw-ml → beta/draw-ml}/src/manifest.js +17 -11
- package/plugins/{draw-ml → beta/draw-ml}/src/mapboxDraw.js +51 -2
- package/plugins/{draw-ml → beta/draw-ml}/src/mapboxSnap.js +2 -0
- package/plugins/beta/draw-ml/src/modes/createDrawMode.js +496 -0
- package/plugins/beta/draw-ml/src/modes/drawLineMode.js +18 -0
- package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +16 -0
- package/plugins/beta/draw-ml/src/modes/editVertexMode.js +792 -0
- package/plugins/{draw-ml → beta/draw-ml}/src/reducer.js +30 -2
- package/plugins/{draw-ml → beta/draw-ml}/src/styles.js +66 -36
- package/plugins/beta/draw-ml/src/undoStack.js +50 -0
- package/plugins/beta/draw-ml/src/utils/debounce.js +16 -0
- package/plugins/beta/draw-ml/src/utils/spatial.js +258 -0
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +1 -0
- package/plugins/beta/frame/dist/esm/index.js +2 -0
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +1 -0
- package/plugins/beta/frame/dist/umd/index.js +2 -0
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
- package/plugins/beta/map-styles/dist/esm/index.js +2 -0
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
- package/plugins/beta/map-styles/dist/umd/index.js +2 -0
- package/plugins/{map-styles → beta/map-styles}/src/MapStyles.jsx +1 -1
- package/plugins/{map-styles → beta/map-styles}/src/manifest.js +8 -10
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
- package/plugins/beta/scale-bar/dist/esm/index.js +2 -0
- package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -0
- package/plugins/beta/scale-bar/dist/umd/index.js +2 -0
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +1 -0
- package/plugins/beta/use-location/dist/esm/index.js +2 -0
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +1 -0
- package/plugins/beta/use-location/dist/umd/index.js +2 -0
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/interact/src/InteractInit.test.js +97 -0
- package/plugins/interact/src/api/clear.test.js +18 -0
- package/plugins/interact/src/api/disable.test.js +12 -0
- package/plugins/interact/src/api/enable.test.js +48 -0
- package/plugins/interact/src/api/selectFeature.test.js +33 -0
- package/plugins/interact/src/api/unselectFeature.test.js +33 -0
- package/plugins/interact/src/defaults.js +1 -0
- package/plugins/interact/src/events.test.js +151 -0
- package/plugins/interact/src/hooks/useHighlightSync.test.js +212 -0
- package/plugins/interact/src/hooks/useInteractionHandlers.js +14 -7
- package/plugins/interact/src/hooks/useInteractionHandlers.test.js +260 -0
- package/plugins/interact/src/index.test.js +22 -0
- package/plugins/interact/src/manifest.js +1 -1
- package/plugins/interact/src/manifest.test.js +94 -0
- package/plugins/interact/src/reducer.js +10 -1
- package/plugins/interact/src/reducer.test.js +142 -0
- package/plugins/interact/src/utils/buildStylesMap.test.js +57 -0
- package/plugins/interact/src/utils/featureQueries.test.js +56 -0
- package/plugins/interact/src/utils/turfHelpers.js +30 -0
- package/plugins/interact/src/utils/turfHelpers.test.js +30 -0
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/esm/index.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/plugins/search/src/utils/parseOsNamesResults.js +3 -7
- package/providers/{esri → beta/esri}/src/mapEvents.js +2 -2
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +2 -0
- package/providers/beta/open-names/dist/esm/index.js +2 -0
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +2 -0
- package/providers/beta/open-names/dist/umd/index.js +2 -0
- package/providers/maplibre/dist/esm/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/esm/im-maplibre-framework.js.LICENSE.txt +1 -1
- package/providers/maplibre/dist/esm/im-maplibre-legacy-framework.js +1 -1
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/esm/index.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-framework.js.LICENSE.txt +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-legacy-framework.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/index.js +14 -1
- package/providers/maplibre/src/maplibreProvider.js +127 -0
- package/sonar-project.properties +1 -1
- package/src/App/hooks/useInterfaceAPI.js +24 -1
- package/src/App/renderer/mapButtons.js +1 -1
- package/src/App/store/appActionsMap.js +22 -1
- package/src/InteractiveMap/InteractiveMap.js +114 -6
- package/src/config/defaults.js +29 -20
- package/src/config/events.js +110 -4
- package/src/index.js +5 -2
- package/src/scss/tools/_border-focus.scss +20 -4
- package/src/types.js +585 -0
- package/webpack.esm.mjs +8 -8
- package/webpack.umd.mjs +8 -8
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +0 -1
- package/plugins/datasets/dist/esm/index.js +0 -2
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +0 -1
- package/plugins/datasets/dist/umd/index.js +0 -2
- package/plugins/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
- package/plugins/draw-ml/dist/esm/index.js +0 -2
- package/plugins/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
- package/plugins/draw-ml/dist/umd/index.js +0 -2
- package/plugins/draw-ml/src/modes/drawVertexMode.js +0 -275
- package/plugins/draw-ml/src/modes/editVertexMode.js +0 -426
- package/plugins/draw-ml/src/utils.js +0 -102
- package/plugins/frame/dist/esm/im-frame-plugin.js +0 -1
- package/plugins/frame/dist/esm/index.js +0 -2
- package/plugins/frame/dist/umd/im-frame-plugin.js +0 -1
- package/plugins/frame/dist/umd/index.js +0 -2
- package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
- package/plugins/map-styles/dist/esm/index.js +0 -2
- package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
- package/plugins/map-styles/dist/umd/index.js +0 -2
- package/plugins/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
- package/plugins/scale-bar/dist/esm/index.js +0 -2
- package/plugins/scale-bar/dist/umd/im-scale-bar-plugin.js +0 -1
- package/plugins/scale-bar/dist/umd/index.js +0 -2
- package/plugins/use-location/dist/esm/im-use-location-plugin.js +0 -1
- package/plugins/use-location/dist/esm/index.js +0 -2
- package/plugins/use-location/dist/umd/im-use-location-plugin.js +0 -1
- package/plugins/use-location/dist/umd/index.js +0 -2
- package/providers/open-names/dist/esm/im-reverse-geocode.js +0 -2
- package/providers/open-names/dist/esm/index.js +0 -2
- package/providers/open-names/dist/umd/im-reverse-geocode.js +0 -2
- package/providers/open-names/dist/umd/index.js +0 -2
- /package/docs/architecture/{ARCHITECTURE_DIAGRAMS.md → architecture-diagrams.md} +0 -0
- /package/plugins/{datasets → beta/datasets}/dist/css/index.css +0 -0
- /package/plugins/{datasets → beta/datasets}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{datasets → beta/datasets}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{datasets → beta/datasets}/src/DatasetsInit.jsx +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/addDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/hideDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/hideFeatures.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/removeDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/showDataset.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/api/showFeatures.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/datasets.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/datasets.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/defaults.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/handleSetMapStyle.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/index.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Key.module.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Layers.jsx +0 -0
- /package/plugins/{datasets → beta/datasets}/src/panels/Layers.module.scss +0 -0
- /package/plugins/{datasets → beta/datasets}/src/reducer.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/bbox.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/debounce.js +0 -0
- /package/plugins/{datasets → beta/datasets}/src/utils/filters.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/DrawInit.jsx +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/addFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/deleteFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/editFeature.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/api/newPolygon.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/events.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/graphic.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/index.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/manifest.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/reducer.js +0 -0
- /package/plugins/{draw-es → beta/draw-es}/src/sketchViewModel.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/dist/css/index.css +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/DrawInit.jsx +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/api/addFeature.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/api/deleteFeature.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/draw.scss +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/index.js +0 -0
- /package/plugins/{draw-ml → beta/draw-ml}/src/modes/disabledMode.js +0 -0
- /package/plugins/{draw-ml/src → beta/draw-ml/src/utils}/snapHelpers.js +0 -0
- /package/plugins/{frame → beta/frame}/dist/css/index.css +0 -0
- /package/plugins/{frame → beta/frame}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{frame → beta/frame}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{frame → beta/frame}/package.json +0 -0
- /package/plugins/{frame → beta/frame}/src/Frame.jsx +0 -0
- /package/plugins/{frame → beta/frame}/src/FrameInit.jsx +0 -0
- /package/plugins/{frame → beta/frame}/src/api/addFrame.js +0 -0
- /package/plugins/{frame → beta/frame}/src/api/editFeature.js +0 -0
- /package/plugins/{frame → beta/frame}/src/config.js +0 -0
- /package/plugins/{frame → beta/frame}/src/frame.scss +0 -0
- /package/plugins/{frame → beta/frame}/src/index.js +0 -0
- /package/plugins/{frame → beta/frame}/src/manifest.js +0 -0
- /package/plugins/{frame → beta/frame}/src/reducer.js +0 -0
- /package/plugins/{frame → beta/frame}/src/utils.js +0 -0
- /package/plugins/{map-styles → beta/map-styles}/dist/css/index.css +0 -0
- /package/plugins/{map-styles → beta/map-styles}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{map-styles → beta/map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/MapStylesInit.jsx +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/config.js +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/index.js +0 -0
- /package/plugins/{map-styles → beta/map-styles}/src/mapStyles.scss +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/dist/css/index.css +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/package.json +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.jsx +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/ScaleBar.test.jsx +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/index.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/index.test.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/manifest.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/scaleBar.scss +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/utils.js +0 -0
- /package/plugins/{scale-bar → beta/scale-bar}/src/utils.test.js +0 -0
- /package/plugins/{use-location → beta/use-location}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/plugins/{use-location → beta/use-location}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{use-location → beta/use-location}/src/UseLocation.jsx +0 -0
- /package/plugins/{use-location → beta/use-location}/src/UseLocationInit.jsx +0 -0
- /package/plugins/{use-location → beta/use-location}/src/defaults.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/events.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/index.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/manifest.js +0 -0
- /package/plugins/{use-location → beta/use-location}/src/reducer.js +0 -0
- /package/providers/{esri → beta/esri}/src/appEvents.js +0 -0
- /package/providers/{esri → beta/esri}/src/defaults.js +0 -0
- /package/providers/{esri → beta/esri}/src/esriProvider.js +0 -0
- /package/providers/{esri → beta/esri}/src/esriProvider.scss +0 -0
- /package/providers/{esri → beta/esri}/src/index.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/coords.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/detectWebGL.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/esriFixes.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/query.js +0 -0
- /package/providers/{esri → beta/esri}/src/utils/spatial.js +0 -0
- /package/providers/{open-names → beta/open-names}/dist/esm/im-reverse-geocode.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/dist/esm/index.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/dist/umd/im-reverse-geocode.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/providers/{open-names → beta/open-names}/src/index.js +0 -0
- /package/providers/{open-names → beta/open-names}/src/reverseGeocode.js +0 -0
- /package/providers/{open-names → beta/open-names}/src/utils/mapToLocationModel.js +0 -0
package/dist/umd/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.InteractiveMap=t())}(this,()=>(()=>{"use strict";var e,t,n,r,o={12:(e,t,n)=>{n.d(t,{q:()=>r});var r={APP_ADD_MARKER:"app:addmarker",APP_REMOVE_MARKER:"app:removemarker",APP_SET_MODE:"app:setmode",APP_REVERT_MODE:"app:revertmode",APP_ADD_BUTTON:"app:addbutton",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_READY:"app:ready",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_EXIT:"map:exit",MAP_DESTROY:"map:destroy"}},43:(e,t,n)=>{n.d(t,{A:()=>r});const r={mapViewParamKey:"mv",behaviour:"buttonFirst",backgroundColor:"var(--background-color)",maxMobileWidth:640,minDesktopWidth:835,hybridWidth:null,containerHeight:"600px",mapSize:"small",appColorScheme:"light",autoColorScheme:!1,mapLabel:"Interactive map",buttonText:"Map view",buttonClass:"im-c-open-map-button",deviceNotSupportedText:"Your device is not supported. A map is available with a more up-to-date browser or device.",genericErrorText:"There was a problem loading the map. Please try again later.",keyboardHintText:'<span class="im-u-visually-hidden">Press </span><kbd>Alt</kbd> + <kbd>K</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',pageTitle:"Map view",zoomDelta:1,nudgeZoomDelta:.1,panDelta:100,nudgePanDelta:5,mapProvider:null,reverseGeocode:null,markerShape:"pin",markerColor:"#ff0000",enableFullscreen:!1,enableZoomControls:!1,readMapText:!0}},201:(e,t,n)=>{n.d(t,{g:()=>o,w:()=>r});var r=function(e){var t=e.behaviour,n=e.hybridWidth,r=e.maxMobileWidth;if("hybrid"!==t)return!1;var o=null!=n?n:r;return window.matchMedia("(max-width: ".concat(o,"px)")).matches},o=function(e){var t=e.behaviour;return["mapOnly","buttonFirst"].includes(t)||r(e)}},205:(e,t,n)=>{n.d(t,{N:()=>u,i:()=>c});var r=n(637),o=n(901),i=n(201),a=n(43);function u(e){var t=e.config,n=e.rootEl,u=t.pageTitle,c=t.behaviour,l=t.containerHeight,s=function(e){var t=e.id,n=e.behaviour,o=(0,r.q)(a.A.mapViewParamKey)===t;return"mapOnly"===n||o&&("buttonFirst"===n||(0,i.w)(e))}(t);["mapOnly","buttonFirst","hybrid"].includes(c)&&((0,o.U)({containerEl:n,isFullscreen:s}),document.documentElement.classList.toggle("im-is-fullscreen",s),n.classList.toggle("im-is-fullscreen",s)),["buttonFirst","hybrid"].includes(c)&&function(e){var t=e.pageTitle,n=e.isFullscreen,r=document.title.split(": "),o=r[r.length-1];document.title=n?"".concat(t,": ").concat(o):o}({pageTitle:u,isFullscreen:s});var f=s||"buttonFirst"!==c&&!(0,i.w)(t)?l:"auto";n.style.height=s?"100%":f}function c(){document.body.classList.remove("im-is-loading")}},233:(e,t,n)=>{function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof l?r:l,s=Object.create(u.prototype);return o(s,"_invoke",function(n,r,o){var i,a,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,a=0,u=e,p.n=n,c}};function d(n,r){for(a=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,v=i[2];n>3?(o=v===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(a=0,p.v=r,p.n=i[1]):d<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,p.n=v,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,s,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,v),a=s,u=v;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,u)):p.n=u:p.v=u);try{if(l=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==c)break}catch(t){i=e,a=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,i,a),!0),s}var c={};function l(){}function s(){}function f(){}t=Object.getPrototypeOf;var p=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),d=f.prototype=l.prototype=Object.create(p);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return s.prototype=f,o(d,"constructor",f),o(f,"constructor",s),s.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(d),o(d,a,"Generator"),o(d,i,function(){return this}),o(d,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:v}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){if(t)i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}a("next",0),a("throw",1),a("return",2)}},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}n.d(t,{H:()=>u,R:()=>c});var a=null;function u(e,t){var n=e.url,o=e.transformRequest,u=e.load;a=function(){var e,a=(e=r().m(function e(i,a){var c;return r().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,u();case 1:return c=e.v,e.a(2,c(n,o,t,i,a))}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})});return function(e,t){return a.apply(this,arguments)}}()}function c(e,t){if(!a)throw new Error("ReverseGeocode not initialised");return a(e,t)}},540:(e,t,n)=>{e.exports=n(869)},637:(e,t,n)=>{n.d(t,{q:()=>r});var r=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=globalThis.location)||void 0===t?void 0:t.search;return new URLSearchParams(n).get(e)}},698:(e,t)=>{var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return t=r.ref,{$$typeof:n,type:e,key:o,ref:void 0!==t?t:null,props:r}}t.Fragment=r,t.jsx=o,t.jsxs=o},848:(e,t,n)=>{e.exports=n(698)},869:(e,t)=>{var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),v=Symbol.iterator,y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,m={};function b(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||y}function g(){}function _(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||y}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},g.prototype=b.prototype;var w=_.prototype=new g;w.constructor=_,h(w,b.prototype),w.isPureReactComponent=!0;var E=Array.isArray;function P(){}var S={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function O(e,t,r){var o=r.ref;return{$$typeof:n,type:e,key:t,ref:void 0!==o?o:null,props:r}}function k(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var j=/\/+/g;function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function C(e,t,o,i,a){var u=typeof e;"undefined"!==u&&"boolean"!==u||(e=null);var c,l,s=!1;if(null===e)s=!0;else switch(u){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case n:case r:s=!0;break;case p:return C((s=e._init)(e._payload),t,o,i,a)}}if(s)return a=a(e),s=""===i?"."+T(e,0):i,E(a)?(o="",null!=s&&(o=s.replace(j,"$&/")+"/"),C(a,t,o,"",function(e){return e})):null!=a&&(k(a)&&(c=a,l=o+(null==a.key||e&&e.key===a.key?"":(""+a.key).replace(j,"$&/")+"/")+s,a=O(c.type,l,c.props)),t.push(a)),1;s=0;var f,d=""===i?".":i+":";if(E(e))for(var y=0;y<e.length;y++)s+=C(i=e[y],t,o,u=d+T(i,y),a);else if("function"==typeof(y=null===(f=e)||"object"!=typeof f?null:"function"==typeof(f=v&&f[v]||f["@@iterator"])?f:null))for(e=y.call(e),y=0;!(i=e.next()).done;)s+=C(i=i.value,t,o,u=d+T(i,y++),a);else if("object"===u){if("function"==typeof e.then)return C(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(P,P):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,o,i,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function M(e,t,n){if(null==e)return e;var r=[],o=0;return C(e,r,"","",function(e){return t.call(n,e,o++)}),r}function D(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var x="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},R={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};t.Activity=d,t.Children=R,t.Component=b,t.Fragment=o,t.Profiler=a,t.PureComponent=_,t.StrictMode=i,t.Suspense=s,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},t.cache=function(e){return function(){return e.apply(null,arguments)}},t.cacheSignal=function(){return null},t.cloneElement=function(e,t,n){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var r=h({},e.props),o=e.key;if(null!=t)for(i in void 0!==t.key&&(o=""+t.key),t)!A.call(t,i)||"key"===i||"__self"===i||"__source"===i||"ref"===i&&void 0===t.ref||(r[i]=t[i]);var i=arguments.length-2;if(1===i)r.children=n;else if(1<i){for(var a=Array(i),u=0;u<i;u++)a[u]=arguments[u+2];r.children=a}return O(e.type,o,r)},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:u,_context:e},e},t.createElement=function(e,t,n){var r,o={},i=null;if(null!=t)for(r in void 0!==t.key&&(i=""+t.key),t)A.call(t,r)&&"key"!==r&&"__self"!==r&&"__source"!==r&&(o[r]=t[r]);var a=arguments.length-2;if(1===a)o.children=n;else if(1<a){for(var u=Array(a),c=0;c<a;c++)u[c]=arguments[c+2];o.children=u}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===o[r]&&(o[r]=a[r]);return O(e,i,o)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=k,t.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:D}},t.memo=function(e,t){return{$$typeof:f,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=S.T,n={};S.T=n;try{var r=e(),o=S.S;null!==o&&o(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(P,x)}catch(e){x(e)}finally{null!==t&&null!==n.types&&(t.types=n.types),S.T=t}},t.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},t.use=function(e){return S.H.use(e)},t.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},t.useCallback=function(e,t){return S.H.useCallback(e,t)},t.useContext=function(e){return S.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return S.H.useEffect(e,t)},t.useEffectEvent=function(e){return S.H.useEffectEvent(e)},t.useId=function(){return S.H.useId()},t.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return S.H.useMemo(e,t)},t.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},t.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},t.useRef=function(e){return S.H.useRef(e)},t.useState=function(e){return S.H.useState(e)},t.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},t.useTransition=function(){return S.H.useTransition()},t.version="19.2.0"},901:(e,t,n)=>{function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e){var t,n=e.containerEl,o=e.isFullscreen,i=e.boundaryEl,a=void 0===i?document.body:i,u=Array.from(a.querySelectorAll("[data-fm-inert]"));if(n&&(u=u.filter(function(e){return!n.contains(e)})),u.forEach(function(e){e.removeAttribute("aria-hidden"),e.removeAttribute("data-fm-inert")}),o){null===(t=document.activeElement)||void 0===t||t.blur();for(var c=n;null!==(l=c)&&void 0!==l&&l.parentNode&&c!==a&&c!==document.body;){var l,s,f=c.parentNode,p=r(f.children);try{for(p.s();!(s=p.n()).done;){var d=s.value;d===c||n&&n.contains(d)||!d.matches(":not([aria-hidden]):not([data-fm-inert])")||!a.contains(d)||(d.setAttribute("aria-hidden","true"),d.setAttribute("data-fm-inert",""))}}catch(e){p.e(e)}finally{p.f()}c=f}}}n.d(t,{U:()=>i})},902:(e,t,n)=>{n.d(t,{C1:()=>a,Ey:()=>c,ip:()=>u});var r=window.matchMedia("(pointer: coarse)").matches?"touch":"unknown",o=new Set;function i(e){r!==e&&(r=e,o.forEach(function(t){t(e)}))}function a(){var e=window.matchMedia("(pointer: coarse)"),t=function(e){i(e.matches?"touch":"mouse")};e.addEventListener("change",t);var n=function(e){var t,n="pen"===(t=e.pointerType)||"touch"===t?"touch":"mouse"===t?"mouse":"unknown";setTimeout(function(){return i(n)},150)},r=function(e){"Tab"===e.key&&i("keyboard")};return globalThis.addEventListener("pointerdown",n,{passive:!0}),globalThis.addEventListener("keydown",r,{passive:!0}),function(){e.removeEventListener("change",t),globalThis.removeEventListener("pointerdown",n),globalThis.removeEventListener("keydown",r)}}function u(){return"unknown"===r?"mouse":r}function c(e){return o.add(e),function(){o.delete(e)}}}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return o[e](n,n.exports,a),n.exports}a.m=o,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);a.r(o);var i={};e=e||[null,t({}),t([]),t(t)];for(var u=2&r&&n;("object"==typeof u||"function"==typeof u)&&!~e.indexOf(u);u=t(u))Object.getOwnPropertyNames(u).forEach(e=>i[e]=()=>n[e]);return i.default=()=>n,a.d(o,i),o},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>"im-core.js",a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},r="defra.InteractiveMap:",a.l=(e,t,o,i)=>{if(n[e])n[e].push(t);else{var u,c;if(void 0!==o)for(var l=document.getElementsByTagName("script"),s=0;s<l.length;s++){var f=l[s];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==r+o){u=f;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,a.nc&&u.setAttribute("nonce",a.nc),u.setAttribute("data-webpack",r+o),u.src=e),n[e]=[t];var p=(t,r)=>{u.onerror=u.onload=null,clearTimeout(d);var o=n[e];if(delete n[e],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=p.bind(null,u.onerror),u.onload=p.bind(null,u.onload),c&&document.head.appendChild(u)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={57:0};a.f.j=(t,n)=>{var r=a.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=e[t]=[n,o]);n.push(r[2]=o);var i=a.p+a.u(t),u=new Error;a.l(i,n=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;u.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,r[1](u)}},"chunk-"+t,t)}};var t=(t,n)=>{var r,o,[i,u,c]=n,l=0;if(i.some(t=>0!==e[t])){for(r in u)a.o(u,r)&&(a.m[r]=u[r]);c&&c(a)}for(t&&t(n);l<i.length;l++)o=i[l],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0},n=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};a.d(u,{default:()=>Y});var c=a(540),l=a(848),s=a.t(l,2),f=a(637),p=a(201),d=a(43);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(){var e,t=(0,f.q)(d.A.mapViewParamKey),n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(h.values());try{for(n.s();!(e=n.n()).done;){var r,o,i=e.value,a=i.id===t,u="hybrid"===i.config.behaviour&&!(0,p.w)(i.config),c=null===(r=i.rootEl)||void 0===r?void 0:r.children.length;if(a&&!c)null===(o=i.loadApp)||void 0===o||o.call(i);else if(!a&&c&&!u){var l,s,y;null===(l=i.removeApp)||void 0===l||l.call(i),null===(s=i.openButton)||void 0===s||null===(y=s.focus)||void 0===y||y.call(s)}}}catch(e){n.e(e)}finally{n.f()}}var h=new Map,m=!1;const b=function(e){m||(window.addEventListener("popstate",y),m=!0),h.set(e.id,e)},g=function(e){h.delete(e.id)};function _(e){return _="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},_(e)}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e,t,n){return(t=function(e){var t=function(e){if("object"!=_(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){try{return JSON.parse(e)}catch(e){return console.log(e),null}}function S(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var A=a(205);function O(e){var t=e.id,n=e.behaviour,r=(0,f.q)(d.A.mapViewParamKey)===t;return["mapOnly","inline"].includes(n)||"hybrid"===n&&!(0,p.w)(e)||r}function k(e){return k="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},k(e)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){C(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C(e,t,n){return(t=function(e){var t=function(e){if("object"!=k(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==k(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=a(902),D=a(233),x=a(12);function R(e){return R="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},R(e)}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,N(r.key),r)}}function N(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}var B=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={}},t=[{key:"on",value:function(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),this}},{key:"off",value:function(e,t){return this.events[e]?(this.events[e]=t?this.events[e].filter(function(e){return e!==t}):[],this):this}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return this.events[e]?(this.events[e].forEach(function(t){try{t.apply(void 0,n)}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}}),this):this}},{key:"destroy",value:function(){this.events={}}}],t&&L(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function H(e){return H="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},H(e)}function I(){var e,t,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,l=Object.create(c.prototype);return F(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,u=0,c=e,p.n=n,a}};function d(n,r){for(u=n,c=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,v=i[2];n>3?(o=v===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(u=0,p.v=r,p.n=i[1]):d<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,p.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,v),u=s,c=v;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),d(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(t){i=e,u=1,c=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(F(t={},r,function(){return this}),t),f=l.prototype=u.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,F(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=l,F(f,"constructor",l),F(l,"constructor",c),c.displayName="GeneratorFunction",F(l,o,"GeneratorFunction"),F(f),F(f,o,"Generator"),F(f,r,function(){return this}),F(f,"toString",function(){return"[object Generator]"}),(I=function(){return{w:i,m:p}})()}function F(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}F=function(e,t,n,r){if(t)o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n;else{function i(t,n){F(e,t,function(e){return this._invoke(t,n,e)})}i("next",0),i("throw",1),i("return",2)}},F(e,t,n,r)}function $(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach(function(t){U(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,W(r.key),r)}}function U(e,t,n){return(t=W(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e){var t=function(e){if("object"!=H(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==H(t)?t:t+""}new B;const z=function(){return e=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),U(this,"_openButton",null),U(this,"_root",null),U(this,"_breakpointDetector",null),U(this,"_interfaceDetectorCleanup",null),U(this,"_hybridBehaviourCleanup",null),this.id=t,this.rootEl=document.getElementById(t),!this.rootEl)throw new Error('Element with id "'.concat(t,'" not found'));this.eventBus=new B,this.config=this._buildConfig(n),function(e,t){var n=t.mapProvider,r=t.deviceNotSupportedText,o=null==n?void 0:n.checkDeviceCapabilities();if(n)return!(null==o||!o.isSupported)||(S(e,r),(0,A.i)(),console.log(null==o?void 0:o.error),!1);console.log("No map provider")}(this.rootEl,this.config)&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&b(this),this._breakpointDetector=function(e){var t=e.maxMobileWidth,n=e.minDesktopWidth,r=e.containerEl,o="unknown",i=new Set,a=null,u=function(e){return e<=t?"mobile":e>=n?"desktop":"tablet"},c=function(e){e!==o&&(o=e,requestAnimationFrame(function(){o===e&&i.forEach(function(t){return t(e)})}))};if(r){r.style.containerType="inline-size";var l=r.getBoundingClientRect().width,s=u(l);r.setAttribute("data-breakpoint",s),o=s;var f=new ResizeObserver(function(e){var t,n,o=(null===(t=e[0])||void 0===t||null===(t=t.borderBoxSize)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.inlineSize)||(null===(n=e[0])||void 0===n?void 0:n.contentRect.width),i=u(o);r.setAttribute("data-breakpoint",i),c(i)});f.observe(r),c(s),a=function(){f.disconnect(),r.style.containerType="",r.removeAttribute("data-breakpoint")}}else{var p={mobile:window.matchMedia("(max-width: ".concat(t,"px)")),desktop:window.matchMedia("(min-width: ".concat(n,"px)"))},d=function(){var e;e=p.mobile.matches?"mobile":p.desktop.matches?"desktop":"tablet",c(e)};p.mobile.addEventListener("change",d),p.desktop.addEventListener("change",d),d(),a=function(){p.mobile.removeEventListener("change",d),p.desktop.removeEventListener("change",d)}}return{subscribe:function(e){return i.add(e),function(){return i.delete(e)}},getBreakpoint:function(){return"unknown"===o?"desktop":o},destroy:function(){var e;null===(e=a)||void 0===e||e(),i.clear()}}}({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=(0,M.C1)(),this._initialize())},t=[{key:"_buildConfig",value:function(e){var t=function(e){for(var t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},null==e?void 0:e.dataset),n={},r=0,o=Object.keys(t);r<o.length;r++){var i=o[r];n[i]=P(t[i])}return n}(this.rootEl);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return T(T({},d.A),e)}(V(V({id:this.id,title:document.title},t),e))}},{key:"_initialize",value:function(){var e=this;["buttonFirst","hybrid"].includes(this.config.behaviour)&&(this._openButton=function(t,n){var r=t.id,o=t.buttonText,i=t.buttonClass,a='\n <a class="'.concat(i,"\" role=\"button\">\n <svg focusable='false' aria-hidden='true' width='16' height='20' viewBox='0 0 16 20' fillRule='evenodd'>\n <path d='M15 7.5c.009 3.778-4.229 9.665-7.5 12.5C4.229 17.165-.009 11.278 0 7.5a7.5 7.5 0 1 1 15 0z'/>\n <path d='M7.5 12.961a5.46 5.46 0 1 0 0-10.922 5.46 5.46 0 1 0 0 10.922z' fill='#fff'/>\n </svg>\n <span>").concat(o,"</span>\n <span class='im-u-visually-hidden'> (Visual only)</span>\n </a>\n ");n.insertAdjacentHTML("beforebegin",a);var u=n.previousElementSibling,c=new URL(window.location.href);return c.searchParams.set(d.A.mapViewParamKey,r),u.setAttribute("href",c.toString()),u.addEventListener("click",function(t){t.preventDefault(),function(t){e._handleButtonClick(t)}(t)}),u}(this.config,this.rootEl)),this._hybridBehaviourCleanup=function(e){var t=e.config,n=t.behaviour,r=t.hybridWidth,o=t.maxMobileWidth;if("buttonFirst"===n&&e._breakpointDetector.subscribe(function(){O(e.config)?e.loadApp():e.removeApp()}),"hybrid"===n){var i=null!=r?r:o,a=window.matchMedia("(max-width: ".concat(i,"px)")),u=function(){O(e.config)?e.loadApp():e.removeApp()};return a.addEventListener("change",u),function(){return a.removeEventListener("change",u)}}return null}(this),O(this.config)?this.loadApp():(0,A.i)()}},{key:"_handleButtonClick",value:function(e){this.loadApp(),history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href"))}},{key:"_handleExitClick",value:function(){this.removeApp();var e=this.config.mapViewParamKey,t=location.href.replace(new RegExp("[?&]".concat(e,"=[^&]*(&|$)")),function(e,t){return"&"===t?"?":""}).replace(/\?$/,"");history.replaceState(history.state,"",t)}},{key:"loadApp",value:(n=I().m(function e(){var t,n,r,o,i,u,c,l,s,f=this;return I().w(function(e){for(;;)switch(e.p=e.n){case 0:return this._openButton&&(this._openButton.style.display="none"),e.p=1,e.n=2,a.e(935).then(a.bind(a,663));case 2:return t=e.v,n=t.initialiseApp,e.n=3,this.config.mapProvider.load();case 3:return r=e.v,o=r.MapProvider,i=r.mapFramework,u=r.mapProviderConfig,this.config.reverseGeocodeProvider&&(0,D.H)(this.config.reverseGeocodeProvider,u.crs),e.n=4,n(this.rootEl,V(V({id:this.id,initialBreakpoint:this._breakpointDetector.getBreakpoint(),initialInterfaceType:(0,M.ip)()},this.config),{},{MapProvider:o,mapProviderConfig:u,mapFramework:i,eventBus:this.eventBus,breakpointDetector:this._breakpointDetector,handleExitClick:this._handleExitClick.bind(this)}));case 4:c=e.v,this._root=c._root,delete c._root,l=["on","off","emit"],Object.keys(c).forEach(function(e){l.includes(e)||(f[e]=c[e])}),(0,A.N)(this),e.n=6;break;case 5:throw e.p=5,s=e.v,S(this.rootEl,this.config.genericErrorText),console.error(s),s;case 6:return e.a(2)}},e,this,[[1,5]])}),r=function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){$(i,r,o,a,u,"next",e)}function u(e){$(i,r,o,a,u,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})},{key:"removeApp",value:function(){this._root&&"function"==typeof this.unmount&&(this.unmount(),this._root=null),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),(0,A.N)(this),this.eventBus.emit(x.q.MAP_DESTROY,{mapId:this.id})}},{key:"destroy",value:function(){var e,t,n;this.removeApp(),null===(e=this._breakpointDetector)||void 0===e||e.destroy(),null===(t=this._interfaceDetectorCleanup)||void 0===t||t.call(this),null===(n=this._hybridBehaviourCleanup)||void 0===n||n.call(this),g(this),this.eventBus.destroy()}},{key:"on",value:function(){var e;(e=this.eventBus).on.apply(e,arguments)}},{key:"off",value:function(){var e;(e=this.eventBus).off.apply(e,arguments)}},{key:"emit",value:function(){var e;(e=this.eventBus).emit.apply(e,arguments)}},{key:"addMarker",value:function(e,t,n){this.eventBus.emit(x.q.APP_ADD_MARKER,{id:e,coords:t,options:n})}},{key:"removeMarker",value:function(e){this.eventBus.emit(x.q.APP_REMOVE_MARKER,e)}},{key:"setMode",value:function(e){this.eventBus.emit(x.q.APP_SET_MODE,e)}},{key:"addButton",value:function(e,t){this.eventBus.emit(x.q.APP_ADD_BUTTON,{id:e,config:t})}},{key:"addPanel",value:function(e,t){this.eventBus.emit(x.q.APP_ADD_PANEL,{id:e,config:t})}},{key:"removePanel",value:function(e){this.eventBus.emit(x.q.APP_REMOVE_PANEL,e)}},{key:"showPanel",value:function(e){this.eventBus.emit(x.q.APP_SHOW_PANEL,e)}},{key:"hidePanel",value:function(e){this.eventBus.emit(x.q.APP_HIDE_PANEL,e)}},{key:"addControl",value:function(e,t){this.eventBus.emit(x.q.APP_ADD_CONTROL,{id:e,config:t})}}],t&&G(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r}();var K="undefined"!=typeof window?window:globalThis;K.defra=K.defra||{},K.preactCompat=c,K.preactJsxRuntime=s,K.preactHooks={useState:c.useState},K.defra.InteractiveMap=z,K.preactCompat.default||(K.preactCompat.default=K.preactCompat),K.preactCompat.createRoot||(K.preactCompat.createRoot=function(e){return{render:function(t){K.preactCompat.render(t,e)},unmount:function(){K.preactCompat.render(null,e)}}});const Y=z;return u.default})());
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("defra",[],t):"object"==typeof exports?exports.defra=t():(e.defra=e.defra||{},e.defra.InteractiveMap=t())}(this,()=>(()=>{"use strict";var e,t,n,r,o={698(e,t){var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function o(e,t,r){var o=null;if(void 0!==r&&(o=""+r),void 0!==t.key&&(o=""+t.key),"key"in t)for(var i in r={},t)"key"!==i&&(r[i]=t[i]);else r=t;return t=r.ref,{$$typeof:n,type:e,key:o,ref:void 0!==t?t:null,props:r}}t.Fragment=r,t.jsx=o,t.jsxs=o},869(e,t){var n=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),s=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),v=Symbol.iterator,y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,m={};function b(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||y}function g(){}function _(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||y}b.prototype.isReactComponent={},b.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},b.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},g.prototype=b.prototype;var w=_.prototype=new g;w.constructor=_,h(w,b.prototype),w.isPureReactComponent=!0;var E=Array.isArray;function P(){}var S={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function O(e,t,r){var o=r.ref;return{$$typeof:n,type:e,key:t,ref:void 0!==o?o:null,props:r}}function k(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var j=/\/+/g;function T(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(n=""+e.key,r={"=":"=0",":":"=2"},"$"+n.replace(/[=:]/g,function(e){return r[e]})):t.toString(36);var n,r}function C(e,t,o,i,a){var u=typeof e;"undefined"!==u&&"boolean"!==u||(e=null);var c,l,s=!1;if(null===e)s=!0;else switch(u){case"bigint":case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case n:case r:s=!0;break;case p:return C((s=e._init)(e._payload),t,o,i,a)}}if(s)return a=a(e),s=""===i?"."+T(e,0):i,E(a)?(o="",null!=s&&(o=s.replace(j,"$&/")+"/"),C(a,t,o,"",function(e){return e})):null!=a&&(k(a)&&(c=a,l=o+(null==a.key||e&&e.key===a.key?"":(""+a.key).replace(j,"$&/")+"/")+s,a=O(c.type,l,c.props)),t.push(a)),1;s=0;var f,d=""===i?".":i+":";if(E(e))for(var y=0;y<e.length;y++)s+=C(i=e[y],t,o,u=d+T(i,y),a);else if("function"==typeof(y=null===(f=e)||"object"!=typeof f?null:"function"==typeof(f=v&&f[v]||f["@@iterator"])?f:null))for(e=y.call(e),y=0;!(i=e.next()).done;)s+=C(i=i.value,t,o,u=d+T(i,y++),a);else if("object"===u){if("function"==typeof e.then)return C(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(P,P):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,o,i,a);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return s}function M(e,t,n){if(null==e)return e;var r=[],o=0;return C(e,r,"","",function(e){return t.call(n,e,o++)}),r}function D(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var x="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},R={map:M,forEach:function(e,t,n){M(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return M(e,function(){t++}),t},toArray:function(e){return M(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};t.Activity=d,t.Children=R,t.Component=b,t.Fragment=o,t.Profiler=a,t.PureComponent=_,t.StrictMode=i,t.Suspense=s,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=S,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return S.H.useMemoCache(e)}},t.cache=function(e){return function(){return e.apply(null,arguments)}},t.cacheSignal=function(){return null},t.cloneElement=function(e,t,n){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var r=h({},e.props),o=e.key;if(null!=t)for(i in void 0!==t.key&&(o=""+t.key),t)!A.call(t,i)||"key"===i||"__self"===i||"__source"===i||"ref"===i&&void 0===t.ref||(r[i]=t[i]);var i=arguments.length-2;if(1===i)r.children=n;else if(1<i){for(var a=Array(i),u=0;u<i;u++)a[u]=arguments[u+2];r.children=a}return O(e.type,o,r)},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:u,_context:e},e},t.createElement=function(e,t,n){var r,o={},i=null;if(null!=t)for(r in void 0!==t.key&&(i=""+t.key),t)A.call(t,r)&&"key"!==r&&"__self"!==r&&"__source"!==r&&(o[r]=t[r]);var a=arguments.length-2;if(1===a)o.children=n;else if(1<a){for(var u=Array(a),c=0;c<a;c++)u[c]=arguments[c+2];o.children=u}if(e&&e.defaultProps)for(r in a=e.defaultProps)void 0===o[r]&&(o[r]=a[r]);return O(e,i,o)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=k,t.lazy=function(e){return{$$typeof:p,_payload:{_status:-1,_result:e},_init:D}},t.memo=function(e,t){return{$$typeof:f,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=S.T,n={};S.T=n;try{var r=e(),o=S.S;null!==o&&o(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(P,x)}catch(e){x(e)}finally{null!==t&&null!==n.types&&(t.types=n.types),S.T=t}},t.unstable_useCacheRefresh=function(){return S.H.useCacheRefresh()},t.use=function(e){return S.H.use(e)},t.useActionState=function(e,t,n){return S.H.useActionState(e,t,n)},t.useCallback=function(e,t){return S.H.useCallback(e,t)},t.useContext=function(e){return S.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return S.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return S.H.useEffect(e,t)},t.useEffectEvent=function(e){return S.H.useEffectEvent(e)},t.useId=function(){return S.H.useId()},t.useImperativeHandle=function(e,t,n){return S.H.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return S.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return S.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return S.H.useMemo(e,t)},t.useOptimistic=function(e,t){return S.H.useOptimistic(e,t)},t.useReducer=function(e,t,n){return S.H.useReducer(e,t,n)},t.useRef=function(e){return S.H.useRef(e)},t.useState=function(e){return S.H.useState(e)},t.useSyncExternalStore=function(e,t,n){return S.H.useSyncExternalStore(e,t,n)},t.useTransition=function(){return S.H.useTransition()},t.version="19.2.4"},540(e,t,n){e.exports=n(869)},848(e,t,n){e.exports=n(698)},205(e,t,n){n.d(t,{N:()=>u,i:()=>c});var r=n(637),o=n(901),i=n(201),a=n(43);function u(e){var t=e.config,n=e.rootEl,u=t.pageTitle,c=t.behaviour,l=t.containerHeight,s=function(e){var t=e.id,n=e.behaviour,o=(0,r.q)(a.A.mapViewParamKey)===t;return"mapOnly"===n||o&&("buttonFirst"===n||(0,i.w)(e))}(t);["mapOnly","buttonFirst","hybrid"].includes(c)&&((0,o.U)({containerEl:n,isFullscreen:s}),document.documentElement.classList.toggle("im-is-fullscreen",s),n.classList.toggle("im-is-fullscreen",s)),["buttonFirst","hybrid"].includes(c)&&function(e){var t=e.pageTitle,n=e.isFullscreen,r=document.title.split(": "),o=r[r.length-1];document.title=n?"".concat(t,": ").concat(o):o}({pageTitle:u,isFullscreen:s});var f=s||"buttonFirst"!==c&&!(0,i.w)(t)?l:"auto";n.style.height=s?"100%":f}function c(){document.body.classList.remove("im-is-loading")}},43(e,t,n){n.d(t,{A:()=>r});const r={appColorScheme:"light",autoColorScheme:!1,backgroundColor:"var(--background-color)",behaviour:"buttonFirst",buttonClass:"im-c-open-map-button",buttonText:"Map view",containerHeight:"600px",deviceNotSupportedText:"Your device is not supported. A map is available with a more up-to-date browser or device.",enableFullscreen:!1,enableZoomControls:!1,genericErrorText:"There was a problem loading the map. Please try again later.",hasExitButton:!1,hybridWidth:null,keyboardHintText:'<span class="im-u-visually-hidden">Press </span><kbd>Alt</kbd> + <kbd>K</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',mapLabel:"Interactive map",mapProvider:null,mapSize:"small",mapViewParamKey:"mv",maxMobileWidth:640,minDesktopWidth:835,markerColor:"#ff0000",markerShape:"pin",nudgePanDelta:5,nudgeZoomDelta:.1,panDelta:100,pageTitle:"Map view",readMapText:!1,reverseGeocodeProvider:null,zoomDelta:1}},12(e,t,n){n.d(t,{q:()=>r});var r={APP_ADD_MARKER:"app:addmarker",APP_REMOVE_MARKER:"app:removemarker",APP_SET_MODE:"app:setmode",APP_REVERT_MODE:"app:revertmode",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_READY:"app:ready",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_EXIT:"map:exit",MAP_DESTROY:"map:destroy"}},233(e,t,n){function r(){var e,t,n="function"==typeof Symbol?Symbol:{},i=n.iterator||"@@iterator",a=n.toStringTag||"@@toStringTag";function u(n,r,i,a){var u=r&&r.prototype instanceof l?r:l,s=Object.create(u.prototype);return o(s,"_invoke",function(n,r,o){var i,a,u,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,a=0,u=e,p.n=n,c}};function d(n,r){for(a=n,u=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,v=i[2];n>3?(o=v===r)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(a=0,p.v=r,p.n=i[1]):d<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,p.n=v,a=0))}if(o||n>1)return c;throw f=!0,r}return function(o,s,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,v),a=s,u=v;(t=a<2?e:u)||!f;){i||(a?a<3?(a>1&&(p.n=-1),d(a,u)):p.n=u:p.v=u);try{if(l=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=p.n<0)?u:n.call(r,p))!==c)break}catch(t){i=e,a=1,u=t}finally{l=1}}return{value:t,done:f}}}(n,i,a),!0),s}var c={};function l(){}function s(){}function f(){}t=Object.getPrototypeOf;var p=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),d=f.prototype=l.prototype=Object.create(p);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,o(e,a,"GeneratorFunction")),e.prototype=Object.create(d),e}return s.prototype=f,o(d,"constructor",f),o(f,"constructor",s),s.displayName="GeneratorFunction",o(f,a,"GeneratorFunction"),o(d),o(d,a,"Generator"),o(d,i,function(){return this}),o(d,"toString",function(){return"[object Generator]"}),(r=function(){return{w:u,m:v}})()}function o(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,n,r){function a(t,n){o(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},o(e,t,n,r)}function i(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}n.d(t,{H:()=>u,R:()=>c});var a=null;function u(e,t){var n=e.url,o=e.transformRequest,u=e.load;a=function(){var e,a=(e=r().m(function e(i,a){var c;return r().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,u();case 1:return c=e.v,e.a(2,c(n,o,t,i,a))}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function u(e){i(a,r,o,u,c,"next",e)}function c(e){i(a,r,o,u,c,"throw",e)}u(void 0)})});return function(e,t){return a.apply(this,arguments)}}()}function c(e,t){if(!a)throw new Error("ReverseGeocode not initialised");return a(e,t)}},902(e,t,n){n.d(t,{C1:()=>a,Ey:()=>c,ip:()=>u});var r=window.matchMedia("(pointer: coarse)").matches?"touch":"unknown",o=new Set;function i(e){r!==e&&(r=e,o.forEach(function(t){t(e)}))}function a(){var e=window.matchMedia("(pointer: coarse)"),t=function(e){i(e.matches?"touch":"mouse")};e.addEventListener("change",t);var n=function(e){var t,n="pen"===(t=e.pointerType)||"touch"===t?"touch":"mouse"===t?"mouse":"unknown";setTimeout(function(){return i(n)},150)},r=function(e){"Tab"===e.key&&i("keyboard")};return globalThis.addEventListener("pointerdown",n,{passive:!0}),globalThis.addEventListener("keydown",r,{passive:!0}),function(){e.removeEventListener("change",t),globalThis.removeEventListener("pointerdown",n),globalThis.removeEventListener("keydown",r)}}function u(){return"unknown"===r?"mouse":r}function c(e){return o.add(e),function(){o.delete(e)}}},201(e,t,n){n.d(t,{g:()=>o,w:()=>r});var r=function(e){var t=e.behaviour,n=e.hybridWidth,r=e.maxMobileWidth;if("hybrid"!==t)return!1;var o=null!=n?n:r;return window.matchMedia("(max-width: ".concat(o,"px)")).matches},o=function(e){var t=e.behaviour;return["mapOnly","buttonFirst"].includes(t)||r(e)}},637(e,t,n){n.d(t,{q:()=>r});var r=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=globalThis.location)||void 0===t?void 0:t.search;return new URLSearchParams(n).get(e)}},901(e,t,n){function r(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return o(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return u=e.done,e},e:function(e){c=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(c)throw a}}}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function i(e){var t,n=e.containerEl,o=e.isFullscreen,i=e.boundaryEl,a=void 0===i?document.body:i,u=Array.from(a.querySelectorAll("[data-fm-inert]"));if(n&&(u=u.filter(function(e){return!n.contains(e)})),u.forEach(function(e){e.removeAttribute("aria-hidden"),e.removeAttribute("data-fm-inert")}),o){null===(t=document.activeElement)||void 0===t||t.blur();for(var c=n;null!==(l=c)&&void 0!==l&&l.parentNode&&c!==a&&c!==document.body;){var l,s,f=c.parentNode,p=r(f.children);try{for(p.s();!(s=p.n()).done;){var d=s.value;d===c||n&&n.contains(d)||!d.matches(":not([aria-hidden]):not([data-fm-inert])")||!a.contains(d)||(d.setAttribute("aria-hidden","true"),d.setAttribute("data-fm-inert",""))}}catch(e){p.e(e)}finally{p.f()}c=f}}}n.d(t,{U:()=>i})}},i={};function a(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return o[e](n,n.exports,a),n.exports}a.m=o,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,a.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var o=Object.create(null);a.r(o);var i={};e=e||[null,t({}),t([]),t(t)];for(var u=2&r&&n;("object"==typeof u||"function"==typeof u)&&!~e.indexOf(u);u=t(u))Object.getOwnPropertyNames(u).forEach(e=>i[e]=()=>n[e]);return i.default=()=>n,a.d(o,i),o},a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.f={},a.e=e=>Promise.all(Object.keys(a.f).reduce((t,n)=>(a.f[n](e,t),t),[])),a.u=e=>"im-core.js",a.miniCssF=e=>{},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},r="defra.InteractiveMap:",a.l=(e,t,o,i)=>{if(n[e])n[e].push(t);else{var u,c;if(void 0!==o)for(var l=document.getElementsByTagName("script"),s=0;s<l.length;s++){var f=l[s];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==r+o){u=f;break}}u||(c=!0,(u=document.createElement("script")).charset="utf-8",a.nc&&u.setAttribute("nonce",a.nc),u.setAttribute("data-webpack",r+o),u.src=e),n[e]=[t];var p=(t,r)=>{u.onerror=u.onload=null,clearTimeout(d);var o=n[e];if(delete n[e],u.parentNode&&u.parentNode.removeChild(u),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(p.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=p.bind(null,u.onerror),u.onload=p.bind(null,u.onload),c&&document.head.appendChild(u)}},a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e;a.g.importScripts&&(e=a.g.location+"");var t=a.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=n[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=e})(),(()=>{var e={57:0};a.f.j=(t,n)=>{var r=a.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=e[t]=[n,o]);n.push(r[2]=o);var i=a.p+a.u(t),u=new Error;a.l(i,n=>{if(a.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;u.message="Loading chunk "+t+" failed.\n("+o+": "+i+")",u.name="ChunkLoadError",u.type=o,u.request=i,r[1](u)}},"chunk-"+t,t)}};var t=(t,n)=>{var r,o,[i,u,c]=n,l=0;if(i.some(t=>0!==e[t])){for(r in u)a.o(u,r)&&(a.m[r]=u[r]);c&&c(a)}for(t&&t(n);l<i.length;l++)o=i[l],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0},n=this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};a.d(u,{default:()=>Y});var c=a(540),l=a(848),s=a.t(l,2),f=a(637),p=a(201),d=a(43);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function y(){var e,t=(0,f.q)(d.A.mapViewParamKey),n=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(h.values());try{for(n.s();!(e=n.n()).done;){var r,o,i=e.value,a=i.id===t,u="hybrid"===i.config.behaviour&&!(0,p.w)(i.config),c=null===(r=i.rootEl)||void 0===r?void 0:r.children.length;if(a&&!c)null===(o=i.loadApp)||void 0===o||o.call(i);else if(!a&&c&&!u){var l,s,y;null===(l=i.removeApp)||void 0===l||l.call(i),null===(s=i.openButton)||void 0===s||null===(y=s.focus)||void 0===y||y.call(s)}}}catch(e){n.e(e)}finally{n.f()}}var h=new Map,m=!1;const b=function(e){m||(window.addEventListener("popstate",y),m=!0),h.set(e.id,e)},g=function(e){h.delete(e.id)};function _(e){return _="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},_(e)}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e,t,n){return(t=function(e){var t=function(e){if("object"!=_(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==_(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){try{return JSON.parse(e)}catch(e){return console.log(e),null}}function S(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var A=a(205);function O(e){var t=e.id,n=e.behaviour,r=(0,f.q)(d.A.mapViewParamKey)===t;return["mapOnly","inline"].includes(n)||"hybrid"===n&&!(0,p.w)(e)||r}function k(e){return k="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},k(e)}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach(function(t){C(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C(e,t,n){return(t=function(e){var t=function(e){if("object"!=k(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==k(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var M=a(902),D=a(233),x=a(12);function R(e){return R="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},R(e)}function L(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,B(r.key),r)}}function B(e){var t=function(e){if("object"!=R(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=R(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==R(t)?t:t+""}var N=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.events={}},t=[{key:"on",value:function(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),this}},{key:"off",value:function(e,t){return this.events[e]?(this.events[e]=t?this.events[e].filter(function(e){return e!==t}):[],this):this}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return this.events[e]?(this.events[e].forEach(function(t){try{t.apply(void 0,n)}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}}),this):this}},{key:"destroy",value:function(){this.events={}}}],t&&L(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function H(e){return H="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},H(e)}function I(){var e,t,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,l=Object.create(c.prototype);return F(l,"_invoke",function(n,r,o){var i,u,c,l=0,s=o||[],f=!1,p={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,n){return i=t,u=0,c=e,p.n=n,a}};function d(n,r){for(u=n,c=r,t=0;!f&&l&&!o&&t<s.length;t++){var o,i=s[t],d=p.p,v=i[2];n>3?(o=v===r)&&(c=i[(u=i[4])?5:(u=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=n<2&&d<i[1])?(u=0,p.v=r,p.n=i[1]):d<v&&(o=n<3||i[0]>r||r>v)&&(i[4]=n,i[5]=r,p.n=v,u=0))}if(o||n>1)return a;throw f=!0,r}return function(o,s,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&d(s,v),u=s,c=v;(t=u<2?e:c)||!f;){i||(u?u<3?(u>1&&(p.n=-1),d(u,c)):p.n=c:p.v=c);try{if(l=2,i){if(u||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=i.return)&&t.call(i),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);i=e}else if((t=(f=p.n<0)?c:n.call(r,p))!==a)break}catch(t){i=e,u=1,c=t}finally{l=1}}return{value:t,done:f}}}(n,o,i),!0),l}var a={};function u(){}function c(){}function l(){}t=Object.getPrototypeOf;var s=[][r]?t(t([][r]())):(F(t={},r,function(){return this}),t),f=l.prototype=u.prototype=Object.create(s);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,F(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=l,F(f,"constructor",l),F(l,"constructor",c),c.displayName="GeneratorFunction",F(l,o,"GeneratorFunction"),F(f),F(f,o,"Generator"),F(f,r,function(){return this}),F(f,"toString",function(){return"[object Generator]"}),(I=function(){return{w:i,m:p}})()}function F(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}F=function(e,t,n,r){function i(t,n){F(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(i("next",0),i("throw",1),i("return",2))},F(e,t,n,r)}function $(e,t,n,r,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function q(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q(Object(n),!0).forEach(function(t){U(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function V(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,W(r.key),r)}}function U(e,t,n){return(t=W(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function W(e){var t=function(e){if("object"!=H(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=H(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==H(t)?t:t+""}new N;var z=function(){return e=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),U(this,"_openButton",null),U(this,"_root",null),U(this,"_breakpointDetector",null),U(this,"_interfaceDetectorCleanup",null),U(this,"_hybridBehaviourCleanup",null),this.id=t,this.rootEl=document.getElementById(t),!this.rootEl)throw new Error('Element with id "'.concat(t,'" not found'));this.eventBus=new N,this.config=this._buildConfig(n),function(e,t){var n=t.mapProvider,r=t.deviceNotSupportedText,o=null==n?void 0:n.checkDeviceCapabilities();if(n)return!(null==o||!o.isSupported)||(S(e,r),(0,A.i)(),console.log(null==o?void 0:o.error),!1);console.log("No map provider")}(this.rootEl,this.config)&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&b(this),this._breakpointDetector=function(e){var t=e.maxMobileWidth,n=e.minDesktopWidth,r=e.containerEl,o="unknown",i=new Set,a=null,u=function(e){return e<=t?"mobile":e>=n?"desktop":"tablet"},c=function(e){e!==o&&(o=e,requestAnimationFrame(function(){o===e&&i.forEach(function(t){return t(e)})}))};if(r){r.style.containerType="inline-size";var l=r.getBoundingClientRect().width,s=u(l);r.setAttribute("data-breakpoint",s),o=s;var f=new ResizeObserver(function(e){var t,n,o=(null===(t=e[0])||void 0===t||null===(t=t.borderBoxSize)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.inlineSize)||(null===(n=e[0])||void 0===n?void 0:n.contentRect.width),i=u(o);r.setAttribute("data-breakpoint",i),c(i)});f.observe(r),c(s),a=function(){f.disconnect(),r.style.containerType="",r.removeAttribute("data-breakpoint")}}else{var p={mobile:window.matchMedia("(max-width: ".concat(t,"px)")),desktop:window.matchMedia("(min-width: ".concat(n,"px)"))},d=function(){var e;e=p.mobile.matches?"mobile":p.desktop.matches?"desktop":"tablet",c(e)};p.mobile.addEventListener("change",d),p.desktop.addEventListener("change",d),d(),a=function(){p.mobile.removeEventListener("change",d),p.desktop.removeEventListener("change",d)}}return{subscribe:function(e){return i.add(e),function(){return i.delete(e)}},getBreakpoint:function(){return"unknown"===o?"desktop":o},destroy:function(){var e;null===(e=a)||void 0===e||e(),i.clear()}}}({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=(0,M.C1)(),this._initialize())},t=[{key:"_buildConfig",value:function(e){var t=function(e){for(var t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach(function(t){E(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},null==e?void 0:e.dataset),n={},r=0,o=Object.keys(t);r<o.length;r++){var i=o[r];n[i]=P(t[i])}return n}(this.rootEl);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return T(T({},d.A),e)}(G(G({id:this.id,title:document.title},t),e))}},{key:"_initialize",value:function(){var e=this;["buttonFirst","hybrid"].includes(this.config.behaviour)&&(this._openButton=function(t,n){var r=t.id,o=t.buttonText,i=t.buttonClass,a='\n <a class="'.concat(i,"\" role=\"button\">\n <svg focusable='false' aria-hidden='true' width='16' height='20' viewBox='0 0 16 20' fillRule='evenodd'>\n <path d='M15 7.5c.009 3.778-4.229 9.665-7.5 12.5C4.229 17.165-.009 11.278 0 7.5a7.5 7.5 0 1 1 15 0z'/>\n <path d='M7.5 12.961a5.46 5.46 0 1 0 0-10.922 5.46 5.46 0 1 0 0 10.922z' fill='#fff'/>\n </svg>\n <span>").concat(o,"</span>\n <span class='im-u-visually-hidden'> (Visual only)</span>\n </a>\n ");n.insertAdjacentHTML("beforebegin",a);var u=n.previousElementSibling,c=new URL(window.location.href);return c.searchParams.set(d.A.mapViewParamKey,r),u.setAttribute("href",c.toString()),u.addEventListener("click",function(t){t.preventDefault(),function(t){e._handleButtonClick(t)}(t)}),u}(this.config,this.rootEl)),this._hybridBehaviourCleanup=function(e){var t=e.config,n=t.behaviour,r=t.hybridWidth,o=t.maxMobileWidth;if("buttonFirst"===n&&e._breakpointDetector.subscribe(function(){O(e.config)?e.loadApp():e.removeApp()}),"hybrid"===n){var i=null!=r?r:o,a=window.matchMedia("(max-width: ".concat(i,"px)")),u=function(){O(e.config)?e.loadApp():e.removeApp()};return a.addEventListener("change",u),function(){return a.removeEventListener("change",u)}}return null}(this),O(this.config)?this.loadApp():(0,A.i)()}},{key:"_handleButtonClick",value:function(e){this.loadApp(),history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href"))}},{key:"_handleExitClick",value:function(){this.removeApp();var e=this.config.mapViewParamKey,t=location.href.replace(new RegExp("[?&]".concat(e,"=[^&]*(&|$)")),function(e,t){return"&"===t?"?":""}).replace(/\?$/,"");history.replaceState(history.state,"",t)}},{key:"loadApp",value:(n=I().m(function e(){var t,n,r,o,i,u,c,l,s,f=this;return I().w(function(e){for(;;)switch(e.p=e.n){case 0:return this._openButton&&(this._openButton.style.display="none"),e.p=1,e.n=2,a.e(935).then(a.bind(a,663));case 2:return t=e.v,n=t.initialiseApp,e.n=3,this.config.mapProvider.load();case 3:return r=e.v,o=r.MapProvider,i=r.mapFramework,u=r.mapProviderConfig,this.config.reverseGeocodeProvider&&(0,D.H)(this.config.reverseGeocodeProvider,u.crs),e.n=4,n(this.rootEl,G(G({id:this.id,initialBreakpoint:this._breakpointDetector.getBreakpoint(),initialInterfaceType:(0,M.ip)()},this.config),{},{MapProvider:o,mapProviderConfig:u,mapFramework:i,eventBus:this.eventBus,breakpointDetector:this._breakpointDetector,handleExitClick:this._handleExitClick.bind(this)}));case 4:c=e.v,this._root=c._root,delete c._root,l=["on","off","emit"],Object.keys(c).forEach(function(e){l.includes(e)||(f[e]=c[e])}),(0,A.N)(this),e.n=6;break;case 5:throw e.p=5,s=e.v,S(this.rootEl,this.config.genericErrorText),console.error(s),s;case 6:return e.a(2)}},e,this,[[1,5]])}),r=function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function a(e){$(i,r,o,a,u,"next",e)}function u(e){$(i,r,o,a,u,"throw",e)}a(void 0)})},function(){return r.apply(this,arguments)})},{key:"removeApp",value:function(){this._root&&"function"==typeof this.unmount&&(this.unmount(),this._root=null),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),(0,A.N)(this),this.eventBus.emit(x.q.MAP_DESTROY,{mapId:this.id})}},{key:"destroy",value:function(){var e,t,n;this.removeApp(),null===(e=this._breakpointDetector)||void 0===e||e.destroy(),null===(t=this._interfaceDetectorCleanup)||void 0===t||t.call(this),null===(n=this._hybridBehaviourCleanup)||void 0===n||n.call(this),g(this),this.eventBus.destroy()}},{key:"on",value:function(){var e;(e=this.eventBus).on.apply(e,arguments)}},{key:"off",value:function(){var e;(e=this.eventBus).off.apply(e,arguments)}},{key:"emit",value:function(){var e;(e=this.eventBus).emit.apply(e,arguments)}},{key:"addMarker",value:function(e,t,n){this.eventBus.emit(x.q.APP_ADD_MARKER,{id:e,coords:t,options:n})}},{key:"removeMarker",value:function(e){this.eventBus.emit(x.q.APP_REMOVE_MARKER,e)}},{key:"setMode",value:function(e){this.eventBus.emit(x.q.APP_SET_MODE,e)}},{key:"addButton",value:function(e,t){this.eventBus.emit(x.q.APP_ADD_BUTTON,{id:e,config:t})}},{key:"toggleButtonState",value:function(e,t,n){this.eventBus.emit(x.q.APP_TOGGLE_BUTTON_STATE,{id:e,prop:t,value:n})}},{key:"addPanel",value:function(e,t){this.eventBus.emit(x.q.APP_ADD_PANEL,{id:e,config:t})}},{key:"removePanel",value:function(e){this.eventBus.emit(x.q.APP_REMOVE_PANEL,e)}},{key:"showPanel",value:function(e){this.eventBus.emit(x.q.APP_SHOW_PANEL,e)}},{key:"hidePanel",value:function(e){this.eventBus.emit(x.q.APP_HIDE_PANEL,e)}},{key:"addControl",value:function(e,t){this.eventBus.emit(x.q.APP_ADD_CONTROL,{id:e,config:t})}}],t&&V(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r}(),K="undefined"!=typeof window?window:globalThis;K.defra=K.defra||{},K.preactCompat=c,K.preactJsxRuntime=s,K.preactHooks={useState:c.useState},K.defra.InteractiveMap=z,K.preactCompat.default||(K.preactCompat.default=K.preactCompat),K.preactCompat.createRoot||(K.preactCompat.createRoot=function(e){return{render:function(t){K.preactCompat.render(t,e)},unmount:function(){K.preactCompat.render(null,e)}}});const Y=z;return u.default})());
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# ButtonDefinition
|
|
2
|
+
|
|
3
|
+
Defines a button that can be rendered in the UI at various breakpoints.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### `id`
|
|
10
|
+
**Type:** `string`
|
|
11
|
+
**Required**
|
|
12
|
+
|
|
13
|
+
Unique button identifier.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### `label`
|
|
18
|
+
**Type:** `string | function`
|
|
19
|
+
**Required**
|
|
20
|
+
|
|
21
|
+
Accessible label. Used for the button label or tooltip if `showLabel` is false. Can be a string or a function that returns a string. If a function is used, it receives the [Context](./context.md) as an argument.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
label: (context) => context.appState.isFullscreen ? 'Exit fullscreen' : 'Enter fullscreen'
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### `mobile`
|
|
30
|
+
**Type:** `ButtonBreakpointConfig`
|
|
31
|
+
**Required**
|
|
32
|
+
|
|
33
|
+
Mobile breakpoint configuration. See [Breakpoint Configuration](#breakpoint-configuration) below.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
### `tablet`
|
|
38
|
+
**Type:** `ButtonBreakpointConfig`
|
|
39
|
+
**Required**
|
|
40
|
+
|
|
41
|
+
Tablet breakpoint configuration. See [Breakpoint Configuration](#breakpoint-configuration) below.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### `desktop`
|
|
46
|
+
**Type:** `ButtonBreakpointConfig`
|
|
47
|
+
|
|
48
|
+
Desktop breakpoint configuration. See [Breakpoint Configuration](#breakpoint-configuration) below.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### `iconId`
|
|
53
|
+
**Type:** `string`
|
|
54
|
+
|
|
55
|
+
Icon identifier from the icon registry.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### `iconSvgContent`
|
|
60
|
+
**Type:** `string`
|
|
61
|
+
|
|
62
|
+
Raw SVG content for the button icon. The outer `<svg>` tag should be excluded.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### `group`
|
|
67
|
+
**Type:** `string`
|
|
68
|
+
|
|
69
|
+
Button group label for grouping related buttons.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
### `panelId`
|
|
74
|
+
**Type:** `string`
|
|
75
|
+
|
|
76
|
+
Associated panel identifier. When set, clicking the button toggles the panel open/closed.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### `inline`
|
|
81
|
+
**Type:** `boolean`
|
|
82
|
+
**Default:** `true`
|
|
83
|
+
|
|
84
|
+
Whether the button is rendered when the app is in 'inline' mode. Set to `false` to only show the button when fullscreen.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### `isToggle`
|
|
89
|
+
**Type:** `boolean`
|
|
90
|
+
|
|
91
|
+
Enables pressed state tracking for the button. When `true`, `aria-pressed` is set based on the button's pressed state. Use [`toggleButtonState()`](../api.md#togglebuttonstateid-prop-value) to control the pressed state.
|
|
92
|
+
|
|
93
|
+
This is intended for host buttons added via `addButton()` as an alternative to the `pressedWhen` callback.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### `onClick`
|
|
98
|
+
**Type:** `function`
|
|
99
|
+
|
|
100
|
+
Click handler for the button. Receives the event and [Context](./context.md).
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
onClick: (event, context) => {
|
|
104
|
+
console.log('Button clicked')
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Reactive Callbacks
|
|
109
|
+
|
|
110
|
+
The following callbacks are evaluated automatically for plugin-defined buttons only. When adding buttons via the host API (`addButton`), use [`toggleButtonState()`](../api.md#togglebuttonstateid-prop-value) to control these states imperatively.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### `enableWhen`
|
|
115
|
+
**Type:** `function`
|
|
116
|
+
|
|
117
|
+
Callback to determine if the button should be enabled. Returns `true` or `false`. Sets `aria-disabled` accordingly.
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
enableWhen: (context) => context.pluginState.isReady
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### `excludeWhen`
|
|
126
|
+
**Type:** `function`
|
|
127
|
+
|
|
128
|
+
Callback to determine if the button should be excluded from rendering entirely.
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
excludeWhen: (context) => !context.appState.hasPermission
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### `hiddenWhen`
|
|
137
|
+
**Type:** `function`
|
|
138
|
+
|
|
139
|
+
Callback to determine if the button should be hidden. Sets `display: none` if true.
|
|
140
|
+
|
|
141
|
+
```js
|
|
142
|
+
hiddenWhen: (context) => context.pluginState.isHidden
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### `pressedWhen`
|
|
148
|
+
**Type:** `function`
|
|
149
|
+
|
|
150
|
+
Callback to determine if the button should appear pressed. Sets `aria-pressed` accordingly.
|
|
151
|
+
|
|
152
|
+
```js
|
|
153
|
+
pressedWhen: (context) => context.pluginState.isActive
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Breakpoint Configuration
|
|
159
|
+
|
|
160
|
+
Each breakpoint (`mobile`, `tablet`, `desktop`) accepts the following properties:
|
|
161
|
+
|
|
162
|
+
### `slot`
|
|
163
|
+
**Type:** `string`
|
|
164
|
+
**Required**
|
|
165
|
+
|
|
166
|
+
The [slot](./slots.md) where the button should appear at this breakpoint. Slots are named regions in the UI layout.
|
|
167
|
+
|
|
168
|
+
### `order`
|
|
169
|
+
**Type:** `number`
|
|
170
|
+
|
|
171
|
+
The order the button appears within its slot.
|
|
172
|
+
|
|
173
|
+
### `showLabel`
|
|
174
|
+
**Type:** `boolean`
|
|
175
|
+
|
|
176
|
+
Whether to show the label. If `false`, a tooltip is generated from the label instead.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Context
|
|
2
|
+
|
|
3
|
+
Context object providing access to configuration, state, and services. This object is passed to various callbacks and components throughout the application.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### `appConfig`
|
|
10
|
+
**Type:** `Object`
|
|
11
|
+
|
|
12
|
+
Application configuration passed to the InteractiveMap constructor.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
### `appState`
|
|
17
|
+
**Type:** `Object`
|
|
18
|
+
|
|
19
|
+
Current application state, including:
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
{
|
|
23
|
+
breakpoint: 'mobile' | 'tablet' | 'desktop',
|
|
24
|
+
interfaceType: 'mouse' | 'touch' | 'keyboard',
|
|
25
|
+
// ... other app state
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
### `iconRegistry`
|
|
32
|
+
**Type:** `Object`
|
|
33
|
+
|
|
34
|
+
Registry of icons available for use in buttons and controls.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
### `mapProvider`
|
|
39
|
+
**Type:** `MapProvider`
|
|
40
|
+
|
|
41
|
+
The map provider instance. Provides methods to interact with the underlying map engine.
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
// Example usage
|
|
45
|
+
const center = context.mapProvider.getCenter()
|
|
46
|
+
context.mapProvider.setView({ zoom: 10 })
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### `mapState`
|
|
52
|
+
**Type:** `Object`
|
|
53
|
+
|
|
54
|
+
Current map state, including:
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
{
|
|
58
|
+
zoom: 8,
|
|
59
|
+
center: [-1.5, 52.5],
|
|
60
|
+
bounds: [...],
|
|
61
|
+
// ... other map state
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### `services`
|
|
68
|
+
**Type:** `Object`
|
|
69
|
+
|
|
70
|
+
Core services for interacting with the application.
|
|
71
|
+
|
|
72
|
+
#### `announce`
|
|
73
|
+
|
|
74
|
+
Updates the map's `aria-live` region with a screen reader announcement. Use this to communicate important state changes to assistive technology users.
|
|
75
|
+
|
|
76
|
+
> [!NOTE]
|
|
77
|
+
> This will override any pending core messages, so be sure to include necessary context. This function is experimental and subject to change.
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
context.services.announce('3 results found')
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### `reverseGeocode`
|
|
84
|
+
|
|
85
|
+
Returns a location description for the given coordinates. Uses the `reverseGeocodeProvider` if configured in options.
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
const description = await context.services.reverseGeocode(zoom, center)
|
|
89
|
+
// e.g. "Manchester, Greater Manchester"
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
> [!NOTE]
|
|
93
|
+
> Further work is planned to provide richer results with optional detail levels and zoom-dependent descriptions.
|
|
94
|
+
|
|
95
|
+
#### `closeApp`
|
|
96
|
+
|
|
97
|
+
Closes the map if in fullscreen mode and returns to the previous page. Use this when your interaction needs to exit the map entirely.
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
context.services.closeApp()
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
#### `eventBus`
|
|
104
|
+
|
|
105
|
+
Pub/sub event bus for communication within the application.
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
const { eventBus, events } = context.services
|
|
109
|
+
|
|
110
|
+
// Subscribe to an event
|
|
111
|
+
eventBus.on(events.APP_PANEL_OPENED, ({ panelId }) => {
|
|
112
|
+
console.log('Panel opened:', panelId)
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
// Unsubscribe from an event
|
|
116
|
+
eventBus.off(events.APP_PANEL_OPENED, handler)
|
|
117
|
+
|
|
118
|
+
// Emit an event
|
|
119
|
+
eventBus.emit(events.MY_CUSTOM_EVENT, { data: 'value' })
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### `events`
|
|
123
|
+
|
|
124
|
+
Event name constants for use with `eventBus`. See [Events](../api.md#events) for available events.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# ControlDefinition
|
|
2
|
+
|
|
3
|
+
Defines a custom control component that can be rendered in the UI at various breakpoints.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### `id`
|
|
10
|
+
**Type:** `string`
|
|
11
|
+
**Required**
|
|
12
|
+
|
|
13
|
+
Unique control identifier.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### `label`
|
|
18
|
+
**Type:** `string`
|
|
19
|
+
**Required**
|
|
20
|
+
|
|
21
|
+
Accessible label for the control.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### `render`
|
|
26
|
+
**Type:** `ComponentType`
|
|
27
|
+
**Required**
|
|
28
|
+
|
|
29
|
+
A React/Preact component to render. Receives [Context](./context.md) as props (or [PluginContext](../plugins/plugin-context.md) when used in a plugin manifest).
|
|
30
|
+
|
|
31
|
+
```jsx
|
|
32
|
+
const MyControl = ({ context }) => {
|
|
33
|
+
const { appState, pluginState } = context
|
|
34
|
+
return <div>Custom control content</div>
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### `mobile`
|
|
41
|
+
**Type:** `ControlBreakpointConfig`
|
|
42
|
+
**Required**
|
|
43
|
+
|
|
44
|
+
Mobile breakpoint configuration. See [Breakpoint Configuration](#breakpoint-configuration) below.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
### `tablet`
|
|
49
|
+
**Type:** `ControlBreakpointConfig`
|
|
50
|
+
**Required**
|
|
51
|
+
|
|
52
|
+
Tablet breakpoint configuration. See [Breakpoint Configuration](#breakpoint-configuration) below.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### `desktop`
|
|
57
|
+
**Type:** `ControlBreakpointConfig`
|
|
58
|
+
**Required**
|
|
59
|
+
|
|
60
|
+
Desktop breakpoint configuration. See [Breakpoint Configuration](#breakpoint-configuration) below.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Breakpoint Configuration
|
|
65
|
+
|
|
66
|
+
Each breakpoint (`mobile`, `tablet`, `desktop`) accepts the following properties:
|
|
67
|
+
|
|
68
|
+
### `slot`
|
|
69
|
+
**Type:** `string`
|
|
70
|
+
**Required**
|
|
71
|
+
|
|
72
|
+
The [slot](./slots.md) where the control should appear at this breakpoint. Slots are named regions in the UI layout.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# IconDefinition
|
|
2
|
+
|
|
3
|
+
Definition for a custom icon that can be registered and used by buttons.
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
### `id`
|
|
10
|
+
**Type:** `string`
|
|
11
|
+
**Required**
|
|
12
|
+
|
|
13
|
+
Unique icon identifier. Use this ID to reference the icon in button definitions via the `iconId` property.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
### `svgContent`
|
|
18
|
+
**Type:** `string`
|
|
19
|
+
**Required**
|
|
20
|
+
|
|
21
|
+
Raw SVG content without the outer `<svg>` tag. The component will wrap your content in an appropriately sized SVG element.
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
{
|
|
25
|
+
id: 'my-icon',
|
|
26
|
+
svgContent: '<path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/>'
|
|
27
|
+
}
|
|
28
|
+
```
|