@defra/interactive-map 0.0.55-alpha → 0.0.56-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/style-switcher.njk +2 -2
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/index.js +1 -1
- package/docs/api/context.md +2 -0
- package/docs/api.md +17 -1
- package/docs/architecture/interactive-map.likec4 +4 -4
- package/docs/plugins/datasets.md +11 -0
- package/docs/plugins/draw.md +8 -2
- package/docs/plugins/interact.md +24 -1
- package/docs/plugins/search.md +2 -2
- package/docusaurus.config.cjs +25 -3
- package/govuk-prototype-kit.config.json +6 -7
- package/package.json +20 -23
- package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/esm/index.js +1 -1
- package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/index.js +1 -1
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +18 -16
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +2 -2
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.js +2 -3
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
- package/plugins/datasets/src/adapters/loadLayerAdapter.js +2 -20
- package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +9 -9
- package/plugins/datasets/src/adapters/mapboxStyleLayerAdapter.js +7 -7
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +19 -19
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +1 -1
- package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +1 -1
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +2 -2
- package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +1 -1
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +21 -21
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +5 -5
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +2 -3
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +2 -2
- package/plugins/datasets/src/api/getOpacity.js +1 -2
- package/plugins/datasets/src/api/getOpacity.test.js +9 -12
- package/plugins/datasets/src/api/getStyle.js +1 -2
- package/plugins/datasets/src/api/getStyle.test.js +5 -8
- package/plugins/datasets/src/api/removeDataset.js +2 -4
- package/plugins/datasets/src/api/removeDataset.test.js +5 -10
- package/plugins/datasets/src/api/setData.js +2 -4
- package/plugins/datasets/src/api/setData.test.js +6 -14
- package/plugins/datasets/src/api/setFeatureVisibility.js +1 -2
- package/plugins/datasets/src/api/setFeatureVisibility.test.js +8 -11
- package/plugins/datasets/src/components/LayersMenu/LayersMenu.jsx +1 -0
- package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +1 -3
- package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.test.jsx +13 -18
- package/plugins/datasets/src/index.js +2 -2
- package/plugins/datasets/src/index.test.js +8 -1
- package/plugins/datasets/src/initialise/DatasetsInit.jsx +48 -26
- package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +160 -89
- package/plugins/datasets/src/initialise/initialiseDatasets.js +2 -3
- package/plugins/datasets/src/initialise/initialiseDatasets.test.js +23 -10
- package/plugins/datasets/src/manifest.js +53 -44
- package/plugins/datasets/src/manifest.test.js +36 -4
- package/plugins/datasets/src/reducers/pluginState.js +5 -5
- package/plugins/datasets/src/reducers/pluginState.test.js +21 -20
- package/plugins/datasets/src/registry/__mocks__/datasetRegistry.js +7 -6
- package/plugins/datasets/src/registry/createDataset.js +2 -2
- package/plugins/datasets/src/registry/dataset.js +9 -10
- package/plugins/datasets/src/registry/dataset.test.js +63 -64
- package/plugins/datasets/src/registry/datasetRegistry.js +39 -10
- package/plugins/datasets/src/registry/datasetRegistry.test.js +83 -1
- package/plugins/datasets/src/registry/globalDataset.js +9 -17
- package/plugins/datasets/src/registry/isVisibleWhen.js +9 -17
- package/plugins/datasets/src/registry/isVisibleWhen.test.js +27 -20
- package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +26 -27
- package/plugins/datasets/src/utils/hasLayersMenu.js +13 -0
- package/plugins/datasets/src/utils/hasLayersMenu.test.js +25 -0
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/DrawInit.jsx +47 -26
- package/plugins/draw/src/DrawInit.test.jsx +90 -2
- package/plugins/draw/src/adapters/openlayers/core/styles.test.js +1 -1
- package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +1 -1
- package/plugins/draw/src/manifest.js +3 -2
- package/plugins/draw/src/manifest.test.js +13 -1
- package/plugins/draw/src/utils/needsDrawTarget.js +22 -0
- package/plugins/draw/src/utils/needsDrawTarget.test.js +42 -0
- package/plugins/draw-es/dist/esm/index.js +1 -0
- package/plugins/{beta/draw-es → draw-es}/src/DrawInit.jsx +1 -1
- package/plugins/{beta/draw-es → draw-es}/src/events.test.js +1 -1
- package/plugins/{beta/draw-es → draw-es}/src/graphic.js +1 -1
- package/plugins/frame/dist/esm/index.js +1 -0
- package/plugins/{beta/frame → frame}/dist/umd/im-frame-plugin.js +1 -1
- package/plugins/{beta/frame → frame}/dist/umd/index.js +1 -1
- package/plugins/{beta/frame → frame}/package.json +2 -2
- package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/esm/index.js +1 -1
- package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
- package/plugins/interact/dist/umd/index.js +1 -1
- package/plugins/interact/src/InteractInit.jsx +3 -3
- package/plugins/interact/src/api/enable.test.js +13 -0
- package/plugins/interact/src/defaults.js +1 -0
- package/plugins/interact/src/hooks/useCrossHairVisibility.js +27 -17
- package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +72 -7
- package/plugins/interact/src/manifest.js +4 -4
- package/plugins/interact/src/manifest.test.js +29 -0
- package/plugins/interact/src/reducer.js +7 -2
- package/plugins/interact/src/reducer.test.js +12 -2
- package/plugins/interact/src/utils/needsTarget.js +20 -0
- package/plugins/interact/src/utils/needsTarget.test.js +36 -0
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/esm/index.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/index.js +1 -1
- package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +4 -0
- package/plugins/map-key/src/components/Key/MapKey.jsx +15 -15
- package/plugins/map-key/src/components/Key/MapKey.test.jsx +29 -15
- package/plugins/map-key/src/initialise/MapKeyInit.jsx +5 -8
- package/plugins/map-key/src/initialise/MapKeyInit.test.jsx +9 -7
- package/plugins/map-key/src/manifest.test.js +0 -1
- package/plugins/map-key/src/reducers/mergeKeyGroupItems.js +14 -33
- package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +34 -50
- package/plugins/map-key/src/reducers/pluginState.js +6 -1
- package/plugins/map-key/src/reducers/pluginState.test.js +13 -4
- package/plugins/map-styles/dist/esm/index.js +1 -0
- package/plugins/{beta/map-styles → map-styles}/dist/umd/im-map-styles-plugin.js +1 -1
- package/plugins/{beta/map-styles → map-styles}/dist/umd/index.js +1 -1
- package/plugins/{beta/map-styles → map-styles}/src/MapStyles.jsx +2 -2
- package/plugins/{beta/map-styles → map-styles}/src/MapStylesInit.jsx +1 -1
- package/plugins/menu/dist/esm/index.js +1 -1
- package/plugins/scale-bar/dist/esm/index.js +1 -0
- package/plugins/{beta/scale-bar → scale-bar}/dist/umd/im-scale-bar-plugin.js +1 -1
- package/plugins/{beta/scale-bar → scale-bar}/dist/umd/index.js +1 -1
- package/plugins/{beta/scale-bar → scale-bar}/package.json +2 -2
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/esm/index.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/index.js +1 -1
- package/plugins/search/src/components/Suggestions/Suggestions.jsx +3 -1
- package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +11 -0
- package/plugins/search/src/utils/markedToElements.jsx +25 -0
- package/plugins/search/src/utils/markedToElements.test.jsx +49 -0
- package/plugins/search/src/utils/parseOsNamesResults.js +6 -4
- package/plugins/search/src/utils/parseOsNamesResults.test.js +18 -0
- package/plugins/use-location/dist/esm/index.js +1 -0
- package/plugins/{beta/use-location → use-location}/dist/umd/im-use-location-plugin.js +1 -1
- package/plugins/{beta/use-location → use-location}/dist/umd/index.js +1 -1
- package/providers/esri/dist/esm/index.js +1 -0
- package/providers/{beta/esri → esri}/src/esriProvider.js +1 -1
- package/providers/{beta/esri → esri}/src/mapEvents.js +2 -2
- package/providers/maplibre/dist/esm/index.js +1 -1
- package/providers/open-names/dist/esm/index.js +1 -0
- package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js +1 -1
- package/providers/{beta/open-names → open-names}/dist/umd/index.js +1 -1
- package/providers/openlayers/dist/esm/index.js +1 -0
- package/providers/openlayers/dist/umd/im-openlayers-provider.js +2 -0
- package/providers/{beta/openlayers → openlayers}/dist/umd/index.js +1 -1
- package/providers/{beta/openlayers → openlayers}/src/index.js +4 -4
- package/providers/{beta/openlayers → openlayers}/src/mapEvents.js +2 -2
- package/providers/{beta/openlayers → openlayers}/src/mapEvents.test.js +2 -2
- package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.js +3 -3
- package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.js +1 -1
- package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.js +1 -1
- package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.js +1 -1
- package/rollup.esm.mjs +43 -47
- package/sonar-project.properties +1 -1
- package/src/App/App.jsx +4 -1
- package/src/App/App.test.jsx +6 -0
- package/src/App/renderer/PluginInits.jsx +8 -7
- package/src/App/renderer/PluginInits.test.jsx +20 -5
- package/src/App/renderer/SlotItemsProvider.jsx +33 -0
- package/src/App/renderer/SlotItemsProvider.test.jsx +59 -0
- package/src/App/renderer/SlotRenderer.jsx +3 -14
- package/src/App/renderer/SlotRenderer.test.jsx +11 -44
- package/src/App/renderer/mapButtons.js +22 -11
- package/src/App/renderer/mapButtons.test.js +23 -1
- package/src/App/renderer/mapControls.js +6 -8
- package/src/App/renderer/mapControls.test.js +10 -0
- package/src/App/renderer/mapPanels.js +16 -19
- package/src/App/renderer/mapPanels.test.js +37 -9
- package/src/App/renderer/pluginWrapper.js +10 -8
- package/src/App/renderer/pluginWrapper.test.js +23 -9
- package/src/App/renderer/slotAggregator.js +18 -5
- package/src/App/renderer/slotAggregator.test.js +68 -25
- package/src/App/renderer/slotHelpers.js +13 -0
- package/src/App/renderer/slotHelpers.test.js +16 -1
- package/src/App/store/AppProvider.jsx +19 -1
- package/src/App/store/AppProvider.test.jsx +41 -0
- package/src/App/store/appActionsMap.js +10 -1
- package/src/App/store/appActionsMap.test.js +21 -0
- package/src/App/store/appDispatchMiddleware.js +29 -17
- package/src/App/store/appDispatchMiddleware.test.js +31 -0
- package/src/InteractiveMap/parseDataProperties.js +4 -4
- package/src/InteractiveMap/parseDataProperties.test.js +62 -6
- package/src/config/events.js +4 -2
- package/src/scss/tools/_govuk-content.scss +4 -3
- package/webpack.dev.mjs +9 -3
- package/webpack.prod.mjs +11 -4
- package/webpack.umd.mjs +6 -7
- package/plugins/beta/draw-es/dist/esm/index.js +0 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
- package/plugins/beta/draw-ml/dist/esm/index.js +0 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
- package/plugins/beta/draw-ml/dist/umd/index.js +0 -2
- package/plugins/beta/draw-ml/src/DrawInit.jsx +0 -85
- package/plugins/beta/draw-ml/src/api/addFeature.js +0 -27
- package/plugins/beta/draw-ml/src/api/deleteFeature.js +0 -13
- package/plugins/beta/draw-ml/src/api/editFeature.js +0 -75
- package/plugins/beta/draw-ml/src/api/merge.js +0 -9
- package/plugins/beta/draw-ml/src/api/newLine.js +0 -68
- package/plugins/beta/draw-ml/src/api/newPolygon.js +0 -68
- package/plugins/beta/draw-ml/src/api/split.js +0 -81
- package/plugins/beta/draw-ml/src/defaults.js +0 -17
- package/plugins/beta/draw-ml/src/draw.scss +0 -26
- package/plugins/beta/draw-ml/src/events.js +0 -185
- package/plugins/beta/draw-ml/src/index.js +0 -13
- package/plugins/beta/draw-ml/src/manifest.js +0 -110
- package/plugins/beta/draw-ml/src/mapboxDraw.js +0 -143
- package/plugins/beta/draw-ml/src/mapboxSnap.js +0 -321
- package/plugins/beta/draw-ml/src/modes/createDrawMode.js +0 -552
- package/plugins/beta/draw-ml/src/modes/disabledMode.js +0 -23
- package/plugins/beta/draw-ml/src/modes/drawLineMode.js +0 -18
- package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +0 -16
- package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +0 -135
- package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +0 -2
- package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +0 -142
- package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +0 -133
- package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +0 -142
- package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +0 -121
- package/plugins/beta/draw-ml/src/modes/editVertexMode.js +0 -495
- package/plugins/beta/draw-ml/src/reducer.js +0 -90
- package/plugins/beta/draw-ml/src/styles.js +0 -190
- package/plugins/beta/draw-ml/src/undoStack.js +0 -50
- package/plugins/beta/draw-ml/src/utils/debounce.js +0 -16
- package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +0 -49
- package/plugins/beta/draw-ml/src/utils/snapHelpers.js +0 -200
- package/plugins/beta/draw-ml/src/utils/spatial.js +0 -258
- package/plugins/beta/draw-ol/dist/css/index.css +0 -1
- package/plugins/beta/draw-ol/dist/esm/DrawMode.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/EditMode.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/index.js +0 -1
- package/plugins/beta/draw-ol/src/DrawInit.jsx +0 -65
- package/plugins/beta/draw-ol/src/api/addFeature.js +0 -29
- package/plugins/beta/draw-ol/src/api/deleteFeature.js +0 -11
- package/plugins/beta/draw-ol/src/api/editFeature.js +0 -50
- package/plugins/beta/draw-ol/src/api/newLine.js +0 -44
- package/plugins/beta/draw-ol/src/api/newPolygon.js +0 -44
- package/plugins/beta/draw-ol/src/core/OLDrawManager.js +0 -153
- package/plugins/beta/draw-ol/src/core/featureStore.js +0 -65
- package/plugins/beta/draw-ol/src/core/styles.js +0 -98
- package/plugins/beta/draw-ol/src/core/undoStack.js +0 -31
- package/plugins/beta/draw-ol/src/defaults.js +0 -16
- package/plugins/beta/draw-ol/src/draw/DrawMode.js +0 -121
- package/plugins/beta/draw-ol/src/draw/drawInput.js +0 -243
- package/plugins/beta/draw-ol/src/draw.scss +0 -17
- package/plugins/beta/draw-ol/src/edit/EditMode.js +0 -424
- package/plugins/beta/draw-ol/src/edit/keyboardHandler.js +0 -229
- package/plugins/beta/draw-ol/src/edit/midpointLayer.js +0 -57
- package/plugins/beta/draw-ol/src/edit/touchHandler.js +0 -171
- package/plugins/beta/draw-ol/src/edit/undoOps.js +0 -95
- package/plugins/beta/draw-ol/src/edit/vertexHitTest.js +0 -72
- package/plugins/beta/draw-ol/src/edit/vertexLayer.js +0 -49
- package/plugins/beta/draw-ol/src/edit/vertexOps.js +0 -99
- package/plugins/beta/draw-ol/src/events.js +0 -114
- package/plugins/beta/draw-ol/src/index.js +0 -12
- package/plugins/beta/draw-ol/src/manifest.js +0 -125
- package/plugins/beta/draw-ol/src/olDraw.js +0 -38
- package/plugins/beta/draw-ol/src/reducer.js +0 -41
- package/plugins/beta/draw-ol/src/snap/snapEngine.js +0 -153
- package/plugins/beta/draw-ol/src/snap/snapGeometry.js +0 -177
- package/plugins/beta/draw-ol/src/snap/snapIndicator.js +0 -81
- package/plugins/beta/draw-ol/src/snap/snapInteraction.js +0 -57
- package/plugins/beta/draw-ol/src/snap/snapManager.js +0 -99
- package/plugins/beta/draw-ol/src/utils/flattenStyleProperties.js +0 -47
- package/plugins/beta/draw-ol/src/utils/geometryHelpers.js +0 -103
- package/plugins/beta/draw-ol/src/utils/olCoords.js +0 -35
- package/plugins/beta/draw-ol/src/utils/resolveColors.js +0 -39
- package/plugins/beta/draw-ol/src/utils/spatial.js +0 -24
- package/plugins/beta/draw-ol/src/utils/touchTarget.js +0 -61
- package/plugins/beta/frame/dist/esm/index.js +0 -1
- package/plugins/beta/map-styles/dist/esm/index.js +0 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +0 -1
- package/plugins/beta/use-location/dist/esm/index.js +0 -1
- package/plugins/map-key/src/registry/getDatasetRegistry.js +0 -6
- package/plugins/map-key/src/registry/getDatasetRegistry.test.js +0 -23
- package/plugins/map-key/src/registry/index.js +0 -1
- package/plugins/map-key/src/registry/index.test.js +0 -7
- package/providers/beta/esri/dist/esm/index.js +0 -1
- package/providers/beta/open-names/dist/esm/index.js +0 -1
- package/providers/beta/openlayers/dist/esm/index.js +0 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +0 -2
- package/providers/beta/openlayers/dist/umd/index.js.LICENSE.txt +0 -1
- /package/plugins/{beta/draw-es → draw-es}/dist/esm/im-draw-es-plugin.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/addFeature.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/deleteFeature.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/editFeature.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/newPolygon.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/removeSafeZone.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/events.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/index.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/manifest.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/reducer.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/sketchViewModel.js +0 -0
- /package/plugins/{beta/frame → frame}/dist/css/index.css +0 -0
- /package/plugins/{beta/frame → frame}/dist/esm/im-frame-plugin.js +0 -0
- /package/plugins/{beta/draw-ml → frame}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/frame → frame}/src/Frame.jsx +0 -0
- /package/plugins/{beta/frame → frame}/src/FrameInit.jsx +0 -0
- /package/plugins/{beta/frame → frame}/src/api/addFrame.js +0 -0
- /package/plugins/{beta/frame → frame}/src/api/editFeature.js +0 -0
- /package/plugins/{beta/frame → frame}/src/config.js +0 -0
- /package/plugins/{beta/frame → frame}/src/frame.scss +0 -0
- /package/plugins/{beta/frame → frame}/src/index.js +0 -0
- /package/plugins/{beta/frame → frame}/src/manifest.js +0 -0
- /package/plugins/{beta/frame → frame}/src/reducer.js +0 -0
- /package/plugins/{beta/frame → frame}/src/utils.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/dist/css/index.css +0 -0
- /package/plugins/{beta/map-styles → map-styles}/dist/esm/im-map-styles-plugin.js +0 -0
- /package/plugins/{beta/frame → map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/config.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/index.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/manifest.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/mapStyles.scss +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/dist/css/index.css +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/dist/esm/im-scale-bar-plugin.js +0 -0
- /package/plugins/{beta/map-styles → scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.jsx +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.test.jsx +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/index.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/index.test.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/manifest.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/scaleBar.scss +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/utils.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/utils.test.js +0 -0
- /package/plugins/{beta/use-location → use-location}/dist/esm/im-use-location-plugin.js +0 -0
- /package/plugins/{beta/scale-bar → use-location}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/use-location → use-location}/src/UseLocation.jsx +0 -0
- /package/plugins/{beta/use-location → use-location}/src/UseLocationInit.jsx +0 -0
- /package/plugins/{beta/use-location → use-location}/src/defaults.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/events.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/index.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/manifest.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/reducer.js +0 -0
- /package/providers/{beta/esri → esri}/dist/css/index.css +0 -0
- /package/providers/{beta/esri → esri}/dist/esm/im-esri-provider.js +0 -0
- /package/providers/{beta/esri → esri}/src/appEvents.js +0 -0
- /package/providers/{beta/esri → esri}/src/defaults.js +0 -0
- /package/providers/{beta/esri → esri}/src/esriProvider.scss +0 -0
- /package/providers/{beta/esri → esri}/src/index.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/coords.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/coords.test.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/detectWebGL.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/esriFixes.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/query.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/spatial.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/spatial.test.js +0 -0
- /package/providers/{beta/open-names → open-names}/dist/esm/im-reverse-geocode.js +0 -0
- /package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js.LICENSE.txt +0 -0
- /package/{plugins/beta/use-location → providers/open-names}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/providers/{beta/open-names → open-names}/src/index.js +0 -0
- /package/providers/{beta/open-names → open-names}/src/reverseGeocode.js +0 -0
- /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.js +0 -0
- /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/dist/esm/im-openlayers-provider.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/dist/umd/im-openlayers-provider.js.LICENSE.txt +0 -0
- /package/providers/{beta/open-names → openlayers}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/appEvents.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/appEvents.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/defaults.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/index.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/bngProjection.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.test.js +0 -0
package/dist/esm/im-shell.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/toConsumableArray";import t from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import i from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/objectWithoutProperties";import o from"@babel/runtime/helpers/defineProperty";var a=["mapViewParamKey"];import s from"@babel/runtime/regenerator";function u(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}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,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var p=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=window.location)||void 0===t?void 0:t.search;return new URLSearchParams(n).get(e)},h=function(e){var t=e.behaviour,n=e.hybridWidth,i=e.maxMobileWidth;if("hybrid"!==t)return!1;var r=null!=n?n:i;return window.matchMedia("(max-width: ".concat(r,"px)")).matches},v=function(e){var t=e.behaviour;return["mapOnly","buttonFirst"].includes(t)||h(e)};function f(){m.forEach(function(e){!function(e,t){var n;if(!1!==e.config.manageHistoryState){e._isClosingViaBack=!1;var i=e.id===t,r="hybrid"===e.config.behaviour&&!h(e.config),o=null===(n=e.rootEl)||void 0===n?void 0:n.children.length;!i||o&&!e._isHidden?i||!o||r||function(e){var t,n;e.config.preserveStateOnClose?null===(t=e.hideApp)||void 0===t||t.call(e):null===(n=e.removeApp)||void 0===n||n.call(e)}(e):function(e){var t,n;e._isHidden?null===(t=e.showApp)||void 0===t||t.call(e):null===(n=e.loadApp)||void 0===n||n.call(e)}(e)}}(e,p(e.config.mapViewQueryParam))})}var m=new Map,y=!1;var b={register:function(e){y||(globalThis.addEventListener("popstate",f),y=!0),m.set(e.id,e)},unregister:function(e){m.delete(e.id),0===m.size&&(globalThis.removeEventListener("popstate",f),y=!1)}};function _(e){try{return JSON.parse(e)}catch(e){return console.log(e),null}}function A(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var P=function(e,t,n,i){return e!==t&&!(null!=n&&n.contains(e))&&e.matches(":not([aria-hidden]):not([data-fm-inert])")&&i.contains(e)};function E(e){var t,n=e.containerEl,i=e.isFullscreen,r=e.boundaryEl,o=void 0===r?document.body:r,a=Array.from(o.querySelectorAll("[data-fm-inert]"));if(n&&(a=a.filter(function(e){return!n.contains(e)})),a.forEach(function(e){e.removeAttribute("aria-hidden"),delete e.dataset.fmInert}),i){null===(t=document.activeElement)||void 0===t||t.blur();for(var s=n;null!==(l=s)&&void 0!==l&&l.parentNode&&s!==o&&s!==document.body;){var l,c,d=s.parentNode,p=u(d.children);try{for(p.s();!(c=p.n()).done;){var h=c.value;P(h,s,n,o)&&(h.setAttribute("aria-hidden","true"),h.dataset.fmInert="")}}catch(e){p.e(e)}finally{p.f()}s=d}}}function g(e){var t=e.id,n=e.behaviour,i=e.manageHistoryState;return"mapOnly"===n||("buttonFirst"===n?!1===i||p(e.mapViewQueryParam)===t:h(e)&&p(e.mapViewQueryParam)===t)}function w(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).isFullscreen,n=e.config,i=e.rootEl,r=n.pageTitle,o=n.behaviour,a=n.containerHeight,s=null!=t?t:g(n);["mapOnly","buttonFirst","hybrid"].includes(o)&&(E({containerEl:i,isFullscreen:s}),document.documentElement.classList.toggle("im-is-fullscreen",s),i.classList.toggle("im-is-fullscreen",s)),["buttonFirst","hybrid"].includes(o)&&function(e){var t=e.pageTitle,n=e.isFullscreen,i=document.title.split(": "),r=i[i.length-1];document.title=n?"".concat(t,": ").concat(r):r}({pageTitle:r,isFullscreen:s});var u=s||"buttonFirst"!==o&&!h(n)?a:"auto";return i.style.height=s?"100%":u,{isFullscreen:s}}function k(){document.body.classList.remove("im-is-loading")}var O="[interactive-map]",T={warn:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).warn.apply(e,[O].concat(n))},error:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).error.apply(e,[O].concat(n))}};var S={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 M(e){var t=e.id,n=e.behaviour,i=p(e.mapViewQueryParam)===t;return["mapOnly","inline"].includes(n)||"hybrid"===n&&!h(e)||i}var x={appColorScheme:"light",autoColorScheme:!1,backgroundColor:"var(--background-color)",behaviour:"buttonFirst",buttonClass:"im-c-open-map-button",buttonText:"Map view",containerHeight:"600px",deviceNotSupportedText:"Your device is not supported. A map is available with a more up-to-date browser or device.",enableFullscreen:!1,enableMapControls:!0,enableZoomControls:!0,genericErrorText:"There was a problem loading the map. Please try again later.",hasExitButton:!1,backAndContinue:null,hybridWidth:null,keyboardHintText:'<span class="im-u-visually-hidden">Press </span><kbd>Shift</kbd> + <span class="im-u-visually-hidden">Question mark</span><kbd aria-hidden="true">?</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',mapHintText:"Press Tab to focus it. Keyboard commands are only available once it has focus.",mapLabel:"Interactive map application",mapProvider:null,mapSize:"small",manageHistoryState:!0,mapViewQueryParam:"mv",urlPosition:"sync",maxMobileWidth:640,minDesktopWidth:835,mapControlsHintText:'A "map controls" button is also available, opening further controls for moving and zooming.',nudgePanDelta:5,nudgeZoomDelta:.1,panDelta:100,pageTitle:"Map view",preserveStateOnClose:!1,readMapText:!1,reverseGeocodeProvider:null,zoomDelta:1};function B(e){var t,n=e.maxMobileWidth,i=e.minDesktopWidth,r=e.containerEl,o="unknown",a=new Set,s=function(e){e!==o&&(o=e,requestAnimationFrame(function(){o===e&&a.forEach(function(t){return t(e)})}))};if(r){var u=function(e,t,n){e.style.containerType="inline-size";var i=e.getBoundingClientRect().width,r=t(i);e.dataset.breakpoint=r;var o=new window.ResizeObserver(function(i){var r,o,a=(null===(r=i[0])||void 0===r||null===(r=r.borderBoxSize)||void 0===r||null===(r=r[0])||void 0===r?void 0:r.inlineSize)||(null===(o=i[0])||void 0===o?void 0:o.contentRect.width),s=t(a);e.dataset.breakpoint=s,n(s)});return o.observe(e),{initialType:r,cleanup:function(){o.disconnect(),e.style.containerType="",delete e.dataset.breakpoint}}}(r,function(e){return function(e,t,n){return e<=t?"mobile":e>=n?"desktop":"tablet"}(e,n,i)},s);o=u.initialType,s(u.initialType),t=u.cleanup}else{var l=function(e,t,n){var i={mobile:window.matchMedia("(max-width: ".concat(e,"px)")),desktop:window.matchMedia("(min-width: ".concat(t,"px)"))},r=function(){var e="tablet";i.mobile.matches?e="mobile":i.desktop.matches&&(e="desktop"),n(e)};return i.mobile.addEventListener("change",r),i.desktop.addEventListener("change",r),r(),{cleanup:function(){i.mobile.removeEventListener("change",r),i.desktop.removeEventListener("change",r)}}}(n,i,s);t=l.cleanup}return{subscribe:function(e){return a.add(e),function(){return a.delete(e)}},getBreakpoint:function(){return o},destroy:function(){var e;null===(e=t)||void 0===e||e(),a.clear()}}}var L=window.matchMedia("(pointer: coarse)").matches?"touch":"unknown",D=new Set,C=new Set;var R=new Set(["Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape"]),I=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]);function N(e){L!==e&&(L=e,C.forEach(function(t){return t(e)}),D.forEach(function(t){return t(e)}))}function H(){var e=window.matchMedia("(pointer: coarse)"),t=function(e){N(e.matches?"touch":"mouse")};e.addEventListener("change",t);var n=function(e){var t,n="pen"===(t=e.pointerType)||"touch"===t?"touch":"mouse"===t?"mouse":"unknown";n!==L&&(L=n,C.forEach(function(e){return e(n)}),setTimeout(function(){D.forEach(function(e){return e(n)})},150))},i=function(e){var t;("Tab"===e.key||R.has(e.key)&&(!(t=e.target)||"TEXTAREA"!==t.tagName&&!t.isContentEditable&&("INPUT"!==t.tagName||I.has(t.type))))&&N("keyboard")};return window.addEventListener("pointerdown",n,{passive:!0}),window.addEventListener("keydown",i,{passive:!0}),function(){e.removeEventListener("change",t),window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",i)}}function F(){return"unknown"===L?(L="mouse","mouse"):L}function j(e){return D.add(e),function(){D.delete(e)}}var U=null;function V(e,t){var n=e.url,r=e.transformRequest,o=e.load;U=function(){var e=i(s.mark(function e(i,a){var u;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=1,o();case 1:return u=e.sent,e.abrupt("return",u(n,r,t,i,a));case 2:case"end":return e.stop()}},e)}));return function(t,n){return e.apply(this,arguments)}}()}function W(){return null!==U}function q(e,t){if(!U)throw new Error("ReverseGeocode not initialised");return U(e,t)}var z=function(){return n(function e(){t(this,e),this.events={},this._queued={}},[{key:"on",value:function(t,n){if(this.events[t]||(this.events[t]=[]),this.events[t].push(n),void 0!==this._queued[t]){try{n.apply(void 0,e(this._queued[t]))}catch(e){console.error("Error in event handler for '".concat(t,"':"),e)}delete this._queued[t]}return this}},{key:"once",value:function(e,t){var n=this,i=function(){n.off(e,i),t.apply(void 0,arguments)};return this.on(e,i)}},{key:"off",value:function(e,t){return this.events[e]?(this.events[e]=t?this.events[e].filter(function(e){return e!==t}):[],this):this}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.events[e]?(this.events[e].forEach(function(t){try{t.apply(void 0,n)}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}}),this):this}},{key:"emitWhenReady",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.events[e]&&0!==this.events[e].length?this.emit.apply(this,[e].concat(n)):(this._queued[e]=n,this)}},{key:"emitWhenRequested",value:function(e){for(var t=this,n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];var o="".concat(e,"Requested"),a="".concat(e,"Ready"),s=function(){return t.emit.apply(t,[a].concat(i))};return this.on(o,s),s(),function(){return t.off(o,s)}}},{key:"requestOnce",value:function(e,t){var n="".concat(e,"Requested"),i="".concat(e,"Ready");return this.once(i,t),this.emit(n,e),this}},{key:"destroy",value:function(){this.events={},this._queued={}}}])}();if("undefined"!=typeof crypto&&!crypto.randomUUID){var G=0;crypto.randomUUID=function(){return G=Math.max(Date.now(),G+1),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e,t){var n=t<12?Number.parseInt(G.toString(16).padStart(12,"0")[t],16):16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})}}var K=!Object.hasOwn;K&&(Object.hasOwn=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)});var Q="undefined"!=typeof AbortController&&!Object.getPrototypeOf((new AbortController).signal).throwIfAborted;Q&&(Object.getPrototypeOf((new AbortController).signal).throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");throw e.name="AbortError",e}});if((Q||K)&&"undefined"!=typeof URL&&URL.createObjectURL){var Y="text/javascript",Z=["if(!Object.hasOwn){Object.hasOwn=function(o,k){return Object.prototype.hasOwnProperty.call(o,k)}}\n",Q?'if(typeof AbortController!=="undefined"){var _p=Object.getPrototypeOf(new AbortController().signal);if(!_p.throwIfAborted){_p.throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");e.name="AbortError";throw e}}}}\n':""].join(""),$=URL.createObjectURL.bind(URL);if(URL.createObjectURL=function(e){return e instanceof Blob&&e.type===Y&&(e=new Blob([Z,e],{type:Y})),$(e)},"undefined"!=typeof Worker){var J=Worker;Worker=function(e,t){if("string"==typeof e&&!e.startsWith("blob:")&&"module"!==(null==t?void 0:t.type)){var n=new Blob(["".concat(Z,"importScripts(").concat(JSON.stringify(e),")")],{type:Y});e=$(n)}return new J(e,t)},Worker.prototype=J.prototype}}var X=function(){return n(function e(n){var i,r,a,s,u,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t(this,e),o(this,"_openButton",null),o(this,"_root",null),o(this,"_breakpointDetector",null),o(this,"_interfaceDetectorCleanup",null),o(this,"_hybridBehaviourCleanup",null),o(this,"_isHidden",!1),o(this,"_isClosingViaBack",!1),o(this,"_isLoading",!1),this.id=n,this.rootEl=document.getElementById(n),!this.rootEl)throw new Error('Element with id "'.concat(n,'" not found'));this.eventBus=new z,this.config=this._buildConfig(l),i=this.rootEl,r=this.config,a=r.mapProvider,s=r.deviceNotSupportedText,u=null==a?void 0:a.checkDeviceCapabilities(),(a?null!=u&&u.isSupported||(A(i,s),k(),T.warn(null==u?void 0:u.error),0):(T.warn("No map provider"),0))&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&b.register(this),this._breakpointDetector=B({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=H(),this._initialize())},[{key:"_buildConfig",value:function(e){var t=function(e){for(var t=d({},null==e?void 0:e.dataset),n={},i=0,r=Object.keys(t);i<r.length;i++){var o=r[i];n[o]=_(t[o])}return n}(this.rootEl);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapViewParamKey,n=r(e,a),i=d(d({},x),n);return void 0!==t&&(console.warn("[InteractiveMap] mapViewParamKey is deprecated — use mapViewQueryParam instead."),i.mapViewQueryParam=t),"mapOnly"===i.behaviour&&i.hasExitButton&&(console.warn("[InteractiveMap] hasExitButton has no effect when behaviour is 'mapOnly' — there is nothing to exit to."),i.hasExitButton=!1),i}(d(d({id:this.id,title:document.title},t),e))}},{key:"_initialize",value:function(){var e,t=this;["buttonFirst","hybrid"].includes(this.config.behaviour)&&(this._openButton=function(e,t,n){var i=e.id,r=e.buttonText,o=e.buttonClass,a='\n <a class="'.concat(o,"\" role=\"button\">\n <svg focusable='false' aria-hidden='true' width='16' height='20' viewBox='0 0 16 20' fillRule='evenodd'>\n <path d='M15 7.5c.009 3.778-4.229 9.665-7.5 12.5C4.229 17.165-.009 11.278 0 7.5a7.5 7.5 0 1 1 15 0z'/>\n <path d='M7.5 12.961a5.46 5.46 0 1 0 0-10.922 5.46 5.46 0 1 0 0 10.922z' fill='#fff'/>\n </svg>\n <span>").concat(r,"</span>\n <span class='im-u-visually-hidden'> (Visual only)</span>\n </a>\n ");t.insertAdjacentHTML("beforebegin",a);var s=t.previousElementSibling,u=new URL(window.location.href);return u.searchParams.set(e.mapViewQueryParam,i),s.setAttribute("href",u.toString()),s.addEventListener("click",function(e){e.preventDefault(),n(e)}),s}(this.config,this.rootEl,function(e){t._handleButtonClick(e)})),this._hybridBehaviourCleanup=function(e){var t=e.config,n=t.behaviour,i=t.hybridWidth,r=t.maxMobileWidth;if("buttonFirst"===n&&e._breakpointDetector.subscribe(function(){M(e.config)?e.loadApp():e.removeApp()}),"hybrid"===n){var o=null!=i?i:r,a=window.matchMedia("(max-width: ".concat(o,"px)")),s=function(){if(M(e.config))if(e._isHidden)e.showApp();else if(null==e._root)e.loadApp();else{var t=w(e).isFullscreen;e.eventBus.emit(S.APP_FULLSCREEN_CHANGE,{isFullscreen:t})}else e._root&&e.hideApp()};return a.addEventListener("change",s),function(){return a.removeEventListener("change",s)}}return null}(this),M(this.config)?(g((e=this).config)||(w(e,{isFullscreen:!1}),k()),this.loadApp()):k()}},{key:"_handleButtonClick",value:function(e){var t;this._isHidden?(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.showApp(),null===(t=this.rootEl.querySelector('[role="application"]'))||void 0===t||t.focus()):this._root||(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.loadApp({focusOnMount:!0}))}},{key:"_removeMapParamFromUrl",value:function(e,t){var n=new RegExp("[?&]".concat(t,"=[^&]*(&|$)"));return n.test(e)?e.replace(n,function(e,t){return"&"===t?"?":""}).replace(/\?$/,""):e}},{key:"_handleExitClick",value:function(){var e,t=this;if(this.config.manageHistoryState)if(null!==(e=history.state)&&void 0!==e&&e.isBack){if(this._isClosingViaBack)return;this._isClosingViaBack=!0,history.back(),setTimeout(function(){t._isClosingViaBack=!1},1e3)}else{this.config.preserveStateOnClose?this.hideApp():this.removeApp();var n=this.config.mapViewQueryParam,i=this._removeMapParamFromUrl(location.href,n);history.replaceState(history.state,"",i)}else this.config.preserveStateOnClose?this.hideApp():this.removeApp()}},{key:"loadApp",value:(e=i(s.mark(function e(){var t,n,i,r,o,a,u,l,c,p,h,v,f,m,y=this,b=arguments;return s.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(b.length>0&&void 0!==b[0]?b[0]:{}).focusOnMount,n=void 0!==t&&t,!this._root&&!this._isLoading){e.next=1;break}return e.abrupt("return");case 1:return this._isLoading=!0,this._openButton&&(this._openButton.style.display="none"),e.prev=2,e.next=3,import(/* webpackChunkName: "im-core" */ "./im-core.js");case 3:return i=e.sent,r=i.initialiseApp,e.next=4,this.config.mapProvider.load();case 4:return o=e.sent,a=o.MapProvider,u=o.mapFramework,l=o.mapProviderConfig,this.config.reverseGeocodeProvider&&V(this.config.reverseGeocodeProvider,l.crs),e.next=5,r(this.rootEl,d(d({id:this.id,initialBreakpoint:this._breakpointDetector.getBreakpoint(),initialInterfaceType:F(),focusOnMount:n},this.config),{},{MapProvider:a,mapProviderConfig:l,mapFramework:u,eventBus:this.eventBus,breakpointDetector:this._breakpointDetector,handleExitClick:this._handleExitClick.bind(this)}));case 5:c=e.sent,this._root=c._root,delete c._root,p=new Set(["on","off","emit"]),Object.keys(c).forEach(function(e){p.has(e)||(y[e]=c[e])}),h=w(this),v=h.isFullscreen,this.eventBus.emit(S.APP_OPENED,{statePreserved:!1,isFullscreen:v}),e.next=7;break;case 6:throw e.prev=6,m=e.catch(2),null===(f=this._openButton)||void 0===f||f.removeAttribute("style"),A(this.rootEl,this.config.genericErrorText),console.error(m),m;case 7:return e.prev=7,this._isLoading=!1,e.finish(7);case 8:case"end":return e.stop()}},e,this,[[2,6,7,8]])})),function(){return e.apply(this,arguments)})},{key:"removeApp",value:function(){this._root&&"function"==typeof this.unmount&&(this.unmount(),this._root=null),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),w(this,{isFullscreen:!1}),this.eventBus.emit(S.APP_CLOSED,{statePreserved:!1}),this.eventBus.emit(S.MAP_DESTROY,{mapId:this.id})}},{key:"hideApp",value:function(){this._isHidden=!0,this.rootEl.style.display="none",E({containerEl:this.rootEl,isFullscreen:!1}),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),document.documentElement.classList.remove("im-is-fullscreen"),this.rootEl.classList.remove("im-is-fullscreen");var e=document.title.split(": ");e.length>1&&(document.title=e.at(-1)),this.eventBus.emit(S.APP_CLOSED,{statePreserved:!0})}},{key:"showApp",value:function(){this._isHidden=!1,this.rootEl.style.display="",this._openButton&&(this._openButton.style.display="none");var e=w(this).isFullscreen;this.eventBus.emit(S.APP_OPENED,{statePreserved:!0,isFullscreen:e})}},{key:"destroy",value:function(){var e,t,n;this.removeApp(),null===(e=this._breakpointDetector)||void 0===e||e.destroy(),null===(t=this._interfaceDetectorCleanup)||void 0===t||t.call(this),null===(n=this._hybridBehaviourCleanup)||void 0===n||n.call(this),b.unregister(this),this.eventBus.destroy()}},{key:"on",value:function(){var e;(e=this.eventBus).on.apply(e,arguments)}},{key:"off",value:function(){var e;(e=this.eventBus).off.apply(e,arguments)}},{key:"emit",value:function(){var e;(e=this.eventBus).emit.apply(e,arguments)}},{key:"addMarker",value:function(e,t,n){this.eventBus.emit(S.APP_ADD_MARKER,{id:e,coords:t,options:n})}},{key:"updateMarker",value:function(e,t){this.eventBus.emit(S.APP_UPDATE_MARKER,{id:e,options:t})}},{key:"removeMarker",value:function(e){this.eventBus.emit(S.APP_REMOVE_MARKER,e)}},{key:"addButton",value:function(e,t){this.eventBus.emit(S.APP_ADD_BUTTON,{id:e,config:t})}},{key:"toggleButtonState",value:function(e,t,n){this.eventBus.emit(S.APP_TOGGLE_BUTTON_STATE,{id:e,prop:t,value:n})}},{key:"setContinueEnabled",value:function(e){this.toggleButtonState("journeyContinue","disabled",!e)}},{key:"addPanel",value:function(e,t){this.eventBus.emit(S.APP_ADD_PANEL,{id:e,config:t})}},{key:"removePanel",value:function(e){this.eventBus.emit(S.APP_REMOVE_PANEL,e)}},{key:"showPanel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.focus,i=void 0===n||n,r=t.triggeringElement,o=null!=r?r:document.activeElement&&document.activeElement!==document.body?document.activeElement:void 0;this.eventBus.emit(S.APP_SHOW_PANEL,{id:e,focus:i,triggeringElement:o})}},{key:"hidePanel",value:function(e){this.eventBus.emit(S.APP_HIDE_PANEL,e)}},{key:"setApplicationMode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.include,i=void 0===n?null:n,r=t.exclude,o=void 0===r?null:r;this.eventBus.emit(S.APP_SET_APPLICATION_MODE,{id:e,include:i,exclude:o})}},{key:"clearApplicationMode",value:function(e){this.eventBus.emit(S.APP_CLEAR_APPLICATION_MODE,e)}},{key:"addControl",value:function(e,t){this.eventBus.emit(S.APP_ADD_CONTROL,{id:e,config:t})}},{key:"showHint",value:function(e,t){this.eventBus.emit(S.APP_SHOW_HINT,{text:e,options:t})}},{key:"dismissHint",value:function(){this.eventBus.emit(S.APP_DISMISS_HINT)}},{key:"fitToBounds",value:function(e){this.eventBus.emitWhenReady(S.MAP_FIT_TO_BOUNDS,e)}},{key:"setView",value:function(e){this.eventBus.emitWhenReady(S.MAP_SET_VIEW,e)}},{key:"open",value:function(){this._isHidden?this.showApp():this._root||this.loadApp()}},{key:"close",value:function(){this._handleExitClick()}}]);var e}();export{S as E,X as I,F as a,k as b,v as g,W as h,T as l,q as r,j as s,E as t};
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/toConsumableArray";import n from"@babel/runtime/helpers/classCallCheck";import i from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/regenerator";import r from"@babel/runtime/helpers/asyncToGenerator";import a from"@babel/runtime/helpers/objectWithoutProperties";import s from"@babel/runtime/helpers/createForOfIteratorHelper";import u from"@babel/runtime/helpers/objectSpread2";var l=["mapViewParamKey"],c=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=window.location)||void 0===t?void 0:t.search;return new URLSearchParams(n).get(e)},d=function(e){var t=e.behaviour,n=e.hybridWidth,i=e.maxMobileWidth;if("hybrid"!==t)return!1;var o=null!=n?n:i;return window.matchMedia("(max-width: ".concat(o,"px)")).matches},p=function(e){var t=e.behaviour;return["mapOnly","buttonFirst"].includes(t)||d(e)};function h(){v.forEach(function(e){!function(e,t){var n;if(!1!==e.config.manageHistoryState){e._isClosingViaBack=!1;var i=e.id===t,o="hybrid"===e.config.behaviour&&!d(e.config),r=null===(n=e.rootEl)||void 0===n?void 0:n.children.length;!i||r&&!e._isHidden?i||!r||o||function(e){var t,n;e.config.preserveStateOnClose?null===(t=e.hideApp)||void 0===t||t.call(e):null===(n=e.removeApp)||void 0===n||n.call(e)}(e):function(e){var t,n;e._isHidden?null===(t=e.showApp)||void 0===t||t.call(e):null===(n=e.loadApp)||void 0===n||n.call(e)}(e)}}(e,c(e.config.mapViewQueryParam))})}var v=new Map,f=!1;var m={register:function(e){f||(globalThis.addEventListener("popstate",h),f=!0),v.set(e.id,e)},unregister:function(e){v.delete(e.id),0===v.size&&(globalThis.removeEventListener("popstate",h),f=!1)}};function _(e){try{return JSON.parse(e)}catch(t){return e}}function y(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var b=function(e,t,n,i){return e!==t&&!(null!=n&&n.contains(e))&&e.matches(":not([aria-hidden]):not([data-fm-inert])")&&i.contains(e)};function A(e){var t,n=e.containerEl,i=e.isFullscreen,o=e.boundaryEl,r=void 0===o?document.body:o,a=Array.from(r.querySelectorAll("[data-fm-inert]"));if(n&&(a=a.filter(function(e){return!n.contains(e)})),a.forEach(function(e){e.removeAttribute("aria-hidden"),delete e.dataset.fmInert}),i){null===(t=document.activeElement)||void 0===t||t.blur();for(var u=n;null!==(l=u)&&void 0!==l&&l.parentNode&&u!==r&&u!==document.body;){var l,c,d=u.parentNode,p=s(d.children);try{for(p.s();!(c=p.n()).done;){var h=c.value;b(h,u,n,r)&&(h.setAttribute("aria-hidden","true"),h.dataset.fmInert="")}}catch(e){p.e(e)}finally{p.f()}u=d}}}function P(e){var t=e.id,n=e.behaviour,i=e.manageHistoryState;return"mapOnly"===n||("buttonFirst"===n?!1===i||c(e.mapViewQueryParam)===t:d(e)&&c(e.mapViewQueryParam)===t)}function E(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).isFullscreen,n=e.config,i=e.rootEl,o=n.pageTitle,r=n.behaviour,a=n.containerHeight,s=null!=t?t:P(n);["mapOnly","buttonFirst","hybrid"].includes(r)&&(A({containerEl:i,isFullscreen:s}),document.documentElement.classList.toggle("im-is-fullscreen",s),i.classList.toggle("im-is-fullscreen",s)),["buttonFirst","hybrid"].includes(r)&&function(e){var t=e.pageTitle,n=e.isFullscreen,i=document.title.split(": "),o=i[i.length-1];document.title=n?"".concat(t,": ").concat(o):o}({pageTitle:o,isFullscreen:s});var u=s||"buttonFirst"!==r&&!d(n)?a:"auto";return i.style.height=s?"100%":u,{isFullscreen:s}}function g(){document.body.classList.remove("im-is-loading")}var w="[interactive-map]",k={warn:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).warn.apply(e,[w].concat(n))},error:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).error.apply(e,[w].concat(n))}};var 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 S(e){var t=e.id,n=e.behaviour,i=c(e.mapViewQueryParam)===t;return["mapOnly","inline"].includes(n)||"hybrid"===n&&!d(e)||i}var O={appColorScheme:"light",autoColorScheme:!1,backgroundColor:"var(--background-color)",behaviour:"buttonFirst",buttonClass:"im-c-open-map-button",buttonText:"Map view",containerHeight:"600px",deviceNotSupportedText:"Your device is not supported. A map is available with a more up-to-date browser or device.",enableFullscreen:!1,enableMapControls:!0,enableZoomControls:!0,genericErrorText:"There was a problem loading the map. Please try again later.",hasExitButton:!1,backAndContinue:null,hybridWidth:null,keyboardHintText:'<span class="im-u-visually-hidden">Press </span><kbd>Shift</kbd> + <span class="im-u-visually-hidden">Question mark</span><kbd aria-hidden="true">?</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',mapHintText:"Press Tab to focus it. Keyboard commands are only available once it has focus.",mapLabel:"Interactive map application",mapProvider:null,mapSize:"small",manageHistoryState:!0,mapViewQueryParam:"mv",urlPosition:"sync",maxMobileWidth:640,minDesktopWidth:835,mapControlsHintText:'A "map controls" button is also available, opening further controls for moving and zooming.',nudgePanDelta:5,nudgeZoomDelta:.1,panDelta:100,pageTitle:"Map view",preserveStateOnClose:!1,readMapText:!1,reverseGeocodeProvider:null,zoomDelta:1};function M(e){var t,n=e.maxMobileWidth,i=e.minDesktopWidth,o=e.containerEl,r="unknown",a=new Set,s=function(e){e!==r&&(r=e,requestAnimationFrame(function(){r===e&&a.forEach(function(t){return t(e)})}))};if(o){var u=function(e,t,n){e.style.containerType="inline-size";var i=e.getBoundingClientRect().width,o=t(i);e.dataset.breakpoint=o;var r=new window.ResizeObserver(function(i){var o,r,a=(null===(o=i[0])||void 0===o||null===(o=o.borderBoxSize)||void 0===o||null===(o=o[0])||void 0===o?void 0:o.inlineSize)||(null===(r=i[0])||void 0===r?void 0:r.contentRect.width),s=t(a);e.dataset.breakpoint=s,n(s)});return r.observe(e),{initialType:o,cleanup:function(){r.disconnect(),e.style.containerType="",delete e.dataset.breakpoint}}}(o,function(e){return function(e,t,n){return e<=t?"mobile":e>=n?"desktop":"tablet"}(e,n,i)},s);r=u.initialType,s(u.initialType),t=u.cleanup}else{var l=function(e,t,n){var i={mobile:window.matchMedia("(max-width: ".concat(e,"px)")),desktop:window.matchMedia("(min-width: ".concat(t,"px)"))},o=function(){var e="tablet";i.mobile.matches?e="mobile":i.desktop.matches&&(e="desktop"),n(e)};return i.mobile.addEventListener("change",o),i.desktop.addEventListener("change",o),o(),{cleanup:function(){i.mobile.removeEventListener("change",o),i.desktop.removeEventListener("change",o)}}}(n,i,s);t=l.cleanup}return{subscribe:function(e){return a.add(e),function(){return a.delete(e)}},getBreakpoint:function(){return r},destroy:function(){var e;null===(e=t)||void 0===e||e(),a.clear()}}}var B=window.matchMedia("(pointer: coarse)").matches?"touch":"unknown",L=new Set,x=new Set;var C=new Set(["Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape"]),D=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]);function R(e){B!==e&&(B=e,x.forEach(function(t){return t(e)}),L.forEach(function(t){return t(e)}))}function I(){var e=window.matchMedia("(pointer: coarse)"),t=function(e){R(e.matches?"touch":"mouse")};e.addEventListener("change",t);var n=function(e){var t,n="pen"===(t=e.pointerType)||"touch"===t?"touch":"mouse"===t?"mouse":"unknown";n!==B&&(B=n,x.forEach(function(e){return e(n)}),setTimeout(function(){L.forEach(function(e){return e(n)})},150))},i=function(e){var t;("Tab"===e.key||C.has(e.key)&&(!(t=e.target)||"TEXTAREA"!==t.tagName&&!t.isContentEditable&&("INPUT"!==t.tagName||D.has(t.type))))&&R("keyboard")};return window.addEventListener("pointerdown",n,{passive:!0}),window.addEventListener("keydown",i,{passive:!0}),function(){e.removeEventListener("change",t),window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",i)}}function N(){return"unknown"===B?(B="mouse","mouse"):B}function H(e){return L.add(e),function(){L.delete(e)}}var F=null;function U(e,t){var n=e.url,i=e.transformRequest,a=e.load;F=function(){var e=r(o().m(function e(r,s){var u;return o().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,a();case 1:return u=e.v,e.a(2,u(n,i,t,r,s))}},e)}));return function(t,n){return e.apply(this,arguments)}}()}function V(){return null!==F}function W(e,t){if(!F)throw new Error("ReverseGeocode not initialised");return F(e,t)}var j=function(){return i(function e(){n(this,e),this.events={},this._queued={}},[{key:"on",value:function(e,n){if(this.events[e]||(this.events[e]=[]),this.events[e].push(n),void 0!==this._queued[e]){try{n.apply(void 0,t(this._queued[e]))}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}delete this._queued[e]}return this}},{key:"once",value:function(e,t){var n=this,i=function(){n.off(e,i),t.apply(void 0,arguments)};return this.on(e,i)}},{key:"off",value:function(e,t){return this.events[e]?(this.events[e]=t?this.events[e].filter(function(e){return e!==t}):[],this):this}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.events[e]?(this.events[e].forEach(function(t){try{t.apply(void 0,n)}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}}),this):this}},{key:"emitWhenReady",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.events[e]&&0!==this.events[e].length?this.emit.apply(this,[e].concat(n)):(this._queued[e]=n,this)}},{key:"emitWhenRequested",value:function(e){for(var t=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var r="".concat(e,"Requested"),a="".concat(e,"Ready"),s=function(){return t.emit.apply(t,[a].concat(i))};return this.on(r,s),s(),function(){return t.off(r,s)}}},{key:"requestOnce",value:function(e,t){var n="".concat(e,"Requested"),i="".concat(e,"Ready");return this.once(i,t),this.emit(n,e),this}},{key:"destroy",value:function(){this.events={},this._queued={}}}])}();if("undefined"!=typeof crypto&&!crypto.randomUUID){var q=0;crypto.randomUUID=function(){return q=Math.max(Date.now(),q+1),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e,t){var n=t<12?Number.parseInt(q.toString(16).padStart(12,"0")[t],16):16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})}}var z=!Object.hasOwn;z&&(Object.hasOwn=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)});var G="undefined"!=typeof AbortController&&!Object.getPrototypeOf((new AbortController).signal).throwIfAborted;G&&(Object.getPrototypeOf((new AbortController).signal).throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");throw e.name="AbortError",e}});if((G||z)&&"undefined"!=typeof URL&&URL.createObjectURL){var K="text/javascript",Q=["if(!Object.hasOwn){Object.hasOwn=function(o,k){return Object.prototype.hasOwnProperty.call(o,k)}}\n",G?'if(typeof AbortController!=="undefined"){var _p=Object.getPrototypeOf(new AbortController().signal);if(!_p.throwIfAborted){_p.throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");e.name="AbortError";throw e}}}}\n':""].join(""),Y=URL.createObjectURL.bind(URL);if(URL.createObjectURL=function(e){return e instanceof Blob&&e.type===K&&(e=new Blob([Q,e],{type:K})),Y(e)},"undefined"!=typeof Worker){var Z=Worker;Worker=function(e,t){if("string"==typeof e&&!e.startsWith("blob:")&&"module"!==(null==t?void 0:t.type)){var n=new Blob(["".concat(Q,"importScripts(").concat(JSON.stringify(e),")")],{type:K});e=Y(n)}return new Z(e,t)},Worker.prototype=Z.prototype}}var J=function(){return i(function t(i){var o,r,a,s,u,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n(this,t),e(this,"_openButton",null),e(this,"_root",null),e(this,"_breakpointDetector",null),e(this,"_interfaceDetectorCleanup",null),e(this,"_hybridBehaviourCleanup",null),e(this,"_isHidden",!1),e(this,"_isClosingViaBack",!1),e(this,"_isLoading",!1),this.id=i,this.rootEl=document.getElementById(i),!this.rootEl)throw new Error('Element with id "'.concat(i,'" not found'));this.eventBus=new j,this.config=this._buildConfig(l),o=this.rootEl,r=this.config,a=r.mapProvider,s=r.deviceNotSupportedText,u=null==a?void 0:a.checkDeviceCapabilities(),(a?null!=u&&u.isSupported||(y(o,s),g(),k.warn(null==u?void 0:u.error),0):(k.warn("No map provider"),0))&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&m.register(this),this._breakpointDetector=M({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=I(),this._initialize())},[{key:"_buildConfig",value:function(e){var t=function(e){for(var t=u({},null==e?void 0:e.dataset),n={},i=0,o=Object.keys(t);i<o.length;i++){var r=o[i];n[r]=_(t[r])}return n}(this.rootEl);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapViewParamKey,n=a(e,l),i=u(u({},O),n);return void 0!==t&&(console.warn("[InteractiveMap] mapViewParamKey is deprecated — use mapViewQueryParam instead."),i.mapViewQueryParam=t),"mapOnly"===i.behaviour&&i.hasExitButton&&(console.warn("[InteractiveMap] hasExitButton has no effect when behaviour is 'mapOnly' — there is nothing to exit to."),i.hasExitButton=!1),i}(u(u({id:this.id,title:document.title},t),e))}},{key:"_initialize",value:function(){var e,t=this;["buttonFirst","hybrid"].includes(this.config.behaviour)&&(this._openButton=function(e,t,n){var i=e.id,o=e.buttonText,r=e.buttonClass,a='\n <a class="'.concat(r,"\" role=\"button\">\n <svg focusable='false' aria-hidden='true' width='16' height='20' viewBox='0 0 16 20' fillRule='evenodd'>\n <path d='M15 7.5c.009 3.778-4.229 9.665-7.5 12.5C4.229 17.165-.009 11.278 0 7.5a7.5 7.5 0 1 1 15 0z'/>\n <path d='M7.5 12.961a5.46 5.46 0 1 0 0-10.922 5.46 5.46 0 1 0 0 10.922z' fill='#fff'/>\n </svg>\n <span>").concat(o,"</span>\n <span class='im-u-visually-hidden'> (Visual only)</span>\n </a>\n ");t.insertAdjacentHTML("beforebegin",a);var s=t.previousElementSibling,u=new URL(window.location.href);return u.searchParams.set(e.mapViewQueryParam,i),s.setAttribute("href",u.toString()),s.addEventListener("click",function(e){e.preventDefault(),n(e)}),s}(this.config,this.rootEl,function(e){t._handleButtonClick(e)})),this._hybridBehaviourCleanup=function(e){var t=e.config,n=t.behaviour,i=t.hybridWidth,o=t.maxMobileWidth;if("buttonFirst"===n&&e._breakpointDetector.subscribe(function(){S(e.config)?e.loadApp():e.removeApp()}),"hybrid"===n){var r=null!=i?i:o,a=window.matchMedia("(max-width: ".concat(r,"px)")),s=function(){if(S(e.config))if(e._isHidden)e.showApp();else if(null==e._root)e.loadApp();else{var t=E(e).isFullscreen;e.eventBus.emit(T.APP_FULLSCREEN_CHANGE,{isFullscreen:t})}else e._root&&e.hideApp()};return a.addEventListener("change",s),function(){return a.removeEventListener("change",s)}}return null}(this),S(this.config)?(P((e=this).config)||(E(e,{isFullscreen:!1}),g()),this.loadApp()):g()}},{key:"_handleButtonClick",value:function(e){var t;this._isHidden?(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.showApp(),null===(t=this.rootEl.querySelector('[role="application"]'))||void 0===t||t.focus()):this._root||(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.loadApp({focusOnMount:!0}))}},{key:"_removeMapParamFromUrl",value:function(e,t){var n=new RegExp("[?&]".concat(t,"=[^&]*(&|$)"));return n.test(e)?e.replace(n,function(e,t){return"&"===t?"?":""}).replace(/\?$/,""):e}},{key:"_handleExitClick",value:function(){var e,t=this;if(this.config.manageHistoryState)if(null!==(e=history.state)&&void 0!==e&&e.isBack){if(this._isClosingViaBack)return;this._isClosingViaBack=!0,history.back(),setTimeout(function(){t._isClosingViaBack=!1},1e3)}else{this.config.preserveStateOnClose?this.hideApp():this.removeApp();var n=this.config.mapViewQueryParam,i=this._removeMapParamFromUrl(location.href,n);history.replaceState(history.state,"",i)}else this.config.preserveStateOnClose?this.hideApp():this.removeApp()}},{key:"loadApp",value:(t=r(o().m(function e(){var t,n,i,r,a,s,l,c,d,p,h,v,f,m,_=this,b=arguments;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=(b.length>0&&void 0!==b[0]?b[0]:{}).focusOnMount,n=void 0!==t&&t,!this._root&&!this._isLoading){e.n=1;break}return e.a(2);case 1:return this._isLoading=!0,this._openButton&&(this._openButton.style.display="none"),e.p=2,e.n=3,import(/* webpackChunkName: "im-core" */ "./im-core.js");case 3:return i=e.v,r=i.initialiseApp,e.n=4,this.config.mapProvider.load();case 4:return a=e.v,s=a.MapProvider,l=a.mapFramework,c=a.mapProviderConfig,this.config.reverseGeocodeProvider&&U(this.config.reverseGeocodeProvider,c.crs),e.n=5,r(this.rootEl,u(u({id:this.id,initialBreakpoint:this._breakpointDetector.getBreakpoint(),initialInterfaceType:N(),focusOnMount:n},this.config),{},{MapProvider:s,mapProviderConfig:c,mapFramework:l,eventBus:this.eventBus,breakpointDetector:this._breakpointDetector,handleExitClick:this._handleExitClick.bind(this)}));case 5:d=e.v,this._root=d._root,delete d._root,p=new Set(["on","off","emit"]),Object.keys(d).forEach(function(e){p.has(e)||(_[e]=d[e])}),h=E(this),v=h.isFullscreen,this.eventBus.emit(T.APP_OPENED,{statePreserved:!1,isFullscreen:v}),e.n=7;break;case 6:throw e.p=6,m=e.v,null===(f=this._openButton)||void 0===f||f.removeAttribute("style"),y(this.rootEl,this.config.genericErrorText),console.error(m),m;case 7:return e.p=7,this._isLoading=!1,e.f(7);case 8:return e.a(2)}},e,this,[[2,6,7,8]])})),function(){return t.apply(this,arguments)})},{key:"removeApp",value:function(){this._root&&"function"==typeof this.unmount&&(this.unmount(),this._root=null),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),E(this,{isFullscreen:!1}),this.eventBus.emit(T.APP_CLOSED,{statePreserved:!1}),this.eventBus.emit(T.MAP_DESTROY,{mapId:this.id})}},{key:"hideApp",value:function(){this._isHidden=!0,this.rootEl.style.display="none",A({containerEl:this.rootEl,isFullscreen:!1}),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),document.documentElement.classList.remove("im-is-fullscreen"),this.rootEl.classList.remove("im-is-fullscreen");var e=document.title.split(": ");e.length>1&&(document.title=e.at(-1)),this.eventBus.emit(T.APP_CLOSED,{statePreserved:!0})}},{key:"showApp",value:function(){this._isHidden=!1,this.rootEl.style.display="",this._openButton&&(this._openButton.style.display="none");var e=E(this).isFullscreen;this.eventBus.emit(T.APP_OPENED,{statePreserved:!0,isFullscreen:e})}},{key:"destroy",value:function(){var e,t,n;this.removeApp(),null===(e=this._breakpointDetector)||void 0===e||e.destroy(),null===(t=this._interfaceDetectorCleanup)||void 0===t||t.call(this),null===(n=this._hybridBehaviourCleanup)||void 0===n||n.call(this),m.unregister(this),this.eventBus.destroy()}},{key:"on",value:function(){var e;(e=this.eventBus).on.apply(e,arguments)}},{key:"off",value:function(){var e;(e=this.eventBus).off.apply(e,arguments)}},{key:"emit",value:function(){var e;(e=this.eventBus).emit.apply(e,arguments)}},{key:"addMarker",value:function(e,t,n){this.eventBus.emit(T.APP_ADD_MARKER,{id:e,coords:t,options:n})}},{key:"updateMarker",value:function(e,t){this.eventBus.emit(T.APP_UPDATE_MARKER,{id:e,options:t})}},{key:"removeMarker",value:function(e){this.eventBus.emit(T.APP_REMOVE_MARKER,e)}},{key:"addButton",value:function(e,t){this.eventBus.emit(T.APP_ADD_BUTTON,{id:e,config:t})}},{key:"toggleButtonState",value:function(e,t,n){this.eventBus.emit(T.APP_TOGGLE_BUTTON_STATE,{id:e,prop:t,value:n})}},{key:"setContinueEnabled",value:function(e){this.toggleButtonState("journeyContinue","disabled",!e)}},{key:"addPanel",value:function(e,t){this.eventBus.emit(T.APP_ADD_PANEL,{id:e,config:t})}},{key:"removePanel",value:function(e){this.eventBus.emit(T.APP_REMOVE_PANEL,e)}},{key:"showPanel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.focus,i=void 0===n||n,o=t.triggeringElement,r=null!=o?o:document.activeElement&&document.activeElement!==document.body?document.activeElement:void 0;this.eventBus.emit(T.APP_SHOW_PANEL,{id:e,focus:i,triggeringElement:r})}},{key:"hidePanel",value:function(e){this.eventBus.emit(T.APP_HIDE_PANEL,e)}},{key:"setApplicationMode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.include,i=void 0===n?null:n,o=t.exclude,r=void 0===o?null:o;this.eventBus.emit(T.APP_SET_APPLICATION_MODE,{id:e,include:i,exclude:r})}},{key:"clearApplicationMode",value:function(e){this.eventBus.emit(T.APP_CLEAR_APPLICATION_MODE,e)}},{key:"addControl",value:function(e,t){this.eventBus.emit(T.APP_ADD_CONTROL,{id:e,config:t})}},{key:"showHint",value:function(e,t){this.eventBus.emit(T.APP_SHOW_HINT,{text:e,options:t})}},{key:"dismissHint",value:function(){this.eventBus.emit(T.APP_DISMISS_HINT)}},{key:"fitToBounds",value:function(e){this.eventBus.emitWhenReady(T.MAP_FIT_TO_BOUNDS,e)}},{key:"setView",value:function(e){this.eventBus.emitWhenReady(T.MAP_SET_VIEW,e)}},{key:"open",value:function(){this._isHidden?this.showApp():this._root||this.loadApp()}},{key:"close",value:function(){this._handleExitClick()}}]);var t}();export{T as E,J as I,N as a,g as b,p as g,V as h,k as l,W as r,H as s,A as t};
|