@defra/interactive-map 0.0.48-alpha → 0.0.48-fmp-2

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 (31) hide show
  1. package/dist/esm/im-core.js +1 -1
  2. package/dist/umd/im-core.js +1 -1
  3. package/package.json +1 -1
  4. package/plugins/datasets/dist/esm/esriLayerAdapter.js +1 -1
  5. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  6. package/plugins/datasets/dist/umd/im-datasets-esri-adapter.js +1 -1
  7. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  8. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +42 -9
  9. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +42 -4
  10. package/plugins/datasets/src/registry/datasetRegistry.js +6 -6
  11. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  12. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  13. package/plugins/map-key/dist/umd/index.js +1 -1
  14. package/plugins/map-key/src/api/addSymbol.js +3 -0
  15. package/plugins/map-key/src/api/addSymbol.test.js +14 -0
  16. package/plugins/map-key/src/api/index.js +7 -0
  17. package/plugins/map-key/src/api/index.test.js +13 -0
  18. package/plugins/map-key/src/api/removeSymbol.js +3 -0
  19. package/plugins/map-key/src/api/removeSymbol.test.js +14 -0
  20. package/plugins/map-key/src/components/Key/MapKey.jsx +11 -3
  21. package/plugins/map-key/src/initialise/MapKeyInit.jsx +18 -3
  22. package/plugins/map-key/src/initialise/MapKeyInit.test.jsx +44 -8
  23. package/plugins/map-key/src/manifest.js +5 -1
  24. package/plugins/map-key/src/reducers/mergeKeyGroupItems.js +68 -0
  25. package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +91 -0
  26. package/plugins/map-key/src/reducers/pluginState.js +68 -0
  27. package/plugins/map-key/src/reducers/pluginState.test.js +82 -0
  28. package/src/App/hooks/useLayoutMeasurements.js +10 -5
  29. package/src/App/hooks/useLayoutMeasurements.test.js +28 -9
  30. package/plugins/map-key/src/utils/mergeKeyGroupItems.js +0 -12
  31. package/plugins/map-key/src/utils/mergeKeyGroupItems.test.js +0 -53
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see im-datasets-plugin.js.LICENSE.txt */
2
- "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[2447],{65767(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function i(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,{V:()=>u,jE:()=>p,ns:()=>f,p_:()=>c});var u={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},s=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription","keySymbolShape","symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"],l=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],c=function(t){return l.some(function(e){return e in t})},f=function(t,e){var r=t.style||{},n=a(a({},e.style),r);!("symbolDescription"in r)&&c(r)&&delete n.symbolDescription;var o=a({},t);delete o.style,s.forEach(function(t){return delete o[t]});var i=a({},e);return delete i.style,a(a(a({},i),o),n)},p=function(t){!0!==t.visible&&!1!==t.visible&&(t.visible="hidden"!==t.visibility);var e=a(a(a({},u),t),{},{style:a(a({},u.style),t.style)}),r=t.style||{};return!("symbolDescription"in r)&&c(r)&&delete e.style.symbolDescription,s.forEach(function(t){return delete e[t]}),e}},11973(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function i(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}r.r(e),r.d(e,{manifest:()=>ht});var l=function(t){var e=t.datasets,r=[],n=(void 0===e?[]:e).filter(function(t){var e;return t.showInMenu||(null===(e=t.sublayers)||void 0===e?void 0:e.some(function(t){return t.showInMenu}))}),o=new Map;return n.forEach(function(t){var e;if(null!==(e=t.sublayers)&&void 0!==e&&e.length){var n=t.sublayers.filter(function(e){return t.showInMenu?!1!==e.showInMenu:e.showInMenu});if(!1===t.showInMenu&&!n.length)return;var a={id:t.id,groupLabel:t.label,visibleWhen:!0,type:"checkbox",items:n.map(function(e){return{id:"".concat(t.id,"-").concat(e.id),label:e.label}})};0===a.items.length&&(delete a.groupLabel,a.items.push({id:t.id,label:t.label})),r.push(a)}else if(t.groupLabel){var i=o.has(t.groupLabel)?o.get(t.groupLabel):{id:t.groupLabel,groupLabel:t.groupLabel,visibleWhen:!0,type:"checkbox",items:[]};o.has(t.groupLabel)||(o.set(t.groupLabel,i),r.push(i)),i.items.push({id:t.id,label:t.label})}else r.push({visibleWhen:!0,type:"checkbox",id:t.id,items:[{id:t.id,label:t.label}]})}),r},c=function(t,e){return t.reduce(function(t,r){var n=r.items.filter(function(t){return!e.includes(t.id)});return n.length&&t.push(a(a({},r),{},{items:n})),t},[])},f=r(65767);function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach(function(e){b(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function b(t,e,r){return(e=function(t){var e=function(t){if("object"!=p(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==p(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var v=function(t,e){var r,n=e.id,o=(0,f.jE)(e);e.parentId&&("showInKey"in e||delete o.showInKey,"showInMenu"in e||delete o.showInMenu),t[n]=o;var a=t.orderedDatasets;a.push(n);var i=null===(r=e.sublayers)||void 0===r?void 0:r.map(function(t){return function(t,e){var r="".concat(t,"-").concat(e.id),n=e.id;return"hidden"!==e.visibility&&(e.visibility="visible"),d(d({},e),{},{id:r,parentId:t,sublayerId:n})}(n,t)});if(null!=i&&i.length){var u=null==i?void 0:i.map(function(t){return t.id}),s=null==i?void 0:i.reduce(v,{orderedDatasets:a});return t[n].sublayerIds=u,delete t[n].sublayers,d(d(d({},t),s),{},{orderedDatasets:a})}return d(d({},t),{},{orderedDatasets:a})},h=function(t){var e=(t.datasets||[]).reduce(v,{orderedDatasets:[]}),r=e.orderedDatasets;return delete e.orderedDatasets,d(d({},t),{},{mappedDatasets:e,orderedDatasets:r})},m=r(97619);function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function S(t){return function(t){if(Array.isArray(t))return D(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return D(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?D(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function O(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?O(Object(r),!0).forEach(function(e){A(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function A(t,e,r){return(e=function(t){var e=function(t){if("object"!=g(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==g(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var P=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"not found";return!!t.mappedDatasets[e]||(m.v.error("".concat(r,": Dataset with id '").concat(e,"' ").concat(n)),!1)},w=0,E=function(t,e,r){return w=r.actionsArray.length?w+1:0,_(_({},r),{},{actionsArray:[].concat(S(r.actionsArray),[{method:t,parameters:e,actionId:w}])})},j={SET_DATASETS:function(t,e){var r=e.mappedDatasets,n=e.orderedDatasets;return _(_({},t),{},{mappedDatasets:r,orderedDatasets:n})},ADD_DATASET:function(t,e){var r=e.dataset,n=e.mapStyle;if(t.mappedDatasets[r.id])return m.v.error("addDataset: Dataset with id '".concat(r.id,"' already exists")),t;var o=h({datasets:[r]}),a=o.mappedDatasets,i=o.orderedDatasets,s=function(t,e){var r,n=u(t.menu),o=l({datasets:[e]}),a=n.find(function(t){return t.groupLabel===o[0].groupLabel});return a?(r=a.items).push.apply(r,u(o[0].items)):n.push.apply(n,u(o)),n}(t,r);return E("addDataset",[r.id,n],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),a),orderedDatasets:[].concat(S(t.orderedDatasets),S(i)),menu:s}))},REMOVE_DATASET:function(t,e){var r,n=e.id;if(!P(t,n,"removeDataset"))return t;var o=_({},t.mappedDatasets),a=[n].concat(S((null===(r=o[n])||void 0===r?void 0:r.sublayerIds)||[]));a.forEach(function(t){return delete o[t]});var i=t.orderedDatasets.filter(function(t){return!a.includes(t)});return _(_({},t),{},{mappedDatasets:o,orderedDatasets:i,menu:c(t.menu,a)})},SET_DATASET_VISIBILITY:function(t,e){var r=e.datasetId,n=e.visible;return P(t,r,"setDatasetVisibility")?t.mappedDatasets[r].visible===n?t:E("applyDatasetVisibility",[r,n],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,_(_({},t.mappedDatasets[r]),{},{visible:n})))})):t},SET_GLOBAL_VISIBILITY:function(t,e){var r=e.visible;return E("applyGlobalVisibility",[r],_(_({},t),{},{globals:_(_({},t.globals),{},{visible:r})}))},SET_DATASET_STYLE:function(t,e){var r=e.datasetId,n=e.styleChanges,o=e.mapStyle;if(!P(t,r,"setDatasetStyle"))return t;var a=_(_({},t.mappedDatasets[r].style),n),i=_(_(_({},t.mappedDatasets[r]),n),{},{style:a});return E("applyStyle",[r,o],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,i))}))},SET_OPACITY:function(t,e){var r=e.datasetId,n=e.opacity;if(!P(t,r,"setOpacity"))return t;var o=_(_({},t.mappedDatasets[r].style),{},{opacity:n}),a=_(_({},t.mappedDatasets[r]),{},{style:o});return E("applyDatasetOpacity",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,a))}))},SET_GLOBAL_OPACITY:function(t,e){var r=e.opacity;return E("applyGlobalOpacity",[],_(_({},t),{},{globals:_(_({},t.globals),{},{opacity:r})}))},HIDE_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!P(t,r,"setFeatureVisibility - hideFeatures"))return t;var o=_({},t.mappedDatasets[r]),a=o.hiddenFeatures||[],i=Array.from(new Set([].concat(S(a),S(n))));return o.hiddenFeatures=i,E("applyFeatureFilter",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,o))}))},SHOW_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!P(t,r,"setFeatureVisibility - showFeatures"))return t;var o=_({},t.mappedDatasets[r]),a=(o.hiddenFeatures||[]).filter(function(t){return!n.includes(t)});return o.hiddenFeatures=a.length?a:[-1],E("applyFeatureFilter",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,o))}))},REMOVE_ADAPTER_ACTIONS:function(t,e){return null!=e&&e.length?_(_({},t),{},{actionsArray:t.actionsArray.filter(function(t){return!e.includes(t)})}):t},SET_GLOBAL_STATE:function(t,e){return E("applyGlobalOpacity",[],_(_({},t),{},{globals:_(_({},t.globals),e)}))},SET_MENU:function(t,e){var r=e.menu;return _(_({},t),{},{menu:r})}},I=r(51738),T={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",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_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",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"};function M(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return k(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(k(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,k(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,k(f,"constructor",l),k(l,"constructor",s),s.displayName="GeneratorFunction",k(l,o,"GeneratorFunction"),k(f),k(f,o,"Generator"),k(f,n,function(){return this}),k(f,"toString",function(){return"[object Generator]"}),(M=function(){return{w:a,m:p}})()}function k(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}k=function(t,e,r,n){function a(e,r){k(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},k(t,e,r,n)}function C(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}var L=function(){var t,e=(t=M().m(function t(e,r,n,o){var a,i,u,s,l,c,f;return M().w(function(t){for(;;)switch(t.n){case 0:return a=n(e,r),u=(i="string"==typeof a?{url:a}:a).url,s=i.headers,l=void 0===s?{}:s,t.n=1,fetch(u,{headers:l,signal:o});case 1:if((c=t.v).ok){t.n=2;break}throw new Error("Failed to fetch GeoJSON: ".concat(c.status," ").concat(c.statusText));case 2:return t.n=3,c.json();case 3:if("FeatureCollection"!==(f=t.v).type){t.n=4;break}return t.a(2,f);case 4:if("Feature"!==f.type){t.n=5;break}return t.a(2,{type:"FeatureCollection",features:[f]});case 5:if(!Array.isArray(f)){t.n=6;break}return t.a(2,{type:"FeatureCollection",features:f});case 6:throw new Error("Invalid GeoJSON response");case 7:return t.a(2)}},t)}),function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){C(a,n,o,i,u,"next",t)}function u(t){C(a,n,o,i,u,"throw",t)}i(void 0)})});return function(t,r,n,o){return e.apply(this,arguments)}}();function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var G=function(t){var e=t.getBounds();return[e.getWest(),e.getSouth(),e.getEast(),e.getNorth()]},F=function(t,e){return!(!t||!e)&&e[0]>=t[0]&&e[1]>=t[1]&&e[2]<=t[2]&&e[3]<=t[3]},N=function(t,e){return t?[Math.min(t[0],e[0]),Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[3],e[3])]:function(t){if(Array.isArray(t))return x(t)}(r=e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return x(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}(r)||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.")}();var r},R=function(t,e){return!(!t||!e||t[2]<e[0]||t[0]>e[2]||t[3]<e[1]||t[1]>e[3])},V=function(t){var e=1/0,r=1/0,n=-1/0,o=-1/0,a=function(t,i){var u;0===i?(u=t,e=Math.min(e,u[0]),r=Math.min(r,u[1]),n=Math.max(n,u[0]),o=Math.max(o,u[1])):t.forEach(function(t){return a(t,i-1)})};switch(t.type){case"Point":a(t.coordinates,0);break;case"LineString":case"MultiPoint":a(t.coordinates,1);break;case"Polygon":case"MultiLineString":a(t.coordinates,2);break;case"MultiPolygon":a(t.coordinates,3);break;case"GeometryCollection":t.geometries.forEach(function(t){var a=V(t);e=Math.min(e,a[0]),r=Math.min(r,a[1]),n=Math.max(n,a[2]),o=Math.max(o,a[3])});break;default:throw new Error("Unsupported geometry type: ".concat(t.type))}return[e,r,n,o]};function B(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return U(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(U(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,U(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,U(f,"constructor",l),U(l,"constructor",s),s.displayName="GeneratorFunction",U(l,o,"GeneratorFunction"),U(f),U(f,o,"Generator"),U(f,n,function(){return this}),U(f,"toString",function(){return"[object Generator]"}),(B=function(){return{w:a,m:p}})()}function U(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}U=function(t,e,r,n){function a(e,r){U(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},U(t,e,r,n)}function K(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function W(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,u=[],s=!0,l=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){l=!0,o=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(t,e)||H(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(t,e){if(t){if("string"==typeof t)return Y(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Y(t,e):void 0}}function Y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Z=function(t){return{type:"FeatureCollection",features:Array.from(t.values()).map(function(t){return t.feature})}},Q=function(t,e,r){if(r&&!(t.size<=1.2*r)){var n,o=r,a=[],i=[],u=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=H(t))){e&&(t=e);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){i=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(i)throw o}}}}(t);try{for(u.s();!(n=u.n()).done;){var s=W(n.value,2),l=s[0],c=s[1];R(c.bbox,e)?a.push(l):i.push({id:l,lastSeenAt:c.lastSeenAt})}}catch(t){u.e(t)}finally{u.f()}i.sort(function(t,e){return t.lastSeenAt-e.lastSeenAt});for(var f=t.size-o,p=0;p<f&&p<i.length;p++)t.delete(i[p].id);if(t.size>o)for(var y=t.size-o,d=a.map(function(e){return{id:e,lastSeenAt:t.get(e).lastSeenAt}}).sort(function(t,e){return t.lastSeenAt-e.lastSeenAt}),b=0;b<y&&b<d.length;b++)t.delete(d[b].id)}},z=function(t,e,r){var n=Date.now();e.features.forEach(function(e){var o=function(t,e){var r,n;return e&&null!==(r=null===(n=t.properties)||void 0===n?void 0:n[e])&&void 0!==r?r:t.id}(e,r);null!=o?t.set(o,{feature:e,bbox:V(e.geometry),lastSeenAt:n}):console.warn("Feature missing ID, skipping:",e)})},J=function(){var t,e=(t=B().m(function t(e,r){var n,o,a,i,u,s,l,c,f,p,y,d,b,v,h;return B().w(function(t){for(;;)switch(t.p=t.n){case 0:if(n=r.map,o=r.dynamicGeoJSON,a=r.onUpdate,i=o.url,u=o.idProperty,s=o.transformRequest,l=o.maxFeatures,c=o.minZoom,f=void 0===c?0:c,!((p=n.getZoom())<f)){t.n=1;break}return t.a(2);case 1:if(y=G(n),!e.fetchedBbox||!F(e.fetchedBbox,y)){t.n=2;break}return t.a(2);case 2:return e.currentController&&e.currentController.abort(),e.currentController=new AbortController,t.p=3,d={bbox:y,zoom:p},t.n=4,L(i,d,s,e.currentController.signal);case 4:b=t.v,z(e.features,b,u),e.fetchedBbox=N(e.fetchedBbox,y),v=e.features.size,Q(e.features,y,l),e.features.size<v&&(e.fetchedBbox=y),a(o.id,Z(e.features)),t.n=7;break;case 5:if(t.p=5,"AbortError"!==(h=t.v).name){t.n=6;break}return t.a(2);case 6:console.error("Failed to fetch dynamic GeoJSON for ".concat(o.id,":"),h);case 7:return t.a(2)}},t,null,[[3,5]])}),function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){K(a,n,o,i,u,"next",t)}function u(t){K(a,n,o,i,u,"throw",t)}i(void 0)})});return function(t,r){return e.apply(this,arguments)}}(),$=r(83262),q=r(63447),X=function(t){var e=t.adapter,r=t.pluginConfig,n=t.mapStyle,o=t.mapProvider,a=t.events,i=t.dispatch,u=t.eventBus,s=r.datasets,c=new Map;r.globals&&i({type:"SET_GLOBAL_STATE",payload:r.globals});var p=s.map(function(t){return(0,f.ns)(t,f.V)}),y=h({datasets:s}),d=y.mappedDatasets,b=y.orderedDatasets;e.createDataset&&$.Q.attachCreateDataset(e.createDataset),$.Q.attach(d,b,n);var v=l({datasets:p});u.requestOnce("menu:state",q.vf),i({type:"SET_MENU",payload:{menu:v}}),i({type:"SET_DATASETS",payload:{mappedDatasets:d,orderedDatasets:b}}),e.init().then(function(){$.Q.forEachDataset(function(t){if(t.hasDynamicGeoJSON){var r=function(t){var e,r,n,o=t.dynamicGeoJSON,a=t.map,i=t.onUpdate,u={features:new Map,fetchedBbox:null,currentController:null},s=function(){return J(u,{map:a,dynamicGeoJSON:o,onUpdate:i})},l=(e=s,n=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){return e.apply(void 0,n)},200)},n.cancel=function(){clearTimeout(r),r=null},n),c=function(){l()};return a.on("moveend",c),s(),{destroy:function(){a.off("moveend",c),l.cancel(),u.currentController&&u.currentController.abort()},clear:function(){u.features.clear(),u.fetchedBbox=null,i(o.id,{type:"FeatureCollection",features:[]})},refresh:function(){u.features.clear(),u.fetchedBbox=null,s()},getFeatureCount:function(){return u.features.size},reapply:function(){u.features.size>0&&i(o.id,Z(u.features))}}}({dynamicGeoJSON:t.dynamicGeoJSON,map:o.map,onUpdate:function(t,r){return e.setData(t,r)}});c.set(t.id,r)}}),e.attachDynamicSources(c),u.emit("datasets:ready")});var m=function(){e.onMapSizeChange()};u.on(a.MAP_SIZE_CHANGE,m);var g=u.emitWhenRequested("datasets:registry",$.Q);return u.on("menu:changed",function(t){$.Q.invalidateKeyItemsOnMenuStateChange(t),e.applyGlobalVisibility()}),{remove:function(){u.off(a.MAP_SIZE_CHANGE,m),g(),c.forEach(function(t){return t.destroy()}),c.clear(),e.destroy()},refreshDataset:function(t){var e;null===(e=c.get(t))||void 0===e||e.refresh()},clearDatasetCache:function(t){var e;null===(e=c.get(t))||void 0===e||e.clear()},getFeatureCount:function(t){var e,r;return null!==(e=null===(r=c.get(t))||void 0===r?void 0:r.getFeatureCount())&&void 0!==e?e:null}}},tt=r(7400);function et(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return rt(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(rt(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,rt(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,rt(f,"constructor",l),rt(l,"constructor",s),s.displayName="GeneratorFunction",rt(l,o,"GeneratorFunction"),rt(f),rt(f,o,"Generator"),rt(f,n,function(){return this}),rt(f,"toString",function(){return"[object Generator]"}),(et=function(){return{w:a,m:p}})()}function rt(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}rt=function(t,e,r,n){function a(e,r){rt(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},rt(t,e,r,n)}function nt(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function ot(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){nt(a,n,o,i,u,"next",t)}function u(t){nt(a,n,o,i,u,"throw",t)}i(void 0)})}}var at,it=function(){var t=ot(et().m(function t(e){var n,o,a,i,u;return et().w(function(t){for(;;)switch(t.n){case 0:u=e.name,t.n="MapLibreProvider"===u?1:"EsriProvider"===u?3:5;break;case 1:return t.n=2,r.e(6563).then(r.bind(r,58739));case 2:return n=t.v,o=n.default,t.a(2,o);case 3:return t.n=4,r.e(7067).then(r.bind(r,91566));case 4:return a=t.v,i=a.default,t.a(2,i);case 5:throw new Error("No layer adapter available for map provider ".concat(e.name,". Please provide a compatible layer adapter."));case 6:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),ut={},st=function(){var t=ot(et().m(function t(e,r,n){var o,a,i;return et().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,it(e);case 1:return i=t.v,at=new i(e,r,n),ut.removeDataset=at.removeDataset.bind(at),ut.setData=at.setData.bind(at),ut.applyStyle=at.applyStyle.bind(at),ut.applyDatasetVisibility=at.applyDatasetVisibility.bind(at),ut.applyGlobalVisibility=at.applyGlobalVisibility.bind(at),ut.applyDatasetOpacity=at.applyDatasetOpacity.bind(at),ut.applyGlobalOpacity=at.applyGlobalOpacity.bind(at),ut.addDataset=at.addDataset.bind(at),ut.applyFeatureFilter=at.applyFeatureFilter.bind(at),ut.onMapStyleChange=null===(o=at.onMapStyleChange)||void 0===o?void 0:o.bind(at),ut.onMapSizeChange=null===(a=at.onMapSizeChange)||void 0===a?void 0:a.bind(at),t.a(2,at)}},t)}));return function(e,r,n){return t.apply(this,arguments)}}();function lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function ct(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return ft(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(ft(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ft(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,ft(f,"constructor",l),ft(l,"constructor",s),s.displayName="GeneratorFunction",ft(l,o,"GeneratorFunction"),ft(f),ft(f,o,"Generator"),ft(f,n,function(){return this}),ft(f,"toString",function(){return"[object Generator]"}),(ct=function(){return{w:a,m:p}})()}function ft(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ft=function(t,e,r,n){function a(e,r){ft(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},ft(t,e,r,n)}function pt(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}var yt=function(t,e){var r=t.pluginState.dispatch,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.datasetId,a=n.sublayerId,i=a?"".concat(o,"-").concat(a):o;r(i?{type:"SET_DATASET_VISIBILITY",payload:{datasetId:i,visible:e}}:{type:"SET_GLOBAL_VISIBILITY",payload:{visible:e}})},dt=r(19287),bt=function(t){var e=t.menuGroupItem,r=t.onChange,n=$.Q.getDataset(e.id);if(!n)return null;var o=n.isSublayer?n.parentId:n.id,a=n.isSublayer?n.id:void 0,i="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small".concat(n.visible?"":" im-c-datasets-layers__item--checked");return(0,dt.jsx)("div",{className:i,"data-module":"govuk-checkboxes",children:(0,dt.jsxs)("div",{className:"govuk-checkboxes__item",children:[(0,dt.jsx)("input",{className:"govuk-checkboxes__input",id:n.id,"data-dataset-id":o,"data-sublayer-id":a,name:"layers",type:"checkbox",value:n.id,checked:n.isLocallyVisible,onChange:r}),(0,dt.jsx)("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:n.id,children:n.label})]})},n.id)},vt=function(t){var e=t.menuGroup,r=t.children;return e.groupLabel?(0,dt.jsx)("div",{className:"govuk-form-group im-c-datasets-layers-group",children:(0,dt.jsxs)("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[(0,dt.jsx)("legend",{className:"im-c-datasets-layers-group__legend",children:(0,dt.jsx)("h3",{children:e.groupLabel})}),r]})},e.id):(0,dt.jsx)(dt.Fragment,{children:r})},ht={InitComponent:function(t){var e=t.pluginConfig,r=t.pluginState,n=t.appState,o=t.mapState,a=t.mapProvider,i=t.services,u=r.dispatch,s=i.eventBus,l=i.symbolRegistry,c=i.patternRegistry,f=Boolean(null==a?void 0:a.isBaseMapReady());(0,I.useEffect)(function(){var t=!1!==e.hasMenu&&function(t){return t.datasets.some(function(t){var e;return t.showInMenu||(null===(e=t.sublayers)||void 0===e?void 0:e.some(function(t){return t.showInMenu}))})}(e);t||(s.emitWhenReady(T.APP_REMOVE_PANEL,"datasetsLayers"),s.emitWhenReady(T.APP_TOGGLE_BUTTON_STATE,{id:"datasetsLayers",prop:"hidden",value:!0}))},[e.hasMenu]);var p=(0,I.useRef)(r);p.current=r;var y=(0,I.useRef)(null);return(0,I.useEffect)(function(){var t,r,i,d,b=null===(t=null===(r=e.includeModes)||void 0===r?void 0:r.includes(n.mode))||void 0===t||t,v=null!==(i=null===(d=e.excludeModes)||void 0===d?void 0:d.includes(n.mode))&&void 0!==i&&i;if(f&&b&&!v&&!y.current){var h=function(){var t,r=(t=ct().m(function t(){var r;return ct().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,st(a,l,c);case 1:r=t.v,y.current=X({adapter:r,pluginConfig:e,pluginStateRef:p,mapStyle:o.mapStyle,mapProvider:a,events:T,dispatch:u,eventBus:s});case 2:return t.a(2)}},t)}),function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){pt(a,n,o,i,u,"next",t)}function u(t){pt(a,n,o,i,u,"throw",t)}i(void 0)})});return function(){return r.apply(this,arguments)}}();h()}},[f,n.mode]),(0,I.useEffect)(function(){$.Q.attach(r.mappedDatasets,r.orderedDatasets),s.emit("datasets:changed")},[r.mappedDatasets,r.orderedDatasets]),(0,I.useEffect)(function(){$.Q.attachMapStyle(o.mapStyle),null!=ut&&ut.onMapStyleChange&&ut.onMapStyleChange()},[o.mapStyle]),(0,I.useEffect)(function(){return(0,tt.A3)(r.globals)},[r.globals]),(0,I.useEffect)(function(){var t=r.actionsArray;t.length&&(t.forEach(function(t){var e,r=t.method,n=t.parameters;return ut[r].apply(ut,function(t){if(Array.isArray(t))return lt(t)}(e=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return lt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lt(t,e):void 0}}(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.")}())}),u({type:"REMOVE_ADAPTER_ACTIONS",payload:t}))},[r.actionsArray]),(0,I.useEffect)(function(){return function(){y.current&&(y.current.remove(),y.current=null)}},[]),null},reducer:{initialState:{globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[]},actions:j},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",dismissible:!0,exclusive:!0,width:"260px"},desktop:{slot:"left-top",modal:!1,dismissible:!0,exclusive:!0,width:"280px"},render:function(t){var e=t.pluginState,r=e.menu,n=void 0===r?[]:r,o=function(t){var r=t.target,n=r.value,o=r.checked;yt({pluginState:e},o,{datasetId:n})},a=n.some(function(t){return t.groupLabel}),i="im-c-datasets-layers".concat(a?" im-c-datasets-layers--has-groups":"");return(0,dt.jsx)("div",{className:i,children:n.map(function(t){return(0,dt.jsxs)(vt,{menuGroup:t,children:[" ",t.items.map(function(t){return(0,dt.jsx)(bt,{menuGroupItem:t,onChange:o},t.id)})]},t.id)})})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"></path><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"></path><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"></path>'},{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}],api:{addDataset:function(t,e){(0,t.pluginState.dispatch)({type:"ADD_DATASET",payload:{dataset:e,mapStyle:t.mapState.mapStyle}})},removeDataset:function(t,e){var r=t.pluginState.dispatch;ut.removeDataset(e),r({type:"REMOVE_DATASET",payload:{id:e}})},setDatasetVisibility:yt,setFeatureVisibility:function(t,e,r){var n=t.pluginState.dispatch,o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).datasetId,a=void 0===o?null:o;if(a){var i=$.Q.getDataset(a);!i||i.idProperty||i.generateIds||m.v.warn('setFeatureVisibility: Dataset "'.concat(a,'" has no idProperty or generateIds configured. Features may not be matched correctly. Add idProperty to match by a feature property, or add generateIds: true to use auto-generated IDs.'))}n({type:e?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:a,featureIds:r}})},setStyle:function(t,e){var r=t.pluginState.dispatch,n=t.mapState,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.datasetId,i=o.sublayerId;r({type:"SET_DATASET_STYLE",payload:{datasetId:a=i?"".concat(a,"-").concat(i):a,styleChanges:e,mapStyle:n.mapStyle}})},getStyle:function(t){t._pluginState;var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.datasetId,n=e.sublayerId;r=n?"".concat(r,"-").concat(n):r;var o=$.Q.getDataset(r);return o?o.style:(m.v.warn("getStyle: Dataset with id ".concat(r," not found")),null)},setOpacity:function(t,e){var r=t.pluginState.dispatch,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.datasetId,a=n.sublayerId,i=a?"".concat(o,"-").concat(a):o;r(i?{type:"SET_OPACITY",payload:{datasetId:i,opacity:e}}:{type:"SET_GLOBAL_OPACITY",payload:{opacity:e}})},getOpacity:function(t){var e,r=t.pluginState.globals,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.datasetId,a=n.sublayerId,i=a?"".concat(o,"-").concat(a):o;if(i){var u,s=$.Q.getDataset(i);return s?null!==(u=s.opacity)&&void 0!==u?u:null:(m.v.warn("getOpacity: Dataset with id ".concat(i," not found")),null)}return null!==(e=r.opacity)&&void 0!==e?e:null},setData:function(t,e,r){t._pluginState;var n=r.datasetId,o=$.Q.getDataset(n);o?null!=o&&o.tiles?m.v.warn('setData called on vector tile dataset "'.concat(n,'" — has no effect')):ut.setData(n,e):m.v.warn("setData: Dataset with id ".concat(n," not found"))},setGlobals:function(t,e){var r=t.pluginState.dispatch,n=e.opacityMode,o={},a=!1;n&&(["dataset","global","multiply"].includes(n)?(a=!0,o.opacityMode=n):m.v.warn("Ignoring invalid opacityMode: ".concat(n,". Must be one of 'dataset', 'global' or 'multiply'."))),a?r({type:"SET_GLOBAL_STATE",payload:o}):m.v.warn("setGlobals: requires a valid value for opacityMode to be set")}}}},91954(t,e,r){r.d(e,{j:()=>_});var n=r(83262),o=r(63447),a=r(65767),i=r(41449);function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function l(t,e,r){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function f(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function p(t){var e=function(t){if("object"!=u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==u(e)?e:e+""}var y=f(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e.id,this.url=e.url,this.transformRequest=e.transformRequest,this.maxFeatures=e.maxFeatures,this.minZoom=e.minZoom,this.idProperty=e.idProperty,this.hiddenFeaturesIdExpression=["to-string",["get",this.idProperty]],this.sourceId="geojson-dynamic-".concat(this.id),this.source=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach(function(e){l(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({type:"geojson",data:{type:"FeatureCollection",features:[]}},this.idProperty?{promoteId:this.idProperty}:{generateId:!0})}),d=r(7400);function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function v(t){return function(t){if(Array.isArray(t))return h(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach(function(e){S(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function S(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function D(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function O(t){var e=function(t){if("object"!=b(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==b(e)?e:e+""}var _=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._datasetDefinition=e},(e=[{key:"id",get:function(){return this._datasetDefinition.id}},{key:"label",get:function(){return this._datasetDefinition.label}},{key:"hasSymbol",get:function(){var t;return!this.hasSublayers&&Boolean(null===(t=this.style)||void 0===t?void 0:t.symbol)}},{key:"hasPattern",get:function(){return!this.hasSublayers&&!this.hasSymbol&&(0,i.vY)(this.style)}},{key:"hasFill",get:function(){var t,e;return!this.hasSublayers&&!this.hasSymbol&&(this.hasPattern||(null===(t=this.style)||void 0===t?void 0:t.fill)&&"transparent"!==(null===(e=this.style)||void 0===e?void 0:e.fill))}},{key:"hasStroke",get:function(){var t;return!this.hasSublayers&&!this.hasSymbol&&Boolean(null===(t=this.style)||void 0===t?void 0:t.stroke)}},{key:"tiles",get:function(){return this._datasetDefinition.tiles}},{key:"geojson",get:function(){return this._datasetDefinition.geojson}},{key:"idProperty",get:function(){return this._datasetDefinition.idProperty}},{key:"generateIds",get:function(){return this._datasetDefinition.generateIds}},{key:"parentId",get:function(){return this._datasetDefinition.parentId}},{key:"minZoom",get:function(){var t;return this._datasetDefinition.minZoom||(null===(t=this.parent)||void 0===t?void 0:t.minZoom)}},{key:"maxZoom",get:function(){var t;return this._datasetDefinition.maxZoom||(null===(t=this.parent)||void 0===t?void 0:t.maxZoom)}},{key:"type",get:function(){var t;return this._datasetDefinition.type||(null===(t=this.parent)||void 0===t?void 0:t.type)}},{key:"showInKey",get:function(){var t,e,r=this._datasetDefinition.showInKey;return void 0!==r?r:null!==(t=null===(e=this.parent)||void 0===e?void 0:e.showInKey)&&void 0!==t&&t}},{key:"visibleWhen",get:function(){var t;return void 0===this._datasetDefinition.visibleWhen?null===(t=this.parent)||void 0===t?void 0:t.visibleWhen:this._datasetDefinition.visibleWhen}},{key:"groupLabel",get:function(){var t,e;return this._datasetDefinition.groupLabel||(null===(t=this.parent)||void 0===t?void 0:t.groupLabel)||(null===(e=this.parent)||void 0===e?void 0:e.label)}},{key:"groupId",get:function(){var t;return this._datasetDefinition.groupId||(null===(t=this.parent)||void 0===t?void 0:t.groupId)||(this.groupLabel?this.groupLabel.toLowerCase().replace(/\s+/g,"-"):null)}},{key:"opacity",get:function(){var t,e,r=null===(t=this.style)||void 0===t?void 0:t.opacity,n=null===(e=this.parent)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.opacity;return(0,d.ob)(r,n)}},{key:"hasDynamicGeoJSON",get:function(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}},{key:"dynamicGeoJSON",get:function(){return new y(g(g({},this._datasetDefinition.dynamicGeoJSON),{},{id:this.id,minZoom:this.minZoom}))}},{key:"hiddenFeatures",get:function(){return this._datasetDefinition.hiddenFeatures}},{key:"hasHiddenFeatures",get:function(){var t,e;return Boolean((null===(t=this.hiddenFeatures)||void 0===t?void 0:t.length)>0||(null===(e=this.parent)||void 0===e?void 0:e.hasHiddenFeatures))}},{key:"filter",get:function(){return null}},{key:"isHiddenByInheritance",get:function(){var t;return this.isSublayer?!(null!==(t=this.parent)&&void 0!==t&&t.visible):!(0,d.uA)()}},{key:"isLocallyVisible",get:function(){return!!this.isVisible||this._datasetDefinition.visible}},{key:"visible",get:function(){var t;return this.isSublayer?this._datasetDefinition.visible&&(null===(t=this.parent)||void 0===t?void 0:t.visible):this._datasetDefinition.visible&&(0,d.uA)()}},{key:"esriStyleLayerId",get:function(){return this._datasetDefinition.esriStyleLayerId}},{key:"visibility",get:function(){var t=this.visible,e=this.visibleWhen;return t&&e?(0,o.DV)(e)?"visible":"none":t?"visible":"none"}},{key:"keyVisibility",get:function(){return this.showInKey&&"visible"===this.visibility}},{key:"symbolAnchor",get:function(){var t,e;return null!==(t=this.style)&&void 0!==t&&t.symbolAnchor?this.style.symbolAnchor:null===(e=this.parent)||void 0===e?void 0:e.symbolAnchor}},{key:"sourceLayer",get:function(){return this.isSublayer?this.parent.sourceLayer:this.tiles?this._datasetDefinition.sourceLayer:void 0}},{key:"isSublayer",get:function(){return Boolean(this._datasetDefinition.parentId)}},{key:"hasSublayers",get:function(){var t;return(null===(t=this._datasetDefinition.sublayerIds)||void 0===t?void 0:t.length)>0}},{key:"sublayerIds",get:function(){return this._datasetDefinition.sublayerIds}},{key:"sublayers",get:function(){var t=this.sublayerIds;return t?t.map(function(t){return n.Q.getDataset(t)}):[]}},{key:"parent",get:function(){if(this._datasetDefinition.parentId)return n.Q.getDataset(this._datasetDefinition.parentId)}},{key:"style",get:function(){var t,e=null===(t=this.parent)||void 0===t?void 0:t.style;return e?g(g(g({},e),{},{opacity:void 0},this._datasetDefinition.style),{},{symbolDescription:this.symbolDescription}):this._datasetDefinition.style||{}}},{key:"hasCustomVisualStyle",get:function(){return(0,a.p_)(this._datasetDefinition.style||{})}},{key:"symbolDescription",get:function(){var t,e;return null!==(t=this._datasetDefinition.style)&&void 0!==t&&t.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle||null===(e=this.parent)||void 0===e?void 0:e.symbolDescription}},{key:"patternConfigs",get:function(){var t=this.hasPattern?[this.style]:[];return this.hasSublayers?[].concat(t,v(this.sublayers.flatMap(function(t){return t.patternConfigs}))):t}},{key:"symbolConfigs",get:function(){var t=this.hasSymbol?[this.style]:[];return this.hasSublayers?[].concat(t,v(this.sublayers.flatMap(function(t){return t.symbolConfigs}))):t}},{key:"keyDefinition",get:function(){return{id:this.id,type:"dataset",label:this.label,hasSymbol:this.hasSymbol,hasPattern:this.hasPattern,style:this.style,symbolDescription:this.symbolDescription}}}])&&D(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},83262(t,e,r){r.d(e,{Q:()=>b});var n=r(91954);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}var s=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.idToDefinitionMap=new Map,this.definitionToInstanceMap=new Map},(e=[{key:"add",value:function(t){this.idToDefinitionMap.set(t.id,t._datasetDefinition),this.definitionToInstanceMap.set(t._datasetDefinition,t)}},{key:"invalidateDataset",value:function(t){var e=this,r=this.idToDefinitionMap.get(t.id);[r.id].concat(function(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((null==r?void 0:r.sublayerIds)||[])).forEach(function(t){var r=e.idToDefinitionMap.get(t);e.definitionToInstanceMap.delete(r),e.idToDefinitionMap.delete(t)})}},{key:"invalidateChangedDatasets",value:function(t){var e=this;t.forEach(function(t){var r=e.idToDefinitionMap.get(t.id);if(r&&r!==t){var n=e.definitionToInstanceMap.get(r);e.invalidateDataset(n.isSublayer&&n.parent?n.parent:n)}})}},{key:"getByDefinition",value:function(t){return this.definitionToInstanceMap.get(t)}}])&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function c(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function d(t,e,r){return(e=function(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var b={attach:function(t,e,r){this._datasets=t,this._orderedDatasets=e,this.attachMapStyle(r),this._invalidateChangedDatasets()},_definitionCache:new s,_invalidateCache:function(){this._definitionCache=new s},_invalidateChangedDatasets:function(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset:function(t){this._createDataset=t},_createDataset:function(t){return function(t){return new n.j(t)}(t)},attachMapStyle:function(t){t&&(this._mapStyle=t)},get mapStyle(){return this._mapStyle},getDataset:function(t){var e=this.datasets[t];if(e){var r=this._definitionCache.getByDefinition(e);if(r)return r;var n=this._createDataset(e);return this._definitionCache.add(n),n.isSublayer&&this.getDataset(n.parentId),n}},forEach:function(t){var e=this;this._orderedDatasets.forEach(function(r){return t(e.getDataset(r))})},forEachDataset:function(t){var e=this;Object.values(this.datasets).filter(function(t){return!t.parentId}).forEach(function(r){return t(e.getDataset(r.id))})},topLevelDatasets:function(){var t=this;return Object.values(this.datasets).filter(function(t){return!t.parentId}).map(function(e){return t.getDataset(e.id)})},getPatternAndSymbolConfigs:function(){return this.topLevelDatasets().reduce(function(t,e){return y(y({},t),{},{patternConfigs:[].concat(c(t.patternConfigs),c(e.patternConfigs)),symbolConfigs:[].concat(c(t.symbolConfigs),c(e.symbolConfigs))})},{patternConfigs:[],symbolConfigs:[]})},_lastMenuState:{},invalidateKeyItemsOnMenuStateChange:function(t){t!==this._lastMenuState&&(this._lastMenuState=t,this._lastKeyItemsDatasets=null)},_lastKeyItems:{},keyItems:function(){if(this.datasets===this._lastKeyItemsDatasets)return this._lastKeyItems;this._lastKeyItemsDatasets=this.datasets;var t=[],e=new Map;this.forEach(function(r){if(r.keyVisibility)if(r.hasSublayers||r.groupLabel){var n=r.groupId,o=function(r,n){if(e.has(r))return e.get(r);var o={type:"group",id:n,groupLabel:r,keyDefinitions:[]};return e.set(r,o),t.push(o),o}(r.groupLabel||r.label,n);r.hasSublayers||o.keyDefinitions.push(r.keyDefinition)}else t.push({type:"flat",id:r.id,keyDefinition:r.keyDefinition})});var r=t.filter(function(t){var e;return"flat"===t.type||Boolean(null===(e=t.keyDefinitions)||void 0===e?void 0:e.length)}),n=r.some(function(t){return"group"===t.type});return this._lastKeyItems={items:r,hasGroups:n},this._lastKeyItems}};Object.defineProperty(b,"datasets",{get:function(){return b._datasets}})},7400(t,e,r){r.d(e,{A3:()=>o,ob:()=>a,uA:()=>i});var n={},o=function(t){n=t},a=function(t,e){switch(n.opacityMode){case"global":return n.opacity;case"multiply":return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.round(100*(t*e*n.opacity+Number.EPSILON))/100}(t,e);default:return function(t,e){return void 0===t?void 0===e?n.opacity:e:t}(t,e)}},i=function(){return n.visible}},63447(t,e,r){r.d(e,{DV:()=>p,vf:()=>s});var n=r(83262);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,u=[],s=!0,l=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){l=!0,o=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var u={},s=function(t){u=t},l=function(t){for(var e,r=(null===(e=u)||void 0===e||null===(e=e.current)||void 0===e?void 0:e.menuState)||{},n=0,o=Object.entries(t);n<o.length;n++){var i=a(o[n],2),s=i[0],l=i[1],c=r[s];if(!l.includes(c))return!1}return!0},c=function(t){return(Array.isArray(t)?t:[t]).includes(f())},f=function(){return n.Q.mapStyle.id},p=function(t){if(null==t)return!0;if("boolean"==typeof t)return t;if("object"===o(t)){for(var e=0,r=Object.entries(t);e<r.length;e++){var n=a(r[e],2),i=n[0],u=n[1];if("mapStyleId"===i&&!c(u))return!1;if("menu"===i&&!l(u))return!1}return!0}return!0}},97619(t,e,r){r.d(e,{v:()=>o});var n="[interactive-map]",o={warn:function(){for(var t,e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return(t=console).warn.apply(t,[n].concat(r))},error:function(){for(var t,e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return(t=console).error.apply(t,[n].concat(r))}}},41449(t,e,r){function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}r.d(e,{YZ:()=>o,vY:()=>a});var o=function(t){var e,r=0,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,a=function(){};return{s:a,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){s=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw i}}}}(t);try{for(o.s();!(e=o.n()).done;){var a=e.value;r=Math.trunc((r<<5)-r+a.codePointAt(0))}}catch(t){o.e(t)}finally{o.f()}return Math.abs(r).toString(36)},a=function(t){return!(!t.fillPattern&&!t.fillPatternSvgContent)}}}]);
2
+ "use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[2447],{65767(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function i(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.d(e,{V:()=>u,jE:()=>p,ns:()=>f,p_:()=>c});var u={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},s=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription","keySymbolShape","symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"],l=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],c=function(t){return l.some(function(e){return e in t})},f=function(t,e){var r=t.style||{},n=a(a({},e.style),r);!("symbolDescription"in r)&&c(r)&&delete n.symbolDescription;var o=a({},t);delete o.style,s.forEach(function(t){return delete o[t]});var i=a({},e);return delete i.style,a(a(a({},i),o),n)},p=function(t){!0!==t.visible&&!1!==t.visible&&(t.visible="hidden"!==t.visibility);var e=a(a(a({},u),t),{},{style:a(a({},u.style),t.style)}),r=t.style||{};return!("symbolDescription"in r)&&c(r)&&delete e.style.symbolDescription,s.forEach(function(t){return delete e[t]}),e}},11973(t,e,r){function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function i(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}r.r(e),r.d(e,{manifest:()=>ht});var l=function(t){var e=t.datasets,r=[],n=(void 0===e?[]:e).filter(function(t){var e;return t.showInMenu||(null===(e=t.sublayers)||void 0===e?void 0:e.some(function(t){return t.showInMenu}))}),o=new Map;return n.forEach(function(t){var e;if(null!==(e=t.sublayers)&&void 0!==e&&e.length){var n=t.sublayers.filter(function(e){return t.showInMenu?!1!==e.showInMenu:e.showInMenu});if(!1===t.showInMenu&&!n.length)return;var a={id:t.id,groupLabel:t.label,visibleWhen:!0,type:"checkbox",items:n.map(function(e){return{id:"".concat(t.id,"-").concat(e.id),label:e.label}})};0===a.items.length&&(delete a.groupLabel,a.items.push({id:t.id,label:t.label})),r.push(a)}else if(t.groupLabel){var i=o.has(t.groupLabel)?o.get(t.groupLabel):{id:t.groupLabel,groupLabel:t.groupLabel,visibleWhen:!0,type:"checkbox",items:[]};o.has(t.groupLabel)||(o.set(t.groupLabel,i),r.push(i)),i.items.push({id:t.id,label:t.label})}else r.push({visibleWhen:!0,type:"checkbox",id:t.id,items:[{id:t.id,label:t.label}]})}),r},c=function(t,e){return t.reduce(function(t,r){var n=r.items.filter(function(t){return!e.includes(t.id)});return n.length&&t.push(a(a({},r),{},{items:n})),t},[])},f=r(65767);function p(t){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},p(t)}function y(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?y(Object(r),!0).forEach(function(e){b(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function b(t,e,r){return(e=function(t){var e=function(t){if("object"!=p(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=p(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==p(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var v=function(t,e){var r,n=e.id,o=(0,f.jE)(e);e.parentId&&("showInKey"in e||delete o.showInKey,"showInMenu"in e||delete o.showInMenu),t[n]=o;var a=t.orderedDatasets;a.push(n);var i=null===(r=e.sublayers)||void 0===r?void 0:r.map(function(t){return function(t,e){var r="".concat(t,"-").concat(e.id),n=e.id;return"hidden"!==e.visibility&&(e.visibility="visible"),d(d({},e),{},{id:r,parentId:t,sublayerId:n})}(n,t)});if(null!=i&&i.length){var u=null==i?void 0:i.map(function(t){return t.id}),s=null==i?void 0:i.reduce(v,{orderedDatasets:a});return t[n].sublayerIds=u,delete t[n].sublayers,d(d(d({},t),s),{},{orderedDatasets:a})}return d(d({},t),{},{orderedDatasets:a})},h=function(t){var e=(t.datasets||[]).reduce(v,{orderedDatasets:[]}),r=e.orderedDatasets;return delete e.orderedDatasets,d(d({},t),{},{mappedDatasets:e,orderedDatasets:r})},m=r(97619);function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function S(t){return function(t){if(Array.isArray(t))return D(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return D(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?D(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function O(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function _(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?O(Object(r),!0).forEach(function(e){A(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function A(t,e,r){return(e=function(t){var e=function(t){if("object"!=g(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==g(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var P=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"not found";return!!t.mappedDatasets[e]||(m.v.error("".concat(r,": Dataset with id '").concat(e,"' ").concat(n)),!1)},w=0,E=function(t,e,r){return w=r.actionsArray.length?w+1:0,_(_({},r),{},{actionsArray:[].concat(S(r.actionsArray),[{method:t,parameters:e,actionId:w}])})},j={SET_DATASETS:function(t,e){var r=e.mappedDatasets,n=e.orderedDatasets;return _(_({},t),{},{mappedDatasets:r,orderedDatasets:n})},ADD_DATASET:function(t,e){var r=e.dataset,n=e.mapStyle;if(t.mappedDatasets[r.id])return m.v.error("addDataset: Dataset with id '".concat(r.id,"' already exists")),t;var o=h({datasets:[r]}),a=o.mappedDatasets,i=o.orderedDatasets,s=function(t,e){var r,n=u(t.menu),o=l({datasets:[e]}),a=n.find(function(t){return t.groupLabel===o[0].groupLabel});return a?(r=a.items).push.apply(r,u(o[0].items)):n.push.apply(n,u(o)),n}(t,r);return E("addDataset",[r.id,n],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),a),orderedDatasets:[].concat(S(t.orderedDatasets),S(i)),menu:s}))},REMOVE_DATASET:function(t,e){var r,n=e.id;if(!P(t,n,"removeDataset"))return t;var o=_({},t.mappedDatasets),a=[n].concat(S((null===(r=o[n])||void 0===r?void 0:r.sublayerIds)||[]));a.forEach(function(t){return delete o[t]});var i=t.orderedDatasets.filter(function(t){return!a.includes(t)});return _(_({},t),{},{mappedDatasets:o,orderedDatasets:i,menu:c(t.menu,a)})},SET_DATASET_VISIBILITY:function(t,e){var r=e.datasetId,n=e.visible;return P(t,r,"setDatasetVisibility")?t.mappedDatasets[r].visible===n?t:E("applyDatasetVisibility",[r,n],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,_(_({},t.mappedDatasets[r]),{},{visible:n})))})):t},SET_GLOBAL_VISIBILITY:function(t,e){var r=e.visible;return E("applyGlobalVisibility",[r],_(_({},t),{},{globals:_(_({},t.globals),{},{visible:r})}))},SET_DATASET_STYLE:function(t,e){var r=e.datasetId,n=e.styleChanges,o=e.mapStyle;if(!P(t,r,"setDatasetStyle"))return t;var a=_(_({},t.mappedDatasets[r].style),n),i=_(_(_({},t.mappedDatasets[r]),n),{},{style:a});return E("applyStyle",[r,o],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,i))}))},SET_OPACITY:function(t,e){var r=e.datasetId,n=e.opacity;if(!P(t,r,"setOpacity"))return t;var o=_(_({},t.mappedDatasets[r].style),{},{opacity:n}),a=_(_({},t.mappedDatasets[r]),{},{style:o});return E("applyDatasetOpacity",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,a))}))},SET_GLOBAL_OPACITY:function(t,e){var r=e.opacity;return E("applyGlobalOpacity",[],_(_({},t),{},{globals:_(_({},t.globals),{},{opacity:r})}))},HIDE_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!P(t,r,"setFeatureVisibility - hideFeatures"))return t;var o=_({},t.mappedDatasets[r]),a=o.hiddenFeatures||[],i=Array.from(new Set([].concat(S(a),S(n))));return o.hiddenFeatures=i,E("applyFeatureFilter",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,o))}))},SHOW_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!P(t,r,"setFeatureVisibility - showFeatures"))return t;var o=_({},t.mappedDatasets[r]),a=(o.hiddenFeatures||[]).filter(function(t){return!n.includes(t)});return o.hiddenFeatures=a.length?a:[-1],E("applyFeatureFilter",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,o))}))},REMOVE_ADAPTER_ACTIONS:function(t,e){return null!=e&&e.length?_(_({},t),{},{actionsArray:t.actionsArray.filter(function(t){return!e.includes(t)})}):t},SET_GLOBAL_STATE:function(t,e){return E("applyGlobalOpacity",[],_(_({},t),{},{globals:_(_({},t.globals),e)}))},SET_MENU:function(t,e){var r=e.menu;return _(_({},t),{},{menu:r})}},I=r(51738),T={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",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_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",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"};function M(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return k(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(k(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,k(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,k(f,"constructor",l),k(l,"constructor",s),s.displayName="GeneratorFunction",k(l,o,"GeneratorFunction"),k(f),k(f,o,"Generator"),k(f,n,function(){return this}),k(f,"toString",function(){return"[object Generator]"}),(M=function(){return{w:a,m:p}})()}function k(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}k=function(t,e,r,n){function a(e,r){k(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},k(t,e,r,n)}function C(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}var L=function(){var t,e=(t=M().m(function t(e,r,n,o){var a,i,u,s,l,c,f;return M().w(function(t){for(;;)switch(t.n){case 0:return a=n(e,r),u=(i="string"==typeof a?{url:a}:a).url,s=i.headers,l=void 0===s?{}:s,t.n=1,fetch(u,{headers:l,signal:o});case 1:if((c=t.v).ok){t.n=2;break}throw new Error("Failed to fetch GeoJSON: ".concat(c.status," ").concat(c.statusText));case 2:return t.n=3,c.json();case 3:if("FeatureCollection"!==(f=t.v).type){t.n=4;break}return t.a(2,f);case 4:if("Feature"!==f.type){t.n=5;break}return t.a(2,{type:"FeatureCollection",features:[f]});case 5:if(!Array.isArray(f)){t.n=6;break}return t.a(2,{type:"FeatureCollection",features:f});case 6:throw new Error("Invalid GeoJSON response");case 7:return t.a(2)}},t)}),function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){C(a,n,o,i,u,"next",t)}function u(t){C(a,n,o,i,u,"throw",t)}i(void 0)})});return function(t,r,n,o){return e.apply(this,arguments)}}();function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var G=function(t){var e=t.getBounds();return[e.getWest(),e.getSouth(),e.getEast(),e.getNorth()]},F=function(t,e){return!(!t||!e)&&e[0]>=t[0]&&e[1]>=t[1]&&e[2]<=t[2]&&e[3]<=t[3]},N=function(t,e){return t?[Math.min(t[0],e[0]),Math.min(t[1],e[1]),Math.max(t[2],e[2]),Math.max(t[3],e[3])]:function(t){if(Array.isArray(t))return x(t)}(r=e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||function(t,e){if(t){if("string"==typeof t)return x(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}(r)||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.")}();var r},R=function(t,e){return!(!t||!e||t[2]<e[0]||t[0]>e[2]||t[3]<e[1]||t[1]>e[3])},V=function(t){var e=1/0,r=1/0,n=-1/0,o=-1/0,a=function(t,i){var u;0===i?(u=t,e=Math.min(e,u[0]),r=Math.min(r,u[1]),n=Math.max(n,u[0]),o=Math.max(o,u[1])):t.forEach(function(t){return a(t,i-1)})};switch(t.type){case"Point":a(t.coordinates,0);break;case"LineString":case"MultiPoint":a(t.coordinates,1);break;case"Polygon":case"MultiLineString":a(t.coordinates,2);break;case"MultiPolygon":a(t.coordinates,3);break;case"GeometryCollection":t.geometries.forEach(function(t){var a=V(t);e=Math.min(e,a[0]),r=Math.min(r,a[1]),n=Math.max(n,a[2]),o=Math.max(o,a[3])});break;default:throw new Error("Unsupported geometry type: ".concat(t.type))}return[e,r,n,o]};function B(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return U(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(U(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,U(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,U(f,"constructor",l),U(l,"constructor",s),s.displayName="GeneratorFunction",U(l,o,"GeneratorFunction"),U(f),U(f,o,"Generator"),U(f,n,function(){return this}),U(f,"toString",function(){return"[object Generator]"}),(B=function(){return{w:a,m:p}})()}function U(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}U=function(t,e,r,n){function a(e,r){U(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},U(t,e,r,n)}function K(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function W(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,u=[],s=!0,l=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){l=!0,o=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(t,e)||H(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(t,e){if(t){if("string"==typeof t)return Y(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Y(t,e):void 0}}function Y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Z=function(t){return{type:"FeatureCollection",features:Array.from(t.values()).map(function(t){return t.feature})}},Q=function(t,e,r){if(r&&!(t.size<=1.2*r)){var n,o=r,a=[],i=[],u=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=H(t))){e&&(t=e);var r=0,n=function(){};return{s:n,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,i=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){i=!0,o=t},f:function(){try{a||null==e.return||e.return()}finally{if(i)throw o}}}}(t);try{for(u.s();!(n=u.n()).done;){var s=W(n.value,2),l=s[0],c=s[1];R(c.bbox,e)?a.push(l):i.push({id:l,lastSeenAt:c.lastSeenAt})}}catch(t){u.e(t)}finally{u.f()}i.sort(function(t,e){return t.lastSeenAt-e.lastSeenAt});for(var f=t.size-o,p=0;p<f&&p<i.length;p++)t.delete(i[p].id);if(t.size>o)for(var y=t.size-o,d=a.map(function(e){return{id:e,lastSeenAt:t.get(e).lastSeenAt}}).sort(function(t,e){return t.lastSeenAt-e.lastSeenAt}),b=0;b<y&&b<d.length;b++)t.delete(d[b].id)}},z=function(t,e,r){var n=Date.now();e.features.forEach(function(e){var o=function(t,e){var r,n;return e&&null!==(r=null===(n=t.properties)||void 0===n?void 0:n[e])&&void 0!==r?r:t.id}(e,r);null!=o?t.set(o,{feature:e,bbox:V(e.geometry),lastSeenAt:n}):console.warn("Feature missing ID, skipping:",e)})},J=function(){var t,e=(t=B().m(function t(e,r){var n,o,a,i,u,s,l,c,f,p,y,d,b,v,h;return B().w(function(t){for(;;)switch(t.p=t.n){case 0:if(n=r.map,o=r.dynamicGeoJSON,a=r.onUpdate,i=o.url,u=o.idProperty,s=o.transformRequest,l=o.maxFeatures,c=o.minZoom,f=void 0===c?0:c,!((p=n.getZoom())<f)){t.n=1;break}return t.a(2);case 1:if(y=G(n),!e.fetchedBbox||!F(e.fetchedBbox,y)){t.n=2;break}return t.a(2);case 2:return e.currentController&&e.currentController.abort(),e.currentController=new AbortController,t.p=3,d={bbox:y,zoom:p},t.n=4,L(i,d,s,e.currentController.signal);case 4:b=t.v,z(e.features,b,u),e.fetchedBbox=N(e.fetchedBbox,y),v=e.features.size,Q(e.features,y,l),e.features.size<v&&(e.fetchedBbox=y),a(o.id,Z(e.features)),t.n=7;break;case 5:if(t.p=5,"AbortError"!==(h=t.v).name){t.n=6;break}return t.a(2);case 6:console.error("Failed to fetch dynamic GeoJSON for ".concat(o.id,":"),h);case 7:return t.a(2)}},t,null,[[3,5]])}),function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){K(a,n,o,i,u,"next",t)}function u(t){K(a,n,o,i,u,"throw",t)}i(void 0)})});return function(t,r){return e.apply(this,arguments)}}(),$=r(83262),q=r(63447),X=function(t){var e=t.adapter,r=t.pluginConfig,n=t.mapStyle,o=t.mapProvider,a=t.events,i=t.dispatch,u=t.eventBus,s=r.datasets,c=new Map;r.globals&&i({type:"SET_GLOBAL_STATE",payload:r.globals});var p=s.map(function(t){return(0,f.ns)(t,f.V)}),y=h({datasets:s}),d=y.mappedDatasets,b=y.orderedDatasets;e.createDataset&&$.Q.attachCreateDataset(e.createDataset),$.Q.attach(d,b,n);var v=l({datasets:p});u.requestOnce("menu:state",q.vf),i({type:"SET_MENU",payload:{menu:v}}),i({type:"SET_DATASETS",payload:{mappedDatasets:d,orderedDatasets:b}}),e.init().then(function(){$.Q.forEachDataset(function(t){if(t.hasDynamicGeoJSON){var r=function(t){var e,r,n,o=t.dynamicGeoJSON,a=t.map,i=t.onUpdate,u={features:new Map,fetchedBbox:null,currentController:null},s=function(){return J(u,{map:a,dynamicGeoJSON:o,onUpdate:i})},l=(e=s,n=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){return e.apply(void 0,n)},200)},n.cancel=function(){clearTimeout(r),r=null},n),c=function(){l()};return a.on("moveend",c),s(),{destroy:function(){a.off("moveend",c),l.cancel(),u.currentController&&u.currentController.abort()},clear:function(){u.features.clear(),u.fetchedBbox=null,i(o.id,{type:"FeatureCollection",features:[]})},refresh:function(){u.features.clear(),u.fetchedBbox=null,s()},getFeatureCount:function(){return u.features.size},reapply:function(){u.features.size>0&&i(o.id,Z(u.features))}}}({dynamicGeoJSON:t.dynamicGeoJSON,map:o.map,onUpdate:function(t,r){return e.setData(t,r)}});c.set(t.id,r)}}),e.attachDynamicSources(c),u.emit("datasets:ready")});var m=function(){e.onMapSizeChange()};u.on(a.MAP_SIZE_CHANGE,m);var g=u.emitWhenRequested("datasets:registry",$.Q);return u.on("menu:changed",function(t){$.Q.invalidateKeyItemsOnMenuStateChange(t),e.applyGlobalVisibility()}),{remove:function(){u.off(a.MAP_SIZE_CHANGE,m),g(),c.forEach(function(t){return t.destroy()}),c.clear(),e.destroy()},refreshDataset:function(t){var e;null===(e=c.get(t))||void 0===e||e.refresh()},clearDatasetCache:function(t){var e;null===(e=c.get(t))||void 0===e||e.clear()},getFeatureCount:function(t){var e,r;return null!==(e=null===(r=c.get(t))||void 0===r?void 0:r.getFeatureCount())&&void 0!==e?e:null}}},tt=r(7400);function et(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return rt(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(rt(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,rt(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,rt(f,"constructor",l),rt(l,"constructor",s),s.displayName="GeneratorFunction",rt(l,o,"GeneratorFunction"),rt(f),rt(f,o,"Generator"),rt(f,n,function(){return this}),rt(f,"toString",function(){return"[object Generator]"}),(et=function(){return{w:a,m:p}})()}function rt(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}rt=function(t,e,r,n){function a(e,r){rt(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},rt(t,e,r,n)}function nt(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}function ot(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){nt(a,n,o,i,u,"next",t)}function u(t){nt(a,n,o,i,u,"throw",t)}i(void 0)})}}var at,it=function(){var t=ot(et().m(function t(e){var n,o,a,i,u;return et().w(function(t){for(;;)switch(t.n){case 0:u=e.name,t.n="MapLibreProvider"===u?1:"EsriProvider"===u?3:5;break;case 1:return t.n=2,r.e(6563).then(r.bind(r,58739));case 2:return n=t.v,o=n.default,t.a(2,o);case 3:return t.n=4,r.e(7067).then(r.bind(r,91566));case 4:return a=t.v,i=a.default,t.a(2,i);case 5:throw new Error("No layer adapter available for map provider ".concat(e.name,". Please provide a compatible layer adapter."));case 6:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),ut={},st=function(){var t=ot(et().m(function t(e,r,n){var o,a,i;return et().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,it(e);case 1:return i=t.v,at=new i(e,r,n),ut.removeDataset=at.removeDataset.bind(at),ut.setData=at.setData.bind(at),ut.applyStyle=at.applyStyle.bind(at),ut.applyDatasetVisibility=at.applyDatasetVisibility.bind(at),ut.applyGlobalVisibility=at.applyGlobalVisibility.bind(at),ut.applyDatasetOpacity=at.applyDatasetOpacity.bind(at),ut.applyGlobalOpacity=at.applyGlobalOpacity.bind(at),ut.addDataset=at.addDataset.bind(at),ut.applyFeatureFilter=at.applyFeatureFilter.bind(at),ut.onMapStyleChange=null===(o=at.onMapStyleChange)||void 0===o?void 0:o.bind(at),ut.onMapSizeChange=null===(a=at.onMapSizeChange)||void 0===a?void 0:a.bind(at),t.a(2,at)}},t)}));return function(e,r,n){return t.apply(this,arguments)}}();function lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function ct(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var s=n&&n.prototype instanceof u?n:u,l=Object.create(s.prototype);return ft(l,"_invoke",function(r,n,o){var a,u,s,l=0,c=o||[],f=!1,p={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return a=e,u=0,s=t,p.n=r,i}};function y(r,n){for(u=r,s=n,e=0;!f&&l&&!o&&e<c.length;e++){var o,a=c[e],y=p.p,d=a[2];r>3?(o=d===n)&&(s=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=y&&((o=r<2&&y<a[1])?(u=0,p.v=n,p.n=a[1]):y<d&&(o=r<3||a[0]>n||n>d)&&(a[4]=r,a[5]=n,p.n=d,u=0))}if(o||r>1)return i;throw f=!0,n}return function(o,c,d){if(l>1)throw TypeError("Generator is already running");for(f&&1===c&&y(c,d),u=c,s=d;(e=u<2?t:s)||!f;){a||(u?u<3?(u>1&&(p.n=-1),y(u,s)):p.n=s:p.v=s);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(s=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=p.n<0)?s:r.call(n,p))!==i)break}catch(e){a=t,u=1,s=e}finally{l=1}}return{value:e,done:f}}}(r,o,a),!0),l}var i={};function u(){}function s(){}function l(){}e=Object.getPrototypeOf;var c=[][n]?e(e([][n]())):(ft(e={},n,function(){return this}),e),f=l.prototype=u.prototype=Object.create(c);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,ft(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,ft(f,"constructor",l),ft(l,"constructor",s),s.displayName="GeneratorFunction",ft(l,o,"GeneratorFunction"),ft(f),ft(f,o,"Generator"),ft(f,n,function(){return this}),ft(f,"toString",function(){return"[object Generator]"}),(ct=function(){return{w:a,m:p}})()}function ft(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ft=function(t,e,r,n){function a(e,r){ft(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(a("next",0),a("throw",1),a("return",2))},ft(t,e,r,n)}function pt(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}var yt=function(t,e){var r=t.pluginState.dispatch,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.datasetId,a=n.sublayerId,i=a?"".concat(o,"-").concat(a):o;r(i?{type:"SET_DATASET_VISIBILITY",payload:{datasetId:i,visible:e}}:{type:"SET_GLOBAL_VISIBILITY",payload:{visible:e}})},dt=r(19287),bt=function(t){var e=t.menuGroupItem,r=t.onChange,n=$.Q.getDataset(e.id);if(!n)return null;var o=n.isSublayer?n.parentId:n.id,a=n.isSublayer?n.id:void 0,i="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small".concat(n.visible?"":" im-c-datasets-layers__item--checked");return(0,dt.jsx)("div",{className:i,"data-module":"govuk-checkboxes",children:(0,dt.jsxs)("div",{className:"govuk-checkboxes__item",children:[(0,dt.jsx)("input",{className:"govuk-checkboxes__input",id:n.id,"data-dataset-id":o,"data-sublayer-id":a,name:"layers",type:"checkbox",value:n.id,checked:n.isLocallyVisible,onChange:r}),(0,dt.jsx)("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:n.id,children:n.label})]})},n.id)},vt=function(t){var e=t.menuGroup,r=t.children;return e.groupLabel?(0,dt.jsx)("div",{className:"govuk-form-group im-c-datasets-layers-group",children:(0,dt.jsxs)("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[(0,dt.jsx)("legend",{className:"im-c-datasets-layers-group__legend",children:(0,dt.jsx)("h3",{children:e.groupLabel})}),r]})},e.id):(0,dt.jsx)(dt.Fragment,{children:r})},ht={InitComponent:function(t){var e=t.pluginConfig,r=t.pluginState,n=t.appState,o=t.mapState,a=t.mapProvider,i=t.services,u=r.dispatch,s=i.eventBus,l=i.symbolRegistry,c=i.patternRegistry,f=Boolean(null==a?void 0:a.isBaseMapReady());(0,I.useEffect)(function(){var t=!1!==e.hasMenu&&function(t){return t.datasets.some(function(t){var e;return t.showInMenu||(null===(e=t.sublayers)||void 0===e?void 0:e.some(function(t){return t.showInMenu}))})}(e);t||(s.emitWhenReady(T.APP_REMOVE_PANEL,"datasetsLayers"),s.emitWhenReady(T.APP_TOGGLE_BUTTON_STATE,{id:"datasetsLayers",prop:"hidden",value:!0}))},[e.hasMenu]);var p=(0,I.useRef)(r);p.current=r;var y=(0,I.useRef)(null);return(0,I.useEffect)(function(){var t,r,i,d,b=null===(t=null===(r=e.includeModes)||void 0===r?void 0:r.includes(n.mode))||void 0===t||t,v=null!==(i=null===(d=e.excludeModes)||void 0===d?void 0:d.includes(n.mode))&&void 0!==i&&i;if(f&&b&&!v&&!y.current){var h=function(){var t,r=(t=ct().m(function t(){var r;return ct().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,st(a,l,c);case 1:r=t.v,y.current=X({adapter:r,pluginConfig:e,pluginStateRef:p,mapStyle:o.mapStyle,mapProvider:a,events:T,dispatch:u,eventBus:s});case 2:return t.a(2)}},t)}),function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){pt(a,n,o,i,u,"next",t)}function u(t){pt(a,n,o,i,u,"throw",t)}i(void 0)})});return function(){return r.apply(this,arguments)}}();h()}},[f,n.mode]),(0,I.useEffect)(function(){$.Q.attach(r.mappedDatasets,r.orderedDatasets),s.emit("datasets:changed")},[r.mappedDatasets,r.orderedDatasets]),(0,I.useEffect)(function(){$.Q.attachMapStyle(o.mapStyle),null!=ut&&ut.onMapStyleChange&&ut.onMapStyleChange()},[o.mapStyle]),(0,I.useEffect)(function(){return(0,tt.A3)(r.globals)},[r.globals]),(0,I.useEffect)(function(){var t=r.actionsArray;t.length&&(t.forEach(function(t){var e,r=t.method,n=t.parameters;return ut[r].apply(ut,function(t){if(Array.isArray(t))return lt(t)}(e=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return lt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?lt(t,e):void 0}}(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.")}())}),u({type:"REMOVE_ADAPTER_ACTIONS",payload:t}))},[r.actionsArray]),(0,I.useEffect)(function(){return function(){y.current&&(y.current.remove(),y.current=null)}},[]),null},reducer:{initialState:{globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[]},actions:j},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"drawer",modal:!0,dismissible:!0},tablet:{slot:"left-top",dismissible:!0,exclusive:!0,width:"260px"},desktop:{slot:"left-top",modal:!1,dismissible:!0,exclusive:!0,width:"280px"},render:function(t){var e=t.pluginState,r=e.menu,n=void 0===r?[]:r,o=function(t){var r=t.target,n=r.value,o=r.checked;yt({pluginState:e},o,{datasetId:n})},a=n.some(function(t){return t.groupLabel}),i="im-c-datasets-layers".concat(a?" im-c-datasets-layers--has-groups":"");return(0,dt.jsx)("div",{className:i,children:n.map(function(t){return(0,dt.jsxs)(vt,{menuGroup:t,children:[" ",t.items.map(function(t){return(0,dt.jsx)(bt,{menuGroupItem:t,onChange:o},t.id)})]},t.id)})})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"></path><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"></path><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"></path>'},{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}],api:{addDataset:function(t,e){(0,t.pluginState.dispatch)({type:"ADD_DATASET",payload:{dataset:e,mapStyle:t.mapState.mapStyle}})},removeDataset:function(t,e){var r=t.pluginState.dispatch;ut.removeDataset(e),r({type:"REMOVE_DATASET",payload:{id:e}})},setDatasetVisibility:yt,setFeatureVisibility:function(t,e,r){var n=t.pluginState.dispatch,o=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).datasetId,a=void 0===o?null:o;if(a){var i=$.Q.getDataset(a);!i||i.idProperty||i.generateIds||m.v.warn('setFeatureVisibility: Dataset "'.concat(a,'" has no idProperty or generateIds configured. Features may not be matched correctly. Add idProperty to match by a feature property, or add generateIds: true to use auto-generated IDs.'))}n({type:e?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:a,featureIds:r}})},setStyle:function(t,e){var r=t.pluginState.dispatch,n=t.mapState,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.datasetId,i=o.sublayerId;r({type:"SET_DATASET_STYLE",payload:{datasetId:a=i?"".concat(a,"-").concat(i):a,styleChanges:e,mapStyle:n.mapStyle}})},getStyle:function(t){t._pluginState;var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.datasetId,n=e.sublayerId;r=n?"".concat(r,"-").concat(n):r;var o=$.Q.getDataset(r);return o?o.style:(m.v.warn("getStyle: Dataset with id ".concat(r," not found")),null)},setOpacity:function(t,e){var r=t.pluginState.dispatch,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=n.datasetId,a=n.sublayerId,i=a?"".concat(o,"-").concat(a):o;r(i?{type:"SET_OPACITY",payload:{datasetId:i,opacity:e}}:{type:"SET_GLOBAL_OPACITY",payload:{opacity:e}})},getOpacity:function(t){var e,r=t.pluginState.globals,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.datasetId,a=n.sublayerId,i=a?"".concat(o,"-").concat(a):o;if(i){var u,s=$.Q.getDataset(i);return s?null!==(u=s.opacity)&&void 0!==u?u:null:(m.v.warn("getOpacity: Dataset with id ".concat(i," not found")),null)}return null!==(e=r.opacity)&&void 0!==e?e:null},setData:function(t,e,r){t._pluginState;var n=r.datasetId,o=$.Q.getDataset(n);o?null!=o&&o.tiles?m.v.warn('setData called on vector tile dataset "'.concat(n,'" — has no effect')):ut.setData(n,e):m.v.warn("setData: Dataset with id ".concat(n," not found"))},setGlobals:function(t,e){var r=t.pluginState.dispatch,n=e.opacityMode,o={},a=!1;n&&(["dataset","global","multiply"].includes(n)?(a=!0,o.opacityMode=n):m.v.warn("Ignoring invalid opacityMode: ".concat(n,". Must be one of 'dataset', 'global' or 'multiply'."))),a?r({type:"SET_GLOBAL_STATE",payload:o}):m.v.warn("setGlobals: requires a valid value for opacityMode to be set")}}}},91954(t,e,r){r.d(e,{j:()=>_});var n=r(83262),o=r(63447),a=r(65767),i=r(41449);function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}function s(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function l(t,e,r){return(e=p(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,p(n.key),n)}}function f(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function p(t){var e=function(t){if("object"!=u(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=u(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==u(e)?e:e+""}var y=f(function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.id=e.id,this.url=e.url,this.transformRequest=e.transformRequest,this.maxFeatures=e.maxFeatures,this.minZoom=e.minZoom,this.idProperty=e.idProperty,this.hiddenFeaturesIdExpression=["to-string",["get",this.idProperty]],this.sourceId="geojson-dynamic-".concat(this.id),this.source=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?s(Object(r),!0).forEach(function(e){l(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({type:"geojson",data:{type:"FeatureCollection",features:[]}},this.idProperty?{promoteId:this.idProperty}:{generateId:!0})}),d=r(7400);function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function v(t){return function(t){if(Array.isArray(t))return h(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return h(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function g(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach(function(e){S(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function S(t,e,r){return(e=O(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function D(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,O(n.key),n)}}function O(t){var e=function(t){if("object"!=b(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=b(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==b(e)?e:e+""}var _=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._datasetDefinition=e},(e=[{key:"id",get:function(){return this._datasetDefinition.id}},{key:"label",get:function(){return this._datasetDefinition.label}},{key:"hasSymbol",get:function(){var t;return!this.hasSublayers&&Boolean(null===(t=this.style)||void 0===t?void 0:t.symbol)}},{key:"hasPattern",get:function(){return!this.hasSublayers&&!this.hasSymbol&&(0,i.vY)(this.style)}},{key:"hasFill",get:function(){var t,e;return!this.hasSublayers&&!this.hasSymbol&&(this.hasPattern||(null===(t=this.style)||void 0===t?void 0:t.fill)&&"transparent"!==(null===(e=this.style)||void 0===e?void 0:e.fill))}},{key:"hasStroke",get:function(){var t;return!this.hasSublayers&&!this.hasSymbol&&Boolean(null===(t=this.style)||void 0===t?void 0:t.stroke)}},{key:"tiles",get:function(){return this._datasetDefinition.tiles}},{key:"geojson",get:function(){return this._datasetDefinition.geojson}},{key:"idProperty",get:function(){return this._datasetDefinition.idProperty}},{key:"generateIds",get:function(){return this._datasetDefinition.generateIds}},{key:"parentId",get:function(){return this._datasetDefinition.parentId}},{key:"minZoom",get:function(){var t;return this._datasetDefinition.minZoom||(null===(t=this.parent)||void 0===t?void 0:t.minZoom)}},{key:"maxZoom",get:function(){var t;return this._datasetDefinition.maxZoom||(null===(t=this.parent)||void 0===t?void 0:t.maxZoom)}},{key:"type",get:function(){var t;return this._datasetDefinition.type||(null===(t=this.parent)||void 0===t?void 0:t.type)}},{key:"showInKey",get:function(){var t,e,r=this._datasetDefinition.showInKey;return void 0!==r?r:null!==(t=null===(e=this.parent)||void 0===e?void 0:e.showInKey)&&void 0!==t&&t}},{key:"visibleWhen",get:function(){var t;return void 0===this._datasetDefinition.visibleWhen?null===(t=this.parent)||void 0===t?void 0:t.visibleWhen:this._datasetDefinition.visibleWhen}},{key:"groupLabel",get:function(){var t,e;return this._datasetDefinition.groupLabel||(null===(t=this.parent)||void 0===t?void 0:t.groupLabel)||(null===(e=this.parent)||void 0===e?void 0:e.label)}},{key:"groupId",get:function(){var t;return this._datasetDefinition.groupId||(null===(t=this.parent)||void 0===t?void 0:t.groupId)||(this.groupLabel?this.groupLabel.toLowerCase().replace(/\s+/g,"-"):null)}},{key:"opacity",get:function(){var t,e,r=null===(t=this.style)||void 0===t?void 0:t.opacity,n=null===(e=this.parent)||void 0===e||null===(e=e.style)||void 0===e?void 0:e.opacity;return(0,d.ob)(r,n)}},{key:"hasDynamicGeoJSON",get:function(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}},{key:"dynamicGeoJSON",get:function(){return new y(g(g({},this._datasetDefinition.dynamicGeoJSON),{},{id:this.id,minZoom:this.minZoom}))}},{key:"hiddenFeatures",get:function(){return this._datasetDefinition.hiddenFeatures}},{key:"hasHiddenFeatures",get:function(){var t,e;return Boolean((null===(t=this.hiddenFeatures)||void 0===t?void 0:t.length)>0||(null===(e=this.parent)||void 0===e?void 0:e.hasHiddenFeatures))}},{key:"filter",get:function(){return null}},{key:"isHiddenByInheritance",get:function(){var t;return this.isSublayer?!(null!==(t=this.parent)&&void 0!==t&&t.visible):!(0,d.uA)()}},{key:"isLocallyVisible",get:function(){return!!this.isVisible||this._datasetDefinition.visible}},{key:"visible",get:function(){var t;return this.isSublayer?this._datasetDefinition.visible&&(null===(t=this.parent)||void 0===t?void 0:t.visible):this._datasetDefinition.visible&&(0,d.uA)()}},{key:"esriStyleLayerId",get:function(){return this._datasetDefinition.esriStyleLayerId}},{key:"visibility",get:function(){var t=this.visible,e=this.visibleWhen;return t&&e?(0,o.DV)(e)?"visible":"none":t?"visible":"none"}},{key:"keyVisibility",get:function(){return this.showInKey&&"visible"===this.visibility}},{key:"symbolAnchor",get:function(){var t,e;return null!==(t=this.style)&&void 0!==t&&t.symbolAnchor?this.style.symbolAnchor:null===(e=this.parent)||void 0===e?void 0:e.symbolAnchor}},{key:"sourceLayer",get:function(){return this.isSublayer?this.parent.sourceLayer:this.tiles?this._datasetDefinition.sourceLayer:void 0}},{key:"isSublayer",get:function(){return Boolean(this._datasetDefinition.parentId)}},{key:"hasSublayers",get:function(){var t;return(null===(t=this._datasetDefinition.sublayerIds)||void 0===t?void 0:t.length)>0}},{key:"sublayerIds",get:function(){return this._datasetDefinition.sublayerIds}},{key:"sublayers",get:function(){var t=this.sublayerIds;return t?t.map(function(t){return n.Q.getDataset(t)}):[]}},{key:"parent",get:function(){if(this._datasetDefinition.parentId)return n.Q.getDataset(this._datasetDefinition.parentId)}},{key:"style",get:function(){var t,e=null===(t=this.parent)||void 0===t?void 0:t.style;return e?g(g(g({},e),{},{opacity:void 0},this._datasetDefinition.style),{},{symbolDescription:this.symbolDescription}):this._datasetDefinition.style||{}}},{key:"hasCustomVisualStyle",get:function(){return(0,a.p_)(this._datasetDefinition.style||{})}},{key:"symbolDescription",get:function(){var t,e;return null!==(t=this._datasetDefinition.style)&&void 0!==t&&t.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle||null===(e=this.parent)||void 0===e?void 0:e.symbolDescription}},{key:"patternConfigs",get:function(){var t=this.hasPattern?[this.style]:[];return this.hasSublayers?[].concat(t,v(this.sublayers.flatMap(function(t){return t.patternConfigs}))):t}},{key:"symbolConfigs",get:function(){var t=this.hasSymbol?[this.style]:[];return this.hasSublayers?[].concat(t,v(this.sublayers.flatMap(function(t){return t.symbolConfigs}))):t}},{key:"keyDefinition",get:function(){return{id:this.id,type:"dataset",label:this.label,hasSymbol:this.hasSymbol,hasPattern:this.hasPattern,style:this.style,symbolDescription:this.symbolDescription}}}])&&D(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},83262(t,e,r){r.d(e,{Q:()=>b});var n=r(91954);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}function u(t){var e=function(t){if("object"!=o(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=o(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==o(e)?e:e+""}var s=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.idToDefinitionMap=new Map,this.definitionToInstanceMap=new Map},(e=[{key:"add",value:function(t){this.idToDefinitionMap.set(t.id,t._datasetDefinition),this.definitionToInstanceMap.set(t._datasetDefinition,t)}},{key:"invalidateDataset",value:function(t){var e=this,r=this.idToDefinitionMap.get(t.id);[r.id].concat(function(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return a(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}((null==r?void 0:r.sublayerIds)||[])).forEach(function(t){var r=e.idToDefinitionMap.get(t);e.definitionToInstanceMap.delete(r),e.idToDefinitionMap.delete(t)})}},{key:"invalidateChangedDatasets",value:function(t){var e=this;t.forEach(function(t){var r=e.idToDefinitionMap.get(t.id);if(r&&r!==t){var n=e.definitionToInstanceMap.get(r);e.invalidateDataset(n.isSublayer&&n.parent?n.parent:n)}})}},{key:"getByDefinition",value:function(t){return this.definitionToInstanceMap.get(t)}}])&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function l(t){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l(t)}function c(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return f(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?f(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function d(t,e,r){return(e=function(t){var e=function(t){if("object"!=l(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=l(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==l(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var b={attach:function(t,e,r){this._datasets=t,this._orderedDatasets=e,this.attachMapStyle(r),this._invalidateChangedDatasets()},_definitionCache:new s,_invalidateCache:function(){this._definitionCache=new s},_invalidateChangedDatasets:function(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset:function(t){this._createDataset=t},_createDataset:function(t){return function(t){return new n.j(t)}(t)},attachMapStyle:function(t){t&&(this._mapStyle=t)},get mapStyle(){return this._mapStyle},getDataset:function(t){var e=this.datasets[t];if(e){var r=this._definitionCache.getByDefinition(e);if(r)return r;var n=this._createDataset(e);return this._definitionCache.add(n),n.isSublayer&&this.getDataset(n.parentId),n}},forEach:function(t){var e=this;this._orderedDatasets.forEach(function(r){return t(e.getDataset(r))})},forEachDataset:function(t){var e=this;Object.values(this.datasets).filter(function(t){return!t.parentId}).forEach(function(r){return t(e.getDataset(r.id))})},topLevelDatasets:function(){var t=this;return Object.values(this.datasets).filter(function(t){return!t.parentId}).map(function(e){return t.getDataset(e.id)})},getPatternAndSymbolConfigs:function(){return this.topLevelDatasets().reduce(function(t,e){return y(y({},t),{},{patternConfigs:[].concat(c(t.patternConfigs),c(e.patternConfigs)),symbolConfigs:[].concat(c(t.symbolConfigs),c(e.symbolConfigs))})},{patternConfigs:[],symbolConfigs:[]})},_lastMenuState:{},invalidateKeyItemsOnMenuStateChange:function(t){t!==this._lastMenuState&&(this._lastMenuState=t,this._lastKeyItemsDatasets=null)},_lastKeyItems:{},keyItems:function(){if(this.datasets===this._lastKeyItemsDatasets)return this._lastKeyItems;this._lastKeyItemsDatasets=this.datasets;var t=[],e=new Map;this.forEach(function(r){if(r.keyVisibility)if(r.hasSublayers||r.groupId||r.groupLabel){var n=r.groupId,o=function(r,n){if(e.has(n))return e.get(n);var o={type:"group",id:n,groupLabel:r,keyDefinitions:[]};return e.set(n,o),t.push(o),o}(r.groupLabel||n||r.label,n);r.hasSublayers||o.keyDefinitions.push(r.keyDefinition)}else t.push({type:"flat",id:r.id,keyDefinition:r.keyDefinition})});var r=t.filter(function(t){var e;return"flat"===t.type||Boolean(null===(e=t.keyDefinitions)||void 0===e?void 0:e.length)}),n=r.some(function(t){return"group"===t.type});return this._lastKeyItems={items:r,hasGroups:n},this._lastKeyItems}};Object.defineProperty(b,"datasets",{get:function(){return b._datasets}})},7400(t,e,r){r.d(e,{A3:()=>o,ob:()=>a,uA:()=>i});var n={},o=function(t){n=t},a=function(t,e){switch(n.opacityMode){case"global":return n.opacity;case"multiply":return function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Math.round(100*(t*e*n.opacity+Number.EPSILON))/100}(t,e);default:return function(t,e){return void 0===t?void 0===e?n.opacity:e:t}(t,e)}},i=function(){return n.visible}},63447(t,e,r){r.d(e,{DV:()=>p,vf:()=>s});var n=r(83262);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,a,i,u=[],s=!0,l=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(u.push(n.value),u.length!==e);s=!0);}catch(t){l=!0,o=t}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var u={},s=function(t){u=t},l=function(t){for(var e,r=(null===(e=u)||void 0===e||null===(e=e.current)||void 0===e?void 0:e.menuState)||{},n=0,o=Object.entries(t);n<o.length;n++){var i=a(o[n],2),s=i[0],l=i[1],c=r[s];if(!l.includes(c))return!1}return!0},c=function(t){return(Array.isArray(t)?t:[t]).includes(f())},f=function(){return n.Q.mapStyle.id},p=function(t){if(null==t)return!0;if("boolean"==typeof t)return t;if("object"===o(t)){for(var e=0,r=Object.entries(t);e<r.length;e++){var n=a(r[e],2),i=n[0],u=n[1];if("mapStyleId"===i&&!c(u))return!1;if("menu"===i&&!l(u))return!1}return!0}return!0}},97619(t,e,r){r.d(e,{v:()=>o});var n="[interactive-map]",o={warn:function(){for(var t,e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return(t=console).warn.apply(t,[n].concat(r))},error:function(){for(var t,e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return(t=console).error.apply(t,[n].concat(r))}}},41449(t,e,r){function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}r.d(e,{YZ:()=>o,vY:()=>a});var o=function(t){var e,r=0,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var o=0,a=function(){};return{s:a,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){s=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(s)throw i}}}}(t);try{for(o.s();!(e=o.n()).done;){var a=e.value;r=Math.trunc((r<<5)-r+a.codePointAt(0))}}catch(t){o.e(t)}finally{o.f()}return Math.abs(r).toString(36)},a=function(t){return!(!t.fillPattern&&!t.fillPatternSvgContent)}}}]);
@@ -6,6 +6,17 @@ import { datasetRegistry } from '../../registry/datasetRegistry.js'
6
6
  import { EsriDataset } from './registry/esriDataset.js'
7
7
  import { logger } from '../../../../../src/services/logger.js'
8
8
 
9
+ const getLayerSortOrder = (layer) => {
10
+ if (layer.id === 'baseLayer') {
11
+ return -Infinity
12
+ }
13
+ if (layer.id.includes('ketchLayer')) {
14
+ return Infinity
15
+ }
16
+ const layerId = layer.type === 'group' ? layer.layers?.items?.[0]?.id : layer.id
17
+ return datasetRegistry._orderedDatasets.indexOf(layerId)
18
+ }
19
+
9
20
  export default class EsriLayerAdapter extends LayerAdapter {
10
21
  constructor (mapProvider) {
11
22
  super()
@@ -36,8 +47,29 @@ export default class EsriLayerAdapter extends LayerAdapter {
36
47
  async init () {
37
48
  const topLevelDatasets = datasetRegistry.topLevelDatasets()
38
49
  // ensure the datasets are added in order
50
+ const _add = async (registryDataset) => {
51
+ return this._addLayers(registryDataset).then(() => {
52
+ const mapLayer = this._mapVisibilityLayers[registryDataset.id]
53
+ registryDataset.sublayers?.forEach(sublayer => {
54
+ if (sublayer.visibility === 'visible') {
55
+ this._applyStyleLayerPaintProperties(sublayer, mapLayer)
56
+ }
57
+ })
58
+ this.applyDatasetVisibility(registryDataset.id)
59
+ })
60
+ }
61
+
62
+ // Add the visible datasets first - to speed up rendering
39
63
  for (const registryDataset of topLevelDatasets) {
40
- await this._addLayers(registryDataset)
64
+ if (registryDataset.visibility === 'visible') {
65
+ await _add(registryDataset)
66
+ }
67
+ }
68
+ // Add the non-visible datasets next
69
+ for (const registryDataset of topLevelDatasets) {
70
+ if (registryDataset.visibility !== 'visible') {
71
+ await _add(registryDataset)
72
+ }
41
73
  }
42
74
 
43
75
  // onMapStyleChange: handles showing and hiding sublayers based on the current mapStyle
@@ -54,14 +86,16 @@ export default class EsriLayerAdapter extends LayerAdapter {
54
86
  }
55
87
 
56
88
  _reorderLayers () {
57
- // Ensure that all sketch layers are on top of the map, so that they are not obscured by other layers
58
- // Only applicable when the draw plugin is in use, but safe to call regardless
59
- const layersLength = this._map?.allLayers?.items?.length
60
- if (layersLength) {
61
- this._map.allLayers.items
62
- .filter((layer) => layer.id.includes('ketchLayer'))
63
- .forEach((layer) => this._map.reorder(layer, layersLength))
89
+ // Order: baseLayer first, then datasets by their registry order, then sketch layers last
90
+ // Layers within a group layer are not reordered individually - they keep their existing relative order
91
+ const allLayers = this._map?.allLayers?.items
92
+ if (!allLayers?.length) {
93
+ return
64
94
  }
95
+
96
+ const topLevelLayers = allLayers.filter(layer => layer.parent?.type !== 'group')
97
+ const orderedLayers = [...topLevelLayers].sort((a, b) => getLayerSortOrder(a) - getLayerSortOrder(b))
98
+ orderedLayers.forEach((layer, index) => this._map.reorder(layer, index))
65
99
  }
66
100
 
67
101
  _addGroupLayer (esriGroupId) {
@@ -228,7 +262,6 @@ export default class EsriLayerAdapter extends LayerAdapter {
228
262
  }
229
263
  const layerPaintProperties = vectorTileLayer.getPaintProperties(esriStyleLayerId)
230
264
  if (layerPaintProperties) {
231
- registryDataset.applyLayerPaintProperties(layerPaintProperties)
232
265
  vectorTileLayer.setPaintProperties(esriStyleLayerId, registryDataset.applyLayerPaintProperties(layerPaintProperties))
233
266
  }
234
267
  }
@@ -300,16 +300,54 @@ describe('esriLayerAdapter', () => {
300
300
  // ─── _reorderLayers with sketch layers ───────────────────────────────────────
301
301
 
302
302
  describe('_reorderLayers', () => {
303
- it('reorders sketch layers to the top when allLayers is present', () => {
303
+ it('does nothing when allLayers is empty', () => {
304
+ map.allLayers = { items: [] }
305
+ map.reorder = jest.fn()
306
+
307
+ adapter._reorderLayers()
308
+
309
+ expect(map.reorder).not.toHaveBeenCalled()
310
+ })
311
+
312
+ it('orders baseLayer first, then registry order, then sketch layers last', () => {
313
+ datasetRegistry._orderedDatasets = ['roads']
304
314
  const sketchLayer = { id: 'ketchLayer-0' }
305
315
  const normalLayer = { id: 'roads' }
306
- map.allLayers = { items: [normalLayer, sketchLayer] }
316
+ const baseLayer = { id: 'baseLayer' }
317
+ map.allLayers = { items: [normalLayer, sketchLayer, baseLayer] }
318
+ map.reorder = jest.fn()
319
+
320
+ adapter._reorderLayers()
321
+
322
+ expect(map.reorder).toHaveBeenNthCalledWith(1, baseLayer, 0)
323
+ expect(map.reorder).toHaveBeenNthCalledWith(2, normalLayer, 1)
324
+ expect(map.reorder).toHaveBeenNthCalledWith(3, sketchLayer, 2)
325
+ })
326
+
327
+ it('excludes child layers of a group from reordering', () => {
328
+ const baseLayer = { id: 'baseLayer' }
329
+ const groupLayer = { id: 'group-1', type: 'group', layers: { items: [{ id: 'roads' }] } }
330
+ const childLayer = { id: 'roads', parent: { type: 'group' } }
331
+ map.allLayers = { items: [groupLayer, childLayer, baseLayer] }
332
+ map.reorder = jest.fn()
333
+
334
+ adapter._reorderLayers()
335
+
336
+ expect(map.reorder).toHaveBeenCalledTimes(2)
337
+ expect(map.reorder).toHaveBeenCalledWith(baseLayer, 0)
338
+ expect(map.reorder).toHaveBeenCalledWith(groupLayer, 1)
339
+ })
340
+
341
+ it('handles a group layer with no child layers without throwing', () => {
342
+ const baseLayer = { id: 'baseLayer' }
343
+ const emptyGroupLayer = { id: 'empty-group', type: 'group' }
344
+ map.allLayers = { items: [emptyGroupLayer, baseLayer] }
307
345
  map.reorder = jest.fn()
308
346
 
309
347
  adapter._reorderLayers()
310
348
 
311
- expect(map.reorder).toHaveBeenCalledWith(sketchLayer, 2)
312
- expect(map.reorder).not.toHaveBeenCalledWith(normalLayer, expect.anything())
349
+ expect(map.reorder).toHaveBeenCalledWith(baseLayer, 0)
350
+ expect(map.reorder).toHaveBeenCalledWith(emptyGroupLayer, 1)
313
351
  })
314
352
  })
315
353
 
@@ -101,16 +101,16 @@ const datasetRegistry = {
101
101
  const groups = new Map()
102
102
 
103
103
  const getOrCreateGroup = (groupLabel, groupId) => {
104
- if (groups.has(groupLabel)) {
105
- return groups.get(groupLabel)
104
+ if (groups.has(groupId)) {
105
+ return groups.get(groupId)
106
106
  }
107
107
  const groupObject = {
108
108
  type: 'group',
109
- id: groupId, // groupLabel.toLowerCase().replaceAll(/\s+/g, '-'),
109
+ id: groupId,
110
110
  groupLabel,
111
111
  keyDefinitions: []
112
112
  }
113
- groups.set(groupLabel, groupObject)
113
+ groups.set(groupId, groupObject)
114
114
  _items.push(groupObject)
115
115
  return groupObject
116
116
  }
@@ -119,14 +119,14 @@ const datasetRegistry = {
119
119
  if (!dataset.keyVisibility) {
120
120
  return
121
121
  }
122
- const isGroup = dataset.hasSublayers || dataset.groupLabel
122
+ const isGroup = dataset.hasSublayers || dataset.groupId || dataset.groupLabel
123
123
  if (!isGroup) {
124
124
  _items.push({ type: 'flat', id: dataset.id, keyDefinition: dataset.keyDefinition })
125
125
  return
126
126
  }
127
127
 
128
128
  const groupId = dataset.groupId
129
- const groupLabel = dataset.groupLabel || dataset.label
129
+ const groupLabel = dataset.groupLabel || groupId || dataset.label
130
130
  const groupObject = getOrCreateGroup(groupLabel, groupId)
131
131
  if (!dataset.hasSublayers) {
132
132
  groupObject.keyDefinitions.push(dataset.keyDefinition)