@defra/interactive-map 0.0.61-alpha → 0.0.63-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/esm/im-core.js +1 -1
  2. package/dist/esm/im-shell.js +1 -1
  3. package/dist/umd/im-core.js +1 -1
  4. package/dist/umd/index.js +1 -1
  5. package/docs/api.md +20 -0
  6. package/package.json +1 -1
  7. package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
  8. package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
  9. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  10. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +27 -10
  11. package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +38 -0
  12. package/plugins/datasets/src/reducers/datasetsToMenu.js +12 -9
  13. package/plugins/datasets/src/reducers/datasetsToMenu.test.js +42 -0
  14. package/plugins/datasets/src/reducers/pluginState.test.js +12 -0
  15. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  16. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  17. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  18. package/providers/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  19. package/providers/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  20. package/providers/openlayers/src/openlayersProvider.js +2 -1
  21. package/providers/openlayers/src/openlayersProvider.test.js +1 -1
  22. package/src/App/components/MapControls/MapControls.jsx +2 -1
  23. package/src/App/components/MapControls/MapControls.test.jsx +1 -1
  24. package/src/App/components/PopupMenu/PopupMenu.test.jsx +22 -0
  25. package/src/App/components/PopupMenu/usePopupMenu.js +9 -6
  26. package/src/App/components/Viewport/MapController.jsx +2 -0
  27. package/src/App/components/Viewport/MapController.test.jsx +3 -0
  28. package/src/App/hooks/useMapProviderOverrides.js +10 -5
  29. package/src/App/hooks/useMapProviderOverrides.test.js +11 -0
  30. package/src/App/hooks/useResetViewTarget.js +135 -0
  31. package/src/App/hooks/useResetViewTarget.test.js +211 -0
  32. package/src/App/hooks/useUserMoveTracking.js +7 -0
  33. package/src/App/hooks/useUserMoveTracking.test.js +21 -3
  34. package/src/App/renderer/mapButtons.js +2 -1
  35. package/src/App/renderer/mapButtons.test.js +12 -0
  36. package/src/App/store/ServiceProvider.jsx +8 -2
  37. package/src/App/store/ServiceProvider.test.jsx +13 -0
  38. package/src/App/store/mapActionsMap.js +14 -0
  39. package/src/App/store/mapActionsMap.test.js +11 -0
  40. package/src/App/store/mapReducer.js +4 -0
  41. package/src/App/store/mapReducer.test.js +2 -0
  42. package/src/InteractiveMap/InteractiveMap.js +8 -0
  43. package/src/InteractiveMap/InteractiveMap.test.js +5 -0
  44. package/src/config/appConfig.js +17 -0
  45. package/src/config/appConfig.test.js +28 -0
  46. package/src/config/defaults.js +1 -0
  47. package/src/config/events.js +2 -0
  48. package/src/services/mapFocus.js +3 -2
  49. package/src/services/mapFocus.test.js +10 -0
  50. package/src/types.js +5 -0
  51. package/src/utils/focusAfterPanelClose.js +3 -1
  52. package/src/utils/getFocusOptions.js +3 -0
  53. package/src/utils/getFocusOptions.test.js +11 -0
  54. package/src/utils/mapStateSync.js +1 -0
  55. package/src/utils/resetView.js +61 -0
  56. package/src/utils/resetView.test.js +62 -0
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see im-datasets-plugin.js.LICENSE.txt */
2
- "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[447],{852:function(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,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,{jE:function(){return d},Eg:function(){return y},V:function(){return l},p_:function(){return p}});var s,l={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},c=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription"].concat(function(t){if(Array.isArray(t))return u(t)}(s=["symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"])||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(s)||function(t,e){if(t){if("string"==typeof t)return u(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)?u(t,e):void 0}}(s)||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.")}()),f=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],p=function(t){return f.some(function(e){return e in t})},y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t)?a({strokeWidth:l.style.strokeWidth},t):a(a({},l.style),t)},d=function(t){!0!==t.visible&&!1!==t.visible&&(t.visible="hidden"!==t.visibility);var e=a(a(a({},l),t),{},{style:a({},t.style)});return c.forEach(function(t){return delete e[t]}),e}},634:function(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,{createManifest:function(){return zt}});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(852);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(619);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 O(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 O(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(t,e):void 0}}(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 O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function D(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 P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?D(Object(r),!0).forEach(function(e){_(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):D(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function _(t,e,r){return(e=function(t){var e=function(t){if("object"!=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 A={globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[],menuInitialised:!1},w=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)},E=function(t,e,r){return P(P({},r),{},{actionsArray:[].concat(S(r.actionsArray),[{method:t,parameters:e}])})},j={SET_DATASETS:function(t,e){var r=e.mappedDatasets,n=e.orderedDatasets;return P(P({},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],P(P({},t),{},{mappedDatasets:P(P({},t.mappedDatasets),a),orderedDatasets:[].concat(S(t.orderedDatasets),S(i)),menu:s}))},REMOVE_DATASET:function(t,e){var r,n=e.id;if(!w(t,n,"removeDataset"))return t;var o=P({},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 P(P({},t),{},{mappedDatasets:o,orderedDatasets:i,menu:c(t.menu,a)})},SET_DATASET_VISIBILITY:function(t,e){var r=e.datasetId,n=e.visible;return w(t,r,"setDatasetVisibility")?t.mappedDatasets[r].visible===n?t:E("applyDatasetVisibility",[r,n],P(P({},t),{},{mappedDatasets:P(P({},t.mappedDatasets),{},_({},r,P(P({},t.mappedDatasets[r]),{},{visible:n})))})):t},SET_GLOBAL_VISIBILITY:function(t,e){var r=e.visible;return E("applyGlobalVisibility",[r],P(P({},t),{},{globals:P(P({},t.globals),{},{visible:r})}))},SET_DATASET_STYLE:function(t,e){var r=e.datasetId,n=e.styleChanges,o=e.mapStyle;if(!w(t,r,"setDatasetStyle"))return t;var a=P(P({},t.mappedDatasets[r].style),n),i=P(P(P({},t.mappedDatasets[r]),n),{},{style:a});return E("applyStyle",[r,o],P(P({},t),{},{mappedDatasets:P(P({},t.mappedDatasets),{},_({},r,i))}))},SET_OPACITY:function(t,e){var r=e.datasetId,n=e.opacity;if(!w(t,r,"setOpacity"))return t;var o=P(P({},t.mappedDatasets[r].style),{},{opacity:n}),a=P(P({},t.mappedDatasets[r]),{},{style:o});return E("applyDatasetOpacity",[r],P(P({},t),{},{mappedDatasets:P(P({},t.mappedDatasets),{},_({},r,a))}))},SET_GLOBAL_OPACITY:function(t,e){var r=e.opacity;return E("applyGlobalOpacity",[],P(P({},t),{},{globals:P(P({},t.globals),{},{opacity:r})}))},HIDE_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!w(t,r,"setFeatureVisibility - hideFeatures"))return t;var o=P({},t.mappedDatasets[r]),a=o.hiddenFeatures||[],i=Array.from(new Set([].concat(S(a),S(n))));return o.hiddenFeatures=i,E("applyFeatureFilter",[r],P(P({},t),{},{mappedDatasets:P(P({},t.mappedDatasets),{},_({},r,o))}))},SHOW_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!w(t,r,"setFeatureVisibility - showFeatures"))return t;var o=P({},t.mappedDatasets[r]),a=(o.hiddenFeatures||[]).filter(function(t){return!n.includes(t)});return o.hiddenFeatures=a.length?a:[-1],E("applyFeatureFilter",[r],P(P({},t),{},{mappedDatasets:P(P({},t.mappedDatasets),{},_({},r,o))}))},REMOVE_ADAPTER_ACTIONS:function(t,e){return null!=e&&e.length?P(P({},t),{},{actionsArray:t.actionsArray.filter(function(t){return!e.includes(t)})}):t},SET_GLOBAL_STATE:function(t,e){return E("applyGlobalOpacity",[],P(P({},t),{},{globals:P(P({},t.globals),e)}))},SET_MENU:function(t,e){var r=e.menu;return P(P({},t),{},{menu:r,menuInitialised:!0})}},I=r(738),T={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",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_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",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 k(){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 M(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]())):(M(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,M(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,M(f,"constructor",l),M(l,"constructor",s),s.displayName="GeneratorFunction",M(l,o,"GeneratorFunction"),M(f),M(f,o,"Generator"),M(f,n,function(){return this}),M(f,"toString",function(){return"[object Generator]"}),(k=function(){return{w:a,m:p}})()}function M(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}M=function(t,e,r,n){function a(e,r){M(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))},M(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=k().m(function t(e,r,n,o){var a,i,u,s,l,c,f;return k().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){return t.getBounds()},R=function(t,e){return!(!t||!e)&&e[0]>=t[0]&&e[1]>=t[1]&&e[2]<=t[2]&&e[3]<=t[3]},F=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},N=function(t,e){return!(!t||!e||t[2]<e[0]||t[0]>e[2]||t[3]<e[1]||t[1]>e[3])},B=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=B(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 V(){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]"}),(V=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 W(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 H(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)||K(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 K(t,e){if(t){if("string"==typeof t)return Z(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Z(t,e):void 0}}function Z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var Y=function(t){return{type:"FeatureCollection",features:Array.from(t.values()).map(function(t){return t.feature})}},z=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=K(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=H(n.value,2),l=s[0],c=s[1];N(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)}},J=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:B(e.geometry),lastSeenAt:n}):console.warn("Feature missing ID, skipping:",e)})},$=function(){var t,e=(t=V().m(function t(e,r){var n,o,a,i,u,s,l,c,f,p,y,d,b,v,h;return V().w(function(t){for(;;)switch(t.p=t.n){case 0:if(n=r.mapProvider,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||!R(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,J(e.features,b,u),e.fetchedBbox=F(e.fetchedBbox,y),v=e.features.size,z(e.features,y,l),e.features.size<v&&(e.fetchedBbox=y),a(o.id,Y(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){W(a,n,o,i,u,"next",t)}function u(t){W(a,n,o,i,u,"throw",t)}i(void 0)})});return function(t,r){return e.apply(this,arguments)}}(),q=function(t){var e=t.adapter,r=t.datasetRegistry,n=t.pluginConfig,o=t.mapStyle,a=t.mapProvider,i=t.events,u=t.dispatch,s=t.eventBus,c=n.datasets,f=new Map;n.globals&&u({type:"SET_GLOBAL_STATE",payload:n.globals});var p=h({datasets:c}),y=p.mappedDatasets,d=p.orderedDatasets;e.createDataset&&r.attachCreateDataset(e.createDataset),r.attach(y,d,o);var b=l({datasets:c});s.requestOnce("menu:state",function(t){return r.attachMenuStateRef(t)}),u({type:"SET_MENU",payload:{menu:b}}),u({type:"SET_DATASETS",payload:{mappedDatasets:y,orderedDatasets:d}}),e.init().then(function(){r.forEachDataset(function(t){if(t.hasDynamicGeoJSON){var r=function(t){var e,r,n,o=t.dynamicGeoJSON,a=t.mapProvider,i=t.onUpdate,u={features:new Map,fetchedBbox:null,currentController:null},s=function(){return $(u,{mapProvider: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.map.on("moveend",c),s(),{destroy:function(){var t,e;t=a.map,e=c,(t.off||t.un).call(t,"moveend",e),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,Y(u.features))}}}({dynamicGeoJSON:t.dynamicGeoJSON,mapProvider:a,onUpdate:function(t,r){return e.setData(t,r)}});f.set(t.id,r)}}),e.attachDynamicSources(f),s.emit("datasets:ready")});var v=function(){e.onMapSizeChange()};s.on(i.MAP_SIZE_CHANGE,v);var m=s.emitWhenRequested("datasets:registry",r);return s.on("menu:changed",function(t){r.invalidateKeyItemsOnMenuStateChange(t),e.applyGlobalVisibility()}),{remove:function(){s.off(i.MAP_SIZE_CHANGE,v),m(),f.forEach(function(t){return t.destroy()}),f.clear(),e.destroy()},refreshDataset:function(t){var e;null===(e=f.get(t))||void 0===e||e.refresh()},clearDatasetCache:function(t){var e;null===(e=f.get(t))||void 0===e||e.clear()},getFeatureCount:function(t){var e,r;return null!==(e=null===(r=f.get(t))||void 0===r?void 0:r.getFeatureCount())&&void 0!==e?e:null}}};function X(){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 Q(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]())):(Q(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,Q(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,Q(f,"constructor",l),Q(l,"constructor",s),s.displayName="GeneratorFunction",Q(l,o,"GeneratorFunction"),Q(f),Q(f,o,"Generator"),Q(f,n,function(){return this}),Q(f,"toString",function(){return"[object Generator]"}),(X=function(){return{w:a,m:p}})()}function Q(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Q=function(t,e,r,n){function a(e,r){Q(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))},Q(t,e,r,n)}function tt(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 et(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){tt(a,n,o,i,u,"next",t)}function u(t){tt(a,n,o,i,u,"throw",t)}i(void 0)})}}var rt=function(){var t=et(X().m(function t(e){var n,o,a,i,u,s,l;return X().w(function(t){for(;;)switch(t.n){case 0:l=e.name,t.n="MapLibreProvider"===l?1:"EsriProvider"===l?3:"OpenLayersProvider"===l?5:7;break;case 1:return t.n=2,r.e(563).then(r.bind(r,291));case 2:return n=t.v,o=n.default,t.a(2,o);case 3:return t.n=4,Promise.resolve().then(function(){var t=new Error("Cannot find module './esri/esriLayerAdapter.js'");throw t.code="MODULE_NOT_FOUND",t});case 4:return a=t.v,i=a.default,t.a(2,i);case 5:return t.n=6,r.e(809).then(r.bind(r,382));case 6:return u=t.v,s=u.default,t.a(2,s);case 7:throw new Error("No layer adapter available for map provider ".concat(e.name,". Please provide a compatible layer adapter."));case 8:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),nt=function(){var t=et(X().m(function t(e,r,n,o){var a;return X().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,rt(e);case 1:return a=t.v,t.a(2,new a(e,r,n,o))}},t)}));return function(e,r,n,o){return t.apply(this,arguments)}}(),ot=function(t){var e=t.pluginConfig,r=t.pluginState;return!1!==e.hasMenu&&(r.menuInitialised?r.menu.length>0:(e.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}))}))};function at(){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 it(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]())):(it(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,it(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,it(f,"constructor",l),it(l,"constructor",s),s.displayName="GeneratorFunction",it(l,o,"GeneratorFunction"),it(f),it(f,o,"Generator"),it(f,n,function(){return this}),it(f,"toString",function(){return"[object Generator]"}),(at=function(){return{w:a,m:p}})()}function it(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}it=function(t,e,r,n){function a(e,r){it(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))},it(t,e,r,n)}function ut(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 st(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 lt="datasetsLayers";function ct(t){var e=t.appState,r=t.pluginConfig,n=t.pluginState,o=t.mapState,a=t.mapProvider,i=t.services,u=n.dispatch,s=n.datasetRegistry,l=i.eventBus,c=i.symbolRegistry,f=i.patternRegistry,p=Boolean(null==a?void 0:a.isBaseMapReady());!function(t){var e=t.appState,r=t.pluginConfig,n=t.pluginState,o=t.services.eventBus,a=ot({pluginConfig:r,pluginState:n}),i=Boolean(e.openPanels[lt]);(0,I.useEffect)(function(){!a&&i&&o.emit(T.APP_HIDE_PANEL,lt)},[a,i])}({appState:e,pluginConfig:r,pluginState:n,services:i});var y=(0,I.useRef)(n);y.current=n;var d=(0,I.useRef)(null),b=function(t){var e=null==a?void 0:a.datasets;t.length&&e&&(t.forEach(function(t){var r,n=t.method,o=t.parameters;return e[n].apply(e,function(t){if(Array.isArray(t))return st(t)}(r=o)||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 st(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)?st(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.")}())}),u({type:"REMOVE_ADAPTER_ACTIONS",payload:t}))};return(0,I.useEffect)(function(){if(p&&!d.current){var t=function(){var t,e=(t=at().m(function t(){var e;return at().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,nt(a,c,f,s);case 1:e=t.v,d.current=q({adapter:e,datasetRegistry:s,pluginConfig:r,pluginStateRef:y,mapStyle:o.mapStyle,mapProvider:a,events:T,dispatch:u,eventBus:l}),a.datasets=e,b(y.current.actionsArray);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){ut(a,n,o,i,u,"next",t)}function u(t){ut(a,n,o,i,u,"throw",t)}i(void 0)})});return function(){return e.apply(this,arguments)}}();t()}},[p]),(0,I.useEffect)(function(){s.attach(n.mappedDatasets,n.orderedDatasets),l.emit("datasets:changed")},[n.mappedDatasets,n.orderedDatasets]),(0,I.useEffect)(function(){s.attachMapStyle(o.mapStyle);var t=null==a?void 0:a.datasets;null!=t&&t.onMapStyleChange&&Promise.resolve(t.onMapStyleChange()).then(function(){l.emit(T.MAP_DATA_CHANGE)})},[o.mapStyle]),(0,I.useEffect)(function(){return s.attachGlobals(n.globals)},[n.globals]),(0,I.useEffect)(function(){return b(n.actionsArray)},[n.actionsArray]),(0,I.useEffect)(function(){return function(){d.current&&(d.current.remove(),d.current=null,a.datasets=null)}},[]),null}var ft=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}})},pt=r(287),yt=function(t){var e=t.menuGroupItem,r=t.datasetRegistry,n=t.onChange,o=r.getDataset(e.id);if(!o)return null;var a=o.isSublayer?o.parentId:o.id,i=o.isSublayer?o.id:void 0,u="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small".concat(o.visible?"":" im-c-datasets-layers__item--checked");return(0,pt.jsx)("div",{className:u,"data-module":"govuk-checkboxes",children:(0,pt.jsxs)("div",{className:"govuk-checkboxes__item",children:[(0,pt.jsx)("input",{className:"govuk-checkboxes__input",id:o.id,"data-dataset-id":a,"data-sublayer-id":i,name:"layers",type:"checkbox",value:o.id,checked:o.isLocallyVisible,onChange:n}),(0,pt.jsx)("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:o.id,children:o.label})]})},o.id)},dt=function(t){var e=t.menuGroup,r=t.children;return e.groupLabel?(0,pt.jsx)("div",{className:"govuk-form-group im-c-datasets-layers-group",children:(0,pt.jsxs)("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[(0,pt.jsx)("legend",{className:"im-c-datasets-layers-group__legend",children:(0,pt.jsx)("h3",{children:e.groupLabel})}),r]})},e.id):(0,pt.jsx)(pt.Fragment,{children:r})},bt=function(t,e){(0,t.pluginState.dispatch)({type:"ADD_DATASET",payload:{dataset:e,mapStyle:t.mapState.mapStyle}})},vt=function(t,e){var r,n=t.pluginState.dispatch;null===(r=t.mapProvider.datasets)||void 0===r||r.removeDataset(e),n({type:"REMOVE_DATASET",payload:{id:e}})},ht=function(t,e,r){var n=t.pluginState,o=n.dispatch,a=n.datasetRegistry,i=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).datasetId,u=void 0===i?null:i;if(u){var s=a.getDataset(u);!s||s.idProperty||s.generateIds||m.v.warn('setFeatureVisibility: Dataset "'.concat(u,'" 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.'))}o({type:e?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:u,featureIds:r}})},mt=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}})},gt=function(t){var e=t.pluginState.datasetRegistry,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.datasetId,o=r.sublayerId;n=o?"".concat(n,"-").concat(o):n;var a=e.getDataset(n);return a?a.style:(m.v.warn("getStyle: Dataset with id ".concat(n," not found")),null)},St=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}})},Ot=function(t){var e,r=t.pluginState,n=r.globals,o=r.datasetRegistry,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.datasetId,u=a.sublayerId,s=u?"".concat(i,"-").concat(u):i;if(s){var l,c=o.getDataset(s);return c?null!==(l=c.opacity)&&void 0!==l?l:null:(m.v.warn("getOpacity: Dataset with id ".concat(s," not found")),null)}return null!==(e=n.opacity)&&void 0!==e?e:null},Dt=function(t,e,r){var n,o=t.pluginState.datasetRegistry,a=t.mapProvider,i=r.datasetId,u=o.getDataset(i);u?null!=u&&u.tiles?m.v.warn('setData called on vector tile dataset "'.concat(i,'" — has no effect')):null===(n=a.datasets)||void 0===n||n.setData(i,e):m.v.warn("setData: Dataset with id ".concat(i," not found"))},Pt=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")},_t=r(428);function At(t){return At="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},At(t)}function wt(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 Et(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,jt(n.key),n)}}function jt(t){var e=function(t){if("object"!=At(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=At(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==At(e)?e:e+""}var It=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 wt(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 wt(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)?wt(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)}}])&&Et(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function Tt(t){return Tt="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},Tt(t)}function kt(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 Mt(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)?Mt(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 Mt(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 Ct=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=0,n=Object.entries(t);r<n.length;r++){var o=kt(n[r],2),a=o[0],i=o[1],u=e[a];if(!i.includes(u))return!1}return!0},Lt=function(t,e){return(Array.isArray(t)?t:[t]).includes(e)};function xt(t){return xt="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},xt(t)}function Gt(t){return function(t){if(Array.isArray(t))return Rt(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 Rt(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)?Rt(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 Rt(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 Ft(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 Nt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ft(Object(r),!0).forEach(function(e){Bt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ft(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Bt(t,e,r){return(e=function(t){var e=function(t){if("object"!=xt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=xt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==xt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Vt={attach:function(t,e,r){this._datasets=t,this._orderedDatasets=e,this.attachMapStyle(r),this._invalidateChangedDatasets()},_invalidateCache:function(){this._definitionCache=new It},_invalidateChangedDatasets:function(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset:function(t){this._createDataset=t},_createDataset:function(t,e){return function(t,e){return new _t.j(t,e)}(t,e)},attachMapStyle:function(t){t&&(this._mapStyle=t)},get mapStyle(){return this._mapStyle},attachGlobals:function(t){t&&(this._globals=t)},get globals(){return this._globals},attachMenuStateRef:function(t){this._menuStateRef=t},isVisibleWhen:function(t){var e,r;return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.mapStyleId,n=e.menuState;if(null==t)return!0;if("boolean"==typeof t)return t;if("object"===Tt(t)){for(var o=0,a=Object.entries(t);o<a.length;o++){var i=kt(a[o],2),u=i[0],s=i[1];if("mapStyleId"===u&&!Lt(s,r))return!1;if("menu"===u&&!Ct(s,n))return!1}return!0}return!0}(t,{mapStyleId:null===(e=this._mapStyle)||void 0===e?void 0:e.id,menuState:null===(r=this._menuStateRef)||void 0===r||null===(r=r.current)||void 0===r?void 0:r.menuState})},get datasets(){return this._datasets},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,this);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 Nt(Nt({},t),{},{patternConfigs:[].concat(Gt(t.patternConfigs),Gt(e.patternConfigs)),symbolConfigs:[].concat(Gt(t.symbolConfigs),Gt(e.symbolConfigs))})},{patternConfigs:[],symbolConfigs:[]})},invalidateKeyItemsOnMenuStateChange:function(t){t!==this._lastMenuState&&(this._lastMenuState=t,this._lastKeyItemsDatasets=null)},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}};function Ut(t){return Ut="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},Ut(t)}function Wt(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 Ht(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Wt(Object(r),!0).forEach(function(e){Kt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Kt(t,e,r){return(e=function(t){var e=function(t){if("object"!=Ut(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Ut(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Ut(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Zt={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;ft({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,pt.jsx)("div",{className:i,children:n.map(function(t){return(0,pt.jsxs)(dt,{menuGroup:t,children:[" ",t.items.map(function(t){return(0,pt.jsx)(yt,{menuGroupItem:t,datasetRegistry:e.datasetRegistry,onChange:o},t.id)})]},t.id)})})}},Yt={id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",excludeWhen:function(t){return!ot(t)},iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}},zt=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).hasMenu;return{InitComponent:ct,reducer:{initialState:Ht(Ht({},A),{},{datasetRegistry:Object.assign(Object.create(Vt),{_definitionCache:new It,_globals:{},_menuStateRef:{},_lastMenuState:{},_lastKeyItems:{}})}),actions:j},panels:!1===t?[]:[Zt],buttons:!1===t?[]:[Yt],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:bt,removeDataset:vt,setDatasetVisibility:ft,setFeatureVisibility:ht,setStyle:mt,getStyle:gt,setOpacity:St,getOpacity:Ot,setData:Dt,setGlobals:Pt}}}},428:function(t,e,r){r.d(e,{j:function(){return g}});var n=r(852);new Set,new Set(["symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolDescription"]);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){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 i(t,e,r){return(e=l(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(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,l(n.key),n)}}function s(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(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 c=s(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?a(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(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})});function f(t){return f="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},f(t)}function p(t){return function(t){if(Array.isArray(t))return y(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 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}}(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 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}function d(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach(function(e){v(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function v(t,e,r){return(e=m(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(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,m(n.key),n)}}function m(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}var g=function(){return t=function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._datasetDefinition=e,this._datasetRegistry=r},(e=[{key:"id",get:function(){return this._datasetDefinition.id}},{key:"label",get:function(){return this._datasetDefinition.label}},{key:"hasSymbol",get:function(){return!this.hasSublayers&&!!(null!=(t=this.style)&&t.symbol||null!=t&&t.symbolSvgContent);var t}},{key:"hasPattern",get:function(){return!(this.hasSublayers||this.hasSymbol||(t=this.style,!t.fillPattern&&!t.fillPatternSvgContent));var t}},{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 function(t,e,r){switch(t.opacityMode){case"global":return t.opacity;case"multiply":return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.round(100*(e*r*t.opacity+Number.EPSILON))/100}(t,e,r);default:return function(t,e,r){return void 0===e?void 0===r?t.opacity:r:e}(t,e,r)}}(this._datasetRegistry.globals,r,n)}},{key:"hasDynamicGeoJSON",get:function(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}},{key:"dynamicGeoJSON",get:function(){return new c(b(b({},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):!this._datasetRegistry.globals.visible}},{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&&this._datasetRegistry.globals.visible}},{key:"esriStyleLayerId",get:function(){return this._datasetDefinition.esriStyleLayerId}},{key:"visibility",get:function(){var t=this.visible,e=this.visibleWhen;return t&&e?this._datasetRegistry.isVisibleWhen(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,e=this.sublayerIds;return e?e.map(function(e){return t._datasetRegistry.getDataset(e)}):[]}},{key:"parent",get:function(){if(this._datasetDefinition.parentId)return this._datasetRegistry.getDataset(this._datasetDefinition.parentId)}},{key:"inheritedStyle",get:function(){var t=this._datasetDefinition.style||{},e=this.parent;return e?b(b({},e.inheritedStyle),{},{opacity:void 0},t):t}},{key:"style",get:function(){return b(b({},(0,n.Eg)(this.inheritedStyle)),{},{symbolDescription:this.symbolDescription})}},{key:"hasCustomVisualStyle",get:function(){return(0,n.p_)(this._datasetDefinition.style||{})}},{key:"symbolDescription",get:function(){var t;return null!==(t=this._datasetDefinition.style)&&void 0!==t&&t.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle?void 0:this.parent?this.parent.symbolDescription:n.V.style.symbolDescription}},{key:"patternConfigs",get:function(){var t=this.hasPattern?[this.style]:[];return this.hasSublayers?[].concat(t,p(this.sublayers.flatMap(function(t){return t.patternConfigs}))):t}},{key:"symbolConfigs",get:function(){var t=this.hasSymbol?[this.style]:[];return this.hasSublayers?[].concat(t,p(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}}}])&&h(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},619:function(t,e,r){r.d(e,{v:function(){return 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))}}}}]);
2
+ "use strict";(Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap=Object("undefined"!=typeof self?self:this).webpackChunkdefra_DefraMap||[]).push([[447],{852:function(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,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,{jE:function(){return d},Eg:function(){return y},V:function(){return l},p_:function(){return p}});var s,l={minZoom:6,maxZoom:24,showInKey:!1,showInMenu:!1,visible:!0,style:{stroke:"#d4351c",strokeWidth:2,symbolDescription:"red outline"}},c=["stroke","strokeWidth","strokeDashArray","fill","fillPattern","fillPatternSvgContent","fillPatternForegroundColor","fillPatternBackgroundColor","opacity","symbolDescription"].concat(function(t){if(Array.isArray(t))return u(t)}(s=["symbol","symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"])||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(s)||function(t,e){if(t){if("string"==typeof t)return u(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)?u(t,e):void 0}}(s)||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.")}()),f=["stroke","fill","fillPattern","fillPatternSvgContent","symbol","symbolSvgContent"],p=function(t){return f.some(function(e){return e in t})},y=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return p(t)?a({strokeWidth:l.style.strokeWidth},t):a(a({},l.style),t)},d=function(t){!0!==t.visible&&!1!==t.visible&&(t.visible="hidden"!==t.visibility);var e=a(a(a({},l),t),{},{style:a({},t.style)});return c.forEach(function(t){return delete e[t]}),e}},634:function(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 l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||s(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){if(t){if("string"==typeof t)return l(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)?l(t,e):void 0}}function l(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,{createManifest:function(){return Jt}});var c=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},f=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},[])},p=r(852);function y(t){return y="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},y(t)}function d(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach(function(e){v(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function v(t,e,r){return(e=function(t){var e=function(t){if("object"!=y(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==y(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var h=function(t,e){var r,n=e.id,o=(0,p.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"),b(b({},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(h,{orderedDatasets:a});return t[n].sublayerIds=u,delete t[n].sublayers,b(b(b({},t),s),{},{orderedDatasets:a})}return b(b({},t),{},{orderedDatasets:a})},m=function(t){var e=(t.datasets||[]).reduce(h,{orderedDatasets:[]}),r=e.orderedDatasets;return delete e.orderedDatasets,b(b({},t),{},{mappedDatasets:e,orderedDatasets:r})},g=r(619);function S(t){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},S(t)}function O(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 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 _(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){A(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 A(t,e,r){return(e=function(t){var e=function(t){if("object"!=S(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=S(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==S(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var w={globals:{visible:!0,opacity:1,opacityMode:"dataset"},key:{items:[],hasGroups:!1},mappedDatasets:{},orderedDatasets:[],actionsArray:[],menu:[],menuInitialised:!1},E=function(t,e,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"not found";return!!t.mappedDatasets[e]||(g.v.error("".concat(r,": Dataset with id '").concat(e,"' ").concat(n)),!1)},j=function(t,e,r){return _(_({},r),{},{actionsArray:[].concat(O(r.actionsArray),[{method:t,parameters:e}])})},I={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 g.v.error("addDataset: Dataset with id '".concat(r.id,"' already exists")),t;var o=m({datasets:[r]}),i=o.mappedDatasets,l=o.orderedDatasets,f=function(t,e){var r,n,o=(r=c({datasets:[e]}),n=1,function(t){if(Array.isArray(t))return t}(r)||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}}(r,n)||s(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];if(!o)return t.menu;var i=t.menu.find(function(t){return t.groupLabel===o.groupLabel});return i?t.menu.map(function(t){return t===i?a(a({},t),{},{items:[].concat(u(t.items),u(o.items))}):t}):[].concat(u(t.menu),[o])}(t,r);return j("addDataset",[r.id,n],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),i),orderedDatasets:[].concat(O(t.orderedDatasets),O(l)),menu:f}))},REMOVE_DATASET:function(t,e){var r,n=e.id;if(!E(t,n,"removeDataset"))return t;var o=_({},t.mappedDatasets),a=[n].concat(O((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:f(t.menu,a)})},SET_DATASET_VISIBILITY:function(t,e){var r=e.datasetId,n=e.visible;return E(t,r,"setDatasetVisibility")?t.mappedDatasets[r].visible===n?t:j("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 j("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(!E(t,r,"setDatasetStyle"))return t;var a=_(_({},t.mappedDatasets[r].style),n),i=_(_(_({},t.mappedDatasets[r]),n),{},{style:a});return j("applyStyle",[r,o],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,i))}))},SET_OPACITY:function(t,e){var r=e.datasetId,n=e.opacity;if(!E(t,r,"setOpacity"))return t;var o=_(_({},t.mappedDatasets[r].style),{},{opacity:n}),a=_(_({},t.mappedDatasets[r]),{},{style:o});return j("applyDatasetOpacity",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,a))}))},SET_GLOBAL_OPACITY:function(t,e){var r=e.opacity;return j("applyGlobalOpacity",[],_(_({},t),{},{globals:_(_({},t.globals),{},{opacity:r})}))},HIDE_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!E(t,r,"setFeatureVisibility - hideFeatures"))return t;var o=_({},t.mappedDatasets[r]),a=o.hiddenFeatures||[],i=Array.from(new Set([].concat(O(a),O(n))));return o.hiddenFeatures=i,j("applyFeatureFilter",[r],_(_({},t),{},{mappedDatasets:_(_({},t.mappedDatasets),{},A({},r,o))}))},SHOW_FEATURES:function(t,e){var r=e.datasetId,n=e.featureIds;if(!E(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],j("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 j("applyGlobalOpacity",[],_(_({},t),{},{globals:_(_({},t.globals),e)}))},SET_MENU:function(t,e){var r=e.menu;return _(_({},t),{},{menu:r,menuInitialised:!0})}},T=r(738),k={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",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_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",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_RESET_VIEW:"map:resetview",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 C(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]())):(C(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,C(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,C(f,"constructor",l),C(l,"constructor",s),s.displayName="GeneratorFunction",C(l,o,"GeneratorFunction"),C(f),C(f,o,"Generator"),C(f,n,function(){return this}),C(f,"toString",function(){return"[object Generator]"}),(M=function(){return{w:a,m:p}})()}function C(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}C=function(t,e,r,n){function a(e,r){C(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))},C(t,e,r,n)}function L(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 x=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){L(a,n,o,i,u,"next",t)}function u(t){L(a,n,o,i,u,"throw",t)}i(void 0)})});return function(t,r,n,o){return e.apply(this,arguments)}}();function G(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 R=function(t){return t.getBounds()},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 G(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 G(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)?G(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},B=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 U(){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 W(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]())):(W(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,W(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,W(f,"constructor",l),W(l,"constructor",s),s.displayName="GeneratorFunction",W(l,o,"GeneratorFunction"),W(f),W(f,o,"Generator"),W(f,n,function(){return this}),W(f,"toString",function(){return"[object Generator]"}),(U=function(){return{w:a,m:p}})()}function W(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}W=function(t,e,r,n){function a(e,r){W(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))},W(t,e,r,n)}function H(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 K(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)||Z(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Z(t,e){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})}},J=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=Z(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=K(n.value,2),l=s[0],c=s[1];B(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)}},$=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)})},q=function(){var t,e=(t=U().m(function t(e,r){var n,o,a,i,u,s,l,c,f,p,y,d,b,v,h;return U().w(function(t){for(;;)switch(t.p=t.n){case 0:if(n=r.mapProvider,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=R(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,x(i,d,s,e.currentController.signal);case 4:b=t.v,$(e.features,b,u),e.fetchedBbox=N(e.fetchedBbox,y),v=e.features.size,J(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){H(a,n,o,i,u,"next",t)}function u(t){H(a,n,o,i,u,"throw",t)}i(void 0)})});return function(t,r){return e.apply(this,arguments)}}(),X=function(t){var e=t.adapter,r=t.datasetRegistry,n=t.pluginConfig,o=t.mapStyle,a=t.mapProvider,i=t.events,u=t.dispatch,s=t.eventBus,l=n.datasets,f=new Map;n.globals&&u({type:"SET_GLOBAL_STATE",payload:n.globals});var p=m({datasets:l}),y=p.mappedDatasets,d=p.orderedDatasets;e.createDataset&&r.attachCreateDataset(e.createDataset),r.attach(y,d,o);var b=c({datasets:l});s.requestOnce("menu:state",function(t){return r.attachMenuStateRef(t)}),u({type:"SET_MENU",payload:{menu:b}}),u({type:"SET_DATASETS",payload:{mappedDatasets:y,orderedDatasets:d}}),e.init().then(function(){r.forEachDataset(function(t){if(t.hasDynamicGeoJSON){var r=function(t){var e,r,n,o=t.dynamicGeoJSON,a=t.mapProvider,i=t.onUpdate,u={features:new Map,fetchedBbox:null,currentController:null},s=function(){return q(u,{mapProvider: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.map.on("moveend",c),s(),{destroy:function(){var t,e;t=a.map,e=c,(t.off||t.un).call(t,"moveend",e),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,mapProvider:a,onUpdate:function(t,r){return e.setData(t,r)}});f.set(t.id,r)}}),e.attachDynamicSources(f),s.emit("datasets:ready")});var v=function(){e.onMapSizeChange()};s.on(i.MAP_SIZE_CHANGE,v);var h=s.emitWhenRequested("datasets:registry",r);return s.on("menu:changed",function(t){r.invalidateKeyItemsOnMenuStateChange(t),e.applyGlobalVisibility()}),{remove:function(){s.off(i.MAP_SIZE_CHANGE,v),h(),f.forEach(function(t){return t.destroy()}),f.clear(),e.destroy()},refreshDataset:function(t){var e;null===(e=f.get(t))||void 0===e||e.refresh()},clearDatasetCache:function(t){var e;null===(e=f.get(t))||void 0===e||e.clear()},getFeatureCount:function(t){var e,r;return null!==(e=null===(r=f.get(t))||void 0===r?void 0:r.getFeatureCount())&&void 0!==e?e:null}}};function Q(){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 tt(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]())):(tt(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,tt(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,tt(f,"constructor",l),tt(l,"constructor",s),s.displayName="GeneratorFunction",tt(l,o,"GeneratorFunction"),tt(f),tt(f,o,"Generator"),tt(f,n,function(){return this}),tt(f,"toString",function(){return"[object Generator]"}),(Q=function(){return{w:a,m:p}})()}function tt(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}tt=function(t,e,r,n){function a(e,r){tt(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))},tt(t,e,r,n)}function et(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 rt(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function i(t){et(a,n,o,i,u,"next",t)}function u(t){et(a,n,o,i,u,"throw",t)}i(void 0)})}}var nt=function(){var t=rt(Q().m(function t(e){var n,o,a,i,u,s,l;return Q().w(function(t){for(;;)switch(t.n){case 0:l=e.name,t.n="MapLibreProvider"===l?1:"EsriProvider"===l?3:"OpenLayersProvider"===l?5:7;break;case 1:return t.n=2,r.e(563).then(r.bind(r,291));case 2:return n=t.v,o=n.default,t.a(2,o);case 3:return t.n=4,Promise.resolve().then(function(){var t=new Error("Cannot find module './esri/esriLayerAdapter.js'");throw t.code="MODULE_NOT_FOUND",t});case 4:return a=t.v,i=a.default,t.a(2,i);case 5:return t.n=6,r.e(809).then(r.bind(r,382));case 6:return u=t.v,s=u.default,t.a(2,s);case 7:throw new Error("No layer adapter available for map provider ".concat(e.name,". Please provide a compatible layer adapter."));case 8:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),ot=function(){var t=rt(Q().m(function t(e,r,n,o){var a;return Q().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,nt(e);case 1:return a=t.v,t.a(2,new a(e,r,n,o))}},t)}));return function(e,r,n,o){return t.apply(this,arguments)}}(),at=function(t){var e=t.pluginConfig,r=t.pluginState;return!1!==e.hasMenu&&(r.menuInitialised?r.menu.length>0:(e.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}))}))};function it(){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 ut(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]())):(ut(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,ut(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return s.prototype=l,ut(f,"constructor",l),ut(l,"constructor",s),s.displayName="GeneratorFunction",ut(l,o,"GeneratorFunction"),ut(f),ut(f,o,"Generator"),ut(f,n,function(){return this}),ut(f,"toString",function(){return"[object Generator]"}),(it=function(){return{w:a,m:p}})()}function ut(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}ut=function(t,e,r,n){function a(e,r){ut(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))},ut(t,e,r,n)}function st(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 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}var ct="datasetsLayers";function ft(t){var e=t.appState,r=t.pluginConfig,n=t.pluginState,o=t.mapState,a=t.mapProvider,i=t.services,u=n.dispatch,s=n.datasetRegistry,l=i.eventBus,c=i.symbolRegistry,f=i.patternRegistry,p=Boolean(null==a?void 0:a.isBaseMapReady());!function(t){var e=t.appState,r=t.pluginConfig,n=t.pluginState,o=t.services.eventBus,a=at({pluginConfig:r,pluginState:n}),i=Boolean(e.openPanels[ct]);(0,T.useEffect)(function(){!a&&i&&o.emit(k.APP_HIDE_PANEL,ct)},[a,i])}({appState:e,pluginConfig:r,pluginState:n,services:i});var y=(0,T.useRef)(n);y.current=n;var d=(0,T.useRef)(null),b=function(t){var e=null==a?void 0:a.datasets;t.length&&e&&(t.forEach(function(t){var r,n=t.method,o=t.parameters;return e[n].apply(e,function(t){if(Array.isArray(t))return lt(t)}(r=o)||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 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}}(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.")}())}),u({type:"REMOVE_ADAPTER_ACTIONS",payload:t}))};return(0,T.useEffect)(function(){if(p&&!d.current){var t=function(){var t,e=(t=it().m(function t(){var e;return it().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,ot(a,c,f,s);case 1:e=t.v,d.current=X({adapter:e,datasetRegistry:s,pluginConfig:r,pluginStateRef:y,mapStyle:o.mapStyle,mapProvider:a,events:k,dispatch:u,eventBus:l}),a.datasets=e,b(y.current.actionsArray);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){st(a,n,o,i,u,"next",t)}function u(t){st(a,n,o,i,u,"throw",t)}i(void 0)})});return function(){return e.apply(this,arguments)}}();t()}},[p]),(0,T.useEffect)(function(){s.attach(n.mappedDatasets,n.orderedDatasets),l.emit("datasets:changed")},[n.mappedDatasets,n.orderedDatasets]),(0,T.useEffect)(function(){s.attachMapStyle(o.mapStyle);var t=null==a?void 0:a.datasets;null!=t&&t.onMapStyleChange&&Promise.resolve(t.onMapStyleChange()).then(function(){l.emit(k.MAP_DATA_CHANGE)})},[o.mapStyle]),(0,T.useEffect)(function(){return s.attachGlobals(n.globals)},[n.globals]),(0,T.useEffect)(function(){return b(n.actionsArray)},[n.actionsArray]),(0,T.useEffect)(function(){return function(){d.current&&(d.current.remove(),d.current=null,a.datasets=null)}},[]),null}var pt=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}})},yt=r(287),dt=function(t){var e=t.menuGroupItem,r=t.datasetRegistry,n=t.onChange,o=r.getDataset(e.id);if(!o)return null;var a=o.isSublayer?o.parentId:o.id,i=o.isSublayer?o.id:void 0,u="im-c-datasets-layers__item govuk-checkboxes govuk-checkboxes--small".concat(o.visible?"":" im-c-datasets-layers__item--checked");return(0,yt.jsx)("div",{className:u,"data-module":"govuk-checkboxes",children:(0,yt.jsxs)("div",{className:"govuk-checkboxes__item",children:[(0,yt.jsx)("input",{className:"govuk-checkboxes__input",id:o.id,"data-dataset-id":a,"data-sublayer-id":i,name:"layers",type:"checkbox",value:o.id,checked:o.isLocallyVisible,onChange:n}),(0,yt.jsx)("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:o.id,children:o.label})]})},o.id)},bt=function(t){var e=t.menuGroup,r=t.children;return e.groupLabel?(0,yt.jsx)("div",{className:"govuk-form-group im-c-datasets-layers-group",children:(0,yt.jsxs)("fieldset",{className:"im-c-datasets-layers-group__fieldset",children:[(0,yt.jsx)("legend",{className:"im-c-datasets-layers-group__legend",children:(0,yt.jsx)("h3",{children:e.groupLabel})}),r]})},e.id):(0,yt.jsx)(yt.Fragment,{children:r})},vt=function(t,e){(0,t.pluginState.dispatch)({type:"ADD_DATASET",payload:{dataset:e,mapStyle:t.mapState.mapStyle}})},ht=function(t,e){var r,n=t.pluginState.dispatch;null===(r=t.mapProvider.datasets)||void 0===r||r.removeDataset(e),n({type:"REMOVE_DATASET",payload:{id:e}})},mt=function(t,e,r){var n=t.pluginState,o=n.dispatch,a=n.datasetRegistry,i=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).datasetId,u=void 0===i?null:i;if(u){var s=a.getDataset(u);!s||s.idProperty||s.generateIds||g.v.warn('setFeatureVisibility: Dataset "'.concat(u,'" 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.'))}o({type:e?"SHOW_FEATURES":"HIDE_FEATURES",payload:{datasetId:u,featureIds:r}})},gt=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}})},St=function(t){var e=t.pluginState.datasetRegistry,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.datasetId,o=r.sublayerId;n=o?"".concat(n,"-").concat(o):n;var a=e.getDataset(n);return a?a.style:(g.v.warn("getStyle: Dataset with id ".concat(n," not found")),null)},Ot=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}})},Dt=function(t){var e,r=t.pluginState,n=r.globals,o=r.datasetRegistry,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=a.datasetId,u=a.sublayerId,s=u?"".concat(i,"-").concat(u):i;if(s){var l,c=o.getDataset(s);return c?null!==(l=c.opacity)&&void 0!==l?l:null:(g.v.warn("getOpacity: Dataset with id ".concat(s," not found")),null)}return null!==(e=n.opacity)&&void 0!==e?e:null},Pt=function(t,e,r){var n,o=t.pluginState.datasetRegistry,a=t.mapProvider,i=r.datasetId,u=o.getDataset(i);u?null!=u&&u.tiles?g.v.warn('setData called on vector tile dataset "'.concat(i,'" — has no effect')):null===(n=a.datasets)||void 0===n||n.setData(i,e):g.v.warn("setData: Dataset with id ".concat(i," not found"))},_t=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):g.v.warn("Ignoring invalid opacityMode: ".concat(n,". Must be one of 'dataset', 'global' or 'multiply'."))),a?r({type:"SET_GLOBAL_STATE",payload:o}):g.v.warn("setGlobals: requires a valid value for opacityMode to be set")},At=r(428);function wt(t){return wt="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},wt(t)}function Et(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 jt(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,It(n.key),n)}}function It(t){var e=function(t){if("object"!=wt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=wt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==wt(e)?e:e+""}var Tt=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 Et(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 Et(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)?Et(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)}}])&&jt(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function kt(t){return kt="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},kt(t)}function Mt(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 Ct(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)?Ct(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 Ct(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 Lt=function(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=0,n=Object.entries(t);r<n.length;r++){var o=Mt(n[r],2),a=o[0],i=o[1],u=e[a];if(!i.includes(u))return!1}return!0},xt=function(t,e){return(Array.isArray(t)?t:[t]).includes(e)};function Gt(t){return Gt="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},Gt(t)}function Rt(t){return function(t){if(Array.isArray(t))return Ft(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 Ft(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)?Ft(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 Ft(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 Nt(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 Bt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Nt(Object(r),!0).forEach(function(e){Vt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Vt(t,e,r){return(e=function(t){var e=function(t){if("object"!=Gt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Gt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Gt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Ut={attach:function(t,e,r){this._datasets=t,this._orderedDatasets=e,this.attachMapStyle(r),this._invalidateChangedDatasets()},_invalidateCache:function(){this._definitionCache=new Tt},_invalidateChangedDatasets:function(){this._datasets?this._definitionCache.invalidateChangedDatasets(Object.values(this._datasets)):this._invalidateCache()},attachCreateDataset:function(t){this._createDataset=t},_createDataset:function(t,e){return function(t,e){return new At.j(t,e)}(t,e)},attachMapStyle:function(t){t&&(this._mapStyle=t)},get mapStyle(){return this._mapStyle},attachGlobals:function(t){t&&(this._globals=t)},get globals(){return this._globals},attachMenuStateRef:function(t){this._menuStateRef=t},isVisibleWhen:function(t){var e,r;return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.mapStyleId,n=e.menuState;if(null==t)return!0;if("boolean"==typeof t)return t;if("object"===kt(t)){for(var o=0,a=Object.entries(t);o<a.length;o++){var i=Mt(a[o],2),u=i[0],s=i[1];if("mapStyleId"===u&&!xt(s,r))return!1;if("menu"===u&&!Lt(s,n))return!1}return!0}return!0}(t,{mapStyleId:null===(e=this._mapStyle)||void 0===e?void 0:e.id,menuState:null===(r=this._menuStateRef)||void 0===r||null===(r=r.current)||void 0===r?void 0:r.menuState})},get datasets(){return this._datasets},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,this);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 Bt(Bt({},t),{},{patternConfigs:[].concat(Rt(t.patternConfigs),Rt(e.patternConfigs)),symbolConfigs:[].concat(Rt(t.symbolConfigs),Rt(e.symbolConfigs))})},{patternConfigs:[],symbolConfigs:[]})},invalidateKeyItemsOnMenuStateChange:function(t){t!==this._lastMenuState&&(this._lastMenuState=t,this._lastKeyItemsDatasets=null)},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}};function Wt(t){return Wt="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},Wt(t)}function Ht(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 Kt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ht(Object(r),!0).forEach(function(e){Zt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function Zt(t,e,r){return(e=function(t){var e=function(t){if("object"!=Wt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=Wt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Wt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Yt={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;pt({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,yt.jsx)("div",{className:i,children:n.map(function(t){return(0,yt.jsxs)(bt,{menuGroup:t,children:[" ",t.items.map(function(t){return(0,yt.jsx)(dt,{menuGroupItem:t,datasetRegistry:e.datasetRegistry,onChange:o},t.id)})]},t.id)})})}},zt={id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",excludeWhen:function(t){return!at(t)},iconId:"layers",mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}},Jt=function(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).hasMenu;return{InitComponent:ft,reducer:{initialState:Kt(Kt({},w),{},{datasetRegistry:Object.assign(Object.create(Ut),{_definitionCache:new Tt,_globals:{},_menuStateRef:{},_lastMenuState:{},_lastKeyItems:{}})}),actions:I},panels:!1===t?[]:[Yt],buttons:!1===t?[]:[zt],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:vt,removeDataset:ht,setDatasetVisibility:pt,setFeatureVisibility:mt,setStyle:gt,getStyle:St,setOpacity:Ot,getOpacity:Dt,setData:Pt,setGlobals:_t}}}},428:function(t,e,r){r.d(e,{j:function(){return g}});var n=r(852);new Set,new Set(["symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolDescription"]);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){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 i(t,e,r){return(e=l(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(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,l(n.key),n)}}function s(t,e,r){return e&&u(t.prototype,e),r&&u(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function l(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 c=s(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?a(Object(r),!0).forEach(function(e){i(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(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})});function f(t){return f="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},f(t)}function p(t){return function(t){if(Array.isArray(t))return y(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 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}}(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 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}function d(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 b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?d(Object(r),!0).forEach(function(e){v(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function v(t,e,r){return(e=m(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(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,m(n.key),n)}}function m(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}var g=function(){return t=function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._datasetDefinition=e,this._datasetRegistry=r},(e=[{key:"id",get:function(){return this._datasetDefinition.id}},{key:"label",get:function(){return this._datasetDefinition.label}},{key:"hasSymbol",get:function(){return!this.hasSublayers&&!!(null!=(t=this.style)&&t.symbol||null!=t&&t.symbolSvgContent);var t}},{key:"hasPattern",get:function(){return!(this.hasSublayers||this.hasSymbol||(t=this.style,!t.fillPattern&&!t.fillPatternSvgContent));var t}},{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 function(t,e,r){switch(t.opacityMode){case"global":return t.opacity;case"multiply":return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.round(100*(e*r*t.opacity+Number.EPSILON))/100}(t,e,r);default:return function(t,e,r){return void 0===e?void 0===r?t.opacity:r:e}(t,e,r)}}(this._datasetRegistry.globals,r,n)}},{key:"hasDynamicGeoJSON",get:function(){return Boolean(this._datasetDefinition.dynamicGeoJSON)}},{key:"dynamicGeoJSON",get:function(){return new c(b(b({},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):!this._datasetRegistry.globals.visible}},{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&&this._datasetRegistry.globals.visible}},{key:"esriStyleLayerId",get:function(){return this._datasetDefinition.esriStyleLayerId}},{key:"visibility",get:function(){var t=this.visible,e=this.visibleWhen;return t&&e?this._datasetRegistry.isVisibleWhen(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,e=this.sublayerIds;return e?e.map(function(e){return t._datasetRegistry.getDataset(e)}):[]}},{key:"parent",get:function(){if(this._datasetDefinition.parentId)return this._datasetRegistry.getDataset(this._datasetDefinition.parentId)}},{key:"inheritedStyle",get:function(){var t=this._datasetDefinition.style||{},e=this.parent;return e?b(b({},e.inheritedStyle),{},{opacity:void 0},t):t}},{key:"style",get:function(){return b(b({},(0,n.Eg)(this.inheritedStyle)),{},{symbolDescription:this.symbolDescription})}},{key:"hasCustomVisualStyle",get:function(){return(0,n.p_)(this._datasetDefinition.style||{})}},{key:"symbolDescription",get:function(){var t;return null!==(t=this._datasetDefinition.style)&&void 0!==t&&t.symbolDescription?this._datasetDefinition.style.symbolDescription:this.hasCustomVisualStyle?void 0:this.parent?this.parent.symbolDescription:n.V.style.symbolDescription}},{key:"patternConfigs",get:function(){var t=this.hasPattern?[this.style]:[];return this.hasSublayers?[].concat(t,p(this.sublayers.flatMap(function(t){return t.patternConfigs}))):t}},{key:"symbolConfigs",get:function(){var t=this.hasSymbol?[this.style]:[];return this.hasSublayers?[].concat(t,p(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}}}])&&h(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}()},619:function(t,e,r){r.d(e,{v:function(){return 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))}}}}]);
@@ -45,10 +45,25 @@ export default class EsriLayerAdapter extends LayerAdapter {
45
45
  }
46
46
 
47
47
  async init () {
48
+ try {
49
+ await this._init()
50
+ } finally {
51
+ // Always settle `ready` so a failed layer doesn't block later toggles
52
+ this.resolveReady()
53
+ }
54
+ }
55
+
56
+ async _init () {
48
57
  const topLevelDatasets = this._datasetRegistry.topLevelDatasets()
58
+ const visibleDatasets = topLevelDatasets.filter(dataset => dataset.visibility === 'visible')
59
+ const hiddenDatasets = topLevelDatasets.filter(dataset => dataset.visibility !== 'visible')
60
+
49
61
  // ensure the datasets are added in order
50
- const _add = async (registryDataset) => {
62
+ const _add = async (registryDataset, setVisibility = false) => {
51
63
  return this._addLayers(registryDataset).then(() => {
64
+ if (!setVisibility) {
65
+ return
66
+ }
52
67
  const mapLayer = this._mapVisibilityLayers[registryDataset.id]
53
68
  registryDataset.sublayers?.forEach(sublayer => {
54
69
  if (sublayer.visibility === 'visible') {
@@ -56,22 +71,24 @@ export default class EsriLayerAdapter extends LayerAdapter {
56
71
  }
57
72
  })
58
73
  this.applyDatasetVisibility(registryDataset.id) // NOSONAR: Not changing for now as used in production
74
+ }).catch(async (error) => {
75
+ // A failed layer must not stop the remaining datasets loading; drop it so later steps skip it
76
+ logger.error(`Error adding layer for dataset ${registryDataset.id}:`, error)
77
+ await this.removeDataset(registryDataset.id)
59
78
  })
60
79
  }
61
80
 
62
81
  // Add the visible datasets first - to speed up rendering
63
- for (const registryDataset of topLevelDatasets) {
64
- if (registryDataset.visibility === 'visible') {
65
- await _add(registryDataset) // NOSONAR: Await inside a for loop is fine, parent function is async
66
- }
82
+ for (const registryDataset of visibleDatasets) {
83
+ await _add(registryDataset, true) // NOSONAR: Await inside a for loop is fine, parent function is async
67
84
  }
85
+
68
86
  // Reorder layers after adding the initially visible datasets
69
87
  this._reorderLayers()
70
88
  // Add the non-visible datasets next
71
- for (const registryDataset of topLevelDatasets) {
72
- if (registryDataset.visibility !== 'visible') {
73
- await _add(registryDataset) // NOSONAR: Await inside a for loop is fine, parent function is async
74
- }
89
+
90
+ for (const registryDataset of hiddenDatasets) {
91
+ await _add(registryDataset) // NOSONAR: Await inside a for loop is fine, parent function is async
75
92
  }
76
93
 
77
94
  // onMapStyleChange: handles showing and hiding sublayers based on the current mapStyle
@@ -84,7 +101,6 @@ export default class EsriLayerAdapter extends LayerAdapter {
84
101
  // Finally show all layers that are visible based on the dataset/mapStyle visibility
85
102
  await Promise.all(topLevelDatasets.map(registryDataset => this.applyDatasetVisibility(registryDataset.id)))
86
103
  this._reorderLayers()
87
- this.resolveReady()
88
104
  }
89
105
 
90
106
  _reorderLayers () {
@@ -242,6 +258,7 @@ export default class EsriLayerAdapter extends LayerAdapter {
242
258
  }
243
259
 
244
260
  async applyGlobalVisibility () {
261
+ await this.ready
245
262
  this._datasetRegistry.forEachDataset(registryDataset => this._applyRegistryDatasetVisibility(registryDataset))
246
263
  }
247
264
 
@@ -285,6 +285,44 @@ describe('esriLayerAdapter', () => {
285
285
  })
286
286
  })
287
287
 
288
+ describe('ready', () => {
289
+ const isSettled = async (promise) => {
290
+ const pending = Symbol('pending')
291
+ return (await Promise.race([promise, Promise.resolve(pending)])) !== pending
292
+ }
293
+
294
+ it('is pending until init completes, then resolves', async () => {
295
+ const freshAdapter = new EsriLayerAdapter(mapProvider, null, null, datasetRegistry)
296
+ expect(await isSettled(freshAdapter.ready)).toBe(false)
297
+ await freshAdapter.init()
298
+ expect(await isSettled(freshAdapter.ready)).toBe(true)
299
+ })
300
+
301
+ it('resolves even when init throws unexpectedly', async () => {
302
+ const freshAdapter = new EsriLayerAdapter(mapProvider, null, null, datasetRegistry)
303
+ jest.spyOn(freshAdapter, 'onMapStyleChange').mockRejectedValue(new Error('boom'))
304
+ await expect(freshAdapter.init()).rejects.toThrow('boom')
305
+ expect(await isSettled(freshAdapter.ready)).toBe(true)
306
+ })
307
+ })
308
+
309
+ describe('init failure', () => {
310
+ it('skips a layer that fails to load and still loads the rest', async () => {
311
+ const failingAdapter = new EsriLayerAdapter(mapProvider, null, null, datasetRegistry)
312
+ const addLayers = failingAdapter._addLayers.bind(failingAdapter)
313
+ jest.spyOn(failingAdapter, '_addLayers').mockImplementation(async (dataset) => {
314
+ await addLayers(dataset)
315
+ if (dataset.id === 'flood-zones') {
316
+ throw new Error('404')
317
+ }
318
+ })
319
+ await expect(failingAdapter.init()).resolves.toBeUndefined()
320
+ await expect(failingAdapter.ready).resolves.toBeUndefined()
321
+ expect(failingAdapter._mapVisibilityLayers['flood-zones']).toBeUndefined()
322
+ expect(failingAdapter._mapVisibilityLayers['flood-zones-cc']).toBeDefined()
323
+ })
324
+ })
325
+
288
326
  // ─── onMapSizeChange ─────────────────────────────────────────────────────────
289
327
 
290
328
  describe('onMapSizeChange', () => {
@@ -72,16 +72,19 @@ export const datasetsToMenu = (state) => {
72
72
  }
73
73
 
74
74
  export const addDatasetToMenu = (state, dataset) => {
75
- const menu = [...state.menu]
76
- const datasetMenuEntry = datasetsToMenu({ datasets: [dataset] })
77
- // For each entry in the new dataset menu, either add it to an existing group or add it as a new entry
78
- const existingGroup = menu.find(entry => entry.groupLabel === datasetMenuEntry[0].groupLabel)
79
- if (existingGroup) {
80
- existingGroup.items.push(...datasetMenuEntry[0].items)
81
- } else {
82
- menu.push(...datasetMenuEntry)
75
+ const [datasetMenuEntry] = datasetsToMenu({ datasets: [dataset] })
76
+ if (!datasetMenuEntry) {
77
+ return state.menu
83
78
  }
84
- return menu
79
+ // Add the dataset to an existing entry with the same groupLabel, or as a new entry
80
+ const existingEntry = state.menu.find(entry => entry.groupLabel === datasetMenuEntry.groupLabel)
81
+ if (!existingEntry) {
82
+ return [...state.menu, datasetMenuEntry]
83
+ }
84
+ return state.menu.map(entry => entry === existingEntry
85
+ ? { ...entry, items: [...entry.items, ...datasetMenuEntry.items] }
86
+ : entry
87
+ )
85
88
  }
86
89
 
87
90
  export const removeDatasetsFromMenu = (menu, datasetsToRemove) => {
@@ -115,6 +115,48 @@ describe('addDatasetToMenu', () => {
115
115
  expect(result).toHaveLength(1)
116
116
  expect(result[0].items[0].id).toBe('parks')
117
117
  })
118
+ it('returns the menu unchanged when the dataset is not in the menu', () => {
119
+ const state = {
120
+ menu: [{ id: 'roads', type: 'checkbox', visibleWhen: true, items: [{ id: 'roads', label: 'Roads' }] }]
121
+ }
122
+ const dataset = { id: 'highlights', label: 'Highlights' }
123
+ expect(addDatasetToMenu(state, dataset)).toBe(state.menu)
124
+ })
125
+
126
+ it('adds an ungrouped dataset next to the existing ungrouped items', () => {
127
+ const state = {
128
+ menu: [
129
+ { id: 'roads', type: 'checkbox', visibleWhen: true, items: [{ id: 'roads', label: 'Roads' }] },
130
+ { id: 'Layers', groupLabel: 'Layers', type: 'checkbox', visibleWhen: true, items: [{ id: 'rivers', label: 'Rivers' }] }
131
+ ]
132
+ }
133
+ const dataset = { id: 'parks', label: 'Parks', showInMenu: true }
134
+ const result = addDatasetToMenu(state, dataset)
135
+ expect(result).toHaveLength(2)
136
+ expect(result[0].items.map(item => item.id)).toEqual(['roads', 'parks'])
137
+ })
138
+
139
+ it('does not change the existing menu or its groups', () => {
140
+ const roads = { id: 'roads', label: 'Roads' }
141
+ const group = { id: 'Layers', groupLabel: 'Layers', type: 'checkbox', visibleWhen: true, items: [roads] }
142
+ const state = { menu: [group] }
143
+ const dataset = { id: 'rivers', label: 'Rivers', showInMenu: true, groupLabel: 'Layers' }
144
+ const result = addDatasetToMenu(state, dataset)
145
+ expect(state.menu).toEqual([group])
146
+ expect(group.items).toEqual([roads])
147
+ expect(result[0]).not.toBe(group)
148
+ })
149
+
150
+ it('gives the same result when run twice on the same state', () => {
151
+ const state = {
152
+ menu: [{ id: 'Layers', groupLabel: 'Layers', type: 'checkbox', visibleWhen: true, items: [{ id: 'roads', label: 'Roads' }] }]
153
+ }
154
+ const dataset = { id: 'rivers', label: 'Rivers', showInMenu: true, groupLabel: 'Layers' }
155
+ const first = addDatasetToMenu(state, dataset)
156
+ const second = addDatasetToMenu(state, dataset)
157
+ expect(second).toEqual(first)
158
+ expect(second[0].items.map(item => item.id)).toEqual(['roads', 'rivers'])
159
+ })
118
160
  })
119
161
 
120
162
  describe('removeDatasetsFromMenu', () => {
@@ -105,6 +105,18 @@ describe('ADD_DATASET', () => {
105
105
  })
106
106
  })
107
107
 
108
+ it('adds a dataset that is not in the menu and leaves the menu unchanged', () => {
109
+ const menu = [{ id: 'roads', type: 'checkbox', visibleWhen: true, items: [{ id: 'roads', label: 'Roads' }] }]
110
+ const state = makeState({ menu })
111
+ const dataset = { id: 'highlights', label: 'Highlights' }
112
+
113
+ const result = actions.ADD_DATASET(state, { dataset, mapStyle: {} })
114
+
115
+ expect(result.mappedDatasets).toHaveProperty('highlights')
116
+ expect(result.orderedDatasets).toContain('highlights')
117
+ expect(result.menu).toBe(menu)
118
+ })
119
+
108
120
  it('logs error and returns unchanged state when dataset already exists', () => {
109
121
  const state = makeStateWithDataset('roads')
110
122
  const result = actions.ADD_DATASET(state, { dataset: { id: 'roads', label: 'Roads' }, mapStyle: {} })