@defra/interactive-map 0.0.20-alpha → 0.0.22-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/esm/im-core.js +1 -1
  2. package/dist/esm/im-shell.js +1 -1
  3. package/dist/esm/index.js +1 -1
  4. package/dist/umd/im-core.js +1 -1
  5. package/dist/umd/index.js +1 -1
  6. package/docs/api.md +41 -2
  7. package/docs/examples/index.mdx +2 -2
  8. package/docs/plugins/datasets.md +50 -12
  9. package/package.json +6 -4
  10. package/plugins/beta/datasets/dist/adapters/maplibre/esm/im-datasets-ml-adapter.js +1 -0
  11. package/plugins/beta/datasets/dist/adapters/maplibre/esm/index.js +1 -0
  12. package/plugins/beta/datasets/dist/esm/im-datasets-plugin.js +1 -1
  13. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-maplibre-adapter.js +2 -0
  14. package/plugins/beta/datasets/dist/umd/maplibre/im-datasets-plugin.js +2 -0
  15. package/plugins/beta/datasets/dist/umd/maplibre/index.js +2 -0
  16. package/plugins/beta/datasets/dist/umd/maplibre/index.js.LICENSE.txt +1 -0
  17. package/plugins/beta/datasets/src/adapters/maplibre/index.js +1 -1
  18. package/plugins/beta/datasets/src/adapters/maplibre/layerBuilders.js +4 -4
  19. package/plugins/beta/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +26 -7
  20. package/plugins/beta/datasets/src/defaults.js +1 -1
  21. package/plugins/beta/datasets/src/index.maplibre.umd.js +23 -0
  22. package/plugins/beta/datasets/src/manifest.js +1 -1
  23. package/plugins/beta/datasets/src/panels/Layers.jsx +4 -4
  24. package/plugins/beta/datasets/src/utils/mergeSublayer.js +1 -1
  25. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  26. package/providers/maplibre/dist/esm/index.js +1 -1
  27. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  28. package/providers/maplibre/dist/umd/index.js +1 -1
  29. package/providers/maplibre/src/index.js +7 -1
  30. package/providers/maplibre/src/index.test.js +18 -0
  31. package/providers/maplibre/src/maplibreProvider.js +2 -1
  32. package/providers/maplibre/src/maplibreProvider.test.js +22 -2
  33. package/providers/maplibre/src/utils/patternImages.js +16 -10
  34. package/providers/maplibre/src/utils/patternImages.test.js +50 -19
  35. package/rollup.esm.mjs +9 -0
  36. package/src/App/components/Viewport/MapController.jsx +1 -1
  37. package/src/App/hooks/useMapURLSync.js +3 -3
  38. package/src/App/hooks/useMapURLSync.test.js +20 -3
  39. package/src/InteractiveMap/InteractiveMap.js +1 -1
  40. package/src/InteractiveMap/InteractiveMap.test.js +4 -4
  41. package/src/InteractiveMap/behaviourController.js +1 -2
  42. package/src/InteractiveMap/buttonManager.js +1 -3
  43. package/src/InteractiveMap/buttonManager.test.js +16 -8
  44. package/src/InteractiveMap/domStateManager.js +2 -3
  45. package/src/InteractiveMap/historyManager.js +4 -3
  46. package/src/config/defaults.js +2 -1
  47. package/src/config/mergeConfig.js +8 -2
  48. package/src/config/mergeConfig.test.js +19 -0
  49. package/src/types.js +22 -2
  50. package/src/utils/mapStateSync.js +2 -2
  51. package/src/utils/mapStateSync.test.js +18 -0
  52. package/src/utils/patternUtils.js +8 -3
  53. package/src/utils/patternUtils.test.js +17 -0
  54. package/webpack.dev.mjs +4 -0
  55. package/webpack.umd.mjs +9 -5
  56. package/plugins/beta/datasets/dist/umd/im-datasets-plugin.js +0 -2
  57. package/plugins/beta/datasets/dist/umd/index.js +0 -2
  58. /package/plugins/beta/datasets/dist/umd/{im-datasets-plugin.js.LICENSE.txt → maplibre/im-datasets-maplibre-adapter.js.LICENSE.txt} +0 -0
  59. /package/plugins/beta/datasets/dist/umd/{index.js.LICENSE.txt → maplibre/im-datasets-plugin.js.LICENSE.txt} +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={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"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),v=Symbol.iterator,h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,m={};function b(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||h}function g(){}function _(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||h}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=_,y(w,b.prototype),w.isPureReactComponent=!0;var P=Array.isArray;function E(){}var A={H:null,A:null,T:null,S:null},S=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 x(e,t,o,i,a){var u=typeof e;"undefined"!==u&&"boolean"!==u||(e=null);var c,s,l=!1;if(null===e)l=!0;else switch(u){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case n:case r:l=!0;break;case p:return x((l=e._init)(e._payload),t,o,i,a)}}if(l)return a=a(e),l=""===i?"."+T(e,0):i,P(a)?(o="",null!=l&&(o=l.replace(j,"$&/")+"/"),x(a,t,o,"",function(e){return e})):null!=a&&(k(a)&&(c=a,s=o+(null==a.key||e&&e.key===a.key?"":(""+a.key).replace(j,"$&/")+"/")+l,a=O(c.type,s,c.props)),t.push(a)),1;l=0;var f,d=""===i?".":i+":";if(P(e))for(var h=0;h<e.length;h++)l+=x(i=e[h],t,o,u=d+T(i,h),a);else if("function"==typeof(h=null===(f=e)||"object"!=typeof f?null:"function"==typeof(f=v&&f[v]||f["@@iterator"])?f:null))for(e=h.call(e),h=0;!(i=e.next()).done;)l+=x(i=i.value,t,o,u=d+T(i,h++),a);else if("object"===u){if("function"==typeof e.then)return x(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(E,E):(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 l}function C(e,t,n){if(null==e)return e;var r=[],o=0;return x(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 M="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:C,forEach:function(e,t,n){C(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return C(e,function(){t++}),t},toArray:function(e){return C(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=l,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return A.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=y({},e.props),o=e.key;if(null!=t)for(i in void 0!==t.key&&(o=""+t.key),t)!S.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)S.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:s,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=A.T,n={};A.T=n;try{var r=e(),o=A.S;null!==o&&o(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(E,M)}catch(e){M(e)}finally{null!==t&&null!==n.types&&(t.types=n.types),A.T=t}},t.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},t.use=function(e){return A.H.use(e)},t.useActionState=function(e,t,n){return A.H.useActionState(e,t,n)},t.useCallback=function(e,t){return A.H.useCallback(e,t)},t.useContext=function(e){return A.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return A.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return A.H.useEffect(e,t)},t.useEffectEvent=function(e){return A.H.useEffectEvent(e)},t.useId=function(){return A.H.useId()},t.useImperativeHandle=function(e,t,n){return A.H.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return A.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return A.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return A.H.useMemo(e,t)},t.useOptimistic=function(e,t){return A.H.useOptimistic(e,t)},t.useReducer=function(e,t,n){return A.H.useReducer(e,t,n)},t.useRef=function(e){return A.H.useRef(e)},t.useState=function(e){return A.H.useState(e)},t.useSyncExternalStore=function(e,t,n){return A.H.useSyncExternalStore(e,t,n)},t.useTransition=function(){return A.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=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).isFullscreen,n=e.config,u=e.rootEl,c=n.pageTitle,s=n.behaviour,l=n.containerHeight,f=null!=t?t:function(e){var t=e.id,n=e.behaviour,o=e.manageHistoryState;return"mapOnly"===n||("buttonFirst"===n?!1===o||(0,r.q)(a.A.mapViewParamKey)===t:(0,i.w)(e)&&(0,r.q)(a.A.mapViewParamKey)===t)}(n);["mapOnly","buttonFirst","hybrid"].includes(s)&&((0,o.U)({containerEl:u,isFullscreen:f}),document.documentElement.classList.toggle("im-is-fullscreen",f),u.classList.toggle("im-is-fullscreen",f)),["buttonFirst","hybrid"].includes(s)&&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:c,isFullscreen:f});var p=f||"buttonFirst"!==s&&!(0,i.w)(n)?l:"auto";u.style.height=f?"100%":p}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:!0,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",manageHistoryState:!0,mapViewParamKey:"mv",maxMobileWidth:640,minDesktopWidth:835,nudgePanDelta:5,nudgeZoomDelta:.1,panDelta:100,pageTitle:"Map view",preserveStateOnClose:!1,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_OPENED:"app:opened",APP_CLOSED:"app:closed",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_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",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_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 s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=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&&s&&!o&&t<l.length;t++){var o,i=l[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,l,v){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,v),a=l,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(s=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{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var p=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),d=f.prototype=s.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 l.prototype=f,o(d,"constructor",f),o(f,"constructor",l),l.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 window.addEventListener("pointerdown",n,{passive:!0}),window.addEventListener("keydown",r,{passive:!0}),function(){e.removeEventListener("change",t),window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",r)}}function u(){return"unknown"===r?(r="mouse","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=window.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}n.d(t,{U:()=>a});var i=function(e,t,n,r){return e!==t&&!(null!=n&&n.contains(e))&&e.matches(":not([aria-hidden]):not([data-fm-inert])")&&r.contains(e)};function a(e){var t,n=e.containerEl,o=e.isFullscreen,a=e.boundaryEl,u=void 0===a?document.body:a,c=Array.from(u.querySelectorAll("[data-fm-inert]"));if(n&&(c=c.filter(function(e){return!n.contains(e)})),c.forEach(function(e){e.removeAttribute("aria-hidden"),delete e.dataset.fmInert}),o){null===(t=document.activeElement)||void 0===t||t.blur();for(var s=n;null!==(l=s)&&void 0!==l&&l.parentNode&&s!==u&&s!==document.body;){var l,f,p=s.parentNode,d=r(p.children);try{for(d.s();!(f=d.n()).done;){var v=f.value;i(v,s,n,u)&&(v.setAttribute("aria-hidden","true"),v.dataset.fmInert="")}}catch(e){d.e(e)}finally{d.f()}s=p}}}}},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 s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var f=s[l];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,s=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);s<i.length;s++)o=i[s],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:()=>Q});var c=a(540),s=a(848),l=a.t(s,2),f=a(637),p=a(201),d=a(43);function v(){var e=(0,f.q)(d.A.mapViewParamKey);h.forEach(function(t){return function(e,t){var n;if(!1!==e.config.manageHistoryState){var r=e.id===t,o="hybrid"===e.config.behaviour&&!(0,p.w)(e.config),i=null===(n=e.rootEl)||void 0===n?void 0:n.children.length;!r||i&&!e._isHidden?r||!i||o||function(e){var t,n;e.config.preserveStateOnClose?null===(t=e.hideApp)||void 0===t||t.call(e):null===(n=e.removeApp)||void 0===n||n.call(e)}(e):function(e){var t,n;e._isHidden?null===(t=e.showApp)||void 0===t||t.call(e):null===(n=e.loadApp)||void 0===n||n.call(e)}(e)}}(t,e)})}var h=new Map,y=!1;const m=function(e){y||(globalThis.addEventListener("popstate",v),y=!0),h.set(e.id,e)},b=function(e){h.delete(e.id)};function g(e){return g="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},g(e)}function _(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 w(e,t,n){return(t=function(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(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 E(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var A=a(205);function S(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 O(e){return O="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},O(e)}function k(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 j(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?k(Object(n),!0).forEach(function(t){T(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):k(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function T(e,t,n){return(t=function(e){var t=function(e){if("object"!=O(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=O(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==O(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=a(902),C=a(233),D=a(12);function M(e){return M="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},M(e)}function R(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 B(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,L(r.key),r)}}function L(e){var t=function(e){if("object"!=M(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=M(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==M(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={},this._queued={}},t=[{key:"on",value:function(e,t){if(this.events[e]||(this.events[e]=[]),this.events[e].push(t),void 0!==this._queued[e]){try{t.apply(void 0,function(e){return function(e){if(Array.isArray(e))return R(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return R(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)?R(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this._queued[e]))}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}delete this._queued[e]}return 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:"emitWhenReady",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]&&0!==this.events[e].length?this.emit.apply(this,[e].concat(n)):(this._queued[e]=n,this)}},{key:"destroy",value:function(){this.events={},this._queued={}}}],t&&B(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();new N;var H=a(901);if("undefined"!=typeof crypto&&!crypto.randomUUID){var I=0;crypto.randomUUID=function(){return I=Math.max(Date.now(),I+1),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e,t){var n=t<12?Number.parseInt(I.toString(16).padStart(12,"0")[t],16):16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})}}var q="undefined"!=typeof AbortController&&!Object.getPrototypeOf((new AbortController).signal).throwIfAborted;if(q&&(Object.getPrototypeOf((new AbortController).signal).throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");throw e.name="AbortError",e}}),q&&"undefined"!=typeof URL&&URL.createObjectURL){var F=URL.createObjectURL.bind(URL);URL.createObjectURL=function(e){return e instanceof Blob&&"text/javascript"===e.type&&(e=new Blob(['if(typeof AbortController!=="undefined"){var _p=Object.getPrototypeOf(new AbortController().signal);if(!_p.throwIfAborted){_p.throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");e.name="AbortError";throw e}}}}\n',e],{type:"text/javascript"})),F(e)}}function U(e){return U="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},U(e)}function $(){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,s=Object.create(c.prototype);return V(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=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&&s&&!o&&t<l.length;t++){var o,i=l[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,l,v){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,v),u=l,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(s=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{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(V(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,V(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,V(f,"constructor",s),V(s,"constructor",c),c.displayName="GeneratorFunction",V(s,o,"GeneratorFunction"),V(f),V(f,o,"Generator"),V(f,r,function(){return this}),V(f,"toString",function(){return"[object Generator]"}),($=function(){return{w:i,m:p}})()}function V(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}V=function(e,t,n,r){function i(t,n){V(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))},V(e,t,n,r)}function G(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 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 z(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){Y(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}function K(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,Z(r.key),r)}}function Y(e,t,n){return(t=Z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e){var t=function(e){if("object"!=U(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=U(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==U(t)?t:t+""}var J=function(){return e=function e(t){var n,r,o,i,a,u=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),Y(this,"_openButton",null),Y(this,"_root",null),Y(this,"_breakpointDetector",null),Y(this,"_interfaceDetectorCleanup",null),Y(this,"_hybridBehaviourCleanup",null),Y(this,"_isHidden",!1),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(u),n=this.rootEl,o=(r=this.config).mapProvider,i=r.deviceNotSupportedText,a=null==o?void 0:o.checkDeviceCapabilities(),(o?null!=a&&a.isSupported||(E(n,i),(0,A.i)(),console.log(null==a?void 0:a.error),0):(console.log("No map provider"),0))&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&m(this),this._breakpointDetector=function(e){var t,n=e.maxMobileWidth,r=e.minDesktopWidth,o=e.containerEl,i="unknown",a=new Set,u=function(e){e!==i&&(i=e,requestAnimationFrame(function(){i===e&&a.forEach(function(t){return t(e)})}))};if(o){var c=function(e,t,n){e.style.containerType="inline-size";var r=e.getBoundingClientRect().width,o=t(r);e.dataset.breakpoint=o;var i=new window.ResizeObserver(function(r){var o,i,a=(null===(o=r[0])||void 0===o||null===(o=o.borderBoxSize)||void 0===o||null===(o=o[0])||void 0===o?void 0:o.inlineSize)||(null===(i=r[0])||void 0===i?void 0:i.contentRect.width),u=t(a);e.dataset.breakpoint=u,n(u)});return i.observe(e),{initialType:o,cleanup:function(){i.disconnect(),e.style.containerType="",delete e.dataset.breakpoint}}}(o,function(e){return function(e,t,n){return e<=t?"mobile":e>=n?"desktop":"tablet"}(e,n,r)},u);i=c.initialType,u(c.initialType),t=c.cleanup}else{var s=function(e,t,n){var r={mobile:window.matchMedia("(max-width: ".concat(e,"px)")),desktop:window.matchMedia("(min-width: ".concat(t,"px)"))},o=function(){var e="tablet";r.mobile.matches?e="mobile":r.desktop.matches&&(e="desktop"),n(e)};return r.mobile.addEventListener("change",o),r.desktop.addEventListener("change",o),o(),{cleanup:function(){r.mobile.removeEventListener("change",o),r.desktop.removeEventListener("change",o)}}}(n,r,u);t=s.cleanup}return{subscribe:function(e){return a.add(e),function(){return a.delete(e)}},getBreakpoint:function(){return i},destroy:function(){var e;null===(e=t)||void 0===e||e(),a.clear()}}}({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=(0,x.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?_(Object(n),!0).forEach(function(t){w(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(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 j(j({},d.A),e)}(z(z({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(){S(e.config)?e.loadApp():e.removeApp()}),"hybrid"===n){var i=null!=r?r:o,a=window.matchMedia("(max-width: ".concat(i,"px)")),u=function(){S(e.config)?e._isHidden?e.showApp():null==e._root?e.loadApp():(0,A.N)(e):e._root&&e.hideApp()};return a.addEventListener("change",u),function(){return a.removeEventListener("change",u)}}return null}(this),S(this.config)?this.loadApp():(0,A.i)()}},{key:"_handleButtonClick",value:function(e){this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this._isHidden?this.showApp():this.loadApp()}},{key:"_removeMapParamFromUrl",value:function(e,t){var n=new RegExp("[?&]".concat(t,"=[^&]*(&|$)"));return n.test(e)?e.replace(n,function(e,t){return"&"===t?"?":""}).replace(/\?$/,""):e}},{key:"_handleExitClick",value:function(){var e;if(this.config.preserveStateOnClose?this.hideApp():this.removeApp(),this.config.manageHistoryState)if(null!==(e=history.state)&&void 0!==e&&e.isBack)history.back();else{var t=this.config.mapViewParamKey,n=this._removeMapParamFromUrl(location.href,t);history.replaceState(history.state,"",n)}}},{key:"loadApp",value:(n=$().m(function e(){var t,n,r,o,i,u,c,s,l,f=this;return $().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,724));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,C.H)(this.config.reverseGeocodeProvider,u.crs),e.n=4,n(this.rootEl,z(z({id:this.id,initialBreakpoint:this._breakpointDetector.getBreakpoint(),initialInterfaceType:(0,x.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,s=new Set(["on","off","emit"]),Object.keys(c).forEach(function(e){s.has(e)||(f[e]=c[e])}),(0,A.N)(this),this.eventBus.emit(D.q.APP_OPENED,{statePreserved:!1}),e.n=6;break;case 5:throw e.p=5,l=e.v,E(this.rootEl,this.config.genericErrorText),console.error(l),l;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){G(i,r,o,a,u,"next",e)}function u(e){G(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,{isFullscreen:!1}),this.eventBus.emit(D.q.APP_CLOSED,{statePreserved:!1}),this.eventBus.emit(D.q.MAP_DESTROY,{mapId:this.id})}},{key:"hideApp",value:function(){this._isHidden=!0,this.rootEl.style.display="none",(0,H.U)({containerEl:this.rootEl,isFullscreen:!1}),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),document.documentElement.classList.remove("im-is-fullscreen"),this.rootEl.classList.remove("im-is-fullscreen");var e=document.title.split(": ");e.length>1&&(document.title=e.at(-1)),this.eventBus.emit(D.q.APP_CLOSED,{statePreserved:!0})}},{key:"showApp",value:function(){this._isHidden=!1,this.rootEl.style.display="",this._openButton&&(this._openButton.style.display="none"),(0,A.N)(this),this.eventBus.emit(D.q.APP_OPENED,{statePreserved:!0})}},{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),b(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(D.q.APP_ADD_MARKER,{id:e,coords:t,options:n})}},{key:"removeMarker",value:function(e){this.eventBus.emit(D.q.APP_REMOVE_MARKER,e)}},{key:"setMode",value:function(e){this.eventBus.emit(D.q.APP_SET_MODE,e)}},{key:"addButton",value:function(e,t){this.eventBus.emit(D.q.APP_ADD_BUTTON,{id:e,config:t})}},{key:"toggleButtonState",value:function(e,t,n){this.eventBus.emit(D.q.APP_TOGGLE_BUTTON_STATE,{id:e,prop:t,value:n})}},{key:"addPanel",value:function(e,t){this.eventBus.emit(D.q.APP_ADD_PANEL,{id:e,config:t})}},{key:"removePanel",value:function(e){this.eventBus.emit(D.q.APP_REMOVE_PANEL,e)}},{key:"showPanel",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).focus,n=void 0===t||t;this.eventBus.emit(D.q.APP_SHOW_PANEL,{id:e,focus:n})}},{key:"hidePanel",value:function(e){this.eventBus.emit(D.q.APP_HIDE_PANEL,e)}},{key:"addControl",value:function(e,t){this.eventBus.emit(D.q.APP_ADD_CONTROL,{id:e,config:t})}},{key:"fitToBounds",value:function(e){this.eventBus.emitWhenReady(D.q.MAP_FIT_TO_BOUNDS,e)}},{key:"setView",value:function(e){this.eventBus.emitWhenReady(D.q.MAP_SET_VIEW,e)}},{key:"open",value:function(){this._isHidden?this.showApp():this._root||this.loadApp()}},{key:"close",value:function(){this._handleExitClick()}}],t&&K(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r}(),X="undefined"==typeof window?globalThis:window;X.defra=X.defra||{},X.preactCompat=c,X.preactJsxRuntime=l,X.preactHooks={useState:c.useState},X.defra.InteractiveMap=J,X.preactCompat.default||(X.preactCompat.default=X.preactCompat),X.preactCompat.createRoot||(X.preactCompat.createRoot=function(e){return{render:function(t){X.preactCompat.render(t,e)},unmount:function(){X.preactCompat.render(null,e)}}});const Q=J;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"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),d=Symbol.for("react.activity"),v=Symbol.iterator,h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,m={};function b(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||h}function g(){}function _(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||h}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=_,y(w,b.prototype),w.isPureReactComponent=!0;var P=Array.isArray;function E(){}var O={H:null,A:null,T:null,S:null},S=Object.prototype.hasOwnProperty;function A(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 x(e,t,o,i,a){var u=typeof e;"undefined"!==u&&"boolean"!==u||(e=null);var c,s,l=!1;if(null===e)l=!0;else switch(u){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case n:case r:l=!0;break;case p:return x((l=e._init)(e._payload),t,o,i,a)}}if(l)return a=a(e),l=""===i?"."+T(e,0):i,P(a)?(o="",null!=l&&(o=l.replace(j,"$&/")+"/"),x(a,t,o,"",function(e){return e})):null!=a&&(k(a)&&(c=a,s=o+(null==a.key||e&&e.key===a.key?"":(""+a.key).replace(j,"$&/")+"/")+l,a=A(c.type,s,c.props)),t.push(a)),1;l=0;var f,d=""===i?".":i+":";if(P(e))for(var h=0;h<e.length;h++)l+=x(i=e[h],t,o,u=d+T(i,h),a);else if("function"==typeof(h=null===(f=e)||"object"!=typeof f?null:"function"==typeof(f=v&&f[v]||f["@@iterator"])?f:null))for(e=h.call(e),h=0;!(i=e.next()).done;)l+=x(i=i.value,t,o,u=d+T(i,h++),a);else if("object"===u){if("function"==typeof e.then)return x(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(E,E):(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 l}function C(e,t,n){if(null==e)return e;var r=[],o=0;return x(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 M="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:C,forEach:function(e,t,n){C(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return C(e,function(){t++}),t},toArray:function(e){return C(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=l,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.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=y({},e.props),o=e.key;if(null!=t)for(i in void 0!==t.key&&(o=""+t.key),t)!S.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 A(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)S.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 A(e,i,o)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:s,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=O.T,n={};O.T=n;try{var r=e(),o=O.S;null!==o&&o(n,r),"object"==typeof r&&null!==r&&"function"==typeof r.then&&r.then(E,M)}catch(e){M(e)}finally{null!==t&&null!==n.types&&(t.types=n.types),O.T=t}},t.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},t.use=function(e){return O.H.use(e)},t.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)},t.useCallback=function(e,t){return O.H.useCallback(e,t)},t.useContext=function(e){return O.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return O.H.useEffect(e,t)},t.useEffectEvent=function(e){return O.H.useEffectEvent(e)},t.useId=function(){return O.H.useId()},t.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return O.H.useMemo(e,t)},t.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)},t.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)},t.useRef=function(e){return O.H.useRef(e)},t.useState=function(e){return O.H.useState(e)},t.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)},t.useTransition=function(){return O.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:()=>a,i:()=>u});var r=n(637),o=n(901),i=n(201);function a(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).isFullscreen,n=e.config,a=e.rootEl,u=n.pageTitle,c=n.behaviour,s=n.containerHeight,l=null!=t?t:function(e){var t=e.id,n=e.behaviour,o=e.manageHistoryState;return"mapOnly"===n||("buttonFirst"===n?!1===o||(0,r.q)(e.mapViewQueryParam)===t:(0,i.w)(e)&&(0,r.q)(e.mapViewQueryParam)===t)}(n);["mapOnly","buttonFirst","hybrid"].includes(c)&&((0,o.U)({containerEl:a,isFullscreen:l}),document.documentElement.classList.toggle("im-is-fullscreen",l),a.classList.toggle("im-is-fullscreen",l)),["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:l});var f=l||"buttonFirst"!==c&&!(0,i.w)(n)?s:"auto";a.style.height=l?"100%":f}function u(){document.body.classList.remove("im-is-loading")}},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_OPENED:"app:opened",APP_CLOSED:"app:closed",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_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",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_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 s?r:s,l=Object.create(u.prototype);return o(l,"_invoke",function(n,r,o){var i,a,u,s=0,l=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&&s&&!o&&t<l.length;t++){var o,i=l[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,l,v){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,v),a=l,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(s=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{s=1}}return{value:t,done:f}}}(n,i,a),!0),l}var c={};function s(){}function l(){}function f(){}t=Object.getPrototypeOf;var p=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),d=f.prototype=s.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 l.prototype=f,o(d,"constructor",f),o(f,"constructor",l),l.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 window.addEventListener("pointerdown",n,{passive:!0}),window.addEventListener("keydown",r,{passive:!0}),function(){e.removeEventListener("change",t),window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",r)}}function u(){return"unknown"===r?(r="mouse","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=window.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}n.d(t,{U:()=>a});var i=function(e,t,n,r){return e!==t&&!(null!=n&&n.contains(e))&&e.matches(":not([aria-hidden]):not([data-fm-inert])")&&r.contains(e)};function a(e){var t,n=e.containerEl,o=e.isFullscreen,a=e.boundaryEl,u=void 0===a?document.body:a,c=Array.from(u.querySelectorAll("[data-fm-inert]"));if(n&&(c=c.filter(function(e){return!n.contains(e)})),c.forEach(function(e){e.removeAttribute("aria-hidden"),delete e.dataset.fmInert}),o){null===(t=document.activeElement)||void 0===t||t.blur();for(var s=n;null!==(l=s)&&void 0!==l&&l.parentNode&&s!==u&&s!==document.body;){var l,f,p=s.parentNode,d=r(p.children);try{for(d.s();!(f=d.n()).done;){var v=f.value;i(v,s,n,u)&&(v.setAttribute("aria-hidden","true"),v.dataset.fmInert="")}}catch(e){d.e(e)}finally{d.f()}s=p}}}}},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 s=document.getElementsByTagName("script"),l=0;l<s.length;l++){var f=s[l];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,s=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);s<i.length;s++)o=i[s],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:()=>ee});var c=a(540),s=a(848),l=a.t(s,2),f=a(637),p=a(201);function d(){v.forEach(function(e){!function(e,t){var n;if(!1!==e.config.manageHistoryState){var r=e.id===t,o="hybrid"===e.config.behaviour&&!(0,p.w)(e.config),i=null===(n=e.rootEl)||void 0===n?void 0:n.children.length;!r||i&&!e._isHidden?r||!i||o||function(e){var t,n;e.config.preserveStateOnClose?null===(t=e.hideApp)||void 0===t||t.call(e):null===(n=e.removeApp)||void 0===n||n.call(e)}(e):function(e){var t,n;e._isHidden?null===(t=e.showApp)||void 0===t||t.call(e):null===(n=e.loadApp)||void 0===n||n.call(e)}(e)}}(e,(0,f.q)(e.config.mapViewQueryParam))})}var v=new Map,h=!1;const y=function(e){h||(globalThis.addEventListener("popstate",d),h=!0),v.set(e.id,e)},m=function(e){v.delete(e.id)};function b(e){return b="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},b(e)}function g(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,t,n){return(t=function(e){var t=function(e){if("object"!=b(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==b(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){try{return JSON.parse(e)}catch(e){return console.log(e),null}}function P(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var E=a(205);function O(e){var t=e.id,n=e.behaviour,r=(0,f.q)(e.mapViewQueryParam)===t;return["mapOnly","inline"].includes(n)||"hybrid"===n&&!(0,p.w)(e)||r}const S={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:!0,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",manageHistoryState:!0,mapViewQueryParam:"mv",urlPosition:"sync",maxMobileWidth:640,minDesktopWidth:835,nudgePanDelta:5,nudgeZoomDelta:.1,panDelta:100,pageTitle:"Map view",preserveStateOnClose:!1,readMapText:!1,reverseGeocodeProvider:null,zoomDelta:1};function A(e){return A="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},A(e)}var k=["mapViewParamKey"];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){x(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 x(e,t,n){return(t=function(e){var t=function(e){if("object"!=A(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=A(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==A(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C=a(902),D=a(233),M=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 B(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 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 H=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={},this._queued={}},t=[{key:"on",value:function(e,t){if(this.events[e]||(this.events[e]=[]),this.events[e].push(t),void 0!==this._queued[e]){try{t.apply(void 0,function(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return B(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)?B(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(this._queued[e]))}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}delete this._queued[e]}return 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:"emitWhenReady",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]&&0!==this.events[e].length?this.emit.apply(this,[e].concat(n)):(this._queued[e]=n,this)}},{key:"destroy",value:function(){this.events={},this._queued={}}}],t&&L(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();new H;var I=a(901);if("undefined"!=typeof crypto&&!crypto.randomUUID){var q=0;crypto.randomUUID=function(){return q=Math.max(Date.now(),q+1),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e,t){var n=t<12?Number.parseInt(q.toString(16).padStart(12,"0")[t],16):16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})}}var F="undefined"!=typeof AbortController&&!Object.getPrototypeOf((new AbortController).signal).throwIfAborted;if(F&&(Object.getPrototypeOf((new AbortController).signal).throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");throw e.name="AbortError",e}}),F&&"undefined"!=typeof URL&&URL.createObjectURL){var U=URL.createObjectURL.bind(URL);URL.createObjectURL=function(e){return e instanceof Blob&&"text/javascript"===e.type&&(e=new Blob(['if(typeof AbortController!=="undefined"){var _p=Object.getPrototypeOf(new AbortController().signal);if(!_p.throwIfAborted){_p.throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");e.name="AbortError";throw e}}}}\n',e],{type:"text/javascript"})),U(e)}}function V(e){return V="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},V(e)}function $(){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,s=Object.create(c.prototype);return G(s,"_invoke",function(n,r,o){var i,u,c,s=0,l=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&&s&&!o&&t<l.length;t++){var o,i=l[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,l,v){if(s>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,v),u=l,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(s=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{s=1}}return{value:t,done:f}}}(n,o,i),!0),s}var a={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var l=[][r]?t(t([][r]())):(G(t={},r,function(){return this}),t),f=s.prototype=u.prototype=Object.create(l);function p(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,G(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=s,G(f,"constructor",s),G(s,"constructor",c),c.displayName="GeneratorFunction",G(s,o,"GeneratorFunction"),G(f),G(f,o,"Generator"),G(f,r,function(){return this}),G(f,"toString",function(){return"[object Generator]"}),($=function(){return{w:i,m:p}})()}function G(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}G=function(e,t,n,r){function i(t,n){G(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))},G(e,t,n,r)}function W(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 z(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 K(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?z(Object(n),!0).forEach(function(t){Y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(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,Z(r.key),r)}}function Y(e,t,n){return(t=Z(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Z(e){var t=function(e){if("object"!=V(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=V(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==V(t)?t:t+""}var J=function(){return e=function e(t){var n,r,o,i,a,u=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),Y(this,"_openButton",null),Y(this,"_root",null),Y(this,"_breakpointDetector",null),Y(this,"_interfaceDetectorCleanup",null),Y(this,"_hybridBehaviourCleanup",null),Y(this,"_isHidden",!1),this.id=t,this.rootEl=document.getElementById(t),!this.rootEl)throw new Error('Element with id "'.concat(t,'" not found'));this.eventBus=new H,this.config=this._buildConfig(u),n=this.rootEl,o=(r=this.config).mapProvider,i=r.deviceNotSupportedText,a=null==o?void 0:o.checkDeviceCapabilities(),(o?null!=a&&a.isSupported||(P(n,i),(0,E.i)(),console.log(null==a?void 0:a.error),0):(console.log("No map provider"),0))&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&y(this),this._breakpointDetector=function(e){var t,n=e.maxMobileWidth,r=e.minDesktopWidth,o=e.containerEl,i="unknown",a=new Set,u=function(e){e!==i&&(i=e,requestAnimationFrame(function(){i===e&&a.forEach(function(t){return t(e)})}))};if(o){var c=function(e,t,n){e.style.containerType="inline-size";var r=e.getBoundingClientRect().width,o=t(r);e.dataset.breakpoint=o;var i=new window.ResizeObserver(function(r){var o,i,a=(null===(o=r[0])||void 0===o||null===(o=o.borderBoxSize)||void 0===o||null===(o=o[0])||void 0===o?void 0:o.inlineSize)||(null===(i=r[0])||void 0===i?void 0:i.contentRect.width),u=t(a);e.dataset.breakpoint=u,n(u)});return i.observe(e),{initialType:o,cleanup:function(){i.disconnect(),e.style.containerType="",delete e.dataset.breakpoint}}}(o,function(e){return function(e,t,n){return e<=t?"mobile":e>=n?"desktop":"tablet"}(e,n,r)},u);i=c.initialType,u(c.initialType),t=c.cleanup}else{var s=function(e,t,n){var r={mobile:window.matchMedia("(max-width: ".concat(e,"px)")),desktop:window.matchMedia("(min-width: ".concat(t,"px)"))},o=function(){var e="tablet";r.mobile.matches?e="mobile":r.desktop.matches&&(e="desktop"),n(e)};return r.mobile.addEventListener("change",o),r.desktop.addEventListener("change",o),o(),{cleanup:function(){r.mobile.removeEventListener("change",o),r.desktop.removeEventListener("change",o)}}}(n,r,u);t=s.cleanup}return{subscribe:function(e){return a.add(e),function(){return a.delete(e)}},getBreakpoint:function(){return i},destroy:function(){var e;null===(e=t)||void 0===e||e(),a.clear()}}}({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=(0,C.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?g(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(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]=w(t[i])}return n}(this.rootEl);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapViewParamKey,n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,k),r=T(T({},S),n);return void 0!==t&&(console.warn("[InteractiveMap] mapViewParamKey is deprecated — use mapViewQueryParam instead."),r.mapViewQueryParam=t),r}(K(K({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(t.mapViewQueryParam,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._isHidden?e.showApp():null==e._root?e.loadApp():(0,E.N)(e):e._root&&e.hideApp()};return a.addEventListener("change",u),function(){return a.removeEventListener("change",u)}}return null}(this),O(this.config)?this.loadApp():(0,E.i)()}},{key:"_handleButtonClick",value:function(e){this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this._isHidden?this.showApp():this.loadApp()}},{key:"_removeMapParamFromUrl",value:function(e,t){var n=new RegExp("[?&]".concat(t,"=[^&]*(&|$)"));return n.test(e)?e.replace(n,function(e,t){return"&"===t?"?":""}).replace(/\?$/,""):e}},{key:"_handleExitClick",value:function(){var e;if(this.config.preserveStateOnClose?this.hideApp():this.removeApp(),this.config.manageHistoryState)if(null!==(e=history.state)&&void 0!==e&&e.isBack)history.back();else{var t=this.config.mapViewQueryParam,n=this._removeMapParamFromUrl(location.href,t);history.replaceState(history.state,"",n)}}},{key:"loadApp",value:(n=$().m(function e(){var t,n,r,o,i,u,c,s,l,f=this;return $().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,724));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,K(K({id:this.id,initialBreakpoint:this._breakpointDetector.getBreakpoint(),initialInterfaceType:(0,C.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,s=new Set(["on","off","emit"]),Object.keys(c).forEach(function(e){s.has(e)||(f[e]=c[e])}),(0,E.N)(this),this.eventBus.emit(M.q.APP_OPENED,{statePreserved:!1}),e.n=6;break;case 5:throw e.p=5,l=e.v,P(this.rootEl,this.config.genericErrorText),console.error(l),l;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){W(i,r,o,a,u,"next",e)}function u(e){W(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,E.N)(this,{isFullscreen:!1}),this.eventBus.emit(M.q.APP_CLOSED,{statePreserved:!1}),this.eventBus.emit(M.q.MAP_DESTROY,{mapId:this.id})}},{key:"hideApp",value:function(){this._isHidden=!0,this.rootEl.style.display="none",(0,I.U)({containerEl:this.rootEl,isFullscreen:!1}),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),document.documentElement.classList.remove("im-is-fullscreen"),this.rootEl.classList.remove("im-is-fullscreen");var e=document.title.split(": ");e.length>1&&(document.title=e.at(-1)),this.eventBus.emit(M.q.APP_CLOSED,{statePreserved:!0})}},{key:"showApp",value:function(){this._isHidden=!1,this.rootEl.style.display="",this._openButton&&(this._openButton.style.display="none"),(0,E.N)(this),this.eventBus.emit(M.q.APP_OPENED,{statePreserved:!0})}},{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),m(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(M.q.APP_ADD_MARKER,{id:e,coords:t,options:n})}},{key:"removeMarker",value:function(e){this.eventBus.emit(M.q.APP_REMOVE_MARKER,e)}},{key:"setMode",value:function(e){this.eventBus.emit(M.q.APP_SET_MODE,e)}},{key:"addButton",value:function(e,t){this.eventBus.emit(M.q.APP_ADD_BUTTON,{id:e,config:t})}},{key:"toggleButtonState",value:function(e,t,n){this.eventBus.emit(M.q.APP_TOGGLE_BUTTON_STATE,{id:e,prop:t,value:n})}},{key:"addPanel",value:function(e,t){this.eventBus.emit(M.q.APP_ADD_PANEL,{id:e,config:t})}},{key:"removePanel",value:function(e){this.eventBus.emit(M.q.APP_REMOVE_PANEL,e)}},{key:"showPanel",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).focus,n=void 0===t||t;this.eventBus.emit(M.q.APP_SHOW_PANEL,{id:e,focus:n})}},{key:"hidePanel",value:function(e){this.eventBus.emit(M.q.APP_HIDE_PANEL,e)}},{key:"addControl",value:function(e,t){this.eventBus.emit(M.q.APP_ADD_CONTROL,{id:e,config:t})}},{key:"fitToBounds",value:function(e){this.eventBus.emitWhenReady(M.q.MAP_FIT_TO_BOUNDS,e)}},{key:"setView",value:function(e){this.eventBus.emitWhenReady(M.q.MAP_SET_VIEW,e)}},{key:"open",value:function(){this._isHidden?this.showApp():this._root||this.loadApp()}},{key:"close",value:function(){this._handleExitClick()}}],t&&Q(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n,r}(),X="undefined"==typeof window?globalThis:window;X.defra=X.defra||{},X.preactCompat=c,X.preactJsxRuntime=l,X.preactHooks={useState:c.useState},X.defra.InteractiveMap=J,X.preactCompat.default||(X.preactCompat.default=X.preactCompat),X.preactCompat.createRoot||(X.preactCompat.createRoot=function(e){return{render:function(t){X.preactCompat.render(t,e)},unmount:function(){X.preactCompat.render(null,e)}}});const ee=J;return u.default})());
package/docs/api.md CHANGED
@@ -248,6 +248,32 @@ new InteractiveMap('map', {
248
248
  })
249
249
  ```
250
250
 
251
+ #### MapLibre provider options
252
+
253
+ `maplibreProvider()` accepts an optional config object.
254
+
255
+ ##### `workerUrl`
256
+ **Type:** `string`
257
+ **Default:** `undefined`
258
+
259
+ URL to a separately hosted MapLibre worker file (`maplibre-gl-csp-worker.js`). Required when running under a Content Security Policy that blocks `blob:` worker URLs — a common restriction on government and enterprise platforms.
260
+
261
+ When set, MapLibre loads its rendering worker from this URL instead of generating an inline blob, so your CSP only needs `worker-src 'self'` rather than `worker-src blob:`.
262
+
263
+ The worker file ships with maplibre-gl and must be served from your own origin (copy from `node_modules/maplibre-gl/dist/maplibre-gl-csp-worker.js`).
264
+
265
+ **ESM:**
266
+
267
+ ```js
268
+ maplibreProvider({ workerUrl: '/your-assets-path/maplibre-gl-csp-worker.js' })
269
+ ```
270
+
271
+ **UMD:**
272
+
273
+ ```js
274
+ defra.maplibreProvider({ workerUrl: '/your-assets-path/maplibre-gl-csp-worker.js' })
275
+ ```
276
+
251
277
  ---
252
278
 
253
279
  ### `mapSize`
@@ -277,14 +303,27 @@ See [MapStyleConfig](./api/map-style-config.md) for full details.
277
303
 
278
304
  ---
279
305
 
280
- ### `mapViewParamKey`
306
+ ### `mapViewQueryParam`
281
307
  **Type:** `string`
282
308
  **Default:** `'mv'`
283
309
 
284
- URL query parameter key used to persist map visibility state. Override if the default value clashes with an existing parameter on your page.
310
+ URL query parameter used to control fullscreen/hybrid/buttonFirst state. Override if the default value clashes with an existing parameter on your page.
285
311
 
286
312
  ---
287
313
 
314
+ ### `urlPosition`
315
+ **Type:** `'sync' | 'readOnly' | 'none'`
316
+ **Default:** `'sync'`
317
+
318
+ Controls how map center and zoom interact with the page URL.
319
+
320
+ | Value | Behaviour |
321
+ |---|---|
322
+ | `'sync'` | Reads center/zoom from the URL on load and writes back on pan/zoom — enables bookmarking and sharing the current map view |
323
+ | `'readOnly'` | Seeds the initial view from the URL but never writes back |
324
+ | `'none'` | Ignores the URL entirely — use when you don't want the user's pan/zoom to be persisted or shared |
325
+ ---
326
+
288
327
  ### `markers`
289
328
  **Type:** `MarkerConfig[]`
290
329
 
@@ -23,7 +23,7 @@ export function ExampleCards() {
23
23
  <div className='govuk-grid-column-one-half'>
24
24
  <div className='app-example-card'>
25
25
  <img src={buttonFirstImg} alt='' />
26
- <div className='app-example-card__body' style={{ borderTop: '1px solid #f4f8fb'}}>
26
+ <div className='app-example-card__body'>
27
27
  <h2 className='govuk-heading-m'>
28
28
  <a href={buttonHref}>Button-triggered map</a>
29
29
  </h2>
@@ -33,7 +33,7 @@ export function ExampleCards() {
33
33
  <div className='govuk-grid-column-one-half'>
34
34
  <div className='app-example-card'>
35
35
  <img src={markerPanelImg} alt='' />
36
- <div className='app-example-card__body' style={{ borderTop: '1px solid #f4f8fb'}}>
36
+ <div className='app-example-card__body'>
37
37
  <h2 className='govuk-heading-m'>
38
38
  <a href={interactHref}>Add a marker with a panel</a>
39
39
  </h2>
@@ -2,11 +2,11 @@
2
2
 
3
3
  The datasets plugin renders GeoJSON and vector tile datasets on the map, with support for polygon, line, and symbol (point) layer types, sublayer style rules, layer visibility toggling, a key panel, and runtime style and data updates.
4
4
 
5
- ## Usage
5
+ ## ESM usage
6
6
 
7
7
  ```js
8
- import createDatasetsPlugin from '@defra/interactive-map/plugins/beta/datasets'
9
- import { maplibreLayerAdapter } from '@defra/interactive-map/plugins/beta/datasets/adapters/maplibre'
8
+ import createDatasetsPlugin from '@defra/interactive-map/plugins/datasets'
9
+ import { maplibreLayerAdapter } from '@defra/interactive-map/plugins/datasets/adapters/maplibre'
10
10
 
11
11
  const datasetsPlugin = createDatasetsPlugin({
12
12
  layerAdapter: maplibreLayerAdapter,
@@ -18,7 +18,7 @@ const datasetsPlugin = createDatasetsPlugin({
18
18
  minZoom: 10,
19
19
  maxZoom: 24,
20
20
  showInKey: true,
21
- toggleVisibility: true,
21
+ showInMenu: true,
22
22
  style: {
23
23
  stroke: '#d4351c',
24
24
  strokeWidth: 2,
@@ -33,6 +33,41 @@ const interactiveMap = new InteractiveMap({
33
33
  })
34
34
  ```
35
35
 
36
+ ## UMD usage
37
+
38
+ Copy `plugins/beta/datasets/dist/umd/maplibre/` to `/your-assets-path/plugins/beta/datasets/umd/maplibre/`, then load the script tag. The MapLibre adapter is included — no `layerAdapter` config is needed.
39
+
40
+ ```html
41
+ <script defer src="/your-assets-path/plugins/beta/datasets/umd/maplibre/index.js"></script>
42
+ ```
43
+
44
+ ```js
45
+ const datasetsPlugin = defra.datasetsMaplibrePlugin({
46
+ datasets: [
47
+ {
48
+ id: 'my-parcels',
49
+ label: 'My parcels',
50
+ geojson: 'https://example.com/api/parcels',
51
+ minZoom: 10,
52
+ maxZoom: 24,
53
+ showInKey: true,
54
+ showInMenu: true,
55
+ style: {
56
+ stroke: '#d4351c',
57
+ strokeWidth: 2,
58
+ fill: 'transparent'
59
+ }
60
+ }
61
+ ]
62
+ })
63
+ ```
64
+
65
+ > [!NOTE]
66
+ > **GOV.UK Prototype Kit** — skip the copy step. The file is served automatically. Use this path instead:
67
+ > ```html
68
+ > <script defer src="/plugin-assets/%40defra%2Finteractive-map/plugins/beta/datasets/dist/umd/maplibre/index.js"></script>
69
+ > ```
70
+
36
71
  ## Options
37
72
 
38
73
  Options are passed to the factory function when creating the plugin.
@@ -41,13 +76,16 @@ Options are passed to the factory function when creating the plugin.
41
76
 
42
77
  ### `layerAdapter`
43
78
 
79
+ > [!NOTE]
80
+ > UMD users using the `datasetsMaplibrePlugin` bundle do not need to set this — the MapLibre adapter is pre-configured.
81
+
44
82
  **Type:** `LayerAdapter`
45
83
  **Required**
46
84
 
47
85
  The map provider adapter responsible for rendering datasets. Import `maplibreLayerAdapter` for MapLibre GL JS, or supply a custom adapter.
48
86
 
49
87
  ```js
50
- import { maplibreLayerAdapter } from '@defra/interactive-map/plugins/beta/datasets/adapters/maplibre'
88
+ import { maplibreLayerAdapter } from '@defra/interactive-map/plugins/datasets/adapters/maplibre'
51
89
  ```
52
90
 
53
91
  ---
@@ -232,7 +270,7 @@ When `true`, the dataset appears in the Key panel with its style symbol and labe
232
270
 
233
271
  ---
234
272
 
235
- ### `toggleVisibility`
273
+ ### `showInMenu`
236
274
 
237
275
  **Type:** `boolean`
238
276
  **Default:** `false`
@@ -353,7 +391,7 @@ Sublayers inherit the parent dataset's style and only override what they specify
353
391
  | `filter` | `FilterExpression` | MapLibre filter expression to match features for this sublayer |
354
392
  | `style` | `Object` | Style overrides. Accepts the same properties as the dataset `style` object |
355
393
  | `showInKey` | `boolean` | Shows this sublayer in the Key panel. Inherits from dataset if not set |
356
- | `toggleVisibility` | `boolean` | Shows this sublayer in the Layers panel. **Default:** `false` |
394
+ | `showInMenu` | `boolean` | Shows this sublayer in the Layers panel. **Default:** `false` |
357
395
 
358
396
  **Polygon/line example:**
359
397
 
@@ -363,7 +401,7 @@ sublayers: [
363
401
  id: 'active',
364
402
  label: 'Active parcels',
365
403
  filter: ['==', ['get', 'status'], 'active'],
366
- toggleVisibility: true,
404
+ showInMenu: true,
367
405
  style: {
368
406
  stroke: '#00703c',
369
407
  fill: 'rgba(0,112,60,0.1)',
@@ -374,7 +412,7 @@ sublayers: [
374
412
  id: 'inactive',
375
413
  label: 'Inactive parcels',
376
414
  filter: ['==', ['get', 'status'], 'inactive'],
377
- toggleVisibility: true,
415
+ showInMenu: true,
378
416
  style: {
379
417
  stroke: '#d4351c',
380
418
  fillPattern: 'diagonal-cross-hatch',
@@ -399,7 +437,7 @@ When the parent dataset has `symbol` set, each sublayer can override individual
399
437
  label: 'Prehistoric sites',
400
438
  filter: ['==', ['get', 'type'], 'prehistoric'],
401
439
  showInKey: true,
402
- toggleVisibility: true,
440
+ showInMenu: true,
403
441
  style: { symbolBackgroundColor: '#0f7a52' }
404
442
  },
405
443
  {
@@ -407,7 +445,7 @@ When the parent dataset has `symbol` set, each sublayer can override individual
407
445
  label: 'Roman sites',
408
446
  filter: ['==', ['get', 'type'], 'roman'],
409
447
  showInKey: true,
410
- toggleVisibility: true,
448
+ showInMenu: true,
411
449
  style: { symbolBackgroundColor: '#54319f' }
412
450
  },
413
451
  {
@@ -415,7 +453,7 @@ When the parent dataset has `symbol` set, each sublayer can override individual
415
453
  label: 'Medieval sites',
416
454
  filter: ['==', ['get', 'type'], 'medieval'],
417
455
  showInKey: true,
418
- toggleVisibility: true,
456
+ showInMenu: true,
419
457
  style: { symbolBackgroundColor: '#ca357c' }
420
458
  }
421
459
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/interactive-map",
3
- "version": "0.0.20-alpha",
3
+ "version": "0.0.22-alpha",
4
4
  "description": "An accessible map component",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,8 +41,10 @@
41
41
  "require": "./plugins/interact/dist/umd/index.js"
42
42
  },
43
43
  "./plugins/datasets": {
44
- "import": "./plugins/beta/datasets/dist/esm/index.js",
45
- "require": "./plugins/beta/datasets/dist/umd/index.js"
44
+ "import": "./plugins/beta/datasets/dist/esm/index.js"
45
+ },
46
+ "./plugins/datasets/adapters/maplibre": {
47
+ "import": "./plugins/beta/datasets/dist/adapters/maplibre/esm/index.js"
46
48
  },
47
49
  "./plugins/map-styles": {
48
50
  "import": "./plugins/beta/map-styles/dist/esm/index.js",
@@ -127,7 +129,7 @@
127
129
  "@babel/plugin-transform-runtime": "^7.29.0",
128
130
  "@babel/preset-env": "^7.28.0",
129
131
  "@babel/preset-react": "^7.27.1",
130
- "@defra/docusaurus-theme-govuk": "^0.0.18-alpha",
132
+ "@defra/docusaurus-theme-govuk": "^0.0.19-alpha",
131
133
  "@docusaurus/core": "^3.9.2",
132
134
  "@docusaurus/module-type-aliases": "^3.9.2",
133
135
  "@docusaurus/plugin-content-docs": "^3.9.2",
@@ -0,0 +1 @@
1
+ import{useContext as e,createContext as r}from"preact/compat";import{jsx as t,jsxs as i}from"preact/jsx-runtime";import o from"@babel/runtime/helpers/asyncToGenerator";import a from"@babel/runtime/helpers/defineProperty";var l=(e,r,t,i,o)=>{if(e.getLayer(r)){var a=((e,r,t)=>{if(!t||0===t.length)return e;var i=["!",["in",r?["to-string",["get",r]]:["to-string",["id"]],["literal",t.map(String)]]];return e?["all",e,i]:i})(t,i,o);e.setFilter(r,a)}},s=(e,r)=>{if(!e)return null;if("string"==typeof e)return e.trim();if("object"==typeof e){if(r&&e[r])return e[r];var t=Object.values(e)[0];return null!=t?t:null}return null},n=e=>!(!e.fillPattern&&!e.fillPatternSvgContent),y=function(e,r,t){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=((e,r)=>{return e.fillPatternSvgContent?e.fillPatternSvgContent:e.fillPattern&&null!==(t=null==r||null===(i=r.get(e.fillPattern))||void 0===i?void 0:i.svgContent)&&void 0!==t?t:null;var t,i})(e,t);if(!o)return null;var a=s(e.fillPatternForegroundColor,r)||"black",l=s(e.fillPatternBackgroundColor,r)||"transparent",n=Math.max(2,i);return"pattern-".concat((e=>{var r=0;for(var t of e)r=(r<<5)-r+t.codePointAt(0),r&=r;return Math.abs(r).toString(36)})(o+a+l),"-").concat(n,"x")},d=e=>"string"==typeof e.geojson&&!!e.idProperty&&"function"==typeof e.transformRequest,m=e=>{var r=0;for(var t of e)r=Math.trunc((r<<5)-r+t.codePointAt(0));return Math.abs(r).toString(36)},p=e=>{if(e.tiles){var r=Array.isArray(e.tiles)?e.tiles.join(","):e.tiles;return"tiles-".concat(m(r))}return e.geojson?d(e)?"geojson-dynamic-".concat(e.id):"string"==typeof e.geojson?"geojson-".concat(m(e.geojson)):"geojson-".concat(e.id):"source-".concat(e.id)},c=e=>{if((e=>!!e.symbol)(e))return{fillLayerId:null,strokeLayerId:null,symbolLayerId:e.id};var r=!!e.fill&&"transparent"!==e.fill||n(e),t=!!e.stroke,i=r?e.id:null,o=null;return t&&(o=r?"".concat(e.id,"-stroke"):e.id),{fillLayerId:i,strokeLayerId:o,symbolLayerId:null}},u=(e,r)=>({fillLayerId:"".concat(e,"-").concat(r),strokeLayerId:"".concat(e,"-").concat(r,"-stroke"),symbolLayerId:"".concat(e,"-").concat(r,"-symbol")}),f=e=>{var r;if(null!==(r=e.sublayers)&&void 0!==r&&r.length)return e.sublayers.flatMap(r=>{var{fillLayerId:t,strokeLayerId:i,symbolLayerId:o}=u(e.id,r.id);return[i,t,o]});var{fillLayerId:t,strokeLayerId:i,symbolLayerId:o}=c(e);return[i,t,o].filter(Boolean)},v=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"];function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,i)}return t}var g=(e,r)=>{return"symbolDescription"in r?r.symbolDescription:(t=r,v.some(e=>e in t)?void 0:e.symbolDescription);var t},h=(e,r)=>{var t,i,o,l,s,n,y,d,m,p,c,u,f,v,h,_,P,L=r.style||{},S=(_=e.filter,P=r.filter,_&&P?["all",_,P]:P||_||null);return function(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach(function(r){a(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}({id:r.id,label:r.label,stroke:null!==(t=L.stroke)&&void 0!==t?t:e.stroke,strokeWidth:null!==(i=L.strokeWidth)&&void 0!==i?i:e.strokeWidth,strokeDashArray:null!==(o=L.strokeDashArray)&&void 0!==o?o:e.strokeDashArray,opacity:null!==(l=L.opacity)&&void 0!==l?l:e.opacity,keySymbolShape:null!==(s=L.keySymbolShape)&&void 0!==s?s:e.keySymbolShape,symbolDescription:g(e,L),showInKey:null!==(n=r.showInKey)&&void 0!==n?n:e.showInKey,showInMenu:null!==(y=r.showInMenu)&&void 0!==y&&y,filter:S,minZoom:e.minZoom,maxZoom:e.maxZoom,symbol:null!==(d=L.symbol)&&void 0!==d?d:e.symbol,symbolSvgContent:null!==(m=L.symbolSvgContent)&&void 0!==m?m:e.symbolSvgContent,symbolViewBox:null!==(p=L.symbolViewBox)&&void 0!==p?p:e.symbolViewBox,symbolAnchor:null!==(c=L.symbolAnchor)&&void 0!==c?c:e.symbolAnchor,symbolBackgroundColor:null!==(u=L.symbolBackgroundColor)&&void 0!==u?u:e.symbolBackgroundColor,symbolForegroundColor:null!==(f=L.symbolForegroundColor)&&void 0!==f?f:e.symbolForegroundColor,symbolHaloWidth:null!==(v=L.symbolHaloWidth)&&void 0!==v?v:e.symbolHaloWidth,symbolGraphic:null!==(h=L.symbolGraphic)&&void 0!==h?h:e.symbolGraphic},((e,r)=>{var t,i;return r.fillPattern||r.fillPatternSvgContent?{fillPattern:r.fillPattern,fillPatternSvgContent:r.fillPatternSvgContent,fillPatternForegroundColor:null!==(t=r.fillPatternForegroundColor)&&void 0!==t?t:e.fillPatternForegroundColor,fillPatternBackgroundColor:null!==(i=r.fillPatternBackgroundColor)&&void 0!==i?i:e.fillPatternBackgroundColor}:"fill"in r?{fill:r.fill}:{fill:e.fill,fillPattern:e.fillPattern,fillPatternSvgContent:e.fillPatternSvgContent,fillPatternForegroundColor:e.fillPatternForegroundColor,fillPatternBackgroundColor:e.fillPatternBackgroundColor}})(e,L))},_=(e,r)=>e.flatMap(e=>{var r,t=n(e)?[e]:[];return null!==(r=e.sublayers)&&void 0!==r&&r.length&&e.sublayers.forEach(r=>{var i=h(e,r);n(i)&&t.push(i)}),t}),P=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),L=e=>!(!e.symbol&&!e.symbolSvgContent),S=(e,r)=>e.symbolSvgContent?{svg:e.symbolSvgContent}:e.symbol?r.get(e.symbol):void 0,I=e=>{var[r,t]=e,i=(e=>e<=.25?"left":e>=.75?"right":"")(r),o=(e=>e<=.25?"top":e>=.75?"bottom":"")(t);return o+(i&&o?"-":"")+i||"center"},O=function(e,r,t){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=S(e,t);if(!a)return null;var l=(e=>{if(!L(e))return{};var r={};return P.forEach(t=>{if(null!=e[t]){var i=t.charAt(6).toLowerCase()+t.slice(7);r[i]=e[t]}}),r})(e),s=i?t.resolveSelected(a,l,r):t.resolve(a,l,r);return"symbol-".concat(i?"sel-":"").concat((e=>{var r=0;for(var t of e)r=Math.trunc((r<<5)-r+t.codePointAt(0));return Math.abs(r).toString(36)})(s),"-").concat(o,"x")},R=e=>e.flatMap(e=>{var r,t=L(e)?[e]:[];return null!==(r=e.sublayers)&&void 0!==r&&r.length&&e.sublayers.forEach(r=>{var i=h(e,r);L(i)&&t.push(i)}),t});function j(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,i)}return t}function k(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?j(Object(t),!0).forEach(function(r){a(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):j(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}var w=(e,r,t,i,o,a,l)=>{var{mapStyleId:d,patternRegistry:m,pixelRatio:p=1}=l;if(t&&!e.getLayer(t)&&(r.fill||n(r))){var c=n(r)?y(r,d,m,p):null,u=c?{"fill-pattern":c,"fill-opacity":r.opacity||1}:{"fill-color":s(r.fill,d),"fill-opacity":r.opacity||1};e.addLayer(k({id:t,type:"fill",source:i,"source-layer":o,minzoom:r.minZoom,maxzoom:r.maxZoom,layout:{visibility:a},paint:u},r.filter?{filter:r.filter}:{}))}},C=(e,r,t,i,o,a,l)=>{t&&r.stroke&&!e.getLayer(t)&&e.addLayer(k({id:t,type:"line",source:i,"source-layer":o,minzoom:r.minZoom,maxzoom:r.maxZoom,layout:{visibility:a},paint:k({"line-color":s(r.stroke,l),"line-width":r.strokeWidth||1,"line-opacity":r.opacity||1},r.strokeDashArray?{"line-dasharray":r.strokeDashArray}:{})},r.filter?{filter:r.filter}:{}))},x=(e,r,t,i,o,a,l)=>{var{mapStyle:s,symbolRegistry:n,pixelRatio:y}=l;if(t&&!e.getLayer(t)){var d=S(r,n);if(d){var m=O(r,s,n,!1,y);if(m){var p=((e,r)=>{var t;return e.symbolAnchor?e.symbolAnchor:null!==(t=null==r?void 0:r.anchor)&&void 0!==t?t:[.5,.5]})(r,d);e.addLayer(k({id:t,type:"symbol",source:i,"source-layer":o,minzoom:r.minZoom,maxzoom:r.maxZoom,layout:{visibility:a,"icon-image":m,"icon-anchor":I(p),"icon-allow-overlap":!0}},r.filter?{filter:r.filter}:{}))}}}},D=(e,r,t,i,o,a)=>{var l,{mapStyle:s,symbolRegistry:n,patternRegistry:y,pixelRatio:d}=a,m=s.id,p=h(r,t),{fillLayerId:c,strokeLayerId:f,symbolLayerId:v}=u(r.id,t.id),b="hidden"===r.visibility,g="hidden"===(null===(l=r.sublayerVisibility)||void 0===l?void 0:l[t.id]),_=b||g?"none":"visible";L(p)&&n?x(e,p,v,i,o,_,{mapStyle:s,symbolRegistry:n,pixelRatio:d}):(w(e,p,c,i,o,_,{mapStyleId:m,patternRegistry:y,pixelRatio:d}),C(e,p,f,i,o,_,m))},E=(e,r,t,i,o,a)=>{var l,s,n=t.id,y=p(r);((e,r,t)=>{if(!e.getSource(t))if(r.tiles)e.addSource(t,{type:"vector",tiles:r.tiles,minzoom:r.minZoom||0,maxzoom:r.maxZoom||22});else if(r.geojson){var i=d(r)?{type:"FeatureCollection",features:[]}:r.geojson;e.addSource(t,{type:"geojson",data:i,generateId:!0})}})(e,r,y);var m=null!==(l=r.tiles)&&void 0!==l&&l.length?r.sourceLayer:void 0;if(null!==(s=r.sublayers)&&void 0!==s&&s.length)return r.sublayers.forEach(l=>{D(e,r,l,y,m,{mapStyle:t,symbolRegistry:i,patternRegistry:o,pixelRatio:a})}),y;var{fillLayerId:u,strokeLayerId:f,symbolLayerId:v}=c(r),b="hidden"===r.visibility?"none":"visible";return L(r)&&i?(x(e,r,v,y,m,b,{mapStyle:t,symbolRegistry:i,pixelRatio:a}),y):(w(e,r,u,y,m,b,{mapStyleId:n,patternRegistry:o,pixelRatio:a}),C(e,r,f,y,m,b,n),y)};new Set;function F(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,i)}return t}function M(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?F(Object(t),!0).forEach(function(r){a(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):F(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}var A={slot:"middle",open:!1,dismissible:!0,modal:!0};M({},A),M(M({},A),{},{width:"500px"}),M(M({},A),{},{width:"500px"});var B={small:1,medium:1.5,large:2};class Z{constructor(e,r,t){this._mapProvider=e,this._map=e.map,this._symbolRegistry=r,this._patternRegistry=t,this._datasetSourceMap=new Map,this._symbolLayerIds=new Set}init(e,r){var t=this;return o(function*(){var i=r.id,o=t._pixelRatio;yield Promise.all([t._mapProvider.registerPatterns(_(e,t._patternRegistry),i,t._patternRegistry),t._mapProvider.registerSymbols(R(e),r,t._symbolRegistry)]),t._symbolLayerIds.clear(),e.forEach(e=>t._addLayers(e,r,o)),yield new Promise(e=>t._map.once("idle",e))})()}destroy(e){var r=new Set;e.forEach(e=>{var t=p(e);this._getLayersUsingSource(t).forEach(e=>{this._map.getLayer(e)&&this._map.removeLayer(e)}),!r.has(t)&&this._map.getSource(t)&&(this._map.removeSource(t),r.add(t))}),this._datasetSourceMap.clear()}onStyleChange(e,r,t,i){var a=this;return o(function*(){yield new Promise(e=>a._map.once("idle",e));var o=r.id,l=a._pixelRatio;yield Promise.all([a._mapProvider.registerPatterns(_(e,a._patternRegistry),o,a._patternRegistry),a._mapProvider.registerSymbols(R(e),r,a._symbolRegistry)]),a._symbolLayerIds.clear(),e.forEach(e=>a._addLayers(e,r,l)),i.forEach(e=>e.reapply()),Object.entries(t).forEach(r=>{var[t,{idProperty:i,ids:o}]=r,l=e.find(e=>e.id===t);l&&a._applyFeatureFilter(l,i,o)})})()}onSizeChange(e,r){var t=this;return o(function*(){var i=t._pixelRatio;yield Promise.all([t._mapProvider.registerSymbols(R(e),r,t._symbolRegistry),t._mapProvider.registerPatterns(_(e,t._patternRegistry),r.id,t._patternRegistry)]),e.forEach(e=>{var o;if(f(e).forEach(o=>{if(t._symbolLayerIds.has(o)&&t._map.getLayer(o)){var a=O(e,r,t._symbolRegistry,!1,i);a&&t._map.setLayoutProperty(o,"icon-image",a)}}),n(e)){var{fillLayerId:a}=c(e);if(t._map.getLayer(a)){var l=y(e,r.id,t._patternRegistry,i);l&&t._map.setPaintProperty(a,"fill-pattern",l)}}null===(o=e.sublayers)||void 0===o||o.forEach(o=>{var a=h(e,o),{symbolLayerId:l,fillLayerId:s}=u(e.id,o.id);if(t._map.getLayer(l)){var d=O(a,r,t._symbolRegistry,!1,i);d&&t._map.setLayoutProperty(l,"icon-image",d)}if(n(a)&&t._map.getLayer(s)){var m=y(a,r.id,t._patternRegistry,i);m&&t._map.setPaintProperty(s,"fill-pattern",m)}})})})()}addDataset(e,r){this._addLayers(e,r,this._pixelRatio)}removeDataset(e,r){var t=p(e);f(e).forEach(e=>{this._map.getLayer(e)&&this._map.removeLayer(e),this._symbolLayerIds.delete(e)}),!r.some(r=>r.id!==e.id&&p(r)===t)&&this._map.getSource(t)&&this._map.removeSource(t),this._datasetSourceMap.delete(e.id)}showDataset(e){this._setDatasetVisibility(e,"visible")}hideDataset(e){this._setDatasetVisibility(e,"none")}showSublayer(e,r){var{fillLayerId:t,strokeLayerId:i,symbolLayerId:o}=u(e,r);[t,i,o].forEach(e=>{this._map.getLayer(e)&&this._map.setLayoutProperty(e,"visibility","visible")})}hideSublayer(e,r){var{fillLayerId:t,strokeLayerId:i,symbolLayerId:o}=u(e,r);[t,i,o].forEach(e=>{this._map.getLayer(e)&&this._map.setLayoutProperty(e,"visibility","none")})}showFeatures(e,r,t){this._applyFeatureFilter(e,r,t)}hideFeatures(e,r,t){this._applyFeatureFilter(e,r,t)}setStyle(e,r){var t=this;return o(function*(){var i=r.id,o=t._pixelRatio;f(e).forEach(e=>{t._map.getLayer(e)&&t._map.removeLayer(e),t._symbolLayerIds.delete(e)}),yield Promise.all([t._mapProvider.registerPatterns(_([e],t._patternRegistry),i,t._patternRegistry),t._mapProvider.registerSymbols(R([e]),r,t._symbolRegistry)]),t._addLayers(e,r,o)})()}setSublayerStyle(e,r,t){var i=this;return o(function*(){var o,a,l=t.id,s=i._pixelRatio,{fillLayerId:n,strokeLayerId:y,symbolLayerId:d}=u(e.id,r);[n,y,d].forEach(e=>{i._map.getLayer(e)&&i._map.removeLayer(e),i._symbolLayerIds.delete(e)});var m=null===(o=e.sublayers)||void 0===o?void 0:o.find(e=>e.id===r);if(m){yield Promise.all([i._mapProvider.registerPatterns(_([e],i._patternRegistry),l,i._patternRegistry),i._mapProvider.registerSymbols(R([e]),t,i._symbolRegistry)]);var p=i._datasetSourceMap.get(e.id),c=null!==(a=e.tiles)&&void 0!==a&&a.length?e.sourceLayer:void 0;D(i._map,e,m,p,c,{mapStyle:t,symbolRegistry:i._symbolRegistry,patternRegistry:i._patternRegistry,pixelRatio:s}),i._maintainSymbolOrdering(e)}})()}setOpacity(e,r){var t=this._map.getStyle();null!=t&&t.layers&&t.layers.filter(r=>r.id===e||r.id.startsWith("".concat(e,"-"))).forEach(e=>this._setPaintOpacity(e.id,r))}setSublayerOpacity(e,r,t){var{fillLayerId:i,strokeLayerId:o}=u(e,r);this._setPaintOpacity(i,t),this._setPaintOpacity(o,t)}setData(e,r){var t=this._datasetSourceMap.get(e);if(t){var i=this._map.getSource(t);i&&"function"==typeof i.setData&&i.setData(r)}}get _pixelRatio(){return this._mapProvider.map.getPixelRatio()*(B[this._mapProvider.mapSize]||1)}_addLayers(e,r,t){var i=E(this._map,e,r,this._symbolRegistry,this._patternRegistry,t);this._datasetSourceMap.set(e.id,i),this._maintainSymbolOrdering(e)}_getFirstSymbolLayerId(){var e,r=this._map.getStyle();if(null==r||!r.layers)return null;var t=r.layers.find(e=>this._symbolLayerIds.has(e.id));return null!==(e=null==t?void 0:t.id)&&void 0!==e?e:null}_maintainSymbolOrdering(e){var r=f(e).filter(e=>e&&this._map.getLayer(e));r.forEach(e=>{var r;"symbol"===(null===(r=this._map.getLayer(e))||void 0===r?void 0:r.type)?this._symbolLayerIds.add(e):this._symbolLayerIds.delete(e)});var t=this._getFirstSymbolLayerId();t&&r.forEach(e=>{this._symbolLayerIds.has(e)||this._map.moveLayer(e,t)})}_setDatasetVisibility(e,r){var t=this._map.getStyle();null!=t&&t.layers&&t.layers.filter(r=>r.id===e||r.id.startsWith("".concat(e,"-"))).forEach(e=>this._map.setLayoutProperty(e.id,"visibility",r))}_applyFeatureFilter(e,r,t){var i;if(null!==(i=e.sublayers)&&void 0!==i&&i.length)e.sublayers.forEach(i=>{var{fillLayerId:o,strokeLayerId:a}=u(e.id,i.id),s=e.filter&&i.filter?["all",e.filter,i.filter]:i.filter||e.filter||null;l(this._map,o,s,r,t),l(this._map,a,s,r,t)});else{var{fillLayerId:o,strokeLayerId:a,symbolLayerId:s}=c(e),n=e.filter||null;[o,a,s].filter(Boolean).forEach(e=>{l(this._map,e,n,r,t)})}}_setPaintOpacity(e,r){var t=this._map.getLayer(e);if(t){var i={line:"line-opacity",symbol:"icon-opacity"}[t.type]||"fill-opacity";this._map.setPaintProperty(e,i,r)}}_getLayersUsingSource(e){var r=this._map.getStyle();return null!=r&&r.layers?r.layers.filter(r=>r.source===e).map(e=>e.id):[]}}export{Z as default};
@@ -0,0 +1 @@
1
+ var a={load:()=>import(/* webpackChunkName: "im-datasets-ml-adapter" */ "./im-datasets-ml-adapter.js")};export{a as maplibreLayerAdapter};