@defra/interactive-map 0.0.59-alpha → 0.0.61-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 (125) hide show
  1. package/assets/templates/add-polygons.njk +2 -2
  2. package/assets/templates/add-symbols.njk +2 -2
  3. package/dist/css/index.css +1 -1
  4. package/dist/esm/im-core.js +1 -1
  5. package/dist/esm/im-shell.js +1 -1
  6. package/dist/umd/im-core.js +1 -1
  7. package/dist/umd/index.js +1 -1
  8. package/docs/api/button-definition.md +11 -0
  9. package/docs/api/context.md +2 -0
  10. package/docs/api/panel-definition.md +30 -0
  11. package/docs/api/symbol-config.md +12 -0
  12. package/docs/api.md +21 -2
  13. package/docs/assets/images/slot-map.svg +3 -3
  14. package/docs/plugins/datasets.md +11 -1
  15. package/docs/plugins/draw.md +26 -0
  16. package/package.json +1 -1
  17. package/plugins/datasets/dist/esm/index.js +1 -1
  18. package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
  19. package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
  20. package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
  21. package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
  22. package/plugins/datasets/dist/umd/index.js +1 -1
  23. package/plugins/datasets/src/index.js +0 -1
  24. package/plugins/datasets/src/index.test.js +2 -8
  25. package/plugins/datasets/src/registry/dataset.test.js +9 -0
  26. package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
  27. package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
  28. package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
  29. package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
  30. package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
  31. package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
  32. package/plugins/draw/dist/umd/index.js +1 -1
  33. package/plugins/draw/src/DrawInit.jsx +3 -0
  34. package/plugins/draw/src/DrawInit.test.jsx +16 -0
  35. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.js +19 -3
  36. package/plugins/draw/src/adapters/maplibre/MaplibreDrawAdapter.test.js +27 -0
  37. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.js +10 -2
  38. package/plugins/draw/src/adapters/openlayers/OLDrawAdapter.test.js +14 -0
  39. package/plugins/draw/src/defaults.js +4 -0
  40. package/plugins/draw/src/hooks/useSnapMinZoom.js +29 -0
  41. package/plugins/draw/src/hooks/useSnapMinZoom.test.js +82 -0
  42. package/plugins/draw/src/manifest.js +4 -1
  43. package/plugins/draw/src/manifest.test.js +15 -2
  44. package/plugins/draw/src/utils/snapMinZoom.js +8 -0
  45. package/plugins/draw/src/utils/snapMinZoom.test.js +22 -0
  46. package/plugins/interact/dist/esm/im-interact-plugin.js +1 -1
  47. package/plugins/interact/dist/umd/im-interact-plugin.js +1 -1
  48. package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
  49. package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
  50. package/plugins/map-key/src/manifest.js +1 -1
  51. package/plugins/search/dist/css/index.css +1 -1
  52. package/plugins/search/src/components/Form/Form.module.scss +1 -0
  53. package/providers/esri/dist/esm/im-esri-provider.js +1 -1
  54. package/providers/esri/src/esriProvider.js +10 -21
  55. package/providers/esri/src/utils/coords.js +37 -7
  56. package/providers/esri/src/utils/coords.test.js +22 -1
  57. package/providers/esri/src/utils/spatial.js +1 -47
  58. package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
  59. package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
  60. package/providers/maplibre/src/maplibreProvider.js +5 -14
  61. package/providers/maplibre/src/maplibreProvider.test.js +143 -146
  62. package/providers/maplibre/src/utils/spatial.js +0 -40
  63. package/providers/maplibre/src/utils/spatial.test.js +0 -35
  64. package/providers/openlayers/dist/esm/im-openlayers-provider.js +1 -1
  65. package/providers/openlayers/dist/umd/im-openlayers-provider.js +1 -1
  66. package/providers/openlayers/src/openlayersProvider.js +5 -14
  67. package/providers/openlayers/src/openlayersProvider.test.js +12 -10
  68. package/providers/openlayers/src/utils/spatial.js +0 -39
  69. package/providers/openlayers/src/utils/spatial.test.js +1 -26
  70. package/src/App/components/Hints/Hints.jsx +9 -21
  71. package/src/App/components/Hints/Hints.test.jsx +20 -33
  72. package/src/App/components/MapButton/MapButton.jsx +20 -2
  73. package/src/App/components/MapButton/MapButton.module.scss +15 -1
  74. package/src/App/components/MapButton/MapButton.test.jsx +21 -3
  75. package/src/App/components/Panel/Panel.jsx +16 -1
  76. package/src/App/components/Panel/Panel.test.jsx +44 -0
  77. package/src/App/components/Tooltip/Tooltip.jsx +29 -11
  78. package/src/App/components/Tooltip/Tooltip.test.jsx +45 -3
  79. package/src/App/components/Viewport/MapController.jsx +2 -0
  80. package/src/App/components/Viewport/MapController.test.jsx +3 -0
  81. package/src/App/hooks/useCrossHairAPI.js +27 -28
  82. package/src/App/hooks/useCrossHairAPI.test.js +64 -7
  83. package/src/App/hooks/useLayoutMeasurements.js +175 -131
  84. package/src/App/hooks/useLayoutMeasurements.test.js +227 -122
  85. package/src/App/hooks/useMapProviderOverrides.js +114 -35
  86. package/src/App/hooks/useMapProviderOverrides.test.js +188 -5
  87. package/src/App/hooks/useModalPanelBehaviour.js +18 -32
  88. package/src/App/hooks/useModalPanelBehaviour.test.js +45 -33
  89. package/src/App/hooks/useUserMoveTracking.js +65 -0
  90. package/src/App/hooks/useUserMoveTracking.test.js +99 -0
  91. package/src/App/hooks/useVisibleGeometry.js +35 -45
  92. package/src/App/hooks/useVisibleGeometry.test.js +149 -121
  93. package/src/App/layout/Layout.jsx +4 -4
  94. package/src/App/layout/layout.module.scss +124 -61
  95. package/src/App/renderer/mapButtons.js +1 -0
  96. package/src/App/renderer/mapButtons.test.js +8 -0
  97. package/src/App/store/AppProvider.jsx +3 -0
  98. package/src/App/store/appDispatchMiddleware.js +18 -10
  99. package/src/App/store/appDispatchMiddleware.test.js +42 -4
  100. package/src/App/store/mapActionsMap.js +2 -1
  101. package/src/App/store/mapActionsMap.test.js +6 -0
  102. package/src/App/store/mapReducer.js +2 -0
  103. package/src/App/store/mapReducer.test.js +1 -0
  104. package/src/InteractiveMap/InteractiveMap.js +3 -2
  105. package/src/InteractiveMap/InteractiveMap.test.js +2 -2
  106. package/src/config/events.js +1 -1
  107. package/src/config/mapPanelSlots.js +8 -0
  108. package/src/config/symbolConfig.js +1 -1
  109. package/src/scss/settings/_colors.scss +4 -0
  110. package/src/services/symbolRegistry.js +1 -1
  111. package/src/services/symbolRegistry.test.js +19 -0
  112. package/src/types.js +33 -8
  113. package/src/utils/getFitMove.js +73 -0
  114. package/src/utils/getFitMove.test.js +114 -0
  115. package/src/utils/getSafeZoneInset.js +122 -77
  116. package/src/utils/getSafeZoneInset.test.js +241 -54
  117. package/src/utils/getValueForStyle.js +10 -5
  118. package/src/utils/getValueForStyle.test.js +13 -2
  119. package/src/utils/renderedBoxes.js +25 -0
  120. package/src/utils/renderedBoxes.test.js +61 -0
  121. package/src/utils/screenBox.js +70 -0
  122. package/src/utils/screenBox.test.js +69 -0
  123. package/src/utils/symbolUtils.js +9 -9
  124. package/src/utils/symbolUtils.test.js +21 -0
  125. package/providers/esri/src/utils/spatial.test.js +0 -58
@@ -1 +1 @@
1
- import{createRoot as e}from"preact/compat/client";import{g as t,E as n,l as o,s as r,r as i,t as a,a as s,h as l,b as c}from"./im-shell.js";import d,{useContext as u,createContext as p,useEffect as f,useRef as m,useReducer as h,useCallback as g,useMemo as b,useState as y,cloneElement as v,useLayoutEffect as E,createPortal as P,forwardRef as R}from"preact/compat";import{jsx as C,jsxs as I,Fragment as _}from"preact/jsx-runtime";const A=p(null);function S(){return u(A)}const T=(e,t)=>{const n={...e};for(const o in t)"object"!=typeof t[o]||Array.isArray(t[o])||null===t[o]?n[o]=t[o]:n[o]=T(e[o]||{},t[o]);return n},M=(e,t)=>({...e,...t}),w=(e,t,n)=>{const o=T(so,n);return{...e,[t]:o}};function k(){let e={};return{registerButton:t=>{e=M(e,t)},addButton:(t,n)=>(e=w(e,t,n),t),getButtonConfig:t=>((e,t)=>t?Object.fromEntries(Object.entries(e).filter(([e,n])=>n.pluginId===t)):e)(e,t),clear:()=>{e={}}}}const x=(e,t)=>({...e,...t}),L=(e,t,n)=>{const o=T(lo,n);return{...e,[t]:{...o,html:o.html,render:o.render}}},O=(e,t)=>{const{[t]:n,...o}=e;return o};const B=(e,t)=>({...e,...t}),D=(e,t,n)=>{const o=T(co,n);return{...e,[t]:{id:t,...o}}};function N(e,t,n,o,r){const i=e.panelConfig||e.panelRegistry.getPanelConfig(),a=i[t]?.[n];if(!a)return e.openPanels;const s=!!a.exclusive&&!a.modal,l=!!a.modal,c=Object.fromEntries(Object.entries(e.openPanels).filter(([e])=>!i[e]?.[n]?.exclusive));return{...s?{}:c,...l?e.openPanels:{},[t]:{props:o,...void 0!==r&&{focusOnOpen:r}}}}const $=(e,t)=>e===t||!!e&&!!t&&e.length===t.length&&e.every((e,n)=>e===t[n]),H={SET_BREAKPOINT:(e,n)=>{const{behaviour:o,hybridWidth:r,maxMobileWidth:i}=n,a=Object.keys(e.openPanels),s=a[a.length-1],l="hybrid"===o?e.isFullscreen:t({behaviour:o,hybridWidth:r,maxMobileWidth:i}),c=s?N(e,s,n.breakpoint,e.openPanels[s]?.props||{}):{},d=e.panelConfig||e.panelRegistry.getPanelConfig(),u=Object.fromEntries(Object.entries(d).filter(([e,t])=>{const o=t[n.breakpoint];return!0===o?.open&&!1===o?.dismissible&&!c[e]}).map(([t])=>[t,e.openPanels[t]||{props:{}}]));return{...e,breakpoint:n.breakpoint,isFullscreen:l,previousOpenPanels:e.openPanels,openPanels:{...c,...u}}},SET_MEDIA:(e,t)=>({...e,...t}),SET_HYBRID_FULLSCREEN:(e,t)=>({...e,isFullscreen:t}),SET_INTERFACE_TYPE:(e,t)=>e.interfaceType===t?e:{...e,interfaceType:t},PLUGINS_EVALUATED:e=>e.arePluginsEvaluated?e:{...e,arePluginsEvaluated:!0},CLEAR_PLUGINS_EVALUATED:e=>e.arePluginsEvaluated?{...e,arePluginsEvaluated:!1}:e,SET_LISTBOX_ACTIVE:e=>e.listboxIsActive?e:{...e,listboxIsActive:!0},SET_SAFE_ZONE_INSET:(e,{safeZoneInset:t,syncMapPadding:n=!0})=>((e,t)=>{if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every(n=>Object.is(e[n],t[n]))})(e.safeZoneInset,t)?e:{...e,safeZoneInset:t,syncMapPadding:n,isLayoutReady:!0},OPEN_PANEL:(e,t)=>{const{panelId:n,props:o={},focusOnOpen:r}=t,i=N(e,n,e.breakpoint,o,r);return i===e.openPanels?e:{...e,previousOpenPanels:e.openPanels,openPanels:i}},CLOSE_PANEL:(e,t)=>{const{[t]:n,...o}=e.openPanels;return{...e,previousOpenPanels:e.openPanels,openPanels:o}},CLOSE_ALL_PANELS:e=>({...e,previousOpenPanels:e.openPanels,openPanels:{}}),RESTORE_PREVIOUS_PANELS:e=>({...e,openPanels:e.previousOpenPanels||{},previousOpenPanels:e.openPanels}),TOGGLE_APP_VISIBLE:(e,t)=>({...e,appVisible:t}),SET_APPLICATION_MODE:(e,{id:t,include:n=null,exclude:o=null})=>{const r=e.applicationModeEntries,i=r[r.length-1];return i?.id===t&&$(i.include,n)&&$(i.exclude,o)?e:{...e,applicationModeEntries:[...r.filter(e=>e.id!==t),{id:t,include:n,exclude:o}]}},CLEAR_APPLICATION_MODE:(e,t)=>{const n=e.applicationModeEntries.filter(e=>e.id!==t);return n.length===e.applicationModeEntries.length?e:{...e,applicationModeEntries:n}},TOGGLE_NUDGE_STEP:e=>({...e,nudgeStepSize:"small"===e.nudgeStepSize?"large":"small"}),TOGGLE_BUTTON_DISABLED:(e,t)=>{const{id:n,isDisabled:o}=t,r=new Set(e.disabledButtons);return o?r.add(n):r.delete(n),{...e,disabledButtons:r}},TOGGLE_BUTTON_HIDDEN:(e,t)=>{const{id:n,isHidden:o}=t,r=new Set(e.hiddenButtons);return o?r.add(n):r.delete(n),{...e,hiddenButtons:r}},TOGGLE_BUTTON_PRESSED:(e,t)=>{const{id:n,isPressed:o}=t,r=new Set(e.pressedButtons);return o?r.add(n):r.delete(n),{...e,pressedButtons:r}},TOGGLE_BUTTON_EXPANDED:(e,t)=>{const{id:n,isExpanded:o}=t,r=new Set(e.expandedButtons);return o?r.add(n):r.delete(n),{...e,expandedButtons:r}},REGISTER_BUTTON:(e,t)=>({...e,buttonConfig:M(e.buttonConfig,t)}),ADD_BUTTON:(e,t)=>{const{id:n,config:o}=t,r=w(e.buttonConfig,n,o),i=new Set(e.hiddenButtons);o.isHidden&&i.add(n);const a=new Set(e.disabledButtons);o.isDisabled&&a.add(n);const s=new Set(e.pressedButtons);o.isPressed&&s.add(n);const l=new Set(e.expandedButtons);return o.isExpanded&&l.add(n),e.buttonRegistry?.addButton&&e.buttonRegistry.addButton(n,o),{...e,buttonConfig:r,hiddenButtons:i,disabledButtons:a,pressedButtons:s,expandedButtons:l}},REGISTER_PANEL:(e,t)=>({...e,panelConfig:x(e.panelConfig,t)}),ADD_PANEL:(e,t)=>{const{id:n,config:o}=t,r=L(e.panelConfig,n,o),i=r[n];e.panelRegistry?.addPanel&&e.panelRegistry.addPanel(n,o);const a=i?.[e.breakpoint],s=a?.open;return{...e,panelConfig:r,openPanels:s?N({...e,panelConfig:r},n,e.breakpoint,{}):e.openPanels}},REMOVE_PANEL:(e,t)=>{const n=t,{[n]:o,...r}=e.openPanels;return e.panelRegistry?.removePanel&&e.panelRegistry.removePanel(n),{...e,panelConfig:O(e.panelConfig,n),openPanels:r}},REGISTER_CONTROL:(e,t)=>({...e,controlConfig:B(e.controlConfig,t)}),ADD_CONTROL:(e,t)=>{const{id:n,config:o}=t,r=D(e.controlConfig,n,o);return e.controlRegistry?.addControl&&e.controlRegistry.addControl(n,o),{...e,controlConfig:r}}};function z(){return{preferredColorScheme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",prefersReducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches}}const F=e=>{const{initialBreakpoint:n,initialInterfaceType:o,appColorScheme:r,autoColorScheme:i,pluginRegistry:a,buttonRegistry:s,panelRegistry:l,controlRegistry:c}=e,{preferredColorScheme:d,prefersReducedMotion:u}=z(),p=t(e),f=function(e,t,n={}){const o={};return Object.keys(e).forEach(r=>{const i=e[r][t];i?.open&&(o[r]=n[r]||{props:{}})}),o}(l.getPanelConfig(),n);return{appVisible:null,isLayoutReady:!1,arePluginsEvaluated:!1,breakpoint:n,interfaceType:o,preferredColorScheme:i?d:r,prefersReducedMotion:u,isFullscreen:p,safeZoneInset:null,disabledButtons:e.backAndContinue?.continueLabel?new Set(["journeyContinue"]):new Set,hiddenButtons:new Set,pressedButtons:new Set,expandedButtons:new Set,applicationModeEntries:[],nudgeStepSize:"large",openPanels:f,previousOpenPanels:{},listboxIsActive:!1,syncMapPadding:!0,pluginRegistry:a,buttonRegistry:s,panelRegistry:l,controlRegistry:c,buttonConfig:s.getButtonConfig(),panelConfig:l.getPanelConfig(),controlConfig:c.getControlConfig()}},V=(e,t)=>{const{type:n,payload:o}=t,r=H[n];return r?r(e,o):e},W=Object.freeze({SIDE:"side",HEADER:"header",BANNER:"banner",TOP_LEFT:"top-left",TOP_MIDDLE:"top-middle",TOP_RIGHT:"top-right",LEFT_TOP:"left-top",LEFT_BOTTOM:"left-bottom",MIDDLE:"middle",RIGHT_TOP:"right-top",RIGHT_BOTTOM:"right-bottom",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",DRAWER:"drawer",ACTIONS:"actions",MODAL:"modal"}),G=Object.freeze({control:[W.HEADER,W.BANNER,W.TOP_LEFT,W.TOP_RIGHT,W.MIDDLE,W.RIGHT_TOP,W.RIGHT_BOTTOM,W.BOTTOM_RIGHT,W.DRAWER,W.ACTIONS],panel:[W.SIDE,W.HEADER,W.BANNER,W.LEFT_TOP,W.LEFT_BOTTOM,W.MIDDLE,W.RIGHT_TOP,W.RIGHT_BOTTOM,W.DRAWER,W.MODAL],button:[W.TOP_LEFT,W.TOP_MIDDLE,W.TOP_RIGHT,W.LEFT_TOP,W.LEFT_BOTTOM,W.RIGHT_TOP,W.RIGHT_BOTTOM,W.BOTTOM_LEFT,W.BOTTOM_RIGHT,W.ACTIONS]}),j=["mobile","tablet","desktop"];function U({panelId:e,props:t},o,r,i){if(!r?.[e]?.[o.breakpoint])return;const a=function(e,t,n,o){const r=o[e]?.[n],i=!!r?.exclusive&&!r?.modal,a=[];if(r?.modal)return a;const s=Object.keys(t);return i?s.forEach(e=>{const t=o[e]?.[n];t?.exclusive||a.push(e)}):s.forEach(e=>{const t=o[e]?.[n];t?.exclusive&&!t?.modal&&a.push(e)}),a}(e,o.openPanels,o.breakpoint,r);queueMicrotask(()=>{a.forEach(e=>{i.emit(n.APP_PANEL_CLOSED,{panelId:e})}),i.emit(n.APP_PANEL_OPENED,{panelId:e,props:t})})}const K=p(null),Z=({options:e,children:t})=>{const{pluginRegistry:i,buttonRegistry:a,panelRegistry:s,controlRegistry:l,keyboardShortcutRegistry:c,spatialListRegistry:d,eventBus:u,breakpointDetector:p}=e,y={appContainerRef:m(null),sideRef:m(null),mainRef:m(null),headerRef:m(null),topRef:m(null),topLeftColRef:m(null),topRightColRef:m(null),leftRef:m(null),leftTopRef:m(null),leftBottomRef:m(null),middleRef:m(null),rightRef:m(null),rightTopRef:m(null),rightBottomRef:m(null),drawerRef:m(null),bottomRef:m(null),bottomRightRef:m(null),attributionsRef:m(null),actionsRef:m(null),bannerRef:m(null),modalRef:m(null),viewportRef:m(null)},v=m({}),[E,P]=h(V,F(e)),R=m(E.panelConfig);R.current=E.panelConfig;const I=g(t=>{const r=R.current||e.panelRegistry.getPanelConfig(),i=E;P(t),R.current=((e,{type:t,payload:n})=>"ADD_PANEL"===t?L(e,n.id,n.config):"REMOVE_PANEL"===t?O(e,n):e)(r,t),function(e,t,r,i){const{type:a,payload:s}=e;if("CLOSE_PANEL"===a&&queueMicrotask(()=>{i.emit(n.APP_PANEL_CLOSED,{panelId:s})}),"CLOSE_ALL_PANELS"===a&&queueMicrotask(()=>{Object.keys(t.openPanels).forEach(e=>{i.emit(n.APP_PANEL_CLOSED,{panelId:e})})}),"OPEN_PANEL"===a&&U(s,t,r,i),"ADD_BUTTON"===a){const{id:e,config:t}=s,n=T(so,t);j.forEach(t=>{const r=n[t]?.slot;r&&!G.button.includes(r)&&o.warn(`button "${e}" has invalid slot "${r}" at breakpoint "${t}". Allowed slots: ${G.button.join(", ")}.`)})}if("ADD_CONTROL"===a){const{id:e,config:t}=s,n=T(co,t);j.forEach(t=>{const r=n[t]?.slot;!r||G.control.includes(r)||r.endsWith("-panel")||o.warn(`control "${e}" has invalid slot "${r}" at breakpoint "${t}". Allowed slots: ${G.control.join(", ")}.`)})}if("ADD_PANEL"===a){const{id:e,config:r}=s,a=T(lo,r);j.forEach(t=>{const n=a[t]?.slot;!n||G.panel.includes(n)||n.endsWith("-button")||o.warn(`panel "${e}" has invalid slot "${n}" at breakpoint "${t}". Allowed slots: ${G.panel.join(", ")}.`)});const l=a[t.breakpoint];l?.open&&queueMicrotask(()=>{const t=l.slot,{visibleGeometry:o}=a,r={panelId:e,slot:t};o&&(r.visibleGeometry=o),i.emit(n.APP_PANEL_OPENED,r)})}}(t,i,r,u)},[E,e,u]);!function(e,t){const{appColorScheme:n,autoColorScheme:o,behaviour:r,hybridWidth:i,maxMobileWidth:a}=t;f(()=>{const t=[window.matchMedia("(prefers-color-scheme: dark)"),window.matchMedia("(prefers-reduced-motion: reduce)")];function s(){const{preferredColorScheme:t,prefersReducedMotion:r}=z();e({type:"SET_MEDIA",payload:{preferredColorScheme:o?t:n,prefersReducedMotion:r}})}t.forEach(e=>e.addEventListener("change",s));let l=null,c=null;if("hybrid"===r){const t=i??a;l=window.matchMedia(`(max-width: ${t}px)`),c=t=>{e({type:"SET_HYBRID_FULLSCREEN",payload:t.matches})},l.addEventListener("change",c)}return()=>{t.forEach(e=>e.removeEventListener("change",s)),l&&c&&l.removeEventListener("change",c)}},[e,r,i,a])}(P,e),f(()=>{const t=p.subscribe(t=>{I({type:"SET_BREAKPOINT",payload:{behaviour:e.behaviour,breakpoint:t,hybridWidth:e.hybridWidth,maxMobileWidth:e.maxMobileWidth}})}),n=r(e=>{I({type:"SET_INTERFACE_TYPE",payload:e})});return()=>{t(),n()}},[]);const _=b(()=>({...E,dispatch:I,layoutRefs:y,buttonRefs:v,pluginRegistry:i,buttonRegistry:a,panelRegistry:s,controlRegistry:l,keyboardShortcutRegistry:c,spatialListRegistry:d}),[E,I]);return C(A.Provider,{value:e,children:C(K.Provider,{value:_,children:t})})};function Y(){return u(K)}const q=(e,t)=>`${e}-tabs-tab-${t.toLowerCase().replaceAll(/\s+/g,"-")}`,X=(e,t)=>`${e}-tabs-panel-${t.toLowerCase().replaceAll(/\s+/g,"-")}`,Q=({tabs:e,defaultTab:t,panelProps:n})=>{const{id:o}=S(),r=e.map(e=>e.name),[i,a]=y(t??r[0]),s=g(e=>{a(e),document.getElementById(q(o,e))?.focus()},[o]),l=g(e=>{const t=r.indexOf(i);"ArrowRight"===e.key?(e.preventDefault(),s(r[(t+1)%r.length])):"ArrowLeft"===e.key?(e.preventDefault(),s(r[(t-1+r.length)%r.length])):"Home"===e.key?(e.preventDefault(),s(r[0])):"End"===e.key&&(e.preventDefault(),s(r.at(-1)))},[r,i,s]),c=["im-c-tabs__panel",n?.className].filter(Boolean).join(" ");return I("div",{className:"im-c-tabs",children:[C("div",{role:"tablist",className:"im-c-tabs__list",children:e.map(({name:e})=>C("button",{type:"button",id:q(o,e),role:"tab","aria-selected":i===e,"aria-controls":X(o,e),tabIndex:i===e?0:-1,className:"im-c-tabs__tab",onClick:()=>s(e),onKeyDown:l,children:C("span",{className:"im-c-tabs__label",children:e})},e))}),e.map(({name:e,content:t})=>{const r=i===e;return C("div",{ref:r?n?.ref:void 0,id:X(o,e),role:"tabpanel","aria-labelledby":q(o,e),tabIndex:r?n?.tabIndex??-1:-1,hidden:!r,className:c,children:t},e)})]})};function J(e){const t=e.filter(e=>null==e.order||0===e.order),n=e.filter(e=>null!=e.order&&0!==e.order);n.sort((e,t)=>e.order-t.order);const o=[...t];for(const e of n){const t=Math.min(Math.max(e.order-1,0),o.length);o.splice(t,0,e)}return o}function ee(e){return e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function te({items:e,keyFn:t}){const n=new Map;for(const o of e){const e=t(o),r=e?ee(e):null;n.has(r)||n.set(r,[]),n.get(r).push(o)}return n}function ne({items:e,fallbackLabel:t}){const n=te({items:e,keyFn:e=>e.tab});if(n.size<=1)return null;const o=Array.from(n.entries()).map(([e,n])=>{const o=J(n),r=o[0];return{id:e??"default",order:r.order,name:e?r.tab:t,items:o}});return J(o)}const oe=({items:e})=>C("dl",{className:"im-c-keyboard-help__list",children:e.map(e=>I("div",{className:"im-c-keyboard-help__item"+(e.visuallyHidden?" im-u-visually-hidden":""),children:[C("dt",{className:"im-c-keyboard-help__title",children:e.title}),C("dd",{className:"im-c-keyboard-help__description",dangerouslySetInnerHTML:{__html:e.command}})]},e.id))}),re=(e,t)=>{const n=e.find(e=>e.items.some(({shortcut:e})=>(e.context??"viewport")===t));if(n)return n.name;const o=e.find(e=>e.items.some(({shortcut:e})=>"global"===e.context));return o?.name??e[0].name},ie=({context:e="viewport"})=>{const t=S(),{listboxIsActive:n,keyboardShortcutRegistry:o}=Y(),r=o.getKeyboardShortcuts(t),i=n?r:r.filter(e=>"listbox"!==e.context),a=ne({items:i.map(e=>({id:e.id,order:0,tab:e.group,shortcut:e})),fallbackLabel:"Navigate"});if(!a)return C("div",{className:"im-c-keyboard-help",children:C(oe,{items:i})});const s=a.map(e=>({name:e.name,content:C(oe,{items:e.items.map(({shortcut:e})=>e)})}));return C("div",{className:"im-c-keyboard-help",children:C(Q,{tabs:s,defaultTab:re(a,e)})})},ae=(e,t)=>`${e}-panel-${ee(t)}`;let se=0;const le=({children:e,content:t})=>{const{interfaceType:n}=Y(),o=m(null),r=m(null),[i,a]=y(!1),[s,l]=y(!1),[c,d]=y(null),[u]=y(()=>(se+=1,`tooltip-${se}`)),p=m(null),h=m(null),g=()=>{clearTimeout(p.current),a(!1)},b=()=>{clearTimeout(h.current),p.current=setTimeout(()=>a(!0),500)},E=()=>{clearTimeout(p.current),h.current=setTimeout(()=>a(!1),0)};f(()=>{const e=e=>{"Escape"===e.key&&(clearTimeout(p.current),clearTimeout(h.current),a(!1))};if(window.addEventListener("keydown",e),i){const e=function(e,t){if(!e)return"bottom";t||(t=e.closest(".im-o-app__main"));const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r={top:n.top-o.top,bottom:o.bottom-n.bottom,left:n.left-o.left,right:o.right-n.right},i=Object.entries(r);i.sort(([,e],[,t])=>e-t);const[a,s]=i[0];if("top"===a||"bottom"===a)for(const[e,t]of i)if(("left"===e||"right"===e)&&Math.abs(t-s)<=50)return"left"===e?"right":"left";return{top:"bottom",bottom:"top",left:"right",right:"left"}[a]}(o.current);d(e)}return()=>{window.removeEventListener("keydown",e),clearTimeout(p.current),clearTimeout(h.current)}},[i]);return I("div",{className:"im-c-tooltip-wrapper"+(s?" im-c-tooltip-wrapper--has-focus":""),children:[v(e,{ref:t=>{o.current=t;const n=e.props?.ref;"function"==typeof n?n(t):n&&"object"==typeof n&&(n.current=t)},onMouseEnter:b,onMouseLeave:E,onMouseDown:g,onKeyDown:g,onFocus:()=>{"keyboard"===n&&b(),l(!0)},onBlur:()=>{E(),l(!1)},"aria-labelledby":u}),C("div",{id:u,ref:r,className:`im-c-tooltip im-c-tooltip--${c||"hidden"} ${i?"im-c-tooltip--is-visible":""}`,role:"tooltip","aria-hidden":!i,children:t})]})};let ce={close:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};const de=()=>ce,ue=({id:e,svgContent:t,isMenu:n})=>{const o=n?de().chevron:de()[e]||t;return C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:o},className:"im-c-icon"+(n?" im-c-icon--narrow":"")})},pe=(e,t)=>({...e,...t}),fe={SET_MAP_READY:e=>({...e,isMapReady:!0}),MAP_MOVE:pe,MAP_MOVE_END:pe,MAP_FIRST_IDLE:pe,SET_MAP_STYLE:(e,t)=>({...e,mapStyle:t}),SET_MAP_STYLES:(e,t)=>({...e,mapStyles:t}),SET_MAP_SIZE:(e,t)=>({...e,mapSize:t}),UPDATE_CROSS_HAIR:(e,t)=>({...e,crossHair:{...e.crossHair,...t}}),UPSERT_LOCATION_MARKER:(e,t)=>{const n=new Map(e.markers.items.map(e=>[e.id,e])),o=n.get(t.id)||{};n.set(t.id,{...o,...t});const r=Array.from(n.values());return{...e,markers:{...e.markers,items:r}}},REMOVE_LOCATION_MARKER:(e,t)=>{const n=e.markers.items.filter(e=>e.id!==t);return{...e,markers:{...e.markers,items:n}}}},me=(e,t)=>{const{type:n,payload:o}=t,r=fe[n];return r?r(e,o):e},he={small:1,medium:1.5,large:2},ge=p(null),be=({options:e,children:t})=>{const[o,r]=h(me,(e=>{const{center:t,zoom:n,bounds:o,extent:r,mapStyle:i,mapSize:a,markers:s}=e,{registeredPlugins:l}=e.pluginRegistry,c=l?.find(e=>e.config?.handlesMapStyle)?null:i;return{isMapReady:!1,mapProvider:null,mapStyle:c,mapStyles:c?[c]:[],mapSize:a,center:t,zoom:n,bounds:o||r,resolution:null,isAtMaxZoom:null,isAtMinZoom:null,crossHair:{isVisible:!1,isPinnedToMap:!1,state:"active"},markers:{items:s||[]}}})(e)),{eventBus:i}=e,a=m(!1),s=()=>{r({type:"SET_MAP_READY"})},l=t=>{const n=localStorage.getItem(`${e.id}:mapStyleId`),o=t.find(e=>e.id===n)||t[0],i=localStorage.getItem(`${e.id}:mapSize`)||e.mapSize;r({type:"SET_MAP_STYLES",payload:t}),r({type:"SET_MAP_STYLE",payload:o}),r({type:"SET_MAP_SIZE",payload:i})},c=e=>{r({type:"SET_MAP_STYLE",payload:e})},d=e=>{r({type:"SET_MAP_SIZE",payload:e})};f(()=>(i.on(n.MAP_READY,s),i.on(n.MAP_INIT_MAP_STYLES,l),i.on(n.MAP_SET_STYLE,c),i.on(n.MAP_SET_SIZE,d),()=>{i.off(n.MAP_READY,s),i.off(n.MAP_INIT_MAP_STYLES,l),i.off(n.MAP_SET_STYLE,c),i.off(n.MAP_SET_SIZE,d)}),[]),f(()=>{o.mapSize&&(a.current?i.emit(n.MAP_SIZE_CHANGE,{mapSize:o.mapSize}):a.current=!0)},[o.mapSize]),f(()=>{o.mapStyle&&o.mapSize&&(localStorage.setItem(`${e.id}:mapStyleId`,o.mapStyle.id),localStorage.setItem(`${e.id}:mapSize`,o.mapSize))},[o.mapStyle,o.mapSize]);const u=b(()=>{return{...o,mapSizeScale:(e=o.mapSize,he[e]??1),dispatch:r};var e},[o]);return C(ge.Provider,{value:u,children:t})};function ye(){return u(ge)}function ve(e,{startupGraceDelay:t=1e3}={}){const n=t,o=Date.now();let r=null,i=null,a=!1;const s=t=>{if(!e?.current||!t)return;const r=Math.max(0,n-(Date.now()-o));e.current.textContent="",setTimeout(()=>{e.current&&(a=t===i&&!a,i=t,e.current.textContent=a?t+"​":t)},100+r)},l=((e,t)=>{let n=null;const o=(...o)=>{clearTimeout(n),n=setTimeout(()=>{e(...o)},t)};return o.cancel=()=>{n&&(clearTimeout(n),n=null)},o})(s,500),c=(e,t="action")=>{if(e)if("ambient"!==t)clearTimeout(r),r=setTimeout(()=>{r=null},1e3),l(e);else{if(r)return;s(e)}};return c.clear=()=>{e?.current&&(e.current.textContent="")},c}const Ee="aria-label";const Pe=(e,t)=>{if(!e)return null;if("string"==typeof e)return e.trim();if("object"==typeof e){if(t&&e[t])return e[t];return Object.values(e)[0]??null}return null},Re={symbol:"pin",size:"medium",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},Ce={small:.75,medium:1,large:1.25},Ie=[.5,.5],_e="0 0 44 44",Ae={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},Se={id:"pin",path:"M22 7a13 13 0 0 1 13 13C35 28.258 23.758 39.499 22 39.499S9 28.259 9 20.001a13 13 0 0 1 13-13z",bounds:[9,7,26,32.499],anchorPoint:[22,40.5],graphicCentre:[22,20],graphic:Ae.dot},Te={id:"circle",path:"M22 9a13 13 0 1 1 0 26 13 13 0 1 1 0-26z",bounds:[9,9,26,26],anchorPoint:[22,22],graphicCentre:[22,22],graphic:Ae.dot},Me={id:"square",path:"M13.2 33.8a3 3 0 0 1-3-3V13.2a3 3 0 0 1 3-3h17.6a3 3 0 0 1 3 3v17.6a3 3 0 0 1-3 3H13.2z",bounds:[10.2,10.2,23.6,23.6],anchorPoint:[22,22],graphicCentre:[22,22],graphic:Ae.dot},we={id:"hexagon",path:"M23.5 8.317L33.1 13.859A3 3 0 0 1 34.6 16.457L34.6 27.543A3 3 0 0 1 33.1 30.141L23.5 35.683A3 3 0 0 1 20.5 35.683L10.9 30.141A3 3 0 0 1 9.4 27.543L9.4 16.457A3 3 0 0 1 10.9 13.859L20.5 8.317A3 3 0 0 1 23.5 8.317z",bounds:[9.4,7.915,25.2,28.17],anchorPoint:[22,22],graphicCentre:[22,22],graphic:Ae.dot},ke={id:"triangle",path:"M25.598 9.7L38.415 31.9A3 3 0 0 1 35.817 36.4L10.183 36.4A3 3 0 0 1 7.585 31.9L20.402 9.7A3 3 0 0 1 25.598 9.7z",bounds:[7.183,8.2,31.634,28.2],anchorPoint:[23,26],graphicCentre:[23,26.5],graphic:Ae.dot},xe={id:"diamond",path:"M25.121 8.716L37.284 20.879A3 3 0 0 1 37.284 25.121L25.121 37.284A3 3 0 0 1 20.879 37.284L8.716 25.121A3 3 0 0 1 8.716 20.879L20.879 8.716A3 3 0 0 1 25.121 8.716z",bounds:[7.838,7.838,30.325,30.325],anchorPoint:[23,23],graphicCentre:[23,23],graphic:Ae.dot},Le=new Set,Oe=e=>`'${e}'`,Be=new Set(["symbolBackgroundColor","symbolForegroundColor","symbolHaloWidth","symbolGraphic"]),De=e=>!!e.label&&(!e.symbol&&!e.svgContent&&(null===e.symbol||null===e.svgContent)),Ne=e=>{if(t=e,!t?.symbol&&!t?.symbolSvgContent)return{};var t;const n={};return Be.forEach(t=>{if(null!=e[t]){const o=t.charAt(6).toLowerCase()+t.slice(7);n[o]=e[t]}}),n},$e={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}},He=e=>{const{haloColor:t,selectedColor:n,activeColor:o,foregroundColor:r}=(e=>{const t=$e[e?.mapColorScheme]??$e.light;return{haloColor:e?.haloColor??t.haloColor,selectedColor:e?.selectedColor??t.selectedColor,activeColor:e?.activeColor??t.activeColor,foregroundColor:e?.foregroundColor??t.foregroundColor}})(e);return{"--map-overlay-halo-color":t,"--map-overlay-selected-color":n,"--map-overlay-active-color":o,"--map-overlay-foreground-color":r}},ze=(e,t,n)=>new Promise((o,r)=>{const i=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,a=new Image(t,n);a.onload=()=>{const e=document.createElement("canvas");e.width=t,e.height=n;const r=e.getContext("2d");r.drawImage(a,0,0,t,n),o(r.getImageData(0,0,t,n))},a.onerror=()=>{r(new Error(`Failed to rasterise SVG: ${e.slice(0,80)}`))},a.src=i}),Fe=e=>{let t=0,n=2166136261;for(const o of e){const e=o.codePointAt(0);t=Math.imul(t,31)+e,n=Math.imul(n^e,16777619)}return(t>>>0).toString(36)+(n>>>0).toString(36)},Ve=e=>{const t=new Map,n=new Map;return{get:e=>{const n=t.get(e);return n&&(t.delete(e),t.set(e,n)),n},rasteriseOnce:(o,r)=>{if(!n.has(o)){const i=r().then(n=>(((n,o)=>{t.set(n,o),t.size>e&&t.delete(t.keys().next().value)})(o,n),n)).finally(()=>n.delete(o));n.set(o,i)}return n.get(o)}}},We=/[MmLlHhVvCcSsQqTtAaZz]/,Ge=/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/y,je=/[\s,]*/y,Ue=/[-+.\d]/,Ke={m:"nn",l:"nn",h:"n",v:"n",c:"nnnnnn",s:"nnnn",q:"nnnn",t:"nn",a:"nnnffnn",z:""},Ze=1e6,Ye=.5,qe=2*Math.PI,Xe=Math.PI/180,Qe=e=>Math.round(e*Ze)/Ze,Je=e=>Math.abs(e)<1e-12,et=e=>e>0&&e<1;class tt{position=0;constructor(e){this.pathData=e}fail(e){throw new Error(`Invalid SVG path: ${e} at position ${this.position} in "${this.pathData}"`)}skipSeparators(){je.lastIndex=this.position,je.exec(this.pathData),this.position=je.lastIndex}atEnd(){return this.skipSeparators(),this.position>=this.pathData.length}peek(){return this.pathData[this.position]}readCommand(){if(!We.test(this.peek()))return null;const e=this.peek();return this.position++,e}readNumber(){this.skipSeparators(),Ge.lastIndex=this.position;const e=Ge.exec(this.pathData);return e||this.fail("expected a number"),this.position=Ge.lastIndex,Number.parseFloat(e[0])}readFlag(){this.skipSeparators();const e=this.peek();return"0"!==e&&"1"!==e&&this.fail("expected an arc flag (0 or 1)"),this.position++,Number(e)}readParameters(e){return[...Ke[e.toLowerCase()]].map(e=>"f"===e?this.readFlag():this.readNumber())}}const nt=(e,t,n,o)=>{const r=3*t-e-3*n+o,i=2*(e-2*t+n),a=t-e;if(Je(r))return Je(i)?[]:[-a/i];const s=i*i-4*r*a;if(s<0)return[];const l=Math.sqrt(s);return[(-i+l)/(2*r),(-i-l)/(2*r)]},ot=(e,t,n,o,r)=>{const i=1-r;return i**3*e+3*i**2*r*t+3*i*r**2*n+r**3*o},rt=(e,t,n)=>{const o=e-2*t+n;return Je(o)?[]:[(e-t)/o]},it=(e,t,n,o)=>{const r=1-o;return r**2*e+2*r*o*t+o**2*n},at=e=>(e%qe+qe)%qe,st=e=>{if(Je(e.radiusX)||Je(e.radiusY)||e.startX===e.endX&&e.startY===e.endY)return[];const{centreX:t,centreY:n,radiusX:o,radiusY:r,cosRotation:i,sinRotation:a,startAngle:s,sweepAngle:l}=(({startX:e,startY:t,endX:n,endY:o,radiusX:r,radiusY:i,rotation:a,largeArc:s,sweep:l})=>{const c=Math.cos(a*Xe),d=Math.sin(a*Xe),u=(e-n)*Ye,p=(t-o)*Ye,f=c*u+d*p,m=-d*u+c*p,h=Math.max(1,Math.sqrt(f*f/(r*r)+m*m/(i*i))),g=r*h,b=i*h,y=g*g*b*b,v=g*g*m*m+b*b*f*f,E=(s===l?-1:1)*Math.sqrt(Math.max(0,(y-v)/v)),P=E*(g*m/b),R=E*(-b*f/g),C=Math.atan2((m-R)/b,(f-P)/g);let I=Math.atan2((-m-R)/b,(-f-P)/g)-C;return l&&I<0&&(I+=qe),!l&&I>0&&(I-=qe),{centreX:c*P-d*R+(e+n)*Ye,centreY:d*P+c*R+(t+o)*Ye,radiusX:g,radiusY:b,cosRotation:c,sinRotation:d,startAngle:C,sweepAngle:I}})(e),c=Math.atan2(-r*a,o*i),d=Math.atan2(r*i,o*a);return[c,c+Math.PI,d,d+Math.PI].filter(e=>l>=0?at(e-s)<=l:at(s-e)<=-l).map(e=>[t+o*i*Math.cos(e)-r*a*Math.sin(e),n+o*a*Math.cos(e)+r*i*Math.sin(e)])};class lt{currentX=0;currentY=0;subpathStartX=0;subpathStartY=0;lastCubicControl=null;lastQuadControl=null;hasPoints=!1;minX=1/0;minY=1/0;maxX=-1/0;maxY=-1/0;include(e,t){this.hasPoints=!0,this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,t),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,t)}moveCurrentPoint(e,t){this.currentX=e,this.currentY=t,this.include(e,t)}moveTo(e,t){this.moveCurrentPoint(e,t),this.subpathStartX=e,this.subpathStartY=t}lineTo(e,t){this.moveCurrentPoint(e,t)}reflect(e){return e?[2*this.currentX-e[0],2*this.currentY-e[1]]:[this.currentX,this.currentY]}cubicTo(e,t,n,o,r,i){const a=[this.currentX,e,n,r],s=[this.currentY,t,o,i];[...nt(...a),...nt(...s)].filter(et).forEach(e=>this.include(ot(...a,e),ot(...s,e))),this.moveCurrentPoint(r,i),this.lastCubicControl=[n,o]}quadTo(e,t,n,o){const r=[this.currentX,e,n],i=[this.currentY,t,o];[...rt(...r),...rt(...i)].filter(et).forEach(e=>this.include(it(...r,e),it(...i,e))),this.moveCurrentPoint(n,o),this.lastQuadControl=[e,t]}arcTo(e){st({...e,startX:this.currentX,startY:this.currentY}).forEach(([e,t])=>this.include(e,t)),this.moveCurrentPoint(e.endX,e.endY)}close(){this.currentX=this.subpathStartX,this.currentY=this.subpathStartY}}const ct={m:(e,[t,n],[o,r])=>e.moveTo(t+o,n+r),l:(e,[t,n],[o,r])=>e.lineTo(t+o,n+r),h:(e,[t],[n])=>e.lineTo(t+n,e.currentY),v:(e,[t],[,n])=>e.lineTo(e.currentX,t+n),c:(e,[t,n,o,r,i,a],[s,l])=>e.cubicTo(t+s,n+l,o+s,r+l,i+s,a+l),s:(e,[t,n,o,r],[i,a],s)=>e.cubicTo(...e.reflect(s.cubic),t+i,n+a,o+i,r+a),q:(e,[t,n,o,r],[i,a])=>e.quadTo(t+i,n+a,o+i,r+a),t:(e,[t,n],[o,r],i)=>e.quadTo(...e.reflect(i.quad),t+o,n+r),a:(e,[t,n,o,r,i,a,s],[l,c])=>e.arcTo({radiusX:Math.abs(t),radiusY:Math.abs(n),rotation:o,largeArc:r,sweep:i,endX:a+l,endY:s+c}),z:e=>e.close()},dt=e=>{const t=new lt;for(const[n,...o]of(e=>{const t=new tt(e),n=[];let o=null;for(;!t.atEnd();){const e=t.readCommand();e||o&&Ue.test(t.peek())||t.fail(`unexpected "${t.peek()}"`),o=e??o,n.push([o,...t.readParameters(o)]),o={M:"L",m:"l",Z:null,z:null}[o]??o}return n})(e)){const e=n.toLowerCase(),r=n===e?[t.currentX,t.currentY]:[0,0],i={cubic:t.lastCubicControl,quad:t.lastQuadControl};t.lastCubicControl=null,t.lastQuadControl=null,ct[e](t,o,r,i)}if(!t.hasPoints)throw new Error(`Invalid SVG path: "${e}" draws nothing`);return[Qe(t.minX),Qe(t.minY),Qe(t.maxX-t.minX),Qe(t.maxY-t.minY)]},ut=.5,pt=e=>4*Math.ceil(e/4),ft=e=>Math.round(1e3*e)/1e3,mt=new Set,ht=new WeakMap,gt=(e,t)=>{let n=ht.get(e);if(n||(n=new Map,ht.set(e,n)),n.has(t))return n.get(t);const[o,r,i,a]=e.bounds,s=pt(i*t+16),l=pt(a*t+16),c=(s-i*t)*ut,d=(l-a*t)*ut,[u,p]=e.anchorPoint,f={...e,scale:t,viewBox:`0 0 ${s} ${l}`,anchor:[((u-o)*t+c)/s,((p-r)*t+d)/l],bodyBox:[c,d,i*t,a*t],transform:`translate(${ft(c)}, ${ft(d)}) scale(${t}) translate(${-o}, ${-r})`};return n.set(t,f),f},bt=(e,t)=>{if(!t)return e;if(!(e=>Array.isArray(e)&&2===e.length&&e.every(Number.isFinite))(t)){const n=JSON.stringify(t);return mt.has(n)||(mt.add(n),o.warn(`Invalid symbolAnchor ${n} — expected [x, y] numbers. Using the symbol's own anchor.`)),e}if(!e.bodyBox)return{...e,anchor:t};const[n,r,i,a]=e.bodyBox,[,,s,l]=e.viewBox.split(" ").map(Number);return{...e,anchor:[(n+t[0]*i)/s,(r+t[1]*a)/l]}},yt=new Map,vt=(e,t,n)=>{if(!yt.has(e)){let t={scale:1,graphicCentreX:8,graphicCentreY:8};if(e)try{const[n,o,r,i]=dt(e);t={scale:Math.min(1,16/Math.max(r,i,Number.EPSILON)),graphicCentreX:n+r*ut,graphicCentreY:o+i*ut}}catch(e){o.warn(`Symbol graphic could not be measured, so it isn't centred — ${e.message}`)}yt.set(e,t)}const{scale:r,graphicCentreX:i,graphicCentreY:a}=yt.get(e);return`translate(${t}, ${n}) scale(${ft(.8*r)}) translate(${ft(-i)}, ${ft(-a)})`},Et=e=>!!e&&"none"!==e,Pt=Ve(256),Rt=(e,t,n,o)=>`symbol-${e}${Fe(`${n}|${t}`)}-${o}x`,Ct=new Set(["id","svg","viewBox","anchor","symbol","svgContent","size","symbolSvgContent","symbolSize","path","bounds","anchorPoint","graphicCentre","bodyBox","transform","scale"]),It={normal:{resolveWith:"resolve",prefix:""},active:{resolveWith:"resolveActive",prefix:"act-"},selected:{resolveWith:"resolveSelected",prefix:"sel-"}},_t=(e,t)=>Array.isArray(e)&&e.length===t&&e.every(Number.isFinite),At=e=>{if("string"!=typeof e?.id||!e.id)throw new TypeError('symbolRegistry.register: a symbol needs a string "id"');e.path?(({id:e,bounds:t,anchorPoint:n,graphicCentre:o})=>{if(!_t(t,4))throw new TypeError(`symbolRegistry.register: symbol "${e}" has a "path" but no valid "bounds" ([x, y, width, height])`);if(!_t(n,2)||!_t(o,2))throw new TypeError(`symbolRegistry.register: symbol "${e}" has a "path" but no valid "anchorPoint" and "graphicCentre" ([x, y])`)})(e):(({id:e,svg:t,viewBox:n,anchor:o})=>{if("string"!=typeof t||!t)throw new TypeError(`symbolRegistry.register: symbol "${e}" needs an "svg" template`);if("string"!=typeof n||4!==n.trim().split(/[\s,]+/).length)throw new TypeError(`symbolRegistry.register: symbol "${e}" needs a "viewBox" ('minX minY width height')`);if(void 0!==o&&!_t(o,2))throw new TypeError(`symbolRegistry.register: symbol "${e}" has an invalid "anchor" — expected [x, y] in 0–1`)})(e)};function St(e,t){if(e.path){return((e,t)=>{const{path:n,scale:o,transform:r,graphicCentre:[i,a]}=e,s=(e,t)=>`<path d="${n}" fill="none" stroke="${e}" stroke-width="${ft(t/o)}" stroke-linejoin="round"/>`;return`<g transform="${r}">${[Et(t.activeColor)?s(t.activeColor,14):"",Et(t.selectedColor)?s(t.selectedColor,8):"",`<path d="${n}" fill="${t.backgroundColor}" stroke="${t.haloColor}" stroke-width="${ft(2/o)}" stroke-linejoin="round" paint-order="stroke fill"/>`,`<g transform="${vt(t.graphic,i,a)}"><path d="${t.graphic}" fill="${t.foregroundColor}"/></g>`].join("")}</g>`})(e.transform?e:gt(e,1),t)}return((e,t)=>Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e))(e.svg,t)}function Tt(e,t,n,o){const r=n?.id,i=Object.fromEntries(Object.entries(e||{}).filter(([e])=>!Ct.has(e))),a=Object.fromEntries(Object.entries(o).filter(([e])=>!Ct.has(e))),s=Object.fromEntries(Object.entries(t).filter(([,e])=>null!=e)),l={...Re,...a,...i,...s},c=$e[n?.mapColorScheme]??$e.light;return l.haloColor=n?.haloColor??c.haloColor,l.selectedColor=n?.selectedColor??c.selectedColor,l.activeColor=n?.activeColor??c.activeColor,"string"==typeof l.graphic&&Ae[l.graphic]&&(l.graphic=Ae[l.graphic]),Object.fromEntries(Object.entries(l).map(([e,t])=>[e,Pe(t,r)||""]))}const Mt={getMarkerSymbolDef(e){const t=this.getDefaults(),n=e.svgContent||t.svgContent,o=n?{svg:n}:this.get(e.symbol||t.symbol);if(o)return this.getSizedSymbolDef(o,{viewBox:e.viewBox||t.viewBox,size:e.size??t.size,anchor:e.anchor??t.anchor})},resolveVariant(e,t,n,o){const{resolveWith:r}=It[o]??It.normal;return this[r](e,t,n)},getKeySymbol(e,t){const n=this.getSymbolDef({...e,symbolSize:"medium"});if(!n)return null;const o={...t,mapColorScheme:t?.appColorScheme??"light"};return{svg:this.resolve(n,Ne(e),o),viewBox:n.viewBox}},resolveSymbolImage(e,t,n,o){const r=this.getSymbolDef(e);if(!r)return null;const{prefix:i}=It[n]??It.normal,a=this.resolveVariant(r,Ne(e),t,n);return{symbolDef:r,resolvedContent:a,imageId:Rt(i,a,r.viewBox,o)}},getSymbolImageId(e,t,n,o){return this.resolveSymbolImage(e,t,n,o)?.imageId??null},getSymbolImageIds(e,t,n){const o=this.getSymbolImageId(e,t,"normal",n);return o?{normal:o,active:this.getSymbolImageId(e,t,"active",n),selected:this.getSymbolImageId(e,t,"selected",n)}:null},getSymbolDef(e){const t=e.symbolSvgContent?{svg:e.symbolSvgContent}:e.symbol&&this.get(e.symbol);if(t)return this.getSizedSymbolDef(t,{viewBox:e.symbolViewBox,size:e.symbolSize,anchor:e.symbolAnchor})},getSizedSymbolDef(e,{viewBox:t,size:n,anchor:r}={}){const i=(e=>{if(null==e||Object.keys(Ce).includes(e))return Ce[e]??Ce.medium;if(!Le.has(e)){Le.add(e);const t=Object.keys(Ce).map(Oe).join(", ");o.warn(`Unknown symbol size "${e}" — expected ${t}. Using 'medium'.`)}return Ce.medium})(n??this.getDefaults().size),a=e.path?gt(e,i):((e,t,n)=>{const o={anchor:Ie,...e};if(1===n)return{...o,viewBox:t};const r=t.split(" ").map(e=>ft(Number(e)*n)).join(" ");return{...o,viewBox:r,svg:`<g transform="scale(${n})">${e.svg}</g>`}})(e,t??e.viewBox??_e,i);return bt(a,r)},async rasteriseSymbolImage(e,t,n,o){const r=this.resolveSymbolImage(e,t,n,o);if(!r)return null;const{symbolDef:{viewBox:i},resolvedContent:a,imageId:s}=r;let l=Pt.get(s);if(!l){const[,,e,t]=i.split(" ").map(Number),n=`<svg xmlns="http://www.w3.org/2000/svg" width="${e*o}" height="${t*o}" viewBox="${i}">${a}</svg>`;l=await Pt.rasteriseOnce(s,()=>ze(n,e*o,t*o))}return{imageId:s,imageData:l}}},wt=()=>{const e=new Map;let t={};const n={setDefaults(e){t=e||{}},getDefaults:()=>({...Re,...t}),register(t){At(t),e.set(t.id,t)},get:t=>e.get(t),list:()=>[...e.values()],clear(){e.clear()},initialise(){this.register(Se),this.register(Te),this.register(Me),this.register(we),this.register(ke),this.register(xe)},resolve(e,n,o){const r=Tt(e,n||{},o,t);return e?(r.selectedColor="none",r.activeColor="none",St(e,r)):""},resolveActive(e,n,o){const r=Tt(e,n||{},o,t);return e?St(e,r):""},resolveSelected(e,n,o){const r=Tt(e,n||{},o,t);return e?(r.activeColor="none",St(e,r)):""},...Mt};return n.initialise(),n},kt={"cross-hatch":'<path d="M0 4.486V3.485h3.5V.001h1v3.484h7.002V.001h1v3.484h3.5v1.001h-3.5v7h3.5v.999h-3.5v3.516h-1v-3.516H4.499v3.516h-1v-3.516H0v-.999h3.5v-7H0zm11.501 0H4.499v7h7.002v-7z" fill="{{foregroundColor}}"/>',"diagonal-cross-hatch":'<path d="M0 8.707V7.293L7.293 0h1.414L16 7.293v1.414L8.707 16H7.293L0 8.707zM.707 8L8 15.293 15.293 8 8 .707.707 8z" fill="{{foregroundColor}}"/>',"forward-diagonal-hatch":'<path d="M16 8.707V7.293L7.293 16h1.414L16 8.707zm-16 0L8.707 0H7.293L0 7.293v1.414z" fill="{{foregroundColor}}"/>',"backward-diagonal-hatch":'<path d="M0 8.707V7.293L8.707 16H7.293L0 8.707zm16 0L7.293 0h1.414L16 7.293v1.414z" fill="{{foregroundColor}}"/>',"horizontal-hatch":'<path d="M0 4.5V3.499h15.999V4.5H0zm0 7h15.999V12.5H0v-1.001z" fill="{{foregroundColor}}"/>',"vertical-hatch":'<path d="M3.501 16.001V0h1v16.001h-1zm7.998 0V0h1v16.001h-1z" fill="{{foregroundColor}}"/>',dot:'<path d="M3.999 2A2 2 0 0 1 6 3.999C6 5.103 5.103 6 3.999 6a2 2 0 0 1-1.999-2.001A2 2 0 0 1 3.999 2zm0 7.999C5.103 10 6 10.897 6 12.001A2 2 0 0 1 3.999 14a2 2 0 0 1-1.999-1.999A2 2 0 0 1 3.999 10zM11.999 2A2 2 0 0 1 14 3.999C14 5.103 13.103 6 11.999 6S10 5.103 10 3.999A2 2 0 0 1 11.999 2zm0 7.999c1.104 0 2.001.897 2.001 2.001A2 2 0 0 1 11.999 14 2 2 0 0 1 10 12.001c0-1.104.897-2.001 1.999-2.001z" fill="{{foregroundColor}}"/>',diamond:'<path d="M4 .465L7.535 4 4 7.535.465 4 4 .465zm0 7.999l3.535 3.535L4 15.535.465 11.999 4 8.464zm8-8l3.535 3.535-3.536 3.536L8.464 4 12 .464zm0 8.001L15.536 12 12 15.536 8.465 12 12 8.465z" fill="{{foregroundColor}}"/>'},xt=e=>Math.max(2,2*e),Lt=(e,t,n)=>e.replace(/\{\{foregroundColor\}\}/g,t||"black").replace(/\{\{backgroundColor\}\}/g,n||"transparent"),Ot=Ve(128),Bt={getPatternInnerContent(e){return e.fillPatternSvgContent?e.fillPatternSvgContent:e.fillPattern?this.get(e.fillPattern)?.svgContent??null:null},getKeyPatternPaths(e,t){const n=this.getPatternInnerContent(e);if(!n)return null;const o=Pe(e.fillPatternForegroundColor,t)||"black",r=Pe(e.fillPatternBackgroundColor,t)||"transparent",i=Pe(e.stroke,t)||o;return{border:Lt('<path d="M19 2.862v14.275c0 1.028-.835 1.862-1.862 1.862H2.863c-1.028 0-1.862-.835-1.862-1.862V2.862C1.001 1.834 1.836 1 2.863 1h14.275C18.166 1 19 1.835 19 2.862z" fill="{{backgroundColor}}" stroke="{{foregroundColor}}" stroke-width="2"/>',i,r),content:Lt(n,o,r)}},getPatternImageId(e,t,n){const o=this.getPatternInnerContent(e);if(!o)return null;const r=Pe(e.fillPatternForegroundColor,t)||"black",i=Pe(e.fillPatternBackgroundColor,t)||"transparent",a=xt(n);return`pattern-${Fe(o+r+i)}-${a}x`},async rasterisePatternImage(e,t,n){const o=this.getPatternInnerContent(e);if(!o)return null;const r=this.getPatternImageId(e,t,n);if(!r)return null;let i=Ot.get(r);if(!i){const a=Pe(e.fillPatternForegroundColor,t)||"black",s=Pe(e.fillPatternBackgroundColor,t)||"transparent",l=Lt(o,a,s),c=`<rect width="16" height="16" fill="${s}"/>`,d=Math.round(8*xt(n)),u=`<svg xmlns="http://www.w3.org/2000/svg" width="${d}" height="${d}" viewBox="0 0 16 16">${c}${l}</svg>`;i=await Ot.rasteriseOnce(r,()=>ze(u,d,d))}return{imageId:r,imageData:i}}},Dt=()=>{const e=new Map,t={register(t,n){e.set(t,{id:t,svgContent:n})},get:t=>e.get(t),list:()=>[...e.values()],clear(){e.clear()},initialise(){Object.entries(kt).forEach(([e,t])=>{this.register(e,t)})},...Bt};return t.initialise(),t},Nt=p(null),$t=({eventBus:e,pluginRegistry:t,children:n})=>{const{id:o,handleExitClick:r,symbolDefaults:a}=S(),s=m(null),l=b(()=>ve(s),[]),c=b(()=>function(e){const t=new Set;let n=null,o=null;const r=()=>t.forEach(e=>e(n)),i=()=>{o&&(clearTimeout(o),o=null)},a=()=>{i(),n=null,r(),e.clear?.()};return{show:(t,s={})=>{const{duration:l=4e3,announce:c}=s;i(),n={html:t},r(),e(c??(e=>e.replace(/<[^<>]*>/g,""))(t),"ambient"),l>0&&(o=setTimeout(a,l))},dismiss:a,subscribe:e=>(t.add(e),()=>t.delete(e))}}(l),[l]),{layoutRefs:d}=Y(),u=b(()=>function({viewportRef:e}){let t=null,n=!1,o=!1;return{focus:({message:r}={})=>{const i=e.current;i&&(r&&(n||(t=i.getAttribute(Ee)),i.setAttribute(Ee,r),n=!0,o=!0),i.focus())},clear:()=>{if(o=!1,!n)return;n=!1;const r=e.current;r&&(null===t?r.removeAttribute(Ee):r.setAttribute(Ee,t))},releaseAnnouncements:()=>{o=!1},isHoldingAnnouncements:()=>o}}({viewportRef:d.viewportRef}),[]),p=b(()=>wt(),[]),f=b(()=>Dt(),[]);p.setDefaults(a||{});const h=b(()=>({announce:l,hints:c,reverseGeocode:(e,t)=>i(e,t),eventBus:e,mapStatusRef:s,focusMap:u.focus,mapFocus:u,closeApp:()=>function(e,t){t()}(0,r),symbolRegistry:p,patternRegistry:f,getPlugin:e=>t?.getPlugin(e)}),[l,c,u,t,p,f]);return C(Nt.Provider,{value:h,children:n})};function Ht(){return u(Nt)}const zt=p(null);const Ft=({children:e})=>{const{pluginRegistry:t}=S(),n={},o={},r=m({});t.registeredPlugins.forEach(e=>{const t=e.reducer;if(t){const{initialState:r,actions:i}=t;n[e.id]=function(e){return(t={},n)=>{const o=e?.[n?.type];return o?o(t,n.payload):t}}(i),o[e.id]=r}r.current[e.id]||(r.current[e.id]={})});const[i,a]=h((e,t)=>{const{pluginId:o}=t;return o&&n[o]?{...e,[o]:n[o](e[o],t)}:e},o),s=(e,t)=>(r.current[e]||(r.current[e]={}),r.current[e][t]||(r.current[e][t]=d.createRef()),r.current[e][t]),l=b(()=>({state:i,dispatch:a,refs:r,getPluginRef:s}),[i,a]);return C(zt.Provider,{value:l,children:e})},Vt=e=>{const t=u(zt);if(!t)throw new Error("usePlugin must be used within PluginProvider");const{state:n,dispatch:o,refs:r,getPluginRef:i}=t;return r.current[e]||(r.current[e]={}),{...n[e],dispatch:t=>o({...t,pluginId:e}),refs:r.current[e],useRef:t=>i(e,t)}},Wt=new Map;function Gt(e){const t=e;return Wt.has(t)||Wt.set(t,function({pluginId:t,pluginConfig:n,...o}){const r=S(),i=Y(),a=ye(),s=Ht(),l=Vt(t),c=m(i.dispatch);c.current=i.dispatch;const d=m(null);d.current||(d.current={setApplicationMode:(e,{include:t=null,exclude:n=null}={})=>c.current({type:"SET_APPLICATION_MODE",payload:{id:e,include:t,exclude:n}}),clearApplicationMode:e=>c.current({type:"CLEAR_APPLICATION_MODE",payload:e})});const{setApplicationMode:u,clearApplicationMode:p}=d.current;return C(e,{...o,pluginConfig:n,pluginState:l,appConfig:r,appState:i,mapState:a,services:s,mapProvider:r.mapProvider,iconRegistry:de(),setApplicationMode:u,clearApplicationMode:p,buttonConfig:b(()=>Object.fromEntries(Object.entries(i.buttonConfig).filter(([e,n])=>n.pluginId===t)),[i.buttonConfig,t])})}),Wt.get(t)}const jt=(e,t)=>e.modal?"modal":"drawer"===e.slot&&["tablet","desktop"].includes(t)?"left-top":e.slot,Ut=e=>"string"==typeof e.html&&!e.pluginId,Kt=(e,{targetSlot:t,slot:n,isFullscreen:o})=>{const r=t.endsWith("-button");return!(!G.panel.includes(t)&&!r)&&(!(!1===e.inline&&!o)&&(void 0===n||t===n))},Zt=(e,t,n)=>{const o=Object.keys(e).filter(e=>t[e]?.[n]?.modal);return o.length>0?o[o.length-1]:null},Yt=(e,t=e=>e.slot)=>{const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}return n},qt=(e,t)=>({entries:e?.applicationModeEntries??[],declarations:(e?.pluginRegistry?.registeredPlugins??[]).flatMap(e=>Object.entries(e.manifest?.applicationModes??{}).map(([t,n])=>({id:t,pluginId:e.id,...n}))),config:t?.applicationModes??{}}),Xt=({entries:e,config:t})=>{const n=e.filter(e=>!1!==t[e.id]);return n[n.length-1]??null},Qt=e=>{const t=Xt(e);return t?`im-o-app--mode-${t.id}`:null},Jt=(e,t)=>!!e&&t.some(t=>e.includes(t)),en=(e,t)=>{const n=e.map(e=>e?.[t]).filter(Boolean);return n.length?n.flat():null},tn=()=>!1,nn=e=>{const t=Xt(e);if(!t)return tn;const{modeRules:n,ownerIds:o}=((e,{declarations:t,config:n})=>{const o=t.filter(t=>t.id===e.id);return{modeRules:[o.length?{include:en(o,"include"),exclude:en(o,"exclude")}:null,n[e.id]||null,e.include||e.exclude?{include:e.include,exclude:e.exclude}:null].filter(Boolean),ownerIds:o.map(e=>e.pluginId)}})(t,e),r=!!n[0]?.include;return({ids:e,pluginId:t,isModal:i=!1})=>{if(i)return!1;let a=!r||o.includes(t);return n.forEach(t=>{Jt(t.include,e)&&(a=!0),Jt(t.exclude,e)&&(a=!1)}),!a}};function on({slot:e,appState:t,evaluateProp:n,isHiddenByApplicationMode:o=tn}){const{breakpoint:r,pluginRegistry:i,controlConfig:a}=t;return Object.values(a).filter(o=>{if(Ut(o))return!1;const i=o[r];if(!i)return!1;if("function"==typeof o.excludeWhen&&n(o.excludeWhen,o.pluginId))return!1;const a=G.control.includes(i.slot)||i.slot?.endsWith("-panel");return!(!1===o.inline&&!t.isFullscreen)&&((void 0===e||i.slot===e)&&a)}).map(e=>{const t=i.registeredPlugins.find(t=>t.manifest?.controls?.some(t=>t.id===e.id)),a=t?.id,s=o({ids:[e.id],pluginId:a});let l;if(e.html)l=C("div",{className:`im-c-control im-c-control--${ee(e.id)}`,hidden:s,dangerouslySetInnerHTML:{__html:n(e.html,a)}},e.id);else{const n=Gt(e.render);l=C("div",{className:`im-c-control-wrapper im-c-control-wrapper--${ee(e.id)}`,hidden:s,children:C(n,{pluginId:a,pluginConfig:t?.config})},e.id)}return{id:e.id,type:"control",slot:e[r].slot,order:e[r]?.order??0,tab:e[r]?.tab,element:l}})}const rn=({triggeringElement:e,viewportRef:t,interfaceType:n})=>{requestAnimationFrame(()=>{const o=e&&document.contains(e)?e:t.current;o?.focus?.({preventScroll:"keyboard"!==n})})};function an(e,t){const n=m(),o=m(new WeakMap),r=m(t);return r.current=t,f(()=>{const i=(Array.isArray(e)?e:[e]).map(e=>e?.current).filter(Boolean);if(!i.length||!t)return;const a=new window.ResizeObserver(e=>{const t=[];for(const n of e){const{width:e,height:r}=n.contentRect,i=o.current.get(n.target)||{};i.width===e&&i.height===r||(o.current.set(n.target,{width:e,height:r}),t.push(n))}t.length&&(cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{for(const e of t)r.current(e)}))});return i.forEach(e=>a.observe(e)),()=>{a.disconnect(),n.current&&cancelAnimationFrame(n.current)}},[e]),{frameRef:n}}const sn={"left-top":{inset:"var(--left-offset-top) auto auto var(--primary-gap)",maxHeight:"var(--left-top-max-height)"},"left-bottom":{inset:"auto auto var(--left-offset-bottom) var(--primary-gap)",maxHeight:"var(--left-top-max-height)"},"right-top":{inset:"var(--right-offset-top) var(--primary-gap) auto auto",maxHeight:"var(--right-top-max-height)"},"right-bottom":{inset:"auto var(--primary-gap) var(--right-offset-bottom) auto",maxHeight:"var(--right-top-max-height)"}},ln="--modal-inset",cn="--modal-max-height",dn=({isModal:e,mainRef:t,panelRef:n,buttonContainerEl:o,layoutRefs:r})=>{if(!e||!t.current)return;const i=document.documentElement,a=getComputedStyle(i),s=Number.parseInt(a.getPropertyValue("--divider-gap"),10),l=Number.parseInt(a.getPropertyValue("--primary-gap"),10),c=n.current.dataset.slot;if(c?.endsWith("-button")){const e=n.current?.id,r=e?document.querySelector(`[aria-controls="${e}"]`):null,i=r?.parentElement??(o?.isConnected?o:null)??document.querySelector(`[data-button-slot="${c}"]`);if(!i)return;return void((e,t,n)=>{const o=document.documentElement,r=t.current.getBoundingClientRect(),i=e.getBoundingClientRect(),a=!!e.closest(".im-o-app__left-bottom, .im-o-app__right-bottom"),s=!!e.closest(".im-o-app__left-top, .im-o-app__left-bottom"),l=a?"auto":`${Math.round(i.top-r.top)}px`,c=a?`${Math.round(r.bottom-i.bottom)}px`:"auto",d=s?"auto":`${Math.round(r.right-i.left+n)}px`,u=s?`${Math.round(i.right-r.left+n)}px`:"auto",p=a?Math.round(r.bottom-i.bottom):Math.round(i.top-r.top);o.style.setProperty(ln,`${l} ${d} ${c} ${u}`),o.style.setProperty(cn,r.height-p-n+"px")})(i,t,s)}((e,t,n)=>{const o=document.documentElement,r=sn[e];if(r)return o.style.setProperty(ln,r.inset),void o.style.setProperty(cn,r.maxHeight);const i=`${e[0].toLowerCase()+e.slice(1)}Ref`,a=t[i]?.current,s=t.mainRef?.current;if(!a||!s)return;const l=a.getBoundingClientRect(),c=s.getBoundingClientRect(),d=l.left-c.left,u=l.top-c.top;o.style.setProperty(ln,`${u}px auto auto ${d}px`),o.style.setProperty(cn,c.height-u-n+"px")})(c,r,l)},un=(e,t,n)=>{f(()=>{if(!t)return;const o=t=>{"Escape"===t.key&&(t.stopPropagation(),t.preventDefault(),n()),"Tab"===t.key&&e.current&&function(e,t){if("Tab"!==t.key)return;let n=Array.from(e.querySelectorAll(['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','*[tabindex="0"]:not([disabled])'].join(",")));if(n=n.filter(e=>!!e.offsetParent),0===n.length)return;const o=n[0],r=n[n.length-1];!t.shiftKey||document.activeElement!==e&&document.activeElement!==o||(r.focus(),t.preventDefault()),t.shiftKey||document.activeElement!==r||(o.focus(),t.preventDefault())}(e.current,t)},r=e.current;return r?.addEventListener("keydown",o),()=>{r?.removeEventListener("keydown",o)}},[t,e,n])};function pn({mainRef:e,panelRef:t,isModal:n,rootEl:o,buttonContainerEl:r,handleClose:i}){const{layoutRefs:s}=Y();un(t,n,i),an([e],()=>dn({isModal:n,mainRef:e,panelRef:t,buttonContainerEl:r,layoutRefs:s})),E(()=>{dn({isModal:n,mainRef:e,panelRef:t,buttonContainerEl:r,layoutRefs:s})},[n,e,t,r,s]),f(()=>{if(!n)return;const e=e=>{const t=e.target.closest(".im-o-app__modal-backdrop");o&&t&&o.contains(t)&&i()};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[n,o,i]),E(()=>{if(n&&t.current&&o)return a({containerEl:t.current,isFullscreen:!0,boundaryEl:o}),()=>{a({containerEl:t.current,isFullscreen:!1,boundaryEl:o})}},[n,t,o]),((e,t,n)=>{f(()=>{if(!e)return;const o=e=>{const o=e.target,r=t.current;if(!o||!r||!n)return;const i=n.contains(o),a=r.contains(o);i&&!a&&r.focus()};return document.addEventListener("focusin",o),()=>{document.removeEventListener("focusin",o)}},[e,t,n])})(n,t,o)}const fn=e=>{const t=!0===e.modal,n="side"===e.slot&&e.open&&!t,o=t||!1!==e.dismissible;return{isModal:t,isAside:n,isDismissible:o,isDialog:!n&&o}},mn=({isDialog:e,isDismissible:t})=>e?"dialog":t?"complementary":"region",hn=({items:e,WrappedChild:t,props:n,children:o})=>e?e.map(e=>C(d.Fragment,{children:e.element},e.id)):t?C(t,{...n}):o,gn=({innerHtmlProp:e,tabs:t,items:n,WrappedChild:o,props:r,children:i,bodyProps:a,panelBodySlot:s})=>{if(e)return C("div",{...a,dangerouslySetInnerHTML:e});const{className:l,...c}=a;return t?C("div",{className:l,"data-panel-slot":s,children:C(Q,{tabs:t.map(e=>({name:e.name,content:e.items.map(e=>C(d.Fragment,{children:e.element},e.id))})),panelProps:c})}):I("div",{...a,"data-panel-slot":s,children:[" ",C(hn,{items:n,WrappedChild:o,props:r,children:i})]})},bn=({panelId:e,panelConfig:t,props:n,focusOnOpen:o,WrappedChild:r,items:i,tabs:a,label:s,html:l,children:c,isOpen:d=!0,isHidden:u=!1,rootRef:p})=>{const{id:h}=S(),{dispatch:v,breakpoint:E,layoutRefs:P,interfaceType:R}=Y(),_=document.getElementById(`${h}-im-app`),A=t[E],T=ae(h,e),{isDialog:M,isModal:w,isDismissible:k,shouldFocus:x,buttonContainerEl:L}=((e,t,n,o)=>{const{isModal:r,isAside:i,isDismissible:a,isDialog:s}=fn(e);return{isAside:i,isDialog:s,isModal:r,isDismissible:a,shouldFocus:r||!0===o||!1!==o&&!1!==n&&(!0===n||Boolean(t)),buttonContainerEl:e.slot.endsWith("button")?t?.parentNode:void 0}})(A,n?.triggeringElement,t.focus,o),O=w&&d,B=P.mainRef,D=m(null),N=m(null),$=m(d),H=function(e){const[t,n]=y(!1),o=g(()=>{const t=e?.current;t&&n(t.scrollHeight>t.clientHeight)},[e]);return an(e,o),t}(N),z=p||D,F=()=>{rn({triggeringElement:n?.triggeringElement,viewportRef:P.viewportRef,interfaceType:R}),v({type:"CLOSE_PANEL",payload:e})};pn({mainRef:B,panelRef:z,isModal:O,rootEl:_,buttonContainerEl:L,handleClose:F}),f(()=>{const e=d&&!$.current;$.current=d,x&&(e||d)&&z.current?.focus()},[d]);const V=(W=A.slot,G=A.showLabel??!0,["im-c-panel",`im-c-panel--${W}`,!G&&"im-c-panel--no-heading"].filter(Boolean).join(" "));var W,G;const j=((e,t)=>["im-c-panel__body",!e&&t&&"im-c-panel__body--offset"].filter(Boolean).join(" "))(A.showLabel??!0,k),U=b(()=>l?{__html:l}:null,[l]),K=(({elementId:e,shouldFocus:t,isDialog:n,isDismissible:o,isModal:r,width:i,panelClass:a,slot:s,isOpen:l,isHidden:c})=>({id:e,"aria-labelledby":`${e}-label`,tabIndex:t?-1:void 0,role:mn({isDialog:n,isDismissible:o}),"aria-modal":n&&r?"true":void 0,style:i?{width:i}:void 0,className:a,"data-slot":s,hidden:!l||c}))({elementId:T,shouldFocus:x,isDialog:M,isDismissible:k,isModal:w,width:A.width,panelClass:V,slot:A.slot,isOpen:d,isHidden:u}),Z=(({bodyRef:e,panelBodyClass:t,isBodyScrollable:n,elementId:o})=>({ref:e,className:t,tabIndex:n?0:void 0,role:n?"region":void 0,"aria-labelledby":n?`${o}-label`:void 0}))({bodyRef:N,panelBodyClass:j,isBodyScrollable:H,elementId:T}),q=`${ee(e)}-panel`;return I("div",{ref:z,...K,children:[C("h2",{id:`${T}-label`,className:A.showLabel??1?"im-c-panel__heading im-e-heading-m":"im-u-visually-hidden",children:s}),k&&C("button",{type:"button","aria-label":`Close ${s}`,className:"im-c-panel__close",onClick:F,children:C(ue,{id:"close"})}),C(gn,{innerHtmlProp:U,tabs:a,items:i,WrappedChild:r,props:n,bodyProps:Z,panelBodySlot:q,children:c})]})};function yn({slot:e,appState:t,evaluateProp:n,isHiddenByApplicationMode:o=tn,controlsBySlot:r}){const{breakpoint:i,pluginRegistry:a,panelConfig:s,openPanels:l}=t,c=Zt(l,s,i);return Object.keys(s).map(d=>{const u=((e,t,n,{slot:o,isFullscreen:r})=>{const i=t[e];if(!i||Ut(i))return null;const a=i[n];if(!a)return null;const s=jt(a,n);return Kt(i,{targetSlot:s,slot:o,isFullscreen:r})?{config:i,bpConfig:a,targetSlot:s}:null})(d,s,i,{slot:e,isFullscreen:t.isFullscreen});if(!u)return null;const{config:p,bpConfig:f,targetSlot:m}=u,h=l[d],g=((e,t,n,o)=>Boolean(e)&&(!t.modal||n===o))(h,f,d,c),{props:b={},focusOnOpen:y}=h??{},v=a.registeredPlugins.find(e=>e.id===p.pluginId),E=v?.id,P=o({ids:[d],pluginId:E,isModal:!!f.modal}),R=E?n(p.html,E):p.html,I=n(p.label,E);return{id:d,type:"panel",slot:m,order:f.order??0,element:C(bn,{panelId:d,panelConfig:p,props:b,focusOnOpen:y,isOpen:g,isHidden:P,...g?vn({panelId:d,config:p,bpConfig:f,props:b,plugin:v,pluginId:E,html:R,label:I,appState:t,evaluateProp:n,isHiddenByApplicationMode:o,controlsBySlot:r}):{},label:I,html:R},d)}}).filter(Boolean)}function vn({panelId:e,config:t,bpConfig:n,props:o,plugin:r,pluginId:i,html:a,label:s,appState:l,evaluateProp:c,isHiddenByApplicationMode:d,controlsBySlot:u}){const p=`${ee(e)}-panel`,f=u?u.get(p)??[]:on({slot:p,appState:l,evaluateProp:c,isHiddenByApplicationMode:d});if(a)return{};let m=null;if(t.render){const a=Gt(t.render);m={id:e,order:0,tab:n.tab,element:C(a,{...o,pluginId:i,pluginConfig:r?.config})}}const h=m?[m,...f]:f,g=ne({items:h,fallbackLabel:s});return g?{tabs:g}:{items:J(h)}}const En=(e,t,{appState:n,isHiddenByApplicationMode:o})=>n.hiddenButtons.has(e)||o({ids:[e],pluginId:t.pluginId}),Pn=({buttonId:e,config:t,isHidden:n,appState:o,appConfig:r,evaluateProp:i})=>({buttonId:e,config:t,appState:o,appConfig:r,evaluateProp:i,isHidden:n,variant:t.variant});function Rn({buttonId:e,config:t,isHidden:n=!1,appState:o,appConfig:r,evaluateProp:i}){const a=t[o.breakpoint]??{},s=function(e,t,n){const o=!(!e.panelId||!t.openPanels[e.panelId]),r=void 0!==e.isPressed||!!e.pressedWhen;return i=>{if("function"==typeof e.onClick)return e.onClick(i,n(e=>e,e.pluginId)),void(r||e.keepFocus||requestAnimationFrame(()=>t.layoutRefs.viewportRef.current?.focus()));if(e.panelId){const n=i.currentTarget;t.dispatch({type:o?"CLOSE_PANEL":"OPEN_PANEL",payload:o?e.panelId:{panelId:e.panelId,props:{triggeringElement:n},...e.keepFocus&&{focusOnOpen:!1}}})}}}(t,o,i),l=!(!t.panelId||!o.openPanels[t.panelId]),c=t.panelId?o.panelConfig?.[t.panelId]?.[o.breakpoint]:void 0,d=c?mn(fn(c)):void 0;return C(Zn,{buttonId:e,iconId:i(t.iconId,t.pluginId),iconSvgContent:i(t.iconSvgContent,t.pluginId),variant:t.variant,label:i(t.label,t.pluginId),href:i(t.href,t.pluginId),showLabel:a.showLabel??!0,isDisabled:o.disabledButtons.has(e),isHidden:n,isPressed:void 0!==t.isPressed||t.pressedWhen?o.pressedButtons.has(e):void 0,isExpanded:void 0!==t.isExpanded||t.expandedWhen?o.expandedButtons.has(e):void 0,isBusy:t.busyWhen?!!i(t.busyWhen,t.pluginId):void 0,isPanelOpen:l,panelRole:d,onClick:s,panelId:t.panelId,menuItems:t.menuItems,idPrefix:r.id,ariaControls:i(t.ariaControls,t.pluginId)})}function Cn(e,t){return e.map(([e,n])=>({id:e,type:"button",slot:n[t.breakpoint].slot,order:n[t.breakpoint]?.order??0,element:C(Rn,{...Pn({buttonId:e,config:n,isHidden:En(e,n,t),...t})},e)}))}function In(e,t,n){const[,o]=t[0],r=o.group.slotOrder??0;if(t.length<2){const[e,o]=t[0];return{id:e,type:"button",slot:o[n.breakpoint].slot,order:r,element:C(Rn,{...Pn({buttonId:e,config:o,isHidden:En(e,o,n),...n})},e)}}const i=J(t.map(([e,t])=>({id:e,order:t[n.breakpoint]?.order??0,buttonId:e,config:t,isHidden:En(e,t,n)})));return{id:`group-${e}`,type:"group",slot:o[n.breakpoint].slot,order:r,element:C("div",{role:"group","aria-label":o.group.label,className:"im-c-button-group",hidden:i.every(e=>e.isHidden),children:i.map(({buttonId:e,config:t,isHidden:o})=>C(Rn,{...Pn({buttonId:e,config:t,isHidden:o,...n})},e))},`group-${e}`)}}function _n(e,t){const n=te({items:function(e,t){let n=null;for(const[r,i]of e)if(i.exclusiveSlot&&!t.hiddenButtons.has(r)&&i.pluginId){if(null!==n&&n!==i.pluginId)return o.warn(`Slot exclusivity conflict: plugins [${n}, ${i.pluginId}] are both claiming exclusive slot ownership. Showing all buttons.`),e;n=i.pluginId}return null===n?e:e.filter(([e,t])=>t.pluginId===n)}(e,t.appState),keyFn:([,e])=>e.group?.label}),r=[];for(const[e,o]of n)null===e?r.push(...Cn(o,t)):r.push(In(e,o,t));return r}function An({slot:e,appState:t,appConfig:n,evaluateProp:o,isHiddenByApplicationMode:r=tn}){const{buttonConfig:i,breakpoint:a}=t,s=function({appState:e,buttonConfig:t,slot:n,evaluateProp:o}){const{breakpoint:r}=e;return t?Object.entries(t).filter(([t,i])=>{const a=i[r];if(i.isMenuItem)return!1;if("function"==typeof i.excludeWhen&&o(i.excludeWhen,i.pluginId))return!1;if(!1===i.inline&&!e.isFullscreen)return!1;if(i.panelId){const t=e.panelConfig?.[i.panelId]?.[r];if(!0===t?.open&&!1===t?.dismissible)return!1}return!(void 0!==n&&a?.slot!==n||!G.button.includes(a?.slot))}):[]}({appState:t,buttonConfig:i,slot:e,evaluateProp:o}),l={breakpoint:a,appState:t,appConfig:n,evaluateProp:o,isHiddenByApplicationMode:r};return[...Yt(s,([,e])=>e[a].slot).values()].flatMap(e=>_n(e,l))}function Sn(){const e=S(),t=Y(),n=ye(),o=Ht(),r=u(zt),i={appConfig:e,appState:t,mapState:n,services:o,mapProvider:e?.mapProvider,iconRegistry:de()};function a(t){if(!t)return{pluginStates:r?.state??{}};const n=e.pluginRegistry.registeredPlugins.find(e=>e.id===t),o=n?{pluginId:n.id,...n.config}:{};if(Object.hasOwn(r?.state??{},t)){return{pluginConfig:o,pluginState:{...r?.state?.[t]??{},dispatch:e=>r?.dispatch?.({...e,pluginId:t})}}}return{pluginConfig:o,pluginStates:r?.state??{}}}function s(e,t){const n={...i,...a(t)};return"function"==typeof e?e(n):e}return s.ctx=i,s}const Tn=()=>{const e=S(),t=Y();return nn(qt(t,e))},Mn=p(new Map),wn=({children:e})=>{const t=function(e){const t=on(e),n=yn({...e,controlsBySlot:Yt(t)}),o=An(e),r=Yt([...t,...n,...o]);for(const[e,t]of r)r.set(e,J(t));return r}({appConfig:S(),appState:Y(),evaluateProp:Sn(),isHiddenByApplicationMode:Tn()});return C(Mn.Provider,{value:t,children:e})},kn=[],xn=({children:e})=>{const{openPanels:t,panelConfig:n,breakpoint:o}=Y(),r=["im-c-panel","im-c-actions",!d.Children.toArray(e).some(e=>!1===e.props?.isHidden&&"touch"!==e.props?.variant)&&"im-c-actions--hidden",Object.keys(t).some(e=>"mobile"===o&&"drawer"===n[e]?.[o]?.slot)&&"im-c-actions--border-top"].filter(Boolean).join(" ");return C("div",{className:r,children:e})},Ln=({slot:e})=>{const t=(e=>u(Mn).get(e)??kn)(e);return t.length?C(_,{children:"actions"===e?C(xn,{slot:"actions",children:t.map(e=>e.element)}):C(_,{children:t.map(e=>e.element)})}):null};const On=(e,t,{buttonConfig:n,evaluateProp:o,pluginId:r,id:i})=>{const a=n[t.id];if("function"==typeof a?.onClick?a.onClick(e,o(e=>e,r)):"function"==typeof t.onClick&&t.onClick(e.nativeEvent),e.nativeEvent instanceof KeyboardEvent){const e=document.getElementById(`${i}-${ee(t.id)}`);if(e){const t=new MouseEvent("click",{bubbles:!0,cancelable:!0});t._fromKeyboardActivation=!0,e.dispatchEvent(t)}}},Bn=(e,t,n)=>"number"==typeof e?e:"first"===t?n[0]??-1:"last"===t?n[n.length-1]??-1:-1,Dn=(e,t)=>({panelId:t[e.id]?.panelId??e.panelId,keepFocus:t[e.id]?.keepFocus??e.keepFocus}),Nn=(e,t)=>{e?e.focus():t.current?.focus()},$n=(e,t,n)=>{const o=e??n,r=o.closest?.('[role="dialog"][aria-modal="true"]')??document,i=function({el:e,direction:t,root:n=document}){const o=n.querySelectorAll("input, button, select, textarea, a[href]"),r=Array.prototype.filter.call(o,e=>e.tabIndex>=0&&!!e.offsetParent),i=r.indexOf(e);return r["next"===t?i+1:i-1]||r[0]}({el:o,direction:t?"prev":"next",root:r});i?.focus()},Hn=({items:e,visibleIndices:t,index:n,setIndex:o,disabledButtons:r,instigator:i,setIsOpen:a,activateCtx:s,dispatch:l,viewportRef:c})=>{const d={items:e,index:n,disabledButtons:r,activateCtx:s,instigator:i,dispatch:l,viewportRef:c,setIsOpen:a};return e=>{if(!["Escape","Esc"].includes(e.key))return"Tab"===e.key?(e.preventDefault(),$n(i,e.shiftKey,e.currentTarget),void a(!1)):void(["ArrowDown","ArrowUp"].includes(e.key)?(e=>{e.preventDefault();const r=t.length;if(0===r)return;const i=t.indexOf(n);let a;a="ArrowDown"===e.key?-1===i?0:(i+1)%r:-1===i?r-1:(i-1+r)%r,o(t[a])})(e):"Home"===e.key&&t.length?o(t[0]):"End"===e.key&&t.length?o(t[t.length-1]):("Enter"===e.key&&((e,{items:t,index:n,disabledButtons:o,activateCtx:r,instigator:i,dispatch:a,viewportRef:s,setIsOpen:l})=>{e.preventDefault();const c=t[n];if(c&&!o.has(c.id)){const{panelId:t,keepFocus:n}=Dn(c,r.buttonConfig);if(t)return a({type:"OPEN_PANEL",payload:{panelId:t,props:{triggeringElement:i},...n&&{focusOnOpen:!1}}}),void l(!1);if(On(e,c,r),n)return Nn(i,s),void l(!1)}requestAnimationFrame(()=>s.current?.focus()),l(!1)})(e,d)," "===e.key&&((e,{items:t,index:n,disabledButtons:o,activateCtx:r,instigator:i,dispatch:a,viewportRef:s,setIsOpen:l})=>{e.preventDefault();const c=t[n];if(!c||o.has(c.id))return;const{panelId:d,keepFocus:u}=Dn(c,r.buttonConfig);if(d)return a({type:"OPEN_PANEL",payload:{panelId:d,props:{triggeringElement:i},...u&&{focusOnOpen:!1}}}),void l(!1);On(e,c,r),void 0!==c.isPressed||c.pressedWhen||(u?Nn(i,s):requestAnimationFrame(()=>s.current?.focus()),l(!1))})(e,d)));(e=>{e.preventDefault(),Nn(i,c),a(!1)})(e)}},zn=({items:e,hiddenButtons:t,startIndex:n,startPos:o,instigator:r,instigatorKey:i,buttonRefs:a,buttonConfig:s,disabledButtons:l,pluginId:c,evaluateProp:d,id:u,menuRef:p,setIsOpen:m,buttonRect:h,isOpen:g})=>{const{dispatch:v,layoutRefs:E}=Y(),P=E.viewportRef,R=b(()=>{const n=[];return e.forEach((e,o)=>{t.has(e.id)||n.push(o)}),n},[e,t]),[C,I]=y(()=>Bn(n,o,R)),_={buttonConfig:s,evaluateProp:d,pluginId:c,id:u},A=Hn({items:e,visibleIndices:R,index:C,setIndex:I,disabledButtons:l,instigator:r,setIsOpen:m,activateCtx:_,dispatch:v,viewportRef:P}),S=e=>{p.current?.contains(e.target)||a.current[i]?.contains(e.target)||m(!1)};f(()=>{if(!g)return;p.current?.focus(),I(Bn(n,o,R));const e=()=>m(!1);return document.addEventListener("focusin",S),document.addEventListener("pointerdown",S),window.addEventListener("resize",e),()=>{document.removeEventListener("focusin",S),document.removeEventListener("pointerdown",S),window.removeEventListener("resize",e)}},[g]);const{style:T,direction:M,halign:w}=(e=>{if(!e)return{style:{},direction:"below"};const t={};let n;e.top>=window.innerHeight/2?(t.bottom=window.innerHeight-e.top+"px",n="above"):(t.top=`${e.bottom}px`,n="below");const o=(e.left+e.right)/2;let r;return o>2*window.innerWidth/3?(t.right=window.innerWidth-e.right+"px",r="right"):o<window.innerWidth/3?(t.left=`${e.left}px`,r="left"):(t.left=`${o}px`,r="center"),{style:t,direction:n,halign:r}})(h);return{index:C,handleMenuKeyDown:A,handleItemClick:(e,t)=>{if(e.nativeEvent._fromKeyboardActivation||l.has(t.id))return;const{panelId:n,keepFocus:o}=Dn(t,s);if(n)return v({type:"OPEN_PANEL",payload:{panelId:n,props:{triggeringElement:r},...o&&{focusOnOpen:!1}}}),void m(!1);m(!1),On(e,t,_),o?Nn(r,P):P.current?.focus()},menuStyle:T,menuDirection:M,menuHAlign:w}},Fn=({item:e,isSelected:t,hiddenButtons:n,disabledButtons:o,pressedButtons:r,id:i,onItemClick:a})=>I("li",{id:`${i}-${ee(e.id)}`,className:"im-c-popup-menu__item"+(t?" im-c-popup-menu__item--selected":""),role:void 0!==e.isPressed||e.pressedWhen?"menuitemcheckbox":"menuitem","aria-disabled":o.has(e.id)||void 0,"aria-checked":void 0!==e.isPressed||e.pressedWhen?r.has(e.id):void 0,hidden:n.has(e.id),onClick:t=>a(t,e),children:[(e.iconId||e.iconSvgContent)&&C(ue,{id:e.iconId,svgContent:e.iconSvgContent}),C("span",{className:"im-c-popup-menu__item-label",children:e.label})]}),Vn=({popupMenuId:e,buttonId:t,instigatorId:n,pluginId:o,startPos:r,startIndex:i,menuRef:a,items:s,setIsOpen:l,buttonRect:c,isOpen:d=!0})=>{const{id:u}=S(),{buttonRefs:p,buttonConfig:f,hiddenButtons:m,disabledButtons:h,pressedButtons:g,layoutRefs:b}=Y(),y=t??n,v=p.current[y],E=Sn(),{index:R,handleMenuKeyDown:I,handleItemClick:_,menuStyle:A,menuDirection:T,menuHAlign:M}=zn({items:s,hiddenButtons:m,startIndex:i,startPos:r,instigator:v,instigatorKey:y,buttonRefs:p,buttonConfig:f,disabledButtons:h,pluginId:o,evaluateProp:E,id:u,menuRef:a,setIsOpen:l,buttonRect:c,isOpen:d});return P(C("ul",{ref:a,id:e,className:"im-c-popup-menu","data-direction":T,"data-halign":M,style:A,role:"menu",tabIndex:"-1",hidden:!d,"aria-labelledby":y,"aria-activedescendant":R>=0?`${u}-${ee(s[R].id)}`:void 0,onKeyDown:I,children:d&&s.map((e,t)=>C(Fn,{item:e,isSelected:R===t,hiddenButtons:m,disabledButtons:h,pressedButtons:g,id:u,onItemClick:_},e.id))}),b?.appContainerRef?.current??document.body)},Wn=(e,t,n)=>["im-c-map-button",e&&`im-c-map-button--${ee(e)}`,t&&`im-c-map-button--${t}`,n&&"im-c-map-button--with-label"].filter(Boolean).join(" "),Gn=(e,t)=>["im-c-button-wrapper",e&&`im-c-button-wrapper--${ee(e)}`,t&&"im-c-button-wrapper--wide"].filter(Boolean).join(" "),jn=e=>{" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),e.currentTarget.click())},Un=(e,t,n)=>{const o=e.current[t];o&&n(o.getBoundingClientRect().toJSON())},Kn=new Set(["menu","listbox","tree","grid","dialog"]),Zn=({buttonId:e,iconId:t,iconSvgContent:n,label:o,showLabel:r,isDisabled:i,isPressed:a,isExpanded:s,isBusy:l,isHidden:c,isPanelOpen:d,panelRole:u,variant:p,onClick:f,panelId:h,menuItems:b,idPrefix:v,href:E,ariaControls:P})=>{const{id:R}=S(),{buttonRefs:_}=Y(),[A,T]=y(!1),[M,w]=y(null),[k,x]=y(null),L=m(null),O=g(t=>{_.current&&e&&(_.current[e]=t)},[_,e]),B=E?"a":"button",D=b?.length>=1,N=t||n||D,$=((e,t)=>e?`${ee(t)}-button`:void 0)(h,e),H=(({idPrefix:e,panelId:t,buttonId:n,hasMenu:o,panelRole:r})=>t?{id:ae(e,t),type:"panel",role:r}:o?{id:`${e}-popup-${ee(n)}`,type:"popup",role:"menu"}:null)({idPrefix:v,panelId:h,buttonId:e,hasMenu:D,panelRole:u}),z=((e,t,n,o,r,i)=>a=>{e&&["ArrowDown","ArrowUp"].includes(a.key)&&(o("ArrowUp"===a.key?"last":"first"),Un(t,n,r),i(!0))})(D,_,e,w,x,T),F=(e=>t=>{e&&["ArrowDown","ArrowUp"].includes(t.key)&&t.preventDefault()})(D),V=(({appId:e,buttonId:t,className:n,onClick:o,onKeyUp:r,onKeyDown:i,setButtonRef:a,isDisabled:s,isPressed:l,isExpanded:c,isBusy:d,isPanelOpen:u,isPopupOpen:p,controlledElement:f,ariaControls:m,href:h})=>{let g;return"panel"===f?.type?g=String(u):"popup"===f?.type?g=p:"boolean"==typeof c&&(g=c),{id:`${e}-${ee(t)}`,className:n,onClick:o,onKeyUp:r,onKeyDown:i,ref:a,"aria-disabled":s||void 0,"aria-expanded":g,"aria-pressed":"boolean"==typeof l?l:void 0,"aria-busy":d||void 0,"aria-controls":f?.id??m,"aria-haspopup":Kn.has(f?.role)?f.role:void 0,...h?{href:h,target:"_blank",onKeyUp:jn,role:"button"}:{type:"button"}}})({appId:R,buttonId:e,className:Wn(e,p,r),onClick:t=>{if(!i){if("popup"===H?.type){const n=""===t.nativeEvent.pointerType;w(n?"first":null),A||Un(_,e,x),T(e=>!e)}f&&f(t)}},onKeyUp:z,onKeyDown:F,setButtonRef:O,isDisabled:i,isPressed:a,isExpanded:s,isBusy:l,isPanelOpen:d,isPopupOpen:A,controlledElement:H,ariaControls:P,href:E}),W=I(B,{...V,children:[N&&C(ue,{id:t,svgContent:n,isMenu:D}),r&&C("span",{children:o})]});return I("div",{className:Gn(e,r),"data-button-slot":$,hidden:c,children:[r?W:C(le,{content:o,children:W}),$&&C(Ln,{slot:$}),"popup"===H?.type&&C(Vn,{popupMenuId:H.id,buttonId:e,startPos:M,menuRef:L,items:b,setIsOpen:T,buttonRect:k,isOpen:A})]})},Yn=(e,t,n)=>e?n:t,qn=[{id:"panUp",verb:"up",dx:0,dy:-1,key:"ArrowUp"},{id:"panDown",verb:"down",dx:0,dy:1,key:"ArrowDown"},{id:"panLeft",verb:"left",dx:-1,dy:0,key:"ArrowLeft"},{id:"panRight",verb:"right",dx:1,dy:0,key:"ArrowRight"}],Xn=[{id:"nudgeZoomIn",label:"Zoom in",announceLabel:"Zoomed in",method:"zoomIn"},{id:"nudgeZoomOut",label:"Zoom out",announceLabel:"Zoomed out",method:"zoomOut"}],Qn={slot:"middle",open:!1,dismissible:!0,modal:!0},Jn={slot:"top-right",showLabel:!1},eo={slot:"right-top",showLabel:!1},to={slot:"right-bottom"},no={slot:"top-left",showLabel:!1,order:1},oo={slot:"actions",showLabel:!0},ro={slot:"actions",showLabel:!0,order:10},io={buttons:[{id:"journeyBack",label:({appConfig:e})=>e.backAndContinue?.backLabel,variant:"tertiary",onClick:(e,{appConfig:t,services:n})=>"mapOnly"===t.behaviour?globalThis.history.back():n.closeApp(),excludeWhen:({appConfig:e,appState:t})=>!e.backAndContinue?.backLabel||!t.isFullscreen||"mapOnly"===e.behaviour&&globalThis.history.length<=1,mobile:oo,tablet:oo,desktop:oo},{id:"journeyContinue",label:({appConfig:e})=>e.backAndContinue?.continueLabel,variant:"primary",onClick:(e,{services:t,pluginStates:n,mapState:o})=>t.eventBus.emit("app:continue",{pluginStates:n,mapState:o}),excludeWhen:({appConfig:e,appState:t})=>!e.backAndContinue?.continueLabel||!t.isFullscreen,mobile:ro,tablet:ro,desktop:ro},{id:"exit",label:"Close map view",iconId:"close",onClick:(e,{services:t})=>t.closeApp(),excludeWhen:({appConfig:e,appState:t})=>!e.hasExitButton||!t.isFullscreen,mobile:no,tablet:no,desktop:no},{id:"fullscreen",label:()=>(document.fullscreenElement?"Exit":"Enter")+" fullscreen",iconId:()=>document.fullscreenElement?"minimise":"maximise",onClick:(e,{appState:t})=>{const n=t.layoutRefs.appContainerRef.current;document.fullscreenElement?document.exitFullscreen():n.requestFullscreen()},excludeWhen:({appState:e,appConfig:t})=>!t.enableFullscreen||e.isFullscreen,mobile:Jn,tablet:Jn,desktop:Jn},{id:"zoomIn",group:{label:"Zoom controls",slotOrder:0},label:"Zoom in",iconId:"plus",keepFocus:!0,onClick:(e,{mapProvider:t,appConfig:n})=>t.zoomIn(n.zoomDelta),excludeWhen:({appState:e,appConfig:t})=>!t.enableZoomControls||t.enableMapControls||"touch"===e.interfaceType,enableWhen:({mapState:e})=>!e.isAtMaxZoom,mobile:eo,tablet:eo,desktop:eo},{id:"zoomOut",group:{label:"Zoom controls",slotOrder:0},label:"Zoom out",iconId:"minus",keepFocus:!0,onClick:(e,{mapProvider:t,appConfig:n})=>t.zoomOut(n.zoomDelta),excludeWhen:({appState:e,appConfig:t})=>!t.enableZoomControls||t.enableMapControls||"touch"===e.interfaceType,enableWhen:({mapState:e})=>!e.isAtMinZoom,mobile:eo,tablet:eo,desktop:eo},{id:"mapControls",label:"Map controls",iconId:"move",keepFocus:!0,isExpanded:!1,ariaControls:({appConfig:e})=>`${e.id}-map-controls-content`,onClick:(e,{appState:t})=>t.dispatch({type:"TOGGLE_BUTTON_EXPANDED",payload:{id:"mapControls",isExpanded:!t.expandedButtons.has("mapControls")}}),excludeWhen:({appConfig:e})=>!e.enableMapControls,mobile:Jn,tablet:Jn,desktop:Jn}],panels:[{id:"keyboardHelp",label:"Keyboard shortcuts",mobile:{...Qn},tablet:{...Qn,width:"500px"},desktop:{...Qn,width:"500px"},render:e=>C(ie,{context:e?.context})}],controls:[{id:"mapControls",label:"Move and zoom",excludeWhen:({appConfig:e})=>!e.enableMapControls,mobile:to,tablet:to,desktop:to,render:()=>{const{id:e,mapProvider:t,panDelta:n,nudgePanDelta:o,zoomDelta:r,nudgeZoomDelta:i}=S(),{dispatch:a,expandedButtons:s,nudgeStepSize:l,interfaceType:c,layoutRefs:d}=Y(),{isAtMaxZoom:u,isAtMinZoom:p}=ye(),{announce:m}=Ht(),h=s.has("mapControls"),g=`${e}-pan-up`;f(()=>{h&&document.getElementById(g)?.focus()},[h,g]);const b="large"===l,y=b?"Move":"Nudge",v=()=>{"keyboard"!==c&&requestAnimationFrame(()=>d.viewportRef.current?.focus())},E=(e,r,i,a=!1)=>{const s=!a&&b,l=s?"Move":"Nudge",c=t.activeMoveTarget;if(c){c.move(e,r,s);const t=c.label?`${c.label} `:"";return m(`${l}d ${t}${i}`),void v()}const d=Yn(s,o,n);t.panBy([e*d,r*d]),m(`${l}d ${i}`),v()},P=["im-c-map-controls",!h&&"im-c-map-controls--collapsed"].filter(Boolean).join(" "),R=I("div",{role:"group","aria-label":"Direction controls",className:"im-c-map-controls__directions",children:[qn.map(({id:e,verb:t,dx:n,dy:o})=>C(Zn,{buttonId:e,label:`${y} ${t}`,iconId:"chevron",onClick:()=>E(n,o,t)},e)),C(Zn,{buttonId:"nudgeStepToggle",label:I(_,{children:["Precision ",I("span",{"aria-hidden":"true",children:["(",b?"Off":"On",")"]})]}),iconId:b?"precision":"precision-active",isPressed:!b,onClick:()=>{a({type:"TOGGLE_NUDGE_STEP"}),m(b?"Precision on":"Precision off")}})]},"directions"),A=C("div",{role:"group","aria-label":"Zoom controls",className:"im-c-map-controls__zoom",children:Xn.map(({id:e,label:n,announceLabel:o,method:a})=>C(Zn,{buttonId:e,label:n,iconId:"zoomIn"===a?"plus":"minus",isDisabled:"zoomIn"===a?u:p,onClick:()=>((e,n)=>{const o=Yn(b,i,r);t[e](o),m(n),v()})(a,o)},e))},"zoom");return I("div",{id:`${e}-map-controls-content`,className:P,onKeyDown:e=>{const t=qn.find(({key:t})=>t===e.key);t&&(e.preventDefault(),E(t.dx,t.dy,t.verb,e.shiftKey))},"data-map-keyboard-scope":!0,children:[R,A]})}}],icons:[{id:"maximise",svgContent:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>'},{id:"minimise",svgContent:'<path d="m14 10 7-7"/><path d="M20 10h-6V4"/><path d="m3 21 7-7"/><path d="M4 14h6v6"/>'},{id:"plus",svgContent:'<path d="M5 12h14"/><path d="M12 5v14"/>'},{id:"minus",svgContent:'<path d="M5 12h14"/>'},{id:"chevron",svgContent:'<path d="m6 9 6 6 6-6"/>'},{id:"move",svgContent:'<path d="M11.146 15.854a1.207 1.207 0 0 1 1.708 0l1.56 1.56A2 2 0 0 1 15 18.828V21a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-2.172a2 2 0 0 1 .586-1.414z"/><path d="M18.828 15a2 2 0 0 1-1.414-.586l-1.56-1.56a1.207 1.207 0 0 1 0-1.708l1.56-1.56A2 2 0 0 1 18.828 9H21a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1z"/><path d="M6.586 14.414A2 2 0 0 1 5.172 15H3a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h2.172a2 2 0 0 1 1.414.586l1.56 1.56a1.207 1.207 0 0 1 0 1.708z"/><path d="M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2.172a2 2 0 0 1-.586 1.414l-1.56 1.56a1.207 1.207 0 0 1-1.708 0l-1.56-1.56A2 2 0 0 1 9 5.172z"/>'},{id:"precision",svgContent:'<circle cx="12" cy="12" r="10"/><line x1="22" x2="18" y1="12" y2="12"/><line x1="6" x2="2" y1="12" y2="12"/><line x1="12" x2="12" y1="6" y2="2"/><line x1="12" x2="12" y1="22" y2="18"/>'},{id:"precision-active",svgContent:'<circle cx="12" cy="12" r="10"/><line x1="22" x2="16" y1="12" y2="12"/><line x1="8" x2="2" y1="12" y2="12"/><line x1="12" x2="12" y1="8" y2="2"/><line x1="12" x2="12" y1="22" y2="16"/><circle cx="12" cy="12" r="1.5" fill="currentColor" stroke="none"/>'}]},ao={slot:"right-top",showLabel:!0},so={label:"Button",mobile:ao,tablet:ao,desktop:ao},lo={label:"Panel",focus:!0,mobile:{slot:"drawer",open:!0,dismissible:!0,modal:!1,showLabel:!0},tablet:{slot:"left-top",open:!0,dismissible:!0,modal:!1,showLabel:!0},desktop:{slot:"left-top",open:!0,dismissible:!0,modal:!1,showLabel:!0},render:null,html:null},co={label:"Control",mobile:{slot:"drawer"},tablet:{slot:"top-left"},desktop:{slot:"top-left"}},uo=e=>Array.isArray(e)?e:[e],po=["mobile","tablet","desktop"];function fo(e,t){const n=G[t];po.forEach(r=>{const i=e[r]?.slot;!i||n.includes(i)||"panel"===t&&i.endsWith("-button")||"control"===t&&i.endsWith("-panel")||o.warn(`${t} "${e.id}" has invalid slot "${i}" at breakpoint "${r}". Allowed slots: ${n.join(", ")}.`)})}function mo({registerButton:e,registerPanel:t,registerControl:n,registerKeyboardShortcut:o}){const r=[];return{registeredPlugins:r,registerPlugin:function(i){const{manifest:a}=i,s={pluginId:i.id};a.buttons&&uo(a.buttons).forEach(t=>{fo(t,"button"),e({[t.id]:{...s,...t}}),t?.menuItems?.forEach(t=>{e({[t.id]:{...s,...t,isMenuItem:!0}})})}),a.panels&&uo(a.panels).forEach(e=>{fo(e,"panel"),t({[e.id]:{...s,...e}})}),a.controls&&uo(a.controls).forEach(e=>{fo(e,"control"),n({[e.id]:{...s,...e}})}),a.icons&&uo(a.icons).forEach(e=>(e=>{ce={...ce,...e}})({[e.id]:e.svgContent})),a.keyboardShortcuts&&uo(a.keyboardShortcuts).forEach(e=>o({...s,shortcut:e})),r.push(i)},getPlugin:function(e){return r.find(t=>t.id===e)?._originalPlugin},clear:function(){r.length=0}}}const ho=()=>"undefined"!=typeof navigator&&/mac/i.test(navigator.userAgentData?.platform||navigator.platform||""),go=ho()?"<kbd>Option</kbd>":"<kbd>Alt</kbd>",bo=[{id:"showKeyboardHelp",title:"Show keyboard help",command:"<kbd>Shift</kbd> + <kbd>?</kbd>",context:"global",enabled:!0},{id:"getInfo",title:"Get current location and visible area",command:`${ho()?"<kbd>Option</kbd>":"<kbd>Ctrl</kbd>"} + <kbd>I</kbd>`,enabled:!0,visuallyHidden:!0,mapProviderAgnostic:!0,requiredConfig:["reverseGeocodeProvider"]},{id:"moveLarge",title:"Move in large steps",command:"<kbd>←</kbd>, <kbd>↑</kbd>, <kbd>→</kbd> or <kbd>↓</kbd>",enabled:!0},{id:"nudgeMap",title:"Nudge map",command:"<kbd>Shift</kbd> + <kbd>←</kbd>, <kbd>↑</kbd>, <kbd>→</kbd> or <kbd>↓</kbd>",enabled:!1},{id:"zoomLarge",title:"Zoom in large steps",command:"<kbd>+</kbd> or <kbd>-</kbd>",enabled:!0},{id:"nudgeZoom",title:"Nudge zoom",command:"<kbd>Shift</kbd> + <kbd>+</kbd> or <kbd>-</kbd>",enabled:!1},{id:"highlightLabelAtCenter",title:"Highlight label at centre",command:`${go} + <kbd>Enter</kbd>`,enabled:!1,requiredConfig:["readMapText"]},{id:"highlightNextLabel",title:"Highlight nearby label",command:`${go} + <kbd>→</kbd>, <kbd>←</kbd>, <kbd>↑</kbd> or <kbd>↓</kbd>`,enabled:!1,requiredConfig:["readMapText"]}];function yo(){const e={pluginShortcutHelp:[],pluginShortcutIds:new Set,providerSupportedIds:new Set};return{registerKeyboardShortcut:t=>((e,{shortcut:t})=>{const{pluginShortcutHelp:n,pluginShortcutIds:o}=e;o.has(t.id)?n[n.findIndex(e=>e.id===t.id)]=t:(o.add(t.id),n.push(t))})(e,t),setProviderSupportedShortcuts:t=>((e,t=[])=>{e.providerSupportedIds=new Set(t)})(e,t),getKeyboardShortcuts:t=>((e,t={})=>[...bo.filter(n=>!(!n.mapProviderAgnostic&&!e.providerSupportedIds.has(n.id))&&(!n.requiredConfig||n.requiredConfig.every(e=>t[e]))),...e.pluginShortcutHelp])(e,t)}}function vo(e={},t={}){const n=(e=[],t=[])=>{Array.isArray(e)||(e=[]),Array.isArray(t)||(t=[]);const n=new Map(e.map(e=>[e.id,e]));return t.forEach(e=>{e?.id&&(n.has(e.id)?n.set(e.id,{...n.get(e.id),...e}):n.set(e.id,e))}),Array.from(n.values())},o={...e,...t};return(e.buttons||t.buttons)&&(o.buttons=n(e.buttons,t.buttons)),(e.panels||t.panels)&&(o.panels=n(e.panels,t.panels)),(e.controls||t.controls)&&(o.controls=n(e.controls,t.controls)),(e.icons||t.icons)&&(o.icons=n(e.icons,t.icons)),o}const Eo=()=>{const{id:e}=S(),{dispatch:t,hiddenButtons:o,disabledButtons:r,pressedButtons:i,expandedButtons:a,openPanels:s,layoutRefs:l,interfaceType:c}=Y(),{eventBus:d}=Ht(),u=m(t),p=m(null);u.current=t,p.current={hiddenButtons:o,disabledButtons:r,pressedButtons:i,expandedButtons:a,appId:e,openPanels:s,layoutRefs:l,interfaceType:c},f(()=>{const e=((e,t)=>[[n.APP_OPENED,()=>e.current({type:"TOGGLE_APP_VISIBLE",payload:!0})],[n.APP_CLOSED,()=>e.current({type:"TOGGLE_APP_VISIBLE",payload:!1})],[n.APP_ADD_BUTTON,({id:t,config:n})=>{e.current({type:"ADD_BUTTON",payload:{id:t,config:n}}),Array.isArray(n.menuItems)&&n.menuItems.forEach(t=>{e.current({type:"ADD_BUTTON",payload:{id:t.id,config:{...t,isMenuItem:!0}}})})}],[n.APP_TOGGLE_BUTTON_STATE,({id:n,prop:o,value:r})=>{const{hiddenButtons:i,disabledButtons:a,pressedButtons:s,expandedButtons:l}=t.current;switch(o){case"hidden":{const t="boolean"==typeof r?r:!i.has(n);e.current({type:"TOGGLE_BUTTON_HIDDEN",payload:{id:n,isHidden:t}});break}case"disabled":{const t="boolean"==typeof r?r:!a.has(n);e.current({type:"TOGGLE_BUTTON_DISABLED",payload:{id:n,isDisabled:t}});break}case"pressed":{const t="boolean"==typeof r?r:!s.has(n);e.current({type:"TOGGLE_BUTTON_PRESSED",payload:{id:n,isPressed:t}});break}case"expanded":{const t="boolean"==typeof r?r:!l.has(n);e.current({type:"TOGGLE_BUTTON_EXPANDED",payload:{id:n,isExpanded:t}});break}}}],[n.APP_ADD_PANEL,({id:t,config:n})=>e.current({type:"ADD_PANEL",payload:{id:t,config:n}})],[n.APP_REMOVE_PANEL,t=>e.current({type:"REMOVE_PANEL",payload:t})],[n.APP_SHOW_PANEL,({id:t,focus:n=!0,triggeringElement:o})=>e.current({type:"OPEN_PANEL",payload:{panelId:t,focusOnOpen:n,props:o?{triggeringElement:o}:void 0}})],[n.APP_HIDE_PANEL,n=>{const{appId:o,openPanels:r,layoutRefs:i,interfaceType:a}=t.current,s=document.getElementById(ae(o,n));s?.contains(document.activeElement)&&rn({triggeringElement:r[n]?.props?.triggeringElement,viewportRef:i.viewportRef,interfaceType:a}),e.current({type:"CLOSE_PANEL",payload:n})}],[n.APP_ADD_CONTROL,({id:t,config:n})=>e.current({type:"ADD_CONTROL",payload:{id:t,config:n}})],[n.APP_SET_APPLICATION_MODE,({id:t,include:n,exclude:o})=>e.current({type:"SET_APPLICATION_MODE",payload:{id:t,include:n,exclude:o}})],[n.APP_CLEAR_APPLICATION_MODE,t=>e.current({type:"CLEAR_APPLICATION_MODE",payload:t})]])(u,p);return e.forEach(([e,t])=>d.on(e,t)),()=>{e.forEach(([e,t])=>d.off(e,t))}},[d])};function Po(e){const t=Y(),{pluginRegistry:n}=S(),o=u(zt);E(()=>{if(!t?.dispatch||!o)return;const{dispatch:r}=t;let i=0;const a=e=>{i++,r(e)};n.registeredPlugins.forEach(n=>{(n?.manifest?.buttons??[]).flatMap(e=>[e,...e.menuItems??[]]).forEach(o=>function({btn:e,pluginId:t,appState:n,dispatch:o,evaluateProp:r}){[{prop:"enableWhen",state:n.disabledButtons,action:"TOGGLE_BUTTON_DISABLED",invert:!0,key:"isDisabled"},{prop:"hiddenWhen",state:n.hiddenButtons,action:"TOGGLE_BUTTON_HIDDEN",key:"isHidden"},{prop:"pressedWhen",state:n.pressedButtons,action:"TOGGLE_BUTTON_PRESSED",key:"isPressed"},{prop:"expandedWhen",state:n.expandedButtons,action:"TOGGLE_BUTTON_EXPANDED",key:"isExpanded"}].forEach(({prop:n,state:i,action:a,key:s,invert:l})=>{if("function"==typeof e[n])try{const c=r(e[n],t),d=l?!c:c;i.has(e.id)!==d&&o({type:a,payload:{id:e.id,[s]:d}})}catch(t){console.warn(`${n} error for button ${e.id}:`,t)}})}({btn:o,pluginId:n.id,appState:t,dispatch:a,evaluateProp:e}))}),0!==i||t.arePluginsEvaluated||r({type:"PLUGINS_EVALUATED"})},[t,o,e])}const Ro=({plugin:e})=>{const t=function(e){const t=m(null),n=S(),o=Y(),r=ye(),i=Ht(),a=Vt(e);return f(()=>{t.current={appConfig:n,appState:o,mapState:r,services:i,mapProvider:n.mapProvider,pluginState:a}}),t}(e.id);f(()=>{e.api&&e._originalPlugin&&Object.entries(e.api).forEach(([n,o])=>{e._originalPlugin[n]=function(e,{pluginId:t,pluginConfig:n,stateRef:o}){return(...r)=>{const i=o.current;if(!i)throw new Error(`Plugin API "${t}" called before state is initialized`);return e({...i,pluginConfig:n,pluginId:t},...r)}}(o,{pluginId:e.id,pluginConfig:e?.config||{},stateRef:t})})},[e,t]);const{InitComponent:n}=e,o=b(()=>{const{api:t,...n}=e?.config||{};return n},[e]);if(!n)return null;const r=Gt(n);return C(r,{pluginId:e.id,pluginConfig:o})},Co=()=>{const{pluginRegistry:e}=S();Eo(),(()=>{const{eventBus:e,hints:t}=Ht(),{layoutRefs:o}=Y(),r=m(!1);f(()=>{const o=({text:e,options:n}={})=>{e&&t.show(e,n)},r=()=>t.dismiss();return e.on(n.APP_SHOW_HINT,o),e.on(n.APP_DISMISS_HINT,r),()=>{e.off(n.APP_SHOW_HINT,o),e.off(n.APP_DISMISS_HINT,r)}},[e,t]),f(()=>t.subscribe(e=>{r.current=Boolean(e)}),[t]),f(()=>{const e=e=>{if("Escape"!==e.key||!r.current)return;const n=o.appContainerRef?.current;n&&!n.contains(e.target)||t.dismiss()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,o])})();const t=Sn();return Po(t),function(){const e=S()?.backAndContinue,{dispatch:t}=Y(),n=ye(),o=u(zt),r=m(!0);E(()=>{if("function"!=typeof e?.continueEnabledWhen)return;let i=!1;try{i=e.continueEnabledWhen({pluginStates:o?.state??{},mapState:n})}catch(e){console.warn("continueEnabledWhen error:",e)}const a=!i;r.current!==a&&(r.current=a,t({type:"TOGGLE_BUTTON_DISABLED",payload:{id:"journeyContinue",isDisabled:a}}))},[e,o,n,t])}(),C(_,{children:e.registeredPlugins.map((e,n)=>C(Ro,{plugin:e,evaluateProp:t},`init-${e.id}-${n}`))})},Io=(e,t,n)=>{const o=(e,t)=>e[0]===t[0]&&e[1]===t[1],r=t.filter(t=>{const r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]);let a=!1;return a="ArrowUp"===n?t[1]<=e[1]&&i>=r:"ArrowDown"===n?t[1]>e[1]&&i>=r:"ArrowLeft"===n?t[0]<=e[0]&&i<r:"ArrowRight"!==n||t[0]>e[0]&&i<r,a&&!o(t,e)});r.length||r.push(e);const i=t=>Math.hypot(e[0]-t[0],e[1]-t[1]),a=r.reduce((e,t)=>i(t)<i(e)?t:e,r[0]);return t.findIndex(e=>o(e,a))};const _o=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter"]),Ao=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]),So=(e,t)=>{if(!t)return null;const n=e.filter(e=>null!=e.x&&null!=e.y);if(!n.length)return null;const o=n.map(e=>[e.x,e.y]);return n[Io([t.x,t.y],o,void 0)].id},To=(e,t,n,o)=>{const r=e.find(e=>n.includes(e.id));return r?r.id:t&&e.some(e=>e.id===t)?t:So(e,o)??e[0].id},Mo=(e,t,n)=>{const o=Array.from(e?.children??[]).find(e=>e.dataset.id===String(t));o&&(n.current=!0,o.focus({preventScroll:!0}),n.current=!1)};function wo({spatialListRef:e,viewportRef:t,items:o,eventBus:r,activeItemIdRef:i,lastActiveIdRef:a,setActiveItemId:s,isInternalFocusMoveRef:l,hints:c,currentHintRef:d}){f(()=>{const u=e.current;if(!u)return;const p=e=>{a.current=e,s(e),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:e}),Mo(u,e,l)},f=e=>{p(function(e,t,n){const o=e.filter(e=>null!=e.x&&null!=e.y);if(!o.length)return t;const r=o.map(e=>[e.x,e.y]),i=o.findIndex(e=>e.id===t),a=-1===i?r[0]:r[i],s=Io(a,r,n);return o[s]?.id??t}(o,i.current,e.key))},m=e=>{"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),d.current?c.dismiss():t.current?.focus()):e.altKey&&Ao.has(e.key)?(e.preventDefault(),e.stopPropagation(),f(e)):"ArrowDown"===e.key||"ArrowUp"===e.key||"Home"===e.key||"End"===e.key?(e.preventDefault(),e.stopPropagation(),p(((e,t,n)=>{if(!n.length)return e;if("Home"===t)return n[0].id;if("End"===t)return n[n.length-1].id;const o=n.findIndex(t=>t.id===e);return"ArrowDown"===t?-1===o?n[0].id:n[Math.min(o+1,n.length-1)].id:-1===o?n[n.length-1].id:n[Math.max(o-1,0)].id})(i.current,e.key,o))):"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),r?.emit(n.MAP_SELECT_ITEM))},h=e=>{(e=>{e.altKey&&_o.has(e.key)&&e.stopPropagation()})(e)};return u.addEventListener("keydown",m),u.addEventListener("keyup",h),()=>{u.removeEventListener("keydown",m),u.removeEventListener("keyup",h)}},[t,e,o,r])}function ko({viewportRef:e,spatialListRef:t,items:o=[],eventBus:r,hints:i,centerScreenPoint:a}){const[s,l]=y(null),[c,d]=y([]),u=m(!1),p=m(null),h=m(null),g=m([]),b=m(null),v=m(!1);f(()=>i.subscribe(e=>{b.current=e}),[i]),h.current=s,g.current=c,function({eventBus:e,lastActiveIdRef:t,setActiveItemId:o,setSelectedIds:r}){f(()=>{if(!e)return;const i=({id:e})=>{null!==e&&(t.current=e),o(e)},a=({selectedFeatures:e=[],selectedMarkers:t=[]})=>{r([...e.map(e=>String(e.featureId)),...t])};return e.on(n.MAP_SET_ACTIVE_ITEM,i),e.on("interact:selectionchange",a),()=>{e.off(n.MAP_SET_ACTIVE_ITEM,i),e.off("interact:selectionchange",a)}},[e])}({eventBus:r,lastActiveIdRef:p,setActiveItemId:l,setSelectedIds:d}),function({items:e,eventBus:t,isFocusedRef:o,spatialListRef:r,isInternalFocusMoveRef:i,lastActiveIdRef:a,activeItemIdRef:s,selectedIdsRef:l,setActiveItemId:c,centerScreenPoint:d}){f(()=>{if(!o.current)return;if(!e.length)return c(null),void t?.emit(n.MAP_SET_ACTIVE_ITEM,{id:null});if(e.some(e=>e.id===s.current))return;const u=To(e,a.current,l.current,d);a.current=u,c(u),t?.emit(n.MAP_SET_ACTIVE_ITEM,{id:u}),Mo(r.current,u,i)},[e])}({items:o,eventBus:r,isFocusedRef:u,spatialListRef:t,isInternalFocusMoveRef:v,lastActiveIdRef:p,activeItemIdRef:h,selectedIdsRef:g,setActiveItemId:l,centerScreenPoint:a}),wo({spatialListRef:t,viewportRef:e,items:o,eventBus:r,activeItemIdRef:h,lastActiveIdRef:p,setActiveItemId:l,isInternalFocusMoveRef:v,hints:i,currentHintRef:b}),function({viewportRef:e,spatialListRef:t,isFocusedRef:n}){f(()=>{const o=e.current;if(!o)return;const r=o=>{n.current&&!t.current?.contains(o.target)&&e.current?.focus()};return o.addEventListener("pointerdown",r),()=>{o.removeEventListener("pointerdown",r)}},[e,t])}({viewportRef:e,spatialListRef:t,isFocusedRef:u});let E=null;if(o.length){E=p.current&&o.some(e=>e.id===p.current)?p.current:So(o,a)??o[0].id}return{activeItemId:s,tabbableId:E,selectedIds:c,onFocus:()=>{if(u.current=!0,v.current)return;if(!o.length)return;const e=To(o,p.current,c,a);p.current=e,l(e),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:e}),Mo(t.current,e,v)},onBlur:()=>{v.current||(u.current=!1,l(null),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:null}))},selectItem:e=>{p.current=e,l(e),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:e}),Mo(t.current,e,v),r?.emit(n.MAP_SELECT_ITEM)}}}const xo="map:setspatiallist",Lo="map:setspatiallistsuppressed";const Oo=({id:e,center:t,zoom:n,bounds:o,urlPosition:r="sync"},i=window.location.search)=>{const a="none"===r?null:((e,t)=>{const n=new URLSearchParams(t),o=n.get(`${e}:center`),r=n.get(`${e}:zoom`);if(!o||!r)return null;const[i,a]=o.split(",").map(Number);return{center:[i,a],zoom:Number(r)}})(e,i);return a?{center:a.center,zoom:a.zoom}:o?{bounds:o}:{center:t,zoom:n}};function Bo(){const{id:e,urlPosition:t}=S(),{eventBus:o}=Ht();f(()=>{if(!e||"sync"!==t)return;const r=({current:t})=>{((e,t,n=window.location.href)=>{const o=new URL(n||"http://localhost"),r=new Set,i=[];if(t.center){const n=`${e}:center`;r.add(n),i.push(`${n}=${t.center[0]},${t.center[1]}`)}if(null!=t.zoom){const n=`${e}:zoom`;r.add(n),i.push(`${n}=${t.zoom}`)}const a=[];o.searchParams.forEach((e,t)=>{r.has(t)||a.push(`${t}=${e}`)});const s=[...a,...i].join("&"),l=s?"?"+s:"",c=`${o.origin}${o.pathname}${l}${o.hash}`;window.history.replaceState(window.history.state,"",c)})(e,{center:t.center,zoom:t.zoom})};return o.on(n.MAP_STATE_UPDATED,r),()=>o.off(n.MAP_STATE_UPDATED,r)},[e,t])}const Do=({direction:e})=>`Map moved ${e}.`,No=({from:e,to:t,areaDimensions:n,isAtMaxZoom:o,isAtMinZoom:r})=>`Map zoomed ${t>e?"in":"out"}${o?" (Maximum zoom)":""}${r?" (Minimum zoom)":""}. New area approximately ${n}.`,$o=({areaDimensions:e,isAtMaxZoom:t,isAtMinZoom:n})=>`New area approximately ${e}${t?" (Maximum zoom)":""}${n?" (Minimum zoom)":""}.`,Ho=({isAtMaxZoom:e,isAtMinZoom:t})=>`No change, ${e?"maximum zoom reached":""}${t?"minimum zoom reached":""}.`;function zo(){const{mapProvider:e}=S(),{eventBus:t,announce:o,mapFocus:r}=Ht();f(()=>{const i=({previous:t,current:n})=>{if(!t?.center||!n?.center)return;if(r.isHoldingAnnouncements())return;const i=((e,t,n)=>{const o=e.zoom!==t.zoom,r=e.center[0]!==t.center[0]||e.center[1]!==t.center[1],i=n.getAreaDimensions();if(r&&!o){const o=n.getCardinalMove(e.center,t.center);return Do({direction:o,areaDimensions:i})}return!r&&o?No({...t,from:e.zoom,to:t.zoom,areaDimensions:i}):r||o?$o({...t,areaDimensions:i}):Ho({...t})})(t,n,e);i&&o(i,"action")};return t.on(n.MAP_STATE_UPDATED,i),()=>{t.off(n.MAP_STATE_UPDATED,i)}},[e,o,r])}const Fo=e=>{if(!e?.current)return{offsetWidth:0,offsetHeight:0};const t=e.current.firstElementChild;return t?.classList.contains("im-c-panel")&&0!==t.offsetWidth&&0!==t.offsetHeight?{offsetWidth:t.offsetWidth,offsetHeight:t.offsetHeight}:{offsetWidth:0,offsetHeight:0}},Vo=e=>{const t=e?.current?.querySelector(".im-c-button-group");return t?t.offsetWidth:0},Wo=(e,t,n,o,r)=>e.offsetHeight+t.offsetHeight+(e.offsetHeight>0&&t.offsetHeight>0?r:0)>n?o+Math.max(e.offsetWidth,t.offsetWidth)+r:0,Go=(e,t,n,o,r)=>e.offsetWidth+t.offsetWidth+(e.offsetWidth>0&&t.offsetWidth>0?r:0)>n?o+Math.max(e.offsetHeight,t.offsetHeight)+r:0,jo=({mainRef:e,leftRef:t,rightRef:n,actionsRef:o,bottomRef:r,leftTopRef:i,leftBottomRef:a,rightTopRef:s,rightBottomRef:l})=>{if([e,t,n,o,r].some(e=>!e?.current))return;const c=e.current,d=t.current,u=o.current,p=r.current,f=Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue("--divider-gap"),10),m=Fo(i),h=Fo(a),g=Fo(s),b=Fo(l),y=Math.max(Vo(t),Vo(n)),v=c.offsetLeft+d.offsetLeft+y+f,E=d.offsetLeft+y+f,P=d.offsetTop,R=c.offsetHeight-p.offsetTop-p.offsetHeight,C=Math.max(R,c.offsetHeight-p.offsetTop+f),I=Math.max(c.offsetHeight-u.offsetTop+f,C),_=c.offsetHeight-P-I,A=c.offsetWidth-(v-c.offsetLeft)-E,S=Wo(m,h,_/2,c.offsetLeft+d.offsetLeft,f),T=Wo(g,b,_/2,d.offsetLeft,f),M=Go(m,g,A/2,P,f),w=Go(h,b,A/2,C,f),k=c.offsetWidth-2*f,x=c.offsetHeight-2*f,L=c.offsetLeft+2*k/3,O=2*k/3,B=2*x/3;return{left:Math.max(v,Math.min(S,L)),right:Math.max(E,Math.min(T,O)),top:Math.max(P,Math.min(M,B)),bottom:Math.max(I,Math.min(w,B))}},Uo=".im-c-panel--banner",Ko=e=>e?.current?.offsetHeight??0,Zo=e=>e?.current?.offsetWidth??0,Yo=e=>!e.hidden&&(e.getClientRects().length>0||e.classList.contains("im-c-control-wrapper")&&Array.from(e.children).some(Yo)),qo=e=>{const t=Array.from(e.children);return t.length>0&&!t.some(Yo)?0:e.offsetHeight},Xo=(e,t,n)=>e-(t?t+n:0);function Qo({appContainer:e,root:t,top:n,bannerRef:o,leftRef:r,rightRef:i,isMobile:a,dividerGap:s,primaryGap:l}){const c=o?.current;var d;a&&(d=c,d?.querySelectorAll(Uo).forEach(e=>{e.style.width=""}));const u=Ko(o),p=u>0,f=(m=Zo(r),h=Zo(i),m||h?Math.max(m,h):0);var m,h;const g=Number.parseInt(getComputedStyle(t).getPropertyValue("--banner-preferred-width"),10),b=(e=>{const t=Array.from(e?.querySelectorAll(Uo)??[]).map(e=>Number.parseInt(e.style.width,10)).filter(e=>!Number.isNaN(e));return t.length?Math.max(...t):null})(c)??g;e.style.setProperty("--banner-preferred-width",`${b}px`);const y=n.offsetWidth-2*f-2*s;const v=!a&&((e,t)=>e>=t)(y,b);c?.classList.toggle("im-o-app__banner--docked",v);const E=`${((e,t,n,o)=>e?t+n+o:t)(v,l,f,s)}px`;e.style.setProperty("--banner-left",E),e.style.setProperty("--banner-right",E);const P=p&&!v,R=p?n.offsetTop+n.offsetHeight:0;return e.style.setProperty("--banner-top",`${R}px`),{isBannerStacked:P,bannerTop:R,bannerHeight:u}}function Jo({appContainer:e,bottom:t,attributions:n,dividerGap:o,primaryGap:r}){const i=t.children[1],a=(e=>{const t=e?.firstElementChild;if(!t)return 0;const n=t.style.whiteSpace;t.style.whiteSpace="nowrap";const o=t.scrollWidth;return t.style.whiteSpace=n,o})(n)>(i?.offsetWidth??0);n.classList.toggle("im-o-app__attributions--stacked",a);const s=i?Math.round(i.getBoundingClientRect().left-t.getBoundingClientRect().left):0;e.style.setProperty("--attributions-left",`${s}px`);const l=((e,t,n)=>Math.max(0,e+t-n))(n.offsetHeight,o,r);return e.style.setProperty("--bottom-right-clearance",`${((e,t)=>e?0:t)(a,l)}px`),{rise:l}}function er(e,t){const{appContainerRef:n,mainRef:o,topRef:r,topLeftColRef:i,topRightColRef:a,bottomRef:s,attributionsRef:l,bottomRightRef:c,leftTopRef:d,leftBottomRef:u,rightTopRef:p,rightBottomRef:f,actionsRef:m,bannerRef:h,leftRef:g,rightRef:b}=e,y=n.current,v=o.current,E=r.current,P=i.current,R=a.current,C=s.current,I=l.current;if([v,E,C].some(e=>!e))return;const _=document.documentElement,A=Number.parseInt(getComputedStyle(_).getPropertyValue("--divider-gap"),10),S=Number.parseInt(getComputedStyle(_).getPropertyValue("--primary-gap"),10),T="mobile"===t,{isBannerStacked:M,bannerTop:w,bannerHeight:k}=Qo({appContainer:y,root:_,top:E,bannerRef:h,leftRef:g,rightRef:b,isMobile:T,dividerGap:A,primaryGap:S}),x=e=>M?w+k+A:e+E.offsetTop,{rise:L}=Jo({appContainer:y,bottom:C,attributions:I,dividerGap:A,primaryGap:S}),O=x(qo(P)),B=C.offsetTop-O-A;y.style.setProperty("--left-offset-top",`${O}px`),y.style.setProperty("--left-offset-bottom",`${v.offsetHeight-C.offsetTop+A}px`),y.style.setProperty("--left-top-max-height",`${B}px`);const D=Ko(c),N=v.offsetHeight-C.offsetTop-C.offsetHeight,$=x(qo(R)),H=C.offsetTop+C.offsetHeight-D-L-$-A;y.style.setProperty("--right-offset-top",`${$}px`),y.style.setProperty("--right-offset-bottom",`${((e,t,n,o,r)=>e+(t>0?t+o+r:n))(N,D,I.offsetHeight,L,A)}px`),y.style.setProperty("--right-top-max-height",`${H}px`),y.style.setProperty("--hint-bottom",`${((e,t,n,o)=>{const r=e.offsetHeight-t.offsetTop+o,i=(n?.offsetHeight??0)>0?e.offsetHeight-n.offsetTop:0;return Math.max(r,i+o)})(v,C,m?.current,A)}px`),y.style.setProperty("--left-top-panel-max-height",`${Xo(B,Ko(u),A)}px`),y.style.setProperty("--left-bottom-panel-max-height",`${Xo(B,Ko(d),A)}px`),y.style.setProperty("--right-top-panel-max-height",`${Xo(H,Ko(f),A)}px`),y.style.setProperty("--right-bottom-panel-max-height",`${Xo(H,Ko(p),A)}px`)}const tr=(e,t)=>Object.entries(e).reduce((e,[n,o])=>(e[n]=Math.round(o/t),e),{}),nr=e=>"Feature"===e.type?nr(e.geometry):"Point"===e.type?e.coordinates:"MultiPoint"===e.type?e.coordinates[0]:null,or=({mapContainerRef:e})=>{const t=S(),{id:o,mapProvider:r}=t,{safeZoneInset:i,breakpoint:a,isLayoutReady:s,syncMapPadding:l}=Y(),{isMapReady:c,mapStyle:d,mapSize:u,center:p,zoom:h,bounds:g}=ye(),b=m(!1),y=Oo({id:o,center:p,zoom:h,bounds:g,urlPosition:t.urlPosition});return f(()=>{if(i&&s&&d&&u&&!b.current)return requestAnimationFrame(()=>{r.initMap({...t,pixelRatio:window.devicePixelRatio*he[u],container:e.current,padding:i,center:y.center,zoom:y.zoom,bounds:y.bounds,mapStyle:d,mapSize:u})}),b.current=!0,()=>{}},[i,s,d,u]),function(){const{mapProvider:e}=S(),{dispatch:t}=ye(),{eventBus:o}=Ht(),r=m(null),i=m(!1);f(()=>{if(!e)return;const a=e=>{t({type:"MAP_MOVE",payload:e})},s=e=>{t({type:"MAP_MOVE_END",payload:e}),o.emit(n.MAP_STATE_UPDATED,{previous:r.current,current:e}),r.current=e},l=n=>{i.current||(r.current={center:e.getCenter(),zoom:e.getZoom()},i.current=!0),t({type:"MAP_FIRST_IDLE",payload:n})};return o.on(n.MAP_MOVE,a),o.on(n.MAP_MOVE_END,s),o.on(n.MAP_FIRST_IDLE,l),()=>{o.off(n.MAP_MOVE,a),o.off(n.MAP_MOVE_END,s),o.off(n.MAP_FIRST_IDLE,l)}},[e,t])}(),Bo(),zo(),(()=>{const{mapProvider:e,eventBus:t}=S(),{dispatch:o,layoutRefs:r,breakpoint:i}=Y(),{mapSize:a}=ye(),s=m(a);s.current=a;const l=m(i);l.current=i;const c=()=>{er(r,l.current);const t=jo(r),n=tr(t,he[s.current]);"function"==typeof o&&o({type:"SET_SAFE_ZONE_INSET",payload:{safeZoneInset:t,syncMapPadding:!1}}),"function"==typeof e.setPadding&&e.setPadding(n)};f(()=>{if(!e)return;const t=e.fitToBounds;e.fitToBounds=(n,o=!1)=>{if(n)return o?t.call(e,n):void requestAnimationFrame(()=>{c(),t.call(e,n)})};const n=e.setView;return e.setView=({center:t,zoom:o})=>{t&&requestAnimationFrame(()=>{c(),n.call(e,{center:t,zoom:o})})},()=>{e.fitToBounds=t,e.setView=n}},[e,o,r,a]),f(()=>{if(!e||!t)return;const o=t=>e.fitToBounds(t),r=t=>e.setView(t);return t.on(n.MAP_FIT_TO_BOUNDS,o),t.on(n.MAP_SET_VIEW,r),()=>{t.off(n.MAP_FIT_TO_BOUNDS,o),t.off(n.MAP_SET_VIEW,r)}},[e,t])})(),(()=>{const{id:e,mapProvider:t,eventBus:o}=S(),{layoutRefs:r,panelConfig:i,panelRegistry:a,breakpoint:s}=Y(),l=m({layoutRefs:r,panelConfig:i,panelRegistry:a,breakpoint:s});l.current={layoutRefs:r,panelConfig:i,panelRegistry:a,breakpoint:s},f(()=>{if(!t||!o)return;const i=({panelId:n,visibleGeometry:o})=>{const{panelConfig:i,panelRegistry:a}=l.current,s=i?.[n]?i:a?.getPanelConfig()??i,c=o??s?.[n]?.visibleGeometry,d=r.appContainerRef.current?.querySelector(`#${e}-panel-${n}`);if(!c)return;if("function"!=typeof t.isGeometryObscured)return;const u=()=>{if(!d)return;const e=d.getBoundingClientRect();if(e&&0!==e.width&&0!==e.height){if(t.isGeometryObscured(c,e))if((e=>{const t=(e=>e?"Feature"===e.type?e.geometry?.type:e.type:null)(e);return"Point"===t||"MultiPoint"===t})(c)){const e=nr(c);e&&t.setView({center:e})}else t.fitToBounds(c)}else requestAnimationFrame(u)};requestAnimationFrame(u)};return o.on(n.APP_PANEL_OPENED,i),()=>{o.off(n.APP_PANEL_OPENED,i)}},[t,o])})(),f(()=>{c&&l&&r.setPadding(tr(i,he[u]))},[c,u,a,i]),null};const rr=ho()?"Alt":"Ctrl",ir={keydown:{ArrowUp:"panUp",ArrowDown:"panDown",ArrowLeft:"panLeft",ArrowRight:"panRight","+":"zoomIn","=":"zoomIn","-":"zoomOut",_:"zoomOut"},keyup:{"?":"showKeyboardControls","Alt+ArrowRight":"highlightNextLabel","Alt+ArrowLeft":"highlightNextLabel","Alt+ArrowUp":"highlightNextLabel","Alt+ArrowDown":"highlightNextLabel","Alt+Enter":"highlightLabelAtCenter",[`${rr}+i`]:"getInfo",[`${rr}+I`]:"getInfo",Escape:"clearSelection"}},ar=e=>{let t;return t=/^Key[A-Z]$/.test(e.code)?e.code.slice(3):e.key,"Add"===t||"NumpadAdd"===t?t="+":"Subtract"!==t&&"NumpadSubtract"!==t||(t="-"),e.altKey?`Alt+${t}`:e.ctrlKey?`Ctrl+${t}`:t},sr=(e,t,n)=>{const o=ir[t][n];return o&&e[o]?o:null};function lr(e){const{mapProvider:t,panDelta:n,nudgePanDelta:r,zoomDelta:a,nudgeZoomDelta:s,readMapText:c}=S(),{dispatch:d,layoutRefs:u}=Y(),{announce:p}=Ht();f(()=>{const f=e.current,m=u.appContainerRef?.current;if(!f||!m)return;const h=((e,t,{containerRef:n,dispatch:r,panDelta:a,nudgePanDelta:s,zoomDelta:c,nudgeZoomDelta:d,readMapText:u})=>{const p=e=>Yn(!e,s,a),f=e=>Yn(!e,d,c);return{showKeyboardControls:e=>{const t=e.target===n.current?"viewport":"listbox";r({type:"OPEN_PANEL",payload:{panelId:"keyboardHelp",props:{triggeringElement:e.target,context:t}}})},panUp:t=>e.panBy([0,-p(t.shiftKey)]),panDown:t=>e.panBy([0,p(t.shiftKey)]),panLeft:t=>e.panBy([-p(t.shiftKey),0]),panRight:t=>e.panBy([p(t.shiftKey),0]),zoomIn:t=>e.zoomIn(f(t.shiftKey)),zoomOut:t=>e.zoomOut(f(t.shiftKey)),getInfo:async n=>{if(!l())return void o.warn("Alt+I pressed but reverseGeocode has not been configured");const r=e.getCenter(),a=await i(e.getZoom(),r),s=e.getAreaDimensions?.();t(s?`${a}. Covering ${s}.`:`${a}.`,"action")},highlightNextLabel:n=>{if(!u||!e.highlightNextLabel)return;const o=e.highlightNextLabel(n.key);t(o,"action")},highlightLabelAtCenter:()=>{if(!u||!e.highlightLabelAtCenter)return;const n=e.highlightLabelAtCenter();t(n,"action")},clearSelection:()=>e?.clearHighlightedLabel?.()}})(t,p,{containerRef:e,dispatch:d,panDelta:n,nudgePanDelta:r,zoomDelta:a,nudgeZoomDelta:s,readMapText:c}),{handleKeyDown:g,handleKeyUp:b}=(e=>({handleKeyDown:t=>{const n=ar(t),o=sr(e,"keydown",n);if(o)return e[o](t),void t.preventDefault();sr(e,"keyup",n)&&t.preventDefault()},handleKeyUp:t=>{const n=sr(e,"keyup",ar(t));n&&(e[n](t),t.preventDefault())}}))(h);return f.addEventListener("keydown",g),m.addEventListener("keyup",b),()=>{f.removeEventListener("keydown",g),m.removeEventListener("keyup",b)}},[e,t,n,r,a,s])}const cr=()=>{const{mapStatusRef:e}=Ht();return C("div",{ref:e,role:"status",className:"im-u-visually-hidden"})},dr={active:"M5.035 20H1v-2h4.035C5.525 11.069 11.069 5.525 18 5.035V1h2v4.035c6.931.49 12.475 6.034 12.965 12.965H37v2h-4.035c-.49 6.931-6.034 12.475-12.965 12.965V37h-2v-4.035C11.069 32.475 5.525 26.931 5.035 20zM19 7c-6.581.005-11.995 5.419-12 12 .005 6.581 5.419 11.995 12 12 6.581-.005 11.995-5.419 12-12-.005-6.581-5.419-11.995-12-12zm0 10a2.01 2.01 0 0 1 2 2 2.01 2.01 0 0 1-2 2 2.01 2.01 0 0 1-2-2 2.01 2.01 0 0 1 2-2z",inactive:"M5.035 20H1v-2h4.035a13.98 13.98 0 0 1 .246-1.8l1.96.399C7.083 17.375 7 18.178 7 19s.083 1.625.241 2.401l-1.96.399a13.98 13.98 0 0 1-.246-1.8zM20 5.035a13.98 13.98 0 0 1 1.8.246l-.399 1.96C20.625 7.083 19.822 7 19 7s-1.625.083-2.401.241l-.399-1.96a13.98 13.98 0 0 1 1.8-.246V1h2v4.035zm-2 27.93a13.98 13.98 0 0 1-1.8-.246l.399-1.96c.776.158 1.579.241 2.401.241s1.625-.083 2.401-.241l.399 1.96a13.98 13.98 0 0 1-1.8.246V37h-2v-4.035zM32.965 20a13.98 13.98 0 0 1-.246 1.8l-1.96-.399c.158-.776.241-1.579.241-2.401s-.083-1.625-.241-2.401l1.96-.399a13.98 13.98 0 0 1 .246 1.8H37v2h-4.035zM19 17a2.01 2.01 0 0 1 2 2 2.01 2.01 0 0 1-2 2 2.01 2.01 0 0 1-2-2 2.01 2.01 0 0 1 2-2zm3.8-9.385l.634-1.897c1.789.598 3.438 1.553 4.848 2.805l-1.327 1.496c-1.196-1.06-2.605-1.886-4.155-2.404zm5.181 3.43l1.496-1.327c1.252 1.41 2.207 3.059 2.805 4.848l-1.897.634c-.518-1.55-1.344-2.959-2.404-4.155zM30.385 22.8l1.897.634c-.598 1.789-1.553 3.438-2.805 4.848l-1.496-1.327c1.06-1.196 1.886-2.605 2.404-4.155zm-3.43 5.181l1.327 1.496c-1.41 1.252-3.059 2.207-4.848 2.805l-.634-1.897c1.55-.518 2.959-1.344 4.155-2.404zM15.2 30.385l-.634 1.897c-1.789-.598-3.438-1.553-4.848-2.805l1.327-1.496c1.196 1.06 2.605 1.886 4.155 2.404zm-5.181-3.43l-1.496 1.327c-1.252-1.41-2.207-3.059-2.805-4.848l1.897-.634c.518 1.55 1.344 2.959 2.404 4.155zM7.615 15.2l-1.897-.634c.598-1.789 1.553-3.438 2.805-4.848l1.496 1.327c-1.06 1.196-1.886 2.605-2.404 4.155zm3.43-5.181L9.718 8.523c1.41-1.252 3.059-2.207 4.848-2.805l.634 1.897c-1.55.518-2.959 1.344-4.155 2.404z"},ur=()=>{const{id:e}=S(),{crossHairRef:t,crossHair:o}=(()=>{const{mapProvider:e}=S(),{safeZoneInset:t,expandedButtons:o}=Y(),{eventBus:r}=Ht(),{crossHair:i,dispatch:a,mapSize:s}=ye(),l=(e,n,o)=>{if(!t)return;const r=n*he[s],i=o*he[s];e.style.transform=`translate(${r-t.left}px, ${i-t.top}px)`,e.style.left="0",e.style.top="0",e.style.display="block"},c=g(t=>{if(!t)return;((e,t,n,o,r)=>{e.pinToMap=(i,a)=>{const{x:s,y:l}=n.mapToScreen(i);e.coords=i,o({type:"UPDATE_CROSS_HAIR",payload:{isPinnedToMap:!0,isVisible:!0,coords:i,state:a}}),r(t,s,l)},e.fixAtCenter=()=>{t.style.left="50%",t.style.top="50%",t.style.transform="translate(0,0)",t.style.display="block",o({type:"UPDATE_CROSS_HAIR",payload:{isPinnedToMap:!1,isVisible:!0}})},e.remove=()=>{t.style.display="none",o({type:"UPDATE_CROSS_HAIR",payload:{isPinnedToMap:!1,isVisible:!1}})},e.show=()=>{t.style.display="block",o({type:"UPDATE_CROSS_HAIR",payload:{isVisible:!0}})},e.hide=()=>{e.isMapControlsOpen||(t.style.display="none",o({type:"UPDATE_CROSS_HAIR",payload:{isVisible:!1}}))},e.setStyle=e=>{o({type:"UPDATE_CROSS_HAIR",payload:{state:e}})},e.getDetail=()=>{const t=e.isPinnedToMap?e.coords:n.getCenter();return{state:e.state,point:n.mapToScreen(t),zoom:n.getZoom(),coords:t}}})(i,t,e,a,l);const o=()=>{if(i.coords&&i.isPinnedToMap){const{x:n,y:o}=e.mapToScreen(i.coords);l(t,n,o)}};return r.on(n.MAP_RENDER,o),()=>{r.off(n.MAP_RENDER,o)}},[i,e,s,a,t]);return f(()=>{i.coords&&i.isPinnedToMap&&i.pinToMap(i.coords,i.state)},[s]),i.isMapControlsOpen=o?.has("mapControls"),{crossHair:i,crossHairRef:c}})(),{isVisible:r,isPinnedToMap:i,state:a}=o;return C("button",{tabIndex:"-1",ref:t,id:`${e}-cross-hair`,className:"im-c-cross-hair-button","aria-label":"Target",onMouseDown:e=>e.preventDefault(),onClick:()=>o.activate?.(),style:{position:"absolute",left:i?0:"50%",top:i?0:"50%",display:r?"block":"none"},children:C("svg",{width:"38",height:"38",viewBox:"0 0 38 38",fillRule:"evenodd",fill:"currentColor","aria-hidden":"true",children:C("path",{d:dr[a||"active"]})})})},pr=R(({activeItemId:e,tabbableId:t,selectedIds:n=[],multiselectable:o=!1,items:r=[],label:i="Map features",focusable:a=!0,onFocus:s,onBlur:l,onSelectItem:c},d)=>{const{id:u}=S(),p=r.length>0,f=e??t;return C("ul",{id:`${u}-spatial-list`,ref:d,role:"listbox","aria-hidden":!p||void 0,"aria-label":i,"aria-describedby":`${u}-keyboard-desc`,"aria-multiselectable":o||void 0,className:"im-c-spatial-list",onFocus:s,onBlur:l,children:r.map(e=>C("li",{id:`${u}-spatial-list-item-${e.id}`,role:"option","data-id":e.id,tabIndex:a&&e.id===f?0:-1,"aria-selected":n.includes(e.id),style:null!=e.x?{left:e.x,top:e.y}:void 0,onClick:()=>c?.(e.id),children:e.label},e.id))})});pr.displayName="SpatialList";const fr=(e,t,n,o)=>{if(!t||!o)return{x:0,y:0};const{x:r,y:i}=t.mapToScreen(e);return{x:r*he[n],y:i*he[n]}},mr=(e,t,n,o,r)=>{e.forEach(e=>{const i=t.get(e.id);if(!i||!e.coords)return;const{x:a,y:s}=fr(e.coords,n,o,r);i.style.transform=`translate(${a}px, ${s}px)`,i.style.display="block"})},hr=()=>{const{mapProvider:e}=S(),{eventBus:t}=Ht(),{markers:o,dispatch:r,mapSize:i,isMapReady:a}=ye(),s=m(new Map),l=m(o);E(()=>{e&&(l.current=o,o.markerRefs=s.current,o.add=(t,n,o)=>{const{x:s,y:l}=fr(n,e,i,a);r({type:"UPSERT_LOCATION_MARKER",payload:{id:t,coords:n,...o,x:s,y:l,isVisible:!0}})},o.update=(t,n={})=>{const s=o.items.find(e=>e.id===t);if(!s)return;const{coords:l,...c}=n,d=l??s.coords,{x:u,y:p}=fr(d,e,i,a);r({type:"UPSERT_LOCATION_MARKER",payload:{id:t,coords:d,...c,x:u,y:p}})},o.remove=e=>{r({type:"REMOVE_LOCATION_MARKER",payload:e})},o.getMarker=e=>o.items.find(t=>t.id===e))},[e,o,r,i]);const c=g(r=>l=>{if(!l)return void s.current.delete(r);s.current.set(r,l);const c=()=>{a&&e&&mr(o.items,s.current,e,i,a)};return t.on(n.MAP_RENDER,c),()=>{t.off(n.MAP_RENDER,c)}},[o,e,a,i]);return f(()=>{a&&e&&mr(o.items,s.current,e,i,a)},[i,o.items,e,a]),((e,t)=>{f(()=>{const o=(e={})=>{if(!e?.id||!e?.coords)return;const{id:n,coords:o,options:r}=e;t.current.add(n,o,r)};e.on(n.APP_ADD_MARKER,o);const r=(e={})=>{if(!e?.id)return;const{id:n,options:o}=e;t.current.update(n,o)};e.on(n.APP_UPDATE_MARKER,r);const i=e=>{e&&t.current.remove(e)};return e.on(n.APP_REMOVE_MARKER,i),()=>{e.off(n.APP_ADD_MARKER,o),e.off(n.APP_UPDATE_MARKER,r),e.off(n.APP_REMOVE_MARKER,i)}},[])})(t,l),{markers:o,markerRef:c}},gr=({marker:e,mapId:t,markerRef:n})=>C("div",{ref:n(e.id),id:`${t}-marker-${e.id}`,className:"im-c-marker-wrapper im-c-marker-wrapper--label",style:{display:e.isVisible?"block":"none"},children:C("div",{role:"note",className:"im-c-marker__label im-c-marker__label--standalone",children:e.label})}),br=({marker:e,mapId:t,markerRef:n,isSelected:o,symbolProps:r})=>{const{resolvedSvg:i,viewBox:a,anchor:s,shapeId:l,scaledWidth:c,scaledHeight:d}=r;return I("div",{ref:n(e.id),id:`${t}-marker-${e.id}`,className:["im-c-marker-wrapper",`im-c-marker-wrapper--${ee(l)}`,o&&"im-c-marker-wrapper--selected"].filter(Boolean).join(" "),style:{display:e.isVisible?"block":"none",marginLeft:-s[0]*c+"px",marginTop:-s[1]*d+"px",width:`${c}px`,height:`${d}px`},children:[C("svg",{className:["im-c-marker__svg",`im-c-marker--${ee(l)}`,o&&"im-c-marker--selected"].filter(Boolean).join(" "),width:c,height:d,viewBox:a,overflow:"hidden","aria-hidden":"true",children:C("g",{dangerouslySetInnerHTML:{__html:i}})}),C("div",{role:"note",className:"im-c-marker__label",children:e.label})]})},yr=({marker:e,mapId:t,markerRef:n,isSelected:o,symbolProps:r})=>{const{resolvedSvg:i,viewBox:a,anchor:s,shapeId:l,scaledWidth:c,scaledHeight:d}=r;return C("svg",{ref:n(e.id),id:`${t}-marker-${e.id}`,className:["im-c-marker",`im-c-marker--${ee(l)}`,o&&"im-c-marker--selected"].filter(Boolean).join(" "),width:c,height:d,viewBox:a,overflow:"hidden","aria-hidden":"true",style:{display:e.isVisible?"block":"none",marginLeft:-s[0]*c+"px",marginTop:-s[1]*d+"px"},children:C("g",{dangerouslySetInnerHTML:{__html:i}})})},vr=new Set(["id","coords","x","y","isVisible","symbol","svgContent","size","viewBox","anchor","selectedColor","label","showLabel"]),Er=()=>{const{id:e}=S(),{mapStyle:t,mapSizeScale:o}=ye(),{markers:r,markerRef:i}=hr(),{symbolRegistry:a,eventBus:s}=Ht(),[l,c]=y(!1),[d,u]=y([]),[p,h]=y(null),g=m(null);if(f(()=>{const e=({active:e,interactionModes:t=[]})=>c(e&&t.includes("selectMarker")),t=({selectedMarkers:e=[]})=>u(e),o=({id:e})=>h(e);return s.on("interact:active",e),s.on("interact:selectionchange",t),s.on(n.MAP_SET_ACTIVE_ITEM,o),()=>{s.off("interact:active",e),s.off("interact:selectionchange",t),s.off(n.MAP_SET_ACTIVE_ITEM,o)}},[s]),f(()=>{g.current=document.querySelector(".im-c-viewport")},[]),((e,t,n)=>{f(()=>{if(!t)return;const o=n.current;if(!o)return;const r=t=>{const n=e.items.some(n=>{if(De(n))return!1;const o=e.markerRefs?.get(n.id);if(!o)return!1;const{left:r,top:i,right:a,bottom:s}=o.getBoundingClientRect();return t.clientX>=r&&t.clientX<=a&&t.clientY>=i&&t.clientY<=s});o.style.cursor=n?"pointer":""};return o.addEventListener("mousemove",r),()=>{o.removeEventListener("mousemove",r),o.style.cursor=""}},[e,t,n])})(r,l,g),!t)return;const b=a.getDefaults();return C(_,{children:r.items.map(n=>{const r=d.includes(n.id),s=n.id===p;if(De(n))return C(gr,{marker:n,mapId:e,markerRef:i},n.id);const l=((e,t,n,o,r,i)=>{const a=n.getMarkerSymbolDef(e),s=Object.fromEntries(Object.entries(e).filter(([e])=>!vr.has(e))),l=n.resolveVariant(a,s,o,i),c=a?.viewBox??_e,[,,d,u]=c.split(" ").map(Number);return{resolvedSvg:l,viewBox:c,anchor:a?.anchor??Ie,shapeId:e.symbol||t.symbol,scaledWidth:d*r,scaledHeight:u*r}})(n,b,a,t,o,((e,t)=>t?"active":e?"selected":"normal")(r,s));return n.showLabel&&n.label?C(br,{marker:n,mapId:e,markerRef:i,isSelected:r,symbolProps:l},n.id):C(yr,{marker:n,mapId:e,markerRef:i,isSelected:r,symbolProps:l},n.id)})})},Pr=()=>{const{id:e,mapProvider:t,mapLabel:o,keyboardHintText:r,focusOnMount:i}=S(),{layoutRefs:a,safeZoneInset:l,dispatch:c}=Y(),{mapSize:d,isMapReady:u}=ye(),{eventBus:p,hints:h,mapFocus:g}=Ht(),b=m(null),v=m(null),{items:E,multiselectable:P,label:R,focusable:A}=function(e){const[t,n]=y([]),[o,r]=y(!1),[i,a]=y(void 0),[s,l]=y(!0),[c,d]=y(!1);return f(()=>{if(!e)return;const t=({items:e=[],multiselectable:t=!1,label:o,focusable:i=!0}={})=>{n(e),r(t),a(o),l(i)},o=({suppressed:e=!1}={})=>{d(e)};return e.on(xo,t),e.on(Lo,o),()=>{e.off(xo,t),e.off(Lo,o)}},[e]),{items:c?[]:t,multiselectable:o,label:i,focusable:s}}(p);let T=null;if(u){const e=t.mapToScreen(t.getCenter());T={x:e.x*he[d],y:e.y*he[d]}}const{activeItemId:M,tabbableId:w,selectedIds:k,onFocus:x,onBlur:L,selectItem:O}=ko({viewportRef:a.viewportRef,spatialListRef:v,items:E,eventBus:p,hints:h,centerScreenPoint:T});f(()=>{const e=()=>c({type:"SET_LISTBOX_ACTIVE"});return p.on("interact:listboxcapable",e),()=>p.off("interact:listboxcapable",e)},[p]);lr(a.viewportRef),function(e={}){const{mapProvider:t}=S(),{eventBus:n}=Ht();f(()=>{if(!t)return;const o={};return Object.entries(e).forEach(([e,t])=>{const r=e=>t(e);o[e]=r,n.on(e,r)}),()=>{Object.entries(o).forEach(([e,t])=>{n.off(e,t)})}},[t,e])}({[n.MAP_CLICK]:()=>t?.clearHighlightedLabel?.()});const{handleFocus:B,handleBlur:D}=function({containerRef:e,onViewportFocusChange:t}){return f(()=>{const n=e.current;if(!n)return;const o=e=>{"Escape"===e.key&&t(!1)};return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}},[e,t]),{handleFocus:()=>{"keyboard"===s()&&t(!0)},handleBlur:()=>{t(!1)}}}({containerRef:a.viewportRef,onViewportFocusChange:e=>{e?h.show(r,{duration:0}):h.dismiss()}});return f(()=>{i&&a.viewportRef?.current.focus()},[]),I(_,{children:[C(or,{mapContainerRef:b}),I("div",{id:`${e}-viewport`,className:`im-c-viewport im-c-viewport--${d}`,"aria-label":o,role:"application",tabIndex:"0","data-map-keyboard-scope":!0,onFocus:B,onBlur:e=>{D(e),g.clear()},onKeyDown:()=>g.releaseAnnouncements(),onPointerDown:()=>g.releaseAnnouncements(),ref:a.viewportRef,"aria-describedby":`${e}-keyboard-desc`,"aria-controls":`${e}-spatial-list`,children:[C("div",{className:"im-c-viewport__map-container",ref:b,"aria-hidden":"true"}),C(cr,{}),C("div",{className:"im-c-viewport__safezone",style:l,ref:a.safeZoneRef,children:C(ur,{})}),C("div",{className:"im-c-viewport__markers","aria-hidden":"true",children:C(Er,{})})]}),C(pr,{ref:v,activeItemId:M,tabbableId:w,selectedIds:k,multiselectable:P,items:E,label:R,focusable:A,onFocus:()=>{x(),h.show(r,{duration:0})},onBlur:()=>{L(),h.dismiss()},onSelectItem:O})]})};const Rr=()=>{const{mapStyle:e}=ye();if(e?.logo)return C("img",{className:"im-c-logo",src:e.logo,alt:e.logoAltText})},Cr=()=>{const{breakpoint:e}=Y(),{mapStyle:t}=ye();if(!t)return null;return(!("mobile"===e)||t.showAttributionOnMobile)&&C("div",{className:"im-c-attributions",dangerouslySetInnerHTML:{__html:t.attribution}})},Ir=(e,t,n,o,r,i)=>{const a=m(o);a.current=o,E(()=>{const o=e.current;if(n){const e=((e,t)=>{const n={side:t.sideRef,banner:t.bannerRef,"top-left":t.topLeftColRef,"top-right":t.topRightColRef,"left-top":t.leftTopRef,"left-bottom":t.leftBottomRef,middle:t.middleRef,"right-top":t.rightTopRef,"right-bottom":t.rightBottomRef,"bottom-right":t.bottomRightRef,drawer:t.drawerRef,actions:t.actionsRef,modal:t.modalRef};if(e?.endsWith("-button")){const t=document.querySelector(`[data-button-slot="${e}"]`);return t?{current:t}:null}if(e?.endsWith("-panel")){const t=document.querySelector(`[data-panel-slot="${e}"]`);return t?{current:t}:null}return n[e]||null})(t,a.current);if(e?.current){const t=e.current.querySelector(":scope > .im-o-app__modal-backdrop");t?e.current.insertBefore(o,t):e.current.appendChild(o),o.style.display=""}}else o.parentElement===a.current.modalRef?.current&&a.current.appContainerRef?.current?.appendChild(o),o.style.display="none";return()=>{o.style.display="none"}},[n,t,r,e,i])},_r=({panelId:e,config:t,isOpen:n,openPanelProps:o,focusOnOpen:r,allowedModalPanelId:i,appState:a,isHiddenByApplicationMode:s})=>{const l=m(null),{breakpoint:c,isFullscreen:d,layoutRefs:u}=a,p=t[c],f=p?jt(p,c):null,h=Boolean(p&&f&&Kt(t,{targetSlot:f,isFullscreen:d})),g=!p?.modal||e===i,b=s({ids:[e],pluginId:t.pluginId,isModal:!!p?.modal});return Ir(l,f,n&&h&&g&&!b,u,c),C(bn,{panelId:e,panelConfig:t,props:o,focusOnOpen:r,html:t.html,label:t.label,isOpen:n,rootRef:l})},Ar=({control:e,appState:t,isHiddenByApplicationMode:n})=>{const o=m(null),{breakpoint:r,isFullscreen:i,layoutRefs:a,openPanels:s}=t,l=e[r],c=n({ids:[e.id],pluginId:e.pluginId}),d=((e,{breakpoint:t,isFullscreen:n})=>{const o=e[t];return!(!o||!G.control.includes(o.slot)&&!o.slot?.endsWith("-panel")||!1===e.inline&&!n)})(e,{breakpoint:r,isFullscreen:i})&&!c,u=l?.slot||null,p=u?.endsWith("-panel")?Object.keys(s||{}).sort((e,t)=>e.localeCompare(t)).join(","):null;Ir(o,u,d,a,r,p);const f=b(()=>({__html:e.html}),[e.html]);return C("div",{ref:o,className:`im-c-control im-c-control--${ee(e.id)}`,style:{display:"none"},dangerouslySetInnerHTML:f})},Sr=()=>{const e=Y(),t=Tn(),{panelConfig:n={},controlConfig:o={},openPanels:r={},breakpoint:i}=e,a=b(()=>Object.entries(n).filter(([e,t])=>Ut(t)),[n]),s=b(()=>Object.values(o).filter(e=>Ut(e)),[o]),l=b(()=>Zt(r,n,i),[r,n,i]);return a.length||s.length?I(_,{children:[a.map(([n,o])=>C(_r,{panelId:n,config:o,isOpen:!!r[n],openPanelProps:r[n]?.props,focusOnOpen:r[n]?.focusOnOpen,allowedModalPanelId:l,appState:e,isHiddenByApplicationMode:t},n)),s.map(n=>C(Ar,{control:n,appState:e,isHiddenByApplicationMode:t},n.id))]}):null},Tr=e=>{const t=(new DOMParser).parseFromString(e,"text/html");return t.querySelectorAll('[aria-hidden="true"]').forEach(e=>e.remove()),t.body.textContent.replace(/\s{2,}/g," ").trim()},Mr=()=>{const{id:e,keyboardHintText:t,enableMapControls:n,mapControlsHintText:o}=S(),{hints:r}=Ht(),{layoutRefs:i}=Y(),[a,s]=y(null),[l,c]=y(!1);if(f(()=>(c(!0),r.subscribe(s)),[r]),!l||!i.mainRef?.current)return null;const d=n?`${t} ${o}`:t;return P(I("div",{className:"im-o-hints",children:[C("div",{id:`${e}-hints`,className:"im-c-hints",children:a&&C("div",{className:"im-c-hints__hint",dangerouslySetInnerHTML:{__html:a.html}})}),C("div",{id:`${e}-keyboard-desc`,className:"im-u-visually-hidden",dangerouslySetInnerHTML:{__html:Tr(d)}})]}),i.mainRef.current)},wr=()=>{const e=S(),{id:t,mapLabel:n,mapHintText:o}=e,r=Y(),{breakpoint:i,interfaceType:a,preferredColorScheme:l,layoutRefs:c,isLayoutReady:d,isFullscreen:u,openPanels:p,panelConfig:m}=r,{mapStyle:h}=ye(),g=((e,t,n)=>null!==Zt(e,t,n))(p??{},m??{},i),y=qt(r,e);return function(){const{dispatch:e,breakpoint:t,layoutRefs:n,arePluginsEvaluated:o,appVisible:r,isFullscreen:i}=Y(),{mapSize:a,isMapReady:s}=ye(),{bannerRef:l,mainRef:c,headerRef:d,topRef:u,topLeftColRef:p,topRightColRef:f,bottomRef:m,bottomRightRef:h,attributionsRef:g,leftTopRef:y,leftBottomRef:v,rightTopRef:P,rightBottomRef:R,drawerRef:C,actionsRef:I,leftRef:_,rightRef:A}=n;E(()=>{e({type:"CLEAR_PLUGINS_EVALUATED"})},[t,a,s,r,i]),E(()=>{o&&requestAnimationFrame(()=>{er(n,t);const o=jo(n);o&&e({type:"SET_SAFE_ZONE_INSET",payload:{safeZoneInset:o}})})},[o]),an(b(()=>[l,c,d,u,p,f,I,m,h,g,y,v,P,R,C,_,A],[]),()=>{er(n,t)})}(),function(){const{layoutRefs:e}=Y();f(()=>{if(e.appContainerRef.current)return document.addEventListener("focusin",t),document.addEventListener("focusout",n),document.addEventListener("pointerdown",o),()=>{document.removeEventListener("focusin",t),document.removeEventListener("focusout",n),document.removeEventListener("pointerdown",o)};function t(e){e.target.dataset.focusVisible="keyboard"===s()}function n(e){delete e.target.dataset.focusVisible}function o(){delete document.activeElement.dataset.focusVisible}},[e.appContainerRef])}(),function(){const{applicationModeEntries:e,layoutRefs:t}=Y();f(()=>{const e=t.appContainerRef?.current,n=document.activeElement;e&&n&&e.contains(n)&&!(n.getClientRects().length>0)&&t.viewportRef?.current?.focus({preventScroll:!0})},[e])}(),I("div",{id:`${t}-im-app`,className:["im-o-app",`im-o-app--${i}`,`im-o-app--${a}`,"im-o-app--"+(u?"fullscreen":"inline"),`im-o-app--${h?.appColorScheme||l}-app`,Qt(y)].filter(Boolean).join(" "),style:{backgroundColor:h?.backgroundColor||void 0,...He(h)},ref:c.appContainerRef,children:[I("div",{className:"im-u-visually-hidden",children:[n,". ",o]}),C(Pr,{}),I("div",{className:"im-o-app__overlay"+(d?"":" im-o-app__overlay--not-ready"),children:[C("div",{className:"im-o-app__side",ref:c.sideRef,children:C(Ln,{slot:W.SIDE})}),I("div",{className:"im-o-app__main",ref:c.mainRef,children:[C("div",{className:"im-o-app__header",ref:c.headerRef,children:C(Ln,{slot:W.HEADER})}),I("div",{className:"im-o-app__top",ref:c.topRef,children:[C("div",{className:"im-o-app__top-col",ref:c.topLeftColRef,children:C(Ln,{slot:W.TOP_LEFT})}),C("div",{className:"im-o-app__top-col",children:C(Ln,{slot:W.TOP_MIDDLE})}),C("div",{className:"im-o-app__top-col",ref:c.topRightColRef,children:C(Ln,{slot:W.TOP_RIGHT})})]}),C("div",{className:"im-o-app__banner",ref:c.bannerRef,children:C(Ln,{slot:W.BANNER})}),I("div",{className:"im-o-app__left",ref:c.leftRef,children:[C("div",{className:"im-o-app__left-top",ref:c.leftTopRef,children:C(Ln,{slot:W.LEFT_TOP})}),C("div",{className:"im-o-app__left-bottom",ref:c.leftBottomRef,children:C(Ln,{slot:W.LEFT_BOTTOM})})]}),C("div",{className:"im-o-app__middle",ref:c.middleRef,children:C(Ln,{slot:W.MIDDLE})}),I("div",{className:"im-o-app__right",ref:c.rightRef,children:[C("div",{className:"im-o-app__right-top",ref:c.rightTopRef,children:C(Ln,{slot:W.RIGHT_TOP})}),C("div",{className:"im-o-app__right-bottom",ref:c.rightBottomRef,children:C(Ln,{slot:W.RIGHT_BOTTOM})})]}),I("div",{className:"im-o-app__bottom",ref:c.bottomRef,children:[I("div",{className:"im-o-app__bottom-col",children:[C(Rr,{}),C("div",{className:"im-o-app__bottom-left",children:C(Ln,{slot:W.BOTTOM_LEFT})})]}),C("div",{className:"im-o-app__bottom-col",children:C("div",{className:"im-o-app__bottom-right",ref:c.bottomRightRef,children:C(Ln,{slot:W.BOTTOM_RIGHT})})}),C("div",{className:"im-o-app__attributions",ref:c.attributionsRef,children:C(Cr,{})})]}),C("div",{className:"im-o-app__drawer",ref:c.drawerRef,children:C(Ln,{slot:W.DRAWER})}),C("div",{className:"im-o-app__actions",ref:c.actionsRef,children:C(Ln,{slot:W.ACTIONS})}),I("div",{className:"im-o-app__modal",ref:c.modalRef,children:[C(Ln,{slot:W.MODAL}),C("div",{className:"im-o-app__modal-backdrop"+(g?" im-o-app__modal-backdrop--visible":"")})]})]})]}),C(Mr,{}),C(Sr,{})]})},kr=e=>(f(()=>{c(),e.eventBus.emit(n.APP_READY)},[]),C(Z,{options:e,children:C(be,{options:e,children:C($t,{eventBus:e.eventBus,pluginRegistry:e.pluginRegistry,children:I(Ft,{children:[C(Co,{}),C(wn,{children:C(wr,{})})]})})})})),xr=new WeakMap,Lr=new WeakMap,Or=new WeakMap,Br=(e,t)=>{let o=Or.get(e);if(!o){const r=k(),i=function(){let e={};return{registerPanel:t=>{e=x(e,t)},addPanel:(t,n)=>(e=L(e,t,n),e[t]),removePanel:t=>{e=O(e,t)},getPanelConfig:()=>e,clear:()=>{e={}}}}(),a=function(){let e={};return{registerControl:t=>{e=B(e,t)},addControl:(t,n)=>(e=D(e,t,n),e[t]),getControlConfig:()=>e,clear:()=>{e={}}}}(),s=yo(),l=function({eventBus:e}){const t=new Map;let o=null;const r=()=>{let r,i,a=[],s=!1;if(o&&t.has(o)){const e=t.get(o).getItems()??{};a=e.items??[],s=!!e.multiselectable,r=e.label,i=e.focusable}else t.forEach(e=>{if(e.exclusive)return;const t=e.getItems()??{};a=a.concat(t.items??[]),s=s||!!t.multiselectable,r=r??t.label,i=i??t.focusable});e.emit(n.MAP_SET_SPATIAL_LIST,{items:a,multiselectable:s,label:r,focusable:i})};return{registerItemProvider:function(e,{getItems:n,exclusive:o=!1}){t.set(e,{getItems:n,exclusive:o}),r()},unregisterItemProvider:function(e){t.delete(e),o===e&&(o=null),r()},claimExclusive:function(e){o=e,r()},releaseExclusive:function(e){o===e&&(o=null,r())},notifyItemsChanged:function(e){t.has(e)&&(o&&o!==e||r())},clear:function(){t.clear(),o=null}}}({eventBus:t});o={buttonRegistry:r,panelRegistry:i,controlRegistry:a,pluginRegistry:mo({registerButton:r.registerButton,registerPanel:i.registerPanel,registerControl:a.registerControl,registerKeyboardShortcut:s.registerKeyboardShortcut}),keyboardShortcutRegistry:s,spatialListRegistry:l},Or.set(e,o)}return o};async function Dr(t,{MapProvider:o,mapProviderConfig:r,mapFramework:i,plugins:a=[],...s}){const{eventBus:l}=s;let c=Lr.get(t);c||(c=new o({mapFramework:i,mapProviderConfig:r,events:n,eventBus:l}),Lr.set(t,c));const{buttonRegistry:d,panelRegistry:u,controlRegistry:p,pluginRegistry:f,keyboardShortcutRegistry:m,spatialListRegistry:h}=Br(t,l),{registerPlugin:g}=f;c.capabilities?.supportedShortcuts&&m.setProviderSupportedShortcuts(c.capabilities.supportedShortcuts),f.clear(),g({id:"appConfig",manifest:io});let b=xr.get(t);b||(b=e(t),xr.set(t,b));const y={_root:b,on:l.on,off:l.off,emit:l.emit,unmount(){b.unmount(),xr.delete(t),c.destroyMap?.(),Lr.delete(t),f.clear()}};return await(async(e,t)=>{for(const n of e)if("function"==typeof n.load){const e=await n.load(),{id:o,load:r,manifest:i,...a}=n,{InitComponent:s,api:l,reducer:c,...d}=e;t({id:o,InitComponent:s,api:l,reducer:c,config:a,manifest:vo(d,i),_originalPlugin:n})}})(a,g),b.render(C(kr,{...s,buttonRegistry:d,panelRegistry:u,controlRegistry:p,pluginRegistry:f,keyboardShortcutRegistry:m,spatialListRegistry:h,mapProvider:c})),y}export{Dr as initialiseApp};
1
+ import{createRoot as e}from"preact/compat/client";import{g as t,E as n,l as o,s as r,r as i,t as a,a as s,h as l,b as c}from"./im-shell.js";import d,{useContext as u,createContext as p,useEffect as f,useRef as m,useReducer as h,useCallback as g,useMemo as b,useState as y,cloneElement as v,useLayoutEffect as E,createPortal as R,forwardRef as P}from"preact/compat";import{jsx as C,jsxs as I,Fragment as _}from"preact/jsx-runtime";const A=p(null);function S(){return u(A)}const M=(e,t)=>{const n={...e};for(const o in t)"object"!=typeof t[o]||Array.isArray(t[o])||null===t[o]?n[o]=t[o]:n[o]=M(e[o]||{},t[o]);return n},T=(e,t)=>({...e,...t}),w=(e,t,n)=>{const o=M(po,n);return{...e,[t]:o}};function k(){let e={};return{registerButton:t=>{e=T(e,t)},addButton:(t,n)=>(e=w(e,t,n),t),getButtonConfig:t=>((e,t)=>t?Object.fromEntries(Object.entries(e).filter(([e,n])=>n.pluginId===t)):e)(e,t),clear:()=>{e={}}}}const x=(e,t)=>({...e,...t}),L=(e,t,n)=>{const o=M(fo,n);return{...e,[t]:{...o,html:o.html,render:o.render}}},O=(e,t)=>{const{[t]:n,...o}=e;return o};const B=(e,t)=>({...e,...t}),D=(e,t,n)=>{const o=M(mo,n);return{...e,[t]:{id:t,...o}}};function N(e,t,n,o,r){const i=e.panelConfig||e.panelRegistry.getPanelConfig(),a=i[t]?.[n];if(!a)return e.openPanels;const s=!!a.exclusive&&!a.modal,l=!!a.modal,c=Object.fromEntries(Object.entries(e.openPanels).filter(([e])=>!i[e]?.[n]?.exclusive));return{...s?{}:c,...l?e.openPanels:{},[t]:{props:o,...void 0!==r&&{focusOnOpen:r}}}}const $=(e,t)=>e===t||!!e&&!!t&&e.length===t.length&&e.every((e,n)=>e===t[n]),H={SET_BREAKPOINT:(e,n)=>{const{behaviour:o,hybridWidth:r,maxMobileWidth:i}=n,a=Object.keys(e.openPanels),s=a[a.length-1],l="hybrid"===o?e.isFullscreen:t({behaviour:o,hybridWidth:r,maxMobileWidth:i}),c=s?N(e,s,n.breakpoint,e.openPanels[s]?.props||{}):{},d=e.panelConfig||e.panelRegistry.getPanelConfig(),u=Object.fromEntries(Object.entries(d).filter(([e,t])=>{const o=t[n.breakpoint];return!0===o?.open&&!1===o?.dismissible&&!c[e]}).map(([t])=>[t,e.openPanels[t]||{props:{}}]));return{...e,breakpoint:n.breakpoint,isFullscreen:l,previousOpenPanels:e.openPanels,openPanels:{...c,...u}}},SET_MEDIA:(e,t)=>({...e,...t}),SET_HYBRID_FULLSCREEN:(e,t)=>({...e,isFullscreen:t}),SET_INTERFACE_TYPE:(e,t)=>e.interfaceType===t?e:{...e,interfaceType:t},PLUGINS_EVALUATED:e=>e.arePluginsEvaluated?e:{...e,arePluginsEvaluated:!0},CLEAR_PLUGINS_EVALUATED:e=>e.arePluginsEvaluated?{...e,arePluginsEvaluated:!1}:e,SET_LISTBOX_ACTIVE:e=>e.listboxIsActive?e:{...e,listboxIsActive:!0},SET_SAFE_ZONE_INSET:(e,{safeZoneInset:t,syncMapPadding:n=!0})=>((e,t)=>{if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;const n=Object.keys(e),o=Object.keys(t);return n.length===o.length&&n.every(n=>Object.is(e[n],t[n]))})(e.safeZoneInset,t)?e:{...e,safeZoneInset:t,syncMapPadding:n,isLayoutReady:!0},OPEN_PANEL:(e,t)=>{const{panelId:n,props:o={},focusOnOpen:r}=t,i=N(e,n,e.breakpoint,o,r);return i===e.openPanels?e:{...e,previousOpenPanels:e.openPanels,openPanels:i}},CLOSE_PANEL:(e,t)=>{const{[t]:n,...o}=e.openPanels;return{...e,previousOpenPanels:e.openPanels,openPanels:o}},CLOSE_ALL_PANELS:e=>({...e,previousOpenPanels:e.openPanels,openPanels:{}}),RESTORE_PREVIOUS_PANELS:e=>({...e,openPanels:e.previousOpenPanels||{},previousOpenPanels:e.openPanels}),TOGGLE_APP_VISIBLE:(e,t)=>({...e,appVisible:t}),SET_APPLICATION_MODE:(e,{id:t,include:n=null,exclude:o=null})=>{const r=e.applicationModeEntries,i=r[r.length-1];return i?.id===t&&$(i.include,n)&&$(i.exclude,o)?e:{...e,applicationModeEntries:[...r.filter(e=>e.id!==t),{id:t,include:n,exclude:o}]}},CLEAR_APPLICATION_MODE:(e,t)=>{const n=e.applicationModeEntries.filter(e=>e.id!==t);return n.length===e.applicationModeEntries.length?e:{...e,applicationModeEntries:n}},TOGGLE_NUDGE_STEP:e=>({...e,nudgeStepSize:"small"===e.nudgeStepSize?"large":"small"}),TOGGLE_BUTTON_DISABLED:(e,t)=>{const{id:n,isDisabled:o}=t,r=new Set(e.disabledButtons);return o?r.add(n):r.delete(n),{...e,disabledButtons:r}},TOGGLE_BUTTON_HIDDEN:(e,t)=>{const{id:n,isHidden:o}=t,r=new Set(e.hiddenButtons);return o?r.add(n):r.delete(n),{...e,hiddenButtons:r}},TOGGLE_BUTTON_PRESSED:(e,t)=>{const{id:n,isPressed:o}=t,r=new Set(e.pressedButtons);return o?r.add(n):r.delete(n),{...e,pressedButtons:r}},TOGGLE_BUTTON_EXPANDED:(e,t)=>{const{id:n,isExpanded:o}=t,r=new Set(e.expandedButtons);return o?r.add(n):r.delete(n),{...e,expandedButtons:r}},REGISTER_BUTTON:(e,t)=>({...e,buttonConfig:T(e.buttonConfig,t)}),ADD_BUTTON:(e,t)=>{const{id:n,config:o}=t,r=w(e.buttonConfig,n,o),i=new Set(e.hiddenButtons);o.isHidden&&i.add(n);const a=new Set(e.disabledButtons);o.isDisabled&&a.add(n);const s=new Set(e.pressedButtons);o.isPressed&&s.add(n);const l=new Set(e.expandedButtons);return o.isExpanded&&l.add(n),e.buttonRegistry?.addButton&&e.buttonRegistry.addButton(n,o),{...e,buttonConfig:r,hiddenButtons:i,disabledButtons:a,pressedButtons:s,expandedButtons:l}},REGISTER_PANEL:(e,t)=>({...e,panelConfig:x(e.panelConfig,t)}),ADD_PANEL:(e,t)=>{const{id:n,config:o}=t,r=L(e.panelConfig,n,o),i=r[n];e.panelRegistry?.addPanel&&e.panelRegistry.addPanel(n,o);const a=i?.[e.breakpoint],s=a?.open;return{...e,panelConfig:r,openPanels:s?N({...e,panelConfig:r},n,e.breakpoint,{}):e.openPanels}},REMOVE_PANEL:(e,t)=>{const n=t,{[n]:o,...r}=e.openPanels;return e.panelRegistry?.removePanel&&e.panelRegistry.removePanel(n),{...e,panelConfig:O(e.panelConfig,n),openPanels:r}},REGISTER_CONTROL:(e,t)=>({...e,controlConfig:B(e.controlConfig,t)}),ADD_CONTROL:(e,t)=>{const{id:n,config:o}=t,r=D(e.controlConfig,n,o);return e.controlRegistry?.addControl&&e.controlRegistry.addControl(n,o),{...e,controlConfig:r}}};function z(){return{preferredColorScheme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",prefersReducedMotion:window.matchMedia("(prefers-reduced-motion: reduce)").matches}}const F=e=>{const{initialBreakpoint:n,initialInterfaceType:o,appColorScheme:r,autoColorScheme:i,pluginRegistry:a,buttonRegistry:s,panelRegistry:l,controlRegistry:c}=e,{preferredColorScheme:d,prefersReducedMotion:u}=z(),p=t(e),f=function(e,t,n={}){const o={};return Object.keys(e).forEach(r=>{const i=e[r][t];i?.open&&(o[r]=n[r]||{props:{}})}),o}(l.getPanelConfig(),n);return{appVisible:null,isLayoutReady:!1,arePluginsEvaluated:!1,breakpoint:n,interfaceType:o,preferredColorScheme:i?d:r,prefersReducedMotion:u,isFullscreen:p,safeZoneInset:null,disabledButtons:e.backAndContinue?.continueLabel?new Set(["journeyContinue"]):new Set,hiddenButtons:new Set,pressedButtons:new Set,expandedButtons:new Set,applicationModeEntries:[],nudgeStepSize:"large",openPanels:f,previousOpenPanels:{},listboxIsActive:!1,syncMapPadding:!0,pluginRegistry:a,buttonRegistry:s,panelRegistry:l,controlRegistry:c,buttonConfig:s.getButtonConfig(),panelConfig:l.getPanelConfig(),controlConfig:c.getControlConfig()}},V=(e,t)=>{const{type:n,payload:o}=t,r=H[n];return r?r(e,o):e},W=Object.freeze({SIDE:"side",HEADER:"header",BANNER:"banner",TOP_LEFT:"top-left",TOP_MIDDLE:"top-middle",TOP_RIGHT:"top-right",LEFT_TOP:"left-top",LEFT_BOTTOM:"left-bottom",MIDDLE:"middle",RIGHT_TOP:"right-top",RIGHT_BOTTOM:"right-bottom",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",DRAWER:"drawer",ACTIONS:"actions",MODAL:"modal"}),G=Object.freeze({control:[W.HEADER,W.BANNER,W.TOP_LEFT,W.TOP_RIGHT,W.MIDDLE,W.RIGHT_TOP,W.RIGHT_BOTTOM,W.BOTTOM_RIGHT,W.DRAWER,W.ACTIONS],panel:[W.SIDE,W.HEADER,W.BANNER,W.LEFT_TOP,W.LEFT_BOTTOM,W.MIDDLE,W.RIGHT_TOP,W.RIGHT_BOTTOM,W.DRAWER,W.MODAL],button:[W.TOP_LEFT,W.TOP_MIDDLE,W.TOP_RIGHT,W.LEFT_TOP,W.LEFT_BOTTOM,W.RIGHT_TOP,W.RIGHT_BOTTOM,W.BOTTOM_LEFT,W.BOTTOM_RIGHT,W.ACTIONS]}),j=["mobile","tablet","desktop"],U=["visibleGeometry","preferPan","paddingPercent"],Z=(e,t)=>Boolean(t.openPanels?.[e]);function K({panelId:e,props:t},o,r,i){if(!r?.[e]?.[o.breakpoint])return;const a=function(e,t,n,o){const r=o[e]?.[n],i=!!r?.exclusive&&!r?.modal,a=[];if(r?.modal)return a;const s=Object.keys(t);return i?s.forEach(e=>{const t=o[e]?.[n];t?.exclusive||a.push(e)}):s.forEach(e=>{const t=o[e]?.[n];t?.exclusive&&!t?.modal&&a.push(e)}),a}(e,o.openPanels,o.breakpoint,r),s=Z(e,o);queueMicrotask(()=>{a.forEach(e=>{i.emit(n.APP_PANEL_CLOSED,{panelId:e})}),s||i.emit(n.APP_PANEL_OPENED,{panelId:e,props:t})})}const Y=p(null),q=({options:e,children:t})=>{const{pluginRegistry:i,buttonRegistry:a,panelRegistry:s,controlRegistry:l,keyboardShortcutRegistry:c,spatialListRegistry:d,eventBus:u,breakpointDetector:p}=e,y={appContainerRef:m(null),sideRef:m(null),mainRef:m(null),headerRef:m(null),topRef:m(null),topLeftColRef:m(null),topMiddleColRef:m(null),topRightColRef:m(null),leftRef:m(null),leftTopRef:m(null),leftBottomRef:m(null),middleRef:m(null),rightRef:m(null),rightTopRef:m(null),rightBottomRef:m(null),drawerRef:m(null),bottomRef:m(null),bottomLeftColRef:m(null),bottomRightColRef:m(null),bottomRightRef:m(null),attributionsRef:m(null),actionsRef:m(null),bannerRef:m(null),modalRef:m(null),viewportRef:m(null)},v=m({}),[E,R]=h(V,F(e)),P=m(E.panelConfig);P.current=E.panelConfig;const I=g(t=>{const r=P.current||e.panelRegistry.getPanelConfig(),i=E;R(t),P.current=((e,{type:t,payload:n})=>"ADD_PANEL"===t?L(e,n.id,n.config):"REMOVE_PANEL"===t?O(e,n):e)(r,t),function(e,t,r,i){const{type:a,payload:s}=e;if("CLOSE_PANEL"===a&&queueMicrotask(()=>{i.emit(n.APP_PANEL_CLOSED,{panelId:s})}),"CLOSE_ALL_PANELS"===a&&queueMicrotask(()=>{Object.keys(t.openPanels).forEach(e=>{i.emit(n.APP_PANEL_CLOSED,{panelId:e})})}),"OPEN_PANEL"===a&&K(s,t,r,i),"ADD_BUTTON"===a){const{id:e,config:t}=s,n=M(po,t);j.forEach(t=>{const r=n[t]?.slot;r&&!G.button.includes(r)&&o.warn(`button "${e}" has invalid slot "${r}" at breakpoint "${t}". Allowed slots: ${G.button.join(", ")}.`)})}if("ADD_CONTROL"===a){const{id:e,config:t}=s,n=M(mo,t);j.forEach(t=>{const r=n[t]?.slot;!r||G.control.includes(r)||r.endsWith("-panel")||o.warn(`control "${e}" has invalid slot "${r}" at breakpoint "${t}". Allowed slots: ${G.control.join(", ")}.`)})}if("ADD_PANEL"===a){const{id:e,config:r}=s,a=M(fo,r);j.forEach(t=>{const n=a[t]?.slot;!n||G.panel.includes(n)||n.endsWith("-button")||o.warn(`panel "${e}" has invalid slot "${n}" at breakpoint "${t}". Allowed slots: ${G.panel.join(", ")}.`)});const l=a[t.breakpoint];l?.open&&!Z(e,t)&&queueMicrotask(()=>{var t;i.emit(n.APP_PANEL_OPENED,{panelId:e,slot:l.slot,...(t=a,Object.fromEntries(U.filter(e=>void 0!==t[e]).map(e=>[e,t[e]])))})})}}(t,i,r,u)},[E,e,u]);!function(e,t){const{appColorScheme:n,autoColorScheme:o,behaviour:r,hybridWidth:i,maxMobileWidth:a}=t;f(()=>{const t=[window.matchMedia("(prefers-color-scheme: dark)"),window.matchMedia("(prefers-reduced-motion: reduce)")];function s(){const{preferredColorScheme:t,prefersReducedMotion:r}=z();e({type:"SET_MEDIA",payload:{preferredColorScheme:o?t:n,prefersReducedMotion:r}})}t.forEach(e=>e.addEventListener("change",s));let l=null,c=null;if("hybrid"===r){const t=i??a;l=window.matchMedia(`(max-width: ${t}px)`),c=t=>{e({type:"SET_HYBRID_FULLSCREEN",payload:t.matches})},l.addEventListener("change",c)}return()=>{t.forEach(e=>e.removeEventListener("change",s)),l&&c&&l.removeEventListener("change",c)}},[e,r,i,a])}(R,e),f(()=>{const t=p.subscribe(t=>{I({type:"SET_BREAKPOINT",payload:{behaviour:e.behaviour,breakpoint:t,hybridWidth:e.hybridWidth,maxMobileWidth:e.maxMobileWidth}})}),n=r(e=>{I({type:"SET_INTERFACE_TYPE",payload:e})});return()=>{t(),n()}},[]);const _=b(()=>({...E,dispatch:I,layoutRefs:y,buttonRefs:v,pluginRegistry:i,buttonRegistry:a,panelRegistry:s,controlRegistry:l,keyboardShortcutRegistry:c,spatialListRegistry:d}),[E,I]);return C(A.Provider,{value:e,children:C(Y.Provider,{value:_,children:t})})};function X(){return u(Y)}const Q=(e,t)=>`${e}-tabs-tab-${t.toLowerCase().replaceAll(/\s+/g,"-")}`,J=(e,t)=>`${e}-tabs-panel-${t.toLowerCase().replaceAll(/\s+/g,"-")}`,ee=({tabs:e,defaultTab:t,panelProps:n})=>{const{id:o}=S(),r=e.map(e=>e.name),[i,a]=y(t??r[0]),s=g(e=>{a(e),document.getElementById(Q(o,e))?.focus()},[o]),l=g(e=>{const t=r.indexOf(i);"ArrowRight"===e.key?(e.preventDefault(),s(r[(t+1)%r.length])):"ArrowLeft"===e.key?(e.preventDefault(),s(r[(t-1+r.length)%r.length])):"Home"===e.key?(e.preventDefault(),s(r[0])):"End"===e.key&&(e.preventDefault(),s(r.at(-1)))},[r,i,s]),c=["im-c-tabs__panel",n?.className].filter(Boolean).join(" ");return I("div",{className:"im-c-tabs",children:[C("div",{role:"tablist",className:"im-c-tabs__list",children:e.map(({name:e})=>C("button",{type:"button",id:Q(o,e),role:"tab","aria-selected":i===e,"aria-controls":J(o,e),tabIndex:i===e?0:-1,className:"im-c-tabs__tab",onClick:()=>s(e),onKeyDown:l,children:C("span",{className:"im-c-tabs__label",children:e})},e))}),e.map(({name:e,content:t})=>{const r=i===e;return C("div",{ref:r?n?.ref:void 0,id:J(o,e),role:"tabpanel","aria-labelledby":Q(o,e),tabIndex:r?n?.tabIndex??-1:-1,hidden:!r,className:c,children:t},e)})]})};function te(e){const t=e.filter(e=>null==e.order||0===e.order),n=e.filter(e=>null!=e.order&&0!==e.order);n.sort((e,t)=>e.order-t.order);const o=[...t];for(const e of n){const t=Math.min(Math.max(e.order-1,0),o.length);o.splice(t,0,e)}return o}function ne(e){return e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function oe({items:e,keyFn:t}){const n=new Map;for(const o of e){const e=t(o),r=e?ne(e):null;n.has(r)||n.set(r,[]),n.get(r).push(o)}return n}function re({items:e,fallbackLabel:t}){const n=oe({items:e,keyFn:e=>e.tab});if(n.size<=1)return null;const o=Array.from(n.entries()).map(([e,n])=>{const o=te(n),r=o[0];return{id:e??"default",order:r.order,name:e?r.tab:t,items:o}});return te(o)}const ie=({items:e})=>C("dl",{className:"im-c-keyboard-help__list",children:e.map(e=>I("div",{className:"im-c-keyboard-help__item"+(e.visuallyHidden?" im-u-visually-hidden":""),children:[C("dt",{className:"im-c-keyboard-help__title",children:e.title}),C("dd",{className:"im-c-keyboard-help__description",dangerouslySetInnerHTML:{__html:e.command}})]},e.id))}),ae=(e,t)=>{const n=e.find(e=>e.items.some(({shortcut:e})=>(e.context??"viewport")===t));if(n)return n.name;const o=e.find(e=>e.items.some(({shortcut:e})=>"global"===e.context));return o?.name??e[0].name},se=({context:e="viewport"})=>{const t=S(),{listboxIsActive:n,keyboardShortcutRegistry:o}=X(),r=o.getKeyboardShortcuts(t),i=n?r:r.filter(e=>"listbox"!==e.context),a=re({items:i.map(e=>({id:e.id,order:0,tab:e.group,shortcut:e})),fallbackLabel:"Navigate"});if(!a)return C("div",{className:"im-c-keyboard-help",children:C(ie,{items:i})});const s=a.map(e=>({name:e.name,content:C(ie,{items:e.items.map(({shortcut:e})=>e)})}));return C("div",{className:"im-c-keyboard-help",children:C(ee,{tabs:s,defaultTab:ae(a,e)})})},le=(e,t)=>`${e}-panel-${ne(t)}`;let ce=0;const de=({tooltipId:e,label:t,description:n})=>I(_,{children:[t&&C("span",{id:`${e}-label`,children:t}),t&&n&&": ",n&&C("span",{id:`${e}-description`,children:n})]}),ue=({children:e,label:t,description:n})=>{const{interfaceType:o}=X(),r=m(null),i=m(null),[a,s]=y(!1),[l,c]=y(!1),[d,u]=y(null),[p]=y(()=>(ce+=1,`tooltip-${ce}`)),h=m(null),g=m(null),b=()=>{clearTimeout(h.current),s(!1)},E=()=>{clearTimeout(g.current),h.current=setTimeout(()=>s(!0),500)},R=()=>{clearTimeout(h.current),g.current=setTimeout(()=>s(!1),0)};f(()=>{const e=e=>{"Escape"===e.key&&(clearTimeout(h.current),clearTimeout(g.current),s(!1))};if(window.addEventListener("keydown",e),a){const e=function(e,t){if(!e)return"bottom";t||(t=e.closest(".im-o-app__main"));const n=e.getBoundingClientRect(),o=t.getBoundingClientRect(),r={top:n.top-o.top,bottom:o.bottom-n.bottom,left:n.left-o.left,right:o.right-n.right},i=Object.entries(r);i.sort(([,e],[,t])=>e-t);const[a,s]=i[0];if("top"===a||"bottom"===a)for(const[e,t]of i)if(("left"===e||"right"===e)&&Math.abs(t-s)<=50)return"left"===e?"right":"left";return{top:"bottom",bottom:"top",left:"right",right:"left"}[a]}(r.current);u(e)}return()=>{window.removeEventListener("keydown",e),clearTimeout(h.current),clearTimeout(g.current)}},[a]);const P=(t,n)=>o=>{n(),e.props?.[t]?.(o)},_=v(e,{ref:t=>{r.current=t;const n=e.props?.ref;"function"==typeof n?n(t):n&&"object"==typeof n&&(n.current=t)},onMouseEnter:P("onMouseEnter",E),onMouseLeave:P("onMouseLeave",R),onMouseDown:P("onMouseDown",b),onKeyDown:P("onKeyDown",b),onFocus:P("onFocus",()=>{"keyboard"===o&&E(),c(!0)}),onBlur:P("onBlur",()=>{R(),c(!1)}),"aria-labelledby":t?`${p}-label`:void 0,"aria-describedby":n?`${p}-description`:void 0});return I("div",{className:"im-c-tooltip-wrapper"+(l?" im-c-tooltip-wrapper--has-focus":""),children:[_,C("div",{id:p,ref:i,className:`im-c-tooltip im-c-tooltip--${d||"hidden"} ${a?"im-c-tooltip--is-visible":""}`,role:"tooltip","aria-hidden":!a,children:C(de,{tooltipId:p,label:t,description:n})})]})};let pe={close:'<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'};const fe=()=>pe,me=({id:e,svgContent:t,isMenu:n})=>{const o=n?fe().chevron:fe()[e]||t;return C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:o},className:"im-c-icon"+(n?" im-c-icon--narrow":"")})},he=(e,t)=>({...e,...t}),ge={SET_MAP_READY:e=>({...e,isMapReady:!0}),MAP_MOVE_START:he,MAP_MOVE:he,MAP_MOVE_END:he,MAP_FIRST_IDLE:he,SET_MAP_STYLE:(e,t)=>({...e,mapStyle:t}),SET_MAP_STYLES:(e,t)=>({...e,mapStyles:t}),SET_MAP_SIZE:(e,t)=>({...e,mapSize:t}),UPDATE_CROSS_HAIR:(e,t)=>({...e,crossHair:{...e.crossHair,...t}}),UPSERT_LOCATION_MARKER:(e,t)=>{const n=new Map(e.markers.items.map(e=>[e.id,e])),o=n.get(t.id)||{};n.set(t.id,{...o,...t});const r=Array.from(n.values());return{...e,markers:{...e.markers,items:r}}},REMOVE_LOCATION_MARKER:(e,t)=>{const n=e.markers.items.filter(e=>e.id!==t);return{...e,markers:{...e.markers,items:n}}}},be=(e,t)=>{const{type:n,payload:o}=t,r=ge[n];return r?r(e,o):e},ye={small:1,medium:1.5,large:2},ve=e=>ye[e]??1,Ee=p(null),Re=({options:e,children:t})=>{const[o,r]=h(be,(e=>{const{center:t,zoom:n,bounds:o,extent:r,mapStyle:i,mapSize:a,markers:s}=e,{registeredPlugins:l}=e.pluginRegistry,c=l?.find(e=>e.config?.handlesMapStyle)?null:i;return{isMapReady:!1,mapProvider:null,mapStyle:c,mapStyles:c?[c]:[],mapSize:a,center:t,zoom:n,bounds:o||r,resolution:null,isAtMaxZoom:null,isAtMinZoom:null,isUserMove:!1,crossHair:{isVisible:!1,isPinnedToMap:!1,state:"active"},markers:{items:s||[]}}})(e)),{eventBus:i}=e,a=m(!1),s=()=>{r({type:"SET_MAP_READY"})},l=t=>{const n=localStorage.getItem(`${e.id}:mapStyleId`),o=t.find(e=>e.id===n)||t[0],i=localStorage.getItem(`${e.id}:mapSize`)||e.mapSize;r({type:"SET_MAP_STYLES",payload:t}),r({type:"SET_MAP_STYLE",payload:o}),r({type:"SET_MAP_SIZE",payload:i})},c=e=>{r({type:"SET_MAP_STYLE",payload:e})},d=e=>{r({type:"SET_MAP_SIZE",payload:e})};f(()=>(i.on(n.MAP_READY,s),i.on(n.MAP_INIT_MAP_STYLES,l),i.on(n.MAP_SET_STYLE,c),i.on(n.MAP_SET_SIZE,d),()=>{i.off(n.MAP_READY,s),i.off(n.MAP_INIT_MAP_STYLES,l),i.off(n.MAP_SET_STYLE,c),i.off(n.MAP_SET_SIZE,d)}),[]),f(()=>{o.mapSize&&(a.current?i.emit(n.MAP_SIZE_CHANGE,{mapSize:o.mapSize}):a.current=!0)},[o.mapSize]),f(()=>{o.mapStyle&&o.mapSize&&(localStorage.setItem(`${e.id}:mapStyleId`,o.mapStyle.id),localStorage.setItem(`${e.id}:mapSize`,o.mapSize))},[o.mapStyle,o.mapSize]);const u=b(()=>({...o,mapSizeScale:ve(o.mapSize),dispatch:r}),[o]);return C(Ee.Provider,{value:u,children:t})};function Pe(){return u(Ee)}function Ce(e,{startupGraceDelay:t=1e3}={}){const n=t,o=Date.now();let r=null,i=null,a=!1;const s=t=>{if(!e?.current||!t)return;const r=Math.max(0,n-(Date.now()-o));e.current.textContent="",setTimeout(()=>{e.current&&(a=t===i&&!a,i=t,e.current.textContent=a?t+"​":t)},100+r)},l=((e,t)=>{let n=null;const o=(...o)=>{clearTimeout(n),n=setTimeout(()=>{e(...o)},t)};return o.cancel=()=>{n&&(clearTimeout(n),n=null)},o})(s,500),c=(e,t="action")=>{if(e)if("ambient"!==t)clearTimeout(r),r=setTimeout(()=>{r=null},1e3),l(e);else{if(r)return;s(e)}};return c.clear=()=>{e?.current&&(e.current.textContent="")},c}const Ie="aria-label";const _e=(e,t)=>{if("number"==typeof e)return e;if(!e)return null;if("string"==typeof e)return e.trim();if("object"==typeof e){if(t&&null!=e[t])return e[t];return Object.values(e)[0]??null}return null},Ae={symbol:"pin",size:"medium",backgroundColor:"#ca3535",foregroundColor:"#ffffff"},Se={small:.75,medium:1,large:1.25},Me=[.5,.5],Te="0 0 44 44",we={dot:"M8 3c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.241 5-5-2.24-5-5-5z",cross:"M6 3H10V6H13V10H10V13H6V10H3V6H6Z",diamond:"M8 2L14 8L8 14L2 8Z",triangle:"M8 2L14 14H2Z",square:"M3 3H13V13H3Z"},ke={id:"pin",path:"M22 7a13 13 0 0 1 13 13C35 28.258 23.758 39.499 22 39.499S9 28.259 9 20.001a13 13 0 0 1 13-13z",bounds:[9,7,26,32.499],anchorPoint:[22,40.5],graphicCentre:[22,20],graphic:we.dot},xe={id:"circle",path:"M22 9a13 13 0 1 1 0 26 13 13 0 1 1 0-26z",bounds:[9,9,26,26],anchorPoint:[22,22],graphicCentre:[22,22],graphic:we.dot},Le={id:"square",path:"M13.2 33.8a3 3 0 0 1-3-3V13.2a3 3 0 0 1 3-3h17.6a3 3 0 0 1 3 3v17.6a3 3 0 0 1-3 3H13.2z",bounds:[10.2,10.2,23.6,23.6],anchorPoint:[22,22],graphicCentre:[22,22],graphic:we.dot},Oe={id:"hexagon",path:"M23.5 8.317L33.1 13.859A3 3 0 0 1 34.6 16.457L34.6 27.543A3 3 0 0 1 33.1 30.141L23.5 35.683A3 3 0 0 1 20.5 35.683L10.9 30.141A3 3 0 0 1 9.4 27.543L9.4 16.457A3 3 0 0 1 10.9 13.859L20.5 8.317A3 3 0 0 1 23.5 8.317z",bounds:[9.4,7.915,25.2,28.17],anchorPoint:[22,22],graphicCentre:[22,22],graphic:we.dot},Be={id:"triangle",path:"M25.598 9.7L38.415 31.9A3 3 0 0 1 35.817 36.4L10.183 36.4A3 3 0 0 1 7.585 31.9L20.402 9.7A3 3 0 0 1 25.598 9.7z",bounds:[7.183,8.2,31.634,28.2],anchorPoint:[23,26],graphicCentre:[23,26.5],graphic:we.dot},De={id:"diamond",path:"M25.121 8.716L37.284 20.879A3 3 0 0 1 37.284 25.121L25.121 37.284A3 3 0 0 1 20.879 37.284L8.716 25.121A3 3 0 0 1 8.716 20.879L20.879 8.716A3 3 0 0 1 25.121 8.716z",bounds:[7.838,7.838,30.325,30.325],anchorPoint:[23,23],graphicCentre:[23,23],graphic:we.dot},Ne=new Set,$e=e=>`'${e}'`,He=/^symbol[A-Z]/,ze=new Set(["symbolSvgContent","symbolViewBox","symbolAnchor","symbolSize","symbolDescription"]),Fe=e=>!!e.label&&(!e.symbol&&!e.svgContent&&(null===e.symbol||null===e.svgContent)),Ve=e=>{if(t=e,!t?.symbol&&!t?.symbolSvgContent)return{};var t;const n={};return Object.entries(e).forEach(([e,t])=>{if(He.test(e)&&!ze.has(e)&&null!=t){const o=e.charAt(6).toLowerCase()+e.slice(7);n[o]=t}}),n},We={light:{haloColor:"#ffffff",selectedColor:"#0b0c0c",activeColor:"#ffdd00",foregroundColor:"#0b0c0c"},dark:{haloColor:"#0b0c0c",selectedColor:"#ffffff",activeColor:"#ffdd00",foregroundColor:"#ffffff"}},Ge=e=>{const{haloColor:t,selectedColor:n,activeColor:o,foregroundColor:r}=(e=>{const t=We[e?.mapColorScheme]??We.light;return{haloColor:e?.haloColor??t.haloColor,selectedColor:e?.selectedColor??t.selectedColor,activeColor:e?.activeColor??t.activeColor,foregroundColor:e?.foregroundColor??t.foregroundColor}})(e);return{"--map-overlay-halo-color":t,"--map-overlay-selected-color":n,"--map-overlay-active-color":o,"--map-overlay-foreground-color":r}},je=(e,t,n)=>new Promise((o,r)=>{const i=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,a=new Image(t,n);a.onload=()=>{const e=document.createElement("canvas");e.width=t,e.height=n;const r=e.getContext("2d");r.drawImage(a,0,0,t,n),o(r.getImageData(0,0,t,n))},a.onerror=()=>{r(new Error(`Failed to rasterise SVG: ${e.slice(0,80)}`))},a.src=i}),Ue=e=>{let t=0,n=2166136261;for(const o of e){const e=o.codePointAt(0);t=Math.imul(t,31)+e,n=Math.imul(n^e,16777619)}return(t>>>0).toString(36)+(n>>>0).toString(36)},Ze=e=>{const t=new Map,n=new Map;return{get:e=>{const n=t.get(e);return n&&(t.delete(e),t.set(e,n)),n},rasteriseOnce:(o,r)=>{if(!n.has(o)){const i=r().then(n=>(((n,o)=>{t.set(n,o),t.size>e&&t.delete(t.keys().next().value)})(o,n),n)).finally(()=>n.delete(o));n.set(o,i)}return n.get(o)}}},Ke=/[MmLlHhVvCcSsQqTtAaZz]/,Ye=/[-+]?(?:\d*\.\d+|\d+\.?)(?:[eE][-+]?\d+)?/y,qe=/[\s,]*/y,Xe=/[-+.\d]/,Qe={m:"nn",l:"nn",h:"n",v:"n",c:"nnnnnn",s:"nnnn",q:"nnnn",t:"nn",a:"nnnffnn",z:""},Je=1e6,et=.5,tt=2*Math.PI,nt=Math.PI/180,ot=e=>Math.round(e*Je)/Je,rt=e=>Math.abs(e)<1e-12,it=e=>e>0&&e<1;class at{position=0;constructor(e){this.pathData=e}fail(e){throw new Error(`Invalid SVG path: ${e} at position ${this.position} in "${this.pathData}"`)}skipSeparators(){qe.lastIndex=this.position,qe.exec(this.pathData),this.position=qe.lastIndex}atEnd(){return this.skipSeparators(),this.position>=this.pathData.length}peek(){return this.pathData[this.position]}readCommand(){if(!Ke.test(this.peek()))return null;const e=this.peek();return this.position++,e}readNumber(){this.skipSeparators(),Ye.lastIndex=this.position;const e=Ye.exec(this.pathData);return e||this.fail("expected a number"),this.position=Ye.lastIndex,Number.parseFloat(e[0])}readFlag(){this.skipSeparators();const e=this.peek();return"0"!==e&&"1"!==e&&this.fail("expected an arc flag (0 or 1)"),this.position++,Number(e)}readParameters(e){return[...Qe[e.toLowerCase()]].map(e=>"f"===e?this.readFlag():this.readNumber())}}const st=(e,t,n,o)=>{const r=3*t-e-3*n+o,i=2*(e-2*t+n),a=t-e;if(rt(r))return rt(i)?[]:[-a/i];const s=i*i-4*r*a;if(s<0)return[];const l=Math.sqrt(s);return[(-i+l)/(2*r),(-i-l)/(2*r)]},lt=(e,t,n,o,r)=>{const i=1-r;return i**3*e+3*i**2*r*t+3*i*r**2*n+r**3*o},ct=(e,t,n)=>{const o=e-2*t+n;return rt(o)?[]:[(e-t)/o]},dt=(e,t,n,o)=>{const r=1-o;return r**2*e+2*r*o*t+o**2*n},ut=e=>(e%tt+tt)%tt,pt=e=>{if(rt(e.radiusX)||rt(e.radiusY)||e.startX===e.endX&&e.startY===e.endY)return[];const{centreX:t,centreY:n,radiusX:o,radiusY:r,cosRotation:i,sinRotation:a,startAngle:s,sweepAngle:l}=(({startX:e,startY:t,endX:n,endY:o,radiusX:r,radiusY:i,rotation:a,largeArc:s,sweep:l})=>{const c=Math.cos(a*nt),d=Math.sin(a*nt),u=(e-n)*et,p=(t-o)*et,f=c*u+d*p,m=-d*u+c*p,h=Math.max(1,Math.sqrt(f*f/(r*r)+m*m/(i*i))),g=r*h,b=i*h,y=g*g*b*b,v=g*g*m*m+b*b*f*f,E=(s===l?-1:1)*Math.sqrt(Math.max(0,(y-v)/v)),R=E*(g*m/b),P=E*(-b*f/g),C=Math.atan2((m-P)/b,(f-R)/g);let I=Math.atan2((-m-P)/b,(-f-R)/g)-C;return l&&I<0&&(I+=tt),!l&&I>0&&(I-=tt),{centreX:c*R-d*P+(e+n)*et,centreY:d*R+c*P+(t+o)*et,radiusX:g,radiusY:b,cosRotation:c,sinRotation:d,startAngle:C,sweepAngle:I}})(e),c=Math.atan2(-r*a,o*i),d=Math.atan2(r*i,o*a);return[c,c+Math.PI,d,d+Math.PI].filter(e=>l>=0?ut(e-s)<=l:ut(s-e)<=-l).map(e=>[t+o*i*Math.cos(e)-r*a*Math.sin(e),n+o*a*Math.cos(e)+r*i*Math.sin(e)])};class ft{currentX=0;currentY=0;subpathStartX=0;subpathStartY=0;lastCubicControl=null;lastQuadControl=null;hasPoints=!1;minX=1/0;minY=1/0;maxX=-1/0;maxY=-1/0;include(e,t){this.hasPoints=!0,this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,t),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,t)}moveCurrentPoint(e,t){this.currentX=e,this.currentY=t,this.include(e,t)}moveTo(e,t){this.moveCurrentPoint(e,t),this.subpathStartX=e,this.subpathStartY=t}lineTo(e,t){this.moveCurrentPoint(e,t)}reflect(e){return e?[2*this.currentX-e[0],2*this.currentY-e[1]]:[this.currentX,this.currentY]}cubicTo(e,t,n,o,r,i){const a=[this.currentX,e,n,r],s=[this.currentY,t,o,i];[...st(...a),...st(...s)].filter(it).forEach(e=>this.include(lt(...a,e),lt(...s,e))),this.moveCurrentPoint(r,i),this.lastCubicControl=[n,o]}quadTo(e,t,n,o){const r=[this.currentX,e,n],i=[this.currentY,t,o];[...ct(...r),...ct(...i)].filter(it).forEach(e=>this.include(dt(...r,e),dt(...i,e))),this.moveCurrentPoint(n,o),this.lastQuadControl=[e,t]}arcTo(e){pt({...e,startX:this.currentX,startY:this.currentY}).forEach(([e,t])=>this.include(e,t)),this.moveCurrentPoint(e.endX,e.endY)}close(){this.currentX=this.subpathStartX,this.currentY=this.subpathStartY}}const mt={m:(e,[t,n],[o,r])=>e.moveTo(t+o,n+r),l:(e,[t,n],[o,r])=>e.lineTo(t+o,n+r),h:(e,[t],[n])=>e.lineTo(t+n,e.currentY),v:(e,[t],[,n])=>e.lineTo(e.currentX,t+n),c:(e,[t,n,o,r,i,a],[s,l])=>e.cubicTo(t+s,n+l,o+s,r+l,i+s,a+l),s:(e,[t,n,o,r],[i,a],s)=>e.cubicTo(...e.reflect(s.cubic),t+i,n+a,o+i,r+a),q:(e,[t,n,o,r],[i,a])=>e.quadTo(t+i,n+a,o+i,r+a),t:(e,[t,n],[o,r],i)=>e.quadTo(...e.reflect(i.quad),t+o,n+r),a:(e,[t,n,o,r,i,a,s],[l,c])=>e.arcTo({radiusX:Math.abs(t),radiusY:Math.abs(n),rotation:o,largeArc:r,sweep:i,endX:a+l,endY:s+c}),z:e=>e.close()},ht=e=>{const t=new ft;for(const[n,...o]of(e=>{const t=new at(e),n=[];let o=null;for(;!t.atEnd();){const e=t.readCommand();e||o&&Xe.test(t.peek())||t.fail(`unexpected "${t.peek()}"`),o=e??o,n.push([o,...t.readParameters(o)]),o={M:"L",m:"l",Z:null,z:null}[o]??o}return n})(e)){const e=n.toLowerCase(),r=n===e?[t.currentX,t.currentY]:[0,0],i={cubic:t.lastCubicControl,quad:t.lastQuadControl};t.lastCubicControl=null,t.lastQuadControl=null,mt[e](t,o,r,i)}if(!t.hasPoints)throw new Error(`Invalid SVG path: "${e}" draws nothing`);return[ot(t.minX),ot(t.minY),ot(t.maxX-t.minX),ot(t.maxY-t.minY)]},gt=.5,bt=e=>4*Math.ceil(e/4),yt=e=>Math.round(1e3*e)/1e3,vt=new Set,Et=new WeakMap,Rt=(e,t)=>{let n=Et.get(e);if(n||(n=new Map,Et.set(e,n)),n.has(t))return n.get(t);const[o,r,i,a]=e.bounds,s=bt(i*t+16),l=bt(a*t+16),c=(s-i*t)*gt,d=(l-a*t)*gt,[u,p]=e.anchorPoint,f={...e,scale:t,viewBox:`0 0 ${s} ${l}`,anchor:[((u-o)*t+c)/s,((p-r)*t+d)/l],bodyBox:[c,d,i*t,a*t],transform:`translate(${yt(c)}, ${yt(d)}) scale(${t}) translate(${-o}, ${-r})`};return n.set(t,f),f},Pt=(e,t)=>{if(!t)return e;if(!(e=>Array.isArray(e)&&2===e.length&&e.every(Number.isFinite))(t)){const n=JSON.stringify(t);return vt.has(n)||(vt.add(n),o.warn(`Invalid symbolAnchor ${n} — expected [x, y] numbers. Using the symbol's own anchor.`)),e}if(!e.bodyBox)return{...e,anchor:t};const[n,r,i,a]=e.bodyBox,[,,s,l]=e.viewBox.split(" ").map(Number);return{...e,anchor:[(n+t[0]*i)/s,(r+t[1]*a)/l]}},Ct=new Map,It=(e,t,n)=>{if(!Ct.has(e)){let t={scale:1,graphicCentreX:8,graphicCentreY:8};if(e)try{const[n,o,r,i]=ht(e);t={scale:Math.min(1,16/Math.max(r,i,Number.EPSILON)),graphicCentreX:n+r*gt,graphicCentreY:o+i*gt}}catch(e){o.warn(`Symbol graphic could not be measured, so it isn't centred — ${e.message}`)}Ct.set(e,t)}const{scale:r,graphicCentreX:i,graphicCentreY:a}=Ct.get(e);return`translate(${t}, ${n}) scale(${yt(.8*r)}) translate(${yt(-i)}, ${yt(-a)})`},_t=e=>!!e&&"none"!==e,At=Ze(256),St=(e,t,n,o)=>`symbol-${e}${Ue(`${n}|${t}`)}-${o}x`,Mt=new Set(["id","svg","viewBox","anchor","symbol","svgContent","size","symbolSvgContent","symbolSize","path","bounds","anchorPoint","graphicCentre","bodyBox","transform","scale"]),Tt={normal:{resolveWith:"resolve",prefix:""},active:{resolveWith:"resolveActive",prefix:"act-"},selected:{resolveWith:"resolveSelected",prefix:"sel-"}},wt=(e,t)=>Array.isArray(e)&&e.length===t&&e.every(Number.isFinite),kt=e=>{if("string"!=typeof e?.id||!e.id)throw new TypeError('symbolRegistry.register: a symbol needs a string "id"');e.path?(({id:e,bounds:t,anchorPoint:n,graphicCentre:o})=>{if(!wt(t,4))throw new TypeError(`symbolRegistry.register: symbol "${e}" has a "path" but no valid "bounds" ([x, y, width, height])`);if(!wt(n,2)||!wt(o,2))throw new TypeError(`symbolRegistry.register: symbol "${e}" has a "path" but no valid "anchorPoint" and "graphicCentre" ([x, y])`)})(e):(({id:e,svg:t,viewBox:n,anchor:o})=>{if("string"!=typeof t||!t)throw new TypeError(`symbolRegistry.register: symbol "${e}" needs an "svg" template`);if("string"!=typeof n||4!==n.trim().split(/[\s,]+/).length)throw new TypeError(`symbolRegistry.register: symbol "${e}" needs a "viewBox" ('minX minY width height')`);if(void 0!==o&&!wt(o,2))throw new TypeError(`symbolRegistry.register: symbol "${e}" has an invalid "anchor" — expected [x, y] in 0–1`)})(e)};function xt(e,t){if(e.path){return((e,t)=>{const{path:n,scale:o,transform:r,graphicCentre:[i,a]}=e,s=(e,t)=>`<path d="${n}" fill="none" stroke="${e}" stroke-width="${yt(t/o)}" stroke-linejoin="round"/>`;return`<g transform="${r}">${[_t(t.activeColor)?s(t.activeColor,14):"",_t(t.selectedColor)?s(t.selectedColor,8):"",`<path d="${n}" fill="${t.backgroundColor}" stroke="${t.haloColor}" stroke-width="${yt(2/o)}" stroke-linejoin="round" paint-order="stroke fill"/>`,`<g transform="${It(t.graphic,i,a)}"><path d="${t.graphic}" fill="${t.foregroundColor}"/></g>`].join("")}</g>`})(e.transform?e:Rt(e,1),t)}return((e,t)=>Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,n),e))(e.svg,t)}function Lt(e,t,n,o){const r=n?.id,i=Object.fromEntries(Object.entries(e||{}).filter(([e])=>!Mt.has(e))),a=Object.fromEntries(Object.entries(o).filter(([e])=>!Mt.has(e))),s=Object.fromEntries(Object.entries(t).filter(([,e])=>null!=e)),l={...Ae,...a,...i,...s},c=We[n?.mapColorScheme]??We.light;return l.haloColor=n?.haloColor??c.haloColor,l.selectedColor=n?.selectedColor??c.selectedColor,l.activeColor=n?.activeColor??c.activeColor,"string"==typeof l.graphic&&we[l.graphic]&&(l.graphic=we[l.graphic]),Object.fromEntries(Object.entries(l).map(([e,t])=>[e,_e(t,r)??""]))}const Ot={getMarkerSymbolDef(e){const t=this.getDefaults(),n=e.svgContent||t.svgContent,o=n?{svg:n}:this.get(e.symbol||t.symbol);if(o)return this.getSizedSymbolDef(o,{viewBox:e.viewBox||t.viewBox,size:e.size??t.size,anchor:e.anchor??t.anchor})},resolveVariant(e,t,n,o){const{resolveWith:r}=Tt[o]??Tt.normal;return this[r](e,t,n)},getKeySymbol(e,t){const n=this.getSymbolDef({...e,symbolSize:"medium"});if(!n)return null;const o={...t,mapColorScheme:t?.appColorScheme??"light"};return{svg:this.resolve(n,Ve(e),o),viewBox:n.viewBox}},resolveSymbolImage(e,t,n,o){const r=this.getSymbolDef(e);if(!r)return null;const{prefix:i}=Tt[n]??Tt.normal,a=this.resolveVariant(r,Ve(e),t,n);return{symbolDef:r,resolvedContent:a,imageId:St(i,a,r.viewBox,o)}},getSymbolImageId(e,t,n,o){return this.resolveSymbolImage(e,t,n,o)?.imageId??null},getSymbolImageIds(e,t,n){const o=this.getSymbolImageId(e,t,"normal",n);return o?{normal:o,active:this.getSymbolImageId(e,t,"active",n),selected:this.getSymbolImageId(e,t,"selected",n)}:null},getSymbolDef(e){const t=e.symbolSvgContent?{svg:e.symbolSvgContent}:e.symbol&&this.get(e.symbol);if(t)return this.getSizedSymbolDef(t,{viewBox:e.symbolViewBox,size:e.symbolSize,anchor:e.symbolAnchor})},getSizedSymbolDef(e,{viewBox:t,size:n,anchor:r}={}){const i=(e=>{if(null==e||Object.keys(Se).includes(e))return Se[e]??Se.medium;if(!Ne.has(e)){Ne.add(e);const t=Object.keys(Se).map($e).join(", ");o.warn(`Unknown symbol size "${e}" — expected ${t}. Using 'medium'.`)}return Se.medium})(n??this.getDefaults().size),a=e.path?Rt(e,i):((e,t,n)=>{const o={anchor:Me,...e};if(1===n)return{...o,viewBox:t};const r=t.split(" ").map(e=>yt(Number(e)*n)).join(" ");return{...o,viewBox:r,svg:`<g transform="scale(${n})">${e.svg}</g>`}})(e,t??e.viewBox??Te,i);return Pt(a,r)},async rasteriseSymbolImage(e,t,n,o){const r=this.resolveSymbolImage(e,t,n,o);if(!r)return null;const{symbolDef:{viewBox:i},resolvedContent:a,imageId:s}=r;let l=At.get(s);if(!l){const[,,e,t]=i.split(" ").map(Number),n=`<svg xmlns="http://www.w3.org/2000/svg" width="${e*o}" height="${t*o}" viewBox="${i}">${a}</svg>`;l=await At.rasteriseOnce(s,()=>je(n,e*o,t*o))}return{imageId:s,imageData:l}}},Bt=()=>{const e=new Map;let t={};const n={setDefaults(e){t=e||{}},getDefaults:()=>({...Ae,...t}),register(t){kt(t),e.set(t.id,t)},get:t=>e.get(t),list:()=>[...e.values()],clear(){e.clear()},initialise(){this.register(ke),this.register(xe),this.register(Le),this.register(Oe),this.register(Be),this.register(De)},resolve(e,n,o){const r=Lt(e,n||{},o,t);return e?(r.selectedColor="none",r.activeColor="none",xt(e,r)):""},resolveActive(e,n,o){const r=Lt(e,n||{},o,t);return e?xt(e,r):""},resolveSelected(e,n,o){const r=Lt(e,n||{},o,t);return e?(r.activeColor="none",xt(e,r)):""},...Ot};return n.initialise(),n},Dt={"cross-hatch":'<path d="M0 4.486V3.485h3.5V.001h1v3.484h7.002V.001h1v3.484h3.5v1.001h-3.5v7h3.5v.999h-3.5v3.516h-1v-3.516H4.499v3.516h-1v-3.516H0v-.999h3.5v-7H0zm11.501 0H4.499v7h7.002v-7z" fill="{{foregroundColor}}"/>',"diagonal-cross-hatch":'<path d="M0 8.707V7.293L7.293 0h1.414L16 7.293v1.414L8.707 16H7.293L0 8.707zM.707 8L8 15.293 15.293 8 8 .707.707 8z" fill="{{foregroundColor}}"/>',"forward-diagonal-hatch":'<path d="M16 8.707V7.293L7.293 16h1.414L16 8.707zm-16 0L8.707 0H7.293L0 7.293v1.414z" fill="{{foregroundColor}}"/>',"backward-diagonal-hatch":'<path d="M0 8.707V7.293L8.707 16H7.293L0 8.707zm16 0L7.293 0h1.414L16 7.293v1.414z" fill="{{foregroundColor}}"/>',"horizontal-hatch":'<path d="M0 4.5V3.499h15.999V4.5H0zm0 7h15.999V12.5H0v-1.001z" fill="{{foregroundColor}}"/>',"vertical-hatch":'<path d="M3.501 16.001V0h1v16.001h-1zm7.998 0V0h1v16.001h-1z" fill="{{foregroundColor}}"/>',dot:'<path d="M3.999 2A2 2 0 0 1 6 3.999C6 5.103 5.103 6 3.999 6a2 2 0 0 1-1.999-2.001A2 2 0 0 1 3.999 2zm0 7.999C5.103 10 6 10.897 6 12.001A2 2 0 0 1 3.999 14a2 2 0 0 1-1.999-1.999A2 2 0 0 1 3.999 10zM11.999 2A2 2 0 0 1 14 3.999C14 5.103 13.103 6 11.999 6S10 5.103 10 3.999A2 2 0 0 1 11.999 2zm0 7.999c1.104 0 2.001.897 2.001 2.001A2 2 0 0 1 11.999 14 2 2 0 0 1 10 12.001c0-1.104.897-2.001 1.999-2.001z" fill="{{foregroundColor}}"/>',diamond:'<path d="M4 .465L7.535 4 4 7.535.465 4 4 .465zm0 7.999l3.535 3.535L4 15.535.465 11.999 4 8.464zm8-8l3.535 3.535-3.536 3.536L8.464 4 12 .464zm0 8.001L15.536 12 12 15.536 8.465 12 12 8.465z" fill="{{foregroundColor}}"/>'},Nt=e=>Math.max(2,2*e),$t=(e,t,n)=>e.replace(/\{\{foregroundColor\}\}/g,t||"black").replace(/\{\{backgroundColor\}\}/g,n||"transparent"),Ht=Ze(128),zt={getPatternInnerContent(e){return e.fillPatternSvgContent?e.fillPatternSvgContent:e.fillPattern?this.get(e.fillPattern)?.svgContent??null:null},getKeyPatternPaths(e,t){const n=this.getPatternInnerContent(e);if(!n)return null;const o=_e(e.fillPatternForegroundColor,t)||"black",r=_e(e.fillPatternBackgroundColor,t)||"transparent",i=_e(e.stroke,t)||o;return{border:$t('<path d="M19 2.862v14.275c0 1.028-.835 1.862-1.862 1.862H2.863c-1.028 0-1.862-.835-1.862-1.862V2.862C1.001 1.834 1.836 1 2.863 1h14.275C18.166 1 19 1.835 19 2.862z" fill="{{backgroundColor}}" stroke="{{foregroundColor}}" stroke-width="2"/>',i,r),content:$t(n,o,r)}},getPatternImageId(e,t,n){const o=this.getPatternInnerContent(e);if(!o)return null;const r=_e(e.fillPatternForegroundColor,t)||"black",i=_e(e.fillPatternBackgroundColor,t)||"transparent",a=Nt(n);return`pattern-${Ue(o+r+i)}-${a}x`},async rasterisePatternImage(e,t,n){const o=this.getPatternInnerContent(e);if(!o)return null;const r=this.getPatternImageId(e,t,n);if(!r)return null;let i=Ht.get(r);if(!i){const a=_e(e.fillPatternForegroundColor,t)||"black",s=_e(e.fillPatternBackgroundColor,t)||"transparent",l=$t(o,a,s),c=`<rect width="16" height="16" fill="${s}"/>`,d=Math.round(8*Nt(n)),u=`<svg xmlns="http://www.w3.org/2000/svg" width="${d}" height="${d}" viewBox="0 0 16 16">${c}${l}</svg>`;i=await Ht.rasteriseOnce(r,()=>je(u,d,d))}return{imageId:r,imageData:i}}},Ft=()=>{const e=new Map,t={register(t,n){e.set(t,{id:t,svgContent:n})},get:t=>e.get(t),list:()=>[...e.values()],clear(){e.clear()},initialise(){Object.entries(Dt).forEach(([e,t])=>{this.register(e,t)})},...zt};return t.initialise(),t},Vt=p(null),Wt=({eventBus:e,pluginRegistry:t,children:n})=>{const{id:o,handleExitClick:r,symbolDefaults:a}=S(),s=m(null),l=b(()=>Ce(s),[]),c=b(()=>function(e){const t=new Set;let n=null,o=null;const r=()=>t.forEach(e=>e(n)),i=()=>{o&&(clearTimeout(o),o=null)},a=()=>{i(),n=null,r(),e.clear?.()};return{show:(t,s={})=>{const{duration:l=4e3,announce:c}=s;i(),n={html:t},r(),e(c??(e=>e.replace(/<[^<>]*>/g,""))(t),"ambient"),l>0&&(o=setTimeout(a,l))},dismiss:a,subscribe:e=>(t.add(e),()=>t.delete(e))}}(l),[l]),{layoutRefs:d}=X(),u=b(()=>function({viewportRef:e}){let t=null,n=!1,o=!1;return{focus:({message:r}={})=>{const i=e.current;i&&(r&&(n||(t=i.getAttribute(Ie)),i.setAttribute(Ie,r),n=!0,o=!0),i.focus())},clear:()=>{if(o=!1,!n)return;n=!1;const r=e.current;r&&(null===t?r.removeAttribute(Ie):r.setAttribute(Ie,t))},releaseAnnouncements:()=>{o=!1},isHoldingAnnouncements:()=>o}}({viewportRef:d.viewportRef}),[]),p=b(()=>Bt(),[]),f=b(()=>Ft(),[]);p.setDefaults(a||{});const h=b(()=>({announce:l,hints:c,reverseGeocode:(e,t)=>i(e,t),eventBus:e,mapStatusRef:s,focusMap:u.focus,mapFocus:u,closeApp:()=>function(e,t){t()}(0,r),symbolRegistry:p,patternRegistry:f,getPlugin:e=>t?.getPlugin(e)}),[l,c,u,t,p,f]);return C(Vt.Provider,{value:h,children:n})};function Gt(){return u(Vt)}const jt=p(null);const Ut=({children:e})=>{const{pluginRegistry:t}=S(),n={},o={},r=m({});t.registeredPlugins.forEach(e=>{const t=e.reducer;if(t){const{initialState:r,actions:i}=t;n[e.id]=function(e){return(t={},n)=>{const o=e?.[n?.type];return o?o(t,n.payload):t}}(i),o[e.id]=r}r.current[e.id]||(r.current[e.id]={})});const[i,a]=h((e,t)=>{const{pluginId:o}=t;return o&&n[o]?{...e,[o]:n[o](e[o],t)}:e},o),s=(e,t)=>(r.current[e]||(r.current[e]={}),r.current[e][t]||(r.current[e][t]=d.createRef()),r.current[e][t]),l=b(()=>({state:i,dispatch:a,refs:r,getPluginRef:s}),[i,a]);return C(jt.Provider,{value:l,children:e})},Zt=e=>{const t=u(jt);if(!t)throw new Error("usePlugin must be used within PluginProvider");const{state:n,dispatch:o,refs:r,getPluginRef:i}=t;return r.current[e]||(r.current[e]={}),{...n[e],dispatch:t=>o({...t,pluginId:e}),refs:r.current[e],useRef:t=>i(e,t)}},Kt=new Map;function Yt(e){const t=e;return Kt.has(t)||Kt.set(t,function({pluginId:t,pluginConfig:n,...o}){const r=S(),i=X(),a=Pe(),s=Gt(),l=Zt(t),c=m(i.dispatch);c.current=i.dispatch;const d=m(null);d.current||(d.current={setApplicationMode:(e,{include:t=null,exclude:n=null}={})=>c.current({type:"SET_APPLICATION_MODE",payload:{id:e,include:t,exclude:n}}),clearApplicationMode:e=>c.current({type:"CLEAR_APPLICATION_MODE",payload:e})});const{setApplicationMode:u,clearApplicationMode:p}=d.current;return C(e,{...o,pluginConfig:n,pluginState:l,appConfig:r,appState:i,mapState:a,services:s,mapProvider:r.mapProvider,iconRegistry:fe(),setApplicationMode:u,clearApplicationMode:p,buttonConfig:b(()=>Object.fromEntries(Object.entries(i.buttonConfig).filter(([e,n])=>n.pluginId===t)),[i.buttonConfig,t])})}),Kt.get(t)}const qt=(e,t)=>e.modal?"modal":"drawer"===e.slot&&["tablet","desktop"].includes(t)?"left-top":e.slot,Xt=e=>"string"==typeof e.html&&!e.pluginId,Qt=(e,{targetSlot:t,slot:n,isFullscreen:o})=>{const r=t.endsWith("-button");return!(!G.panel.includes(t)&&!r)&&(!(!1===e.inline&&!o)&&(void 0===n||t===n))},Jt=(e,t,n)=>{const o=Object.keys(e).filter(e=>t[e]?.[n]?.modal);return o.length>0?o[o.length-1]:null},en=(e,t=e=>e.slot)=>{const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}return n},tn=(e,t)=>({entries:e?.applicationModeEntries??[],declarations:(e?.pluginRegistry?.registeredPlugins??[]).flatMap(e=>Object.entries(e.manifest?.applicationModes??{}).map(([t,n])=>({id:t,pluginId:e.id,...n}))),config:t?.applicationModes??{}}),nn=({entries:e,config:t})=>{const n=e.filter(e=>!1!==t[e.id]);return n[n.length-1]??null},on=e=>{const t=nn(e);return t?`im-o-app--mode-${t.id}`:null},rn=(e,t)=>!!e&&t.some(t=>e.includes(t)),an=(e,t)=>{const n=e.map(e=>e?.[t]).filter(Boolean);return n.length?n.flat():null},sn=()=>!1,ln=e=>{const t=nn(e);if(!t)return sn;const{modeRules:n,ownerIds:o}=((e,{declarations:t,config:n})=>{const o=t.filter(t=>t.id===e.id);return{modeRules:[o.length?{include:an(o,"include"),exclude:an(o,"exclude")}:null,n[e.id]||null,e.include||e.exclude?{include:e.include,exclude:e.exclude}:null].filter(Boolean),ownerIds:o.map(e=>e.pluginId)}})(t,e),r=!!n[0]?.include;return({ids:e,pluginId:t,isModal:i=!1})=>{if(i)return!1;let a=!r||o.includes(t);return n.forEach(t=>{rn(t.include,e)&&(a=!0),rn(t.exclude,e)&&(a=!1)}),!a}};function cn({slot:e,appState:t,evaluateProp:n,isHiddenByApplicationMode:o=sn}){const{breakpoint:r,pluginRegistry:i,controlConfig:a}=t;return Object.values(a).filter(o=>{if(Xt(o))return!1;const i=o[r];if(!i)return!1;if("function"==typeof o.excludeWhen&&n(o.excludeWhen,o.pluginId))return!1;const a=G.control.includes(i.slot)||i.slot?.endsWith("-panel");return!(!1===o.inline&&!t.isFullscreen)&&((void 0===e||i.slot===e)&&a)}).map(e=>{const t=i.registeredPlugins.find(t=>t.manifest?.controls?.some(t=>t.id===e.id)),a=t?.id,s=o({ids:[e.id],pluginId:a});let l;if(e.html)l=C("div",{className:`im-c-control im-c-control--${ne(e.id)}`,hidden:s,dangerouslySetInnerHTML:{__html:n(e.html,a)}},e.id);else{const n=Yt(e.render);l=C("div",{className:`im-c-control-wrapper im-c-control-wrapper--${ne(e.id)}`,hidden:s,children:C(n,{pluginId:a,pluginConfig:t?.config})},e.id)}return{id:e.id,type:"control",slot:e[r].slot,order:e[r]?.order??0,tab:e[r]?.tab,element:l}})}const dn=({triggeringElement:e,viewportRef:t,interfaceType:n})=>{requestAnimationFrame(()=>{const o=e&&document.contains(e)?e:t.current;o?.focus?.({preventScroll:"keyboard"!==n})})};function un(e,t){const n=m(),o=m(new WeakMap),r=m(t);return r.current=t,f(()=>{const i=(Array.isArray(e)?e:[e]).map(e=>e?.current).filter(Boolean);if(!i.length||!t)return;const a=new window.ResizeObserver(e=>{const t=[];for(const n of e){const{width:e,height:r}=n.contentRect,i=o.current.get(n.target)||{};i.width===e&&i.height===r||(o.current.set(n.target,{width:e,height:r}),t.push(n))}t.length&&(cancelAnimationFrame(n.current),n.current=requestAnimationFrame(()=>{for(const e of t)r.current(e)}))});return i.forEach(e=>a.observe(e)),()=>{a.disconnect(),n.current&&cancelAnimationFrame(n.current)}},[e]),{frameRef:n}}const pn="--modal-inset",fn="--modal-max-height",mn=({isModal:e,mainRef:t,panelRef:n,buttonContainerEl:o,layoutRefs:r})=>{const i=r.appContainerRef?.current;if(!e||!t.current||!i)return;const a=getComputedStyle(document.documentElement),s=Number.parseInt(a.getPropertyValue("--divider-gap"),10),l=Number.parseInt(a.getPropertyValue("--primary-gap"),10),c=n.current.dataset.slot;if(c?.endsWith("-button")){const e=n.current?.id,r=e?document.querySelector(`[aria-controls="${e}"]`):null,a=r?.parentElement??(o?.isConnected?o:null)??document.querySelector(`[data-button-slot="${c}"]`);if(!a)return;return void((e,t,n,o,r)=>{const i=n.current.getBoundingClientRect(),a=t.getBoundingClientRect(),s=!!t.closest(".im-o-app__left-bottom, .im-o-app__right-bottom"),l=!!t.closest(".im-o-app__left-top, .im-o-app__left-bottom"),c=s?"auto":`${Math.round(a.top-i.top)}px`,d=s?`${Math.round(i.bottom-a.bottom)}px`:"auto",u=l?"auto":`${Math.round(i.right-a.left+o)}px`,p=l?`${Math.round(a.right-i.left+o)}px`:"auto",f=s?Math.round(i.bottom-a.bottom):Math.round(a.top-i.top);e.style.setProperty(pn,`${c} ${u} ${d} ${p}`),e.style.setProperty(fn,i.height-f-r+"px")})(i,a,t,s,l)}((e,t,n,o)=>{const r=`${t[0].toLowerCase()+t.slice(1)}Ref`,i=n[r]?.current,a=n.mainRef?.current;if(!i||!a)return;const s=i.getBoundingClientRect(),l=a.getBoundingClientRect(),c=s.left-l.left,d=s.top-l.top;e.style.setProperty(pn,`${d}px auto auto ${c}px`),e.style.setProperty(fn,l.height-d-o+"px")})(i,c,r,l)},hn=(e,t,n)=>{f(()=>{if(!t)return;const o=t=>{"Escape"===t.key&&(t.stopPropagation(),t.preventDefault(),n()),"Tab"===t.key&&e.current&&function(e,t){if("Tab"!==t.key)return;let n=Array.from(e.querySelectorAll(['a[href]:not([disabled]):not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','*[tabindex="0"]:not([disabled])'].join(",")));if(n=n.filter(e=>!!e.offsetParent),0===n.length)return;const o=n[0],r=n[n.length-1];!t.shiftKey||document.activeElement!==e&&document.activeElement!==o||(r.focus(),t.preventDefault()),t.shiftKey||document.activeElement!==r||(o.focus(),t.preventDefault())}(e.current,t)},r=e.current;return r?.addEventListener("keydown",o),()=>{r?.removeEventListener("keydown",o)}},[t,e,n])};function gn({mainRef:e,panelRef:t,isModal:n,rootEl:o,buttonContainerEl:r,handleClose:i}){const{layoutRefs:s}=X();hn(t,n,i),un([e],()=>mn({isModal:n,mainRef:e,panelRef:t,buttonContainerEl:r,layoutRefs:s})),E(()=>{mn({isModal:n,mainRef:e,panelRef:t,buttonContainerEl:r,layoutRefs:s})},[n,e,t,r,s]),f(()=>{if(!n)return;const e=e=>{const t=e.target.closest(".im-o-app__modal-backdrop");o&&t&&o.contains(t)&&i()};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}},[n,o,i]),E(()=>{if(n&&t.current&&o)return a({containerEl:t.current,isFullscreen:!0,boundaryEl:o}),()=>{a({containerEl:t.current,isFullscreen:!1,boundaryEl:o})}},[n,t,o]),((e,t,n)=>{f(()=>{if(!e)return;const o=e=>{const o=e.target,r=t.current;if(!o||!r||!n)return;const i=n.contains(o),a=r.contains(o);i&&!a&&r.focus()};return document.addEventListener("focusin",o),()=>{document.removeEventListener("focusin",o)}},[e,t,n])})(n,t,o)}const bn=e=>{const t=!0===e.modal,n="side"===e.slot&&e.open&&!t,o=t||!1!==e.dismissible;return{isModal:t,isAside:n,isDismissible:o,isDialog:!n&&o}},yn=({isDialog:e,isDismissible:t})=>e?"dialog":t?"complementary":"region",vn=({items:e,WrappedChild:t,props:n,children:o})=>e?e.map(e=>C(d.Fragment,{children:e.element},e.id)):t?C(t,{...n}):o,En=({innerHtmlProp:e,tabs:t,items:n,WrappedChild:o,props:r,children:i,bodyProps:a,panelBodySlot:s})=>{if(e)return C("div",{...a,dangerouslySetInnerHTML:e});const{className:l,...c}=a;return t?C("div",{className:l,"data-panel-slot":s,children:C(ee,{tabs:t.map(e=>({name:e.name,content:e.items.map(e=>C(d.Fragment,{children:e.element},e.id))})),panelProps:c})}):I("div",{...a,"data-panel-slot":s,children:[" ",C(vn,{items:n,WrappedChild:o,props:r,children:i})]})},Rn=({panelId:e,panelConfig:t,props:n,focusOnOpen:o,WrappedChild:r,items:i,tabs:a,label:s,html:l,children:c,isOpen:d=!0,isHidden:u=!1,rootRef:p})=>{const{id:h}=S(),{dispatch:v,breakpoint:E,layoutRefs:R,interfaceType:P}=X(),_=document.getElementById(`${h}-im-app`),A=t[E],M=le(h,e),{isDialog:T,isModal:w,isDismissible:k,shouldFocus:x,buttonContainerEl:L}=((e,t,n,o)=>{const{isModal:r,isAside:i,isDismissible:a,isDialog:s}=bn(e);return{isAside:i,isDialog:s,isModal:r,isDismissible:a,shouldFocus:r||!0===o||!1!==o&&!1!==n&&(!0===n||Boolean(t)),buttonContainerEl:e.slot.endsWith("button")?t?.parentNode:void 0}})(A,n?.triggeringElement,t.focus,o),O=w&&d,B=R.mainRef,D=m(null),N=m(null),$=m(d),H=function(e){const[t,n]=y(!1),o=g(()=>{const t=e?.current;t&&n(t.scrollHeight>t.clientHeight)},[e]);return un(e,o),t}(N),z=p||D,F=()=>{dn({triggeringElement:n?.triggeringElement,viewportRef:R.viewportRef,interfaceType:P}),v({type:"CLOSE_PANEL",payload:e})};gn({mainRef:B,panelRef:z,isModal:O,rootEl:_,buttonContainerEl:L,handleClose:F}),f(()=>{const e=d&&!$.current;$.current=d,x&&(e||d)&&((e,t)=>{if("keyboard"===t)return void e.focus();e.focus({preventScroll:!0});const{top:n}=e.getBoundingClientRect();(n<0||n>=window.innerHeight)&&e.scrollIntoView({block:"nearest"})})(z.current,P)},[d]);const V=(W=A.slot,G=A.showLabel??!0,["im-c-panel",`im-c-panel--${W}`,!G&&"im-c-panel--no-heading"].filter(Boolean).join(" "));var W,G;const j=((e,t)=>["im-c-panel__body",!e&&t&&"im-c-panel__body--offset"].filter(Boolean).join(" "))(A.showLabel??!0,k),U=b(()=>l?{__html:l}:null,[l]),Z=(({elementId:e,shouldFocus:t,isDialog:n,isDismissible:o,isModal:r,width:i,panelClass:a,slot:s,isOpen:l,isHidden:c})=>({id:e,"aria-labelledby":`${e}-label`,tabIndex:t?-1:void 0,role:yn({isDialog:n,isDismissible:o}),"aria-modal":n&&r?"true":void 0,style:i?{width:i}:void 0,className:a,"data-slot":s,hidden:!l||c}))({elementId:M,shouldFocus:x,isDialog:T,isDismissible:k,isModal:w,width:A.width,panelClass:V,slot:A.slot,isOpen:d,isHidden:u}),K=(({bodyRef:e,panelBodyClass:t,isBodyScrollable:n,elementId:o})=>({ref:e,className:t,tabIndex:n?0:void 0,role:n?"region":void 0,"aria-labelledby":n?`${o}-label`:void 0}))({bodyRef:N,panelBodyClass:j,isBodyScrollable:H,elementId:M}),Y=`${ne(e)}-panel`;return I("div",{ref:z,...Z,children:[C("h2",{id:`${M}-label`,className:A.showLabel??1?"im-c-panel__heading im-e-heading-m":"im-u-visually-hidden",children:s}),k&&C("button",{type:"button","aria-label":`Close ${s}`,className:"im-c-panel__close",onClick:F,children:C(me,{id:"close"})}),C(En,{innerHtmlProp:U,tabs:a,items:i,WrappedChild:r,props:n,bodyProps:K,panelBodySlot:Y,children:c})]})};function Pn({slot:e,appState:t,evaluateProp:n,isHiddenByApplicationMode:o=sn,controlsBySlot:r}){const{breakpoint:i,pluginRegistry:a,panelConfig:s,openPanels:l}=t,c=Jt(l,s,i);return Object.keys(s).map(d=>{const u=((e,t,n,{slot:o,isFullscreen:r})=>{const i=t[e];if(!i||Xt(i))return null;const a=i[n];if(!a)return null;const s=qt(a,n);return Qt(i,{targetSlot:s,slot:o,isFullscreen:r})?{config:i,bpConfig:a,targetSlot:s}:null})(d,s,i,{slot:e,isFullscreen:t.isFullscreen});if(!u)return null;const{config:p,bpConfig:f,targetSlot:m}=u,h=l[d],g=((e,t,n,o)=>Boolean(e)&&(!t.modal||n===o))(h,f,d,c),{props:b={},focusOnOpen:y}=h??{},v=a.registeredPlugins.find(e=>e.id===p.pluginId),E=v?.id,R=o({ids:[d],pluginId:E,isModal:!!f.modal}),P=E?n(p.html,E):p.html,I=n(p.label,E);return{id:d,type:"panel",slot:m,order:f.order??0,element:C(Rn,{panelId:d,panelConfig:p,props:b,focusOnOpen:y,isOpen:g,isHidden:R,...g?Cn({panelId:d,config:p,bpConfig:f,props:b,plugin:v,pluginId:E,html:P,label:I,appState:t,evaluateProp:n,isHiddenByApplicationMode:o,controlsBySlot:r}):{},label:I,html:P},d)}}).filter(Boolean)}function Cn({panelId:e,config:t,bpConfig:n,props:o,plugin:r,pluginId:i,html:a,label:s,appState:l,evaluateProp:c,isHiddenByApplicationMode:d,controlsBySlot:u}){const p=`${ne(e)}-panel`,f=u?u.get(p)??[]:cn({slot:p,appState:l,evaluateProp:c,isHiddenByApplicationMode:d});if(a)return{};let m=null;if(t.render){const a=Yt(t.render);m={id:e,order:0,tab:n.tab,element:C(a,{...o,pluginId:i,pluginConfig:r?.config})}}const h=m?[m,...f]:f,g=re({items:h,fallbackLabel:s});return g?{tabs:g}:{items:te(h)}}const In=(e,t,{appState:n,isHiddenByApplicationMode:o})=>n.hiddenButtons.has(e)||o({ids:[e],pluginId:t.pluginId}),_n=({buttonId:e,config:t,isHidden:n,appState:o,appConfig:r,evaluateProp:i})=>({buttonId:e,config:t,appState:o,appConfig:r,evaluateProp:i,isHidden:n,variant:t.variant});function An({buttonId:e,config:t,isHidden:n=!1,appState:o,appConfig:r,evaluateProp:i}){const a=t[o.breakpoint]??{},s=function(e,t,n){const o=!(!e.panelId||!t.openPanels[e.panelId]),r=void 0!==e.isPressed||!!e.pressedWhen;return i=>{if("function"==typeof e.onClick)return e.onClick(i,n(e=>e,e.pluginId)),void(r||e.keepFocus||requestAnimationFrame(()=>t.layoutRefs.viewportRef.current?.focus()));if(e.panelId){const n=i.currentTarget;t.dispatch({type:o?"CLOSE_PANEL":"OPEN_PANEL",payload:o?e.panelId:{panelId:e.panelId,props:{triggeringElement:n},...e.keepFocus&&{focusOnOpen:!1}}})}}}(t,o,i),l=!(!t.panelId||!o.openPanels[t.panelId]),c=t.panelId?o.panelConfig?.[t.panelId]?.[o.breakpoint]:void 0,d=c?yn(bn(c)):void 0;return C(Qn,{buttonId:e,iconId:i(t.iconId,t.pluginId),iconSvgContent:i(t.iconSvgContent,t.pluginId),variant:t.variant,label:i(t.label,t.pluginId),href:i(t.href,t.pluginId),showLabel:a.showLabel??!0,isDisabled:o.disabledButtons.has(e),isHidden:n,isPressed:void 0!==t.isPressed||t.pressedWhen?o.pressedButtons.has(e):void 0,isExpanded:void 0!==t.isExpanded||t.expandedWhen?o.expandedButtons.has(e):void 0,isBusy:t.busyWhen?!!i(t.busyWhen,t.pluginId):void 0,isPanelOpen:l,panelRole:d,onClick:s,panelId:t.panelId,menuItems:t.menuItems,idPrefix:r.id,ariaControls:i(t.ariaControls,t.pluginId),description:i(t.description,t.pluginId)})}function Sn(e,t){return e.map(([e,n])=>({id:e,type:"button",slot:n[t.breakpoint].slot,order:n[t.breakpoint]?.order??0,element:C(An,{..._n({buttonId:e,config:n,isHidden:In(e,n,t),...t})},e)}))}function Mn(e,t,n){const[,o]=t[0],r=o.group.slotOrder??0;if(t.length<2){const[e,o]=t[0];return{id:e,type:"button",slot:o[n.breakpoint].slot,order:r,element:C(An,{..._n({buttonId:e,config:o,isHidden:In(e,o,n),...n})},e)}}const i=te(t.map(([e,t])=>({id:e,order:t[n.breakpoint]?.order??0,buttonId:e,config:t,isHidden:In(e,t,n)})));return{id:`group-${e}`,type:"group",slot:o[n.breakpoint].slot,order:r,element:C("div",{role:"group","aria-label":o.group.label,className:"im-c-button-group",hidden:i.every(e=>e.isHidden),children:i.map(({buttonId:e,config:t,isHidden:o})=>C(An,{..._n({buttonId:e,config:t,isHidden:o,...n})},e))},`group-${e}`)}}function Tn(e,t){const n=oe({items:function(e,t){let n=null;for(const[r,i]of e)if(i.exclusiveSlot&&!t.hiddenButtons.has(r)&&i.pluginId){if(null!==n&&n!==i.pluginId)return o.warn(`Slot exclusivity conflict: plugins [${n}, ${i.pluginId}] are both claiming exclusive slot ownership. Showing all buttons.`),e;n=i.pluginId}return null===n?e:e.filter(([e,t])=>t.pluginId===n)}(e,t.appState),keyFn:([,e])=>e.group?.label}),r=[];for(const[e,o]of n)null===e?r.push(...Sn(o,t)):r.push(Mn(e,o,t));return r}function wn({slot:e,appState:t,appConfig:n,evaluateProp:o,isHiddenByApplicationMode:r=sn}){const{buttonConfig:i,breakpoint:a}=t,s=function({appState:e,buttonConfig:t,slot:n,evaluateProp:o}){const{breakpoint:r}=e;return t?Object.entries(t).filter(([t,i])=>{const a=i[r];if(i.isMenuItem)return!1;if("function"==typeof i.excludeWhen&&o(i.excludeWhen,i.pluginId))return!1;if(!1===i.inline&&!e.isFullscreen)return!1;if(i.panelId){const t=e.panelConfig?.[i.panelId]?.[r];if(!0===t?.open&&!1===t?.dismissible)return!1}return!(void 0!==n&&a?.slot!==n||!G.button.includes(a?.slot))}):[]}({appState:t,buttonConfig:i,slot:e,evaluateProp:o}),l={breakpoint:a,appState:t,appConfig:n,evaluateProp:o,isHiddenByApplicationMode:r};return[...en(s,([,e])=>e[a].slot).values()].flatMap(e=>Tn(e,l))}function kn(){const e=S(),t=X(),n=Pe(),o=Gt(),r=u(jt),i={appConfig:e,appState:t,mapState:n,services:o,mapProvider:e?.mapProvider,iconRegistry:fe()};function a(t){if(!t)return{pluginStates:r?.state??{}};const n=e.pluginRegistry.registeredPlugins.find(e=>e.id===t),o=n?{pluginId:n.id,...n.config}:{};if(Object.hasOwn(r?.state??{},t)){return{pluginConfig:o,pluginState:{...r?.state?.[t]??{},dispatch:e=>r?.dispatch?.({...e,pluginId:t})}}}return{pluginConfig:o,pluginStates:r?.state??{}}}function s(e,t){const n={...i,...a(t)};return"function"==typeof e?e(n):e}return s.ctx=i,s}const xn=()=>{const e=S(),t=X();return ln(tn(t,e))},Ln=p(new Map),On=({children:e})=>{const t=function(e){const t=cn(e),n=Pn({...e,controlsBySlot:en(t)}),o=wn(e),r=en([...t,...n,...o]);for(const[e,t]of r)r.set(e,te(t));return r}({appConfig:S(),appState:X(),evaluateProp:kn(),isHiddenByApplicationMode:xn()});return C(Ln.Provider,{value:t,children:e})},Bn=[],Dn=({children:e})=>{const{openPanels:t,panelConfig:n,breakpoint:o}=X(),r=["im-c-panel","im-c-actions",!d.Children.toArray(e).some(e=>!1===e.props?.isHidden&&"touch"!==e.props?.variant)&&"im-c-actions--hidden",Object.keys(t).some(e=>"mobile"===o&&"drawer"===n[e]?.[o]?.slot)&&"im-c-actions--border-top"].filter(Boolean).join(" ");return C("div",{className:r,children:e})},Nn=({slot:e})=>{const t=(e=>u(Ln).get(e)??Bn)(e);return t.length?C(_,{children:"actions"===e?C(Dn,{slot:"actions",children:t.map(e=>e.element)}):C(_,{children:t.map(e=>e.element)})}):null};const $n=(e,t,{buttonConfig:n,evaluateProp:o,pluginId:r,id:i})=>{const a=n[t.id];if("function"==typeof a?.onClick?a.onClick(e,o(e=>e,r)):"function"==typeof t.onClick&&t.onClick(e.nativeEvent),e.nativeEvent instanceof KeyboardEvent){const e=document.getElementById(`${i}-${ne(t.id)}`);if(e){const t=new MouseEvent("click",{bubbles:!0,cancelable:!0});t._fromKeyboardActivation=!0,e.dispatchEvent(t)}}},Hn=(e,t,n)=>"number"==typeof e?e:"first"===t?n[0]??-1:"last"===t?n[n.length-1]??-1:-1,zn=(e,t)=>({panelId:t[e.id]?.panelId??e.panelId,keepFocus:t[e.id]?.keepFocus??e.keepFocus}),Fn=(e,t)=>{e?e.focus():t.current?.focus()},Vn=(e,t,n)=>{const o=e??n,r=o.closest?.('[role="dialog"][aria-modal="true"]')??document,i=function({el:e,direction:t,root:n=document}){const o=n.querySelectorAll("input, button, select, textarea, a[href]"),r=Array.prototype.filter.call(o,e=>e.tabIndex>=0&&!!e.offsetParent),i=r.indexOf(e);return r["next"===t?i+1:i-1]||r[0]}({el:o,direction:t?"prev":"next",root:r});i?.focus()},Wn=({items:e,visibleIndices:t,index:n,setIndex:o,disabledButtons:r,instigator:i,setIsOpen:a,activateCtx:s,dispatch:l,viewportRef:c})=>{const d={items:e,index:n,disabledButtons:r,activateCtx:s,instigator:i,dispatch:l,viewportRef:c,setIsOpen:a};return e=>{if(!["Escape","Esc"].includes(e.key))return"Tab"===e.key?(e.preventDefault(),Vn(i,e.shiftKey,e.currentTarget),void a(!1)):void(["ArrowDown","ArrowUp"].includes(e.key)?(e=>{e.preventDefault();const r=t.length;if(0===r)return;const i=t.indexOf(n);let a;a="ArrowDown"===e.key?-1===i?0:(i+1)%r:-1===i?r-1:(i-1+r)%r,o(t[a])})(e):"Home"===e.key&&t.length?o(t[0]):"End"===e.key&&t.length?o(t[t.length-1]):("Enter"===e.key&&((e,{items:t,index:n,disabledButtons:o,activateCtx:r,instigator:i,dispatch:a,viewportRef:s,setIsOpen:l})=>{e.preventDefault();const c=t[n];if(c&&!o.has(c.id)){const{panelId:t,keepFocus:n}=zn(c,r.buttonConfig);if(t)return a({type:"OPEN_PANEL",payload:{panelId:t,props:{triggeringElement:i},...n&&{focusOnOpen:!1}}}),void l(!1);if($n(e,c,r),n)return Fn(i,s),void l(!1)}requestAnimationFrame(()=>s.current?.focus()),l(!1)})(e,d)," "===e.key&&((e,{items:t,index:n,disabledButtons:o,activateCtx:r,instigator:i,dispatch:a,viewportRef:s,setIsOpen:l})=>{e.preventDefault();const c=t[n];if(!c||o.has(c.id))return;const{panelId:d,keepFocus:u}=zn(c,r.buttonConfig);if(d)return a({type:"OPEN_PANEL",payload:{panelId:d,props:{triggeringElement:i},...u&&{focusOnOpen:!1}}}),void l(!1);$n(e,c,r),void 0!==c.isPressed||c.pressedWhen||(u?Fn(i,s):requestAnimationFrame(()=>s.current?.focus()),l(!1))})(e,d)));(e=>{e.preventDefault(),Fn(i,c),a(!1)})(e)}},Gn=({items:e,hiddenButtons:t,startIndex:n,startPos:o,instigator:r,instigatorKey:i,buttonRefs:a,buttonConfig:s,disabledButtons:l,pluginId:c,evaluateProp:d,id:u,menuRef:p,setIsOpen:m,buttonRect:h,isOpen:g})=>{const{dispatch:v,layoutRefs:E}=X(),R=E.viewportRef,P=b(()=>{const n=[];return e.forEach((e,o)=>{t.has(e.id)||n.push(o)}),n},[e,t]),[C,I]=y(()=>Hn(n,o,P)),_={buttonConfig:s,evaluateProp:d,pluginId:c,id:u},A=Wn({items:e,visibleIndices:P,index:C,setIndex:I,disabledButtons:l,instigator:r,setIsOpen:m,activateCtx:_,dispatch:v,viewportRef:R}),S=e=>{p.current?.contains(e.target)||a.current[i]?.contains(e.target)||m(!1)};f(()=>{if(!g)return;p.current?.focus(),I(Hn(n,o,P));const e=()=>m(!1);return document.addEventListener("focusin",S),document.addEventListener("pointerdown",S),window.addEventListener("resize",e),()=>{document.removeEventListener("focusin",S),document.removeEventListener("pointerdown",S),window.removeEventListener("resize",e)}},[g]);const{style:M,direction:T,halign:w}=(e=>{if(!e)return{style:{},direction:"below"};const t={};let n;e.top>=window.innerHeight/2?(t.bottom=window.innerHeight-e.top+"px",n="above"):(t.top=`${e.bottom}px`,n="below");const o=(e.left+e.right)/2;let r;return o>2*window.innerWidth/3?(t.right=window.innerWidth-e.right+"px",r="right"):o<window.innerWidth/3?(t.left=`${e.left}px`,r="left"):(t.left=`${o}px`,r="center"),{style:t,direction:n,halign:r}})(h);return{index:C,handleMenuKeyDown:A,handleItemClick:(e,t)=>{if(e.nativeEvent._fromKeyboardActivation||l.has(t.id))return;const{panelId:n,keepFocus:o}=zn(t,s);if(n)return v({type:"OPEN_PANEL",payload:{panelId:n,props:{triggeringElement:r},...o&&{focusOnOpen:!1}}}),void m(!1);m(!1),$n(e,t,_),o?Fn(r,R):R.current?.focus()},menuStyle:M,menuDirection:T,menuHAlign:w}},jn=({item:e,isSelected:t,hiddenButtons:n,disabledButtons:o,pressedButtons:r,id:i,onItemClick:a})=>I("li",{id:`${i}-${ne(e.id)}`,className:"im-c-popup-menu__item"+(t?" im-c-popup-menu__item--selected":""),role:void 0!==e.isPressed||e.pressedWhen?"menuitemcheckbox":"menuitem","aria-disabled":o.has(e.id)||void 0,"aria-checked":void 0!==e.isPressed||e.pressedWhen?r.has(e.id):void 0,hidden:n.has(e.id),onClick:t=>a(t,e),children:[(e.iconId||e.iconSvgContent)&&C(me,{id:e.iconId,svgContent:e.iconSvgContent}),C("span",{className:"im-c-popup-menu__item-label",children:e.label})]}),Un=({popupMenuId:e,buttonId:t,instigatorId:n,pluginId:o,startPos:r,startIndex:i,menuRef:a,items:s,setIsOpen:l,buttonRect:c,isOpen:d=!0})=>{const{id:u}=S(),{buttonRefs:p,buttonConfig:f,hiddenButtons:m,disabledButtons:h,pressedButtons:g,layoutRefs:b}=X(),y=t??n,v=p.current[y],E=kn(),{index:P,handleMenuKeyDown:I,handleItemClick:_,menuStyle:A,menuDirection:M,menuHAlign:T}=Gn({items:s,hiddenButtons:m,startIndex:i,startPos:r,instigator:v,instigatorKey:y,buttonRefs:p,buttonConfig:f,disabledButtons:h,pluginId:o,evaluateProp:E,id:u,menuRef:a,setIsOpen:l,buttonRect:c,isOpen:d});return R(C("ul",{ref:a,id:e,className:"im-c-popup-menu","data-direction":M,"data-halign":T,style:A,role:"menu",tabIndex:"-1",hidden:!d,"aria-labelledby":y,"aria-activedescendant":P>=0?`${u}-${ne(s[P].id)}`:void 0,onKeyDown:I,children:d&&s.map((e,t)=>C(jn,{item:e,isSelected:P===t,hiddenButtons:m,disabledButtons:h,pressedButtons:g,id:u,onItemClick:_},e.id))}),b?.appContainerRef?.current??document.body)},Zn=(e,t,n)=>["im-c-map-button",e&&`im-c-map-button--${ne(e)}`,t&&`im-c-map-button--${t}`,n&&"im-c-map-button--with-label"].filter(Boolean).join(" "),Kn=(e,t)=>["im-c-button-wrapper",e&&`im-c-button-wrapper--${ne(e)}`,t&&"im-c-button-wrapper--wide"].filter(Boolean).join(" "),Yn=e=>{" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),e.currentTarget.click())},qn=(e,t,n)=>{const o=e.current[t];o&&n(o.getBoundingClientRect().toJSON())},Xn=new Set(["menu","listbox","tree","grid","dialog"]),Qn=({buttonId:e,iconId:t,iconSvgContent:n,label:o,showLabel:r,isDisabled:i,isPressed:a,isExpanded:s,isBusy:l,isHidden:c,isPanelOpen:d,panelRole:u,variant:p,onClick:f,panelId:h,menuItems:b,idPrefix:v,href:E,ariaControls:R,description:P})=>{const{id:_}=S(),{buttonRefs:A}=X(),[M,T]=y(!1),[w,k]=y(null),[x,L]=y(null),O=m(null),B=g(t=>{A.current&&e&&(A.current[e]=t)},[A,e]),D=E?"a":"button",N=b?.length>=1,$=t||n||N,H=((e,t)=>e?`${ne(t)}-button`:void 0)(h,e),z=(({idPrefix:e,panelId:t,buttonId:n,hasMenu:o,panelRole:r})=>t?{id:le(e,t),type:"panel",role:r}:o?{id:`${e}-popup-${ne(n)}`,type:"popup",role:"menu"}:null)({idPrefix:v,panelId:h,buttonId:e,hasMenu:N,panelRole:u}),F=(({label:e,description:t,showLabel:n})=>n&&!t?null:{label:n?void 0:e,description:t})({label:o,description:P,showLabel:r}),V=((e,t,n,o,r,i)=>a=>{e&&["ArrowDown","ArrowUp"].includes(a.key)&&(o("ArrowUp"===a.key?"last":"first"),qn(t,n,r),i(!0))})(N,A,e,k,L,T),W=(e=>t=>{e&&["ArrowDown","ArrowUp"].includes(t.key)&&t.preventDefault()})(N),G=(({appId:e,buttonId:t,className:n,onClick:o,onKeyUp:r,onKeyDown:i,setButtonRef:a,isDisabled:s,isPressed:l,isExpanded:c,isBusy:d,isPanelOpen:u,isPopupOpen:p,controlledElement:f,ariaControls:m,href:h})=>{let g;return"panel"===f?.type?g=String(u):"popup"===f?.type?g=p:"boolean"==typeof c&&(g=c),{id:`${e}-${ne(t)}`,className:n,onClick:o,onKeyUp:r,onKeyDown:i,ref:a,"aria-disabled":s||void 0,"aria-expanded":g,"aria-pressed":"boolean"==typeof l?l:void 0,"aria-busy":d||void 0,"aria-controls":f?.id??m,"aria-haspopup":Xn.has(f?.role)?f.role:void 0,...h?{href:h,target:"_blank",onKeyUp:Yn,role:"button"}:{type:"button"}}})({appId:_,buttonId:e,className:Zn(e,p,r),onClick:t=>{if(!i){if("popup"===z?.type){const n=""===t.nativeEvent.pointerType;k(n?"first":null),M||qn(A,e,L),T(e=>!e)}f&&f(t)}},onKeyUp:V,onKeyDown:W,setButtonRef:B,isDisabled:i,isPressed:a,isExpanded:s,isBusy:l,isPanelOpen:d,isPopupOpen:M,controlledElement:z,ariaControls:R,href:E}),j=I(D,{...G,children:[$&&C(me,{id:t,svgContent:n,isMenu:N}),r&&C("span",{children:o})]});return I("div",{className:Kn(e,r),"data-button-slot":H,hidden:c,children:[F?C(ue,{label:F.label,description:F.description,children:j}):j,H&&C(Nn,{slot:H}),"popup"===z?.type&&C(Un,{popupMenuId:z.id,buttonId:e,startPos:w,menuRef:O,items:b,setIsOpen:T,buttonRect:x,isOpen:M})]})},Jn=(e,t,n)=>e?n:t,eo=[{id:"panUp",verb:"up",dx:0,dy:-1,key:"ArrowUp"},{id:"panDown",verb:"down",dx:0,dy:1,key:"ArrowDown"},{id:"panLeft",verb:"left",dx:-1,dy:0,key:"ArrowLeft"},{id:"panRight",verb:"right",dx:1,dy:0,key:"ArrowRight"}],to=[{id:"nudgeZoomIn",label:"Zoom in",announceLabel:"Zoomed in",method:"zoomIn"},{id:"nudgeZoomOut",label:"Zoom out",announceLabel:"Zoomed out",method:"zoomOut"}],no={slot:"middle",open:!1,dismissible:!0,modal:!0},oo={slot:"top-right",showLabel:!1},ro={slot:"right-top",showLabel:!1},io={slot:"right-bottom"},ao={slot:"top-left",showLabel:!1,order:1},so={slot:"actions",showLabel:!0},lo={slot:"actions",showLabel:!0,order:10},co={buttons:[{id:"journeyBack",label:({appConfig:e})=>e.backAndContinue?.backLabel,variant:"tertiary",onClick:(e,{appConfig:t,services:n})=>"mapOnly"===t.behaviour?globalThis.history.back():n.closeApp(),excludeWhen:({appConfig:e,appState:t})=>!e.backAndContinue?.backLabel||!t.isFullscreen||"mapOnly"===e.behaviour&&globalThis.history.length<=1,mobile:so,tablet:so,desktop:so},{id:"journeyContinue",label:({appConfig:e})=>e.backAndContinue?.continueLabel,variant:"primary",onClick:(e,{services:t,pluginStates:n,mapState:o})=>t.eventBus.emit("app:continue",{pluginStates:n,mapState:o}),excludeWhen:({appConfig:e,appState:t})=>!e.backAndContinue?.continueLabel||!t.isFullscreen,mobile:lo,tablet:lo,desktop:lo},{id:"exit",label:"Close map view",iconId:"close",onClick:(e,{services:t})=>t.closeApp(),excludeWhen:({appConfig:e,appState:t})=>!e.hasExitButton||!t.isFullscreen,mobile:ao,tablet:ao,desktop:ao},{id:"fullscreen",label:()=>(document.fullscreenElement?"Exit":"Enter")+" fullscreen",iconId:()=>document.fullscreenElement?"minimise":"maximise",onClick:(e,{appState:t})=>{const n=t.layoutRefs.appContainerRef.current;document.fullscreenElement?document.exitFullscreen():n.requestFullscreen()},excludeWhen:({appState:e,appConfig:t})=>!t.enableFullscreen||e.isFullscreen,mobile:oo,tablet:oo,desktop:oo},{id:"zoomIn",group:{label:"Zoom controls",slotOrder:0},label:"Zoom in",iconId:"plus",keepFocus:!0,onClick:(e,{mapProvider:t,appConfig:n})=>t.zoomIn(n.zoomDelta),excludeWhen:({appState:e,appConfig:t})=>!t.enableZoomControls||t.enableMapControls||"touch"===e.interfaceType,enableWhen:({mapState:e})=>!e.isAtMaxZoom,mobile:ro,tablet:ro,desktop:ro},{id:"zoomOut",group:{label:"Zoom controls",slotOrder:0},label:"Zoom out",iconId:"minus",keepFocus:!0,onClick:(e,{mapProvider:t,appConfig:n})=>t.zoomOut(n.zoomDelta),excludeWhen:({appState:e,appConfig:t})=>!t.enableZoomControls||t.enableMapControls||"touch"===e.interfaceType,enableWhen:({mapState:e})=>!e.isAtMinZoom,mobile:ro,tablet:ro,desktop:ro},{id:"mapControls",label:"Map controls",iconId:"move",keepFocus:!0,isExpanded:!1,ariaControls:({appConfig:e})=>`${e.id}-map-controls-content`,onClick:(e,{appState:t})=>t.dispatch({type:"TOGGLE_BUTTON_EXPANDED",payload:{id:"mapControls",isExpanded:!t.expandedButtons.has("mapControls")}}),excludeWhen:({appConfig:e})=>!e.enableMapControls,mobile:oo,tablet:oo,desktop:oo}],panels:[{id:"keyboardHelp",label:"Keyboard shortcuts",mobile:{...no},tablet:{...no,width:"500px"},desktop:{...no,width:"500px"},render:e=>C(se,{context:e?.context})}],controls:[{id:"mapControls",label:"Move and zoom",excludeWhen:({appConfig:e})=>!e.enableMapControls,mobile:io,tablet:io,desktop:io,render:()=>{const{id:e,mapProvider:t,panDelta:n,nudgePanDelta:o,zoomDelta:r,nudgeZoomDelta:i}=S(),{dispatch:a,expandedButtons:s,nudgeStepSize:l,interfaceType:c,layoutRefs:d}=X(),{isAtMaxZoom:u,isAtMinZoom:p}=Pe(),{announce:m}=Gt(),h=s.has("mapControls"),g=`${e}-pan-up`;f(()=>{h&&document.getElementById(g)?.focus()},[h,g]);const b="large"===l,y=b?"Move":"Nudge",v=()=>{"keyboard"!==c&&requestAnimationFrame(()=>d.viewportRef.current?.focus())},E=(e,r,i,a=!1)=>{const s=!a&&b,l=s?"Move":"Nudge",c=t.activeMoveTarget;if(c){c.move(e,r,s);const t=c.label?`${c.label} `:"";return m(`${l}d ${t}${i}`),void v()}const d=Jn(s,o,n);t.panBy([e*d,r*d]),m(`${l}d ${i}`),v()},R=["im-c-map-controls",!h&&"im-c-map-controls--collapsed"].filter(Boolean).join(" "),P=I("div",{role:"group","aria-label":"Direction controls",className:"im-c-map-controls__directions",children:[eo.map(({id:e,verb:t,dx:n,dy:o})=>C(Qn,{buttonId:e,label:`${y} ${t}`,iconId:"chevron",onClick:()=>E(n,o,t)},e)),C(Qn,{buttonId:"nudgeStepToggle",label:I(_,{children:["Precision ",I("span",{"aria-hidden":"true",children:["(",b?"Off":"On",")"]})]}),iconId:b?"precision":"precision-active",isPressed:!b,onClick:()=>{a({type:"TOGGLE_NUDGE_STEP"}),m(b?"Precision on":"Precision off")}})]},"directions"),A=C("div",{role:"group","aria-label":"Zoom controls",className:"im-c-map-controls__zoom",children:to.map(({id:e,label:n,announceLabel:o,method:a})=>C(Qn,{buttonId:e,label:n,iconId:"zoomIn"===a?"plus":"minus",isDisabled:"zoomIn"===a?u:p,onClick:()=>((e,n)=>{const o=Jn(b,i,r);t[e](o),m(n),v()})(a,o)},e))},"zoom");return I("div",{id:`${e}-map-controls-content`,className:R,onKeyDown:e=>{const t=eo.find(({key:t})=>t===e.key);t&&(e.preventDefault(),E(t.dx,t.dy,t.verb,e.shiftKey))},"data-map-keyboard-scope":!0,children:[P,A]})}}],icons:[{id:"maximise",svgContent:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>'},{id:"minimise",svgContent:'<path d="m14 10 7-7"/><path d="M20 10h-6V4"/><path d="m3 21 7-7"/><path d="M4 14h6v6"/>'},{id:"plus",svgContent:'<path d="M5 12h14"/><path d="M12 5v14"/>'},{id:"minus",svgContent:'<path d="M5 12h14"/>'},{id:"chevron",svgContent:'<path d="m6 9 6 6 6-6"/>'},{id:"move",svgContent:'<path d="M11.146 15.854a1.207 1.207 0 0 1 1.708 0l1.56 1.56A2 2 0 0 1 15 18.828V21a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1v-2.172a2 2 0 0 1 .586-1.414z"/><path d="M18.828 15a2 2 0 0 1-1.414-.586l-1.56-1.56a1.207 1.207 0 0 1 0-1.708l1.56-1.56A2 2 0 0 1 18.828 9H21a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1z"/><path d="M6.586 14.414A2 2 0 0 1 5.172 15H3a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h2.172a2 2 0 0 1 1.414.586l1.56 1.56a1.207 1.207 0 0 1 0 1.708z"/><path d="M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2.172a2 2 0 0 1-.586 1.414l-1.56 1.56a1.207 1.207 0 0 1-1.708 0l-1.56-1.56A2 2 0 0 1 9 5.172z"/>'},{id:"precision",svgContent:'<circle cx="12" cy="12" r="10"/><line x1="22" x2="18" y1="12" y2="12"/><line x1="6" x2="2" y1="12" y2="12"/><line x1="12" x2="12" y1="6" y2="2"/><line x1="12" x2="12" y1="22" y2="18"/>'},{id:"precision-active",svgContent:'<circle cx="12" cy="12" r="10"/><line x1="22" x2="16" y1="12" y2="12"/><line x1="8" x2="2" y1="12" y2="12"/><line x1="12" x2="12" y1="8" y2="2"/><line x1="12" x2="12" y1="22" y2="16"/><circle cx="12" cy="12" r="1.5" fill="currentColor" stroke="none"/>'}]},uo={slot:"right-top",showLabel:!0},po={label:"Button",mobile:uo,tablet:uo,desktop:uo},fo={label:"Panel",focus:!0,mobile:{slot:"drawer",open:!0,dismissible:!0,modal:!1,showLabel:!0},tablet:{slot:"left-top",open:!0,dismissible:!0,modal:!1,showLabel:!0},desktop:{slot:"left-top",open:!0,dismissible:!0,modal:!1,showLabel:!0},render:null,html:null},mo={label:"Control",mobile:{slot:"drawer"},tablet:{slot:"top-left"},desktop:{slot:"top-left"}},ho=e=>Array.isArray(e)?e:[e],go=["mobile","tablet","desktop"];function bo(e,t){const n=G[t];go.forEach(r=>{const i=e[r]?.slot;!i||n.includes(i)||"panel"===t&&i.endsWith("-button")||"control"===t&&i.endsWith("-panel")||o.warn(`${t} "${e.id}" has invalid slot "${i}" at breakpoint "${r}". Allowed slots: ${n.join(", ")}.`)})}function yo({registerButton:e,registerPanel:t,registerControl:n,registerKeyboardShortcut:o}){const r=[];return{registeredPlugins:r,registerPlugin:function(i){const{manifest:a}=i,s={pluginId:i.id};a.buttons&&ho(a.buttons).forEach(t=>{bo(t,"button"),e({[t.id]:{...s,...t}}),t?.menuItems?.forEach(t=>{e({[t.id]:{...s,...t,isMenuItem:!0}})})}),a.panels&&ho(a.panels).forEach(e=>{bo(e,"panel"),t({[e.id]:{...s,...e}})}),a.controls&&ho(a.controls).forEach(e=>{bo(e,"control"),n({[e.id]:{...s,...e}})}),a.icons&&ho(a.icons).forEach(e=>(e=>{pe={...pe,...e}})({[e.id]:e.svgContent})),a.keyboardShortcuts&&ho(a.keyboardShortcuts).forEach(e=>o({...s,shortcut:e})),r.push(i)},getPlugin:function(e){return r.find(t=>t.id===e)?._originalPlugin},clear:function(){r.length=0}}}const vo=()=>"undefined"!=typeof navigator&&/mac/i.test(navigator.userAgentData?.platform||navigator.platform||""),Eo=vo()?"<kbd>Option</kbd>":"<kbd>Alt</kbd>",Ro=[{id:"showKeyboardHelp",title:"Show keyboard help",command:"<kbd>Shift</kbd> + <kbd>?</kbd>",context:"global",enabled:!0},{id:"getInfo",title:"Get current location and visible area",command:`${vo()?"<kbd>Option</kbd>":"<kbd>Ctrl</kbd>"} + <kbd>I</kbd>`,enabled:!0,visuallyHidden:!0,mapProviderAgnostic:!0,requiredConfig:["reverseGeocodeProvider"]},{id:"moveLarge",title:"Move in large steps",command:"<kbd>←</kbd>, <kbd>↑</kbd>, <kbd>→</kbd> or <kbd>↓</kbd>",enabled:!0},{id:"nudgeMap",title:"Nudge map",command:"<kbd>Shift</kbd> + <kbd>←</kbd>, <kbd>↑</kbd>, <kbd>→</kbd> or <kbd>↓</kbd>",enabled:!1},{id:"zoomLarge",title:"Zoom in large steps",command:"<kbd>+</kbd> or <kbd>-</kbd>",enabled:!0},{id:"nudgeZoom",title:"Nudge zoom",command:"<kbd>Shift</kbd> + <kbd>+</kbd> or <kbd>-</kbd>",enabled:!1},{id:"highlightLabelAtCenter",title:"Highlight label at centre",command:`${Eo} + <kbd>Enter</kbd>`,enabled:!1,requiredConfig:["readMapText"]},{id:"highlightNextLabel",title:"Highlight nearby label",command:`${Eo} + <kbd>→</kbd>, <kbd>←</kbd>, <kbd>↑</kbd> or <kbd>↓</kbd>`,enabled:!1,requiredConfig:["readMapText"]}];function Po(){const e={pluginShortcutHelp:[],pluginShortcutIds:new Set,providerSupportedIds:new Set};return{registerKeyboardShortcut:t=>((e,{shortcut:t})=>{const{pluginShortcutHelp:n,pluginShortcutIds:o}=e;o.has(t.id)?n[n.findIndex(e=>e.id===t.id)]=t:(o.add(t.id),n.push(t))})(e,t),setProviderSupportedShortcuts:t=>((e,t=[])=>{e.providerSupportedIds=new Set(t)})(e,t),getKeyboardShortcuts:t=>((e,t={})=>[...Ro.filter(n=>!(!n.mapProviderAgnostic&&!e.providerSupportedIds.has(n.id))&&(!n.requiredConfig||n.requiredConfig.every(e=>t[e]))),...e.pluginShortcutHelp])(e,t)}}function Co(e={},t={}){const n=(e=[],t=[])=>{Array.isArray(e)||(e=[]),Array.isArray(t)||(t=[]);const n=new Map(e.map(e=>[e.id,e]));return t.forEach(e=>{e?.id&&(n.has(e.id)?n.set(e.id,{...n.get(e.id),...e}):n.set(e.id,e))}),Array.from(n.values())},o={...e,...t};return(e.buttons||t.buttons)&&(o.buttons=n(e.buttons,t.buttons)),(e.panels||t.panels)&&(o.panels=n(e.panels,t.panels)),(e.controls||t.controls)&&(o.controls=n(e.controls,t.controls)),(e.icons||t.icons)&&(o.icons=n(e.icons,t.icons)),o}const Io=()=>{const{id:e}=S(),{dispatch:t,hiddenButtons:o,disabledButtons:r,pressedButtons:i,expandedButtons:a,openPanels:s,layoutRefs:l,interfaceType:c}=X(),{eventBus:d}=Gt(),u=m(t),p=m(null);u.current=t,p.current={hiddenButtons:o,disabledButtons:r,pressedButtons:i,expandedButtons:a,appId:e,openPanels:s,layoutRefs:l,interfaceType:c},f(()=>{const e=((e,t)=>[[n.APP_OPENED,()=>e.current({type:"TOGGLE_APP_VISIBLE",payload:!0})],[n.APP_CLOSED,()=>e.current({type:"TOGGLE_APP_VISIBLE",payload:!1})],[n.APP_ADD_BUTTON,({id:t,config:n})=>{e.current({type:"ADD_BUTTON",payload:{id:t,config:n}}),Array.isArray(n.menuItems)&&n.menuItems.forEach(t=>{e.current({type:"ADD_BUTTON",payload:{id:t.id,config:{...t,isMenuItem:!0}}})})}],[n.APP_TOGGLE_BUTTON_STATE,({id:n,prop:o,value:r})=>{const{hiddenButtons:i,disabledButtons:a,pressedButtons:s,expandedButtons:l}=t.current;switch(o){case"hidden":{const t="boolean"==typeof r?r:!i.has(n);e.current({type:"TOGGLE_BUTTON_HIDDEN",payload:{id:n,isHidden:t}});break}case"disabled":{const t="boolean"==typeof r?r:!a.has(n);e.current({type:"TOGGLE_BUTTON_DISABLED",payload:{id:n,isDisabled:t}});break}case"pressed":{const t="boolean"==typeof r?r:!s.has(n);e.current({type:"TOGGLE_BUTTON_PRESSED",payload:{id:n,isPressed:t}});break}case"expanded":{const t="boolean"==typeof r?r:!l.has(n);e.current({type:"TOGGLE_BUTTON_EXPANDED",payload:{id:n,isExpanded:t}});break}}}],[n.APP_ADD_PANEL,({id:t,config:n})=>e.current({type:"ADD_PANEL",payload:{id:t,config:n}})],[n.APP_REMOVE_PANEL,t=>e.current({type:"REMOVE_PANEL",payload:t})],[n.APP_SHOW_PANEL,({id:t,focus:n=!0,triggeringElement:o})=>e.current({type:"OPEN_PANEL",payload:{panelId:t,focusOnOpen:n,props:o?{triggeringElement:o}:void 0}})],[n.APP_HIDE_PANEL,n=>{const{appId:o,openPanels:r,layoutRefs:i,interfaceType:a}=t.current,s=document.getElementById(le(o,n));s?.contains(document.activeElement)&&dn({triggeringElement:r[n]?.props?.triggeringElement,viewportRef:i.viewportRef,interfaceType:a}),e.current({type:"CLOSE_PANEL",payload:n})}],[n.APP_ADD_CONTROL,({id:t,config:n})=>e.current({type:"ADD_CONTROL",payload:{id:t,config:n}})],[n.APP_SET_APPLICATION_MODE,({id:t,include:n,exclude:o})=>e.current({type:"SET_APPLICATION_MODE",payload:{id:t,include:n,exclude:o}})],[n.APP_CLEAR_APPLICATION_MODE,t=>e.current({type:"CLEAR_APPLICATION_MODE",payload:t})]])(u,p);return e.forEach(([e,t])=>d.on(e,t)),()=>{e.forEach(([e,t])=>d.off(e,t))}},[d])};function _o(e){const t=X(),{pluginRegistry:n}=S(),o=u(jt);E(()=>{if(!t?.dispatch||!o)return;const{dispatch:r}=t;let i=0;const a=e=>{i++,r(e)};n.registeredPlugins.forEach(n=>{(n?.manifest?.buttons??[]).flatMap(e=>[e,...e.menuItems??[]]).forEach(o=>function({btn:e,pluginId:t,appState:n,dispatch:o,evaluateProp:r}){[{prop:"enableWhen",state:n.disabledButtons,action:"TOGGLE_BUTTON_DISABLED",invert:!0,key:"isDisabled"},{prop:"hiddenWhen",state:n.hiddenButtons,action:"TOGGLE_BUTTON_HIDDEN",key:"isHidden"},{prop:"pressedWhen",state:n.pressedButtons,action:"TOGGLE_BUTTON_PRESSED",key:"isPressed"},{prop:"expandedWhen",state:n.expandedButtons,action:"TOGGLE_BUTTON_EXPANDED",key:"isExpanded"}].forEach(({prop:n,state:i,action:a,key:s,invert:l})=>{if("function"==typeof e[n])try{const c=r(e[n],t),d=l?!c:c;i.has(e.id)!==d&&o({type:a,payload:{id:e.id,[s]:d}})}catch(t){console.warn(`${n} error for button ${e.id}:`,t)}})}({btn:o,pluginId:n.id,appState:t,dispatch:a,evaluateProp:e}))}),0!==i||t.arePluginsEvaluated||r({type:"PLUGINS_EVALUATED"})},[t,o,e])}const Ao=({plugin:e})=>{const t=function(e){const t=m(null),n=S(),o=X(),r=Pe(),i=Gt(),a=Zt(e);return f(()=>{t.current={appConfig:n,appState:o,mapState:r,services:i,mapProvider:n.mapProvider,pluginState:a}}),t}(e.id);f(()=>{e.api&&e._originalPlugin&&Object.entries(e.api).forEach(([n,o])=>{e._originalPlugin[n]=function(e,{pluginId:t,pluginConfig:n,stateRef:o}){return(...r)=>{const i=o.current;if(!i)throw new Error(`Plugin API "${t}" called before state is initialized`);return e({...i,pluginConfig:n,pluginId:t},...r)}}(o,{pluginId:e.id,pluginConfig:e?.config||{},stateRef:t})})},[e,t]);const{InitComponent:n}=e,o=b(()=>{const{api:t,...n}=e?.config||{};return n},[e]);if(!n)return null;const r=Yt(n);return C(r,{pluginId:e.id,pluginConfig:o})},So=()=>{const{pluginRegistry:e}=S();Io(),(()=>{const{eventBus:e,hints:t}=Gt(),{layoutRefs:o}=X(),r=m(!1);f(()=>{const o=({text:e,options:n}={})=>{e&&t.show(e,n)},r=()=>t.dismiss();return e.on(n.APP_SHOW_HINT,o),e.on(n.APP_DISMISS_HINT,r),()=>{e.off(n.APP_SHOW_HINT,o),e.off(n.APP_DISMISS_HINT,r)}},[e,t]),f(()=>t.subscribe(e=>{r.current=Boolean(e)}),[t]),f(()=>{const e=e=>{if("Escape"!==e.key||!r.current)return;const n=o.appContainerRef?.current;n&&!n.contains(e.target)||t.dismiss()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,o])})();const t=kn();return _o(t),function(){const e=S()?.backAndContinue,{dispatch:t}=X(),n=Pe(),o=u(jt),r=m(!0);E(()=>{if("function"!=typeof e?.continueEnabledWhen)return;let i=!1;try{i=e.continueEnabledWhen({pluginStates:o?.state??{},mapState:n})}catch(e){console.warn("continueEnabledWhen error:",e)}const a=!i;r.current!==a&&(r.current=a,t({type:"TOGGLE_BUTTON_DISABLED",payload:{id:"journeyContinue",isDisabled:a}}))},[e,o,n,t])}(),C(_,{children:e.registeredPlugins.map((e,n)=>C(Ao,{plugin:e,evaluateProp:t},`init-${e.id}-${n}`))})},Mo=(e,t,n)=>{const o=(e,t)=>e[0]===t[0]&&e[1]===t[1],r=t.filter(t=>{const r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]);let a=!1;return a="ArrowUp"===n?t[1]<=e[1]&&i>=r:"ArrowDown"===n?t[1]>e[1]&&i>=r:"ArrowLeft"===n?t[0]<=e[0]&&i<r:"ArrowRight"!==n||t[0]>e[0]&&i<r,a&&!o(t,e)});r.length||r.push(e);const i=t=>Math.hypot(e[0]-t[0],e[1]-t[1]),a=r.reduce((e,t)=>i(t)<i(e)?t:e,r[0]);return t.findIndex(e=>o(e,a))};const To=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter"]),wo=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]),ko=(e,t)=>{if(!t)return null;const n=e.filter(e=>null!=e.x&&null!=e.y);if(!n.length)return null;const o=n.map(e=>[e.x,e.y]);return n[Mo([t.x,t.y],o,void 0)].id},xo=(e,t,n,o)=>{const r=e.find(e=>n.includes(e.id));return r?r.id:t&&e.some(e=>e.id===t)?t:ko(e,o)??e[0].id},Lo=(e,t,n)=>{const o=Array.from(e?.children??[]).find(e=>e.dataset.id===String(t));o&&(n.current=!0,o.focus({preventScroll:!0}),n.current=!1)};function Oo({spatialListRef:e,viewportRef:t,items:o,eventBus:r,activeItemIdRef:i,lastActiveIdRef:a,setActiveItemId:s,isInternalFocusMoveRef:l,hints:c,currentHintRef:d}){f(()=>{const u=e.current;if(!u)return;const p=e=>{a.current=e,s(e),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:e}),Lo(u,e,l)},f=e=>{p(function(e,t,n){const o=e.filter(e=>null!=e.x&&null!=e.y);if(!o.length)return t;const r=o.map(e=>[e.x,e.y]),i=o.findIndex(e=>e.id===t),a=-1===i?r[0]:r[i],s=Mo(a,r,n);return o[s]?.id??t}(o,i.current,e.key))},m=e=>{"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),d.current?c.dismiss():t.current?.focus()):e.altKey&&wo.has(e.key)?(e.preventDefault(),e.stopPropagation(),f(e)):"ArrowDown"===e.key||"ArrowUp"===e.key||"Home"===e.key||"End"===e.key?(e.preventDefault(),e.stopPropagation(),p(((e,t,n)=>{if(!n.length)return e;if("Home"===t)return n[0].id;if("End"===t)return n[n.length-1].id;const o=n.findIndex(t=>t.id===e);return"ArrowDown"===t?-1===o?n[0].id:n[Math.min(o+1,n.length-1)].id:-1===o?n[n.length-1].id:n[Math.max(o-1,0)].id})(i.current,e.key,o))):"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),r?.emit(n.MAP_SELECT_ITEM))},h=e=>{(e=>{e.altKey&&To.has(e.key)&&e.stopPropagation()})(e)};return u.addEventListener("keydown",m),u.addEventListener("keyup",h),()=>{u.removeEventListener("keydown",m),u.removeEventListener("keyup",h)}},[t,e,o,r])}function Bo({viewportRef:e,spatialListRef:t,items:o=[],eventBus:r,hints:i,centerScreenPoint:a}){const[s,l]=y(null),[c,d]=y([]),u=m(!1),p=m(null),h=m(null),g=m([]),b=m(null),v=m(!1);f(()=>i.subscribe(e=>{b.current=e}),[i]),h.current=s,g.current=c,function({eventBus:e,lastActiveIdRef:t,setActiveItemId:o,setSelectedIds:r}){f(()=>{if(!e)return;const i=({id:e})=>{null!==e&&(t.current=e),o(e)},a=({selectedFeatures:e=[],selectedMarkers:t=[]})=>{r([...e.map(e=>String(e.featureId)),...t])};return e.on(n.MAP_SET_ACTIVE_ITEM,i),e.on("interact:selectionchange",a),()=>{e.off(n.MAP_SET_ACTIVE_ITEM,i),e.off("interact:selectionchange",a)}},[e])}({eventBus:r,lastActiveIdRef:p,setActiveItemId:l,setSelectedIds:d}),function({items:e,eventBus:t,isFocusedRef:o,spatialListRef:r,isInternalFocusMoveRef:i,lastActiveIdRef:a,activeItemIdRef:s,selectedIdsRef:l,setActiveItemId:c,centerScreenPoint:d}){f(()=>{if(!o.current)return;if(!e.length)return c(null),void t?.emit(n.MAP_SET_ACTIVE_ITEM,{id:null});if(e.some(e=>e.id===s.current))return;const u=xo(e,a.current,l.current,d);a.current=u,c(u),t?.emit(n.MAP_SET_ACTIVE_ITEM,{id:u}),Lo(r.current,u,i)},[e])}({items:o,eventBus:r,isFocusedRef:u,spatialListRef:t,isInternalFocusMoveRef:v,lastActiveIdRef:p,activeItemIdRef:h,selectedIdsRef:g,setActiveItemId:l,centerScreenPoint:a}),Oo({spatialListRef:t,viewportRef:e,items:o,eventBus:r,activeItemIdRef:h,lastActiveIdRef:p,setActiveItemId:l,isInternalFocusMoveRef:v,hints:i,currentHintRef:b}),function({viewportRef:e,spatialListRef:t,isFocusedRef:n}){f(()=>{const o=e.current;if(!o)return;const r=o=>{n.current&&!t.current?.contains(o.target)&&e.current?.focus()};return o.addEventListener("pointerdown",r),()=>{o.removeEventListener("pointerdown",r)}},[e,t])}({viewportRef:e,spatialListRef:t,isFocusedRef:u});let E=null;if(o.length){E=p.current&&o.some(e=>e.id===p.current)?p.current:ko(o,a)??o[0].id}return{activeItemId:s,tabbableId:E,selectedIds:c,onFocus:()=>{if(u.current=!0,v.current)return;if(!o.length)return;const e=xo(o,p.current,c,a);p.current=e,l(e),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:e}),Lo(t.current,e,v)},onBlur:()=>{v.current||(u.current=!1,l(null),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:null}))},selectItem:e=>{p.current=e,l(e),r?.emit(n.MAP_SET_ACTIVE_ITEM,{id:e}),Lo(t.current,e,v),r?.emit(n.MAP_SELECT_ITEM)}}}const Do="map:setspatiallist",No="map:setspatiallistsuppressed";const $o=["wheel","keydown","keyup"];const Ho=({id:e,center:t,zoom:n,bounds:o,urlPosition:r="sync"},i=window.location.search)=>{const a="none"===r?null:((e,t)=>{const n=new URLSearchParams(t),o=n.get(`${e}:center`),r=n.get(`${e}:zoom`);if(!o||!r)return null;const[i,a]=o.split(",").map(Number);return{center:[i,a],zoom:Number(r)}})(e,i);return a?{center:a.center,zoom:a.zoom}:o?{bounds:o}:{center:t,zoom:n}};function zo(){const{id:e,urlPosition:t}=S(),{eventBus:o}=Gt();f(()=>{if(!e||"sync"!==t)return;const r=({current:t})=>{((e,t,n=window.location.href)=>{const o=new URL(n||"http://localhost"),r=new Set,i=[];if(t.center){const n=`${e}:center`;r.add(n),i.push(`${n}=${t.center[0]},${t.center[1]}`)}if(null!=t.zoom){const n=`${e}:zoom`;r.add(n),i.push(`${n}=${t.zoom}`)}const a=[];o.searchParams.forEach((e,t)=>{r.has(t)||a.push(`${t}=${e}`)});const s=[...a,...i].join("&"),l=s?"?"+s:"",c=`${o.origin}${o.pathname}${l}${o.hash}`;window.history.replaceState(window.history.state,"",c)})(e,{center:t.center,zoom:t.zoom})};return o.on(n.MAP_STATE_UPDATED,r),()=>o.off(n.MAP_STATE_UPDATED,r)},[e,t])}const Fo=({direction:e})=>`Map moved ${e}.`,Vo=({from:e,to:t,areaDimensions:n,isAtMaxZoom:o,isAtMinZoom:r})=>`Map zoomed ${t>e?"in":"out"}${o?" (Maximum zoom)":""}${r?" (Minimum zoom)":""}. New area approximately ${n}.`,Wo=({areaDimensions:e,isAtMaxZoom:t,isAtMinZoom:n})=>`New area approximately ${e}${t?" (Maximum zoom)":""}${n?" (Minimum zoom)":""}.`,Go=({isAtMaxZoom:e,isAtMinZoom:t})=>`No change, ${e?"maximum zoom reached":""}${t?"minimum zoom reached":""}.`;function jo(){const{mapProvider:e}=S(),{eventBus:t,announce:o,mapFocus:r}=Gt();f(()=>{const i=({previous:t,current:n})=>{if(!t?.center||!n?.center)return;if(r.isHoldingAnnouncements())return;const i=((e,t,n)=>{const o=e.zoom!==t.zoom,r=e.center[0]!==t.center[0]||e.center[1]!==t.center[1],i=n.getAreaDimensions();if(r&&!o){const o=n.getCardinalMove(e.center,t.center);return Fo({direction:o,areaDimensions:i})}return!r&&o?Vo({...t,from:e.zoom,to:t.zoom,areaDimensions:i}):r||o?Wo({...t,areaDimensions:i}):Go({...t})})(t,n,e);i&&o(i,"action")};return t.on(n.MAP_STATE_UPDATED,i),()=>{t.off(n.MAP_STATE_UPDATED,i)}},[e,o,r])}function Uo(e,t,n){if(null!==e)for(var o,r,i,a,s,l,c,d,u=0,p=0,f=e.type,m="FeatureCollection"===f,h="Feature"===f,g=m?e.features.length:1,b=0;b<g;b++){s=(d=!!(c=m?e.features[b].geometry:h?e.geometry:e)&&"GeometryCollection"===c.type)?c.geometries.length:1;for(var y=0;y<s;y++){var v=0,E=0;if(null!==(a=d?c.geometries[y]:c)){l=a.coordinates;var R=a.type;switch(u=0,R){case null:break;case"Point":if(!1===t(l,p,b,v,E))return!1;p++,v++;break;case"LineString":case"MultiPoint":for(o=0;o<l.length;o++){if(!1===t(l[o],p,b,v,E))return!1;p++,"MultiPoint"===R&&v++}"LineString"===R&&v++;break;case"Polygon":case"MultiLineString":for(o=0;o<l.length;o++){for(r=0;r<l[o].length-u;r++){if(!1===t(l[o][r],p,b,v,E))return!1;p++}"MultiLineString"===R&&v++,"Polygon"===R&&E++}"Polygon"===R&&v++;break;case"MultiPolygon":for(o=0;o<l.length;o++){for(E=0,r=0;r<l[o].length;r++){for(i=0;i<l[o][r].length-u;i++){if(!1===t(l[o][r][i],p,b,v,E))return!1;p++}E++}v++}break;case"GeometryCollection":for(o=0;o<a.geometries.length;o++)if(!1===Uo(a.geometries[o],t))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}var Zo=function(e,t={}){if(null!=e.bbox&&!0!==t.recompute)return e.bbox;const n=[1/0,1/0,-1/0,-1/0];return Uo(e,e=>{n[0]>e[0]&&(n[0]=e[0]),n[1]>e[1]&&(n[1]=e[1]),n[2]<e[0]&&(n[2]=e[0]),n[3]<e[1]&&(n[3]=e[1])}),n};const Ko=(e,t,n=1)=>{const[o,r,i,a]=(e=>Array.isArray(e)?e.flat():Zo(e))(e),s=[[o,r],[o,a],[i,r],[i,a]].map(t),l=s.map(e=>e.x*n),c=s.map(e=>e.y*n);return{left:Math.min(...l),top:Math.min(...c),right:Math.max(...l),bottom:Math.max(...c)}},Yo=(e,t)=>({left:e.left-t.left,top:e.top-t.top,right:e.right-t.left,bottom:e.bottom-t.top}),qo=e=>[(e.left+e.right)/2,(e.top+e.bottom)/2],Xo=(e,t)=>e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top,Qo=e=>Array.from(e?.children??[]).flatMap(e=>e.hidden?[]:e.getClientRects().length>0?[e.getBoundingClientRect()]:e.classList.contains("im-c-control-wrapper")?Qo(e):[]),Jo=e=>e.children.length>0&&0===Qo(e).length?0:e.offsetHeight,er=e=>e.classList.contains("im-c-panel")&&!e.hidden,tr=(e,t)=>Array.from(e?.current?.children??[]).filter(er).map(e=>e.getBoundingClientRect()).filter(e=>e.width>0&&e.height>0).map(e=>Yo(e,t)),nr=e=>e.right-e.left,or=e=>e.bottom-e.top,rr=(e,t)=>e.length?e.reduce((e,t)=>e+t,0)+t*(e.length-1):0,ir=e=>e.length?Math.max(...e.map(nr)):0,ar=e=>{const t=e?.current?.querySelector(".im-c-button-group");return t?t.offsetWidth:0},sr=(e,t,n)=>rr(e.map(or),n)>t,lr=(e,t)=>2*(e-2*t)/3,cr=({main:e,panels:t,width:n,base:o,availableW:r,availableH:i,gap:a})=>{const s=(e,t)=>((e,t,n,o)=>rr([ir(e),ir(t)].filter(e=>e>0),o)>n?[...e,...t]:[])(n.isLeftCleared?[]:e,n.isRightCleared?[]:t,r/2,a),l=s(t.topLeft,t.topRight),c=s(t.bottomLeft,t.bottomRight),d=l.length?Math.max(...l.map(e=>e.bottom))+a:0,u=c.length?e.offsetHeight-Math.min(...c.map(e=>e.top))+a:0,p=Math.max(o.top,Math.min(d,lr(e.offsetHeight,a))),f=Math.max(o.bottom,Math.min(u,lr(e.offsetHeight,a))),m=e.offsetHeight-p-f<i/4;return{top:m?o.top:p,bottom:m?o.bottom:f}},dr=({mainRef:e,leftRef:t,rightRef:n,actionsRef:o,bottomRef:r,topRef:i,leftTopRef:a,leftBottomRef:s,rightTopRef:l,rightBottomRef:c})=>{if([e,t,n,o,r].some(e=>!e?.current))return;const d=e.current,u=t.current,p=o.current,f=r.current,m=getComputedStyle(document.documentElement),h=Number.parseInt(m.getPropertyValue("--divider-gap"),10),g=Number.parseInt(m.getPropertyValue("--primary-gap"),10),b=d.getBoundingClientRect(),y=tr(a,b),v=tr(s,b),E=tr(l,b),R=tr(c,b),P=[...y,...v],C=[...E,...R],I=Math.max(ar(t),ar(n)),_=(e=>{const t=Math.max(0,...Array.from(e?.children??[],Jo));return{height:t,bottom:(e?.offsetTop??0)+t}})(i?.current),A={left:d.offsetLeft+u.offsetLeft+I+h,right:u.offsetLeft+I+h,top:Math.max(u.offsetTop,n.current.offsetTop,_.bottom),bottom:Math.max(g+_.height,d.offsetHeight-p.offsetTop+h,d.offsetHeight-f.offsetTop-f.offsetHeight)},S=d.offsetHeight-A.top-A.bottom,M=d.offsetWidth-(A.left-d.offsetLeft)-A.right,T=(({main:e,leftColumn:t,rightColumn:n,base:o,availableW:r,availableH:i,gap:a})=>{const s=sr(t,i/2,a)?e.offsetLeft+Math.max(...t.map(e=>e.right))+a:0,l=sr(n,i/2,a)?e.offsetWidth-Math.min(...n.map(e=>e.left))+a:0,c=Math.max(o.left,Math.min(s,e.offsetLeft+lr(e.offsetWidth,a))),d=Math.max(o.right,Math.min(l,lr(e.offsetWidth,a))),u=e.offsetWidth-(c-e.offsetLeft)-d<r/4,p=u?o.left:c,f=u?o.right:d;return{left:p,right:f,isLeftCleared:s>0&&p>=s,isRightCleared:l>0&&f>=l}})({main:d,leftColumn:P,rightColumn:C,base:A,availableW:M,availableH:S,gap:h}),w=cr({main:d,panels:{topLeft:y,topRight:E,bottomLeft:v,bottomRight:R},width:T,base:A,availableW:M,availableH:S,gap:h});return{left:T.left,right:T.right,top:w.top,bottom:w.bottom}},ur=".im-c-panel--banner",pr="im-o-app__attributions--stacked",fr="im-o-app__top--wrapped",mr=e=>e?.current?.offsetHeight??0,hr=e=>e?.current?.offsetWidth??0,gr=(e,t)=>{const n=t.filter(e=>e?.offsetHeight).map(t=>t.getBoundingClientRect().top-e.top);return n.length?Math.min(...n):null},br=e=>Qo(e?.current).length>0,yr=(e,t,n)=>br(e)&&br(t)?n:0,vr=(e,t,n,o)=>{if(!t)return 0;return Qo(n?.current).some(e=>(e=>t.left-o<e.right&&t.right+o>e.left)(e)&&(e=>e.bottom>t.top-o)(e))?e.bottom-t.top:0};function Er({appContainer:e,root:t,top:n,bannerRef:o,leftRef:r,rightRef:i,isMobile:a,dividerGap:s,primaryGap:l}){const c=o?.current;var d;a&&(d=c,d?.querySelectorAll(ur).forEach(e=>{e.style.width=""}));const u=mr(o),p=u>0,f=(m=hr(r),h=hr(i),m||h?Math.max(m,h):0);var m,h;const g=Number.parseInt(getComputedStyle(t).getPropertyValue("--banner-preferred-width"),10),b=(e=>{const t=Array.from(e?.querySelectorAll(ur)??[]).map(e=>Number.parseInt(e.style.width,10)).filter(e=>!Number.isNaN(e));return t.length?Math.max(...t):null})(c)??g;e.style.setProperty("--banner-preferred-width",`${b}px`);const y=n.offsetWidth-2*f-2*s;const v=!a&&((e,t)=>e>=t)(y,b);c?.classList.toggle("im-o-app__banner--docked",v);const E=`${((e,t,n,o)=>e?t+n+o:t)(v,l,f,s)}px`;e.style.setProperty("--banner-left",E),e.style.setProperty("--banner-right",E);const R=p&&!v,P=p?n.offsetTop+n.offsetHeight:0;return e.style.setProperty("--banner-top",`${P}px`),{isBannerStacked:R,bannerTop:P,bannerHeight:u}}function Rr({appContainer:e,main:t,actions:n,columns:o,gap:r}){const i=(t,n,o)=>e.style.setProperty(`--${t}-${n}`,o);Object.entries(o).forEach(([e,{offsetTop:t,baseOffsetBottom:n,topRef:o,bottomRef:a}])=>{i(e,"offset-top",`${t}px`),i(e,"offset-bottom",`${n}px`),i(e,"top-slot-max-height","none"),i(e,"slot-gap",`${yr(o,a,r)}px`)});const a=t.getBoundingClientRect(),s=(e=>{const t=e?.querySelector(".im-c-actions");return t?.offsetHeight?t.getBoundingClientRect():null})(n);return Object.entries(o).map(([e,{offsetTop:n,baseOffsetBottom:o,topRef:l,bottomRef:c}])=>{const d=(({mainRect:e,barRect:t,mainHeight:n,baseOffsetBottom:o,offsetTop:r,topRef:i,bottomRef:a,gap:s})=>{const l=vr(e,t,i,s),c=vr(e,t,a,s);return{offsetBottom:c>0?Math.max(o,c+s):o,topSlotMaxHeight:l>0?`${Math.max(0,n-l-s-r)}px`:"none"}})({mainRect:a,barRect:s,mainHeight:t.offsetHeight,baseOffsetBottom:o,offsetTop:n,topRef:l,bottomRef:c,gap:r});return i(e,"offset-bottom",`${d.offsetBottom}px`),i(e,"top-slot-max-height",d.topSlotMaxHeight),t.offsetHeight-d.offsetBottom-n-((e,t,n)=>mr(e)+mr(t)+yr(e,t,n))(l,c,r)})}function Pr(e,t){const{appContainerRef:n,mainRef:o,topRef:r,topLeftColRef:i,topRightColRef:a,bottomRef:s,bottomLeftColRef:l,bottomRightColRef:c,bottomRightRef:d,attributionsRef:u,leftTopRef:p,leftBottomRef:f,rightTopRef:m,rightBottomRef:h,drawerRef:g,actionsRef:b,bannerRef:y,leftRef:v,rightRef:E}=e,R=n.current,P=o.current,C=r.current,I=s.current,_=u.current;if([P,C,I].some(e=>!e))return;const A=document.documentElement,S=getComputedStyle(A),M=Number.parseInt(S.getPropertyValue("--divider-gap"),10),T=Number.parseInt(S.getPropertyValue("--primary-gap"),10);!function(e){e.classList.remove(fr),e.classList.toggle(fr,e.scrollWidth>e.clientWidth+1)}(C);const w="mobile"===t,{isBannerStacked:k,bannerTop:x,bannerHeight:L}=Er({appContainer:R,root:A,top:C,bannerRef:y,leftRef:v,rightRef:E,isMobile:w,dividerGap:M,primaryGap:T}),O=e=>k?x+L+M:e+C.offsetTop;!function({appContainer:e,bottom:t,attributionsCol:n,attributions:o,dividerGap:r,primaryGap:i}){const a=(e=>{const t=e?.firstElementChild;if(!t)return 0;const n=t.style.whiteSpace;t.style.whiteSpace="nowrap";const o=t.scrollWidth;return t.style.whiteSpace=n,o})(o)>(n?.offsetWidth??0);o.classList.toggle(pr,a);const s=n?Math.round(n.getBoundingClientRect().left-t.getBoundingClientRect().left):0;e.style.setProperty("--attributions-left",`${s}px`);const l=a?0:Math.max(0,o.offsetHeight+r-i);e.style.setProperty("--bottom-right-clearance",`${l}px`)}({appContainer:R,bottom:I,attributionsCol:c?.current,attributions:_,dividerGap:M,primaryGap:T});const B=b?.current,D=l?.current,N=P.getBoundingClientRect(),$=P.offsetHeight-I.offsetTop-I.offsetHeight,H=e=>{const t=gr(N,e);return null===t?$:P.offsetHeight-t+M},z=_.classList.contains(pr),F={left:{offsetTop:O(Jo(i.current)),baseOffsetBottom:H([D,z&&_]),topRef:p,bottomRef:f},right:{offsetTop:O(Jo(a.current)),baseOffsetBottom:H([d?.current,_]),topRef:m,bottomRef:h}},V=Rr({appContainer:R,main:P,actions:B,columns:F,gap:M});R.style.setProperty("--drawer-max-height",((e,t,n)=>br(e)?`${Math.max(0,Math.floor(e.current.offsetHeight+t-n))}px`:"none")(g,Math.min(...V),((e,t)=>{if(!t)return 0;const n=e.getBoundingClientRect(),o=Number.parseFloat(getComputedStyle(t).marginBottom)||0,r=Number.parseFloat(getComputedStyle(e).paddingBottom)||0;return Math.max(0,t.getBoundingClientRect().bottom+o-(n.bottom-r))})(P,B))),R.style.setProperty("--hint-bottom",`${(({main:e,mainRect:t,bottom:n,bottomLeftCol:o,attributions:r,actionsEl:i,gap:a})=>{const s=gr(t,[o,r])??n.offsetTop+n.offsetHeight,l=i?.offsetHeight?e.offsetHeight-i.offsetTop:0;return Math.max(e.offsetHeight-s,l)+a})({main:P,mainRect:N,bottom:I,bottomLeftCol:D,attributions:_,actionsEl:B,gap:M})}px`)}const Cr=(e,t)=>Object.entries(e).reduce((e,[n,o])=>(e[n]=Math.round(o/t),e),{}),Ir=["leftTopRef","leftBottomRef","rightTopRef","rightBottomRef"],_r=[...Ir,"drawerRef"],Ar=100,Sr=["top","right","bottom","left"],Mr=({box:e,safeZone:t,panels:n=[],preferPan:o=!1,paddingPercent:r})=>{const i=(e=>{const t=null!==e&&"object"==typeof e;return Object.fromEntries(Sr.map(n=>{return[n,(o=t?e[n]:e,Math.min(Math.max(Number(o)||0,0),25))];var o}))})(r),a=t.right-t.left,s=t.bottom-t.top,l={top:s*i.top/Ar,right:a*i.right/Ar,bottom:s*i.bottom/Ar,left:a*i.left/Ar};if(!o)return{type:"fit",margin:l};if(((e,t)=>e.left>=t.left&&e.right<=t.right&&e.top>=t.top&&e.bottom<=t.bottom)(e,t)&&!n.some(t=>Xo(e,t)))return{type:"none"};const c={left:t.left+l.left,top:t.top+l.top,right:t.right-l.right,bottom:t.bottom-l.bottom};if(!(e.right-e.left<=c.right-c.left&&e.bottom-e.top<=c.bottom-c.top))return{type:"fit",margin:l};const[d,u]=qo(e),[p,f]=qo(c);return{type:"pan",offset:[d-p,u-f]}},Tr={type:"fit"},wr=(e,{safeZone:t,mapProvider:n,scale:o})=>{if("pan"===e.type){const[r,i]=e.offset,[a,s]=qo(t);return{type:"pan",center:n.screenToMap({x:(a+r)/o,y:(s+i)/o})}}return"fit"===e.type?(r=e.margin,Object.values(r).some(e=>e>0)?{type:"fit",margin:Cr(e.margin,o)}:Tr):e;var r},kr=({bounds:e,safeZoneInset:t,mapProvider:n,layoutRefs:o,mapSize:r,preferPan:i,paddingPercent:a})=>{const s=o.viewportRef?.current;if(!t||!s||!i&&!a)return Tr;const l=ve(r),c={left:t.left,top:t.top,right:s.offsetWidth-t.right,bottom:s.offsetHeight-t.bottom},d=i?Ko(e,e=>n.mapToScreen(e),l):void 0,u=i?((e,t)=>{const n=t.getBoundingClientRect();return Ir.flatMap(t=>tr(e[t],n))})(o,s):[];return wr(Mr({box:d,safeZone:c,panels:u,preferPan:i,paddingPercent:a}),{safeZone:c,mapProvider:n,scale:l})},xr=()=>{const{mapProvider:e,eventBus:t}=S(),{dispatch:o,layoutRefs:r,breakpoint:i}=X(),{mapSize:a}=Pe(),s=m(a);s.current=a;const l=m(i);l.current=i;const c=()=>(Pr(r,l.current),dr(r)),d=t=>{t&&("function"==typeof o&&o({type:"SET_SAFE_ZONE_INSET",payload:{safeZoneInset:t,syncMapPadding:!1}}),"function"==typeof e.setPadding&&e.setPadding(Cr(t,ve(s.current))))};f(()=>{if(!e)return;const t=e.fitToBounds,n=e.setView;return e.fitToBounds=(o,i)=>{if(!o)return;const{skipPaddingCalc:a=!1,preferPan:l=!1,paddingPercent:u}=(e=>"boolean"==typeof e?{skipPaddingCalc:e}:e??{})(i);if(a)return t.call(e,o);requestAnimationFrame(()=>{const i=c(),a=kr({bounds:o,safeZoneInset:i,mapProvider:e,layoutRefs:r,mapSize:s.current,preferPan:l,paddingPercent:u});"none"!==a.type&&(d(i),"pan"===a.type?n.call(e,{center:a.center}):a.margin?t.call(e,o,{padding:a.margin}):t.call(e,o))})},e.setView=({center:t,zoom:o})=>{t&&requestAnimationFrame(()=>{d(c()),n.call(e,{center:t,zoom:o})})},()=>{e.fitToBounds=t,e.setView=n}},[e,o,r,a]),((e,t)=>{f(()=>{if(!e||!t)return;const o=(t,n)=>e.fitToBounds(t,n),r=t=>e.setView(t);return t.on(n.MAP_FIT_TO_BOUNDS,o),t.on(n.MAP_SET_VIEW,r),()=>{t.off(n.MAP_FIT_TO_BOUNDS,o),t.off(n.MAP_SET_VIEW,r)}},[e,t])})(e,t)},Lr=()=>{const{id:e,mapProvider:t,eventBus:o}=S(),{layoutRefs:r,panelConfig:i,panelRegistry:a}=X(),{mapSize:s}=Pe(),l=kn(),c=m({panelConfig:i,panelRegistry:a,mapSize:s,evaluateProp:l});c.current={panelConfig:i,panelRegistry:a,mapSize:s,evaluateProp:l},f(()=>{if(!t||!o)return;const i=({panelId:n,...o})=>{const{panelConfig:i,panelRegistry:a,evaluateProp:s}=c.current,l=i?.[n]?i:a?.getPanelConfig()??i,{visibleGeometry:d,preferPan:u=!0,paddingPercent:p,pluginId:f}={...l?.[n],...o},m=s(d,f),h=r.appContainerRef.current?.querySelector(`#${le(e,n)}`);if(!m)return;const g=()=>{if(!h||!((e,t)=>_r.some(n=>t[n]?.current?.contains(e)))(h,r))return;const e=h.getBoundingClientRect();if(!e||0===e.width||0===e.height)return void requestAnimationFrame(g);const n=r.viewportRef?.current;(({visibleGeometry:e,panelRect:t,mapProvider:n,viewport:o,mapSize:r})=>{if(!o)return!1;const i=Ko(e,e=>n.mapToScreen(e),ve(r));return Xo(i,Yo(t,o.getBoundingClientRect()))})({visibleGeometry:m,panelRect:e,mapProvider:t,viewport:n,mapSize:c.current.mapSize})&&t.fitToBounds(m,{preferPan:u,paddingPercent:p})};requestAnimationFrame(g)};return o.on(n.APP_PANEL_OPENED,i),()=>{o.off(n.APP_PANEL_OPENED,i)}},[t,o])},Or=({mapContainerRef:e})=>{const t=S(),{id:o,mapProvider:r}=t,{safeZoneInset:i,breakpoint:a,isLayoutReady:s,syncMapPadding:l}=X(),{isMapReady:c,mapStyle:d,mapSize:u,center:p,zoom:h,bounds:g}=Pe(),b=m(!1),y=Ho({id:o,center:p,zoom:h,bounds:g,urlPosition:t.urlPosition});return f(()=>{if(i&&s&&d&&u&&!b.current)return requestAnimationFrame(()=>{r.initMap({...t,pixelRatio:window.devicePixelRatio*ye[u],container:e.current,padding:i,center:y.center,zoom:y.zoom,bounds:y.bounds,mapStyle:d,mapSize:u})}),b.current=!0,()=>{}},[i,s,d,u]),function(){const{mapProvider:e}=S(),{dispatch:t}=Pe(),{eventBus:o}=Gt(),r=m(null),i=m(!1);f(()=>{if(!e)return;const a=e=>{t({type:"MAP_MOVE",payload:e})},s=e=>{t({type:"MAP_MOVE_END",payload:e}),o.emit(n.MAP_STATE_UPDATED,{previous:r.current,current:e}),r.current=e},l=n=>{i.current||(r.current={center:e.getCenter(),zoom:e.getZoom()},i.current=!0),t({type:"MAP_FIRST_IDLE",payload:n})};return o.on(n.MAP_MOVE,a),o.on(n.MAP_MOVE_END,s),o.on(n.MAP_FIRST_IDLE,l),()=>{o.off(n.MAP_MOVE,a),o.off(n.MAP_MOVE_END,s),o.off(n.MAP_FIRST_IDLE,l)}},[e,t])}(),function(){const{mapProvider:e}=S(),{layoutRefs:t}=X(),{dispatch:o}=Pe(),{eventBus:r}=Gt();f(()=>{const i=t.appContainerRef?.current;if(!e||!i)return;let a=-1/0,s=!1;const l=()=>{a=Date.now()},c=()=>{s=!0,l()},d=()=>{s=!1},u=()=>{const e=s||Date.now()-a<=500;o({type:"MAP_MOVE_START",payload:{isUserMove:e}})};return i.addEventListener("pointerdown",c,!0),$o.forEach(e=>i.addEventListener(e,l,!0)),document.addEventListener("pointerup",d,!0),document.addEventListener("pointercancel",d,!0),r.on(n.MAP_MOVE_START,u),()=>{i.removeEventListener("pointerdown",c,!0),$o.forEach(e=>i.removeEventListener(e,l,!0)),document.removeEventListener("pointerup",d,!0),document.removeEventListener("pointercancel",d,!0),r.off(n.MAP_MOVE_START,u)}},[e,r,o])}(),zo(),jo(),xr(),Lr(),f(()=>{c&&l&&r.setPadding(Cr(i,ye[u]))},[c,u,a,i]),null};const Br=vo()?"Alt":"Ctrl",Dr={keydown:{ArrowUp:"panUp",ArrowDown:"panDown",ArrowLeft:"panLeft",ArrowRight:"panRight","+":"zoomIn","=":"zoomIn","-":"zoomOut",_:"zoomOut"},keyup:{"?":"showKeyboardControls","Alt+ArrowRight":"highlightNextLabel","Alt+ArrowLeft":"highlightNextLabel","Alt+ArrowUp":"highlightNextLabel","Alt+ArrowDown":"highlightNextLabel","Alt+Enter":"highlightLabelAtCenter",[`${Br}+i`]:"getInfo",[`${Br}+I`]:"getInfo",Escape:"clearSelection"}},Nr=e=>{let t;return t=/^Key[A-Z]$/.test(e.code)?e.code.slice(3):e.key,"Add"===t||"NumpadAdd"===t?t="+":"Subtract"!==t&&"NumpadSubtract"!==t||(t="-"),e.altKey?`Alt+${t}`:e.ctrlKey?`Ctrl+${t}`:t},$r=(e,t,n)=>{const o=Dr[t][n];return o&&e[o]?o:null};function Hr(e){const{mapProvider:t,panDelta:n,nudgePanDelta:r,zoomDelta:a,nudgeZoomDelta:s,readMapText:c}=S(),{dispatch:d,layoutRefs:u}=X(),{announce:p}=Gt();f(()=>{const f=e.current,m=u.appContainerRef?.current;if(!f||!m)return;const h=((e,t,{containerRef:n,dispatch:r,panDelta:a,nudgePanDelta:s,zoomDelta:c,nudgeZoomDelta:d,readMapText:u})=>{const p=e=>Jn(!e,s,a),f=e=>Jn(!e,d,c);return{showKeyboardControls:e=>{const t=e.target===n.current?"viewport":"listbox";r({type:"OPEN_PANEL",payload:{panelId:"keyboardHelp",props:{triggeringElement:e.target,context:t}}})},panUp:t=>e.panBy([0,-p(t.shiftKey)]),panDown:t=>e.panBy([0,p(t.shiftKey)]),panLeft:t=>e.panBy([-p(t.shiftKey),0]),panRight:t=>e.panBy([p(t.shiftKey),0]),zoomIn:t=>e.zoomIn(f(t.shiftKey)),zoomOut:t=>e.zoomOut(f(t.shiftKey)),getInfo:async n=>{if(!l())return void o.warn("Alt+I pressed but reverseGeocode has not been configured");const r=e.getCenter(),a=await i(e.getZoom(),r),s=e.getAreaDimensions?.();t(s?`${a}. Covering ${s}.`:`${a}.`,"action")},highlightNextLabel:n=>{if(!u||!e.highlightNextLabel)return;const o=e.highlightNextLabel(n.key);t(o,"action")},highlightLabelAtCenter:()=>{if(!u||!e.highlightLabelAtCenter)return;const n=e.highlightLabelAtCenter();t(n,"action")},clearSelection:()=>e?.clearHighlightedLabel?.()}})(t,p,{containerRef:e,dispatch:d,panDelta:n,nudgePanDelta:r,zoomDelta:a,nudgeZoomDelta:s,readMapText:c}),{handleKeyDown:g,handleKeyUp:b}=(e=>({handleKeyDown:t=>{const n=Nr(t),o=$r(e,"keydown",n);if(o)return e[o](t),void t.preventDefault();$r(e,"keyup",n)&&t.preventDefault()},handleKeyUp:t=>{const n=$r(e,"keyup",Nr(t));n&&(e[n](t),t.preventDefault())}}))(h);return f.addEventListener("keydown",g),m.addEventListener("keyup",b),()=>{f.removeEventListener("keydown",g),m.removeEventListener("keyup",b)}},[e,t,n,r,a,s])}const zr=()=>{const{mapStatusRef:e}=Gt();return C("div",{ref:e,role:"status",className:"im-u-visually-hidden"})},Fr={active:"M5.035 20H1v-2h4.035C5.525 11.069 11.069 5.525 18 5.035V1h2v4.035c6.931.49 12.475 6.034 12.965 12.965H37v2h-4.035c-.49 6.931-6.034 12.475-12.965 12.965V37h-2v-4.035C11.069 32.475 5.525 26.931 5.035 20zM19 7c-6.581.005-11.995 5.419-12 12 .005 6.581 5.419 11.995 12 12 6.581-.005 11.995-5.419 12-12-.005-6.581-5.419-11.995-12-12zm0 10a2.01 2.01 0 0 1 2 2 2.01 2.01 0 0 1-2 2 2.01 2.01 0 0 1-2-2 2.01 2.01 0 0 1 2-2z",inactive:"M5.035 20H1v-2h4.035a13.98 13.98 0 0 1 .246-1.8l1.96.399C7.083 17.375 7 18.178 7 19s.083 1.625.241 2.401l-1.96.399a13.98 13.98 0 0 1-.246-1.8zM20 5.035a13.98 13.98 0 0 1 1.8.246l-.399 1.96C20.625 7.083 19.822 7 19 7s-1.625.083-2.401.241l-.399-1.96a13.98 13.98 0 0 1 1.8-.246V1h2v4.035zm-2 27.93a13.98 13.98 0 0 1-1.8-.246l.399-1.96c.776.158 1.579.241 2.401.241s1.625-.083 2.401-.241l.399 1.96a13.98 13.98 0 0 1-1.8.246V37h-2v-4.035zM32.965 20a13.98 13.98 0 0 1-.246 1.8l-1.96-.399c.158-.776.241-1.579.241-2.401s-.083-1.625-.241-2.401l1.96-.399a13.98 13.98 0 0 1 .246 1.8H37v2h-4.035zM19 17a2.01 2.01 0 0 1 2 2 2.01 2.01 0 0 1-2 2 2.01 2.01 0 0 1-2-2 2.01 2.01 0 0 1 2-2zm3.8-9.385l.634-1.897c1.789.598 3.438 1.553 4.848 2.805l-1.327 1.496c-1.196-1.06-2.605-1.886-4.155-2.404zm5.181 3.43l1.496-1.327c1.252 1.41 2.207 3.059 2.805 4.848l-1.897.634c-.518-1.55-1.344-2.959-2.404-4.155zM30.385 22.8l1.897.634c-.598 1.789-1.553 3.438-2.805 4.848l-1.496-1.327c1.06-1.196 1.886-2.605 2.404-4.155zm-3.43 5.181l1.327 1.496c-1.41 1.252-3.059 2.207-4.848 2.805l-.634-1.897c1.55-.518 2.959-1.344 4.155-2.404zM15.2 30.385l-.634 1.897c-1.789-.598-3.438-1.553-4.848-2.805l1.327-1.496c1.196 1.06 2.605 1.886 4.155 2.404zm-5.181-3.43l-1.496 1.327c-1.252-1.41-2.207-3.059-2.805-4.848l1.897-.634c.518 1.55 1.344 2.959 2.404 4.155zM7.615 15.2l-1.897-.634c.598-1.789 1.553-3.438 2.805-4.848l1.496 1.327c-1.06 1.196-1.886 2.605-2.404 4.155zm3.43-5.181L9.718 8.523c1.41-1.252 3.059-2.207 4.848-2.805l.634 1.897c-1.55.518-2.959 1.344-4.155 2.404z"},Vr=()=>{const{id:e}=S(),{crossHairRef:t,crossHair:o}=(()=>{const{mapProvider:e}=S(),{safeZoneInset:t,expandedButtons:o}=X(),{eventBus:r}=Gt(),{crossHair:i,dispatch:a,mapSize:s}=Pe(),l=m({isMapControlsOpen:!1,isHideWaiting:!1}),c=(e,n,o)=>{if(!t)return;const r=n*ye[s],i=o*ye[s];e.style.transform=`translate(${r-t.left}px, ${i-t.top}px)`,e.style.left="0",e.style.top="0",e.style.display="block"},d=g(t=>{if(!t)return;((e,t,n,o,r,i)=>{e.pinToMap=(a,s)=>{const{x:l,y:c}=n.mapToScreen(a);i.isHideWaiting=!1,e.coords=a,o({type:"UPDATE_CROSS_HAIR",payload:{isPinnedToMap:!0,isVisible:!0,coords:a,state:s}}),r(t,l,c)},e.fixAtCenter=()=>{i.isHideWaiting=!1,t.style.left="50%",t.style.top="50%",t.style.transform="translate(0,0)",t.style.display="block",o({type:"UPDATE_CROSS_HAIR",payload:{isPinnedToMap:!1,isVisible:!0}})},e.remove=()=>{t.style.display="none",o({type:"UPDATE_CROSS_HAIR",payload:{isPinnedToMap:!1,isVisible:!1}})},e.show=()=>{i.isHideWaiting=!1,t.style.display="block",o({type:"UPDATE_CROSS_HAIR",payload:{isVisible:!0}})},e.hide=()=>{i.isMapControlsOpen?i.isHideWaiting=!0:(i.isHideWaiting=!1,t.style.display="none",o({type:"UPDATE_CROSS_HAIR",payload:{isVisible:!1}}))},e.setStyle=e=>{o({type:"UPDATE_CROSS_HAIR",payload:{state:e}})},e.getDetail=()=>{const t=e.isPinnedToMap?e.coords:n.getCenter();return{state:e.state,point:n.mapToScreen(t),zoom:n.getZoom(),coords:t}}})(i,t,e,a,c,l.current);const o=()=>{if(i.coords&&i.isPinnedToMap){const{x:n,y:o}=e.mapToScreen(i.coords);c(t,n,o)}};return r.on(n.MAP_RENDER,o),()=>{r.off(n.MAP_RENDER,o)}},[i,e,s,a,t]);f(()=>{i.coords&&i.isPinnedToMap&&i.pinToMap(i.coords,i.state)},[s]);const u=!!o?.has("mapControls");return l.current.isMapControlsOpen=u,f(()=>{!u&&l.current.isHideWaiting&&i.hide()},[u]),{crossHair:i,crossHairRef:d}})(),{isVisible:r,isPinnedToMap:i,state:a}=o;return C("button",{tabIndex:"-1",ref:t,id:`${e}-cross-hair`,className:"im-c-cross-hair-button","aria-label":"Target",onMouseDown:e=>e.preventDefault(),onClick:()=>o.activate?.(),style:{position:"absolute",left:i?0:"50%",top:i?0:"50%",display:r?"block":"none"},children:C("svg",{width:"38",height:"38",viewBox:"0 0 38 38",fillRule:"evenodd",fill:"currentColor","aria-hidden":"true",children:C("path",{d:Fr[a||"active"]})})})},Wr=P(({activeItemId:e,tabbableId:t,selectedIds:n=[],multiselectable:o=!1,items:r=[],label:i="Map features",focusable:a=!0,onFocus:s,onBlur:l,onSelectItem:c},d)=>{const{id:u}=S(),p=r.length>0,f=e??t;return C("ul",{id:`${u}-spatial-list`,ref:d,role:"listbox","aria-hidden":!p||void 0,"aria-label":i,"aria-describedby":`${u}-keyboard-desc`,"aria-multiselectable":o||void 0,className:"im-c-spatial-list",onFocus:s,onBlur:l,children:r.map(e=>C("li",{id:`${u}-spatial-list-item-${e.id}`,role:"option","data-id":e.id,tabIndex:a&&e.id===f?0:-1,"aria-selected":n.includes(e.id),style:null!=e.x?{left:e.x,top:e.y}:void 0,onClick:()=>c?.(e.id),children:e.label},e.id))})});Wr.displayName="SpatialList";const Gr=(e,t,n,o)=>{if(!t||!o)return{x:0,y:0};const{x:r,y:i}=t.mapToScreen(e);return{x:r*ye[n],y:i*ye[n]}},jr=(e,t,n,o,r)=>{e.forEach(e=>{const i=t.get(e.id);if(!i||!e.coords)return;const{x:a,y:s}=Gr(e.coords,n,o,r);i.style.transform=`translate(${a}px, ${s}px)`,i.style.display="block"})},Ur=()=>{const{mapProvider:e}=S(),{eventBus:t}=Gt(),{markers:o,dispatch:r,mapSize:i,isMapReady:a}=Pe(),s=m(new Map),l=m(o);E(()=>{e&&(l.current=o,o.markerRefs=s.current,o.add=(t,n,o)=>{const{x:s,y:l}=Gr(n,e,i,a);r({type:"UPSERT_LOCATION_MARKER",payload:{id:t,coords:n,...o,x:s,y:l,isVisible:!0}})},o.update=(t,n={})=>{const s=o.items.find(e=>e.id===t);if(!s)return;const{coords:l,...c}=n,d=l??s.coords,{x:u,y:p}=Gr(d,e,i,a);r({type:"UPSERT_LOCATION_MARKER",payload:{id:t,coords:d,...c,x:u,y:p}})},o.remove=e=>{r({type:"REMOVE_LOCATION_MARKER",payload:e})},o.getMarker=e=>o.items.find(t=>t.id===e))},[e,o,r,i]);const c=g(r=>l=>{if(!l)return void s.current.delete(r);s.current.set(r,l);const c=()=>{a&&e&&jr(o.items,s.current,e,i,a)};return t.on(n.MAP_RENDER,c),()=>{t.off(n.MAP_RENDER,c)}},[o,e,a,i]);return f(()=>{a&&e&&jr(o.items,s.current,e,i,a)},[i,o.items,e,a]),((e,t)=>{f(()=>{const o=(e={})=>{if(!e?.id||!e?.coords)return;const{id:n,coords:o,options:r}=e;t.current.add(n,o,r)};e.on(n.APP_ADD_MARKER,o);const r=(e={})=>{if(!e?.id)return;const{id:n,options:o}=e;t.current.update(n,o)};e.on(n.APP_UPDATE_MARKER,r);const i=e=>{e&&t.current.remove(e)};return e.on(n.APP_REMOVE_MARKER,i),()=>{e.off(n.APP_ADD_MARKER,o),e.off(n.APP_UPDATE_MARKER,r),e.off(n.APP_REMOVE_MARKER,i)}},[])})(t,l),{markers:o,markerRef:c}},Zr=({marker:e,mapId:t,markerRef:n})=>C("div",{ref:n(e.id),id:`${t}-marker-${e.id}`,className:"im-c-marker-wrapper im-c-marker-wrapper--label",style:{display:e.isVisible?"block":"none"},children:C("div",{role:"note",className:"im-c-marker__label im-c-marker__label--standalone",children:e.label})}),Kr=({marker:e,mapId:t,markerRef:n,isSelected:o,symbolProps:r})=>{const{resolvedSvg:i,viewBox:a,anchor:s,shapeId:l,scaledWidth:c,scaledHeight:d}=r;return I("div",{ref:n(e.id),id:`${t}-marker-${e.id}`,className:["im-c-marker-wrapper",`im-c-marker-wrapper--${ne(l)}`,o&&"im-c-marker-wrapper--selected"].filter(Boolean).join(" "),style:{display:e.isVisible?"block":"none",marginLeft:-s[0]*c+"px",marginTop:-s[1]*d+"px",width:`${c}px`,height:`${d}px`},children:[C("svg",{className:["im-c-marker__svg",`im-c-marker--${ne(l)}`,o&&"im-c-marker--selected"].filter(Boolean).join(" "),width:c,height:d,viewBox:a,overflow:"hidden","aria-hidden":"true",children:C("g",{dangerouslySetInnerHTML:{__html:i}})}),C("div",{role:"note",className:"im-c-marker__label",children:e.label})]})},Yr=({marker:e,mapId:t,markerRef:n,isSelected:o,symbolProps:r})=>{const{resolvedSvg:i,viewBox:a,anchor:s,shapeId:l,scaledWidth:c,scaledHeight:d}=r;return C("svg",{ref:n(e.id),id:`${t}-marker-${e.id}`,className:["im-c-marker",`im-c-marker--${ne(l)}`,o&&"im-c-marker--selected"].filter(Boolean).join(" "),width:c,height:d,viewBox:a,overflow:"hidden","aria-hidden":"true",style:{display:e.isVisible?"block":"none",marginLeft:-s[0]*c+"px",marginTop:-s[1]*d+"px"},children:C("g",{dangerouslySetInnerHTML:{__html:i}})})},qr=new Set(["id","coords","x","y","isVisible","symbol","svgContent","size","viewBox","anchor","selectedColor","label","showLabel"]),Xr=()=>{const{id:e}=S(),{mapStyle:t,mapSizeScale:o}=Pe(),{markers:r,markerRef:i}=Ur(),{symbolRegistry:a,eventBus:s}=Gt(),[l,c]=y(!1),[d,u]=y([]),[p,h]=y(null),g=m(null);if(f(()=>{const e=({active:e,interactionModes:t=[]})=>c(e&&t.includes("selectMarker")),t=({selectedMarkers:e=[]})=>u(e),o=({id:e})=>h(e);return s.on("interact:active",e),s.on("interact:selectionchange",t),s.on(n.MAP_SET_ACTIVE_ITEM,o),()=>{s.off("interact:active",e),s.off("interact:selectionchange",t),s.off(n.MAP_SET_ACTIVE_ITEM,o)}},[s]),f(()=>{g.current=document.querySelector(".im-c-viewport")},[]),((e,t,n)=>{f(()=>{if(!t)return;const o=n.current;if(!o)return;const r=t=>{const n=e.items.some(n=>{if(Fe(n))return!1;const o=e.markerRefs?.get(n.id);if(!o)return!1;const{left:r,top:i,right:a,bottom:s}=o.getBoundingClientRect();return t.clientX>=r&&t.clientX<=a&&t.clientY>=i&&t.clientY<=s});o.style.cursor=n?"pointer":""};return o.addEventListener("mousemove",r),()=>{o.removeEventListener("mousemove",r),o.style.cursor=""}},[e,t,n])})(r,l,g),!t)return;const b=a.getDefaults();return C(_,{children:r.items.map(n=>{const r=d.includes(n.id),s=n.id===p;if(Fe(n))return C(Zr,{marker:n,mapId:e,markerRef:i},n.id);const l=((e,t,n,o,r,i)=>{const a=n.getMarkerSymbolDef(e),s=Object.fromEntries(Object.entries(e).filter(([e])=>!qr.has(e))),l=n.resolveVariant(a,s,o,i),c=a?.viewBox??Te,[,,d,u]=c.split(" ").map(Number);return{resolvedSvg:l,viewBox:c,anchor:a?.anchor??Me,shapeId:e.symbol||t.symbol,scaledWidth:d*r,scaledHeight:u*r}})(n,b,a,t,o,((e,t)=>t?"active":e?"selected":"normal")(r,s));return n.showLabel&&n.label?C(Kr,{marker:n,mapId:e,markerRef:i,isSelected:r,symbolProps:l},n.id):C(Yr,{marker:n,mapId:e,markerRef:i,isSelected:r,symbolProps:l},n.id)})})},Qr=()=>{const{id:e,mapProvider:t,mapLabel:o,keyboardHintText:r,focusOnMount:i}=S(),{layoutRefs:a,safeZoneInset:l,dispatch:c}=X(),{mapSize:d,isMapReady:u}=Pe(),{eventBus:p,hints:h,mapFocus:g}=Gt(),b=m(null),v=m(null),{items:E,multiselectable:R,label:P,focusable:A}=function(e){const[t,n]=y([]),[o,r]=y(!1),[i,a]=y(void 0),[s,l]=y(!0),[c,d]=y(!1);return f(()=>{if(!e)return;const t=({items:e=[],multiselectable:t=!1,label:o,focusable:i=!0}={})=>{n(e),r(t),a(o),l(i)},o=({suppressed:e=!1}={})=>{d(e)};return e.on(Do,t),e.on(No,o),()=>{e.off(Do,t),e.off(No,o)}},[e]),{items:c?[]:t,multiselectable:o,label:i,focusable:s}}(p);let M=null;if(u){const e=t.mapToScreen(t.getCenter());M={x:e.x*ye[d],y:e.y*ye[d]}}const{activeItemId:T,tabbableId:w,selectedIds:k,onFocus:x,onBlur:L,selectItem:O}=Bo({viewportRef:a.viewportRef,spatialListRef:v,items:E,eventBus:p,hints:h,centerScreenPoint:M});f(()=>{const e=()=>c({type:"SET_LISTBOX_ACTIVE"});return p.on("interact:listboxcapable",e),()=>p.off("interact:listboxcapable",e)},[p]);Hr(a.viewportRef),function(e={}){const{mapProvider:t}=S(),{eventBus:n}=Gt();f(()=>{if(!t)return;const o={};return Object.entries(e).forEach(([e,t])=>{const r=e=>t(e);o[e]=r,n.on(e,r)}),()=>{Object.entries(o).forEach(([e,t])=>{n.off(e,t)})}},[t,e])}({[n.MAP_CLICK]:()=>t?.clearHighlightedLabel?.()});const{handleFocus:B,handleBlur:D}=function({containerRef:e,onViewportFocusChange:t}){return f(()=>{const n=e.current;if(!n)return;const o=e=>{"Escape"===e.key&&t(!1)};return n.addEventListener("keydown",o),()=>{n.removeEventListener("keydown",o)}},[e,t]),{handleFocus:()=>{"keyboard"===s()&&t(!0)},handleBlur:()=>{t(!1)}}}({containerRef:a.viewportRef,onViewportFocusChange:e=>{e?h.show(r,{duration:0}):h.dismiss()}});return f(()=>{i&&a.viewportRef?.current.focus()},[]),I(_,{children:[C(Or,{mapContainerRef:b}),I("div",{id:`${e}-viewport`,className:`im-c-viewport im-c-viewport--${d}`,"aria-label":o,role:"application",tabIndex:"0","data-map-keyboard-scope":!0,onFocus:B,onBlur:e=>{D(e),g.clear()},onKeyDown:()=>g.releaseAnnouncements(),onPointerDown:()=>g.releaseAnnouncements(),ref:a.viewportRef,"aria-describedby":`${e}-keyboard-desc`,"aria-controls":`${e}-spatial-list`,children:[C("div",{className:"im-c-viewport__map-container",ref:b,"aria-hidden":"true"}),C(zr,{}),C("div",{className:"im-c-viewport__safezone",style:l,ref:a.safeZoneRef,children:C(Vr,{})}),C("div",{className:"im-c-viewport__markers","aria-hidden":"true",children:C(Xr,{})})]}),C(Wr,{ref:v,activeItemId:T,tabbableId:w,selectedIds:k,multiselectable:R,items:E,label:P,focusable:A,onFocus:()=>{x(),h.show(r,{duration:0})},onBlur:()=>{L(),h.dismiss()},onSelectItem:O})]})};const Jr=()=>{const{mapStyle:e}=Pe();if(e?.logo)return C("img",{className:"im-c-logo",src:e.logo,alt:e.logoAltText})},ei=()=>{const{breakpoint:e}=X(),{mapStyle:t}=Pe();if(!t)return null;return(!("mobile"===e)||t.showAttributionOnMobile)&&C("div",{className:"im-c-attributions",dangerouslySetInnerHTML:{__html:t.attribution}})},ti=(e,t,n,o,r,i)=>{const a=m(o);a.current=o,E(()=>{const o=e.current;if(n){const e=((e,t)=>{const n={side:t.sideRef,banner:t.bannerRef,"top-left":t.topLeftColRef,"top-right":t.topRightColRef,"left-top":t.leftTopRef,"left-bottom":t.leftBottomRef,middle:t.middleRef,"right-top":t.rightTopRef,"right-bottom":t.rightBottomRef,"bottom-right":t.bottomRightRef,drawer:t.drawerRef,actions:t.actionsRef,modal:t.modalRef};if(e?.endsWith("-button")){const t=document.querySelector(`[data-button-slot="${e}"]`);return t?{current:t}:null}if(e?.endsWith("-panel")){const t=document.querySelector(`[data-panel-slot="${e}"]`);return t?{current:t}:null}return n[e]||null})(t,a.current);if(e?.current){const t=e.current.querySelector(":scope > .im-o-app__modal-backdrop");t?e.current.insertBefore(o,t):e.current.appendChild(o),o.style.display=""}}else o.parentElement===a.current.modalRef?.current&&a.current.appContainerRef?.current?.appendChild(o),o.style.display="none";return()=>{o.style.display="none"}},[n,t,r,e,i])},ni=({panelId:e,config:t,isOpen:n,openPanelProps:o,focusOnOpen:r,allowedModalPanelId:i,appState:a,isHiddenByApplicationMode:s})=>{const l=m(null),{breakpoint:c,isFullscreen:d,layoutRefs:u}=a,p=t[c],f=p?qt(p,c):null,h=Boolean(p&&f&&Qt(t,{targetSlot:f,isFullscreen:d})),g=!p?.modal||e===i,b=s({ids:[e],pluginId:t.pluginId,isModal:!!p?.modal});return ti(l,f,n&&h&&g&&!b,u,c),C(Rn,{panelId:e,panelConfig:t,props:o,focusOnOpen:r,html:t.html,label:t.label,isOpen:n,rootRef:l})},oi=({control:e,appState:t,isHiddenByApplicationMode:n})=>{const o=m(null),{breakpoint:r,isFullscreen:i,layoutRefs:a,openPanels:s}=t,l=e[r],c=n({ids:[e.id],pluginId:e.pluginId}),d=((e,{breakpoint:t,isFullscreen:n})=>{const o=e[t];return!(!o||!G.control.includes(o.slot)&&!o.slot?.endsWith("-panel")||!1===e.inline&&!n)})(e,{breakpoint:r,isFullscreen:i})&&!c,u=l?.slot||null,p=u?.endsWith("-panel")?Object.keys(s||{}).sort((e,t)=>e.localeCompare(t)).join(","):null;ti(o,u,d,a,r,p);const f=b(()=>({__html:e.html}),[e.html]);return C("div",{ref:o,className:`im-c-control im-c-control--${ne(e.id)}`,style:{display:"none"},dangerouslySetInnerHTML:f})},ri=()=>{const e=X(),t=xn(),{panelConfig:n={},controlConfig:o={},openPanels:r={},breakpoint:i}=e,a=b(()=>Object.entries(n).filter(([e,t])=>Xt(t)),[n]),s=b(()=>Object.values(o).filter(e=>Xt(e)),[o]),l=b(()=>Jt(r,n,i),[r,n,i]);return a.length||s.length?I(_,{children:[a.map(([n,o])=>C(ni,{panelId:n,config:o,isOpen:!!r[n],openPanelProps:r[n]?.props,focusOnOpen:r[n]?.focusOnOpen,allowedModalPanelId:l,appState:e,isHiddenByApplicationMode:t},n)),s.map(n=>C(oi,{control:n,appState:e,isHiddenByApplicationMode:t},n.id))]}):null},ii=e=>{const t=(new DOMParser).parseFromString(e,"text/html");return t.querySelectorAll('[aria-hidden="true"]').forEach(e=>e.remove()),t.body.textContent.replace(/\s{2,}/g," ").trim()},ai=()=>{const{id:e,keyboardHintText:t,enableMapControls:n,mapControlsHintText:o}=S(),{hints:r}=Gt(),[i,a]=y(null);f(()=>r.subscribe(a),[r]);const s=n?`${t} ${o}`:t;return I("div",{className:"im-o-hints",children:[C("div",{id:`${e}-hints`,className:"im-c-hints",children:i&&C("div",{className:"im-c-hints__hint",dangerouslySetInnerHTML:{__html:i.html}})}),C("div",{id:`${e}-keyboard-desc`,className:"im-u-visually-hidden",dangerouslySetInnerHTML:{__html:ii(s)}})]})},si=()=>{const e=S(),{id:t,mapLabel:n,mapHintText:o}=e,r=X(),{breakpoint:i,interfaceType:a,preferredColorScheme:l,layoutRefs:c,isLayoutReady:d,isFullscreen:u,openPanels:p,panelConfig:m}=r,{mapStyle:h}=Pe(),g=((e,t,n)=>null!==Jt(e,t,n))(p??{},m??{},i),y=tn(r,e);return function(){const{dispatch:e,breakpoint:t,layoutRefs:n,arePluginsEvaluated:o,appVisible:r,isFullscreen:i}=X(),{mapSize:a,isMapReady:s}=Pe(),{bannerRef:l,mainRef:c,headerRef:d,topRef:u,topLeftColRef:p,topMiddleColRef:f,topRightColRef:m,bottomRef:h,bottomLeftColRef:g,bottomRightRef:y,attributionsRef:v,leftTopRef:R,leftBottomRef:P,rightTopRef:C,rightBottomRef:I,drawerRef:_,actionsRef:A,leftRef:S,rightRef:M}=n;E(()=>{e({type:"CLEAR_PLUGINS_EVALUATED"})},[t,a,s,r,i]),E(()=>{o&&requestAnimationFrame(()=>{Pr(n,t);const o=dr(n);o&&e({type:"SET_SAFE_ZONE_INSET",payload:{safeZoneInset:o}})})},[o]),un(b(()=>[l,c,d,u,p,f,m,A,h,g,y,v,R,P,C,I,_,S,M],[]),()=>{Pr(n,t)})}(),function(){const{layoutRefs:e}=X();f(()=>{if(e.appContainerRef.current)return document.addEventListener("focusin",t),document.addEventListener("focusout",n),document.addEventListener("pointerdown",o),()=>{document.removeEventListener("focusin",t),document.removeEventListener("focusout",n),document.removeEventListener("pointerdown",o)};function t(e){e.target.dataset.focusVisible="keyboard"===s()}function n(e){delete e.target.dataset.focusVisible}function o(){delete document.activeElement.dataset.focusVisible}},[e.appContainerRef])}(),function(){const{applicationModeEntries:e,layoutRefs:t}=X();f(()=>{const e=t.appContainerRef?.current,n=document.activeElement;e&&n&&e.contains(n)&&!(n.getClientRects().length>0)&&t.viewportRef?.current?.focus({preventScroll:!0})},[e])}(),I("div",{id:`${t}-im-app`,className:["im-o-app",`im-o-app--${i}`,`im-o-app--${a}`,"im-o-app--"+(u?"fullscreen":"inline"),`im-o-app--${h?.appColorScheme||l}-app`,on(y)].filter(Boolean).join(" "),style:{backgroundColor:h?.backgroundColor||void 0,...Ge(h)},ref:c.appContainerRef,children:[I("div",{className:"im-u-visually-hidden",children:[n,". ",o]}),C(Qr,{}),I("div",{className:"im-o-app__overlay"+(d?"":" im-o-app__overlay--not-ready"),children:[C("div",{className:"im-o-app__side",ref:c.sideRef,children:C(Nn,{slot:W.SIDE})}),I("div",{className:"im-o-app__main",ref:c.mainRef,children:[C("div",{className:"im-o-app__header",ref:c.headerRef,children:C(Nn,{slot:W.HEADER})}),I("div",{className:"im-o-app__top",ref:c.topRef,children:[C("div",{className:"im-o-app__top-col",ref:c.topLeftColRef,children:C(Nn,{slot:W.TOP_LEFT})}),C("div",{className:"im-o-app__top-col",ref:c.topMiddleColRef,children:C(Nn,{slot:W.TOP_MIDDLE})}),C("div",{className:"im-o-app__top-col",ref:c.topRightColRef,children:C(Nn,{slot:W.TOP_RIGHT})})]}),C("div",{className:"im-o-app__banner",ref:c.bannerRef,children:C(Nn,{slot:W.BANNER})}),I("div",{className:"im-o-app__left",ref:c.leftRef,children:[C("div",{className:"im-o-app__left-top",ref:c.leftTopRef,children:C(Nn,{slot:W.LEFT_TOP})}),C("div",{className:"im-o-app__left-bottom",ref:c.leftBottomRef,children:C(Nn,{slot:W.LEFT_BOTTOM})})]}),C("div",{className:"im-o-app__middle",ref:c.middleRef,children:C(Nn,{slot:W.MIDDLE})}),I("div",{className:"im-o-app__right",ref:c.rightRef,children:[C("div",{className:"im-o-app__right-top",ref:c.rightTopRef,children:C(Nn,{slot:W.RIGHT_TOP})}),C("div",{className:"im-o-app__right-bottom",ref:c.rightBottomRef,children:C(Nn,{slot:W.RIGHT_BOTTOM})})]}),C(ai,{}),I("div",{className:"im-o-app__bottom",ref:c.bottomRef,children:[I("div",{className:"im-o-app__bottom-col",ref:c.bottomLeftColRef,children:[C(Jr,{}),C("div",{className:"im-o-app__bottom-left",children:C(Nn,{slot:W.BOTTOM_LEFT})})]}),C("div",{className:"im-o-app__bottom-col",ref:c.bottomRightColRef,children:C("div",{className:"im-o-app__bottom-right",ref:c.bottomRightRef,children:C(Nn,{slot:W.BOTTOM_RIGHT})})}),C("div",{className:"im-o-app__attributions",ref:c.attributionsRef,children:C(ei,{})})]}),C("div",{className:"im-o-app__drawer",ref:c.drawerRef,children:C(Nn,{slot:W.DRAWER})}),C("div",{className:"im-o-app__actions",ref:c.actionsRef,children:C(Nn,{slot:W.ACTIONS})}),I("div",{className:"im-o-app__modal",ref:c.modalRef,children:[C(Nn,{slot:W.MODAL}),C("div",{className:"im-o-app__modal-backdrop"+(g?" im-o-app__modal-backdrop--visible":"")})]})]})]}),C(ri,{})]})},li=e=>(f(()=>{c(),e.eventBus.emit(n.APP_READY)},[]),C(q,{options:e,children:C(Re,{options:e,children:C(Wt,{eventBus:e.eventBus,pluginRegistry:e.pluginRegistry,children:I(Ut,{children:[C(So,{}),C(On,{children:C(si,{})})]})})})})),ci=new WeakMap,di=new WeakMap,ui=new WeakMap,pi=(e,t)=>{let o=ui.get(e);if(!o){const r=k(),i=function(){let e={};return{registerPanel:t=>{e=x(e,t)},addPanel:(t,n)=>(e=L(e,t,n),e[t]),removePanel:t=>{e=O(e,t)},getPanelConfig:()=>e,clear:()=>{e={}}}}(),a=function(){let e={};return{registerControl:t=>{e=B(e,t)},addControl:(t,n)=>(e=D(e,t,n),e[t]),getControlConfig:()=>e,clear:()=>{e={}}}}(),s=Po(),l=function({eventBus:e}){const t=new Map;let o=null;const r=()=>{let r,i,a=[],s=!1;if(o&&t.has(o)){const e=t.get(o).getItems()??{};a=e.items??[],s=!!e.multiselectable,r=e.label,i=e.focusable}else t.forEach(e=>{if(e.exclusive)return;const t=e.getItems()??{};a=a.concat(t.items??[]),s=s||!!t.multiselectable,r=r??t.label,i=i??t.focusable});e.emit(n.MAP_SET_SPATIAL_LIST,{items:a,multiselectable:s,label:r,focusable:i})};return{registerItemProvider:function(e,{getItems:n,exclusive:o=!1}){t.set(e,{getItems:n,exclusive:o}),r()},unregisterItemProvider:function(e){t.delete(e),o===e&&(o=null),r()},claimExclusive:function(e){o=e,r()},releaseExclusive:function(e){o===e&&(o=null,r())},notifyItemsChanged:function(e){t.has(e)&&(o&&o!==e||r())},clear:function(){t.clear(),o=null}}}({eventBus:t});o={buttonRegistry:r,panelRegistry:i,controlRegistry:a,pluginRegistry:yo({registerButton:r.registerButton,registerPanel:i.registerPanel,registerControl:a.registerControl,registerKeyboardShortcut:s.registerKeyboardShortcut}),keyboardShortcutRegistry:s,spatialListRegistry:l},ui.set(e,o)}return o};async function fi(t,{MapProvider:o,mapProviderConfig:r,mapFramework:i,plugins:a=[],...s}){const{eventBus:l}=s;let c=di.get(t);c||(c=new o({mapFramework:i,mapProviderConfig:r,events:n,eventBus:l}),di.set(t,c));const{buttonRegistry:d,panelRegistry:u,controlRegistry:p,pluginRegistry:f,keyboardShortcutRegistry:m,spatialListRegistry:h}=pi(t,l),{registerPlugin:g}=f;c.capabilities?.supportedShortcuts&&m.setProviderSupportedShortcuts(c.capabilities.supportedShortcuts),f.clear(),g({id:"appConfig",manifest:co});let b=ci.get(t);b||(b=e(t),ci.set(t,b));const y={_root:b,on:l.on,off:l.off,emit:l.emit,unmount(){b.unmount(),ci.delete(t),c.destroyMap?.(),di.delete(t),f.clear()}};return await(async(e,t)=>{for(const n of e)if("function"==typeof n.load){const e=await n.load(),{id:o,load:r,manifest:i,...a}=n,{InitComponent:s,api:l,reducer:c,...d}=e;t({id:o,InitComponent:s,api:l,reducer:c,config:a,manifest:Co(d,i),_originalPlugin:n})}})(a,g),b.render(C(li,{...s,buttonRegistry:d,panelRegistry:u,controlRegistry:p,pluginRegistry:f,keyboardShortcutRegistry:m,spatialListRegistry:h,mapProvider:c})),y}export{fi as initialiseApp};