@tomtom-org/maps-sdk 0.50.2 → 0.50.4

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.
@@ -1,2 +1,2 @@
1
- import{isEmpty as e,isEqual as t,isNil as i,omit as r,omitBy as s,remove as a}from"lodash-es";import{DEFAULT_COMMON_BASE_URL as o,TomTomConfig as n,bboxCenter as l,bboxFromCoordsArray as c,bboxFromGeoJSON as h,formatDistance as u,formatDuration as d,generateId as p,generateTomTomHeaders as y,getPosition as f,iconToTrafficIncidentCategory as g,indexedMagnitudes as m,isProxyCredentialsMode as _,mergeFromGlobal as L,poiCategoriesToID as A}from"@tomtom-org/maps-sdk/core";import{bearing as S,booleanPointInPolygon as I,difference as E,featureCollection as b,hexGrid as R,mask as T,squareGrid as C}from"@turf/turf";import{Map as v,getRTLTextPluginStatus as w,setRTLTextPlugin as O,setWorkerCount as N}from"maplibre-gl";import{version as M}from"maplibre-gl/package.json";var x=["road_category","road_subcategory","relative_speed","left_hand_traffic","road_closure","absolute_speed","part_of_two_way_road","openlr","display_class"],D=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{roadCategory:t?.road_category,leftHandTraffic:Boolean(t?.left_hand_traffic),roadClosure:Boolean(t?.road_closure),relativeSpeed:t?.relative_speed,...t?.road_subcategory&&{roadSubcategory:t.road_subcategory},...t?.absolute_speed&&{absoluteSpeed:t.absolute_speed},...t?.part_of_two_way_road&&{partOfTwoWayRoad:Boolean(t.part_of_two_way_road)},...t?.openlr&&{openlr:t.openlr},...t?.display_class&&{displayClass:t.display_class}}}},F=["icon_category","left_hand_traffic","magnitude_of_delay","road_category","road_subcategory","id","description","delay","part_of_two_way_road","start_time","end_time","probability_of_occurrence","number_of_reports","last_report_time","average_speed_kmph","openlr","time_validity","display_class"],P={other:0,accident:1,fog:2,danger:3,rain:4,frost:5,jam:6,"lane-closed":7,"road-closed":8,roadworks:9,wind:10,flooding:11,"animals-on-road":12,"narrow-lanes":13,"broken-down-vehicle":14},U=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{id:t.id??p(),description:t?.description_0??"",category:g(t?.icon_category_0),magnitudeOfDelay:m[t?.magnitude_of_delay],roadCategory:t?.road_category,roadSubcategory:t?.road_subcategory,leftHandTraffic:Boolean(t?.left_hand_traffic),...t?.delay&&{delayInSeconds:t.delay},...t?.part_of_two_way_road&&{partOfTwoWayRoad:Boolean(t.part_of_two_way_road)},...t?.start_time&&{startTime:new Date(t.start_time)},...t?.end_time&&{endTime:new Date(t.end_time)},...t?.probability_of_occurrence&&{probabilityOfOccurrence:t.probability_of_occurrence},...t?.number_of_reports&&{numberOfReports:t.number_of_reports},...t?.last_report_time&&{lastReportTime:new Date(t.last_report_time)},...t?.average_speed_kmph&&{averageSpeedKmph:t.average_speed_kmph},...t?.openlr&&{openlr:t.openlr},...t?.time_validity&&{timeValidity:t.time_validity},...t?.display_class&&{displayClass:t.display_class},...t?.point_type&&{pointType:t.point_type}}}},H=e=>/* @__PURE__ */new Error(`Trying to ${e} while it is not in the map style. Did you exclude it when loading the map?`),k=()=>"undefined"!=typeof document&&"undefined"!=typeof DOMParser&&"undefined"!=typeof btoa,W=e=>{if(!k())return;const t=document.createElement("img");return t.src=`data:image/svg+xml;base64,${btoa((new XMLSerializer).serializeToString(e))}`,t},B=e=>(new DOMParser).parseFromString(e,"image/svg+xml").documentElement,V=e=>((e,t)=>(t?.fillColor&&e.querySelector("#background")?.setAttribute("fill",t.fillColor),t?.outlineColor&&e.querySelector("#outline")?.setAttribute("fill",t.outlineColor),void 0!==t?.outlineOpacity&&e.querySelector("#outline")?.setAttribute("fill-opacity",t.outlineOpacity.toString()),e))(B('<svg xmlns="http://www.w3.org/2000/svg" width="120" height="140">\n <path id="background" d="M63.95 137.516c6.556-12.737 19.098-21.09 30.828-29.388C110.046 97.324 120 79.603 120 59.574 120 26.671 93.138 0 60 0S0 26.671 0 59.574c0 20.029 9.954 37.75 25.22 48.55 11.734 8.302 24.274 16.652 30.83 29.388 1.706 3.316 6.194 3.316 7.9 0z"\n fill="#1988cf"/>\n <path id="outline" d="M91.298 103.272C105.052 93.544 114 77.596 114 59.574c0-29.61-24.176-53.617-54-53.617S6 29.964 6 59.574c0 18.022 8.95 33.97 22.7 43.698l2.27 1.601c10.172 7.153 21.922 15.423 29.03 27.416 7.104-11.993 18.858-20.259 29.03-27.416l2.268-1.601zm1.468 6.274c-11.13 7.845-22.632 15.957-28.816 27.966-1.706 3.316-6.194 3.316-7.9 0-6.182-12.009-17.686-20.121-28.816-27.966l-2.016-1.422C9.954 97.324 0 79.603 0 59.574 0 26.671 26.862 0 60 0s60 26.671 60 59.574c0 20.029-9.954 37.75-25.222 48.55l-2.016 1.422z"\n fill-opacity=".3"/>\n</svg>\n'),e);var G,j,z,$=e=>(function(e){if(i(e))throw new Error(`${e} must not be null/undefined. Something went wrong with its initialization.`)}(e),e),Y=e=>{const t=e.properties?.id;return"string"==typeof t||"number"==typeof t?t:e.id},q=(e,t)=>{if(null!=t)for(let i=0;i<e.length;i++)if(Y(e[i])===t)return{feature:e[i],index:i}},K=class{constructor(e,t,i){this.id=e,this.spec=t,this.runtimeSource=i}ensureAddedToMap(e){this.runtimeSource||(!e.getSource(this.id)&&this.spec&&e.addSource(this.id,this.spec),this.runtimeSource=e.getSource(this.id))}},X=class{constructor(e,t,i){this.map=e,this.source=t,this._layerSpecs=i,this._updateSourceAndLayerIDs()}isAnyLayerVisible(e){return this.getLayerSpecs(e).some(e=>this.isLayerVisible(e))}areAllLayersVisible(e){return this.getLayerSpecs(e).every(e=>this.isLayerVisible(e))}getLayerSpecs(e){return e?this._layerSpecs.filter(e):this._layerSpecs}_updateSourceAndLayerIDs(){this._sourceAndLayerIDs={sourceID:this.source.id,layerIDs:this._layerSpecs.map(e=>e.id)}}isLayerVisible(e){return!!this.map.getLayer(e.id)&&"none"!==this.map.getLayoutProperty(e.id,"visibility")}setLayersVisible(e,t){for(const i of this.getLayerSpecs(t))this.map.getLayer(i.id)&&this.map.setLayoutProperty(i.id,"visibility",e?"visible":"none",{validate:!1})}get sourceAndLayerIDs(){return this._sourceAndLayerIDs}equalSourceAndLayerIDs(e){return this.sourceAndLayerIDs.sourceID===e.sourceAndLayerIDs.sourceID&&this.sourceAndLayerIDs.layerIDs.length===e.sourceAndLayerIDs.layerIDs.length&&this.sourceAndLayerIDs.layerIDs.every((t,i)=>t===e.sourceAndLayerIDs.layerIDs[i])}},Z=(e,t)=>e.getStyle().layers.filter(e=>t.includes(e?.source)),J=class extends X{constructor(e,t,i){let r=Z(e,[t.id]);i&&(r=r.filter(i)),super(e,new K(t.id,e.getStyle().sources[t.id],t),r)}},Q=class extends X{constructor(e,t,i,r){super(e,new K(t,i),r.map(e=>({...e,source:t})))}ensureLayersAddedToMap(){for(const e of this._layerSpecs)this.map.getLayer(e.id)||this.map.addLayer(e,e.beforeID)}ensureAddedToMapWithVisibility(e,t){this.source.ensureAddedToMap(this.map),t&&(this.ensureLayersAddedToMap(),this.setLayersVisible(e))}},ee={type:"FeatureCollection",features:[]},te=class extends Q{constructor(e,t,i,r=!0,s){super(e,t,s?.cluster?{type:"geojson",data:ee,...s}:{type:"geojson",data:ee,promoteId:"id",...s??{}},i),this.shownFeatures=ee,this.ensureAddedToMapWithVisibility(!1,r)}show(e,{automaticVisibility:t=!0}={}){this.shownFeatures=e,$(this.source.runtimeSource).setData(e),t&&this.setLayersVisible(!!e.features.length)}findById(e){return q(this.shownFeatures.features,e)}clear(){this.show(ee)}findFeature(e){return"index"in e?this.shownFeatures.features[e.index]:"id"in e?this.findById(e.id)?.feature:void 0}putEventState(e){if("put"===(e.mode??"put"))for(const i of this.shownFeatures.features)i.properties?.eventState===e.state&&delete i.properties.eventState;const t=this.findFeature(e);t&&(t.properties={...t.properties,eventState:e.state}),!1!==e.show&&this.show(this.shownFeatures,{automaticVisibility:!1})}cleanEventState(e){const t=this.findFeature(e);t?.properties?.eventState&&(delete t?.properties?.eventState,!1!==e?.show&&this.show(this.shownFeatures,{automaticVisibility:!1}))}cleanEventStates(e){let t=!1;for(const i of this.shownFeatures.features)e?.states&&!e.states.includes(i.properties?.eventState)||(delete i.properties?.eventState,t=!0);!1!==e?.show&&t&&this.show(this.shownFeatures,{automaticVisibility:!1})}},ie=async e=>{e.mapReady||(await e.mapLibreMap.once("styledata"),await ie(e))},re=e=>{const t=globalThis.__DEMO_BFF_ENSURE_SESSION__;return"function"!=typeof t?e:t().then(()=>e,()=>e)},se=e=>{const t=e.commonBaseURL??o,i=t!==o,r=_(e);return(s,a)=>{const o=((e,t,i,r)=>{if(!i)return e;try{const i=new URL(e);return"api.tomtom.com"===(s=i.hostname)||s.endsWith(".api.tomtom.com")?(r&&i.searchParams.delete("key"),t+i.pathname+i.search+i.hash):e}catch{return e}var s})(s,t,i,r),n=i&&o.startsWith(t),l=r&&n;let c=!1;try{const e=new URL(s).hostname;c="tomtom.com"===e||e.endsWith(".tomtom.com")}catch{c=!1}if(!c&&!n)return{url:o};if("Image"===a)return l?re({url:o,credentials:"include"}):{url:o};const h=new URL(o);(e=>{e.pathname.includes("incidents")?e.searchParams.set("tags",F.join(",")):e.pathname.includes("flow")&&e.searchParams.set("tags",x.join(","))})(h);const u={url:h.toString(),headers:{...y(e)}};return l?(u.credentials="include",re(u)):u}},ae=(e,t,i)=>{const r=e.id;e.maxzoom===t.maxzoom&&e.minzoom===t.minzoom||i.setLayerZoomRange(r,e.minzoom??i.getMinZoom(),e.maxzoom??i.getMaxZoom()),i.setFilter(r,e.filter,{validate:!1});for(const s of Object.keys(t.layout??[]))e.layout?.[s]||i.setLayoutProperty(r,s,void 0,{validate:!1});for(const s of Object.keys(t.paint??[]))e.paint?.[s]||i.setPaintProperty(r,s,void 0,{validate:!1});for(const[s,a]of Object.entries(e.paint??[]))i.setPaintProperty(r,s,a,{validate:!1});for(const[s,a]of Object.entries(e.layout??[]))i.setLayoutProperty(r,s,a,{validate:!1})},oe=(e,t,i,r)=>{const s=e.reduce((e,t)=>({...e,[t.id]:t}),{}),a=t.reduce((e,t)=>({...e,[t.id]:t}),{}),o=[],n=[],l=[],c=[];Object.keys(s).forEach(e=>{a[e]?(l.push(s[e]),c.push(a[e])):o.push(e)}),Object.keys(a).forEach(e=>{s[e]||n.push(e)});const h=i._layerSpecs;n.forEach(e=>{r.removeLayer(e);for(let t=0;t<h.length;t++)if(h[t].id===e){h.splice(t,1);break}}),o.forEach(e=>{const t={...s[e],source:i.source.id};h.push(t)}),i._updateSourceAndLayerIDs(),((e,t,i)=>{e.forEach((e,r)=>ae(e,t[r],i))})(l,c,r)},ne=(e,t)=>{const i=/* @__PURE__ */new Set,r=e=>{t.getLayer(e.id)||t.addLayer({...e,layout:{...e.layout,visibility:"none"}},e.beforeID),i.add(e.id)},s={};for(e.forEach(e=>{e.beforeID?i.has(e.beforeID)||t.getLayer(e.beforeID)?(i.add(e.beforeID),r(e)):s[e.beforeID]?s[e.beforeID].push(e):s[e.beforeID]=[e]:r(e)});Object.keys(s).length>0;){const e=Object.keys(s).filter(e=>i.has(e));if(!e.length)return void console.error(`Some layers cannot be added. Check for non-existing layers, or circular beforeID dependencies for the following: ${JSON.stringify(Object.keys(s))}`);e.forEach(e=>{s[e].forEach(e=>r(e)),delete s[e]})}},le=(e,t)=>{switch(typeof e){case"undefined":return{type:"standard",include:[t]};case"string":return{type:"standard",id:e,include:[t]};default:if("standard"===e.type)return e.include?{...e,include:[...e.include,t]}:{...e,include:[t]};throw(e=>/* @__PURE__ */new Error(`Trying to add style module ${e} to the custom style!`))(t)}},ce=async(e,t,i)=>{if(!e.mapLibreMap.getSource(t)){const r=e.mapLibreMap;r.isStyleLoaded()||await r.once("idle"),e.setStyle(le(e.getStyle(),i)),await(async(e,t)=>{e.mapLibreMap.getSource(t)&&e.mapLibreMap.isSourceLoaded(t)||await e.mapLibreMap.once("sourcedata")})(e,t),await r.once("styledata");for(const e of Z(r,[t]))r.setLayoutProperty(e.id,"visibility","none",{validate:!1});await r.once("styledata")}},he=async(e,t,i,r,s)=>{if(!i)return void console.warn(`addOrUpdateImage called with empty image for ID ${t}`);const a=i=>{const a=r.hasImage(t);a&&"add-or-update"==e?r.updateImage(t,i):a||r.addImage(t,i,s)},o=e=>{e.complete?e.naturalWidth>0?a(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>a(e),e.onerror=()=>console.warn(`Failed to load image for ID ${t}`))};"string"==typeof i?i.includes("<svg")?o(W(B(i))):a((await r.loadImage(i)).data):o(i)},ue=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},de=e=>{if("string"==typeof e)return ue(e);const t=e;return t?.id?ue(t.id):"light"},pe=class e{static{this.instanceCounters=/* @__PURE__ */new WeakMap}constructor(t,i,r){this._initializing=!0,this.configChangeHandlers=[],this.moduleReady=!1;const s=new.target,a=e.instanceCounters.get(s)??-1;this.instanceIndex=a+1,e.instanceCounters.set(s,this.instanceIndex),this.sourceType=t,this.tomtomMap=i,this.eventsProxy=i._eventsProxy,this.mapLibreMap=i.mapLibreMap,this.initSourcesWithLayers(r),this.applyConfig(r),this.tomtomMap.addStyleChangeHandler({onStyleAboutToChange:()=>{this.moduleReady=!1},onStyleChanged:()=>this.restoreDataAndConfig()}),this._initializing=!1}initSourcesWithLayers(e,t){this.moduleReady=!1,this.sourcesWithLayers=this._initSourcesWithLayers(e,t),this._sourceAndLayerIDs=Object.fromEntries(Object.entries(this.sourcesWithLayers).map(([e,t])=>[e,t.sourceAndLayerIDs])),t&&this.eventsProxy.updateIfRegistered(this.sourcesWithLayers),this.tomtomMap.mapReady&&(this.moduleReady=!0)}async waitUntilModuleReady(){await ie(this.tomtomMap),this.moduleReady||await new Promise(e=>{const t=setInterval(()=>{this.tomtomMap.mapReady&&this.moduleReady&&(clearInterval(t),e())},200)})}applyConfig(e){this.config=this._applyConfig(e),this.emitConfigChange()}emitConfigChange(){if(!this._initializing)for(const e of this.configChangeHandlers)e(this.config)}resetConfig(){this.applyConfig(void 0)}async restoreDataAndConfig(){this.moduleReady=!1,"geojson"===this.sourceType?requestAnimationFrame(()=>{this.restoreDataAndConfigImpl()}):this.restoreDataAndConfigImpl()}restoreDataAndConfigImpl(){this.initSourcesWithLayers(this.config,!0),this._applyConfig(this.config)}getConfig(){return this.config&&{...this.config}}get sourceAndLayerIDs(){return this._sourceAndLayerIDs}},ye=class{constructor(e,t){this.userEventsInstance=e,this.moduleEventsInstance=t}on(e,t){return"config-change"===e?this.moduleEventsInstance.on("config-change",t):"shown-features"===e?this.moduleEventsInstance.on("shown-features",t):this.userEventsInstance.on(e,t)}off(e){"config-change"===e||"shown-features"===e?this.moduleEventsInstance.off(e):this.userEventsInstance.off(e)}},fe=class{constructor(){this.interactiveLayerIDs=[],this.handlers={},this.findHandlers=(e,t,i)=>t&&i&&e.flatMap(e=>{const r=this.handlers[t]?.[e];return 1===r?.length?r:this.handlers[t]?.[e]?.filter(e=>e.layerIDs.includes(i))||[]})||[]}ensureInteractiveLayerIDsAdded(e){e._layerSpecs.forEach(e=>{this.interactiveLayerIDs.includes(e.id)||this.interactiveLayerIDs.push(e.id)})}addEventHandler(e,t,i,r){this.ensureInteractiveLayerIDsAdded(e);const s=e.source.id;this.handlers[s]||(this.handlers[s]={[i]:[]}),this.handlers[s][i]??=[],this.handlers[s][i]?.push({sourceWithLayers:e,layerIDs:e._layerSpecs.map(e=>e.id),fn:t,config:r})}removeHandler(t,i,r){const s=this.handlers[t.source.id]?.[i];s&&(a(s,e=>e.fn===r),s.length||(delete this.handlers[t.source.id]?.[i],e(this.handlers[t.source.id])&&delete this.handlers[t.source.id]))}remove(t,i){const r=this.handlers[t.source.id]?.[i];r&&(a(r,e=>{return i=t._layerSpecs,e.layerIDs.every((e,t)=>e===i[t].id);var i}),r.length||(delete this.handlers[t.source.id]?.[i],e(this.handlers[t.source.id])&&delete this.handlers[t.source.id]));for(const e of t._layerSpecs)a(this.interactiveLayerIDs,t=>e.id===t)}removeAll(){this.interactiveLayerIDs=[],this.handlers={}}hasSourceID(e){return!!this.handlers[e]}sourceWithLayersFor(e){if(!e)return;const t=this.handlers[e];if(t)for(const i of Object.values(t))if(i?.length)return i[0].sourceWithLayers}updateIfRegistered(e){for(const t of Object.values(e)){const e=this.handlers[t.source.id];if(e)for(const i of Object.values(e))for(const e of i)t.equalSourceAndLayerIDs(e.sourceWithLayers)&&(e.sourceWithLayers=t)}}},ge=e=>"click"===e||"contextmenu"===e,me=(e,t,i,s="updateInProps")=>{const{feature:a,index:o}=q(i,t)||{};if(a&&(!ge(a.properties?.eventState)||ge(e))){const t={...a,properties:"updateInProps"===s?{...a?.properties,eventState:e}:r(a?.properties,"eventState")};return i.splice(o,1,t),o}},_e=(e,t,r)=>{const s=[...r.shownFeatures.features];i(me(e,Y(t),s,"removeFromProps"))||r.show({...r.shownFeatures,features:s},{automaticVisibility:!1})},Le=(e,t,i,r,s)=>{if(t&&r instanceof te){const n=[...r.shownFeatures.features];return me(e,Y(t),n),!i||(o=t,(a=i)&&o&&a.id===o.id)||(s===r?me(e,Y(i),n,"removeFromProps"):s instanceof te&&_e(e,i,s)),void r.show({...r.shownFeatures,features:n},{automaticVisibility:!1})}var a,o;i&&s instanceof te&&_e(e,i,s)},Ae={precisionMode:"box",paddingBoxPx:5,cursorOnHover:"pointer",cursorOnMouseDown:"grabbing",cursorOnMap:"default",longHoverDelayAfterMapMoveMS:800,longHoverDelayOnStillMapMS:300},Se=class extends fe{constructor(e,t={}){super(),this.enabled=!0,this.firstDelayedHoverSinceMapMove=!0,this.map=e,this.mapCanvas=e.getCanvas(),this.config={...Ae,...t},this.mapCanvas.style.cursor=this.config.cursorOnMap,this.lastCursorStyle=this.config.cursorOnMap,this.listenToEvents()}listenToEvents(){this.map.on("mousemove",e=>this.onMouseMove(e)),this.map.on("movestart",()=>this.onMouseStart()),this.map.on("mouseout",()=>this.onMouseOut()),this.map.on("mouseover",e=>this.onMouseMove(e)),this.map.on("mousedown",()=>this.onMouseDown()),this.map.on("mouseup",()=>this.onMouseUp()),this.map.on("click",e=>this.onMapClick("click",e)),this.map.on("contextmenu",e=>this.onMapClick("contextmenu",e))}enable(e){this.enabled=e,e||this.clearLongHoverTimeout()}toPaddedBounds(e){const t=this.config.paddingBoxPx;return[[e.x-t,e.y+t],[e.x+t,e.y-t]]}isEnabled(){return this.enabled&&!this.map.isMoving()}toCallerFeatures(e,t){const i=(e=>{const t=/* @__PURE__ */new Set,i=[];for(const r of e){const e=Y(r);if(void 0===e){i.push(r);continue}const s=`${r.source} ${e}`;t.has(s)||(t.add(s),i.push(r))}return i})((r=e,(s=t)?r.filter(e=>e.source===s):r));var r,s;const a=this.sourceWithLayersFor(t);return a instanceof te?i.map(e=>a.findById(Y(e))?.feature??e):i}getRenderedFeatures(e){if(!this.interactiveLayerIDs.length)return[];const t={layers:this.interactiveLayerIDs,validate:!1},i=this.config.precisionMode,r="point-then-box"===i||"point"===i?this.map.queryRenderedFeatures(e,t):[];return r.length||"point"===i?r:this.map.queryRenderedFeatures(this.toPaddedBounds(e),t)}clearLongHoverTimeout(){window.clearTimeout(this.longHoverTimeoutHandlerID)}restartLongHoverTimeout(){this.clearLongHoverTimeout(),this.longHoverTimeoutHandlerID=window.setTimeout(()=>this.handleLongHoverTimeout(),this.firstDelayedHoverSinceMapMove?this.config.longHoverDelayAfterMapMoveMS:this.config.longHoverDelayOnStillMapMS)}handleLongHoverTimeout(){if(this.firstDelayedHoverSinceMapMove=!1,this.hoveringSourceWithLayers){Le("long-hover",this.hoveringFeature,void 0,this.hoveringSourceWithLayers,void 0);const e=this.findHandlers(["long-hover"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id);if(e.length){const t=this.toCallerFeatures(this.hoveringFeatures??[],this.hoveringFeature?.source);for(const i of e)i.fn(t[0],this.hoveringLngLat,t,i.sourceWithLayers)}}}onMouseStart(){this.firstDelayedHoverSinceMapMove=!0,this.clearLongHoverTimeout()}onMouseOut(){this.clearLongHoverTimeout()}onMouseDown(){this.lastCursorStyle=this.mapCanvas.style.cursor,this.mapCanvas.style.cursor=this.config.cursorOnMouseDown}onMouseUp(){this.mapCanvas.style.cursor=this.lastCursorStyle}onMouseMove(e){if(!this.isEnabled())return;this.hoveringFeatures=this.getRenderedFeatures(e.point);const[t]=this.hoveringFeatures;if(t&&!this.hasSourceID(t.source))return;const{hoverChanged:i,mouseInMotionOverHoveredFeature:r}=((e,t,i,r)=>{if(t){if(!r)return{hoverChanged:!0};if(t.id&&t.id!==r.id||t.properties.id&&t.properties.id!==r.properties.id||t.source!==r.source||t.layer.id!==r.layer.id)return{hoverChanged:!0};if(i&&(e.x-i.x!=0||e.y-i.y!=0))return{mouseInMotionOverHoveredFeature:!0}}else if(r)return{hoverChanged:!0};return{}})(e.point,t,this.hoveringPoint,this.hoveringFeature);if(i||r){this.hoveringLngLat=e.lngLat,this.hoveringPoint=e.point;const s=this.hoveringFeature;this.hoveringFeature=t;const a=this.hoveringSourceWithLayers,o=this.findHandlers(["hover","hover-move","long-hover","click","contextmenu"],t?.source,t?.layer.id)?.[0];let n;if(this.hoveringSourceWithLayers=this.sourceWithLayersFor(t?.source),i){this.updateHoverCursor(o?.config),Le("hover",this.hoveringFeature,s,this.hoveringSourceWithLayers,a);const i=this.findHandlers(["hover"],t?.source,t?.layer.id);if(i.length){n=this.toCallerFeatures(this.hoveringFeatures,t?.source);for(const t of i)t.fn(n[0],e.lngLat,n,t.sourceWithLayers)}}if(r){const t=this.findHandlers(["hover-move"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id);if(t.length){n??=this.toCallerFeatures(this.hoveringFeatures,this.hoveringFeature?.source);for(const i of t)i.fn(n[0],e.lngLat,n,i.sourceWithLayers)}}this.restartLongHoverTimeout()}}updateHoverCursor(e){this.hoveringFeature?this.mapCanvas.style.cursor=e?.cursorOnHover??this.config.cursorOnHover:this.mapCanvas.style.cursor=this.config.cursorOnMap}onMapClick(e,t){if(!this.isEnabled())return;const i=this.getRenderedFeatures(t.point),r=this.lastClickedFeature;this.lastClickedFeature=i[0];const s=this.lastClickedSourceWithLayers,a=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);if(this.lastClickedSourceWithLayers=a[0]?.sourceWithLayers,Le(e,this.lastClickedFeature,r,this.lastClickedSourceWithLayers,s),a.length){const e=this.toCallerFeatures(i,this.lastClickedFeature?.source);for(const i of a)i.fn(e[0],t.lngLat,e,i.sourceWithLayers)}}},Ie={country:"Places - Country name",lowestPlaceLabel:"Places - Village / Hamlet",poi:"POI",lowestLabel:"Borders - Treaty label",lowestRoadLine:"Tunnel - Railway outline",lowestBuilding:"Buildings - Underground"},Ee="vectorTiles",be="hillshade",Re="vectorTiles",Te="vectorTilesIncidents",Ce="vectorTilesFlow",ve=class{constructor(e,t){this.configChangeHandlers=e,this.shownFeaturesHandlers=t}on(e,t){if("config-change"===e){const e=t;return this.configChangeHandlers.push(e),()=>{const t=this.configChangeHandlers.indexOf(e);-1!==t&&this.configChangeHandlers.splice(t,1)}}const i=t;return this.shownFeaturesHandlers.push(i),()=>{const e=this.shownFeaturesHandlers.indexOf(i);-1!==e&&this.shownFeaturesHandlers.splice(e,1)}}off(e){"config-change"===e?this.configChangeHandlers.length=0:this.shownFeaturesHandlers.length=0}},we=class{constructor(e,t,i,r){this.eventProxy=e,this.config=i,this.mapping=r,this.sources=Array.isArray(t)?t:[t]}on(e,t){const i=[];if(this.mapping){const r=this.mapping;for(const s of this.sources){const a=(e,...i)=>t(r(e),...i);this.eventProxy.addEventHandler(s,a,e,this.config),i.push({source:s,registeredHandler:a})}}else for(const r of this.sources)this.eventProxy.addEventHandler(r,t,e,this.config),i.push({source:r,registeredHandler:t});return()=>{for(const{source:t,registeredHandler:r}of i)this.eventProxy.removeHandler(t,e,r)}}off(e){for(const t of this.sources)this.eventProxy.remove(t,e)}},Oe=["POI","POI - Micro"],Ne={NATIVE_RESERVATION:"aboriginal_land",AIRPORT:"airport",AMUSEMENT_PARK:"amusement_park",ATM:"atm",BANK:"bank",BAR:"bar",BEACH:"beach_resort",ACCESS_GATEWAY:"border_control",FRONTIER_CROSSING:"border_control",BUS_STOP:"bus_station",CAFE:"cafe",CAFE_PUB:"cafe",CAMPING_GROUND:"camping_ground",RENT_A_CAR_FACILITY:"car_rental",CASINO:"casino_and_gambling",CEMETERY:"cemetery",ELECTRIC_VEHICLE_STATION:"charging_location",CINEMA:"cinema",MOVIE_THEATER:"cinema",HEALTH_CARE_SERVICE:"clinic",CLOTHING_SHOP:"clothing_shop",COFFEE_SHOP:"coffee_shop",COLLEGE_OR_UNIVERSITY:"college_or_university",COLLEGE_UNIVERSITY:"college_or_university",AGRICULTURE:"commercial_area",BUSINESS_PARK:"commercial_area",COMMERCIAL_BUILDING:"commercial_area",COMPANY:"commercial_area",RESIDENTIAL_ACCOMMODATION:"commercial_area",EXHIBITION_CONVENTION_CENTER:"conference_center",CLUB_ASSOCIATION:"consumer_service",PUBLIC_AMENITY:"consumer_service",WELFARE_ORGANIZATION:"consumer_service",COURTHOUSE:"courthouse",COMMUNITY_CENTER:"cultural_center",CULTURAL_CENTER:"cultural_center",DENTIST:"dentist",DEPARTMENT_STORE:"department_store",DOCTOR:"doctor",EMERGENCY_MEDICAL_SERVICE:"emergency_ward_entrance",EMERGENCY_ROOM:"emergency_ward_entrance",FAST_FOOD:"fast_food",FERRY_TERMINAL:"ferry_terminal",FIRE_STATION_BRIGADE:"fire_station",FITNESS_CLUB_CENTER:"fitness_center",WINERY:"food_and_drinks_shop",CURRENCY_EXCHANGE:"foreign_exchange",EXCHANGE:"foreign_exchange",GAS_STATION:"fuel_station",GOLD_EXCHANGE:"gold_exchange",GOLF_COURSE:"golf_course",EMBASSY:"government_office",GOVERNMENT_OFFICE:"government_office",HELIPAD_HELICOPTER_LANDING:"heliport_or_helipad",HISTORIC_SITE:"historic_site",HOLIDAY_RENTAL:"holiday_home",GENERAL_HOSPITAL_AND_POLYCLINIC:"hospital",HOSPITAL:"hospital",HOTEL_MOTEL:"hotel_or_motel",ICE_SKATING_RINK:"ice_rink",INDUSTRIAL_BUILDING:"industrial_area",PORT_WAREHOUSE_FACILITY:"industrial_area",PRIMARY_RESOURCE_UTILITY:"industrial_area",GEOGRAPHIC_FEATURE:"landmark",SHOPPING_CENTER:"mall",MANUFACTURING_FACILITY:"manufacturing_facility",MARINA:"marina",MARKET:"marketplace",MEDIA_FACILITY:"media_facility",MOUNTAIN_PASS:"mountain_pass",MUSEUM:"museum",NON_GOVERNMENTAL_ORGANIZATION:"ngo_office",CONCERT_HALL:"nightlife",ENTERTAINMENT:"nightlife",NIGHTLIFE:"nightlife",PARK_RECREATION_AREA:"park_and_recreation_area",TRAIL_SYSTEM:"park_and_recreation_area",LEISURE_CENTER:"park_and_recreation_facility",WATER_SPORT:"park_and_recreation_facility",OPEN_PARKING_AREA:"parking_facility",PARKING_GARAGE:"parking_facility",PHARMACY:"pharmacy",POLICE_STATION:"police_station",POST_OFFICE:"post_office",PRISON_CORRECTIONAL_FACILITY:"prison",PROTECTED_AREA:"protected_land",PUB:"pub",LIBRARY:"public_library",PUBLIC_TRANSPORT_STOP:"public_transport_stop",RAILWAY_STATION:"railway_station",CHURCH:"religious_site",GURUDWARA:"religious_site",MOSQUE:"religious_site",PAGODA:"religious_site",PLACE_OF_WORSHIP:"religious_site",SYNAGOG:"religious_site",TEMPLE:"religious_site",RENT_A_CAR_PARKING:"rental_car_parking",RESEARCH_FACILITY:"research_facility",REST_AREA:"rest_and_service_area",RESTAURANT:"restaurant",RESTAURANT_AREA:"restaurant",SCHOOL:"school_or_kindergarten",SHOP:"shop_or_store",ADVENTURE_SPORTS_FACILITY:"sport_facility",SPORTS_CENTER:"sport_facility",TENNIS_COURT:"sport_facility",STADIUM:"stadium",SUPERMARKETS_HYPERMARKETS:"supermarket",SWIMMING_POOL:"swimming_pool",TAXI_STAND:"taxi_stand",OPERA_HOUSE:"theater",THEATER:"theater",TOLL_GATE:"toll_booth",TOURIST_ATTRACTION:"tourist_attraction",TOURIST_INFORMATION_OFFICE:"tourist_information",TRUCK_STOP:"truck_stop",AUTOMOTIVE_DEALER:"vehicle_dealer",MOTORING_ORGANIZATION_OFFICE:"vehicle_inspection",TRAFFIC_CONTROL_DEPARTMENT:"vehicle_inspection",TRANSPORT_AUTHORITY_VEHICLE_REGISTRATION:"vehicle_inspection",REPAIR_FACILITY:"vehicle_repair",CAR_WASH:"vehicle_wash",VETERINARIAN:"veterinary",HILL:"viewpoint",MOUNTAIN_PEAK:"viewpoint",SCENIC_PANORAMIC_VIEW:"viewpoint",WEIGH_STATION:"weighbridge",AQUATIC_ZOO:"zoo_or_aquarium",ARBORETA_BOTANICAL_GARDENS:"zoo_or_aquarium",ZOOS_ARBORETA_BOTANICAL_GARDEN:"zoo_or_aquarium"},Me={...Ne,AIRFIELD:"airport",AIRLINE_ACCESS:"airport",PRIVATE_AIRPORT:"airport",PUBLIC_AIRPORT:"airport",ANIMAL_SHELTER:"animal_shelter",DIVERSIFIED_FINANCIALS:"bank",COCKTAIL_BAR:"bar",BEACH_CLUB:"beach_resort",SECURED_ENTRANCE:"border_control",INTERNET_CAFE:"cafe",CAFETERIA:"cafeteria",CARAVAN_SITE:"camping_ground",RECREATIONAL_CAMPING_GROUND:"camping_ground",REST_CAMP:"camping_ground",MAUSOLEUM_GRAVE:"cemetery",CHILD_CARE_FACILITY:"childcare",PRE_SCHOOL:"childcare",DRIVE_IN_MOVIES:"cinema",CHILDRENS_CLOTHES:"clothing_shop",MENS_CLOTHING:"clothing_shop",SPECIALTY_CLOTHING_SHOP:"clothing_shop",WOMENS_CLOTHING:"clothing_shop",JUNIOR_COLLEGE_COMMUNITY_COLLEGE:"college_or_university",COMEDY_CLUB:"comedy_club",ADVERTISING_COMPANY:"commercial_area",AGRICULTURAL_TECHNOLOGY:"commercial_area",AIRLINE_COMPANY:"commercial_area",APARTMENT_RENTAL:"commercial_area",AUTOMOBILE_COMPANY:"commercial_area",BUILDING:"commercial_area",BUSINESS_SERVICES:"commercial_area",BUS_CHARTER_COMPANY:"commercial_area",CABLE_TELEPHONE_COMPANY:"commercial_area",CLEANING_SERVICES:"commercial_area",COMPUTER_DATA_SERVICES:"commercial_area",CONSTRUCTION_COMPANY:"commercial_area",DELIVERY_SERVICE:"commercial_area",ELECTRONICS_COMPANY:"commercial_area",EQUIPMENT_RENTAL:"commercial_area",FARM:"commercial_area",FLATS_APARTMENT_COMPLEX:"commercial_area",HORTICULTURE:"commercial_area",IMPORT_EXPORT_AND_DISTRIBUTION:"commercial_area",INSURANCE_COMPANY:"commercial_area",INVESTMENT_ADVISOR:"commercial_area",LEGAL_SERVICES:"commercial_area",MINING_COMPANY:"commercial_area",MOVING_STORAGE_COMPANY:"commercial_area",OIL_NATURAL_GAS:"commercial_area",PHARMACEUTICAL_COMPANY:"commercial_area",PRIMARY_PRODUCER:"commercial_area",PUBLISHING_TECHNOLOGIES:"commercial_area",REAL_ESTATE_AGENT:"commercial_area",REAL_ESTATE_COMPANY:"commercial_area",RETIREMENT_COMMUNITY:"commercial_area",SERVICE_COMPANY:"commercial_area",SOFTWARE_COMPANY:"commercial_area",TAX_SERVICES:"commercial_area",TELECOMMUNICATIONS:"commercial_area",TRANSPORT_COMPANY:"commercial_area",TRAVEL_AGENT:"commercial_area",WEDDING_SERVICES:"commercial_area",PUBLIC_CALL_BOX:"consumer_service",PUBLIC_TOILET:"consumer_service",GENERAL_PRACTITIONER:"doctor",SPECIALIST:"doctor",AMBULANCE_UNIT:"emergency_ward_entrance",ROAD_RESCUE:"emergency_ward_entrance",MICROBREWERY:"food_and_drinks_shop",BATTLEFIELD:"historic_site",MEMORIAL:"historic_site",BUNGALOW_RENTAL:"holiday_home",CHALET_RENTAL:"holiday_home",COTTAGE_RENTAL:"holiday_home",VILLA_RENTAL:"holiday_home",HORSE_RIDING_CENTER:"horse_riding",BLOOD_BANK:"hospital",HOSPITAL_FOR_WOMEN_AND_CHILDREN:"hospital",HOSPITAL_OF_CHINESE_MEDICINE:"hospital",SPECIAL_HOSPITAL:"hospital",B_B_GUEST_HOUSE:"hotel_or_motel",CABINS_LODGES:"hotel_or_motel",HOSTEL:"hotel_or_motel",HOTEL:"hotel_or_motel",MOTEL:"hotel_or_motel",RESORT:"hotel_or_motel",ICE_CREAM_PARLOR:"ice_cream_shop",ICE_HOCKEY_ARENA:"ice_rink",CHEMICAL_COMPANY:"industrial_area",MECHANICAL_ENGINEERING:"industrial_area",QUARRY:"industrial_area",YOGURT_JUICE_BAR:"juice_bar",ARCH:"landmark",BAY:"landmark",BRIDGE:"landmark",CAPE:"landmark",COVE:"landmark",DAM:"landmark",DUNE:"landmark",ISLAND:"landmark",LOCALE:"landmark",MARSH:"landmark",MONUMENT:"landmark",OASIS:"landmark",OBSERVATORY:"landmark",PARKWAY:"landmark",PLAIN_FLAT:"landmark",PLATEAU:"landmark",RAPIDS:"landmark",REEF:"landmark",RESERVOIR:"landmark",RIVER_CROSSING:"landmark",ROCKS:"landmark",STATUE:"landmark",TOWER:"landmark",TUNNEL:"landmark",VALLEY:"landmark",WATER_HOLE:"landmark",WELL:"landmark",AUTOMOBILE_MANUFACTURING:"manufacturing_facility",MANUFACTURING_COMPANY:"manufacturing_facility",FARMERS_MARKET:"marketplace",FOOD_MARKET:"marketplace",INFORMAL_MARKET:"marketplace",PUBLIC_MARKET:"marketplace",MILITARY_AIRPORT:"military_airfield",FUNERAL_SERVICE_MORTUARIES:"mourning_facility",AMUSEMENT_PLACE:"nightlife",BETTING_STATION:"nightlife",CABARET_THEATER:"nightlife",DISCO_CLUB:"nightlife",FAIRGROUND:"nightlife",JAZZ_CLUB:"nightlife",KARAOKE_CLUB:"nightlife",MUSIC_CENTER:"nightlife",ADVENTURE_VEHICLE_TRAIL:"park_and_recreation_area",FISHING_HUNTING_AREA:"park_and_recreation_area",FOREST_AREA:"park_and_recreation_area",HIKING_TRAIL:"park_and_recreation_area",HISTORICAL_PARK:"park_and_recreation_area",HORSE_RIDING_TRAIL:"park_and_recreation_area",MOUNTAIN_BIKE_TRAIL:"park_and_recreation_area",PARK:"park_and_recreation_area",PICNIC_AREA:"park_and_recreation_area",RECREATION_AREA:"park_and_recreation_area",ROCK_CLIMBING_TRAIL:"park_and_recreation_area",WILDERNESS_AREA:"park_and_recreation_area",OPEN_CAR_PARKING_AREA:"parking_facility",BEAUTY_SALON:"personal_care_service",HAIRDRESSER:"personal_care_service",NAIL_SALON:"personal_care_service",PERSONAL_CARE_FACILITY:"personal_care_service",PERSONAL_SERVICE:"personal_care_service",SAUNA_SOLARIUM_MASSAGE:"personal_care_service",DRUG_STORE:"pharmacy",MARIJUANA_DISPENSARY:"pharmacy",MEDICINAL_MARIJUANA_DISPENSARY:"pharmacy",RECREATIONAL_MARIJUANA_DISPENSARY:"pharmacy",PLANETARIUM:"planetarium",COURIER_DROP_BOX:"post_depot",BUS_LINES:"public_transport_stop",PASSENGER_TRANSPORT_TICKET_OFFICE:"public_transport_stop",STREETCAR_STOP:"public_transport_stop",SUBWAY_STATION:"public_transport_stop",INTERNATIONAL_RAILROAD_STATION:"railway_station",NATIONAL_RAILROAD_STATION:"railway_station",STATION_ACCESS:"railway_station",URBAN_STATION:"railway_station",AFGHAN_RESTAURANT:"restaurant",AFRICAN_RESTAURANT:"restaurant",AMERICAN_RESTAURANT:"restaurant",ARABIAN_RESTAURANT:"restaurant",ARMENIAN_RESTAURANT:"restaurant",ASIAN_RESTAURANT:"restaurant",AUSTRALIAN_RESTAURANT:"restaurant",AUSTRIAN_RESTAURANT:"restaurant",BANQUET_ROOMS:"restaurant",BARBECUE_RESTAURANT:"restaurant",BASQUE_RESTAURANT:"restaurant",BELGIAN_RESTAURANT:"restaurant",BISTRO:"restaurant",BOLIVIAN_RESTAURANT:"restaurant",BRAZILIAN_RESTAURANT:"restaurant",BRITISH_RESTAURANT:"restaurant",BUFFET_RESTAURANT:"restaurant",BULGARIAN_RESTAURANT:"restaurant",BURMESE_RESTAURANT:"restaurant",CALIFORNIAN_RESTAURANT:"restaurant",CAMBODIAN_RESTAURANT:"restaurant",CANADIAN_RESTAURANT:"restaurant",CARIBBEAN_RESTAURANT:"restaurant",CATERING_SERVICES:"restaurant",CHICKEN_RESTAURANT:"restaurant",CHINESE_RESTAURANT:"restaurant",COLOMBIAN_RESTAURANT:"restaurant",CORSICAN_RESTAURANT:"restaurant",CREOLE_RESTAURANT:"restaurant",CREPERIE:"restaurant",CUBAN_RESTAURANT:"restaurant",CZECH_RESTAURANT:"restaurant",DANISH_RESTAURANT:"restaurant",DINNER_THEATER:"restaurant",DONGBEI_RESTAURANT:"restaurant",DOUGHNUT_RESTAURANT:"restaurant",DUTCH_RESTAURANT:"restaurant",EGYPTIAN_RESTAURANT:"restaurant",ENGLISH_RESTAURANT:"restaurant",ETHIOPIAN_RESTAURANT:"restaurant",FINNISH_RESTAURANT:"restaurant",FONDUE_RESTAURANT:"restaurant",FRENCH_RESTAURANT:"restaurant",FUSION_RESTAURANT:"restaurant",GERMAN_RESTAURANT:"restaurant",GREEK_RESTAURANT:"restaurant",GRILL_RESTAURANT:"restaurant",HAMBURGER_RESTAURANT:"restaurant",HAWAIIAN_RESTAURANT:"restaurant",HOT_POT_RESTAURANT:"restaurant",HUNAN_RESTAURANT:"restaurant",HUNGARIAN_RESTAURANT:"restaurant",INDIAN_RESTAURANT:"restaurant",INDONESIAN_RESTAURANT:"restaurant",INTERNATIONAL_RESTAURANT:"restaurant",IRANIAN_RESTAURANT:"restaurant",IRISH_RESTAURANT:"restaurant",ISRAELI_RESTAURANT:"restaurant",ITALIAN_RESTAURANT:"restaurant",JAMAICAN_RESTAURANT:"restaurant",JAPANESE_RESTAURANT:"restaurant",JEWISH_RESTAURANT:"restaurant",KOREAN_RESTAURANT:"restaurant",KOSHER_RESTAURANT:"restaurant",LATIN_AMERICAN_RESTAURANT:"restaurant",LEBANESE_RESTAURANT:"restaurant",MEDITERRANEAN_RESTAURANT:"restaurant",MEXICAN_RESTAURANT:"restaurant",MIDDLE_EASTERN_RESTAURANT:"restaurant",MONGOLIAN_RESTAURANT:"restaurant",MOROCCAN_RESTAURANT:"restaurant",NEPALESE_RESTAURANT:"restaurant",NORWEGIAN_RESTAURANT:"restaurant",ORGANIC_FOOD_RESTAURANT:"restaurant",ORIENTAL_RESTAURANT:"restaurant",PAKISTANI_RESTAURANT:"restaurant",PERUVIAN_RESTAURANT:"restaurant",PHILIPPINE_RESTAURANT:"restaurant",PIZZERIA:"restaurant",POLISH_RESTAURANT:"restaurant",POLYNESIAN_RESTAURANT:"restaurant",PORTUGUESE_RESTAURANT:"restaurant",PUB_FOOD:"restaurant",RUSSIAN_RESTAURANT:"restaurant",SALAD_BAR:"restaurant",SANDWICH_RESTAURANT:"restaurant",SCANDINAVIAN_RESTAURANT:"restaurant",SEAFOOD:"restaurant",SHANDONG_RESTAURANT:"restaurant",SICHUAN_RESTAURANT:"restaurant",SNACKS_RESTAURANT:"restaurant",SOUL_FOOD:"restaurant",SOUP_RESTAURANT:"restaurant",SPANISH_RESTAURANT:"restaurant",STEAK_HOUSE:"restaurant",SUSHI_RESTAURANT:"restaurant",SWEDISH_RESTAURANT:"restaurant",SWISS_RESTAURANT:"restaurant",SYRIAN_RESTAURANT:"restaurant",TAIWANESE_RESTAURANT:"restaurant",TAKEOUT_FOOD:"restaurant",TAPAS_RESTAURANT:"restaurant",TEPPANYAKI_RESTAURANT:"restaurant",THAI_RESTAURANT:"restaurant",TIBETAN_RESTAURANT:"restaurant",TUNISIAN_RESTAURANT:"restaurant",TURKISH_RESTAURANT:"restaurant",VEGETARIAN_RESTAURANT:"restaurant",VENEZUELAN_RESTAURANT:"restaurant",VIETNAMESE_RESTAURANT:"restaurant",WESTERN_RESTAURANT:"restaurant",ART_SCHOOL:"school_or_kindergarten",DANCE_STUDIO_SCHOOL:"school_or_kindergarten",DRIVING_SCHOOL:"school_or_kindergarten",HIGH_SCHOOL:"school_or_kindergarten",LANGUAGE_SCHOOL:"school_or_kindergarten",MIDDLE_SCHOOL:"school_or_kindergarten",PRIMARY_SCHOOL:"school_or_kindergarten",SENIOR_HIGH_SCHOOL:"school_or_kindergarten",VOCATIONAL_SCHOOL:"school_or_kindergarten",AGRICULTURAL_SUPPLIES:"shop_or_store",ANTIQUE_ART_SHOP:"shop_or_store",BAGS_LEATHERWEAR:"shop_or_store",BAKERY:"shop_or_store",BEAUTY_SUPPLIES:"shop_or_store",BOATING_EQUIPMENT_ACCESSORIES:"shop_or_store",BOOK_SHOP:"shop_or_store",BUTCHER:"shop_or_store",CAMERAS_PHOTOGRAPHY:"shop_or_store",CARPET_FLOOR_COVERINGS:"shop_or_store",CHRISTMAS_HOLIDAY_SHOP:"shop_or_store",COMPUTER_COMPUTER_SUPPLIES:"shop_or_store",CONSTRUCTION_MATERIAL_EQUIPMENT:"shop_or_store",CONSUMER_ELECTRONICS:"shop_or_store",CONVENIENCE_STORE:"shop_or_store",CURTAINS_TEXTILES:"shop_or_store",C_DS_DVD_VIDEOS:"shop_or_store",DELICATESSEN:"shop_or_store",DO_IT_YOURSELF_CENTERS:"shop_or_store",DRIVE_THROUGH_BOTTLE_SHOP:"shop_or_store",DRY_CLEANER:"shop_or_store",ELECTRICAL_APPLIANCES_SHOP:"shop_or_store",FACTORY_OUTLET:"shop_or_store",FISHMONGER:"shop_or_store",FLORISTS:"shop_or_store",FOOTWEAR_SHOE_REPAIRS:"shop_or_store",FURNITURE_HOME_FURNISHINGS:"shop_or_store",GARDEN_CENTERS_SERVICES:"shop_or_store",GIFTS_CARDS_NOVELTIES_SOUVENIRS:"shop_or_store",GLASSWARE_CERAMIC_SHOP:"shop_or_store",GLASS_WINDOWS_STORE:"shop_or_store",GREENGROCER:"shop_or_store",GROCERY_STORE:"shop_or_store",HARDWARE_STORE:"shop_or_store",HOBBY_SHOP:"shop_or_store",HOUSE_GARDEN_FURNITURE_FITTINGS:"shop_or_store",JEWELRY_CLOCKS_WATCHES:"shop_or_store",KITCHENS_BATHROOMS:"shop_or_store",LAUNDRY:"shop_or_store",LIGHTING_SHOPS:"shop_or_store",LOCAL_SPECIALITIES_SHOP:"shop_or_store",LOTTERY_SHOP:"shop_or_store",MEDICAL_SUPPLIES_EQUIPMENT:"shop_or_store",MOBILE_PHONE_SHOP:"shop_or_store",MUSIC_INSTRUMENTS_STORE:"shop_or_store",NEWSAGENTS_TOBACCONISTS:"shop_or_store",OFFICE_EQUIPMENT:"shop_or_store",OPTICIAN:"shop_or_store",OTHER_FOOD_SHOPS:"shop_or_store",PAINTING_DECORATING:"shop_or_store",PAWN_SHOP:"shop_or_store",PET_SUPPLIES:"shop_or_store",PHOTOCOPY_SHOP:"shop_or_store",PHOTO_LAB_DEVELOPMENT:"shop_or_store",RECYCLING_SHOP:"shop_or_store",RETAIL_OUTLET:"shop_or_store",SECURITY_PRODUCTS:"shop_or_store",SHOPPING_SERVICE:"shop_or_store",SPECIALTY_FOODS:"shop_or_store",SPORTS_EQUIPMENT_CLOTHING:"shop_or_store",TAILOR_SHOP:"shop_or_store",TOYS_GAMES_SHOP:"shop_or_store",VARIETY_STORE:"shop_or_store",VIDEO_RENTAL_SHOP:"shop_or_store",WHOLESALE_CLUB:"shop_or_store",WINE_SPIRITS:"shop_or_store",ATHLETICS_TRACK:"sport_facility",BASEBALL_PARK:"sport_facility",BASKETBALL_ARENA:"sport_facility",BOWLING_CENTER:"sport_facility",CRICKET_GROUND:"sport_facility",HOCKEY_CLUB:"sport_facility",HORSE_RACING_TRACK:"sport_facility",RACE_TRACK:"sport_facility",RUGBY_GROUND:"sport_facility",SNOOKER_POOL_BILLIARD:"sport_facility",THEMATIC_SPORT_CENTER:"sport_facility",FOOTBALL_STADIUM:"stadium",MOTOR_RACING_STADIUM:"stadium",MULTI_PURPOSE_STADIUM:"stadium",NETBALL_STADIUM:"stadium",SOCCER_STADIUM:"stadium",STOCK_EXCHANGE:"stock_exchange",TAXI_LIMOUSINE_SHUTTLE_SERVICE:"taxi_stand",TEA_HOUSE:"tea_house",AMPHITHEATER:"theater",CAVE:"tourist_attraction",MINERAL_HOT_SPRINGS:"tourist_attraction",NATURAL_TOURIST_ATTRACTION:"tourist_attraction",BOAT_LAUNCHING_RAMP:"transport_access",HARBOR:"transport_access",YACHT_BASIN:"transport_access",ATV_DEALER:"vehicle_dealer",BOAT_DEALER:"vehicle_dealer",BUS_DEALER:"vehicle_dealer",CAR_DEALER:"vehicle_dealer",MOTORCYCLE_DEALER:"vehicle_dealer",RECREATIONAL_VEHICLE_DEALER:"vehicle_dealer",TRUCK_DEALER:"vehicle_dealer",VAN_DEALER:"vehicle_dealer",ROAD_TRAFFIC_CONTROL_CENTER:"vehicle_inspection",BODYSHOP:"vehicle_repair",CAR_GLASS_REPLACEMENT_SHOP:"vehicle_repair",CAR_REPAIR_AND_SERVICE:"vehicle_repair",HOME_APPLIANCE_REPAIR:"vehicle_repair",MOTORCYCLE_REPAIR:"vehicle_repair",TIRE_SERVICE:"vehicle_repair",TRUCK_REPAIR_AND_SERVICE:"vehicle_repair",ANIMAL_SERVICES:"veterinary",RIDGE:"viewpoint",OTHER_WINTER_SPORT:"winter_sports",SKI_RESORT:"winter_sports",WILDLIFE_PARK:"zoo_or_aquarium",ZOO:"zoo_or_aquarium"},xe=e=>Me[e],De=Array.from(new Set(Object.values(Me))),Fe={bar:"eat_and_drink",cafe:"eat_and_drink",cafeteria:"eat_and_drink",coffee_shop:"eat_and_drink",fast_food:"eat_and_drink",ice_cream_shop:"eat_and_drink",juice_bar:"eat_and_drink",pub:"eat_and_drink",restaurant:"eat_and_drink",tea_house:"eat_and_drink",clothing_shop:"shopping",department_store:"shopping",food_and_drinks_shop:"shopping",mall:"shopping",marketplace:"shopping",shop_or_store:"shopping",supermarket:"shopping",atm:"finance",bank:"finance",foreign_exchange:"finance",gold_exchange:"finance",stock_exchange:"finance",camping_ground:"lodging",holiday_home:"lodging",hotel_or_motel:"lodging",airport:"transport",bus_station:"transport",ferry_terminal:"transport",heliport_or_helipad:"transport",marina:"transport",public_transport_stop:"transport",railway_station:"transport",taxi_stand:"transport",transport_access:"transport",border_control:"driving",car_rental:"driving",charging_location:"driving",fuel_station:"driving",rest_and_service_area:"driving",toll_booth:"driving",truck_stop:"driving",vehicle_dealer:"driving",vehicle_inspection:"driving",vehicle_repair:"driving",vehicle_wash:"driving",weighbridge:"driving",parking_facility:"parking",rental_car_parking:"parking",clinic:"healthcare",dentist:"healthcare",doctor:"healthcare",emergency_ward_entrance:"healthcare",hospital:"healthcare",pharmacy:"healthcare",veterinary:"healthcare",childcare:"education",college_or_university:"education",research_facility:"education",school_or_kindergarten:"education",cultural_center:"cultural",historic_site:"cultural",museum:"cultural",planetarium:"cultural",theater:"cultural",amusement_park:"leisure",beach_resort:"leisure",casino_and_gambling:"leisure",cinema:"leisure",comedy_club:"leisure",nightlife:"leisure",park_and_recreation_facility:"leisure",tourist_attraction:"leisure",tourist_information:"leisure",zoo_or_aquarium:"leisure",fitness_center:"sport",golf_course:"sport",horse_riding:"sport",ice_rink:"sport",sport_facility:"sport",stadium:"sport",swimming_pool:"sport",winter_sports:"sport",aboriginal_land:"outdoor",landmark:"outdoor",mountain_pass:"outdoor",park_and_recreation_area:"outdoor",viewpoint:"outdoor",protected_land:"protected",cemetery:"public",courthouse:"public",fire_station:"public",government_office:"public",police_station:"public",post_depot:"public",post_office:"public",prison:"public",public_library:"public",military_airfield:"military",religious_site:"religion",animal_shelter:"business",commercial_area:"business",conference_center:"business",consumer_service:"business",industrial_area:"business",manufacturing_facility:"business",media_facility:"business",mourning_facility:"business",ngo_office:"business",personal_care_service:"business"},Pe=e=>{const t=xe(e);return t?Fe[t]:void 0},Ue="Noto-Bold",He=.8,ke=["interpolate",["linear"],["zoom"],8,.6,22,He],We="title",Be="iconID",Ve=.7,Ge="default_place",je="poi-parking-micro",ze={"icon-image":["get",Be],"icon-anchor":"bottom","icon-size":ke,"icon-allow-overlap":!0,"icon-padding":0},$e={"icon-translate":[0,5],"icon-translate-anchor":"viewport"},Ye={"text-optional":!0,"text-font":[Ue],"text-field":["get",We],"text-justify":"auto","text-variable-anchor":["top","left","right"],"text-variable-anchor-offset":["top",[0,Ve],"left",[1.4,-1.4],"right",[-1.4,-1.4]],"text-size":["interpolate",["linear"],["zoom"],10,14,18,16],"text-padding":5},qe={"text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"},Ke={type:"symbol",layout:{...ze,...Ye},paint:{...$e,...qe}},Xe=(e,t)=>`${e}-${t}`,Ze=["has","point_count"],Je=["!",Ze],Qe="clusterBaseMapIconIDs",et=["all",Ze,["==",["index-of",",",["get",Qe]],-1]],tt=["all",Ze,[">=",["index-of",",",["get",Qe]],0]],it=[12,-14],rt={[Qe]:(G="baseMapIconID",j=Qe,[["case",["==",["get",j],null],["accumulated"],["==",["accumulated"],null],["get",j],[">=",["index-of",["concat",",",["get",j],","],["concat",",",["accumulated"],","]],0],["accumulated"],["concat",["accumulated"],",",["get",j]]],["get",G]])},st=e=>{const t=["match",e];for(const i of De){const e=`poi-${i}`;t.push(e,["image",e])}return t.push(["image",je]),t},at={type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#3f9cd9","line-width":1.5,"line-dasharray":[2,2],"line-opacity":.9}},ot={type:"symbol",layout:{"symbol-placement":"line-center","text-field":["get","label"],"text-size":12,"text-offset":[0,-1],"text-allow-overlap":!1,"text-ignore-placement":!1,"text-keep-upright":!0},paint:{"text-color":"#1a5f8a","text-halo-color":"#ffffff","text-halo-width":1.5}},nt=(e,t)=>{if(!e)return;const i=(e=>{try{if("string"==typeof e){if(e.includes("<svg")){const t=B(e),i=t.getAttribute("viewBox");if(i){const e=i.split(/\s+/);if(4===e.length)return{width:Number.parseFloat(e[2]),height:Number.parseFloat(e[3])}}const r=t.getAttribute("width"),s=t.getAttribute("height");if(r&&s)return{width:Number.parseFloat(r),height:Number.parseFloat(s)}}return null}return e.complete&&e.naturalWidth>0?{width:e.naturalWidth,height:e.naturalHeight}:null}catch(t){return console.warn("Failed to extract image dimensions:",t),null}})(e);if(!i)return;const r="base-map"===t||"circle-icon"===t,s=r?54:140,a=r?54:120;return{heightScale:i.height/s,widthScale:i.width/a}},lt=e=>Boolean(e&&"availability"in e&&e.availability),ct=e=>"ELECTRIC_VEHICLE_STATION"===e.properties.poi?.categories?.[0]&&lt(e.properties.chargingPark),ht=e=>{const t=e.properties.chargingPark;if(lt(t)){const e=t.availability.chargingPointAvailability,i=e.statusCounts.Available??0;return{availableCount:i,totalCount:e.count,ratio:i/e.count}}},ut=(e,t)=>`${e}/${t}`,dt=e=>ht(e)?.ratio??0,pt=e=>["case",[">=",["get","evAvailabilityRatio"],e?.threshold??0],"green","red"],yt=e=>Math.round(1e4*e)/1e4,ft=(e,t,i,r)=>{const s=void 0!==r;return{top:s?[0,r]:[0,yt(e)],left:s?[r,yt(i)]:[yt(t),yt(i)],right:s?[-r,yt(i)]:[-yt(t),yt(i)]}},gt=(e,t,i,r)=>{const s=(e=>{if(!e)return He;if("number"==typeof e)return e;if(Array.isArray(e)){const t=e.at(-1);if("number"==typeof t)return t}if("object"==typeof e&&"stops"in e){const t=e.stops;if(Array.isArray(t)&&t.length>0){const e=t.at(-1);if(Array.isArray(e)&&"number"==typeof e[1])return e[1]}}return He})(e)/He,a="base-map"===i||"circle-icon"===i;if(a&&void 0!==r)return{"text-offset":[r,r]};const o=1.4*s,n=ft(Ve*s,o,a?0:-o,r),l=["top",n.top,"left",n.left,"right",n.right];if(0===t.size)return{"text-variable-anchor-offset":l};const c=["case"];for(const[h,u]of t.entries()){const e=(a?1.4:Ve)*u.heightScale,t=1.4*u.widthScale,i=ft(e,t,a?0:-t,r);c.push(["==",["get",Be],h],["literal",["top",i.top,"left",i.left,"right",i.right]])}return c.push(["literal",l]),{"text-variable-anchor-offset":c}},mt=(e,t,i,r,s)=>{const a=t?.text,o=t?.layers?.[i],n=s&&s.size>0,l={...e.layout},c=n||void 0!==a?.offset||"circle-icon"===t?.theme;c&&(delete l["text-offset"],delete l["text-variable-anchor-offset"],delete l["text-radial-offset"]);const h={...l,...o?.layout,...a?.size&&{"text-size":a.size},...a?.font&&{"text-font":a.font},...void 0!==r&&{"text-field":r}};if(c){const e=h["icon-size"],i=s??/* @__PURE__ */new Map;return{...h,...gt(e,i,t?.theme,a?.offset)}}return h},_t=(e,t,i,r)=>{const s=t?.text,a=t?.layers?.[i],{textColor:o,haloColor:n}=(e=>({textColor:"dark"===e?"#FFFFFF":"#333333",haloColor:"dark"===e?"#333333":"#FFFFFF"}))(r),l=e.paint??{};return{...l,...void 0===l["text-color"]&&{"text-color":o},...void 0===l["text-halo-color"]&&{"text-halo-color":n},...s?.color&&{"text-color":s.color},...s?.haloColor&&{"text-halo-color":s.haloColor},...s?.haloWidth&&{"text-halo-width":s.haloWidth},...a?.paint}},Lt=["in",["get","eventState"],["literal",["click","contextmenu"]]],At=e=>JSON.parse(JSON.stringify(e)?.replaceAll("name",We)),St=(e,t)=>e.getStyle().layers.find(e=>e.id===t)??{},It=e=>({filter:["!",Lt],type:"symbol",paint:e.paint,layout:e.layout?r(e.layout,"visibility"):void 0}),Et=e=>{const t=It(St(e,"POI")),i=t.layout?.["text-size"];return{...t,layout:{...t.layout,"icon-image":["get",Be],"text-field":["get",We],...i&&{"text-size":At(i)}}}},bt=e=>{const t=It(St(e,"POI - Micro"));return{...t,minzoom:0,layout:{...t.layout,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{...t.paint,"icon-opacity":1}}},Rt=e=>{const t=St(e,"POI").layout??{};return{...Ke,layout:{...Ke.layout,"icon-anchor":"center",...void 0!==t["icon-size"]&&{"icon-size":t["icon-size"]},...void 0!==t["icon-padding"]&&{"icon-padding":t["icon-padding"]}},paint:{...Ke.paint,"icon-translate":[0,0]}}},Tt=["has","eventState"],Ct={type:"symbol",layout:{visibility:"none"}},vt={type:"circle",layout:{visibility:"none"}},wt="#3f9cd9",Ot={...Ke,filter:["!",Tt]},Nt={...Ke,filter:Tt,layout:{...Ke.layout,"icon-size":["interpolate",["linear"],["zoom"],8,.8,22,1],"text-allow-overlap":!0},paint:{...Ke.paint,"text-color":wt}},Mt=e=>({...e,filter:Tt,layout:{...e.layout,"text-allow-overlap":!0},paint:{...e.paint,"text-color":wt}}),xt=(e,t,i,r,s)=>{const a=t?.text,o=t?.layers?.[i],n=!0===t?.evAvailability?.enabled,l=a?.title&&"function"!=typeof a?.title?a.title:n?((e,t)=>t?["case",["has","evAvailabilityText"],["format",["get",We],{},"\n",{},["get","evAvailabilityText"],{"font-scale":1.1,"text-color":pt(e?.evAvailability)}],["get",We]]:["get",We])(t,n):void 0;return{...e,...o,layout:mt(e,t,i,l,s),paint:_t(e,t,i,r)}},Dt=(e,t,i,r)=>{const s=((e,t)=>{const i=/* @__PURE__ */new Map,r=e?.icon?.categoryIcons??[];for(const s of r)if(s.image){const r=nt(s.image,e?.theme);if(void 0!==r){const e=Xe(s.id,t);if(i.set(e,r),s.availabilityLevel){const e=Xe(`${s.id}-${s.availabilityLevel}`,t);i.set(e,r)}}}return i})(e,r);let a,o,n=Ct,l=Ct,c=vt,h=Ct,u=vt,d=Ct;if("base-map"===e?.theme)a={...Et(t),minzoom:10},n=bt(t),o=(e=>Mt(Et(e)))(t);else if("circle-icon"===e?.theme)a=(e=>({...Rt(e),filter:["!",Tt]}))(t),o=(e=>Mt(Rt(e)))(t);else if("pin-clustered"===e?.theme){a={...Ot,filter:["all",Je,["!",Tt]]},o={...Nt,filter:["all",Je,Tt]};const e=bt(t);n={...e,filter:e.filter?["all",Je,e.filter]:Je},l={type:"symbol",filter:et,layout:{"icon-image":st(["get",Qe]),"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}},c={type:"circle",filter:et,paint:{"circle-radius":11,"circle-color":"#000000","circle-stroke-color":"#FFFFFF","circle-stroke-width":1.5,"circle-translate":it,"circle-translate-anchor":"viewport"}},h={type:"symbol",filter:et,layout:{"text-field":["get","point_count_abbreviated"],"text-font":[Ue],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#FFFFFF","text-translate":it,"text-translate-anchor":"viewport"}},u={type:"circle",filter:tt,paint:{"circle-radius":15,"circle-color":"#000000","circle-stroke-color":"#FFFFFF","circle-stroke-width":1.5}},d={type:"symbol",filter:tt,layout:{"text-field":["get","point_count_abbreviated"],"text-font":[Ue],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#FFFFFF"}}}else a=Ot,o=Nt;return{micro:{...xt(n,e,"micro",i,s),beforeID:Ie.lowestPlaceLabel},main:{...xt(a,e,"main",i,s),beforeID:"selected"},selected:xt(o,e,"selected",i,s),cluster:{...l,...e?.layers?.cluster,beforeID:"clusterBadge"},clusterBadge:{...c,...e?.layers?.clusterBadge,beforeID:"clusterCount"},clusterCount:{...h,...e?.layers?.clusterCount,beforeID:"clusterMixedBadge"},clusterMixedBadge:{...u,...e?.layers?.clusterMixedBadge,beforeID:"clusterMixedCount"},clusterMixedCount:{...d,...e?.layers?.clusterMixedCount},...e?.layers?.additional}},Ft=e=>{if(k())return W(V(e))},Pt=(e,t)=>"string"!=typeof e?e:t.features.find(t=>t.id===e),Ut=new Set([7339002,8099002,7369004,7321003,7376006,9362003,9362004,9160004,9376007,7315015,9376006,9376002,7315078,7315149,9376005,7372003,9352045,9352032,9361048,9902003,9378005,7383004,9910004,7320002,9362016,7320003,9362025,9942002,9942003,7380005,9663003,9361021,9379009,9379004,7315147,9376003,9160002,9160003,9352008,9361006,7389004,9910006]),Ht=e=>e.properties.poi?.name??e.properties.address.freeformAddress,kt=(e,t,i)=>{if("pin"===t||"pin-clustered"===t)return(e=>{if(e)return Ut.has(e)?e.toString():e.toString().substring(0,4)})(A[e])??i;{const t=xe(e);return t?`poi-${t}`:i}},Wt=(e,t,i={})=>{const r=i.theme??"pin",s=((e,t)=>e.icon?.default||"base-map"!==(e.theme??"pin")?Xe(Ge,t):je)(i,t),a=i.icon?.mapping;if(a)return"imageID"===a.to?a.fn(e):kt(a.fn(e),r,s);const o=e.properties.poi?.categories?.[0],n=((e,t,i,r,s)=>{if(!r.evAvailability?.enabled||!ct(e))return;const a=dt(e)>=(r.evAvailability.threshold??.3)?"available":"occupied",o=r.icon?.categoryIcons&&r.icon.categoryIcons.length>0,n=r.icon?.categoryIcons?.find(e=>e.id===t&&e.availabilityLevel===a);return n?Xe(`${n.id}-${a}`,i):o||"pin"!==s?void 0:`7309-${a}`})(e,o,t,i,r);if(n)return n;const l=i.icon?.categoryIcons?.find(e=>e.id===o);return l?Xe(l.id,t):kt(o,r,s)},Bt=(e,t)=>{const i=t?.icon?.mapping;return"poiCategory"===i?.to?i.fn(e):e.properties.poi?.categories?.[0]},Vt=(e,t)=>{const i=Bt(e,t);return i&&xe(i)},Gt=(e,t)=>{const i=Bt(e,t);return i&&Pe(i)},jt=e=>Array.isArray(e)?{type:"FeatureCollection",features:e}:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:e,zt=(e,t,i)=>{if(!0!==t?.enabled)return e;let r=!1,s=!1;for(const a of i.features)if("ELECTRIC_VEHICLE_STATION"===a.properties.poi?.categories?.[0]&&(r=!0,ct(a))){s=!0;break}return r&&!s&&console.warn("PlacesModule: evAvailability is enabled but no availability data found. Did you call getPlacesWithEVAvailability()?"),{...e,evAvailabilityText:e=>ct(e)?((e,t)=>{const i=ht(e);return i?(t?.formatText??ut)(i.availableCount,i.totalCount):""})(e,t):"",evAvailabilityRatio:e=>ct(e)?dt(e):0}},$t=(e,t)=>{const i=Vt(e,t);return i?`poi-${i}`:je},Yt=(e,t,i={})=>{const r=jt(e),s=!0===i.evAvailability?.enabled?zt(i.extraFeatureProps,i.evAvailability,r):i.extraFeatureProps;return{...r,features:r.features.map(e=>{const r="function"==typeof i?.text?.title?i?.text?.title(e):Ht(e),a=s?Object.fromEntries(Object.entries(s).map(([t,i])=>[t,"function"==typeof i?i(e):i])):{},o=e.id??p();return{...e,id:o,geometry:{...e.geometry,bbox:e.bbox},properties:{...e.properties,id:o,title:r,iconID:Wt(e,t,i),...("base-map"===i?.theme||"pin-clustered"===i?.theme)&&{category:Vt(e,i),group:Gt(e,i)},..."pin-clustered"===i?.theme&&{baseMapIconID:$t(e,i)},...a}}})}},qt=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.currentClusterMode=!1,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){t||(this.sourceID=`places-${this.instanceIndex}`,this.unclusteredSourceID=`places-${this.instanceIndex}-unclustered`,this.connectionSourceID=`places-connections-${this.instanceIndex}`,this.layerIDPrefix=this.sourceID,this.defaultPlaceIconID=Xe(Ge,this.instanceIndex),this.shownConnections=[]),this.layerSpecs=this.buildLayerSpecs(e);const i=this.buildClusterOptions(e);this.currentClusterMode=!0===i?.cluster;const r=this.partitionSpecsForSources(this.layerSpecs),s=new te(this.mapLibreMap,this.sourceID,r.clusteredSpecs,!1,i);let a;r.unclusteredSpecs.length>0&&(a=new te(this.mapLibreMap,this.unclusteredSourceID,r.unclusteredSpecs,!1)),ne([...s._layerSpecs,...a?._layerSpecs??[]],this.mapLibreMap),this.connectionLayerSpecs=this.buildConnectionLayerSpecs(e);const o=new te(this.mapLibreMap,this.connectionSourceID,Object.values(this.connectionLayerSpecs),!1);return ne(o._layerSpecs,this.mapLibreMap),a?{places:s,placesUnclustered:a,connections:o}:{places:s,connections:o}}partitionSpecsForSources(e){if(!this.currentClusterMode)return{clusteredSpecs:Object.values(e),unclusteredSpecs:[]};const t=[],i=[];for(const[r,s]of Object.entries(e))"micro"===r?t.push(s):i.push(s);return{clusteredSpecs:i,unclusteredSpecs:t}}buildLayerSpecs(e){const t=Dt(e,this.tomtomMap.mapLibreMap,this.tomtomMap.styleLightDarkTheme,this.instanceIndex),i=new Set(Object.keys(t));return Object.fromEntries(Object.entries(t).map(([e,t])=>{const r=t.beforeID;return[e,{...t,id:`${this.layerIDPrefix}-${e}`,...r&&i.has(r)?{beforeID:`${this.layerIDPrefix}-${r}`}:{}}]}))}buildClusterOptions(e){if("pin-clustered"===e?.theme)return{cluster:!0,clusterRadius:60,clusterProperties:rt}}buildConnectionLayerSpecs(e){const t=(e=>{const t=e?.layers?.line,i=e?.layers?.label;return{line:{...at,...t,layout:{...at.layout,...t?.layout},paint:{...at.paint,...t?.paint}},label:{...ot,...i,layout:{...ot.layout,...i?.layout},paint:{...ot.paint,...i?.paint}}}})(e?.connections),i=`${this.layerIDPrefix}-connection-line`,r=`${this.layerIDPrefix}-connection-label`,s=Ie.lowestLabel;return{line:{...t.line,id:i,beforeID:s},label:{...t.label,id:r,beforeID:s}}}_applyConfig(e){return this.updateLayersAndData(e),e}restoreDataAndConfigImpl(){const e=this.sourcesWithLayers.places.shownFeatures,t=this.shownConnections;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),this.show(e),t.length&&this.showConnections(t)}applyTheme(e){this.applyConfigPart({theme:e})}applyIconConfig(e){this.applyConfigPart({icon:e})}applyTextConfig(e){this.applyConfigPart({text:e})}applyConfigPart(e){const t={...this.config,...e};this.updateLayersAndData(t),this.config=t,this.emitConfigChange()}applyExtraFeatureProps(e){const t={...this.config,extraFeatureProps:e};this.updateData(t),this.config=t,this.emitConfigChange()}updateLayersAndData(e){if(this.setupImages(e),!0===this.buildClusterOptions(e)?.cluster!==this.currentClusterMode)return void this.rebuildSourcesAndLayers(e);const t=this.buildLayerSpecs(e),i=this.currentClusterMode?this.partitionSpecsForSources(t):{clusteredSpecs:Object.values(t),unclusteredSpecs:[]},r=this.currentClusterMode?this.partitionSpecsForSources(this.layerSpecs):{clusteredSpecs:Object.values(this.layerSpecs),unclusteredSpecs:[]};oe(i.clusteredSpecs,r.clusteredSpecs,this.sourcesWithLayers.places,this.mapLibreMap),this.sourcesWithLayers.placesUnclustered&&i.unclusteredSpecs.length>0&&oe(i.unclusteredSpecs,r.unclusteredSpecs,this.sourcesWithLayers.placesUnclustered,this.mapLibreMap),this.layerSpecs=t,this.applyPlacesVisibility(),this.updateData(e),this.updateConnectionLayersAndData(e)}rebuildSourcesAndLayers(e){const t=this.sourcesWithLayers.places.shownFeatures,i=this.shownConnections;for(const s of Object.values(this.layerSpecs))this.mapLibreMap.getLayer(s.id)&&this.mapLibreMap.removeLayer(s.id);for(const s of Object.values(this.connectionLayerSpecs))this.mapLibreMap.getLayer(s.id)&&this.mapLibreMap.removeLayer(s.id);this.mapLibreMap.getSource(this.sourceID)&&this.mapLibreMap.removeSource(this.sourceID),this.mapLibreMap.getSource(this.unclusteredSourceID)&&this.mapLibreMap.removeSource(this.unclusteredSourceID),this.mapLibreMap.getSource(this.connectionSourceID)&&this.mapLibreMap.removeSource(this.connectionSourceID),this.initSourcesWithLayers(e,!0),this.setupImages(e);const r=Yt(t,this.instanceIndex,e);this.sourcesWithLayers.places.show(r,{automaticVisibility:!1}),this.sourcesWithLayers.placesUnclustered?.show(r,{automaticVisibility:!1}),this.applyPlacesVisibility(),i.length&&(this.shownConnections=[...i],this.updateConnectionsData(e))}updateConnectionLayersAndData(e){const t=this.buildConnectionLayerSpecs(e),i=this.sourcesWithLayers.connections;oe(Object.values(t),Object.values(this.connectionLayerSpecs),i,this.mapLibreMap),this.connectionLayerSpecs=t,this.updateConnectionsData(e)}updateConnectionsData(e){const t=this.sourcesWithLayers.places.shownFeatures;this.sourcesWithLayers.connections.show(((e,t,i={})=>{const r=i.connections?.label,s=[];for(const a of e){const e=Pt(a.from,t),i=Pt(a.to,t);if(!e||!i)continue;const o=a.id??p(),n=r?r(a):"";s.push({type:"Feature",id:o,geometry:{type:"LineString",coordinates:[e.geometry.coordinates,i.geometry.coordinates]},properties:{id:o,fromId:"string"==typeof a.from?a.from:e.id,toId:"string"==typeof a.to?a.to:i.id,label:n}})}return{type:"FeatureCollection",features:s}})(this.shownConnections,t,e))}applyPlacesVisibility(){const e=this.sourcesWithLayers.places.shownFeatures.features.length?"visible":"none";for(const t of Object.values(this.layerSpecs))"none"!==t.layout?.visibility&&this.mapLibreMap.setLayoutProperty(t.id,"visibility",e,{validate:!1})}setupImages(e){if(e?.icon){for(const t of e.icon.categoryIcons??[])he("if-not-in-sprite",Xe(t.availabilityLevel?`${t.id}-${t.availabilityLevel}`:t.id,this.instanceIndex),t.image,this.mapLibreMap,{pixelRatio:t.pixelRatio??2});e.icon.default&&(e.icon.default.image&&he("if-not-in-sprite",this.defaultPlaceIconID,e.icon.default.image.image,this.mapLibreMap,{pixelRatio:e.icon.default.image.pixelRatio??2}),e.icon.default.style&&he("if-not-in-sprite",this.defaultPlaceIconID,Ft(e.icon.default.style),this.mapLibreMap,{pixelRatio:2}))}else he("if-not-in-sprite",this.defaultPlaceIconID,Ft(),this.mapLibreMap,{pixelRatio:2})}updateData(e){const t=Yt(this.sourcesWithLayers.places.shownFeatures,this.instanceIndex,e);this.sourcesWithLayers.places.source.runtimeSource?.setData(t),this.sourcesWithLayers.placesUnclustered?.source.runtimeSource?.setData(t)}async show(e){await this.waitUntilModuleReady(),this.clearConnectionsSync();const t=Yt(e,this.instanceIndex,this.config);this.sourcesWithLayers.places.show(t,{automaticVisibility:!1}),this.sourcesWithLayers.placesUnclustered?.show(t,{automaticVisibility:!1}),this.applyPlacesVisibility();for(const i of this.shownFeaturesHandlers)i(e)}async clear(){await this.waitUntilModuleReady(),this.clearConnectionsSync(),this.sourcesWithLayers.places.clear(),this.sourcesWithLayers.placesUnclustered?.clear()}async showConnections(e){await this.waitUntilModuleReady(),this.shownConnections=[...e],this.updateConnectionsData(this.config)}async clearConnections(){await this.waitUntilModuleReady(),this.clearConnectionsSync()}clearConnectionsSync(){this.shownConnections=[],this.sourcesWithLayers.connections?.clear()}getShown(){return{places:this.sourcesWithLayers.places.shownFeatures,connections:[...this.shownConnections]}}putEventState(e){this.sourcesWithLayers.places.putEventState(e)}cleanEventState(e){this.sourcesWithLayers.places.cleanEventState(e)}cleanEventStates(e){this.sourcesWithLayers.places.cleanEventStates(e)}get events(){return new ye(new we(this.eventsProxy,this.sourcesWithLayers.places,this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}},Kt=e=>{if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Kt(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}},Xt=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,Zt=(e,t)=>{return t?["all",e[(i=t,Kt(i)?"expression":"legacy")],t]:e.expression;var i},Jt=(e,t,i)=>{if(1===i.length){const r="only"===t?"==":"!=";return{expression:[r,["get",e],i[0]],legacy:[r,e,i[0]]}}const r=["in",["get",e],["literal",i]];return"only"===t?{expression:r,legacy:["in",e,...i]}:{expression:["!",r],legacy:["!in",e,...i]}},Qt=(e,t,i)=>Jt(e,t.show,i?t.values.map(i):t.values),ei={FOOD_DRINKS_GROUP:["RESTAURANT","FAST_FOOD","CAFE_PUB","PUB","WINERY","PUB_FOOD","SOUL_FOOD","DELICATESSEN"],SHOPPING_GROUP:["SHOP","SHOPPING_CENTER","CLOTHING_SHOP","MARKET","FOOD_MARKET","SUPERMARKETS_HYPERMARKETS","DEPARTMENT_STORE","CONVENIENCE_STORE","GROCERY_STORE","HARDWARE_STORE","ELECTRICAL_APPLIANCES_SHOP"],TRANSPORTATION_GROUP:["AIRPORT","FERRY_TERMINAL","HELIPAD_HELICOPTER_LANDING","PUBLIC_TRANSPORT_STOP","RAILWAY_STATION","BUS_STOP","TAXI_STAND"],HEALTH_GROUP:["DOCTOR","EMERGENCY_MEDICAL_SERVICE","EMERGENCY_ROOM","HEALTH_CARE_SERVICE","HOSPITAL","PHARMACY","DENTIST","WELFARE_ORGANIZATION"],PARKING_GROUP:["PARKING_GARAGE","OPEN_PARKING_AREA"],HOLIDAY_TOURISM_GROUP:["AMUSEMENT_PARK","BEACH","HOLIDAY_RENTAL","GEOGRAPHIC_FEATURE","TOURIST_ATTRACTION","LEISURE_CENTER","MOUNTAIN_PASS","MOUNTAIN_PEAK","MUSEUM","SCENIC_PANORAMIC_VIEW","TOURIST_INFORMATION_OFFICE"],EV_CHARGING_STATIONS_GROUP:["ELECTRIC_VEHICLE_STATION"],GAS_STATIONS_GROUP:["GAS_STATION"],ACCOMMODATION_GROUP:["CAMPING_GROUND","HOTEL_MOTEL","HOLIDAY_RENTAL"],ENTERTAINMENT_GROUP:["CINEMA","THEATER","MOVIE_THEATER","NIGHTLIFE","CONCERT_HALL","ENTERTAINMENT","CLUB_ASSOCIATION","CASINO"],SPORTS_LEISURE_GROUP:["SPORTS_CENTER","WATER_SPORT","SWIMMING_POOL","GOLF_COURSE","STADIUM","BEACH","ICE_SKATING_RINK","LEISURE_CENTER","MOUNTAIN_PASS","MOUNTAIN_PEAK"],EDUCATION_GROUP:["SCHOOL","COLLEGE_UNIVERSITY","LIBRARY","CULTURAL_CENTER"],GOVERNMENT_GROUP:["GOVERNMENT_OFFICE","COURTHOUSE","EMBASSY","FIRE_STATION_BRIGADE","POLICE_STATION"]},ti=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{id:String(t?.id),name:t?.name,category:t?.category,group:t?.group,priority:t?.priority}}},ii=e=>{const t=[];return e.forEach(e=>{e in ei?t.push(...ei[e].map(xe)):t.push(xe(e))}),[...new Set(t)]},ri=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(Ee);if(!t)throw H(`init ${e.name} with source ID ${Ee}`);const i=new J(this.mapLibreMap,t,e=>Oe.includes(e.id)),r=i.sourceAndLayerIDs.layerIDs[0];return this.mapLibreMap.getLayer(r)&&(this.originalFilter=this.mapLibreMap.getFilter(r)),{poi:i}}_applyConfig(e){return e&&!i(e.visible)?this._setVisible(e.visible,!1):this._initializing||this.isVisible()||this._setVisible(!0,!1),this._filterCategories(e?.filters?.categories,!1),e}isVisible(){return this.sourcesWithLayers.poi.isAnyLayerVisible()}setVisible(e){this._setVisible(e)}_setVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.poi.setLayersVisible(e),t&&(this.config={...this.config,visible:e},this.emitConfigChange())}filterCategories(e){this._filterCategories(e)}_filterCategories(e,t=!0){if(e){if(this.tomtomMap.mapReady){const t=Jt("category",e.show,ii(e.values));this.mapLibreMap.setFilter("POI",Zt(t,this.originalFilter))}t&&(this.config={...this.config,filters:{categories:e}})}else this.categoriesFilter&&(t&&(this.config={...this.config,filters:{categories:{show:"all_except",values:[]}}}),this.tomtomMap.mapReady&&this.mapLibreMap.setFilter("POI",this.originalFilter));this.categoriesFilter=e,t&&this.emitConfigChange()}getShown(){return{poi:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.poi.sourceAndLayerIDs.layerIDs,validate:!1}).map(ti)}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.poi,this.config?.events,ti),new ve(this.configChangeHandlers,[]))}},si={land:{layerIDMatches:["lulc"],layerTypes:["fill"]},borders:{layerIDMatches:["borders"],layerTypes:["line"]},water:{layerIDMatches:["water"],layerTypes:["fill","line"]},buildings2D:{layerIDMatches:["building"],layerTypes:["fill","line"]},buildings3D:{layerIDMatches:["building"],layerTypes:["fill-extrusion"]},houseNumbers:{layerIDMatches:["house number"],layerTypes:["symbol"]},roadLines:{layerIDMatches:["road","tunnel","bridge","surface"],layerTypes:["fill","line"]},roadLabels:{layerIDMatches:["road","tunnel","bridge","surface"],layerTypes:["symbol"]},roadShields:{layerIDMatches:["shield"],layerTypes:["symbol"]},placeLabels:{layerIDMatches:["places"],layerTypes:["symbol"]},smallerTownLabels:{layerIDMatches:["town","village","neighbourhood"],layerTypes:["symbol"]},cityLabels:{layerIDMatches:["city","capital"],layerTypes:["symbol"]},capitalLabels:{layerIDMatches:["capital"],layerTypes:["symbol"]},stateLabels:{layerIDMatches:["state"],layerTypes:["symbol"]},countryLabels:{layerIDMatches:["places - country"],layerTypes:["symbol"]}},ai=(e,t)=>{const i=si[e];return i.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&i.layerTypes.includes(t.type)},oi=e=>t=>(!e||((e,t)=>{const i=t?.mode,r=t?.names;if(i&&r?.length){if("include"===i)return r.some(t=>ai(t,e));if("exclude"===i)return!r.some(t=>ai(t,e))}return!0})(t,e))&&!Oe.includes(t.id),ni=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(t){const i=this.mapLibreMap.getSource(Re);if(!i)throw H(`init ${e.name} with source ID ${Re}`);return{vectorTiles:new J(this.mapLibreMap,i,oi(t?.layerGroupsFilter))}}_applyConfig(e){return e&&!i(e.visible)?this._setVisible(e.visible,void 0,!1):this._initializing||this.isVisible()||this._setVisible(!0,void 0,!1),e?.layerGroupsVisibility&&this._setVisible(e.layerGroupsVisibility.visible,{layerGroups:e.layerGroupsVisibility},!1),this.config||e?{...this.config,...e}:void 0}isVisible(){return this.sourcesWithLayers.vectorTiles.isAnyLayerVisible()}setVisible(e,t){this._setVisible(e,t)}_setVisible(e,t,i=!0){i&&(t?.layerGroups?this.config={...this.config,layerGroupsVisibility:{...t.layerGroups,visible:e}}:(delete this.config?.layerGroupsVisibility,this.config={...this.config,visible:e})),this.tomtomMap.mapReady&&this.sourcesWithLayers.vectorTiles.setLayersVisible(e,t?.layerGroups&&(e=>{const t=e.mode,i=e.names;return"include"===t?e=>i.some(t=>ai(t,e)):"exclude"===t?e=>!i.some(t=>ai(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups)),i&&this.emitConfigChange()}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles,this.config?.events),new ve(this.configChangeHandlers,[]))}},li=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],ci=class e extends pe{static async get(t,i){return await ie(t),hi(i),new e(t,i)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(e,t){const i=e??this.config;t||(this.lastShown={},this.shownFeaturesHandlersBySource=/* @__PURE__ */new Map),this.resolveIDs(i),this.registerImages(i);const r={};for(const s of Object.keys(i.sources)){const e=this.resolvedSourceIDs[s],t=this.resolvedLayerSpecs[s],a=i.sources[s].cluster;r[s]=new te(this.mapLibreMap,e,t,!0,a),this.shownFeaturesHandlersBySource.has(s)||this.shownFeaturesHandlersBySource.set(s,[])}return r}registerImages(e){if(e.images)for(const[t,i]of Object.entries(e.images))this.mapLibreMap.hasImage(t)||this.mapLibreMap.addImage(t,i.image,i.options)}resolveIDs(e){const t={},i={};for(const r of Object.keys(e.sources)){const s=e.sources[r],a=s.sourceID??`custom-geojson-${this.instanceIndex}-${String(r)}`;t[r]=a,i[r]=s.layers.map((e,t)=>({...e,id:e.id??`${a}-layer-${t}`}))}this.resolvedSourceIDs=t,this.resolvedLayerSpecs=i}_applyConfig(e){if(!e)return this.config;const t=this.config,i=t?this.resolvedLayerSpecs:void 0;return this.resolveIDs(e),this.registerImages(e),t&&i&&this.updateLayersForExistingSources(i),void 0!==e.visible&&this.applyVisibility(e.visible),e}updateLayersForExistingSources(e){for(const t of Object.keys(this.resolvedLayerSpecs)){const i=e[t],r=this.resolvedLayerSpecs[t],s=this.sourcesWithLayers[t];if(!i||!s)continue;oe(r,i,s,this.mapLibreMap);const a=[];for(const e of s._layerSpecs)this.mapLibreMap.getLayer(e.id)||a.push(e);a.length>0&&(ne(a,this.mapLibreMap),s.shownFeatures.features.length>0&&s.setLayersVisible(!0))}}applyVisibility(e){for(const t of Object.keys(this.sourcesWithLayers))this.sourcesWithLayers[t].setLayersVisible(e)}restoreDataAndConfigImpl(){const e=Object.keys(this.lastShown);this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config);for(const t of e){const e=this.lastShown[t];e&&this.showOnSource(t,e)}}async show(e,t){if(await this.waitUntilModuleReady(),void 0!==t)this.showOnSource(t,e);else for(const i of Object.keys(this.sourcesWithLayers))this.showOnSource(i,e)}showOnSource(e,t){const i=ui(t);this.lastShown[e]=i,this.sourcesWithLayers[e].show(i);const r=this.shownFeaturesHandlersBySource.get(e);if(r)for(const s of r)s(i)}async clear(e){if(await this.waitUntilModuleReady(),void 0!==e)return this.sourcesWithLayers[e].clear(),void delete this.lastShown[e];for(const t of Object.keys(this.sourcesWithLayers))this.sourcesWithLayers[t].clear(),delete this.lastShown[t]}getShown(){const e={};for(const t of Object.keys(this.sourcesWithLayers))e[t]=this.sourcesWithLayers[t].shownFeatures;return e}setVisible(e){this.config={...this.config,visible:e},this.applyVisibility(e),this.emitConfigChange()}get events(){const e={};for(const t of Object.keys(this.sourcesWithLayers)){const i=this.sourcesWithLayers[t],r=this.shownFeaturesHandlersBySource.get(t)??[];e[t]=new ye(new we(this.eventsProxy,i,this.config?.events),new ve(this.configChangeHandlers,r))}return e}},hi=e=>{if(!e.sources||0===Object.keys(e.sources).length)throw new Error("CustomGeoJSONModule requires at least one source in config.sources.");for(const[t,i]of Object.entries(e.sources))if(!i.layers||0===i.layers.length)throw new Error(`CustomGeoJSONModule source "${t}" requires at least one layer.`)},ui=e=>{let t=!1;for(const i of e.features)if(null==i.id||i.properties?.id!==i.id){t=!0;break}return t?{...e,features:e.features.map((e,t)=>{const i=e.id??e.properties?.id??t;return{...e,id:i,properties:{...e.properties,id:i}}})}:e},di="#0A3653",pi="#555555",yi={type:"fill",paint:{"fill-color":["coalesce",["get","color"],di],"fill-opacity":["case",["==",["get","theme"],"outline"],0,.15],"fill-antialias":!1}},fi={type:"line",paint:{"line-color":["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],pi],["coalesce",["get","color"],di]],"line-opacity":["case",["==",["get","theme"],"outline"],.9,1],"line-width":["case",["==",["get","theme"],"outline"],5,2]}},gi=(e,t,r)=>{const s=r?.fill,a=r?.line,o={...yi,id:e,paint:{...yi.paint,...!i(s?.opacity)&&{"fill-opacity":s?.opacity},...s?.color&&{"fill-color":["get","color"]}}},n=a?.layer;return[o,{...fi,...n,id:t,...n?.layout&&{layout:{...fi.layout,...n.layout}},paint:{...fi.paint,...n?.paint,...!i(a?.color)&&{"line-color":a?.color},...!i(a?.width)&&{"line-width":a?.width},...!i(a?.opacity)&&{"line-opacity":a?.opacity}}}]},mi=(e,t)=>{const i=t?.textConfig;return{type:"symbol",id:e,layout:{"text-field":["get","title"],...i?.textField&&{"text-field":i.textField},"text-padding":5,"text-size":15,"text-font":[Ue],"symbol-placement":"point"},paint:{"text-color":"#333333","text-halo-color":"#FFFFFF","text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"}}},_i=(e,t)=>{const r=t?.lineLabelConfig;return{type:"symbol",id:e,minzoom:r?.minZoom??3,layout:{"text-field":["get","title"],"symbol-placement":"line","text-size":r?.textSize??15,"text-font":[Ue],"symbol-spacing":r?.symbolSpacing??200,"text-keep-upright":!0,"text-offset":r?.textOffset??[0,1]},paint:{"text-color":r?.textColor??"#333333","text-halo-color":r?.textHaloColor??"#FFFFFF","text-halo-width":r?.textHaloWidth??2,...!i(r?.textOpacity)&&{"text-opacity":r?.textOpacity}}}},Li={warm:["#793F0D","#AC703D","#C38E63","#E49969","#E5AE86","#EEC5A9","#6E7649","#9D9754","#C7C397","#B4A851","#DFD27C","#E7E3B5","#846D74","#B7A6AD","#D3C9CE"],browns:["#edc4b3","#e6b8a2","#deab90","#d69f7e","#cd9777","#c38e70","#b07d62","#9d6b53","#8a5a44","#774936"],cold:["#344464","#548ca4","#549cac","#2c445c","#a4ccd4","#acbccc","#b4c4d4","#acd4cc","#5c8ca4"],fadedBlues:["#152033","#1d2d44","#2e455d","#3e5c76","#4c6884","#597491","#67809e","#6e86a5","#7b91ad","#879bb4"],blues:["#03045e","#023e8a","#0077b6","#0096c7","#00b4d8","#48cae4","#90e0ef","#ade8f4","#caf0f8"],greens:["#004b23","#006400","#007200","#008000","#38b000","#70e000","#9ef01a","#ccff33"],fadedGreenToBlue:["#d9ed92","#b5e48c","#99d98c","#76c893","#52b69a","#34a0a4","#168aad","#1a759f","#1e6091","#184e77"],blueToRed:["#033270","#1368aa","#4091c9","#9dcee2","#fedfd4","#f29479","#f26a4f","#ef3c2d","#cb1b16","#65010c"],greenToYellow:["#007f5f","#2b9348","#55a630","#80b918","#aacc00","#bfd200","#d4d700","#dddf00","#eeef20","#ffff3f"],pastel:["#fec5bb","#fcd5ce","#fae1dd","#f8edeb","#e8e8e4","#d8e2dc","#ece4db","#ffe5d9","#ffd7ba","#fec89a"],retro:["#f94144","#f3722c","#f8961e","#f9844a","#f9c74f","#90be6d","#43aa8b","#4d908e","#577590","#277da1"],contrastRetro:["#001219","#005f73","#0a9396","#94d2bd","#e9d8a6","#ee9b00","#ca6702","#bb3e03","#ae2012","#9b2226"],fadedRainbow:["#ffadad","#ffd6a5","#fdffb6","#caffbf","#9bf6ff","#a0c4ff","#bdb2ff","#ffc6ff","#fffffc"],pastelRainbow:["#54478c","#2c699a","#048ba8","#0db39e","#16db93","#83e377","#b9e769","#efea5a","#f1c453","#f29e4c"]},Ai=Object.keys(Li),Si=(e,t={})=>({...e,features:e.features.map((e,i)=>{const r=(e.properties??{}).theme??t.theme,s="inverted"===r?(e=>{const t=T(e);return{...e,geometry:t.geometry}})(e):e,a=s.properties??{},o=a.title??((e,t)=>t.textConfig?.textField?t.textConfig.textField:e.properties?.address?.freeformAddress)(s,t),n=a.color??((e,t)=>{const i=e?.fill?.color;if("string"==typeof i&&Li[i]){const e=Li[i];return e[t%e.length]}return i})(t,i);return{...s,properties:{...s.properties,...r&&{theme:r},...o&&{title:o},...n&&{color:n},id:a.id??p()}}})}),Ii=e=>{const t=e.features.map(e=>{let t;if(e.properties?.placeCoordinates)t=e.properties?.placeCoordinates;else if("MultiPolygon"===e.geometry.type){const i=c((e=>e.flat().reduce((e,t)=>t.length>e.length?t:e,[]))(e.geometry.coordinates));t=i&&l(i)||null}else t=e.geometry.coordinates.flat();const i=e.id??e.properties?.id??p();return{type:"Feature",id:i,geometry:{type:"Point",coordinates:t},properties:{...e.properties,id:i}}});return{type:"FeatureCollection",bbox:e.bbox,features:t}},Ei=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.lineLabelLayerSpecs=null,this.lastRawInput=null,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){if(!t){this.sourceID=`geometry-${this.instanceIndex}`,this.titleSourceID=`geometryTitle-${this.instanceIndex}`;const e=`geometry-${this.instanceIndex}`;this.fillLayerID=`${e}_Fill`,this.outlineLayerID=`${e}_Outline`,this.lineLabelLayerID=`${e}_LineLabel`,this.titleLayerID=`${e}_Title`}const[i,r]=gi(this.fillLayerID,this.outlineLayerID,e),s=mi(this.titleLayerID,e);this.titleLayerSpecs=s,this.geometryFillLayerSpecs=i,this.geometryOutlineLayerSpecs=r;const a=void 0===e?.lineLabelConfig?null:_i(this.lineLabelLayerID,e);return this.lineLabelLayerSpecs=a,{geometry:new te(this.mapLibreMap,this.sourceID,[{...i},{...r},...a?[a]:[]]),geometryLabel:new te(this.mapLibreMap,this.titleSourceID,[s])}}_applyConfig(e){return(e?.textConfig||e?.fill||e?.line)&&this.updateLayerAndData(e),(e?.beforeLayerConfig||e?.fill?.beforeLayerConfig||e?.line?.beforeLayerConfig)&&this.applyBeforeLayerConfig(e),e}resolveBeforeID(e){return"top"===e?this.titleLayerID:Ie[e]}moveLayersBefore(e,t){for(const i of e)this.mapLibreMap.moveLayer(i,t)}get fillLayerIDs(){return[this.fillLayerID]}get lineLayerIDs(){return this.lineLabelLayerSpecs?[this.outlineLayerID,this.lineLabelLayerID]:[this.outlineLayerID]}moveBeforeLayer(e){this.config={...this.config,beforeLayerConfig:e},this.applyBeforeLayerConfig(this.config),this.emitConfigChange()}applyBeforeLayerConfig(e){const t=e?.beforeLayerConfig,i=e=>{if(void 0!==t)return"string"==typeof t?t:t[e]??t.all},r=e?.fill?.beforeLayerConfig??i("fill"),s=e?.line?.beforeLayerConfig??i("line");void 0!==r&&this.moveLayersBefore(this.fillLayerIDs,this.resolveBeforeID(r)),void 0!==s&&this.moveLayersBefore(this.lineLayerIDs,this.resolveBeforeID(s))}applyTextConfig(e){const t={...this.config,textConfig:e};this.updateLayerAndData(t),this.sourcesWithLayers.geometryLabel.show(Ii(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t,this.emitConfigChange()}updateLayerAndData(e){const[t,i]=gi(this.fillLayerID,this.outlineLayerID,e),r=mi(this.titleLayerID,e);if(ae(t,this.geometryFillLayerSpecs,this.mapLibreMap),ae(i,this.geometryOutlineLayerSpecs,this.mapLibreMap),ae(r,this.titleLayerSpecs,this.mapLibreMap),this.geometryFillLayerSpecs=t,this.geometryOutlineLayerSpecs=i,this.titleLayerSpecs=r,this.lineLabelLayerSpecs){const t=_i(this.lineLabelLayerID,e);ae(t,this.lineLabelLayerSpecs,this.mapLibreMap),this.lineLabelLayerSpecs=t}}restoreDataAndConfigImpl(){const e=this.lastRawInput;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),e&&this.show(e)}async show(e){await this.waitUntilModuleReady(),this.lastRawInput=e;const{transformFeaturesForDisplay:t}=this.config??{},i=t?t(e):e,r=this.sourcesWithLayers.geometry;r.show(Si(i,this.config)),this.sourcesWithLayers.geometryLabel.show(Ii(r.shownFeatures));for(const s of this.shownFeaturesHandlers)s(e)}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.geometry.clear(),this.sourcesWithLayers.geometryLabel.clear()}getShown(){return{geometry:this.sourcesWithLayers.geometry.shownFeatures,geometryLabel:this.sourcesWithLayers.geometryLabel.shownFeatures}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry,this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}},bi={timeMinutes:"min",distanceKM:"km",remainingChargeCPT:"% remaining",spentChargePCT:"% spent",spentFuelLiters:"L"},Ri=(e,t,i="filled")=>{const r=e.map((e,r)=>({...e,properties:{...e.properties,title:t[r],theme:i}}));return"inverted"===i?(e=>[...e.map((t,i)=>{const r=0===i?T(t):E(b([e[i-1],t])),{title:s,theme:a,...o}=t.properties??{};return{...t,geometry:r?.geometry??t.geometry,properties:o}}),...e.map(e=>({...e,id:void 0,properties:{...e.properties,theme:"filled"}}))])(r):r},Ti=(e,t="filled",i)=>{const r=e.features,s=r.map((e,t)=>{if(i)return i(e,t);const r=e.properties?.budget;return void 0!==r?.value&&r?.type?`${r.value} ${bi[r.type]??r.type}`:String(t+1)});return{type:"FeatureCollection",...e.bbox&&{bbox:e.bbox},features:Ri(r,s,t)}},Ci=(e="fadedRainbow",t="lowestLabel")=>({beforeLayerConfig:t,line:{width:["case",["==",["get","theme"],"outline"],5,1],color:["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],pi],"grey"],opacity:["case",["==",["get","theme"],"outline"],.9,1]},fill:{color:e,opacity:["case",["==",["get","theme"],"outline"],0,.6]},lineLabelConfig:{}}),vi=(e="fadedRainbow",t,i,r)=>{const s=Ci(e,i),a=e=>Ti(e,t,r);return"inverted"!==t?{...s,transformFeaturesForDisplay:a}:{...s,line:{...s.line,opacity:["case",["==",["get","theme"],"filled"],1,0]},fill:{...s.fill,opacity:["case",["==",["get","theme"],"filled"],0,.6]},lineLabelConfig:{textOpacity:["case",["==",["get","theme"],"filled"],1,0],textOffset:["case",["==",["get","theme"],"filled"],["literal",[0,-1]],["literal",[0,1]]]},transformFeaturesForDisplay:a}},wi=["filled","outline","inverted"],Oi=class e extends pe{static async get(t,i){return await ie(t),await ce(t,be,"hillshade"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(be);if(!t)throw H(`init ${e.name} with source ID ${be}`);return{hillshade:new J(this.mapLibreMap,t)}}_applyConfig(e){return this._setVisible(e?.visible??!1,!1),e}setVisible(e){this._setVisible(e)}_setVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.hillshade.setLayersVisible(e),t&&(this.config={...this.config,visible:e},this.emitConfigChange())}isVisible(){return this.sourcesWithLayers.hillshade.isAnyLayerVisible()}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hillshade,this.config?.events),new ve(this.configChangeHandlers,[]))}},Ni=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],Mi=["trafficIncidents","trafficFlow","hillshade"],xi=(e,t,i)=>Math.min(Math.max(t,e),i),Di=e=>!e.some(Number.isNaN),Fi=e=>Number.parseInt(e.padEnd(2,e),16)/255,Pi=(e,t)=>xi(t?e/100:e,0,1),Ui=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,Hi=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,ki=e=>{const t=Hi.exec(e);if(!t)return;const[,i,r,s,a,o,n,l,c]=t,h=[r||" ",a||" ",n].join("");if(" "!==h&&" /"!==h&&",,"!==h&&",,,"!==h)return;const u=[+i,xi(+s,0,100),xi(+o,0,100),l?Pi(+l,c):1];return Di(u)?(([e,t,i,r])=>{const s=(e=>{const t=e%360;return t<0?t+360:t})(e),a=t/100,o=i/100,n=e=>{const t=(e+s/30)%12;return o-a*Math.min(o,1-o)*Math.max(-1,Math.min(t-3,9-t,1))};return[n(0),n(8),n(4),r]})(u):void 0},Wi=e=>{const t=e.toLowerCase().trim();if("transparent"===t)return[0,0,0,0];const i=Bi[t];if(i){const[e,t,r]=i;return[e/255,t/255,r/255,1]}return t.startsWith("#")?(e=>{if(!/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e))return;const t=e.length<6?1:2;return[Fi(e.slice(1,1+t)),Fi(e.slice(1+t,1+2*t)),Fi(e.slice(1+2*t,1+3*t)),Fi(e.slice(1+3*t)||"ff")]})(t):t.startsWith("rgb")?(e=>{const t=Ui.exec(e);if(!t)return;const[,i,r,s,a,o,n,l,c,h,u,d]=t,p=[s||" ",n||" ",h].join("");if(" "!==p&&" /"!==p&&",,"!==p&&",,,"!==p)return;const y=[r,o,c].join(""),f="%%%"===y?100:""===y?255:0;if(!f)return;const g=[xi(+i/f,0,1),xi(+a/f,0,1),xi(+l/f,0,1),u?Pi(+u,d):1];return Di(g)?g:void 0})(t):ki(t)},Bi={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Vi="#36A8F0",Gi="#105287",ji="#ABAFB3",zi="#3C4956",$i="#727C85",Yi=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],qi=["==",["get","routeState"],"selected"],Ki=["==",["get","routeState"],"deselected"],Xi=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],Zi={s:["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],m:Yi,l:["interpolate",["linear"],["zoom"],1,5,5,6,10,11,18,15]},Ji={s:["interpolate",["linear"],["zoom"],1,4,5,5,10,8,18,11],m:Xi,l:["interpolate",["linear"],["zoom"],1,7,5,9,10,14,18,19]},Qi={s:["interpolate",["linear"],["zoom"],8,.45,22,.6],m:["interpolate",["linear"],["zoom"],8,.6,22,.8],l:["interpolate",["linear"],["zoom"],8,.75,22,1]},er=e=>Zi[e??"m"],tr=e=>Ji[e??"m"],ir=e=>Qi[e??"m"],rr={s:["interpolate",["linear"],["zoom"],1,8,5,9,10,12,18,15],m:["interpolate",["linear"],["zoom"],1,9,5,11,10,15,18,20],l:["interpolate",["linear"],["zoom"],1,12,5,14,10,19,18,24]},sr=e=>rr[e??"m"],ar={s:["interpolate",["linear"],["zoom"],16,8,22,12],m:["interpolate",["linear"],["zoom"],16,12,22,17],l:["interpolate",["linear"],["zoom"],16,17,22,24]},or={s:["interpolate",["linear"],["zoom"],16,10,22,14],m:["interpolate",["linear"],["zoom"],16,14,22,20],l:["interpolate",["linear"],["zoom"],16,20,22,28]},nr=e=>ar[e??"m"],lr=e=>or[e??"m"],cr="#AD0000",hr="#FB2D09",ur="#FFC105",dr="#f58240",pr="#000000",yr="#C7D2D8",fr="rgba(190, 39, 27, 1)",gr="rgba(137, 150, 168, 1)",mr=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],_r=e=>({...Ke,filter:qi,minzoom:4,layout:{...Ke.layout,"text-field":mr(e?.text)},paint:{...Ke.paint}}),Lr={filter:qi,minzoom:16},Ar={"line-cap":"round"},Sr=e=>({...Lr,type:"line",layout:Ar,paint:{"line-width":lr(e),"line-color":"grey"}}),Ir=e=>({...Lr,type:"line",layout:Ar,paint:{"line-width":nr(e),"line-color":"white"}}),Er="instruction-arrow",br={...Lr,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":Er,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Rr=e=>({filter:qi,type:"line",layout:{"line-join":"round"},paint:{"line-width":er(e),"line-color":"#6dc4ed"}}),Tr={filter:qi,type:"symbol",minzoom:6,maxzoom:16.5,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-image":"poi-ferry_terminal","icon-size":["interpolate",["linear"],["zoom"],6,.8,16.5,1],"icon-ignore-placement":!0}},Cr={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},vr=e=>({...Cr,filter:Ki,paint:{"line-color":zi,"line-width":tr(e)}}),wr=e=>({...Cr,filter:Ki,paint:{"line-color":ji,"line-width":er(e)}}),Or=(e,t)=>({...Cr,filter:qi,paint:{"line-color":t??"#105287","line-width":tr(e)}}),Nr=(e,t)=>({...Cr,filter:qi,paint:{"line-color":t??"#36A8F0","line-width":er(e)}}),Mr={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},xr="selected-route-summary-popup",Dr="deselected-route-summary-popup",Fr=e=>({filter:qi,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":sr(e),"line-color":"#BEBFFA"}}),Pr={filter:qi,type:"symbol",minzoom:4,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-image":"poi-toll_plaza","icon-size":["interpolate",["linear"],["zoom"],4,.8,16.5,1]}},Ur=["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],Hr=["match",["get","magnitudeOfDelay"],"unknown",fr,gr],kr=["match",["get","magnitudeOfDelay"],"minor",dr,"moderate",hr,"major",cr,"indefinite","#666666",pr],Wr=e=>({type:"line",layout:{"line-cap":"round"},paint:{"line-width":er(e),"line-color":["match",["get","magnitudeOfDelay"],"minor",ur,"moderate",hr,"major",cr,yr]}}),Br=e=>({type:"line",filter:Ur,layout:{"line-join":"round"},paint:{"line-width":er(e),"line-color":Hr,"line-dasharray":[1.5,1]}}),Vr={filter:qi,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},Gr={...Vr,filter:["all",["has","jamIconID"],Vr.filter],layout:{...Vr.layout,"icon-image":["get","jamIconID"],"icon-anchor":"bottom-left","text-anchor":"bottom-left","text-field":["get","title"],"text-font":[Ue],"text-offset":[3.9,-1.4],"text-size":13},paint:{...Vr.paint,"text-color":kr,"text-halo-color":"#FFFFFF","text-halo-width":1}},jr={...Vr,filter:["all",["has","causeIconID"],Vr.filter],layout:{...Vr.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...Vr.paint}},zr=e=>({filter:qi,type:"line",layout:{"line-join":"round"},paint:{"line-width":er(e),"line-color":"#000000","line-opacity":.3}}),$r=e=>({filter:qi,type:"line",layout:{"line-join":"round"},paint:{"line-color":Gi,"line-width":er(e)}}),Yr=e=>({filter:qi,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":Vi,"line-width":er(e),"line-dasharray":[0,1.5]}}),qr="traffic-clear",Kr="traffic-major",Xr="traffic-moderate",Zr="traffic-minor",Jr=["has","formattedTraffic"],Qr=e=>{const t=void 0!==e?Xe(xr,e):xr,i=void 0!==e?Xe(Dr,e):Dr,r=void 0!==e?Xe(qr,e):qr,s=void 0!==e?Xe(Kr,e):Kr,a=void 0!==e?Xe(Xr,e):Xr,o=void 0!==e?Xe(Zr,e):Zr;return{type:"symbol",layout:{"icon-image":["case",qi,t,i],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",qi,0,1],"icon-text-fit":"both","icon-text-fit-padding":[10,5,5,10],"text-font":["Noto-Medium"],"text-size":13,"icon-padding":0,"text-justify":"left","text-line-height":1.5,"text-field":["format",["get","formattedDuration"],{"text-font":["literal",[Ue]],"text-color":["case",qi,"black",$i]},["concat","\t\t",["get","formattedDistance"]],{"text-color":$i},["case",Jr,"\n",""],{},["image",["case",Jr,["match",["get","magnitudeOfDelay"],"major",s,"moderate",a,"minor",o,r],""]],{},["case",Jr,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Ue]],"text-color":kr}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}}},es=Qr(),ts="start",is="middle",rs="finish",ss="indexType",as="stopDisplayIndex",os="waypointStart",ns="waypointStop",ls="waypointSoft",cs="waypointFinish",hs={"text-field":["get",as],"text-font":[Ue],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",ss],is],["!",["has",as]]],"center","bottom"],"text-allow-overlap":!0},us={type:"symbol",paint:{...$e,"text-color":"#ffffff"},layout:{...ze,...hs,"symbol-sort-key":["case",["==",["get",Be],ls],0,["abs",["-",["get","index"],1e3]]]}},ds={type:"symbol",paint:{...qe,"text-color":"black","text-halo-width":1.5,"text-halo-color":"#ffffff"},layout:{...Ye,"text-anchor":"top","text-offset":[0,.4]}},ps=(e,t)=>e&&t&&(e.startsWith("route")||e.startsWith("waypoint"))?`${t}-${e}`:e,ys=(e,t)=>e&&t?Object.fromEntries(Object.entries(e).map(([e,i])=>[e,i?.beforeID?{...i,beforeID:ps(i.beforeID,t)}:i])):e,fs=(e,t)=>t?{...e,...t,...t.paint&&{paint:{...e.paint,...t.paint}},...t.layout&&{layout:{...e.layout,...t.layout}}}:e,gs=(e,t)=>e&&void 0!==t?`${e}-${t}`:e,ms=(e={},t,i)=>{const r=e.layers,s=r?.sections,a=e.theme?.mainColor,o=a?((e,t)=>{const i=Wi(e);if(!i)return;const r=1-t;return`#${[Math.round(255*i[0]*r),Math.round(255*i[1]*r),Math.round(255*i[2]*r)].map(e=>e.toString(16).padStart(2,"0")).join("")}`})(a,.4):void 0,n=e.theme?.routeWidth,l=e.theme?.waypointSize,c=ir(l);return{mainLines:{routeLineArrows:fs({...Mr,beforeID:Ie.lowestLabel},r?.mainLines?.routeLineArrows),routeLine:fs({...Nr(n,a),beforeID:ps("routeIncidentBackgroundLine",t)},r?.mainLines?.routeLine),routeOutline:fs({...Or(n,o),beforeID:ps("routeLine",t)},r?.mainLines?.routeOutline),routeDeselectedLine:fs({...wr(n),beforeID:ps("routeOutline",t)},r?.mainLines?.routeDeselectedLine),routeDeselectedOutline:fs({...vr(n),beforeID:ps("routeDeselectedLine",t)},r?.mainLines?.routeDeselectedOutline),...ys(r?.mainLines?.additional,t)},waypoints:{routeWaypointSymbol:fs({...us,layout:{...us.layout,"icon-size":c},beforeID:ps("routeSummaryBubbleSymbol",t)},r?.waypoints?.routeWaypointSymbol),routeWaypointLabel:fs({...ds,beforeID:ps("routeWaypointSymbol",t)},r?.waypoints?.routeWaypointLabel),...ys(r?.waypoints?.additional,t)},chargingStops:{routeChargingStopSymbol:fs({..._r(e.chargingStops),beforeID:ps("routeWaypointSymbol",t)},r?.chargingStops?.routeChargingStopSymbol),...ys(r?.chargingStops?.additional,t)},sections:{incident:{routeIncidentJamSymbol:fs({...Gr,beforeID:ps("routeChargingStopSymbol",t)},s?.incident?.routeIncidentJamSymbol),routeIncidentCauseSymbol:fs({...jr,beforeID:ps("routeChargingStopSymbol",t)},s?.incident?.routeIncidentCauseSymbol),routeIncidentBackgroundLine:fs({...Wr(n),beforeID:ps("routeIncidentDashedLine",t)},s?.incident?.routeIncidentBackgroundLine),routeIncidentDashedLine:fs({...Br(n),beforeID:ps("routeTunnelLine",t)},s?.incident?.routeIncidentDashedLine),...ys(s?.incident?.additional,t)},ferry:{routeFerryLine:fs({...Rr(n),beforeID:ps("routeLineArrows",t)},s?.ferry?.routeFerryLine),routeFerrySymbol:fs({...Tr,beforeID:ps("routeIncidentJamSymbol",t)},s?.ferry?.routeFerrySymbol),...ys(s?.ferry?.additional,t)},tollRoad:{routeTollRoadOutline:fs({...Fr(n),beforeID:ps("routeDeselectedOutline",t)},s?.tollRoad?.routeTollRoadOutline),routeTollRoadSymbol:fs({...Pr,beforeID:ps("routeChargingStopSymbol",t)},s?.tollRoad?.routeTollRoadSymbol),...ys(s?.tollRoad?.additional,t)},tunnel:{routeTunnelLine:fs({...zr(n),beforeID:ps("routeLineArrows",t)},s?.tunnel?.routeTunnelLine),...ys(s?.tunnel?.additional,t)},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:fs({...$r(n),beforeID:ps("routeVehicleRestrictedForegroundLine",t)},s?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine),routeVehicleRestrictedForegroundLine:fs({...Yr(n),beforeID:Ie.lowestLabel},s?.vehicleRestricted?.routeVehicleRestrictedForegroundLine),...ys(s?.vehicleRestricted?.additional,t)}},instructionLines:{routeInstructionLine:fs({...Ir(n),beforeID:Ie.lowestLabel},r?.instructionLines?.routeInstructionLine),routeInstructionOutline:fs({...Sr(n),beforeID:ps("routeInstructionLine",t)},r?.instructionLines?.routeInstructionOutline),...ys(r?.instructionLines?.additional,t)},instructionArrows:{routeInstructionArrowSymbol:fs({...br,beforeID:ps("routeInstructionLine",t),...void 0!==i&&{layout:{...br.layout,"icon-image":gs(br.layout?.["icon-image"],i)}}},r?.instructionArrows?.routeInstructionArrowSymbol),...ys(r?.instructionArrows?.additional,t)},summaryBubbles:{routeSummaryBubbleSymbol:fs(void 0===i?es:Qr(i),r?.summaryBubbles?.routeSummaryBubbleSymbol),...ys(r?.summaryBubbles?.additional,t)}}},_s=ms();k()&&(z=W(B('<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50">\n <path d="M1.562 40.569L25 1.562l23.438 39.007L25 27.566 1.562 40.569z" fill="#fff"/>\n <path d="M25.369.107c.782.429.506.167.917.682l23.438 39.007c.79 1.316-.671 2.829-2.014 2.085L25 29.281l-22.71 12.6c-1.343.744-2.804-.769-2.014-2.085L23.714.789c.461-.694.9-.682 1.656-.682zM25 1.562L1.562 40.569 25 27.566l23.438 13.003L25 1.562z"\n fill="gray"/>\n</svg>\n')));var Ls,As=e=>{if(!k())return;const t=B('<svg xmlns="http://www.w3.org/2000/svg" width="160" height="65">\n <g filter="url(#A)">\n <rect id="pin" x="81.899" y="47" width="10" height="10" rx="2" transform="rotate(45 81.899 47)"/>\n <rect id="bubble" x="10" y="10" width="140" height="45" rx="12"/>\n </g>\n <defs>\n <filter id="A">\n <feDropShadow dx="0" dy="2" stdDeviation="4" flood-opacity=".3"/>\n </filter>\n </defs>\n</svg>\n');return t.querySelector("#bubble")?.setAttribute("fill",e),t.querySelector("#pin")?.setAttribute("fill",e),W(t)},Ss={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},Is=e=>{if(!k())return;const t=B('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">\n <g id="main">\n <path fill-rule="evenodd"\n d="M11.389 4H9.025a.86.86 0 0 0-.517.173l-.001-.001a.5.5 0 0 1-.464.059l-.028-.011a.5.5 0 0 1-.129-.83A1.86 1.86 0 0 1 9.025 3h2.364a2 2 0 0 1 1.789 1.106l1.02 2.04c.471.176.802.63.802 1.156v.803c0 .543 0 .815-.071 1.038a1.5 1.5 0 0 1-.914.953c-.219.08-.491.092-1.034.114l-1.481.062v-.166-.803a2.23 2.23 0 0 0-1.055-1.897l-.74-1.479 2.326.033h.955l-.703-1.406A1 1 0 0 0 11.389 4zM12 8.4a1 1 0 1 1 2 0 .5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z"/>\n <path d="M11.833 11.115c0-.109.089-.198.198-.198h1.979c.109 0 .198.089.198.198 0 .328-.266.594-.594.594h-1.187c-.328 0-.594-.266-.594-.594z"/>\n <path fill-rule="evenodd"\n d="M1.802 8.146C1.331 8.321 1 8.776 1 9.302v.803c0 .543 0 .815.071 1.038a1.5 1.5 0 0 0 .914.953c.219.08.491.092 1.034.114l2.731.114 2.731-.114c.543-.023.814-.034 1.034-.114a1.5 1.5 0 0 0 .914-.953c.071-.223.071-.494.071-1.038v-.803c0-.526-.331-.98-.802-1.156l-1.02-2.04A2 2 0 0 0 6.889 5H4.611a2 2 0 0 0-1.789 1.106l-1.02 2.04zM6.889 6H4.611a1 1 0 0 0-.894.553l-.703 1.406h.955 3.563.955l-.703-1.406A1 1 0 0 0 6.889 6zM2 10.4a1 1 0 1 1 2 0 .5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm6.5-1a1 1 0 0 0-1 1 .5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5 1 1 0 0 0-1-1z"/>\n <path d="M1.792 13.115c0-.109.089-.198.198-.198h1.979c.109 0 .198.089.198.198 0 .328-.266.594-.594.594H2.385c-.328 0-.594-.266-.594-.594zm5.739-.198c-.109 0-.198.089-.198.198 0 .328.266.594.594.594h1.188c.328 0 .594-.266.594-.594 0-.109-.089-.198-.198-.198h-1.98z"/>\n </g>\n</svg>\n'),i=t.querySelector("#main");return i.setAttribute("transform","scale(2)"),i.setAttribute("fill",e),W(t)},Es=(e,t)=>{if(!k())return;const i=V(t);return e&&i.appendChild(e),W(i)},bs=e=>{if(k())return Es(B('<svg xmlns="http://www.w3.org/2000/svg" width="120" height="140">\n <path d="M63.734 86.383c-1.404.026-2.78-.393-3.93-1.197s-2.01-1.949-2.46-3.271l-3.15-9.339c-1.093-3.403-3.748-6.089-7.154-7.238L37.5 62.21c-2.742-.902-4.567-3.477-4.5-6.345-.058-2.874 1.761-5.457 4.5-6.388l36-11.886c2.461-.88 5.213-.27 7.062 1.567s2.466 4.571 1.578 7.015L70.17 81.918c-.938 2.719-3.54 4.526-6.436 4.469h0z"\n fill="#f4f5f6"/>\n</svg>\n'),e)},Rs=e=>{if(k())return Es(B('<svg xmlns="http://www.w3.org/2000/svg" width="120" height="140">\n <path d="M33 83.404a2.99 2.99 0 0 1-3-2.978V44.681a2.99 2.99 0 1 1 6 0v35.745a2.99 2.99 0 0 1-3 2.978zm48-38.723H39v17.872h42V44.681zm3.878 37.851a3.02 3.02 0 0 0 4.244 0c.561-.559.878-1.317.878-2.106V44.681a2.99 2.99 0 1 0-6 0v35.745c0 .789.317 1.547.878 2.106z"\n fill="#f4f5f6"/>\n</svg>\n'),e)},Ts=(e={},t)=>Object.entries(e).map(([e,i])=>({...i,id:t?`${t}-${e}`:e})),Cs=(e={},t)=>({mainLines:Ts(e.mainLines,t),waypoints:Ts(e.waypoints,t),chargingStops:Ts(e?.chargingStops,t),ferries:Ts(e.sections?.ferry,t),incidents:Ts(e.sections?.incident,t),tollRoads:Ts(e.sections?.tollRoad,t),tunnels:Ts(e.sections?.tunnel,t),vehicleRestricted:Ts(e.sections?.vehicleRestricted,t),instructionLines:Ts(e.instructionLines,t),instructionArrows:Ts(e.instructionArrows,t),summaryBubbles:Ts(e.summaryBubbles,t)}),vs=(e,t,i)=>{const r=n.instance.get().displayUnits,s=e?.displayUnits;return{...e,...s?{}:{displayUnits:r},layers:ms(e,t,i)}},ws=(e,t)=>{const i=t?.chargingStops?.icon;if(i?.mapping){const t=i.mapping;switch(t.basedOn){case"chargingSpeed":if(e.properties.chargingConnectionInfo?.chargingSpeed)return t.value[e.properties.chargingConnectionInfo?.chargingSpeed];break;case"custom":return t.fn(e)}}return"7309"},Os=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},Ns=(e,t)=>{const i=[];if(!1!==t?.chargingStops?.visible)for(const r of e.features)for(const e of r.properties.sections.leg){const s=e.summary.chargingInformationAtEndOfLeg;if(s){const e=s.properties;i.push({...s,properties:{...s.properties,id:s.properties.chargingParkId??p(),iconID:ws(s,t),title:Os(s),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:d(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:r.properties.routeState}})}}return{type:"FeatureCollection",features:i}},Ms=e=>e.categories.includes("jam"),xs=e=>{const t=(e=>{if(Ms(e))return d(e.delayInSeconds)})(e),i=((e,t)=>Ms(e)?`traffic-jam-${e.magnitudeOfDelay??"unknown"}-${(e=>e?.length?e.length<6?"small":e.length<8?"medium":"large":"collapsed")(t)}`:null)(e,t),r=(e=>{const t=e.categories.find(e=>"jam"!==e);return t?(e=>{switch(e){case"accident":return"traffic-incidents-accident";case"roadworks":return"traffic-incidents-roadworks";case"road-closed":return"traffic-incidents-road_closed";case"lane-closed":case"narrow-lanes":return"traffic-incidents-lane_closed";case"danger":case"animals-on-road":return"traffic-incidents-danger";case"broken-down-vehicle":return"traffic-incidents-broken_down_vehicle";case"wind":return"traffic-incidents-wind";case"fog":return"traffic-incidents-fog";case"rain":return"traffic-incidents-rain";case"frost":return"traffic-incidents-frost";case"flooding":return"traffic-incidents-flooding";default:return null}})(t):null})(e);return{...e,...i&&{jamIconID:i},...r&&{causeIconID:r},...t&&{title:t}}},Ds=(e,t,i)=>{if(e.properties.radiusMeters)return void 0!==i?Xe(ls,i):ls;let r;switch(t){case"start":r=os;break;case"finish":r=cs;break;default:r=ns}return void 0!==i?Xe(r,i):r},Fs=(e,t,i)=>{let r=-1;return{type:"FeatureCollection",features:e.map((s,a)=>{if(!s)return r++,null;const o=(e=>{return Array.isArray(e)?{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}:"Point"===e.type?{type:"Feature",geometry:t=e,properties:{},...t.bbox&&{bbox:t.bbox}}:e;var t})(s),n=((e,t)=>0===e?ts:e<t-1?is:rs)(a,e.length),l=(e=>!e.properties.radiusMeters)(o);l&&r++;const c=(e=>{const t=e?.properties;return t?.poi?.name??t?.address?.freeformAddress??void 0})(o),h=o.id??p();return{...o,..."main-when-available"===t?.entryPoints&&{geometry:{type:"Point",coordinates:f(o,{useEntryPoint:"main-when-available"})}},id:h,properties:{...o.properties,id:h,index:a,indexType:n,...c&&{title:c},iconID:Ds(o,n,i),...l&&"middle"===n&&{stopDisplayIndex:r}}}}).filter(e=>e)}},Ps=(e,t,i)=>({type:"FeatureCollection",features:e.features.flatMap(e=>((e,t,i)=>e.properties.sections[t]?.map(t=>{const r=t.id??p();return{type:"Feature",id:r,geometry:{type:"LineString",coordinates:e.geometry.coordinates.slice(t.startPointIndex,t.endPointIndex+1)},properties:{...i?i(t,e.properties):t,routeState:e.properties.routeState,routeIndex:e.properties.index,id:r}}})||[])(e,t,i))}),Us=(e,t)=>t.show(((e,t)=>({...t,features:t.features.map(t=>({...t,properties:{...t.properties,routeState:e.features[t.properties.routeIndex||0].properties.routeState}}))}))(e,t.shownFeatures)),Hs=(e,t=0)=>{const i="features"in e?e:{type:"FeatureCollection",features:[e]};return{...i,features:i.features.map((e,i)=>{const r=e.id??p();return{...e,id:r,properties:{...e.properties,id:r,routeState:i===t?"selected":"deselected"}}})}},ks=(e,t)=>e.some(e=>e.magnitudeOfDelay===t),Ws=(e,t)=>({type:"FeatureCollection",features:e.features.map(e=>{const i=e.properties.summary,r=e.geometry.coordinates,s=d(i.trafficDelayInSeconds,t?.time),a=(e=>{const t=e.properties.sections.traffic;if(t?.length)return ks(t,"major")?"major":ks(t,"moderate")?"moderate":ks(t,"minor")?"minor":void 0})(e),o=e.id??p();return{type:"Feature",id:o,geometry:{type:"Point",coordinates:r[Math.round(r.length/2)]},properties:{id:o,routeIndex:e.properties.index,routeState:e.properties.routeState,formattedDistance:u(i.lengthInMeters,t?.distance),...a&&{magnitudeOfDelay:a},...s&&{formattedTraffic:s},formattedDuration:d(i.travelTimeInSeconds,t?.time)}}})}),Bs=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.shownFeaturesHandlers=[]}createSourcesWithLayers(e){const t=Xe("routes",this.instanceIndex);return{mainLines:new te(this.mapLibreMap,`${t}-mainLines`,e.mainLines,!1),waypoints:new te(this.mapLibreMap,`${t}-waypoints`,e.waypoints,!1),incidents:new te(this.mapLibreMap,`${t}-incidents`,e.incidents,!1),ferries:new te(this.mapLibreMap,`${t}-ferries`,e.ferries,!1),chargingStops:new te(this.mapLibreMap,`${t}-chargingStops`,e.chargingStops,!1),tollRoads:new te(this.mapLibreMap,`${t}-tollRoads`,e.tollRoads,!1),tunnels:new te(this.mapLibreMap,`${t}-tunnels`,e.tunnels,!1),vehicleRestricted:new te(this.mapLibreMap,`${t}-vehicleRestricted`,e.vehicleRestricted,!1),instructionLines:new te(this.mapLibreMap,`${t}-instructionLines`,e.instructionLines,!1),instructionArrows:new te(this.mapLibreMap,`${t}-instructionArrows`,e.instructionArrows,!1),summaryBubbles:new te(this.mapLibreMap,`${t}-summaryBubbles`,e.summaryBubbles,!1)}}_initSourcesWithLayers(e,t){t||(this.layerIDPrefix=Xe("routes",this.instanceIndex)),this.layersSpecs=Cs(vs(e,this.layerIDPrefix,this.instanceIndex).layers,this.layerIDPrefix);const i=this.createSourcesWithLayers(this.layersSpecs);ne(Object.values(i).flatMap(e=>e._layerSpecs),this.mapLibreMap);const r={fillColor:e?.theme?.mainColor,...e?.waypoints?.icon?.style},s={pixelRatio:2},a=Xe(os,this.instanceIndex),o=Xe(ns,this.instanceIndex),n=Xe(ls,this.instanceIndex),l=Xe(cs,this.instanceIndex),c=Xe(Er,this.instanceIndex),h=Xe(xr,this.instanceIndex),u=Xe(Dr,this.instanceIndex),d=Xe(qr,this.instanceIndex),p=Xe(Kr,this.instanceIndex),y=Xe(Xr,this.instanceIndex),f=Xe(Zr,this.instanceIndex);this.addImageIfNotExisting(a,bs(r),s),this.addImageIfNotExisting(o,Es(void 0,r),s),this.addImageIfNotExisting(n,(()=>{if(k())return W(B('<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">\n <circle id="circle" cx="16" cy="16" r="12" fill="white" stroke="#105287" stroke-width="4"/>\n</svg>\n'))})(),s),this.addImageIfNotExisting(l,Rs(r),s),this.addImageIfNotExisting(c,z,s),this.addImageIfNotExisting(h,As("white"),Ss),this.addImageIfNotExisting(u,As("#EEEEEE"),Ss),this.addImageIfNotExisting(d,Is(pr),s),this.addImageIfNotExisting(p,Is(cr),s),this.addImageIfNotExisting(y,Is(hr),s),this.addImageIfNotExisting(f,Is(dr),s);for(const g of e?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(g.id,g.image,{pixelRatio:g.pixelRatio??2});return i}_applyConfig(e){const i=vs(e,this.layerIDPrefix,this.instanceIndex);if(this.config){const e=Cs(i.layers,this.layerIDPrefix);Object.keys(e).forEach(t=>{const i=t;oe(e[i],this.layersSpecs[i],this.sourcesWithLayers[i],this.mapLibreMap)});const t=Object.values(this.sourcesWithLayers);ne(t.flatMap(e=>e._layerSpecs),this.mapLibreMap),t.forEach(e=>e.setLayersVisible(!!e.shownFeatures.features.length)),this.layersSpecs=e}if(e?.theme?.mainColor!==this.config?.theme?.mainColor){const t={fillColor:e?.theme?.mainColor,...e?.waypoints?.icon?.style},i={pixelRatio:2};he("add-or-update",Xe(os,this.instanceIndex),bs(t),this.mapLibreMap,i),he("add-or-update",Xe(ns,this.instanceIndex),Es(void 0,t),this.mapLibreMap,i),he("add-or-update",Xe(cs,this.instanceIndex),Rs(t),this.mapLibreMap,i)}const r=!1!==i.summaryBubbles?.visible,s=!t(this.config?.summaryBubbles?.visible,i.summaryBubbles?.visible),a=!t(this.config?.displayUnits,i.displayUnits),o=this.sourcesWithLayers.summaryBubbles.shownFeatures.features.length>0,n=this.sourcesWithLayers.mainLines.shownFeatures.features.length>0;return!r&&s?this.sourcesWithLayers.summaryBubbles.clear():r&&(s&&n||a&&o)&&this.sourcesWithLayers.summaryBubbles.show(Ws(this.sourcesWithLayers.mainLines.shownFeatures,i.displayUnits)),i}restoreDataAndConfigImpl(){const e=Object.entries(this.sourcesWithLayers).map(e=>({[e[0]]:e[1].shownFeatures})).reduce((e,t)=>({...e,...t}),{});this.initSourcesWithLayers(this.config,!0),this._applyConfig(this.config);for(const t of Object.keys(e))this.sourcesWithLayers[t].show(e[t])}addImageIfNotExisting(e,t,i){he("if-not-in-sprite",e,t,this.mapLibreMap,i)}async showRoutes(e,t){const i=Hs(e,t?.selectedIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(i),this.sourcesWithLayers.vehicleRestricted.show(Ps(i,"vehicleRestricted")),this.sourcesWithLayers.incidents.show(Ps(i,"traffic",xs)),this.sourcesWithLayers.chargingStops.show(Ns(i,this.config)),this.sourcesWithLayers.ferries.show(Ps(i,"ferry")),this.sourcesWithLayers.tunnels.show(Ps(i,"tunnel")),this.sourcesWithLayers.tollRoads.show(Ps(i,"toll")),this.sourcesWithLayers.instructionLines.show((e=>({type:"FeatureCollection",features:e.features.flatMap((e,t)=>e.properties.guidance?.instructions?.filter(e=>e.routePath?.length).map(i=>({type:"Feature",geometry:{type:"LineString",coordinates:i.routePath.map(e=>e.point)},properties:{...i,id:p(),routeIndex:t,routeState:e.properties.routeState}}))||[])}))(i)),this.sourcesWithLayers.instructionArrows.show((e=>({type:"FeatureCollection",features:e.features.flatMap((e,t)=>e.properties.guidance?.instructions?.filter(e=>e.routePath?.length&&e.routePath.length>1).map(i=>{const r=[i.routePath[i.routePath.length-2]?.point,i.routePath[i.routePath.length-1]?.point];return{type:"Feature",geometry:{type:"Point",coordinates:r[1]},properties:{...i,id:p(),routeIndex:t,routeState:e.properties.routeState,lastPointBearingDegrees:S(r[0],r[1])}}})||[])}))(i)),!1!==this.config?.summaryBubbles?.visible?this.sourcesWithLayers.summaryBubbles.show(Ws(i,this.config?.displayUnits)):this.sourcesWithLayers.summaryBubbles.clear();for(const r of this.shownFeaturesHandlers)r({routes:e})}async clearRoutes(){await this.waitUntilModuleReady();for(const e of Object.keys(this.sourcesWithLayers))"waypoints"!==e&&this.sourcesWithLayers[e].clear()}async selectRoute(e){const t=Hs(this.sourcesWithLayers.mainLines.shownFeatures,e);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(t),this.sourcesWithLayers.chargingStops.show(Ns(t,this.config)),Us(t,this.sourcesWithLayers.vehicleRestricted),Us(t,this.sourcesWithLayers.incidents),Us(t,this.sourcesWithLayers.ferries),Us(t,this.sourcesWithLayers.tollRoads),Us(t,this.sourcesWithLayers.tunnels),Us(t,this.sourcesWithLayers.instructionLines),Us(t,this.sourcesWithLayers.instructionArrows),Us(t,this.sourcesWithLayers.summaryBubbles)}async showWaypoints(e){const t=Array.isArray(e)?Fs(e,this.config?.waypoints,this.instanceIndex):Fs(e.features,this.config?.waypoints,this.instanceIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.show(t);for(const i of this.shownFeaturesHandlers)i({waypoints:e})}async clearWaypoints(){await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.clear()}getShown(){return{mainLines:this.sourcesWithLayers.mainLines.shownFeatures,waypoints:this.sourcesWithLayers.waypoints.shownFeatures,incidents:this.sourcesWithLayers.incidents.shownFeatures,ferries:this.sourcesWithLayers.ferries.shownFeatures,chargingStops:this.sourcesWithLayers.chargingStops.shownFeatures,tollRoads:this.sourcesWithLayers.tollRoads.shownFeatures,tunnels:this.sourcesWithLayers.tunnels.shownFeatures,vehicleRestricted:this.sourcesWithLayers.vehicleRestricted.shownFeatures,instructionLines:this.sourcesWithLayers.instructionLines.shownFeatures,instructionArrows:this.sourcesWithLayers.instructionArrows.shownFeatures,summaryBubbles:this.sourcesWithLayers.summaryBubbles.shownFeatures}}get events(){return{user:{mainLines:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.mainLines,this.config?.events),waypoints:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.waypoints,this.config?.events),chargingStops:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.chargingStops,this.config?.events),summaryBubbles:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.summaryBubbles,this.config?.events),incidents:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents,this.config?.events),vehicleRestricted:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vehicleRestricted,this.config?.events),ferries:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.ferries,this.config?.events),tollRoads:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tollRoads,this.config?.events),tunnels:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tunnels,this.config?.events),instructionLines:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.instructionLines,this.config?.events)},module:new ve(this.configChangeHandlers,this.shownFeaturesHandlers)}}getLayerToRenderLinesUnder(){return Ie.lowestLabel}},Vs="standardLight",Gs={standardLight:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_light"},standardDark:{trafficIncidents:"incidents_dark",trafficFlow:"flow_relative-dark",hillshade:"hillshade_dark"},drivingLight:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_light"},drivingDark:{trafficIncidents:"incidents_dark",trafficFlow:"flow_relative-dark",hillshade:"hillshade_dark"},monoLight:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_mono-light"},monoDark:{trafficIncidents:"incidents_dark",trafficFlow:"flow_relative-dark",hillshade:"hillshade_mono-dark"},satellite:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_satellite"}},js={standardLight:"basic_street-light",standardDark:"basic_street-dark",drivingLight:"basic_street-light-driving",drivingDark:"basic_street-dark-driving",monoLight:"basic_mono-light",monoDark:"basic_mono-dark",satellite:"basic_street-satellite"},zs=(e,t,i)=>{const r=e.id??"standardLight",s=e.version??"0.6.0-0",a=new URL(`${t}/maps/orbis/assets/styles/${s}/style.json`);a.searchParams.set("apiVersion","1"),i&&a.searchParams.set("key",i),a.searchParams.set("map",js[r]);for(const o of e.include??Mi)a.searchParams.append(o,Gs[r][o]);return a.toString()},$s=e=>{const t=e.style,i=e.commonBaseURL,r=e.apiKey;return"string"==typeof t?zs({id:t},i,r):"standard"===t?.type?zs(t,i,r):"custom"===t?.type&&t?.url?((e,t)=>{const i=new URL(e);return i.searchParams.has("key")?console.warn("The style URL is coming with an API key parameter which takes priority. If you want to use the SDK configured API key, remove the key param from the style URL"):t&&i.searchParams.set("key",t),i.toString()})(t.url,r):"custom"===t?.type&&t?.json?t.json:zs({id:Vs},i,r)},Ys=class{constructor(e){var i;this.mapReady=!1,this.styleChangeHandlers=[],this.setStyle=(e,i={keepState:!0})=>{this.mapReady=!1;for(const t of[...this.styleChangeHandlers])try{t.onStyleAboutToChange?.()}catch(s){console.error(s)}const r=i.keepState?((e,t)=>t&&"object"==typeof t&&"standard"===t.type&&t.include&&("string"==typeof e||"standard"===e.type&&!e.include)?{type:"standard",id:"string"==typeof e?e:e.id,include:t.include}:e)(e,this._params.style):e;this._params={...this._params,style:r},this.styleLightDarkTheme=de(r),this.mapLibreMap.setStyle($s(this._params),{validate:!1}),this.mapLibreMap.once("style.load",()=>{!this.mapReady&&t(r,this._params.style)&&this.handleStyleData(i.keepState||!0)})},this.getStyle=()=>this._params.style,this._params=L(e),void 0===this._params.style&&(this._params={...this._params,style:Vs}),this.styleLightDarkTheme=de(this._params.style),this.ensureMapLibreCSSLoaded(),N(4),this.mapLibreMap=new v({validateStyle:!1,maxTileCacheZoomLevels:22,cancelPendingTileRequestsWhileZooming:!1,...(i=this._params).mapLibre,style:$s(i),attributionControl:{compact:!1},transformRequest:se(i)}),this.mapLibreMap.once("style.load",()=>{this.handleStyleData(!1)}),this._eventsProxy=new Se(this.mapLibreMap,this._params?.events),this.loadRTLTextPlugin()}loadRTLTextPlugin(){setTimeout(()=>{["deferred","loaded"].includes(w())||O("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!0).catch(e=>console.error("Something went wrong when setting RTL plugin",e))})}ensureMapLibreCSSLoaded(){if("undefined"==typeof document)return;if(Array.from(document.querySelectorAll('link[rel="stylesheet"], style')).some(e=>e.textContent?.includes(".maplibregl-map")))return;const e=document.createElement("link");e.rel="stylesheet",e.href=`https://unpkg.com/maplibre-gl@${M}/dist/maplibre-gl.css`,document.head.appendChild(e)}_setLanguage(e){this._params={...this._params,language:e};const t=e?.includes("-")?e.split("-")[0]:e;this.mapLibreMap.getStyle().layers.forEach(e=>{if("symbol"===e.type&&(e=>{const t=e.layout?.["text-field"]??"";return!!t&&("{name}"===t||2===t.length&&"name"===t[1]||3===t.length&&Array.isArray(t[1])&&"string"==typeof t[1][1]&&t[1][1].includes("name_")&&Array.isArray(t[2])&&t[2].includes("name"))})(e)){const i=t?["coalesce",["get",`name_${t}`],["get","name"]]:["get","name"];this.mapLibreMap.setLayoutProperty(e.id,"text-field",i,{validate:!1})}})}setLanguage(e){this.mapReady?this._setLanguage(e):this.mapLibreMap.once("styledata",()=>this.setLanguage(e))}getBBox(){return this.mapLibreMap.getBounds().toArray().flat()}handleStyleData(e){for(const i of Z(this.mapLibreMap,[Te,Ce,be]))this.mapLibreMap.setLayoutProperty(i.id,"visibility","none",{validate:!1});if((async(e,t)=>{const i=new URLSearchParams;e.apiKey&&i.set("key",e.apiKey),i.set("poi",`poi_${de(e.style)}`),i.set("apiVersion","1"),i.set("apiChannel","preview"),t.setSprite(`${e.commonBaseURL}/maps/orbis/assets/sprites/2.*/sprite?${i}`,{validate:!1})})(this._params,this.mapLibreMap),this._params.language&&this._setLanguage(this._params.language),this.mapReady=!0,e)for(const i of[...this.styleChangeHandlers])try{i.onStyleChanged?.()}catch(t){console.error(t)}}addStyleChangeHandler(e){this.styleChangeHandlers.push(e);let t=!1;return()=>{if(t)return;t=!0;const i=this.styleChangeHandlers.indexOf(e);-1!==i&&this.styleChangeHandlers.splice(i,1)}}},qs={visible:!0,displayMode:"hexgrid-3d",activeMetric:"congestionLevel",metricConfig:{congestionLevel:{color:{valueType:"raw",stops:[{value:0,color:"#2dc653"},{value:50,color:"#f5a623"},{value:100,color:"#e03030"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},speed:{color:{valueType:"relativeToPredefinedRangePCT",stops:[{value:0,color:"#e03030"},{value:50,color:"#f5a623"},{value:100,color:"#2dc653"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},travelTime:{color:{valueType:"relativeToPredefinedRangePCT",stops:[{value:0,color:"#2dc653"},{value:50,color:"#f5a623"},{value:100,color:"#e03030"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},freeFlowSpeed:{color:{valueType:"relativeToPredefinedRangePCT",stops:[{value:0,color:"#e03030"},{value:50,color:"#f5a623"},{value:100,color:"#2dc653"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},networkLength:{color:{valueType:"relativeToActualRangePCT",stops:[{value:0,color:"#2dc653"},{value:50,color:"#f5a623"},{value:100,color:"#e03030"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"currentRange"}}},regionPolygon:{color:"#000000",fillOpacity:0,outlineOpacity:.5,outlineWidth:2,inverted:!1}},Ks={trafficLight:["#2dc653","#f5a623","#e03030"],heat:["#2196F3","#FF9800","#F44336"],monochrome:["#e0e0e0","#888888","#1a1a1a"],viridis:["#fde725","#35b779","#31688e","#440154"],plasma:["#f0f921","#ed7953","#9c179e","#0d0887"]},Xs={congestionLevel:{min:0,max:100},speed:{min:0,max:120},travelTime:{min:0,max:20},freeFlowSpeed:{min:0,max:120},networkLength:{min:0,max:5e3}},Zs=e=>"speed"===e||"freeFlowSpeed"===e,Js=e=>e?.activeMetric??qs.activeMetric,Qs=e=>{return"string"==typeof e?(t=Ks[e]).map((e,i)=>({value:1===t.length?0:i/(t.length-1),color:e})):e.stops;var t},ea=e=>{if("top"!==e)return e?Ie[e]:Ie.lowestLabel},ta=e=>{if("top"!==e)return e?Ie[e]:Ie.lowestPlaceLabel},ia=(e,t,i)=>{const r=t??qs.metricConfig[e].color??"trafficLight",s=Qs(r);let a;if("string"==typeof r){const{min:t,max:i}=Xs[e],r=Zs(e)?[...s].reverse().map(e=>e.color):s.map(e=>e.color);a=s.map(({value:e},s)=>[t+e*(i-t),r[s]])}else if("relativeToPredefinedRangePCT"===r.valueType){const{min:t,max:i}=Xs[e];a=s.map(({value:e,color:r})=>[t+e/100*(i-t),r])}else if("relativeToActualRangePCT"===r.valueType){const{min:t,max:r}=i??Xs[e];a=s.map(({value:e,color:i})=>[t+e/100*(r-t),i])}else a=s.map(({value:e,color:t})=>[e,t]);return["interpolate",["linear"],["get",e],...a.flatMap(([e,t])=>[e,t])]},ra=(e,t)=>{const i=t??qs.metricConfig[e].color??"trafficLight",r=Qs(i);let s;if("string"==typeof i){const t=Zs(e)?[...r].reverse().map(e=>e.color):r.map(e=>e.color);s=r.flatMap(({value:e},i)=>[.3+.7*e,t[i]])}else if("relativeToPredefinedRangePCT"===i.valueType||"relativeToActualRangePCT"===i.valueType)s=r.flatMap(({value:e,color:t})=>[.3+e/100*.7,t]);else{const e=Math.min(...r.map(e=>e.value)),t=Math.max(...r.map(e=>e.value))-e||1;s=r.flatMap(({value:i,color:r})=>[.3+(i-e)/t*.7,r])}return["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",...s]},sa=(e,t,i)=>{const r=qs.metricConfig[e].height,s=t?.minHeightMeters??r.minHeightMeters??0;if("raw"===t?.scaleMode){const i=t.scaleFactor??1;if("speed"===e){const{max:t}=Xs[e];return["max",s,["*",["-",t,["coalesce",["get","speed"],0]],i]]}return["max",s,["*",["coalesce",["get",e],0],i]]}const a=t?.maxHeightMeters??r.maxHeightMeters??1e3,{min:o,max:n}="currentRange"===(t?.scaleMode??r.scaleMode)?i??Xs[e]:Xs[e],l=n-o||1;return"speed"===e?["max",s,["*",["/",["-",n,["coalesce",["get","speed"],0]],l],a]]:["max",s,["*",["/",["-",["coalesce",["get",e],0],o],l],a]]},aa=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r],{min:a,max:o}=i??Xs[r];return{id:e,type:"heatmap",beforeID:ea(t?.beforeLayerConfig?.heatmap),paint:{"heatmap-weight":["interpolate",["linear"],["get",r],a,0,o,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],10,.5,14,2,16,4],"heatmap-color":ra(r,s?.color),"heatmap-radius":["interpolate",["linear"],["zoom"],4,1,8,3,12,35,14,80,16,100],"heatmap-opacity":["interpolate",["linear"],["zoom"],4,.8,13,.8,17,0]}}},oa=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill",beforeID:ea(t?.beforeLayerConfig?.hexgrid?.flat2D),paint:{"fill-color":ia(r,s?.color,i),"fill-opacity":.6}}},na=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill-extrusion",beforeID:ta(t?.beforeLayerConfig?.hexgrid?.extrusion3D),paint:{"fill-extrusion-color":ia(r,s?.color,i),"fill-extrusion-height":sa(r,s?.height,i),"fill-extrusion-base":0,"fill-extrusion-opacity":.75}}},la=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill",beforeID:ea(t?.beforeLayerConfig?.square?.flat2D),paint:{"fill-color":ia(r,s?.color,i),"fill-opacity":.6}}},ca=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill-extrusion",beforeID:ta(t?.beforeLayerConfig?.square?.extrusion3D),paint:{"fill-extrusion-color":ia(r,s?.color,i),"fill-extrusion-height":sa(r,s?.height,i),"fill-extrusion-base":0,"fill-extrusion-opacity":.75}}},ha=e=>({...qs.regionPolygon,...e}),ua=(e,t)=>{const{color:i,fillOpacity:r}=ha(t?.regionPolygon);return{id:e,type:"fill",beforeID:ea(),paint:{"fill-color":i,"fill-opacity":r}}},da=(e,t)=>{const{color:i,outlineOpacity:r,outlineWidth:s}=ha(t?.regionPolygon);return{id:e,type:"line",beforeID:ea(),paint:{"line-color":i,"line-opacity":r,"line-width":s}}},pa=(e,t)=>({id:e,type:"line",beforeID:t,filter:["has","eventState"],paint:{"line-color":"#ffffff","line-width":["case",Lt,3,2],"line-opacity":["case",Lt,1,.8]}}),ya=e=>({...e,filter:["has","eventState"],paint:{...e.paint,"fill-extrusion-color":["case",Lt,"#ffffff","#ffffff"],"fill-extrusion-height":["+",e.paint?.["fill-extrusion-height"],.5],"fill-extrusion-opacity":.6}}),fa=(e,t,i)=>ya(na(e,t,i)),ga=(e,t,i)=>ya(ca(e,t,i)),ma=(e,t,i)=>((e,t,i)=>{const r=[];for(let s=0;s<e.length;s++){const a=e[s];if(!a)continue;const{congestionSum:o,speedSum:n,freeFlowSum:l,travelTimeSum:c,networkLengthSum:h,count:u}=a,d=`${i}-${s}`;r.push({type:"Feature",id:d,geometry:t.features[s].geometry,properties:{id:d,congestionLevel:Math.round(o/u),speed:Math.round(n/u),freeFlowSpeed:Math.round(l/u),travelTime:Math.round(c/u*10)/10,networkLength:Math.round(h/u)}})}return r})(((e,t)=>{const i=[];for(const r of e)for(let e=0;e<t.features.length;e++)if(I(r.tileCentre,t.features[e])){let t=i[e];void 0===t&&(t={congestionSum:0,speedSum:0,freeFlowSum:0,travelTimeSum:0,networkLengthSum:0,count:0},i[e]=t),t.congestionSum+=r.congestionLevel??0,t.speedSum+=r.speed??0,t.freeFlowSum+=r.freeFlowSpeed??0,t.travelTimeSum+=r.travelTime??0,t.networkLengthSum+=r.networkLength??0,t.count++;break}return i})(e,t),t,i),_a=.005,La=(e,t,i,r)=>{const s=[];for(let a=0;a<e.features.length;a++){const o=e.features[a],n=o.properties?.tiledData?.tiles??[];if(0===n.length)continue;const l=h(o);if(!l)continue;const c=i([l[0]-_a,l[1]-_a,l[2]+_a,l[3]+_a],t);s.push(...ma(n,c,`${r}-${a}`))}return{type:"FeatureCollection",features:s}},Aa=class e extends pe{static async get(t,i){return await ie(t),new e(t,i??{})}constructor(e,t){super("geojson",e,t),this.lastAnalytics=null,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){const i=this.instanceIndex,r=`area-analytics-heatmap-${i}`,s=`area-analytics-hexgrid-${i}`,a=`area-analytics-square-${i}`,o=`area-analytics-region-${i}`,n=`${r}-layer`,l=`${s}-fill`,c=`${s}-extrusion`,h=`${s}-outline`,u=`${s}-extrusion-highlight`,d=`${a}-fill`,p=`${a}-extrusion`,y=`${a}-outline`,f=`${a}-extrusion-highlight`,g=`${o}-fill`,m=`${o}-line`;this.heatmapLayerSpec=aa(n,e),this.hexFillLayerSpec=oa(l,e),this.hexExtrusionLayerSpec=na(c,e),this.squareFillLayerSpec=la(d,e),this.squareExtrusionLayerSpec=ca(p,e),this.regionFillLayerSpec=ua(g,e),this.regionLineLayerSpec=da(m,e),this.hexOutlineLayerSpec=((e,t)=>pa(e,ea(t?.beforeLayerConfig?.hexgrid?.flat2D)))(h,e),this.hexExtrusionHighlightLayerSpec=fa(u,e),this.squareOutlineLayerSpec=((e,t)=>pa(e,ea(t?.beforeLayerConfig?.square?.flat2D)))(y,e),this.squareExtrusionHighlightLayerSpec=ga(f,e);const _={heatmap:new te(this.mapLibreMap,r,[this.heatmapLayerSpec]),hexgrid:new te(this.mapLibreMap,s,[this.hexFillLayerSpec,this.hexExtrusionLayerSpec]),square:new te(this.mapLibreMap,a,[this.squareFillLayerSpec,this.squareExtrusionLayerSpec]),region:new te(this.mapLibreMap,o,[this.regionFillLayerSpec,this.regionLineLayerSpec])};return this.addHighlightLayersToMap(s,a),_}_applyConfig(e){if(void 0===e)return;const t=e.metricConfig&&this.config?.metricConfig?{...this.config.metricConfig,...e.metricConfig}:e.metricConfig??this.config?.metricConfig,i=Object.keys(qs.metricConfig),r=Object.fromEntries(i.map(e=>[e,t?.[e]??qs.metricConfig[e]])),s={activeMetric:qs.activeMetric,displayMode:qs.displayMode,...this.config,...e,metricConfig:r};return this.applyLayerConfig(s),s.regionPolygon&&this.applyRegionConfig(s),s.beforeLayerConfig&&this._moveBeforeLayer(s.beforeLayerConfig,!1),this.config=s,this.applyModeVisibility(),s}restoreDataAndConfigImpl(){const e=this.lastAnalytics;this.initSourcesWithLayers(this.config,!0),e?(!1===this.config?.visible&&this.setVisible(!1),this.show(e)):this.config&&this._applyConfig(this.config)}async show(e){await this.waitUntilModuleReady(),this.lastAnalytics=e,this.sourcesWithLayers.heatmap.show((e=>({type:"FeatureCollection",features:e.features.flatMap(e=>e.properties?.tiledData?.tiles??[]).map((e,t)=>{const[i,r]=e.tileCentre,s=`tile-${t}-${i}-${r}`;return{type:"Feature",id:s,geometry:{type:"Point",coordinates:[i,r]},properties:{id:s,speed:e.speed??0,freeFlowSpeed:e.freeFlowSpeed??0,congestionLevel:e.congestionLevel??0,travelTime:e.travelTime??0,networkLength:e.networkLength??0}}})}))(e),{automaticVisibility:!1}),this.sourcesWithLayers.hexgrid.show(((e,t=.25)=>La(e,t,(e,t)=>R(e,t,{units:"kilometers"}),"hex"))(e),{automaticVisibility:!1}),this.sourcesWithLayers.square.show(((e,t=.5)=>La(e,t,(e,t)=>C(e,t,{units:"kilometers"}),"square"))(e),{automaticVisibility:!1});const t=this.config?.regionPolygon?.inverted??qs.regionPolygon.inverted;this.sourcesWithLayers.region.show(this.buildRegionFC(e.features,t)),this.applyLayerConfig(this.config),this.applyModeVisibility();for(const i of this.shownFeaturesHandlers)i(e)}async clear(){await this.waitUntilModuleReady(),this.lastAnalytics=null,this.sourcesWithLayers.heatmap.clear(),this.sourcesWithLayers.hexgrid.clear(),this.sourcesWithLayers.square.clear(),this.sourcesWithLayers.region.clear()}setMode(e){e!==this.mode&&(this.config={...this.config,displayMode:e},this.applyModeVisibility(),this.emitConfigChange())}setMetric(e){e!==this.activeMetric&&(this.config={...this.config,activeMetric:e},this.applyLayerConfig(this.config),this.emitConfigChange())}setColor(e,t){const i=Object.keys(qs.metricConfig),r=t??i,s={...this.config?.metricConfig};if(void 0===e)for(const a of r){const{color:e,...t}=s[a]??{};s[a]=t}else if("string"==typeof e){const t=(e=>{const t=Qs(e),i=e=>{const{min:i,max:r}=Xs[e],s=Zs(e)?[...t].reverse().map(e=>e.color):t.map(e=>e.color);return{valueType:"raw",stops:t.map(({value:e},t)=>({value:i+e*(r-i),color:s[t]}))}};return{congestionLevel:{color:i("congestionLevel")},speed:{color:i("speed")},travelTime:{color:i("travelTime")},freeFlowSpeed:{color:i("freeFlowSpeed")},networkLength:{color:i("networkLength")}}})(e);for(const e of r)s[e]={...s[e],...t[e]}}else for(const a of r)s[a]={...s[a],color:e};this.config={...this.config,metricConfig:s},this.applyLayerConfig(this.config),this.emitConfigChange()}setHeight(e,t){const i=Object.keys(qs.metricConfig),r=t??i,s={...this.config?.metricConfig};for(const a of r)s[a]={...s[a],height:e};this.config={...this.config,metricConfig:s},this.applyLayerConfig(this.config),this.emitConfigChange()}filter(e,t){const i=Object.keys(qs.metricConfig),r=t??i,s={...this.config?.metricConfig};for(const a of r)s[a]={...s[a],filters:e};this.config={...this.config,metricConfig:s},this.applyFiltersToLayers(),this.emitConfigChange()}clearFilter(e){this.filter(void 0,e)}setVisible(e){this.config={...this.config,visible:e},this.applyModeVisibility(),this.emitConfigChange()}isVisible(){return this.sourcesWithLayers.heatmap.isAnyLayerVisible()||this.sourcesWithLayers.hexgrid.isAnyLayerVisible()||this.sourcesWithLayers.square.isAnyLayerVisible()}getShown(){return{heatmap:this.sourcesWithLayers.heatmap.shownFeatures,hexgrid:this.sourcesWithLayers.hexgrid.shownFeatures,square:this.sourcesWithLayers.square.shownFeatures}}moveBeforeLayer(e){this._moveBeforeLayer(e)}_moveBeforeLayer(e,t=!0){const i=e=>"top"===e?void 0:Ie[e];void 0!==e.heatmap&&this.mapLibreMap.moveLayer(this.heatmapLayerSpec.id,i(e.heatmap)),void 0!==e.hexgrid?.flat2D&&this.mapLibreMap.moveLayer(this.hexFillLayerSpec.id,i(e.hexgrid.flat2D)),void 0!==e.hexgrid?.extrusion3D&&this.mapLibreMap.moveLayer(this.hexExtrusionLayerSpec.id,i(e.hexgrid.extrusion3D)),void 0!==e.square?.flat2D&&this.mapLibreMap.moveLayer(this.squareFillLayerSpec.id,i(e.square.flat2D)),void 0!==e.square?.extrusion3D&&this.mapLibreMap.moveLayer(this.squareExtrusionLayerSpec.id,i(e.square.extrusion3D)),t&&(this.config={...this.config,beforeLayerConfig:e})}get events(){return new ye(new we(this.tomtomMap._eventsProxy,[this.sourcesWithLayers.hexgrid,this.sourcesWithLayers.square,this.sourcesWithLayers.heatmap],this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}get mode(){return this.config?.displayMode??qs.displayMode}get activeMetric(){return Js(this.config)}applyModeVisibility(){if(!1===this.config?.visible)return void this.hideAllDataLayers();const e=this.mode,t=this.sourcesWithLayers.heatmap.shownFeatures.features.length>0,i=this.sourcesWithLayers.hexgrid.shownFeatures.features.length>0,r=this.sourcesWithLayers.square.shownFeatures.features.length>0,s=this.sourcesWithLayers.region.shownFeatures.features.length>0;this.sourcesWithLayers.heatmap.setLayersVisible("heatmap"===e&&t),this.sourcesWithLayers.hexgrid.setLayersVisible("hexgrid-3d"===e&&i,e=>e.id===this.hexExtrusionLayerSpec.id),this.sourcesWithLayers.hexgrid.setLayersVisible("hexgrid-2d"===e&&i,e=>e.id===this.hexFillLayerSpec.id),this.sourcesWithLayers.square.setLayersVisible("square-3d"===e&&r,e=>e.id===this.squareExtrusionLayerSpec.id),this.sourcesWithLayers.square.setLayersVisible("square-2d"===e&&r,e=>e.id===this.squareFillLayerSpec.id),this.sourcesWithLayers.region.setLayersVisible(s),this.setHighlightLayerVisible(this.hexOutlineLayerSpec.id,"hexgrid-2d"===e&&i),this.setHighlightLayerVisible(this.hexExtrusionHighlightLayerSpec.id,"hexgrid-3d"===e&&i),this.setHighlightLayerVisible(this.squareOutlineLayerSpec.id,"square-2d"===e&&r),this.setHighlightLayerVisible(this.squareExtrusionHighlightLayerSpec.id,"square-3d"===e&&r)}hideAllDataLayers(){this.sourcesWithLayers.heatmap.setLayersVisible(!1),this.sourcesWithLayers.hexgrid.setLayersVisible(!1),this.sourcesWithLayers.square.setLayersVisible(!1),this.sourcesWithLayers.region.setLayersVisible(!1),this.setHighlightLayerVisible(this.hexOutlineLayerSpec.id,!1),this.setHighlightLayerVisible(this.hexExtrusionHighlightLayerSpec.id,!1),this.setHighlightLayerVisible(this.squareOutlineLayerSpec.id,!1),this.setHighlightLayerVisible(this.squareExtrusionHighlightLayerSpec.id,!1)}addHighlightLayersToMap(e,t){const i=(e,t)=>{this.mapLibreMap.getLayer(e.id)||this.mapLibreMap.addLayer({...e,source:t},e.beforeID),this.mapLibreMap.setLayoutProperty(e.id,"visibility","none")};i(this.hexOutlineLayerSpec,e),i(this.hexExtrusionHighlightLayerSpec,e),i(this.squareOutlineLayerSpec,t),i(this.squareExtrusionHighlightLayerSpec,t)}setHighlightLayerVisible(e,t){this.mapLibreMap.getLayer(e)&&this.mapLibreMap.setLayoutProperty(e,"visibility",t?"visible":"none")}applyLayerConfig(e){const t=this.lastAnalytics?.properties.ranges?.[this.activeMetric],i=aa(this.heatmapLayerSpec.id,e,t),r=oa(this.hexFillLayerSpec.id,e,t),s=na(this.hexExtrusionLayerSpec.id,e,t),a=fa(this.hexExtrusionHighlightLayerSpec.id,e,t),o=la(this.squareFillLayerSpec.id,e,t),n=ca(this.squareExtrusionLayerSpec.id,e,t),l=ga(this.squareExtrusionHighlightLayerSpec.id,e,t);ae(i,this.heatmapLayerSpec,this.mapLibreMap),ae(r,this.hexFillLayerSpec,this.mapLibreMap),ae(s,this.hexExtrusionLayerSpec,this.mapLibreMap),ae(a,this.hexExtrusionHighlightLayerSpec,this.mapLibreMap),ae(o,this.squareFillLayerSpec,this.mapLibreMap),ae(n,this.squareExtrusionLayerSpec,this.mapLibreMap),ae(l,this.squareExtrusionHighlightLayerSpec,this.mapLibreMap),this.heatmapLayerSpec=i,this.hexFillLayerSpec=r,this.hexExtrusionLayerSpec=s,this.hexExtrusionHighlightLayerSpec=a,this.squareFillLayerSpec=o,this.squareExtrusionLayerSpec=n,this.squareExtrusionHighlightLayerSpec=l,this.applyFiltersToLayers()}applyRegionConfig(e){const t=ua(this.regionFillLayerSpec.id,e),i=da(this.regionLineLayerSpec.id,e);if(ae(t,this.regionFillLayerSpec,this.mapLibreMap),ae(i,this.regionLineLayerSpec,this.mapLibreMap),this.regionFillLayerSpec=t,this.regionLineLayerSpec=i,this.lastAnalytics){const t=e?.regionPolygon?.inverted??qs.regionPolygon.inverted;this.sourcesWithLayers.region.show(this.buildRegionFC(this.lastAnalytics.features,t))}}applyFiltersToLayers(){const e=this.activeMetric,t=this.config?.metricConfig?.[e]?.filters,i=[this.hexFillLayerSpec.id,this.hexExtrusionLayerSpec.id,this.squareFillLayerSpec.id,this.squareExtrusionLayerSpec.id];if(!t||void 0===t.min&&void 0===t.max){for(const e of i)this.mapLibreMap.setFilter(e,null);return}const r=[];void 0!==t.min&&r.push([">=",["get",e],t.min]),void 0!==t.max&&r.push(["<=",["get",e],t.max]);const s=1===r.length?r[0]:["any",...r];for(const a of i)this.mapLibreMap.setFilter(a,s)}buildRegionFC(e,t){return{type:"FeatureCollection",features:e.map((e,i)=>{const r=`traffic-area-analytics-region-${i}`,s=t?T(e).geometry:e.geometry;return{...e,id:r,geometry:s,properties:{id:r}}})}}},Sa=(e,t)=>e.length?1===e.length?{expression:e[0],legacy:t[0]}:{expression:["all",...e],legacy:["all",...t]}:null,Ia=(e,t,i)=>{e&&(t.push(e.expression),i.push(e.legacy))},Ea=(e,t,i,r)=>{e&&Ia(Qt(t,e),i,r)},ba=(e,t,i)=>{Ea(e.roadCategories,"road_category",t,i),Ea(e.roadSubCategories,"road_subcategory",t,i)},Ra=e=>{const t=[],i=[];return ba(e,t,i),e.incidentCategories&&Ia(Qt("icon_category_0",e.incidentCategories,e=>P[e]),t,i),e.magnitudes&&Ia(Qt("magnitude_of_delay",e.magnitudes,e=>m.indexOf(e)),t,i),e.delays&&Ia((e=>{const t=[],i=[];if(e.mustHaveDelay&&e.minDelayMinutes){const r=60*e.minDelayMinutes;t.push([">=",["get","delay"],r]),i.push([">=","delay",r])}else if(e.mustHaveDelay)t.push([">",["get","delay"],0]),i.push([">","delay",0]);else if(e.minDelayMinutes){const r=60*e.minDelayMinutes;t.push(["any",["!",["has","delay"]],["==",["get","delay"],0],[">=",["get","delay"],r]]),i.push(["any",["!has","delay"],["==","delay",0],[">=","delay",r]])}return Sa(t,i)})(e.delays),t,i),Sa(t,i)},Ta=e=>e?.any?.length?Xt(e.any.map(Ra).filter(e=>!i(e))):null,Ca=e=>{const t=[],i=[];if(ba(e,t,i),e.showRoadClosures){const r="only"===e.showRoadClosures?"==":"!=";t.push([r,["get","road_closure"],!0]),i.push([r,"road_closure",!0])}return Sa(t,i)},va=(e,t,i,r)=>{for(const s of t)i.setFilter(s.id,e?Zt(e,r[s.id]):r[s.id])},wa=class e extends pe{static async get(t,i){return await ie(t),await ce(t,Ce,"trafficFlow"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(Ce);if(!t)throw H(`init ${e.name} with source ID ${Ce}`);this.originalFilters={};for(const e of this.getLayers())this.originalFilters[e.id]=e.filter;return{trafficFlow:new J(this.mapLibreMap,t)}}_applyConfig(e){return this._setVisible(e?.visible??!1,!1),this._filter(e?.filters,!1),e}getLayers(){return Z(this.tomtomMap.mapLibreMap,[Ce])}filter(e){this._filter(e)}_filter(e,t=!0){if(this.tomtomMap.mapReady)if(e?.any?.length){const t=(r=e,r?.any?.length?Xt(r.any.map(Ca).filter(e=>!i(e))):null);t&&va(t,this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&va(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);var r;t&&(this.config=s({...this.config,filters:e},i),this.emitConfigChange())}setVisible(e){this._setVisible(e)}_setVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficFlow.setLayersVisible(e),t&&(this.config={...this.config,visible:e},this.emitConfigChange())}isVisible(){return this.sourcesWithLayers.trafficFlow.isAnyLayerVisible()}getShown(){return{trafficFlow:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.trafficFlow.sourceAndLayerIDs.layerIDs,validate:!1}).map(D)}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficFlow,this.config?.events,D),new ve(this.configChangeHandlers,[]))}},Oa="tt-traffic-incident-direction-chevron",Na='<svg xmlns="http://www.w3.org/2000/svg" width="48" height="18" viewBox="0 0 48 18">\n<path d="M 18 4 L 30 9 L 18 14" fill="none" stroke="rgba(20, 30, 50, 0.5)" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M 18 4 L 30 9 L 18 14" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>',Ma=["unknown","minor","moderate","major","indefinite"],xa={unknown:{outline:"TrafficIncidents - No delay outline",inner:"TrafficIncidents - No delay pattern"},minor:{outline:"TrafficIncidents - Minor jam outline",inner:"TrafficIncidents - Minor jam"},moderate:{outline:"TrafficIncidents - Moderate jam outline",inner:"TrafficIncidents - Moderate jam"},major:{outline:"TrafficIncidents - Major jam outline",inner:"TrafficIncidents - Major jam"},indefinite:{outline:"TrafficIncidents - Closed road outline",inner:"TrafficIncidents - Closed road pattern"}},Da={outline:{unknown:"hsl(198, 20%, 54%)",minor:"hsl(45, 85%, 36%)",moderate:"hsl(9, 87%, 31%)",major:"hsl(0, 100%, 17%)",indefinite:"hsl(0, 100%, 34%)"},inner:{unknown:"hsl(198, 20%, 90%)",minor:"hsl(45, 100%, 51%)",moderate:"hsl(9, 97%, 51%)",major:"hsl(0, 100%, 34%)",indefinite:"hsl(197, 28%, 95%)"}},Fa=e=>{const t=e.getStyle()?.layers??[],i=/* @__PURE__ */new Map;for(const a of t)i.set(a.id,a);const r={outline:{...Da.outline},inner:{...Da.inner}},s=[];for(const a of Ma){const e=xa[a],t=Pa(i.get(e.outline),e.outline,s),o=Pa(i.get(e.inner),e.inner,s);t&&(r.outline[a]=t),o&&(r.inner[a]=o)}return s.length>0&&console.warn("[TrafficIncidentOverlayModule] style layers have non-literal `line-color` (match/case/etc.); falling back to default colour for: "+s.join(", ")),r},Pa=(e,t,i)=>{if(!e||"object"!=typeof e)return;const r=e.paint;if(!r||"object"!=typeof r)return;const s=r["line-color"];if("string"==typeof s)return s;void 0!==s&&i.push(t)},Ua=["interpolate",["exponential",1.5],["zoom"],5,0,9,.96,13,2.1,19,10.8],Ha=["interpolate",["exponential",1.5],["zoom"],5,.75,9,1.96,13,3.6,19,13.8],ka=e=>["match",["get","magnitudeOfDelay"],"unknown",e.unknown,"minor",e.minor,"moderate",e.moderate,"major",e.major,"indefinite",e.indefinite,e.major],Wa=["match",["get","magnitudeOfDelay"],"unknown","traffic-incidents-no_delay-pattern","indefinite","traffic-incidents-road_closed-pattern",""],Ba=e=>!1===e?null:{outlineColor:e?.outlineColor??"#000",widthScale:e?.widthScale??1.6},Va=["interpolate",["exponential",1.5],["zoom"],5,2.2,9,4.6,13,8.3,19,26],Ga=["case",["==",["feature-state","focused"],!0],1,0],ja=(e,t)=>{if(null===t)return e;const[i,r,s,...a]=e;return[i,r,s,...a.map((e,i)=>i%2==1?["case",["==",["feature-state","focused"],!0],e*t,e]:e)]},za=["in",["get","magnitudeOfDelay"],["literal",["minor","moderate","major"]]],$a=["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],Ya=(e,t,i=Da,r=Ba(void 0))=>{const s=r?.widthScale??null,a=[];return null!==r&&a.push({id:`${e}-focus-halo`,type:"line",minzoom:6,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":r.outlineColor,"line-width":Va,"line-blur":0,"line-opacity":Ga},beforeID:t}),a.push({id:`${e}-outline`,type:"line",minzoom:6,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":ka(i.outline),"line-width":ja(Ha,s)},beforeID:t},{id:`${e}-inner-solid`,type:"line",minzoom:6,filter:za,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":ka(i.inner),"line-width":ja(Ua,s)},beforeID:t},{id:`${e}-inner-chevron`,type:"line",minzoom:12,filter:za,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-pattern":Oa,"line-width":ja(Ua,s)},beforeID:t},{id:`${e}-inner-pattern`,type:"line",minzoom:6,filter:$a,layout:{"line-cap":"round","line-join":"round"},paint:{"line-pattern":Wa,"line-width":ja(Ua,s)},beforeID:t}),a},qa=["step",["zoom"],.7,14,.8,16,.9,18,1],Ka=["step",["zoom"],12.6,14,14.4,16,16.2,18,18],Xa=["match",["get","category"],"other","traffic-incidents-info","accident","traffic-incidents-accident","fog","traffic-incidents-fog","danger","traffic-incidents-roadworks","rain","traffic-incidents-rain","frost","traffic-incidents-frost","lane-closed","traffic-incidents-lane_closed","roadworks","traffic-incidents-roadworks","wind","traffic-incidents-wind","flooding","traffic-incidents-flooding","broken-down-vehicle","traffic-incidents-broken_down_vehicle",""],Za=["all",["!=",["get","magnitudeOfDelay"],"indefinite"],["any",["!",["has","delayInSeconds"]],["step",["zoom"],[">",["get","delayInSeconds"],900],14,[">",["get","delayInSeconds"],600],15,[">",["get","delayInSeconds"],300],16,!0]]],Ja=["all",["==",["get","category"],"jam"],["!=",["get","magnitudeOfDelay"],"unknown"],["!=",["get","magnitudeOfDelay"],"indefinite"],["step",["zoom"],[">",["get","delayInSeconds"],900],13,[">",["get","delayInSeconds"],600],14,[">",["get","delayInSeconds"],300],15,!0]],Qa=["==",["get","magnitudeOfDelay"],"indefinite"],eo=["concat","traffic-jam-",["get","magnitudeOfDelay"],["case",["<",["get","delayInSeconds"],600],"-small",["<",["get","delayInSeconds"],3600],"-medium","-large"]],to=["case",["<=",["get","delayInSeconds"],60],"1 min",[">=",["get","delayInSeconds"],3600],["concat",["to-string",["floor",["/",["to-number",["get","delayInSeconds"]],3600]]]," hr ",["case",["==",["%",["round",["/",["to-number",["get","delayInSeconds"]],60]],60],0],"",["concat",["to-string",["round",["%",["/",["to-number",["get","delayInSeconds"]],60],60]]]," min"]]],["concat",["round",["/",["get","delayInSeconds"],60]]," min"]],io=["case",["has","delayInSeconds"],["*",-1,["get","delayInSeconds"]],0],ro=(e,t)=>[{id:`${e}-incident-marker`,type:"symbol",minzoom:13,filter:Za,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-anchor":"bottom-right","icon-offset":[-1,3],"icon-image":Xa,"icon-size":qa,"symbol-sort-key":io},beforeID:t},{id:`${e}-jam-marker`,type:"symbol",minzoom:12,filter:Ja,layout:{"symbol-placement":"point","icon-anchor":"bottom-left","icon-offset":[2,3],"icon-image":eo,"icon-size":qa,"icon-padding":0,"text-anchor":"bottom-left","text-field":to,"text-font":["NotoSans-CondensedBold"],"text-offset":[2.7,-.75],"text-size":Ka,"symbol-sort-key":io},paint:{"text-color":"hsl(210, 30%, 14%)"},beforeID:t},{id:`${e}-closed-road-marker`,type:"symbol",minzoom:12,filter:Qa,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-anchor":"bottom-right","icon-offset":[-1,3],"icon-image":"traffic-incidents-road_closed","icon-size":qa},beforeID:t}],so=e=>{if("top"!==e)return e?Ie[e]:Ie.lowestLabel},ao=class e extends pe{static async get(t,i){return await ie(t),new e(t,i??{})}constructor(e,t){super("geojson",e,t),this.lastResult=null,this.lastFeatureIds=[],this.lastFocusIds=null,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){const i=`traffic-incident-overlay-${this.instanceIndex}`,r=(()=>{if(k())return Ls||(Ls=W(B(Na))),Ls})();r&&he("if-not-in-sprite",Oa,r,this.mapLibreMap);const s=so(e?.beforeLayerConfig),a=[...Ya(i,s,Fa(this.mapLibreMap),Ba(e?.focus)),...ro(i,s)];return{incidents:new te(this.mapLibreMap,i,a)}}_applyConfig(e){return!1===e?.visible?this.sourcesWithLayers.incidents.setLayersVisible(!1):this.sourcesWithLayers.incidents.setLayersVisible(!0),this.applyBeforeLayer(e?.beforeLayerConfig),e}applyBeforeLayer(e){const t=so(e);for(const i of this.sourcesWithLayers.incidents.sourceAndLayerIDs.layerIDs)this.mapLibreMap.moveLayer(i,t)}restoreDataAndConfigImpl(){this.initSourcesWithLayers(this.config,!0),this.lastResult&&this.sourcesWithLayers.incidents.show(this.lastResult),this._applyConfig(this.config),null!==this.lastFocusIds&&this.lastFocusIds.length>0&&this.setFocus(this.lastFocusIds)}async show(e){await this.waitUntilModuleReady(),this.clearFeatureState(),this.lastFocusIds=null,this.lastResult=e,this.lastFeatureIds=e.features.map(e=>e.properties.id).filter(e=>"string"==typeof e),this.sourcesWithLayers.incidents.show(e);for(const t of this.shownFeaturesHandlers)t(e)}async clear(){await this.waitUntilModuleReady(),this.clearFeatureState(),this.lastResult=null,this.lastFeatureIds=[],this.lastFocusIds=null,this.sourcesWithLayers.incidents.clear()}setVisible(e){this.config={...this.config,visible:e},this.sourcesWithLayers.incidents.setLayersVisible(e),this.emitConfigChange()}isVisible(){return this.sourcesWithLayers.incidents.isAnyLayerVisible()}moveBeforeLayer(e){this.config={...this.config,beforeLayerConfig:e},this.applyBeforeLayer(e),this.emitConfigChange()}getShown(){return{incidents:this.sourcesWithLayers.incidents.shownFeatures}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents,this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}setFocus(e){if(null===e||0===e.length)return this.lastFocusIds=null,void this.clearFeatureState();if(0===this.lastFeatureIds.length)return;this.lastFocusIds=e;const t=new Set(e),i=this.sourcesWithLayers.incidents.sourceAndLayerIDs.sourceID;for(const r of this.lastFeatureIds)this.mapLibreMap.setFeatureState({source:i,id:r},{focused:t.has(r)})}clearFeatureState(){if(0===this.lastFeatureIds.length)return;const e=this.sourcesWithLayers.incidents.sourceAndLayerIDs.sourceID;for(const t of this.lastFeatureIds)this.mapLibreMap.removeFeatureState({source:e,id:t})}},oo=class t extends pe{static async get(e,i){return await ie(e),await ce(e,Te,"trafficIncidents"),new t(e,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(Te);if(!e)throw H(`init ${t.name} with source ID ${Te}`);this.originalFilters={};for(const t of this.getLayers())this.originalFilters[t.id]=t.filter;return{trafficIncidents:new J(this.mapLibreMap,e)}}_applyConfig(e){return this._setVisible(e?.visible??!1,{updateConfig:!1}),i(e?.icons?.visible)||this._setIconsVisible(e.icons.visible,!1),this._filter(e?.filters,e?.icons?.filters,!1),e}filter(e,t){this._filter(e,t)}_filter(e,t,r=!0){if(this.tomtomMap.mapReady){if(e?.any?.length){const i=Ta(e);i&&va(i,t?this.getNonSymbolLayers():this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&va(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);if(t?.any?.length){const e=Ta(t);e&&va(e,this.getSymbolLayers(),this.mapLibreMap,this.originalFilters)}}r&&(this.config=s({...this.config,filters:e,icons:{...this.config?.icons,filters:t}},i),this.emitConfigChange())}getLayers(){return Z(this.tomtomMap.mapLibreMap,[Te])}getSymbolLayers(){return this.getLayers().filter(e=>"symbol"===e.type)}getNonSymbolLayers(){return this.getLayers().filter(e=>"symbol"!=e.type)}setIconsVisible(e){this._setIconsVisible(e)}_setIconsVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficIncidents.setLayersVisible(e,e=>"symbol"===e.type),t&&(this.config={...this.config,icons:{...this.config?.icons,visible:e}},this.emitConfigChange())}setVisible(e){this._setVisible(e)}_setVisible(t,i){(i?.updateConfig??1)&&(delete this.config?.icons?.visible,this.config={...s({...this.config},e),visible:t},this.emitConfigChange()),this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficIncidents.setLayersVisible(t)}isVisible(){return this.sourcesWithLayers.trafficIncidents.isAnyLayerVisible()}anyIconLayersVisible(){return this.sourcesWithLayers.trafficIncidents?.isAnyLayerVisible(e=>"symbol"===e.type)}getShown(){return{trafficIncidents:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.trafficIncidents.sourceAndLayerIDs.layerIDs,validate:!1}).map(U)}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficIncidents,this.config?.events,U),new ve(this.configChangeHandlers,[]))}},no=["motorway","motorway_link","trunk","trunk_link","primary","primary_link","secondary","secondary_link","tertiary","tertiary_link","street","service","track"],lo=["unclassified","residential","living_street"],co=["parking","driveway","alley"],ho=(e,t)=>({left:e.left-t.left,top:e.top-t.top,right:e.right-t.left,bottom:e.bottom-t.top}),uo=(e,t,i)=>e.right<=0||e.left>=t||e.bottom<=0||e.top>=i,po=(e,t,i,r)=>{e.top<=i-e.bottom?t.top=Math.max(t.top,e.bottom+r):t.bottom=Math.min(t.bottom,e.top-r)},yo=(e,t,i,r)=>{e.left<=i-e.right?t.left=Math.max(t.left,e.right+r):t.right=Math.min(t.right,e.left-r)},fo=(e,t,i,r,s)=>{const a=((e,t,i)=>({left:Math.max(0,e.left),top:Math.max(0,e.top),right:Math.min(t,e.right),bottom:Math.min(i,e.bottom)}))(e,i,r),o=e.left<=0&&e.right>=i,n=e.top<=0&&e.bottom>=r;if(o&&!n)return void po(a,t,r,s);if(n&&!o)return void yo(a,t,i,s);const l=e.left<=0,c=e.right>=i,h=e.top<=0,u=e.bottom>=r;!l&&!c||h||u?!h&&!u||l||c?((e,t,i,r,s)=>{const a=e.left,o=i-e.right,n=e.top,l=r-e.bottom,c=Math.min(a,o,n,l);c===a?t.left=Math.max(t.left,e.right+s):c===o?t.right=Math.min(t.right,e.left-s):c===n?t.top=Math.max(t.top,e.bottom+s):t.bottom=Math.min(t.bottom,e.top-s)})(a,t,i,r,s):yo(a,t,i,s):po(a,t,r,s)},go=e=>"string"==typeof e?document.querySelector(e):e,mo=e=>"mapLibreMap"in e?e.mapLibreMap:e,_o=(e,t,i)=>{const r=mo(e).getContainer().getBoundingClientRect(),{width:s,height:a}=r,o={left:i,top:i,right:s-i,bottom:a-i};for(const n of t){const e=go(n);if(!e)continue;const t=ho(e.getBoundingClientRect(),r);uo(t,s,a)||fo(t,o,s,a,i)}return o.left>=o.right||o.top>=o.bottom?null:{visibleAreaBounds:o,mapWidthPX:s,mapHeightPX:a}},Lo=e=>{const{map:t,surroundingElements:i,paddingPX:r=0}=e,s=_o(t,i,r);if(!s)return null;const{visibleAreaBounds:a}=s,o=mo(t),n=o.unproject([a.left,a.bottom]),l=o.unproject([a.right,a.top]);return[n.lng,n.lat,l.lng,l.lat]},Ao=e=>{const{map:t,surroundingElements:i}=e,r=Lo({map:t,surroundingElements:i});if(!r)return null;const[s,a,o,n]=r;return[(s+o)/2,(a+n)/2]},So=e=>{const{map:t,toBeContainedBBox:i,surroundingElements:r,paddingPX:s=0}=e,a=_o(t,r,s);if(!a)return null;const{visibleAreaBounds:o,mapWidthPX:n,mapHeightPX:l}=a,c=o.left/n,h=o.right/n,u=o.top/l,d=h-c,p=o.bottom/l-u,[y,f,g,m]=i,_=(g-y)/d,L=(m-f)/p,A=y-c*_,S=m+u*L;return[A,S-L,A+_,S]};export{pe as AbstractMapModule,X as AbstractSourceWithLayers,Q as AddedSourceWithLayers,Re as BASE_MAP_SOURCE_ID,ni as BaseMapModule,ye as CombinedEvents,ci as CustomGeoJSONModule,ji as DESELECTED_FOREGROUND_COLOR,zi as DESELECTED_OUTLINE_COLOR,Ki as DESELECTED_ROUTE_FILTER,$i as DESELECTED_SECONDARY_COLOR,Se as EventsProxy,rs as FINISH_INDEX,te as GeoJSONSourceWithLayers,Ei as GeometriesModule,be as HILLSHADE_SOURCE_ID,Oi as HillshadeModule,gr as INDEFINITE_DELAY_DASH_COLOR,ss as INDEX_TYPE,cr as MAJOR_DELAY_COLOR,is as MIDDLE_INDEX,ur as MINOR_DELAY_COLOR,dr as MINOR_DELAY_LABEL_COLOR,hr as MODERATE_DELAY_COLOR,ve as ModuleEvents,Ee as POI_SOURCE_ID,ri as POIsModule,qt as PlacesModule,Vi as ROUTE_LINE_FOREGROUND_COLOR,Yi as ROUTE_LINE_FOREGROUND_WIDTH,Gi as ROUTE_LINE_OUTLINE_COLOR,Xi as ROUTE_LINE_OUTLINE_WIDTH,Bs as RoutingModule,qi as SELECTED_ROUTE_FILTER,ts as START_INDEX,as as STOP_DISPLAY_INDEX,J as StyleSourceWithLayers,Ce as TRAFFIC_FLOW_SOURCE_ID,Te as TRAFFIC_INCIDENTS_SOURCE_ID,Ys as TomTomMap,K as TomTomMapSource,Aa as TrafficAreaAnalyticsModule,wa as TrafficFlowModule,ao as TrafficIncidentOverlayModule,oo as TrafficIncidentsModule,yr as UNKNOWN_DELAY_BG_COLOR,pr as UNKNOWN_DELAY_COLOR,fr as UNKNOWN_DELAY_DASH_COLOR,we as UserEvents,li as baseMapLayerGroupNames,De as baseMapPOICategoryValues,Ht as buildPlaceTitle,Ri as buildReachableRangeFeatures,ms as buildRoutingLayers,So as calculateFittingBBox,Lo as calculatePaddedBBox,Ao as calculatePaddedCenter,Ai as colorPaletteIDs,Li as colorPalettes,_s as defaultRoutingLayers,Z as filterLayersBySources,q as findFeatureByRefId,wi as geometryThemes,Wt as getIconIDForPlace,nr as getInstructionLineWidth,lr as getInstructionOutlineWidth,er as getLineForegroundWidth,tr as getLineOutlineWidth,Gt as getPOIGroupForPlace,Vt as getPOILayerCategoryForPlace,ii as getStyleCategories,sr as getTollRoadOutlineWidth,ir as getWaypointIconSize,Ne as mapDisplayPoiCategoryMappings,Ie as mapStyleLayerIDs,ei as poiCategoryGroups,Oe as poiLayerIDs,Yt as preparePlacesForDisplay,Ti as prepareReachableRangesForDisplay,vi as reachableRangeGeometryConfig,Y as renderedRefId,Qs as resolveColorStops,no as roadCategories,co as serviceRoadSubCategories,Ni as standardStyleIDs,lo as streetRoadSubCategories,Mi as styleModules,Ci as themedGeometryConfig,xe as toBaseMapPOICategory,Pe as toBaseMapPOIGroup,jt as toPlaces};
1
+ import{isEmpty as e,isEqual as t,isNil as i,omit as r,omitBy as s,remove as a}from"lodash-es";import{DEFAULT_COMMON_BASE_URL as o,TomTomConfig as n,bboxCenter as l,bboxFromCoordsArray as c,bboxFromGeoJSON as h,formatDistance as u,formatDuration as d,generateId as p,generateTomTomHeaders as y,getPosition as f,iconToTrafficIncidentCategory as g,indexedMagnitudes as m,isProxyCredentialsMode as _,mergeFromGlobal as L,poiCategoriesToID as A}from"@tomtom-org/maps-sdk/core";import{bearing as S,booleanPointInPolygon as I,difference as E,featureCollection as b,hexGrid as R,mask as T,squareGrid as C}from"@turf/turf";import{Map as v,getRTLTextPluginStatus as w,setRTLTextPlugin as O,setWorkerCount as N}from"maplibre-gl";import{version as M}from"maplibre-gl/package.json";var x=["road_category","road_subcategory","relative_speed","left_hand_traffic","road_closure","absolute_speed","part_of_two_way_road","openlr","display_class"],D=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{roadCategory:t?.road_category,leftHandTraffic:Boolean(t?.left_hand_traffic),roadClosure:Boolean(t?.road_closure),relativeSpeed:t?.relative_speed,...t?.road_subcategory&&{roadSubcategory:t.road_subcategory},...t?.absolute_speed&&{absoluteSpeed:t.absolute_speed},...t?.part_of_two_way_road&&{partOfTwoWayRoad:Boolean(t.part_of_two_way_road)},...t?.openlr&&{openlr:t.openlr},...t?.display_class&&{displayClass:t.display_class}}}},F=["icon_category","left_hand_traffic","magnitude_of_delay","road_category","road_subcategory","id","description","delay","part_of_two_way_road","start_time","end_time","probability_of_occurrence","number_of_reports","last_report_time","average_speed_kmph","openlr","time_validity","display_class"],P={other:0,accident:1,fog:2,danger:3,rain:4,frost:5,jam:6,"lane-closed":7,"road-closed":8,roadworks:9,wind:10,flooding:11,"animals-on-road":12,"narrow-lanes":13,"broken-down-vehicle":14},U=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{id:t.id??p(),description:t?.description_0??"",category:g(t?.icon_category_0),magnitudeOfDelay:m[t?.magnitude_of_delay],roadCategory:t?.road_category,roadSubcategory:t?.road_subcategory,leftHandTraffic:Boolean(t?.left_hand_traffic),...t?.delay&&{delayInSeconds:t.delay},...t?.part_of_two_way_road&&{partOfTwoWayRoad:Boolean(t.part_of_two_way_road)},...t?.start_time&&{startTime:new Date(t.start_time)},...t?.end_time&&{endTime:new Date(t.end_time)},...t?.probability_of_occurrence&&{probabilityOfOccurrence:t.probability_of_occurrence},...t?.number_of_reports&&{numberOfReports:t.number_of_reports},...t?.last_report_time&&{lastReportTime:new Date(t.last_report_time)},...t?.average_speed_kmph&&{averageSpeedKmph:t.average_speed_kmph},...t?.openlr&&{openlr:t.openlr},...t?.time_validity&&{timeValidity:t.time_validity},...t?.display_class&&{displayClass:t.display_class},...t?.point_type&&{pointType:t.point_type}}}},H=e=>/* @__PURE__ */new Error(`Trying to ${e} while it is not in the map style. Did you exclude it when loading the map?`),k=()=>"undefined"!=typeof document&&"undefined"!=typeof DOMParser&&"undefined"!=typeof btoa,W=e=>{if(!k())return;const t=document.createElement("img");return t.src=`data:image/svg+xml;base64,${btoa((new XMLSerializer).serializeToString(e))}`,t},B=e=>(new DOMParser).parseFromString(e,"image/svg+xml").documentElement,V=e=>((e,t)=>(t?.fillColor&&e.querySelector("#background")?.setAttribute("fill",t.fillColor),t?.outlineColor&&e.querySelector("#outline")?.setAttribute("fill",t.outlineColor),void 0!==t?.outlineOpacity&&e.querySelector("#outline")?.setAttribute("fill-opacity",t.outlineOpacity.toString()),e))(B('<svg xmlns="http://www.w3.org/2000/svg" width="120" height="140">\n <path id="background" d="M63.95 137.516c6.556-12.737 19.098-21.09 30.828-29.388C110.046 97.324 120 79.603 120 59.574 120 26.671 93.138 0 60 0S0 26.671 0 59.574c0 20.029 9.954 37.75 25.22 48.55 11.734 8.302 24.274 16.652 30.83 29.388 1.706 3.316 6.194 3.316 7.9 0z"\n fill="#1988cf"/>\n <path id="outline" d="M91.298 103.272C105.052 93.544 114 77.596 114 59.574c0-29.61-24.176-53.617-54-53.617S6 29.964 6 59.574c0 18.022 8.95 33.97 22.7 43.698l2.27 1.601c10.172 7.153 21.922 15.423 29.03 27.416 7.104-11.993 18.858-20.259 29.03-27.416l2.268-1.601zm1.468 6.274c-11.13 7.845-22.632 15.957-28.816 27.966-1.706 3.316-6.194 3.316-7.9 0-6.182-12.009-17.686-20.121-28.816-27.966l-2.016-1.422C9.954 97.324 0 79.603 0 59.574 0 26.671 26.862 0 60 0s60 26.671 60 59.574c0 20.029-9.954 37.75-25.222 48.55l-2.016 1.422z"\n fill-opacity=".3"/>\n</svg>\n'),e);var G,j,z,$=e=>(function(e){if(i(e))throw new Error(`${e} must not be null/undefined. Something went wrong with its initialization.`)}(e),e),Y=e=>{const t=e.properties?.id;return"string"==typeof t||"number"==typeof t?t:e.id},q=(e,t)=>{if(null!=t)for(let i=0;i<e.length;i++)if(Y(e[i])===t)return{feature:e[i],index:i}},K=class{constructor(e,t,i){this.id=e,this.spec=t,this.runtimeSource=i}ensureAddedToMap(e){this.runtimeSource||(!e.getSource(this.id)&&this.spec&&e.addSource(this.id,this.spec),this.runtimeSource=e.getSource(this.id))}},X=class{constructor(e,t,i){this.map=e,this.source=t,this._layerSpecs=i,this._updateSourceAndLayerIDs()}get mapRemoved(){return!0===this.map._removed}isAnyLayerVisible(e){return this.getLayerSpecs(e).some(e=>this.isLayerVisible(e))}areAllLayersVisible(e){return this.getLayerSpecs(e).every(e=>this.isLayerVisible(e))}getLayerSpecs(e){return e?this._layerSpecs.filter(e):this._layerSpecs}_updateSourceAndLayerIDs(){this._sourceAndLayerIDs={sourceID:this.source.id,layerIDs:this._layerSpecs.map(e=>e.id)}}isLayerVisible(e){return!this.mapRemoved&&(!!this.map.getLayer(e.id)&&"none"!==this.map.getLayoutProperty(e.id,"visibility"))}setLayersVisible(e,t){if(!this.mapRemoved)for(const i of this.getLayerSpecs(t))this.map.getLayer(i.id)&&this.map.setLayoutProperty(i.id,"visibility",e?"visible":"none",{validate:!1})}get sourceAndLayerIDs(){return this._sourceAndLayerIDs}equalSourceAndLayerIDs(e){return this.sourceAndLayerIDs.sourceID===e.sourceAndLayerIDs.sourceID&&this.sourceAndLayerIDs.layerIDs.length===e.sourceAndLayerIDs.layerIDs.length&&this.sourceAndLayerIDs.layerIDs.every((t,i)=>t===e.sourceAndLayerIDs.layerIDs[i])}},Z=(e,t)=>e.getStyle().layers.filter(e=>t.includes(e?.source)),J=class extends X{constructor(e,t,i){let r=Z(e,[t.id]);i&&(r=r.filter(i)),super(e,new K(t.id,e.getStyle().sources[t.id],t),r)}},Q=class extends X{constructor(e,t,i,r){super(e,new K(t,i),r.map(e=>({...e,source:t})))}ensureLayersAddedToMap(){if(!this.mapRemoved)for(const e of this._layerSpecs)this.map.getLayer(e.id)||this.map.addLayer(e,e.beforeID)}ensureAddedToMapWithVisibility(e,t){this.mapRemoved||(this.source.ensureAddedToMap(this.map),t&&(this.ensureLayersAddedToMap(),this.setLayersVisible(e)))}},ee={type:"FeatureCollection",features:[]},te=class extends Q{constructor(e,t,i,r=!0,s){super(e,t,s?.cluster?{type:"geojson",data:ee,...s}:{type:"geojson",data:ee,promoteId:"id",...s??{}},i),this.shownFeatures=ee,this.ensureAddedToMapWithVisibility(!1,r)}show(e,{automaticVisibility:t=!0}={}){this.shownFeatures=e,this.mapRemoved||($(this.source.runtimeSource).setData(e),t&&this.setLayersVisible(!!e.features.length))}findById(e){return q(this.shownFeatures.features,e)}clear(){this.show(ee)}findFeature(e){return"index"in e?this.shownFeatures.features[e.index]:"id"in e?this.findById(e.id)?.feature:void 0}putEventState(e){if("put"===(e.mode??"put"))for(const i of this.shownFeatures.features)i.properties?.eventState===e.state&&delete i.properties.eventState;const t=this.findFeature(e);t&&(t.properties={...t.properties,eventState:e.state}),!1!==e.show&&this.show(this.shownFeatures,{automaticVisibility:!1})}cleanEventState(e){const t=this.findFeature(e);t?.properties?.eventState&&(delete t?.properties?.eventState,!1!==e?.show&&this.show(this.shownFeatures,{automaticVisibility:!1}))}cleanEventStates(e){let t=!1;for(const i of this.shownFeatures.features)e?.states&&!e.states.includes(i.properties?.eventState)||(delete i.properties?.eventState,t=!0);!1!==e?.show&&t&&this.show(this.shownFeatures,{automaticVisibility:!1})}},ie=async e=>{e.mapReady||(await e.mapLibreMap.once("styledata"),await ie(e))},re=e=>{const t=globalThis.__DEMO_BFF_ENSURE_SESSION__;return"function"!=typeof t?e:t().then(()=>e,()=>e)},se=e=>{const t=e.commonBaseURL??o,i=t!==o,r=_(e);return(s,a)=>{const o=((e,t,i,r)=>{if(!i)return e;try{const i=new URL(e);return"api.tomtom.com"===(s=i.hostname)||s.endsWith(".api.tomtom.com")?(r&&i.searchParams.delete("key"),t+i.pathname+i.search+i.hash):e}catch{return e}var s})(s,t,i,r),n=i&&o.startsWith(t),l=r&&n;let c=!1;try{const e=new URL(s).hostname;c="tomtom.com"===e||e.endsWith(".tomtom.com")}catch{c=!1}if(!c&&!n)return{url:o};if("Image"===a)return l?re({url:o,credentials:"include"}):{url:o};const h=new URL(o);(e=>{e.pathname.includes("incidents")?e.searchParams.set("tags",F.join(",")):e.pathname.includes("flow")&&e.searchParams.set("tags",x.join(","))})(h);const u={url:h.toString(),headers:{...y(e)}};return l?(u.credentials="include",re(u)):u}},ae=(e,t,i)=>{const r=e.id;e.maxzoom===t.maxzoom&&e.minzoom===t.minzoom||i.setLayerZoomRange(r,e.minzoom??i.getMinZoom(),e.maxzoom??i.getMaxZoom()),i.setFilter(r,e.filter,{validate:!1});for(const s of Object.keys(t.layout??[]))e.layout?.[s]||i.setLayoutProperty(r,s,void 0,{validate:!1});for(const s of Object.keys(t.paint??[]))e.paint?.[s]||i.setPaintProperty(r,s,void 0,{validate:!1});for(const[s,a]of Object.entries(e.paint??[]))i.setPaintProperty(r,s,a,{validate:!1});for(const[s,a]of Object.entries(e.layout??[]))i.setLayoutProperty(r,s,a,{validate:!1})},oe=(e,t,i,r)=>{const s=e.reduce((e,t)=>({...e,[t.id]:t}),{}),a=t.reduce((e,t)=>({...e,[t.id]:t}),{}),o=[],n=[],l=[],c=[];Object.keys(s).forEach(e=>{a[e]?(l.push(s[e]),c.push(a[e])):o.push(e)}),Object.keys(a).forEach(e=>{s[e]||n.push(e)});const h=i._layerSpecs;n.forEach(e=>{r.removeLayer(e);for(let t=0;t<h.length;t++)if(h[t].id===e){h.splice(t,1);break}}),o.forEach(e=>{const t={...s[e],source:i.source.id};h.push(t)}),i._updateSourceAndLayerIDs(),((e,t,i)=>{e.forEach((e,r)=>ae(e,t[r],i))})(l,c,r)},ne=(e,t)=>{const i=/* @__PURE__ */new Set,r=e=>{t.getLayer(e.id)||t.addLayer({...e,layout:{...e.layout,visibility:"none"}},e.beforeID),i.add(e.id)},s={};for(e.forEach(e=>{e.beforeID?i.has(e.beforeID)||t.getLayer(e.beforeID)?(i.add(e.beforeID),r(e)):s[e.beforeID]?s[e.beforeID].push(e):s[e.beforeID]=[e]:r(e)});Object.keys(s).length>0;){const e=Object.keys(s).filter(e=>i.has(e));if(!e.length)return void console.error(`Some layers cannot be added. Check for non-existing layers, or circular beforeID dependencies for the following: ${JSON.stringify(Object.keys(s))}`);e.forEach(e=>{s[e].forEach(e=>r(e)),delete s[e]})}},le=(e,t)=>{switch(typeof e){case"undefined":return{type:"standard",include:[t]};case"string":return{type:"standard",id:e,include:[t]};default:if("standard"===e.type)return e.include?{...e,include:[...e.include,t]}:{...e,include:[t]};throw(e=>/* @__PURE__ */new Error(`Trying to add style module ${e} to the custom style!`))(t)}},ce=async(e,t,i)=>{if(!e.mapLibreMap.getSource(t)){const r=e.mapLibreMap;r.isStyleLoaded()||await r.once("idle"),e.setStyle(le(e.getStyle(),i)),await(async(e,t)=>{e.mapLibreMap.getSource(t)&&e.mapLibreMap.isSourceLoaded(t)||await e.mapLibreMap.once("sourcedata")})(e,t),await r.once("styledata");for(const e of Z(r,[t]))r.setLayoutProperty(e.id,"visibility","none",{validate:!1});await r.once("styledata")}},he=async(e,t,i,r,s)=>{if(!i)return void console.warn(`addOrUpdateImage called with empty image for ID ${t}`);const a=i=>{const a=r.hasImage(t);a&&"add-or-update"==e?r.updateImage(t,i):a||r.addImage(t,i,s)},o=e=>{e.complete?e.naturalWidth>0?a(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>a(e),e.onerror=()=>console.warn(`Failed to load image for ID ${t}`))};"string"==typeof i?i.includes("<svg")?o(W(B(i))):a((await r.loadImage(i)).data):o(i)},ue=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},de=e=>{if("string"==typeof e)return ue(e);const t=e;return t?.id?ue(t.id):"light"},pe=class e{static{this.instanceCounters=/* @__PURE__ */new WeakMap}constructor(t,i,r){this._initializing=!0,this.configChangeHandlers=[],this.moduleReady=!1;const s=new.target,a=e.instanceCounters.get(s)??-1;this.instanceIndex=a+1,e.instanceCounters.set(s,this.instanceIndex),this.sourceType=t,this.tomtomMap=i,this.eventsProxy=i._eventsProxy,this.mapLibreMap=i.mapLibreMap,this.initSourcesWithLayers(r),this.applyConfig(r),this.tomtomMap.addStyleChangeHandler({onStyleAboutToChange:()=>{this.moduleReady=!1},onStyleChanged:()=>this.restoreDataAndConfig()}),this._initializing=!1}initSourcesWithLayers(e,t){this.moduleReady=!1,this.sourcesWithLayers=this._initSourcesWithLayers(e,t),this._sourceAndLayerIDs=Object.fromEntries(Object.entries(this.sourcesWithLayers).map(([e,t])=>[e,t.sourceAndLayerIDs])),t&&this.eventsProxy.updateIfRegistered(this.sourcesWithLayers),this.tomtomMap.mapReady&&(this.moduleReady=!0)}async waitUntilModuleReady(){await ie(this.tomtomMap),this.moduleReady||await new Promise(e=>{const t=setInterval(()=>{this.tomtomMap.mapReady&&this.moduleReady&&(clearInterval(t),e())},200)})}applyConfig(e){this.config=this._applyConfig(e),this.emitConfigChange()}emitConfigChange(){if(!this._initializing)for(const e of this.configChangeHandlers)e(this.config)}resetConfig(){this.applyConfig(void 0)}async restoreDataAndConfig(){this.moduleReady=!1,"geojson"===this.sourceType?requestAnimationFrame(()=>{this.restoreDataAndConfigImpl()}):this.restoreDataAndConfigImpl()}restoreDataAndConfigImpl(){this.initSourcesWithLayers(this.config,!0),this._applyConfig(this.config)}getConfig(){return this.config&&{...this.config}}get sourceAndLayerIDs(){return this._sourceAndLayerIDs}},ye=class{constructor(e,t){this.userEventsInstance=e,this.moduleEventsInstance=t}on(e,t){return"config-change"===e?this.moduleEventsInstance.on("config-change",t):"shown-features"===e?this.moduleEventsInstance.on("shown-features",t):this.userEventsInstance.on(e,t)}off(e){"config-change"===e||"shown-features"===e?this.moduleEventsInstance.off(e):this.userEventsInstance.off(e)}},fe=class{constructor(){this.interactiveLayerIDs=[],this.handlers={},this.findHandlers=(e,t,i)=>t&&i&&e.flatMap(e=>{const r=this.handlers[t]?.[e];return 1===r?.length?r:this.handlers[t]?.[e]?.filter(e=>e.layerIDs.includes(i))||[]})||[]}ensureInteractiveLayerIDsAdded(e){e._layerSpecs.forEach(e=>{this.interactiveLayerIDs.includes(e.id)||this.interactiveLayerIDs.push(e.id)})}addEventHandler(e,t,i,r){this.ensureInteractiveLayerIDsAdded(e);const s=e.source.id;this.handlers[s]||(this.handlers[s]={[i]:[]}),this.handlers[s][i]??=[],this.handlers[s][i]?.push({sourceWithLayers:e,layerIDs:e._layerSpecs.map(e=>e.id),fn:t,config:r})}removeHandler(t,i,r){const s=this.handlers[t.source.id]?.[i];s&&(a(s,e=>e.fn===r),s.length||(delete this.handlers[t.source.id]?.[i],e(this.handlers[t.source.id])&&delete this.handlers[t.source.id]))}remove(t,i){const r=this.handlers[t.source.id]?.[i];r&&(a(r,e=>{return i=t._layerSpecs,e.layerIDs.every((e,t)=>e===i[t].id);var i}),r.length||(delete this.handlers[t.source.id]?.[i],e(this.handlers[t.source.id])&&delete this.handlers[t.source.id]));for(const e of t._layerSpecs)a(this.interactiveLayerIDs,t=>e.id===t)}removeAll(){this.interactiveLayerIDs=[],this.handlers={}}hasSourceID(e){return!!this.handlers[e]}sourceWithLayersFor(e){if(!e)return;const t=this.handlers[e];if(t)for(const i of Object.values(t))if(i?.length)return i[0].sourceWithLayers}updateIfRegistered(e){for(const t of Object.values(e)){const e=this.handlers[t.source.id];if(e)for(const i of Object.values(e))for(const e of i)t.equalSourceAndLayerIDs(e.sourceWithLayers)&&(e.sourceWithLayers=t)}}},ge=e=>"click"===e||"contextmenu"===e,me=(e,t,i,s="updateInProps")=>{const{feature:a,index:o}=q(i,t)||{};if(a&&(!ge(a.properties?.eventState)||ge(e))){const t={...a,properties:"updateInProps"===s?{...a?.properties,eventState:e}:r(a?.properties,"eventState")};return i.splice(o,1,t),o}},_e=(e,t,r)=>{const s=[...r.shownFeatures.features];i(me(e,Y(t),s,"removeFromProps"))||r.show({...r.shownFeatures,features:s},{automaticVisibility:!1})},Le=(e,t,i,r,s)=>{if(t&&r instanceof te){const n=[...r.shownFeatures.features];return me(e,Y(t),n),!i||(o=t,(a=i)&&o&&a.id===o.id)||(s===r?me(e,Y(i),n,"removeFromProps"):s instanceof te&&_e(e,i,s)),void r.show({...r.shownFeatures,features:n},{automaticVisibility:!1})}var a,o;i&&s instanceof te&&_e(e,i,s)},Ae={precisionMode:"box",paddingBoxPx:5,cursorOnHover:"pointer",cursorOnMouseDown:"grabbing",cursorOnMap:"default",longHoverDelayAfterMapMoveMS:800,longHoverDelayOnStillMapMS:300},Se=class extends fe{constructor(e,t={}){super(),this.enabled=!0,this.firstDelayedHoverSinceMapMove=!0,this.map=e,this.mapCanvas=e.getCanvas(),this.config={...Ae,...t},this.mapCanvas.style.cursor=this.config.cursorOnMap,this.lastCursorStyle=this.config.cursorOnMap,this.listenToEvents()}listenToEvents(){this.map.on("mousemove",e=>this.onMouseMove(e)),this.map.on("movestart",()=>this.onMouseStart()),this.map.on("mouseout",()=>this.onMouseOut()),this.map.on("mouseover",e=>this.onMouseMove(e)),this.map.on("mousedown",()=>this.onMouseDown()),this.map.on("mouseup",()=>this.onMouseUp()),this.map.on("click",e=>this.onMapClick("click",e)),this.map.on("contextmenu",e=>this.onMapClick("contextmenu",e))}enable(e){this.enabled=e,e||this.clearLongHoverTimeout()}toPaddedBounds(e){const t=this.config.paddingBoxPx;return[[e.x-t,e.y+t],[e.x+t,e.y-t]]}isEnabled(){return this.enabled&&!this.map.isMoving()}toCallerFeatures(e,t){const i=(e=>{const t=/* @__PURE__ */new Set,i=[];for(const r of e){const e=Y(r);if(void 0===e){i.push(r);continue}const s=`${r.source} ${e}`;t.has(s)||(t.add(s),i.push(r))}return i})((r=e,(s=t)?r.filter(e=>e.source===s):r));var r,s;const a=this.sourceWithLayersFor(t);return a instanceof te?i.map(e=>a.findById(Y(e))?.feature??e):i}getRenderedFeatures(e){if(!this.interactiveLayerIDs.length)return[];const t={layers:this.interactiveLayerIDs,validate:!1},i=this.config.precisionMode,r="point-then-box"===i||"point"===i?this.map.queryRenderedFeatures(e,t):[];return r.length||"point"===i?r:this.map.queryRenderedFeatures(this.toPaddedBounds(e),t)}clearLongHoverTimeout(){window.clearTimeout(this.longHoverTimeoutHandlerID)}restartLongHoverTimeout(){this.clearLongHoverTimeout(),this.longHoverTimeoutHandlerID=window.setTimeout(()=>this.handleLongHoverTimeout(),this.firstDelayedHoverSinceMapMove?this.config.longHoverDelayAfterMapMoveMS:this.config.longHoverDelayOnStillMapMS)}handleLongHoverTimeout(){if(this.firstDelayedHoverSinceMapMove=!1,this.hoveringSourceWithLayers){Le("long-hover",this.hoveringFeature,void 0,this.hoveringSourceWithLayers,void 0);const e=this.findHandlers(["long-hover"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id);if(e.length){const t=this.toCallerFeatures(this.hoveringFeatures??[],this.hoveringFeature?.source);for(const i of e)i.fn(t[0],this.hoveringLngLat,t,i.sourceWithLayers)}}}onMouseStart(){this.firstDelayedHoverSinceMapMove=!0,this.clearLongHoverTimeout()}onMouseOut(){this.clearLongHoverTimeout()}onMouseDown(){this.lastCursorStyle=this.mapCanvas.style.cursor,this.mapCanvas.style.cursor=this.config.cursorOnMouseDown}onMouseUp(){this.mapCanvas.style.cursor=this.lastCursorStyle}onMouseMove(e){if(!this.isEnabled())return;this.hoveringFeatures=this.getRenderedFeatures(e.point);const[t]=this.hoveringFeatures;if(t&&!this.hasSourceID(t.source))return;const{hoverChanged:i,mouseInMotionOverHoveredFeature:r}=((e,t,i,r)=>{if(t){if(!r)return{hoverChanged:!0};if(t.id&&t.id!==r.id||t.properties.id&&t.properties.id!==r.properties.id||t.source!==r.source||t.layer.id!==r.layer.id)return{hoverChanged:!0};if(i&&(e.x-i.x!=0||e.y-i.y!=0))return{mouseInMotionOverHoveredFeature:!0}}else if(r)return{hoverChanged:!0};return{}})(e.point,t,this.hoveringPoint,this.hoveringFeature);if(i||r){this.hoveringLngLat=e.lngLat,this.hoveringPoint=e.point;const s=this.hoveringFeature;this.hoveringFeature=t;const a=this.hoveringSourceWithLayers,o=this.findHandlers(["hover","hover-move","long-hover","click","contextmenu"],t?.source,t?.layer.id)?.[0];let n;if(this.hoveringSourceWithLayers=this.sourceWithLayersFor(t?.source),i){this.updateHoverCursor(o?.config),Le("hover",this.hoveringFeature,s,this.hoveringSourceWithLayers,a);const i=this.findHandlers(["hover"],t?.source,t?.layer.id);if(i.length){n=this.toCallerFeatures(this.hoveringFeatures,t?.source);for(const t of i)t.fn(n[0],e.lngLat,n,t.sourceWithLayers)}}if(r){const t=this.findHandlers(["hover-move"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id);if(t.length){n??=this.toCallerFeatures(this.hoveringFeatures,this.hoveringFeature?.source);for(const i of t)i.fn(n[0],e.lngLat,n,i.sourceWithLayers)}}this.restartLongHoverTimeout()}}updateHoverCursor(e){this.hoveringFeature?this.mapCanvas.style.cursor=e?.cursorOnHover??this.config.cursorOnHover:this.mapCanvas.style.cursor=this.config.cursorOnMap}onMapClick(e,t){if(!this.isEnabled())return;const i=this.getRenderedFeatures(t.point),r=this.lastClickedFeature;this.lastClickedFeature=i[0];const s=this.lastClickedSourceWithLayers,a=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);if(this.lastClickedSourceWithLayers=a[0]?.sourceWithLayers,Le(e,this.lastClickedFeature,r,this.lastClickedSourceWithLayers,s),a.length){const e=this.toCallerFeatures(i,this.lastClickedFeature?.source);for(const i of a)i.fn(e[0],t.lngLat,e,i.sourceWithLayers)}}},Ie={country:"Places - Country name",lowestPlaceLabel:"Places - Village / Hamlet",poi:"POI",lowestLabel:"Borders - Treaty label",lowestRoadLine:"Tunnel - Railway outline",lowestBuilding:"Buildings - Underground"},Ee="vectorTiles",be="hillshade",Re="vectorTiles",Te="vectorTilesIncidents",Ce="vectorTilesFlow",ve=class{constructor(e,t){this.configChangeHandlers=e,this.shownFeaturesHandlers=t}on(e,t){if("config-change"===e){const e=t;return this.configChangeHandlers.push(e),()=>{const t=this.configChangeHandlers.indexOf(e);-1!==t&&this.configChangeHandlers.splice(t,1)}}const i=t;return this.shownFeaturesHandlers.push(i),()=>{const e=this.shownFeaturesHandlers.indexOf(i);-1!==e&&this.shownFeaturesHandlers.splice(e,1)}}off(e){"config-change"===e?this.configChangeHandlers.length=0:this.shownFeaturesHandlers.length=0}},we=class{constructor(e,t,i,r){this.eventProxy=e,this.config=i,this.mapping=r,this.sources=Array.isArray(t)?t:[t]}on(e,t){const i=[];if(this.mapping){const r=this.mapping;for(const s of this.sources){const a=(e,...i)=>t(r(e),...i);this.eventProxy.addEventHandler(s,a,e,this.config),i.push({source:s,registeredHandler:a})}}else for(const r of this.sources)this.eventProxy.addEventHandler(r,t,e,this.config),i.push({source:r,registeredHandler:t});return()=>{for(const{source:t,registeredHandler:r}of i)this.eventProxy.removeHandler(t,e,r)}}off(e){for(const t of this.sources)this.eventProxy.remove(t,e)}},Oe=["POI","POI - Micro"],Ne={NATIVE_RESERVATION:"aboriginal_land",AIRPORT:"airport",AMUSEMENT_PARK:"amusement_park",ATM:"atm",BANK:"bank",BAR:"bar",BEACH:"beach_resort",ACCESS_GATEWAY:"border_control",FRONTIER_CROSSING:"border_control",BUS_STOP:"bus_station",CAFE:"cafe",CAFE_PUB:"cafe",CAMPING_GROUND:"camping_ground",RENT_A_CAR_FACILITY:"car_rental",CASINO:"casino_and_gambling",CEMETERY:"cemetery",ELECTRIC_VEHICLE_STATION:"charging_location",CINEMA:"cinema",MOVIE_THEATER:"cinema",HEALTH_CARE_SERVICE:"clinic",CLOTHING_SHOP:"clothing_shop",COFFEE_SHOP:"coffee_shop",COLLEGE_OR_UNIVERSITY:"college_or_university",COLLEGE_UNIVERSITY:"college_or_university",AGRICULTURE:"commercial_area",BUSINESS_PARK:"commercial_area",COMMERCIAL_BUILDING:"commercial_area",COMPANY:"commercial_area",RESIDENTIAL_ACCOMMODATION:"commercial_area",EXHIBITION_CONVENTION_CENTER:"conference_center",CLUB_ASSOCIATION:"consumer_service",PUBLIC_AMENITY:"consumer_service",WELFARE_ORGANIZATION:"consumer_service",COURTHOUSE:"courthouse",COMMUNITY_CENTER:"cultural_center",CULTURAL_CENTER:"cultural_center",DENTIST:"dentist",DEPARTMENT_STORE:"department_store",DOCTOR:"doctor",EMERGENCY_MEDICAL_SERVICE:"emergency_ward_entrance",EMERGENCY_ROOM:"emergency_ward_entrance",FAST_FOOD:"fast_food",FERRY_TERMINAL:"ferry_terminal",FIRE_STATION_BRIGADE:"fire_station",FITNESS_CLUB_CENTER:"fitness_center",WINERY:"food_and_drinks_shop",CURRENCY_EXCHANGE:"foreign_exchange",EXCHANGE:"foreign_exchange",GAS_STATION:"fuel_station",GOLD_EXCHANGE:"gold_exchange",GOLF_COURSE:"golf_course",EMBASSY:"government_office",GOVERNMENT_OFFICE:"government_office",HELIPAD_HELICOPTER_LANDING:"heliport_or_helipad",HISTORIC_SITE:"historic_site",HOLIDAY_RENTAL:"holiday_home",GENERAL_HOSPITAL_AND_POLYCLINIC:"hospital",HOSPITAL:"hospital",HOTEL_MOTEL:"hotel_or_motel",ICE_SKATING_RINK:"ice_rink",INDUSTRIAL_BUILDING:"industrial_area",PORT_WAREHOUSE_FACILITY:"industrial_area",PRIMARY_RESOURCE_UTILITY:"industrial_area",GEOGRAPHIC_FEATURE:"landmark",SHOPPING_CENTER:"mall",MANUFACTURING_FACILITY:"manufacturing_facility",MARINA:"marina",MARKET:"marketplace",MEDIA_FACILITY:"media_facility",MOUNTAIN_PASS:"mountain_pass",MUSEUM:"museum",NON_GOVERNMENTAL_ORGANIZATION:"ngo_office",CONCERT_HALL:"nightlife",ENTERTAINMENT:"nightlife",NIGHTLIFE:"nightlife",PARK_RECREATION_AREA:"park_and_recreation_area",TRAIL_SYSTEM:"park_and_recreation_area",LEISURE_CENTER:"park_and_recreation_facility",WATER_SPORT:"park_and_recreation_facility",OPEN_PARKING_AREA:"parking_facility",PARKING_GARAGE:"parking_facility",PHARMACY:"pharmacy",POLICE_STATION:"police_station",POST_OFFICE:"post_office",PRISON_CORRECTIONAL_FACILITY:"prison",PROTECTED_AREA:"protected_land",PUB:"pub",LIBRARY:"public_library",PUBLIC_TRANSPORT_STOP:"public_transport_stop",RAILWAY_STATION:"railway_station",CHURCH:"religious_site",GURUDWARA:"religious_site",MOSQUE:"religious_site",PAGODA:"religious_site",PLACE_OF_WORSHIP:"religious_site",SYNAGOG:"religious_site",TEMPLE:"religious_site",RENT_A_CAR_PARKING:"rental_car_parking",RESEARCH_FACILITY:"research_facility",REST_AREA:"rest_and_service_area",RESTAURANT:"restaurant",RESTAURANT_AREA:"restaurant",SCHOOL:"school_or_kindergarten",SHOP:"shop_or_store",ADVENTURE_SPORTS_FACILITY:"sport_facility",SPORTS_CENTER:"sport_facility",TENNIS_COURT:"sport_facility",STADIUM:"stadium",SUPERMARKETS_HYPERMARKETS:"supermarket",SWIMMING_POOL:"swimming_pool",TAXI_STAND:"taxi_stand",OPERA_HOUSE:"theater",THEATER:"theater",TOLL_GATE:"toll_booth",TOURIST_ATTRACTION:"tourist_attraction",TOURIST_INFORMATION_OFFICE:"tourist_information",TRUCK_STOP:"truck_stop",AUTOMOTIVE_DEALER:"vehicle_dealer",MOTORING_ORGANIZATION_OFFICE:"vehicle_inspection",TRAFFIC_CONTROL_DEPARTMENT:"vehicle_inspection",TRANSPORT_AUTHORITY_VEHICLE_REGISTRATION:"vehicle_inspection",REPAIR_FACILITY:"vehicle_repair",CAR_WASH:"vehicle_wash",VETERINARIAN:"veterinary",HILL:"viewpoint",MOUNTAIN_PEAK:"viewpoint",SCENIC_PANORAMIC_VIEW:"viewpoint",WEIGH_STATION:"weighbridge",AQUATIC_ZOO:"zoo_or_aquarium",ARBORETA_BOTANICAL_GARDENS:"zoo_or_aquarium",ZOOS_ARBORETA_BOTANICAL_GARDEN:"zoo_or_aquarium"},Me={...Ne,AIRFIELD:"airport",AIRLINE_ACCESS:"airport",PRIVATE_AIRPORT:"airport",PUBLIC_AIRPORT:"airport",ANIMAL_SHELTER:"animal_shelter",DIVERSIFIED_FINANCIALS:"bank",COCKTAIL_BAR:"bar",BEACH_CLUB:"beach_resort",SECURED_ENTRANCE:"border_control",INTERNET_CAFE:"cafe",CAFETERIA:"cafeteria",CARAVAN_SITE:"camping_ground",RECREATIONAL_CAMPING_GROUND:"camping_ground",REST_CAMP:"camping_ground",MAUSOLEUM_GRAVE:"cemetery",CHILD_CARE_FACILITY:"childcare",PRE_SCHOOL:"childcare",DRIVE_IN_MOVIES:"cinema",CHILDRENS_CLOTHES:"clothing_shop",MENS_CLOTHING:"clothing_shop",SPECIALTY_CLOTHING_SHOP:"clothing_shop",WOMENS_CLOTHING:"clothing_shop",JUNIOR_COLLEGE_COMMUNITY_COLLEGE:"college_or_university",COMEDY_CLUB:"comedy_club",ADVERTISING_COMPANY:"commercial_area",AGRICULTURAL_TECHNOLOGY:"commercial_area",AIRLINE_COMPANY:"commercial_area",APARTMENT_RENTAL:"commercial_area",AUTOMOBILE_COMPANY:"commercial_area",BUILDING:"commercial_area",BUSINESS_SERVICES:"commercial_area",BUS_CHARTER_COMPANY:"commercial_area",CABLE_TELEPHONE_COMPANY:"commercial_area",CLEANING_SERVICES:"commercial_area",COMPUTER_DATA_SERVICES:"commercial_area",CONSTRUCTION_COMPANY:"commercial_area",DELIVERY_SERVICE:"commercial_area",ELECTRONICS_COMPANY:"commercial_area",EQUIPMENT_RENTAL:"commercial_area",FARM:"commercial_area",FLATS_APARTMENT_COMPLEX:"commercial_area",HORTICULTURE:"commercial_area",IMPORT_EXPORT_AND_DISTRIBUTION:"commercial_area",INSURANCE_COMPANY:"commercial_area",INVESTMENT_ADVISOR:"commercial_area",LEGAL_SERVICES:"commercial_area",MINING_COMPANY:"commercial_area",MOVING_STORAGE_COMPANY:"commercial_area",OIL_NATURAL_GAS:"commercial_area",PHARMACEUTICAL_COMPANY:"commercial_area",PRIMARY_PRODUCER:"commercial_area",PUBLISHING_TECHNOLOGIES:"commercial_area",REAL_ESTATE_AGENT:"commercial_area",REAL_ESTATE_COMPANY:"commercial_area",RETIREMENT_COMMUNITY:"commercial_area",SERVICE_COMPANY:"commercial_area",SOFTWARE_COMPANY:"commercial_area",TAX_SERVICES:"commercial_area",TELECOMMUNICATIONS:"commercial_area",TRANSPORT_COMPANY:"commercial_area",TRAVEL_AGENT:"commercial_area",WEDDING_SERVICES:"commercial_area",PUBLIC_CALL_BOX:"consumer_service",PUBLIC_TOILET:"consumer_service",GENERAL_PRACTITIONER:"doctor",SPECIALIST:"doctor",AMBULANCE_UNIT:"emergency_ward_entrance",ROAD_RESCUE:"emergency_ward_entrance",MICROBREWERY:"food_and_drinks_shop",BATTLEFIELD:"historic_site",MEMORIAL:"historic_site",BUNGALOW_RENTAL:"holiday_home",CHALET_RENTAL:"holiday_home",COTTAGE_RENTAL:"holiday_home",VILLA_RENTAL:"holiday_home",HORSE_RIDING_CENTER:"horse_riding",BLOOD_BANK:"hospital",HOSPITAL_FOR_WOMEN_AND_CHILDREN:"hospital",HOSPITAL_OF_CHINESE_MEDICINE:"hospital",SPECIAL_HOSPITAL:"hospital",B_B_GUEST_HOUSE:"hotel_or_motel",CABINS_LODGES:"hotel_or_motel",HOSTEL:"hotel_or_motel",HOTEL:"hotel_or_motel",MOTEL:"hotel_or_motel",RESORT:"hotel_or_motel",ICE_CREAM_PARLOR:"ice_cream_shop",ICE_HOCKEY_ARENA:"ice_rink",CHEMICAL_COMPANY:"industrial_area",MECHANICAL_ENGINEERING:"industrial_area",QUARRY:"industrial_area",YOGURT_JUICE_BAR:"juice_bar",ARCH:"landmark",BAY:"landmark",BRIDGE:"landmark",CAPE:"landmark",COVE:"landmark",DAM:"landmark",DUNE:"landmark",ISLAND:"landmark",LOCALE:"landmark",MARSH:"landmark",MONUMENT:"landmark",OASIS:"landmark",OBSERVATORY:"landmark",PARKWAY:"landmark",PLAIN_FLAT:"landmark",PLATEAU:"landmark",RAPIDS:"landmark",REEF:"landmark",RESERVOIR:"landmark",RIVER_CROSSING:"landmark",ROCKS:"landmark",STATUE:"landmark",TOWER:"landmark",TUNNEL:"landmark",VALLEY:"landmark",WATER_HOLE:"landmark",WELL:"landmark",AUTOMOBILE_MANUFACTURING:"manufacturing_facility",MANUFACTURING_COMPANY:"manufacturing_facility",FARMERS_MARKET:"marketplace",FOOD_MARKET:"marketplace",INFORMAL_MARKET:"marketplace",PUBLIC_MARKET:"marketplace",MILITARY_AIRPORT:"military_airfield",FUNERAL_SERVICE_MORTUARIES:"mourning_facility",AMUSEMENT_PLACE:"nightlife",BETTING_STATION:"nightlife",CABARET_THEATER:"nightlife",DISCO_CLUB:"nightlife",FAIRGROUND:"nightlife",JAZZ_CLUB:"nightlife",KARAOKE_CLUB:"nightlife",MUSIC_CENTER:"nightlife",ADVENTURE_VEHICLE_TRAIL:"park_and_recreation_area",FISHING_HUNTING_AREA:"park_and_recreation_area",FOREST_AREA:"park_and_recreation_area",HIKING_TRAIL:"park_and_recreation_area",HISTORICAL_PARK:"park_and_recreation_area",HORSE_RIDING_TRAIL:"park_and_recreation_area",MOUNTAIN_BIKE_TRAIL:"park_and_recreation_area",PARK:"park_and_recreation_area",PICNIC_AREA:"park_and_recreation_area",RECREATION_AREA:"park_and_recreation_area",ROCK_CLIMBING_TRAIL:"park_and_recreation_area",WILDERNESS_AREA:"park_and_recreation_area",OPEN_CAR_PARKING_AREA:"parking_facility",BEAUTY_SALON:"personal_care_service",HAIRDRESSER:"personal_care_service",NAIL_SALON:"personal_care_service",PERSONAL_CARE_FACILITY:"personal_care_service",PERSONAL_SERVICE:"personal_care_service",SAUNA_SOLARIUM_MASSAGE:"personal_care_service",DRUG_STORE:"pharmacy",MARIJUANA_DISPENSARY:"pharmacy",MEDICINAL_MARIJUANA_DISPENSARY:"pharmacy",RECREATIONAL_MARIJUANA_DISPENSARY:"pharmacy",PLANETARIUM:"planetarium",COURIER_DROP_BOX:"post_depot",BUS_LINES:"public_transport_stop",PASSENGER_TRANSPORT_TICKET_OFFICE:"public_transport_stop",STREETCAR_STOP:"public_transport_stop",SUBWAY_STATION:"public_transport_stop",INTERNATIONAL_RAILROAD_STATION:"railway_station",NATIONAL_RAILROAD_STATION:"railway_station",STATION_ACCESS:"railway_station",URBAN_STATION:"railway_station",AFGHAN_RESTAURANT:"restaurant",AFRICAN_RESTAURANT:"restaurant",AMERICAN_RESTAURANT:"restaurant",ARABIAN_RESTAURANT:"restaurant",ARMENIAN_RESTAURANT:"restaurant",ASIAN_RESTAURANT:"restaurant",AUSTRALIAN_RESTAURANT:"restaurant",AUSTRIAN_RESTAURANT:"restaurant",BANQUET_ROOMS:"restaurant",BARBECUE_RESTAURANT:"restaurant",BASQUE_RESTAURANT:"restaurant",BELGIAN_RESTAURANT:"restaurant",BISTRO:"restaurant",BOLIVIAN_RESTAURANT:"restaurant",BRAZILIAN_RESTAURANT:"restaurant",BRITISH_RESTAURANT:"restaurant",BUFFET_RESTAURANT:"restaurant",BULGARIAN_RESTAURANT:"restaurant",BURMESE_RESTAURANT:"restaurant",CALIFORNIAN_RESTAURANT:"restaurant",CAMBODIAN_RESTAURANT:"restaurant",CANADIAN_RESTAURANT:"restaurant",CARIBBEAN_RESTAURANT:"restaurant",CATERING_SERVICES:"restaurant",CHICKEN_RESTAURANT:"restaurant",CHINESE_RESTAURANT:"restaurant",COLOMBIAN_RESTAURANT:"restaurant",CORSICAN_RESTAURANT:"restaurant",CREOLE_RESTAURANT:"restaurant",CREPERIE:"restaurant",CUBAN_RESTAURANT:"restaurant",CZECH_RESTAURANT:"restaurant",DANISH_RESTAURANT:"restaurant",DINNER_THEATER:"restaurant",DONGBEI_RESTAURANT:"restaurant",DOUGHNUT_RESTAURANT:"restaurant",DUTCH_RESTAURANT:"restaurant",EGYPTIAN_RESTAURANT:"restaurant",ENGLISH_RESTAURANT:"restaurant",ETHIOPIAN_RESTAURANT:"restaurant",FINNISH_RESTAURANT:"restaurant",FONDUE_RESTAURANT:"restaurant",FRENCH_RESTAURANT:"restaurant",FUSION_RESTAURANT:"restaurant",GERMAN_RESTAURANT:"restaurant",GREEK_RESTAURANT:"restaurant",GRILL_RESTAURANT:"restaurant",HAMBURGER_RESTAURANT:"restaurant",HAWAIIAN_RESTAURANT:"restaurant",HOT_POT_RESTAURANT:"restaurant",HUNAN_RESTAURANT:"restaurant",HUNGARIAN_RESTAURANT:"restaurant",INDIAN_RESTAURANT:"restaurant",INDONESIAN_RESTAURANT:"restaurant",INTERNATIONAL_RESTAURANT:"restaurant",IRANIAN_RESTAURANT:"restaurant",IRISH_RESTAURANT:"restaurant",ISRAELI_RESTAURANT:"restaurant",ITALIAN_RESTAURANT:"restaurant",JAMAICAN_RESTAURANT:"restaurant",JAPANESE_RESTAURANT:"restaurant",JEWISH_RESTAURANT:"restaurant",KOREAN_RESTAURANT:"restaurant",KOSHER_RESTAURANT:"restaurant",LATIN_AMERICAN_RESTAURANT:"restaurant",LEBANESE_RESTAURANT:"restaurant",MEDITERRANEAN_RESTAURANT:"restaurant",MEXICAN_RESTAURANT:"restaurant",MIDDLE_EASTERN_RESTAURANT:"restaurant",MONGOLIAN_RESTAURANT:"restaurant",MOROCCAN_RESTAURANT:"restaurant",NEPALESE_RESTAURANT:"restaurant",NORWEGIAN_RESTAURANT:"restaurant",ORGANIC_FOOD_RESTAURANT:"restaurant",ORIENTAL_RESTAURANT:"restaurant",PAKISTANI_RESTAURANT:"restaurant",PERUVIAN_RESTAURANT:"restaurant",PHILIPPINE_RESTAURANT:"restaurant",PIZZERIA:"restaurant",POLISH_RESTAURANT:"restaurant",POLYNESIAN_RESTAURANT:"restaurant",PORTUGUESE_RESTAURANT:"restaurant",PUB_FOOD:"restaurant",RUSSIAN_RESTAURANT:"restaurant",SALAD_BAR:"restaurant",SANDWICH_RESTAURANT:"restaurant",SCANDINAVIAN_RESTAURANT:"restaurant",SEAFOOD:"restaurant",SHANDONG_RESTAURANT:"restaurant",SICHUAN_RESTAURANT:"restaurant",SNACKS_RESTAURANT:"restaurant",SOUL_FOOD:"restaurant",SOUP_RESTAURANT:"restaurant",SPANISH_RESTAURANT:"restaurant",STEAK_HOUSE:"restaurant",SUSHI_RESTAURANT:"restaurant",SWEDISH_RESTAURANT:"restaurant",SWISS_RESTAURANT:"restaurant",SYRIAN_RESTAURANT:"restaurant",TAIWANESE_RESTAURANT:"restaurant",TAKEOUT_FOOD:"restaurant",TAPAS_RESTAURANT:"restaurant",TEPPANYAKI_RESTAURANT:"restaurant",THAI_RESTAURANT:"restaurant",TIBETAN_RESTAURANT:"restaurant",TUNISIAN_RESTAURANT:"restaurant",TURKISH_RESTAURANT:"restaurant",VEGETARIAN_RESTAURANT:"restaurant",VENEZUELAN_RESTAURANT:"restaurant",VIETNAMESE_RESTAURANT:"restaurant",WESTERN_RESTAURANT:"restaurant",ART_SCHOOL:"school_or_kindergarten",DANCE_STUDIO_SCHOOL:"school_or_kindergarten",DRIVING_SCHOOL:"school_or_kindergarten",HIGH_SCHOOL:"school_or_kindergarten",LANGUAGE_SCHOOL:"school_or_kindergarten",MIDDLE_SCHOOL:"school_or_kindergarten",PRIMARY_SCHOOL:"school_or_kindergarten",SENIOR_HIGH_SCHOOL:"school_or_kindergarten",VOCATIONAL_SCHOOL:"school_or_kindergarten",AGRICULTURAL_SUPPLIES:"shop_or_store",ANTIQUE_ART_SHOP:"shop_or_store",BAGS_LEATHERWEAR:"shop_or_store",BAKERY:"shop_or_store",BEAUTY_SUPPLIES:"shop_or_store",BOATING_EQUIPMENT_ACCESSORIES:"shop_or_store",BOOK_SHOP:"shop_or_store",BUTCHER:"shop_or_store",CAMERAS_PHOTOGRAPHY:"shop_or_store",CARPET_FLOOR_COVERINGS:"shop_or_store",CHRISTMAS_HOLIDAY_SHOP:"shop_or_store",COMPUTER_COMPUTER_SUPPLIES:"shop_or_store",CONSTRUCTION_MATERIAL_EQUIPMENT:"shop_or_store",CONSUMER_ELECTRONICS:"shop_or_store",CONVENIENCE_STORE:"shop_or_store",CURTAINS_TEXTILES:"shop_or_store",C_DS_DVD_VIDEOS:"shop_or_store",DELICATESSEN:"shop_or_store",DO_IT_YOURSELF_CENTERS:"shop_or_store",DRIVE_THROUGH_BOTTLE_SHOP:"shop_or_store",DRY_CLEANER:"shop_or_store",ELECTRICAL_APPLIANCES_SHOP:"shop_or_store",FACTORY_OUTLET:"shop_or_store",FISHMONGER:"shop_or_store",FLORISTS:"shop_or_store",FOOTWEAR_SHOE_REPAIRS:"shop_or_store",FURNITURE_HOME_FURNISHINGS:"shop_or_store",GARDEN_CENTERS_SERVICES:"shop_or_store",GIFTS_CARDS_NOVELTIES_SOUVENIRS:"shop_or_store",GLASSWARE_CERAMIC_SHOP:"shop_or_store",GLASS_WINDOWS_STORE:"shop_or_store",GREENGROCER:"shop_or_store",GROCERY_STORE:"shop_or_store",HARDWARE_STORE:"shop_or_store",HOBBY_SHOP:"shop_or_store",HOUSE_GARDEN_FURNITURE_FITTINGS:"shop_or_store",JEWELRY_CLOCKS_WATCHES:"shop_or_store",KITCHENS_BATHROOMS:"shop_or_store",LAUNDRY:"shop_or_store",LIGHTING_SHOPS:"shop_or_store",LOCAL_SPECIALITIES_SHOP:"shop_or_store",LOTTERY_SHOP:"shop_or_store",MEDICAL_SUPPLIES_EQUIPMENT:"shop_or_store",MOBILE_PHONE_SHOP:"shop_or_store",MUSIC_INSTRUMENTS_STORE:"shop_or_store",NEWSAGENTS_TOBACCONISTS:"shop_or_store",OFFICE_EQUIPMENT:"shop_or_store",OPTICIAN:"shop_or_store",OTHER_FOOD_SHOPS:"shop_or_store",PAINTING_DECORATING:"shop_or_store",PAWN_SHOP:"shop_or_store",PET_SUPPLIES:"shop_or_store",PHOTOCOPY_SHOP:"shop_or_store",PHOTO_LAB_DEVELOPMENT:"shop_or_store",RECYCLING_SHOP:"shop_or_store",RETAIL_OUTLET:"shop_or_store",SECURITY_PRODUCTS:"shop_or_store",SHOPPING_SERVICE:"shop_or_store",SPECIALTY_FOODS:"shop_or_store",SPORTS_EQUIPMENT_CLOTHING:"shop_or_store",TAILOR_SHOP:"shop_or_store",TOYS_GAMES_SHOP:"shop_or_store",VARIETY_STORE:"shop_or_store",VIDEO_RENTAL_SHOP:"shop_or_store",WHOLESALE_CLUB:"shop_or_store",WINE_SPIRITS:"shop_or_store",ATHLETICS_TRACK:"sport_facility",BASEBALL_PARK:"sport_facility",BASKETBALL_ARENA:"sport_facility",BOWLING_CENTER:"sport_facility",CRICKET_GROUND:"sport_facility",HOCKEY_CLUB:"sport_facility",HORSE_RACING_TRACK:"sport_facility",RACE_TRACK:"sport_facility",RUGBY_GROUND:"sport_facility",SNOOKER_POOL_BILLIARD:"sport_facility",THEMATIC_SPORT_CENTER:"sport_facility",FOOTBALL_STADIUM:"stadium",MOTOR_RACING_STADIUM:"stadium",MULTI_PURPOSE_STADIUM:"stadium",NETBALL_STADIUM:"stadium",SOCCER_STADIUM:"stadium",STOCK_EXCHANGE:"stock_exchange",TAXI_LIMOUSINE_SHUTTLE_SERVICE:"taxi_stand",TEA_HOUSE:"tea_house",AMPHITHEATER:"theater",CAVE:"tourist_attraction",MINERAL_HOT_SPRINGS:"tourist_attraction",NATURAL_TOURIST_ATTRACTION:"tourist_attraction",BOAT_LAUNCHING_RAMP:"transport_access",HARBOR:"transport_access",YACHT_BASIN:"transport_access",ATV_DEALER:"vehicle_dealer",BOAT_DEALER:"vehicle_dealer",BUS_DEALER:"vehicle_dealer",CAR_DEALER:"vehicle_dealer",MOTORCYCLE_DEALER:"vehicle_dealer",RECREATIONAL_VEHICLE_DEALER:"vehicle_dealer",TRUCK_DEALER:"vehicle_dealer",VAN_DEALER:"vehicle_dealer",ROAD_TRAFFIC_CONTROL_CENTER:"vehicle_inspection",BODYSHOP:"vehicle_repair",CAR_GLASS_REPLACEMENT_SHOP:"vehicle_repair",CAR_REPAIR_AND_SERVICE:"vehicle_repair",HOME_APPLIANCE_REPAIR:"vehicle_repair",MOTORCYCLE_REPAIR:"vehicle_repair",TIRE_SERVICE:"vehicle_repair",TRUCK_REPAIR_AND_SERVICE:"vehicle_repair",ANIMAL_SERVICES:"veterinary",RIDGE:"viewpoint",OTHER_WINTER_SPORT:"winter_sports",SKI_RESORT:"winter_sports",WILDLIFE_PARK:"zoo_or_aquarium",ZOO:"zoo_or_aquarium"},xe=e=>Me[e],De=Array.from(new Set(Object.values(Me))),Fe={bar:"eat_and_drink",cafe:"eat_and_drink",cafeteria:"eat_and_drink",coffee_shop:"eat_and_drink",fast_food:"eat_and_drink",ice_cream_shop:"eat_and_drink",juice_bar:"eat_and_drink",pub:"eat_and_drink",restaurant:"eat_and_drink",tea_house:"eat_and_drink",clothing_shop:"shopping",department_store:"shopping",food_and_drinks_shop:"shopping",mall:"shopping",marketplace:"shopping",shop_or_store:"shopping",supermarket:"shopping",atm:"finance",bank:"finance",foreign_exchange:"finance",gold_exchange:"finance",stock_exchange:"finance",camping_ground:"lodging",holiday_home:"lodging",hotel_or_motel:"lodging",airport:"transport",bus_station:"transport",ferry_terminal:"transport",heliport_or_helipad:"transport",marina:"transport",public_transport_stop:"transport",railway_station:"transport",taxi_stand:"transport",transport_access:"transport",border_control:"driving",car_rental:"driving",charging_location:"driving",fuel_station:"driving",rest_and_service_area:"driving",toll_booth:"driving",truck_stop:"driving",vehicle_dealer:"driving",vehicle_inspection:"driving",vehicle_repair:"driving",vehicle_wash:"driving",weighbridge:"driving",parking_facility:"parking",rental_car_parking:"parking",clinic:"healthcare",dentist:"healthcare",doctor:"healthcare",emergency_ward_entrance:"healthcare",hospital:"healthcare",pharmacy:"healthcare",veterinary:"healthcare",childcare:"education",college_or_university:"education",research_facility:"education",school_or_kindergarten:"education",cultural_center:"cultural",historic_site:"cultural",museum:"cultural",planetarium:"cultural",theater:"cultural",amusement_park:"leisure",beach_resort:"leisure",casino_and_gambling:"leisure",cinema:"leisure",comedy_club:"leisure",nightlife:"leisure",park_and_recreation_facility:"leisure",tourist_attraction:"leisure",tourist_information:"leisure",zoo_or_aquarium:"leisure",fitness_center:"sport",golf_course:"sport",horse_riding:"sport",ice_rink:"sport",sport_facility:"sport",stadium:"sport",swimming_pool:"sport",winter_sports:"sport",aboriginal_land:"outdoor",landmark:"outdoor",mountain_pass:"outdoor",park_and_recreation_area:"outdoor",viewpoint:"outdoor",protected_land:"protected",cemetery:"public",courthouse:"public",fire_station:"public",government_office:"public",police_station:"public",post_depot:"public",post_office:"public",prison:"public",public_library:"public",military_airfield:"military",religious_site:"religion",animal_shelter:"business",commercial_area:"business",conference_center:"business",consumer_service:"business",industrial_area:"business",manufacturing_facility:"business",media_facility:"business",mourning_facility:"business",ngo_office:"business",personal_care_service:"business"},Pe=e=>{const t=xe(e);return t?Fe[t]:void 0},Ue="Noto-Bold",He=.8,ke=["interpolate",["linear"],["zoom"],8,.6,22,He],We="title",Be="iconID",Ve=.7,Ge="default_place",je="poi-parking-micro",ze={"icon-image":["get",Be],"icon-anchor":"bottom","icon-size":ke,"icon-allow-overlap":!0,"icon-padding":0},$e={"icon-translate":[0,5],"icon-translate-anchor":"viewport"},Ye={"text-optional":!0,"text-font":[Ue],"text-field":["get",We],"text-justify":"auto","text-variable-anchor":["top","left","right"],"text-variable-anchor-offset":["top",[0,Ve],"left",[1.4,-1.4],"right",[-1.4,-1.4]],"text-size":["interpolate",["linear"],["zoom"],10,14,18,16],"text-padding":5},qe={"text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"},Ke={type:"symbol",layout:{...ze,...Ye},paint:{...$e,...qe}},Xe=(e,t)=>`${e}-${t}`,Ze=["has","point_count"],Je=["!",Ze],Qe="clusterBaseMapIconIDs",et=["all",Ze,["==",["index-of",",",["get",Qe]],-1]],tt=["all",Ze,[">=",["index-of",",",["get",Qe]],0]],it=[12,-14],rt={[Qe]:(G="baseMapIconID",j=Qe,[["case",["==",["get",j],null],["accumulated"],["==",["accumulated"],null],["get",j],[">=",["index-of",["concat",",",["get",j],","],["concat",",",["accumulated"],","]],0],["accumulated"],["concat",["accumulated"],",",["get",j]]],["get",G]])},st=e=>{const t=["match",e];for(const i of De){const e=`poi-${i}`;t.push(e,["image",e])}return t.push(["image",je]),t},at={type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#3f9cd9","line-width":1.5,"line-dasharray":[2,2],"line-opacity":.9}},ot={type:"symbol",layout:{"symbol-placement":"line-center","text-field":["get","label"],"text-size":12,"text-offset":[0,-1],"text-allow-overlap":!1,"text-ignore-placement":!1,"text-keep-upright":!0},paint:{"text-color":"#1a5f8a","text-halo-color":"#ffffff","text-halo-width":1.5}},nt=(e,t)=>{if(!e)return;const i=(e=>{try{if("string"==typeof e){if(e.includes("<svg")){const t=B(e),i=t.getAttribute("viewBox");if(i){const e=i.split(/\s+/);if(4===e.length)return{width:Number.parseFloat(e[2]),height:Number.parseFloat(e[3])}}const r=t.getAttribute("width"),s=t.getAttribute("height");if(r&&s)return{width:Number.parseFloat(r),height:Number.parseFloat(s)}}return null}return e.complete&&e.naturalWidth>0?{width:e.naturalWidth,height:e.naturalHeight}:null}catch(t){return console.warn("Failed to extract image dimensions:",t),null}})(e);if(!i)return;const r="base-map"===t||"circle-icon"===t,s=r?54:140,a=r?54:120;return{heightScale:i.height/s,widthScale:i.width/a}},lt=e=>Boolean(e&&"availability"in e&&e.availability),ct=e=>"ELECTRIC_VEHICLE_STATION"===e.properties.poi?.categories?.[0]&&lt(e.properties.chargingPark),ht=e=>{const t=e.properties.chargingPark;if(lt(t)){const e=t.availability.chargingPointAvailability,i=e.statusCounts.Available??0;return{availableCount:i,totalCount:e.count,ratio:i/e.count}}},ut=(e,t)=>`${e}/${t}`,dt=e=>ht(e)?.ratio??0,pt=e=>["case",[">=",["get","evAvailabilityRatio"],e?.threshold??0],"green","red"],yt=e=>Math.round(1e4*e)/1e4,ft=(e,t,i,r)=>{const s=void 0!==r;return{top:s?[0,r]:[0,yt(e)],left:s?[r,yt(i)]:[yt(t),yt(i)],right:s?[-r,yt(i)]:[-yt(t),yt(i)]}},gt=(e,t,i,r)=>{const s=(e=>{if(!e)return He;if("number"==typeof e)return e;if(Array.isArray(e)){const t=e.at(-1);if("number"==typeof t)return t}if("object"==typeof e&&"stops"in e){const t=e.stops;if(Array.isArray(t)&&t.length>0){const e=t.at(-1);if(Array.isArray(e)&&"number"==typeof e[1])return e[1]}}return He})(e)/He,a="base-map"===i||"circle-icon"===i;if(a&&void 0!==r)return{"text-offset":[r,r]};const o=1.4*s,n=ft(Ve*s,o,a?0:-o,r),l=["top",n.top,"left",n.left,"right",n.right];if(0===t.size)return{"text-variable-anchor-offset":l};const c=["case"];for(const[h,u]of t.entries()){const e=(a?1.4:Ve)*u.heightScale,t=1.4*u.widthScale,i=ft(e,t,a?0:-t,r);c.push(["==",["get",Be],h],["literal",["top",i.top,"left",i.left,"right",i.right]])}return c.push(["literal",l]),{"text-variable-anchor-offset":c}},mt=(e,t,i,r,s)=>{const a=t?.text,o=t?.layers?.[i],n=s&&s.size>0,l={...e.layout},c=n||void 0!==a?.offset||"circle-icon"===t?.theme;c&&(delete l["text-offset"],delete l["text-variable-anchor-offset"],delete l["text-radial-offset"]);const h={...l,...o?.layout,...a?.size&&{"text-size":a.size},...a?.font&&{"text-font":a.font},...void 0!==r&&{"text-field":r}};if(c){const e=h["icon-size"],i=s??/* @__PURE__ */new Map;return{...h,...gt(e,i,t?.theme,a?.offset)}}return h},_t=(e,t,i,r)=>{const s=t?.text,a=t?.layers?.[i],{textColor:o,haloColor:n}=(e=>({textColor:"dark"===e?"#FFFFFF":"#333333",haloColor:"dark"===e?"#333333":"#FFFFFF"}))(r),l=e.paint??{};return{...l,...void 0===l["text-color"]&&{"text-color":o},...void 0===l["text-halo-color"]&&{"text-halo-color":n},...s?.color&&{"text-color":s.color},...s?.haloColor&&{"text-halo-color":s.haloColor},...s?.haloWidth&&{"text-halo-width":s.haloWidth},...a?.paint}},Lt=["in",["get","eventState"],["literal",["click","contextmenu"]]],At=e=>JSON.parse(JSON.stringify(e)?.replaceAll("name",We)),St=(e,t)=>e.getStyle().layers.find(e=>e.id===t)??{},It=e=>({filter:["!",Lt],type:"symbol",paint:e.paint,layout:e.layout?r(e.layout,"visibility"):void 0}),Et=e=>{const t=It(St(e,"POI")),i=t.layout?.["text-size"];return{...t,layout:{...t.layout,"icon-image":["get",Be],"text-field":["get",We],...i&&{"text-size":At(i)}}}},bt=e=>{const t=It(St(e,"POI - Micro"));return{...t,minzoom:0,layout:{...t.layout,"icon-allow-overlap":!0,"icon-ignore-placement":!0},paint:{...t.paint,"icon-opacity":1}}},Rt=e=>{const t=St(e,"POI").layout??{};return{...Ke,layout:{...Ke.layout,"icon-anchor":"center",...void 0!==t["icon-size"]&&{"icon-size":t["icon-size"]},...void 0!==t["icon-padding"]&&{"icon-padding":t["icon-padding"]}},paint:{...Ke.paint,"icon-translate":[0,0]}}},Tt=["has","eventState"],Ct={type:"symbol",layout:{visibility:"none"}},vt={type:"circle",layout:{visibility:"none"}},wt="#3f9cd9",Ot={...Ke,filter:["!",Tt]},Nt={...Ke,filter:Tt,layout:{...Ke.layout,"icon-size":["interpolate",["linear"],["zoom"],8,.8,22,1],"text-allow-overlap":!0},paint:{...Ke.paint,"text-color":wt}},Mt=e=>({...e,filter:Tt,layout:{...e.layout,"text-allow-overlap":!0},paint:{...e.paint,"text-color":wt}}),xt=(e,t,i,r,s)=>{const a=t?.text,o=t?.layers?.[i],n=!0===t?.evAvailability?.enabled,l=a?.title&&"function"!=typeof a?.title?a.title:n?((e,t)=>t?["case",["has","evAvailabilityText"],["format",["get",We],{},"\n",{},["get","evAvailabilityText"],{"font-scale":1.1,"text-color":pt(e?.evAvailability)}],["get",We]]:["get",We])(t,n):void 0;return{...e,...o,layout:mt(e,t,i,l,s),paint:_t(e,t,i,r)}},Dt=(e,t,i,r)=>{const s=((e,t)=>{const i=/* @__PURE__ */new Map,r=e?.icon?.categoryIcons??[];for(const s of r)if(s.image){const r=nt(s.image,e?.theme);if(void 0!==r){const e=Xe(s.id,t);if(i.set(e,r),s.availabilityLevel){const e=Xe(`${s.id}-${s.availabilityLevel}`,t);i.set(e,r)}}}return i})(e,r);let a,o,n=Ct,l=Ct,c=vt,h=Ct,u=vt,d=Ct;if("base-map"===e?.theme)a={...Et(t),minzoom:10},n=bt(t),o=(e=>Mt(Et(e)))(t);else if("circle-icon"===e?.theme)a=(e=>({...Rt(e),filter:["!",Tt]}))(t),o=(e=>Mt(Rt(e)))(t);else if("pin-clustered"===e?.theme){a={...Ot,filter:["all",Je,["!",Tt]]},o={...Nt,filter:["all",Je,Tt]};const e=bt(t);n={...e,filter:e.filter?["all",Je,e.filter]:Je},l={type:"symbol",filter:et,layout:{"icon-image":st(["get",Qe]),"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}},c={type:"circle",filter:et,paint:{"circle-radius":11,"circle-color":"#000000","circle-stroke-color":"#FFFFFF","circle-stroke-width":1.5,"circle-translate":it,"circle-translate-anchor":"viewport"}},h={type:"symbol",filter:et,layout:{"text-field":["get","point_count_abbreviated"],"text-font":[Ue],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#FFFFFF","text-translate":it,"text-translate-anchor":"viewport"}},u={type:"circle",filter:tt,paint:{"circle-radius":15,"circle-color":"#000000","circle-stroke-color":"#FFFFFF","circle-stroke-width":1.5}},d={type:"symbol",filter:tt,layout:{"text-field":["get","point_count_abbreviated"],"text-font":[Ue],"text-size":12,"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"text-color":"#FFFFFF"}}}else a=Ot,o=Nt;return{micro:{...xt(n,e,"micro",i,s),beforeID:Ie.lowestPlaceLabel},main:{...xt(a,e,"main",i,s),beforeID:"selected"},selected:xt(o,e,"selected",i,s),cluster:{...l,...e?.layers?.cluster,beforeID:"clusterBadge"},clusterBadge:{...c,...e?.layers?.clusterBadge,beforeID:"clusterCount"},clusterCount:{...h,...e?.layers?.clusterCount,beforeID:"clusterMixedBadge"},clusterMixedBadge:{...u,...e?.layers?.clusterMixedBadge,beforeID:"clusterMixedCount"},clusterMixedCount:{...d,...e?.layers?.clusterMixedCount},...e?.layers?.additional}},Ft=e=>{if(k())return W(V(e))},Pt=(e,t)=>"string"!=typeof e?e:t.features.find(t=>t.id===e),Ut=new Set([7339002,8099002,7369004,7321003,7376006,9362003,9362004,9160004,9376007,7315015,9376006,9376002,7315078,7315149,9376005,7372003,9352045,9352032,9361048,9902003,9378005,7383004,9910004,7320002,9362016,7320003,9362025,9942002,9942003,7380005,9663003,9361021,9379009,9379004,7315147,9376003,9160002,9160003,9352008,9361006,7389004,9910006]),Ht=e=>e.properties.poi?.name??e.properties.address.freeformAddress,kt=(e,t,i)=>{if("pin"===t||"pin-clustered"===t)return(e=>{if(e)return Ut.has(e)?e.toString():e.toString().substring(0,4)})(A[e])??i;{const t=xe(e);return t?`poi-${t}`:i}},Wt=(e,t,i={})=>{const r=i.theme??"pin",s=((e,t)=>e.icon?.default||"base-map"!==(e.theme??"pin")?Xe(Ge,t):je)(i,t),a=i.icon?.mapping;if(a)return"imageID"===a.to?a.fn(e):kt(a.fn(e),r,s);const o=e.properties.poi?.categories?.[0],n=((e,t,i,r,s)=>{if(!r.evAvailability?.enabled||!ct(e))return;const a=dt(e)>=(r.evAvailability.threshold??.3)?"available":"occupied",o=r.icon?.categoryIcons&&r.icon.categoryIcons.length>0,n=r.icon?.categoryIcons?.find(e=>e.id===t&&e.availabilityLevel===a);return n?Xe(`${n.id}-${a}`,i):o||"pin"!==s?void 0:`7309-${a}`})(e,o,t,i,r);if(n)return n;const l=i.icon?.categoryIcons?.find(e=>e.id===o);return l?Xe(l.id,t):kt(o,r,s)},Bt=(e,t)=>{const i=t?.icon?.mapping;return"poiCategory"===i?.to?i.fn(e):e.properties.poi?.categories?.[0]},Vt=(e,t)=>{const i=Bt(e,t);return i&&xe(i)},Gt=(e,t)=>{const i=Bt(e,t);return i&&Pe(i)},jt=e=>Array.isArray(e)?{type:"FeatureCollection",features:e}:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:e,zt=(e,t,i)=>{if(!0!==t?.enabled)return e;let r=!1,s=!1;for(const a of i.features)if("ELECTRIC_VEHICLE_STATION"===a.properties.poi?.categories?.[0]&&(r=!0,ct(a))){s=!0;break}return r&&!s&&console.warn("PlacesModule: evAvailability is enabled but no availability data found. Did you call getPlacesWithEVAvailability()?"),{...e,evAvailabilityText:e=>ct(e)?((e,t)=>{const i=ht(e);return i?(t?.formatText??ut)(i.availableCount,i.totalCount):""})(e,t):"",evAvailabilityRatio:e=>ct(e)?dt(e):0}},$t=(e,t)=>{const i=Vt(e,t);return i?`poi-${i}`:je},Yt=(e,t,i={})=>{const r=jt(e),s=!0===i.evAvailability?.enabled?zt(i.extraFeatureProps,i.evAvailability,r):i.extraFeatureProps;return{...r,features:r.features.map(e=>{const r="function"==typeof i?.text?.title?i?.text?.title(e):Ht(e),a=s?Object.fromEntries(Object.entries(s).map(([t,i])=>[t,"function"==typeof i?i(e):i])):{},o=e.id??p();return{...e,id:o,geometry:{...e.geometry,bbox:e.bbox},properties:{...e.properties,id:o,title:r,iconID:Wt(e,t,i),...("base-map"===i?.theme||"pin-clustered"===i?.theme)&&{category:Vt(e,i),group:Gt(e,i)},..."pin-clustered"===i?.theme&&{baseMapIconID:$t(e,i)},...a}}})}},qt=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.currentClusterMode=!1,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){t||(this.sourceID=`places-${this.instanceIndex}`,this.unclusteredSourceID=`places-${this.instanceIndex}-unclustered`,this.connectionSourceID=`places-connections-${this.instanceIndex}`,this.layerIDPrefix=this.sourceID,this.defaultPlaceIconID=Xe(Ge,this.instanceIndex),this.shownConnections=[]),this.layerSpecs=this.buildLayerSpecs(e);const i=this.buildClusterOptions(e);this.currentClusterMode=!0===i?.cluster;const r=this.partitionSpecsForSources(this.layerSpecs),s=new te(this.mapLibreMap,this.sourceID,r.clusteredSpecs,!1,i);let a;r.unclusteredSpecs.length>0&&(a=new te(this.mapLibreMap,this.unclusteredSourceID,r.unclusteredSpecs,!1)),ne([...s._layerSpecs,...a?._layerSpecs??[]],this.mapLibreMap),this.connectionLayerSpecs=this.buildConnectionLayerSpecs(e);const o=new te(this.mapLibreMap,this.connectionSourceID,Object.values(this.connectionLayerSpecs),!1);return ne(o._layerSpecs,this.mapLibreMap),a?{places:s,placesUnclustered:a,connections:o}:{places:s,connections:o}}partitionSpecsForSources(e){if(!this.currentClusterMode)return{clusteredSpecs:Object.values(e),unclusteredSpecs:[]};const t=[],i=[];for(const[r,s]of Object.entries(e))"micro"===r?t.push(s):i.push(s);return{clusteredSpecs:i,unclusteredSpecs:t}}buildLayerSpecs(e){const t=Dt(e,this.tomtomMap.mapLibreMap,this.tomtomMap.styleLightDarkTheme,this.instanceIndex),i=new Set(Object.keys(t));return Object.fromEntries(Object.entries(t).map(([e,t])=>{const r=t.beforeID;return[e,{...t,id:`${this.layerIDPrefix}-${e}`,...r&&i.has(r)?{beforeID:`${this.layerIDPrefix}-${r}`}:{}}]}))}buildClusterOptions(e){if("pin-clustered"===e?.theme)return{cluster:!0,clusterRadius:60,clusterProperties:rt}}buildConnectionLayerSpecs(e){const t=(e=>{const t=e?.layers?.line,i=e?.layers?.label;return{line:{...at,...t,layout:{...at.layout,...t?.layout},paint:{...at.paint,...t?.paint}},label:{...ot,...i,layout:{...ot.layout,...i?.layout},paint:{...ot.paint,...i?.paint}}}})(e?.connections),i=`${this.layerIDPrefix}-connection-line`,r=`${this.layerIDPrefix}-connection-label`,s=Ie.lowestLabel;return{line:{...t.line,id:i,beforeID:s},label:{...t.label,id:r,beforeID:s}}}_applyConfig(e){return this.updateLayersAndData(e),e}restoreDataAndConfigImpl(){const e=this.sourcesWithLayers.places.shownFeatures,t=this.shownConnections;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),this.show(e),t.length&&this.showConnections(t)}applyTheme(e){this.applyConfigPart({theme:e})}applyIconConfig(e){this.applyConfigPart({icon:e})}applyTextConfig(e){this.applyConfigPart({text:e})}applyConfigPart(e){const t={...this.config,...e};this.updateLayersAndData(t),this.config=t,this.emitConfigChange()}applyExtraFeatureProps(e){const t={...this.config,extraFeatureProps:e};this.updateData(t),this.config=t,this.emitConfigChange()}updateLayersAndData(e){if(this.setupImages(e),!0===this.buildClusterOptions(e)?.cluster!==this.currentClusterMode)return void this.rebuildSourcesAndLayers(e);const t=this.buildLayerSpecs(e),i=this.currentClusterMode?this.partitionSpecsForSources(t):{clusteredSpecs:Object.values(t),unclusteredSpecs:[]},r=this.currentClusterMode?this.partitionSpecsForSources(this.layerSpecs):{clusteredSpecs:Object.values(this.layerSpecs),unclusteredSpecs:[]};oe(i.clusteredSpecs,r.clusteredSpecs,this.sourcesWithLayers.places,this.mapLibreMap),this.sourcesWithLayers.placesUnclustered&&i.unclusteredSpecs.length>0&&oe(i.unclusteredSpecs,r.unclusteredSpecs,this.sourcesWithLayers.placesUnclustered,this.mapLibreMap),this.layerSpecs=t,this.applyPlacesVisibility(),this.updateData(e),this.updateConnectionLayersAndData(e)}rebuildSourcesAndLayers(e){const t=this.sourcesWithLayers.places.shownFeatures,i=this.shownConnections;for(const s of Object.values(this.layerSpecs))this.mapLibreMap.getLayer(s.id)&&this.mapLibreMap.removeLayer(s.id);for(const s of Object.values(this.connectionLayerSpecs))this.mapLibreMap.getLayer(s.id)&&this.mapLibreMap.removeLayer(s.id);this.mapLibreMap.getSource(this.sourceID)&&this.mapLibreMap.removeSource(this.sourceID),this.mapLibreMap.getSource(this.unclusteredSourceID)&&this.mapLibreMap.removeSource(this.unclusteredSourceID),this.mapLibreMap.getSource(this.connectionSourceID)&&this.mapLibreMap.removeSource(this.connectionSourceID),this.initSourcesWithLayers(e,!0),this.setupImages(e);const r=Yt(t,this.instanceIndex,e);this.sourcesWithLayers.places.show(r,{automaticVisibility:!1}),this.sourcesWithLayers.placesUnclustered?.show(r,{automaticVisibility:!1}),this.applyPlacesVisibility(),i.length&&(this.shownConnections=[...i],this.updateConnectionsData(e))}updateConnectionLayersAndData(e){const t=this.buildConnectionLayerSpecs(e),i=this.sourcesWithLayers.connections;oe(Object.values(t),Object.values(this.connectionLayerSpecs),i,this.mapLibreMap),this.connectionLayerSpecs=t,this.updateConnectionsData(e)}updateConnectionsData(e){const t=this.sourcesWithLayers.places.shownFeatures;this.sourcesWithLayers.connections.show(((e,t,i={})=>{const r=i.connections?.label,s=[];for(const a of e){const e=Pt(a.from,t),i=Pt(a.to,t);if(!e||!i)continue;const o=a.id??p(),n=r?r(a):"";s.push({type:"Feature",id:o,geometry:{type:"LineString",coordinates:[e.geometry.coordinates,i.geometry.coordinates]},properties:{id:o,fromId:"string"==typeof a.from?a.from:e.id,toId:"string"==typeof a.to?a.to:i.id,label:n}})}return{type:"FeatureCollection",features:s}})(this.shownConnections,t,e))}applyPlacesVisibility(){const e=this.sourcesWithLayers.places.shownFeatures.features.length?"visible":"none";for(const t of Object.values(this.layerSpecs))"none"!==t.layout?.visibility&&this.mapLibreMap.setLayoutProperty(t.id,"visibility",e,{validate:!1})}setupImages(e){if(e?.icon){for(const t of e.icon.categoryIcons??[])he("if-not-in-sprite",Xe(t.availabilityLevel?`${t.id}-${t.availabilityLevel}`:t.id,this.instanceIndex),t.image,this.mapLibreMap,{pixelRatio:t.pixelRatio??2});e.icon.default&&(e.icon.default.image&&he("if-not-in-sprite",this.defaultPlaceIconID,e.icon.default.image.image,this.mapLibreMap,{pixelRatio:e.icon.default.image.pixelRatio??2}),e.icon.default.style&&he("if-not-in-sprite",this.defaultPlaceIconID,Ft(e.icon.default.style),this.mapLibreMap,{pixelRatio:2}))}else he("if-not-in-sprite",this.defaultPlaceIconID,Ft(),this.mapLibreMap,{pixelRatio:2})}updateData(e){const t=Yt(this.sourcesWithLayers.places.shownFeatures,this.instanceIndex,e);this.sourcesWithLayers.places.source.runtimeSource?.setData(t),this.sourcesWithLayers.placesUnclustered?.source.runtimeSource?.setData(t)}async show(e){await this.waitUntilModuleReady(),this.clearConnectionsSync();const t=Yt(e,this.instanceIndex,this.config);this.sourcesWithLayers.places.show(t,{automaticVisibility:!1}),this.sourcesWithLayers.placesUnclustered?.show(t,{automaticVisibility:!1}),this.applyPlacesVisibility();for(const i of this.shownFeaturesHandlers)i(e)}async clear(){await this.waitUntilModuleReady(),this.clearConnectionsSync(),this.sourcesWithLayers.places.clear(),this.sourcesWithLayers.placesUnclustered?.clear()}async showConnections(e){await this.waitUntilModuleReady(),this.shownConnections=[...e],this.updateConnectionsData(this.config)}async clearConnections(){await this.waitUntilModuleReady(),this.clearConnectionsSync()}clearConnectionsSync(){this.shownConnections=[],this.sourcesWithLayers.connections?.clear()}getShown(){return{places:this.sourcesWithLayers.places.shownFeatures,connections:[...this.shownConnections]}}putEventState(e){this.sourcesWithLayers.places.putEventState(e)}cleanEventState(e){this.sourcesWithLayers.places.cleanEventState(e)}cleanEventStates(e){this.sourcesWithLayers.places.cleanEventStates(e)}get events(){return new ye(new we(this.eventsProxy,this.sourcesWithLayers.places,this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}},Kt=e=>{if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Kt(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}},Xt=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,Zt=(e,t)=>{return t?["all",e[(i=t,Kt(i)?"expression":"legacy")],t]:e.expression;var i},Jt=(e,t,i)=>{if(1===i.length){const r="only"===t?"==":"!=";return{expression:[r,["get",e],i[0]],legacy:[r,e,i[0]]}}const r=["in",["get",e],["literal",i]];return"only"===t?{expression:r,legacy:["in",e,...i]}:{expression:["!",r],legacy:["!in",e,...i]}},Qt=(e,t,i)=>Jt(e,t.show,i?t.values.map(i):t.values),ei={FOOD_DRINKS_GROUP:["RESTAURANT","FAST_FOOD","CAFE_PUB","PUB","WINERY","PUB_FOOD","SOUL_FOOD","DELICATESSEN"],SHOPPING_GROUP:["SHOP","SHOPPING_CENTER","CLOTHING_SHOP","MARKET","FOOD_MARKET","SUPERMARKETS_HYPERMARKETS","DEPARTMENT_STORE","CONVENIENCE_STORE","GROCERY_STORE","HARDWARE_STORE","ELECTRICAL_APPLIANCES_SHOP"],TRANSPORTATION_GROUP:["AIRPORT","FERRY_TERMINAL","HELIPAD_HELICOPTER_LANDING","PUBLIC_TRANSPORT_STOP","RAILWAY_STATION","BUS_STOP","TAXI_STAND"],HEALTH_GROUP:["DOCTOR","EMERGENCY_MEDICAL_SERVICE","EMERGENCY_ROOM","HEALTH_CARE_SERVICE","HOSPITAL","PHARMACY","DENTIST","WELFARE_ORGANIZATION"],PARKING_GROUP:["PARKING_GARAGE","OPEN_PARKING_AREA"],HOLIDAY_TOURISM_GROUP:["AMUSEMENT_PARK","BEACH","HOLIDAY_RENTAL","GEOGRAPHIC_FEATURE","TOURIST_ATTRACTION","LEISURE_CENTER","MOUNTAIN_PASS","MOUNTAIN_PEAK","MUSEUM","SCENIC_PANORAMIC_VIEW","TOURIST_INFORMATION_OFFICE"],EV_CHARGING_STATIONS_GROUP:["ELECTRIC_VEHICLE_STATION"],GAS_STATIONS_GROUP:["GAS_STATION"],ACCOMMODATION_GROUP:["CAMPING_GROUND","HOTEL_MOTEL","HOLIDAY_RENTAL"],ENTERTAINMENT_GROUP:["CINEMA","THEATER","MOVIE_THEATER","NIGHTLIFE","CONCERT_HALL","ENTERTAINMENT","CLUB_ASSOCIATION","CASINO"],SPORTS_LEISURE_GROUP:["SPORTS_CENTER","WATER_SPORT","SWIMMING_POOL","GOLF_COURSE","STADIUM","BEACH","ICE_SKATING_RINK","LEISURE_CENTER","MOUNTAIN_PASS","MOUNTAIN_PEAK"],EDUCATION_GROUP:["SCHOOL","COLLEGE_UNIVERSITY","LIBRARY","CULTURAL_CENTER"],GOVERNMENT_GROUP:["GOVERNMENT_OFFICE","COURTHOUSE","EMBASSY","FIRE_STATION_BRIGADE","POLICE_STATION"]},ti=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{id:String(t?.id),name:t?.name,category:t?.category,group:t?.group,priority:t?.priority}}},ii=e=>{const t=[];return e.forEach(e=>{e in ei?t.push(...ei[e].map(xe)):t.push(xe(e))}),[...new Set(t)]},ri=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(Ee);if(!t)throw H(`init ${e.name} with source ID ${Ee}`);const i=new J(this.mapLibreMap,t,e=>Oe.includes(e.id)),r=i.sourceAndLayerIDs.layerIDs[0];return this.mapLibreMap.getLayer(r)&&(this.originalFilter=this.mapLibreMap.getFilter(r)),{poi:i}}_applyConfig(e){return e&&!i(e.visible)?this._setVisible(e.visible,!1):this._initializing||this.isVisible()||this._setVisible(!0,!1),this._filterCategories(e?.filters?.categories,!1),e}isVisible(){return this.sourcesWithLayers.poi.isAnyLayerVisible()}setVisible(e){this._setVisible(e)}_setVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.poi.setLayersVisible(e),t&&(this.config={...this.config,visible:e},this.emitConfigChange())}filterCategories(e){this._filterCategories(e)}_filterCategories(e,t=!0){if(e){if(this.tomtomMap.mapReady){const t=Jt("category",e.show,ii(e.values));this.mapLibreMap.setFilter("POI",Zt(t,this.originalFilter))}t&&(this.config={...this.config,filters:{categories:e}})}else this.categoriesFilter&&(t&&(this.config={...this.config,filters:{categories:{show:"all_except",values:[]}}}),this.tomtomMap.mapReady&&this.mapLibreMap.setFilter("POI",this.originalFilter));this.categoriesFilter=e,t&&this.emitConfigChange()}getShown(){return{poi:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.poi.sourceAndLayerIDs.layerIDs,validate:!1}).map(ti)}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.poi,this.config?.events,ti),new ve(this.configChangeHandlers,[]))}},si={land:{layerIDMatches:["lulc"],layerTypes:["fill"]},borders:{layerIDMatches:["borders"],layerTypes:["line"]},water:{layerIDMatches:["water"],layerTypes:["fill","line"]},buildings2D:{layerIDMatches:["building"],layerTypes:["fill","line"]},buildings3D:{layerIDMatches:["building"],layerTypes:["fill-extrusion"]},houseNumbers:{layerIDMatches:["house number"],layerTypes:["symbol"]},roadLines:{layerIDMatches:["road","tunnel","bridge","surface"],layerTypes:["fill","line"]},roadLabels:{layerIDMatches:["road","tunnel","bridge","surface"],layerTypes:["symbol"]},roadShields:{layerIDMatches:["shield"],layerTypes:["symbol"]},placeLabels:{layerIDMatches:["places"],layerTypes:["symbol"]},smallerTownLabels:{layerIDMatches:["town","village","neighbourhood"],layerTypes:["symbol"]},cityLabels:{layerIDMatches:["city","capital"],layerTypes:["symbol"]},capitalLabels:{layerIDMatches:["capital"],layerTypes:["symbol"]},stateLabels:{layerIDMatches:["state"],layerTypes:["symbol"]},countryLabels:{layerIDMatches:["places - country"],layerTypes:["symbol"]}},ai=(e,t)=>{const i=si[e];return i.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&i.layerTypes.includes(t.type)},oi=e=>t=>(!e||((e,t)=>{const i=t?.mode,r=t?.names;if(i&&r?.length){if("include"===i)return r.some(t=>ai(t,e));if("exclude"===i)return!r.some(t=>ai(t,e))}return!0})(t,e))&&!Oe.includes(t.id),ni=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(t){const i=this.mapLibreMap.getSource(Re);if(!i)throw H(`init ${e.name} with source ID ${Re}`);return{vectorTiles:new J(this.mapLibreMap,i,oi(t?.layerGroupsFilter))}}_applyConfig(e){return e&&!i(e.visible)?this._setVisible(e.visible,void 0,!1):this._initializing||this.isVisible()||this._setVisible(!0,void 0,!1),e?.layerGroupsVisibility&&this._setVisible(e.layerGroupsVisibility.visible,{layerGroups:e.layerGroupsVisibility},!1),this.config||e?{...this.config,...e}:void 0}isVisible(){return this.sourcesWithLayers.vectorTiles.isAnyLayerVisible()}setVisible(e,t){this._setVisible(e,t)}_setVisible(e,t,i=!0){i&&(t?.layerGroups?this.config={...this.config,layerGroupsVisibility:{...t.layerGroups,visible:e}}:(delete this.config?.layerGroupsVisibility,this.config={...this.config,visible:e})),this.tomtomMap.mapReady&&this.sourcesWithLayers.vectorTiles.setLayersVisible(e,t?.layerGroups&&(e=>{const t=e.mode,i=e.names;return"include"===t?e=>i.some(t=>ai(t,e)):"exclude"===t?e=>!i.some(t=>ai(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups)),i&&this.emitConfigChange()}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles,this.config?.events),new ve(this.configChangeHandlers,[]))}},li=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],ci=class e extends pe{static async get(t,i){return await ie(t),hi(i),new e(t,i)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(e,t){const i=e??this.config;t||(this.lastShown={},this.shownFeaturesHandlersBySource=/* @__PURE__ */new Map),this.resolveIDs(i),this.registerImages(i);const r={};for(const s of Object.keys(i.sources)){const e=this.resolvedSourceIDs[s],t=this.resolvedLayerSpecs[s],a=i.sources[s].cluster;r[s]=new te(this.mapLibreMap,e,t,!0,a),this.shownFeaturesHandlersBySource.has(s)||this.shownFeaturesHandlersBySource.set(s,[])}return r}registerImages(e){if(e.images)for(const[t,i]of Object.entries(e.images))this.mapLibreMap.hasImage(t)||this.mapLibreMap.addImage(t,i.image,i.options)}resolveIDs(e){const t={},i={};for(const r of Object.keys(e.sources)){const s=e.sources[r],a=s.sourceID??`custom-geojson-${this.instanceIndex}-${String(r)}`;t[r]=a,i[r]=s.layers.map((e,t)=>({...e,id:e.id??`${a}-layer-${t}`}))}this.resolvedSourceIDs=t,this.resolvedLayerSpecs=i}_applyConfig(e){if(!e)return this.config;const t=this.config,i=t?this.resolvedLayerSpecs:void 0;return this.resolveIDs(e),this.registerImages(e),t&&i&&this.updateLayersForExistingSources(i),void 0!==e.visible&&this.applyVisibility(e.visible),e}updateLayersForExistingSources(e){for(const t of Object.keys(this.resolvedLayerSpecs)){const i=e[t],r=this.resolvedLayerSpecs[t],s=this.sourcesWithLayers[t];if(!i||!s)continue;oe(r,i,s,this.mapLibreMap);const a=[];for(const e of s._layerSpecs)this.mapLibreMap.getLayer(e.id)||a.push(e);a.length>0&&(ne(a,this.mapLibreMap),s.shownFeatures.features.length>0&&s.setLayersVisible(!0))}}applyVisibility(e){for(const t of Object.keys(this.sourcesWithLayers))this.sourcesWithLayers[t].setLayersVisible(e)}restoreDataAndConfigImpl(){const e=Object.keys(this.lastShown);this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config);for(const t of e){const e=this.lastShown[t];e&&this.showOnSource(t,e)}}async show(e,t){if(await this.waitUntilModuleReady(),void 0!==t)this.showOnSource(t,e);else for(const i of Object.keys(this.sourcesWithLayers))this.showOnSource(i,e)}showOnSource(e,t){const i=ui(t);this.lastShown[e]=i,this.sourcesWithLayers[e].show(i);const r=this.shownFeaturesHandlersBySource.get(e);if(r)for(const s of r)s(i)}async clear(e){if(await this.waitUntilModuleReady(),void 0!==e)return this.sourcesWithLayers[e].clear(),void delete this.lastShown[e];for(const t of Object.keys(this.sourcesWithLayers))this.sourcesWithLayers[t].clear(),delete this.lastShown[t]}getShown(){const e={};for(const t of Object.keys(this.sourcesWithLayers))e[t]=this.sourcesWithLayers[t].shownFeatures;return e}setVisible(e){this.config={...this.config,visible:e},this.applyVisibility(e),this.emitConfigChange()}get events(){const e={};for(const t of Object.keys(this.sourcesWithLayers)){const i=this.sourcesWithLayers[t],r=this.shownFeaturesHandlersBySource.get(t)??[];e[t]=new ye(new we(this.eventsProxy,i,this.config?.events),new ve(this.configChangeHandlers,r))}return e}},hi=e=>{if(!e.sources||0===Object.keys(e.sources).length)throw new Error("CustomGeoJSONModule requires at least one source in config.sources.");for(const[t,i]of Object.entries(e.sources))if(!i.layers||0===i.layers.length)throw new Error(`CustomGeoJSONModule source "${t}" requires at least one layer.`)},ui=e=>{let t=!1;for(const i of e.features)if(null==i.id||i.properties?.id!==i.id){t=!0;break}return t?{...e,features:e.features.map((e,t)=>{const i=e.id??e.properties?.id??t;return{...e,id:i,properties:{...e.properties,id:i}}})}:e},di="#0A3653",pi="#555555",yi={type:"fill",paint:{"fill-color":["coalesce",["get","color"],di],"fill-opacity":["case",["==",["get","theme"],"outline"],0,.15],"fill-antialias":!1}},fi={type:"line",paint:{"line-color":["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],pi],["coalesce",["get","color"],di]],"line-opacity":["case",["==",["get","theme"],"outline"],.9,1],"line-width":["case",["==",["get","theme"],"outline"],5,2]}},gi=(e,t,r)=>{const s=r?.fill,a=r?.line,o={...yi,id:e,paint:{...yi.paint,...!i(s?.opacity)&&{"fill-opacity":s?.opacity},...s?.color&&{"fill-color":["get","color"]}}},n=a?.layer;return[o,{...fi,...n,id:t,...n?.layout&&{layout:{...fi.layout,...n.layout}},paint:{...fi.paint,...n?.paint,...!i(a?.color)&&{"line-color":a?.color},...!i(a?.width)&&{"line-width":a?.width},...!i(a?.opacity)&&{"line-opacity":a?.opacity}}}]},mi=(e,t)=>{const i=t?.textConfig;return{type:"symbol",id:e,layout:{"text-field":["get","title"],...i?.textField&&{"text-field":i.textField},"text-padding":5,"text-size":15,"text-font":[Ue],"symbol-placement":"point"},paint:{"text-color":"#333333","text-halo-color":"#FFFFFF","text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"}}},_i=(e,t)=>{const r=t?.lineLabelConfig;return{type:"symbol",id:e,minzoom:r?.minZoom??3,layout:{"text-field":["get","title"],"symbol-placement":"line","text-size":r?.textSize??15,"text-font":[Ue],"symbol-spacing":r?.symbolSpacing??200,"text-keep-upright":!0,"text-offset":r?.textOffset??[0,1]},paint:{"text-color":r?.textColor??"#333333","text-halo-color":r?.textHaloColor??"#FFFFFF","text-halo-width":r?.textHaloWidth??2,...!i(r?.textOpacity)&&{"text-opacity":r?.textOpacity}}}},Li={warm:["#793F0D","#AC703D","#C38E63","#E49969","#E5AE86","#EEC5A9","#6E7649","#9D9754","#C7C397","#B4A851","#DFD27C","#E7E3B5","#846D74","#B7A6AD","#D3C9CE"],browns:["#edc4b3","#e6b8a2","#deab90","#d69f7e","#cd9777","#c38e70","#b07d62","#9d6b53","#8a5a44","#774936"],cold:["#344464","#548ca4","#549cac","#2c445c","#a4ccd4","#acbccc","#b4c4d4","#acd4cc","#5c8ca4"],fadedBlues:["#152033","#1d2d44","#2e455d","#3e5c76","#4c6884","#597491","#67809e","#6e86a5","#7b91ad","#879bb4"],blues:["#03045e","#023e8a","#0077b6","#0096c7","#00b4d8","#48cae4","#90e0ef","#ade8f4","#caf0f8"],greens:["#004b23","#006400","#007200","#008000","#38b000","#70e000","#9ef01a","#ccff33"],fadedGreenToBlue:["#d9ed92","#b5e48c","#99d98c","#76c893","#52b69a","#34a0a4","#168aad","#1a759f","#1e6091","#184e77"],blueToRed:["#033270","#1368aa","#4091c9","#9dcee2","#fedfd4","#f29479","#f26a4f","#ef3c2d","#cb1b16","#65010c"],greenToYellow:["#007f5f","#2b9348","#55a630","#80b918","#aacc00","#bfd200","#d4d700","#dddf00","#eeef20","#ffff3f"],pastel:["#fec5bb","#fcd5ce","#fae1dd","#f8edeb","#e8e8e4","#d8e2dc","#ece4db","#ffe5d9","#ffd7ba","#fec89a"],retro:["#f94144","#f3722c","#f8961e","#f9844a","#f9c74f","#90be6d","#43aa8b","#4d908e","#577590","#277da1"],contrastRetro:["#001219","#005f73","#0a9396","#94d2bd","#e9d8a6","#ee9b00","#ca6702","#bb3e03","#ae2012","#9b2226"],fadedRainbow:["#ffadad","#ffd6a5","#fdffb6","#caffbf","#9bf6ff","#a0c4ff","#bdb2ff","#ffc6ff","#fffffc"],pastelRainbow:["#54478c","#2c699a","#048ba8","#0db39e","#16db93","#83e377","#b9e769","#efea5a","#f1c453","#f29e4c"]},Ai=Object.keys(Li),Si=(e,t={})=>({...e,features:e.features.map((e,i)=>{const r=(e.properties??{}).theme??t.theme,s="inverted"===r?(e=>{const t=T(e);return{...e,geometry:t.geometry}})(e):e,a=s.properties??{},o=a.title??((e,t)=>t.textConfig?.textField?t.textConfig.textField:e.properties?.address?.freeformAddress)(s,t),n=a.color??((e,t)=>{const i=e?.fill?.color;if("string"==typeof i&&Li[i]){const e=Li[i];return e[t%e.length]}return i})(t,i);return{...s,properties:{...s.properties,...r&&{theme:r},...o&&{title:o},...n&&{color:n},id:a.id??p()}}})}),Ii=e=>{const t=e.features.map(e=>{let t;if(e.properties?.placeCoordinates)t=e.properties?.placeCoordinates;else if("MultiPolygon"===e.geometry.type){const i=c((e=>e.flat().reduce((e,t)=>t.length>e.length?t:e,[]))(e.geometry.coordinates));t=i&&l(i)||null}else t=e.geometry.coordinates.flat();const i=e.id??e.properties?.id??p();return{type:"Feature",id:i,geometry:{type:"Point",coordinates:t},properties:{...e.properties,id:i}}});return{type:"FeatureCollection",bbox:e.bbox,features:t}},Ei=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.lineLabelLayerSpecs=null,this.lastRawInput=null,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){if(!t){this.sourceID=`geometry-${this.instanceIndex}`,this.titleSourceID=`geometryTitle-${this.instanceIndex}`;const e=`geometry-${this.instanceIndex}`;this.fillLayerID=`${e}_Fill`,this.outlineLayerID=`${e}_Outline`,this.lineLabelLayerID=`${e}_LineLabel`,this.titleLayerID=`${e}_Title`}const[i,r]=gi(this.fillLayerID,this.outlineLayerID,e),s=mi(this.titleLayerID,e);this.titleLayerSpecs=s,this.geometryFillLayerSpecs=i,this.geometryOutlineLayerSpecs=r;const a=void 0===e?.lineLabelConfig?null:_i(this.lineLabelLayerID,e);return this.lineLabelLayerSpecs=a,{geometry:new te(this.mapLibreMap,this.sourceID,[{...i},{...r},...a?[a]:[]]),geometryLabel:new te(this.mapLibreMap,this.titleSourceID,[s])}}_applyConfig(e){return(e?.textConfig||e?.fill||e?.line)&&this.updateLayerAndData(e),(e?.beforeLayerConfig||e?.fill?.beforeLayerConfig||e?.line?.beforeLayerConfig)&&this.applyBeforeLayerConfig(e),e}resolveBeforeID(e){return"top"===e?this.titleLayerID:Ie[e]}moveLayersBefore(e,t){for(const i of e)this.mapLibreMap.moveLayer(i,t)}get fillLayerIDs(){return[this.fillLayerID]}get lineLayerIDs(){return this.lineLabelLayerSpecs?[this.outlineLayerID,this.lineLabelLayerID]:[this.outlineLayerID]}moveBeforeLayer(e){this.config={...this.config,beforeLayerConfig:e},this.applyBeforeLayerConfig(this.config),this.emitConfigChange()}applyBeforeLayerConfig(e){const t=e?.beforeLayerConfig,i=e=>{if(void 0!==t)return"string"==typeof t?t:t[e]??t.all},r=e?.fill?.beforeLayerConfig??i("fill"),s=e?.line?.beforeLayerConfig??i("line");void 0!==r&&this.moveLayersBefore(this.fillLayerIDs,this.resolveBeforeID(r)),void 0!==s&&this.moveLayersBefore(this.lineLayerIDs,this.resolveBeforeID(s))}applyTextConfig(e){const t={...this.config,textConfig:e};this.updateLayerAndData(t),this.sourcesWithLayers.geometryLabel.show(Ii(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t,this.emitConfigChange()}updateLayerAndData(e){const[t,i]=gi(this.fillLayerID,this.outlineLayerID,e),r=mi(this.titleLayerID,e);if(ae(t,this.geometryFillLayerSpecs,this.mapLibreMap),ae(i,this.geometryOutlineLayerSpecs,this.mapLibreMap),ae(r,this.titleLayerSpecs,this.mapLibreMap),this.geometryFillLayerSpecs=t,this.geometryOutlineLayerSpecs=i,this.titleLayerSpecs=r,this.lineLabelLayerSpecs){const t=_i(this.lineLabelLayerID,e);ae(t,this.lineLabelLayerSpecs,this.mapLibreMap),this.lineLabelLayerSpecs=t}}restoreDataAndConfigImpl(){const e=this.lastRawInput;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),e&&this.show(e)}async show(e){await this.waitUntilModuleReady(),this.lastRawInput=e;const{transformFeaturesForDisplay:t}=this.config??{},i=t?t(e):e,r=this.sourcesWithLayers.geometry;r.show(Si(i,this.config)),this.sourcesWithLayers.geometryLabel.show(Ii(r.shownFeatures));for(const s of this.shownFeaturesHandlers)s(e)}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.geometry.clear(),this.sourcesWithLayers.geometryLabel.clear()}getShown(){return{geometry:this.sourcesWithLayers.geometry.shownFeatures,geometryLabel:this.sourcesWithLayers.geometryLabel.shownFeatures}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry,this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}},bi={timeMinutes:"min",distanceKM:"km",remainingChargeCPT:"% remaining",spentChargePCT:"% spent",spentFuelLiters:"L"},Ri=(e,t,i="filled")=>{const r=e.map((e,r)=>({...e,properties:{...e.properties,title:t[r],theme:i}}));return"inverted"===i?(e=>[...e.map((t,i)=>{const r=0===i?T(t):E(b([e[i-1],t])),{title:s,theme:a,...o}=t.properties??{};return{...t,geometry:r?.geometry??t.geometry,properties:o}}),...e.map(e=>({...e,id:void 0,properties:{...e.properties,theme:"filled"}}))])(r):r},Ti=(e,t="filled",i)=>{const r=e.features,s=r.map((e,t)=>{if(i)return i(e,t);const r=e.properties?.budget;return void 0!==r?.value&&r?.type?`${r.value} ${bi[r.type]??r.type}`:String(t+1)});return{type:"FeatureCollection",...e.bbox&&{bbox:e.bbox},features:Ri(r,s,t)}},Ci=(e="fadedRainbow",t="lowestLabel")=>({beforeLayerConfig:t,line:{width:["case",["==",["get","theme"],"outline"],5,1],color:["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],pi],"grey"],opacity:["case",["==",["get","theme"],"outline"],.9,1]},fill:{color:e,opacity:["case",["==",["get","theme"],"outline"],0,.6]},lineLabelConfig:{}}),vi=(e="fadedRainbow",t,i,r)=>{const s=Ci(e,i),a=e=>Ti(e,t,r);return"inverted"!==t?{...s,transformFeaturesForDisplay:a}:{...s,line:{...s.line,opacity:["case",["==",["get","theme"],"filled"],1,0]},fill:{...s.fill,opacity:["case",["==",["get","theme"],"filled"],0,.6]},lineLabelConfig:{textOpacity:["case",["==",["get","theme"],"filled"],1,0],textOffset:["case",["==",["get","theme"],"filled"],["literal",[0,-1]],["literal",[0,1]]]},transformFeaturesForDisplay:a}},wi=["filled","outline","inverted"],Oi=class e extends pe{static async get(t,i){return await ie(t),await ce(t,be,"hillshade"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(be);if(!t)throw H(`init ${e.name} with source ID ${be}`);return{hillshade:new J(this.mapLibreMap,t)}}_applyConfig(e){return this._setVisible(e?.visible??!1,!1),e}setVisible(e){this._setVisible(e)}_setVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.hillshade.setLayersVisible(e),t&&(this.config={...this.config,visible:e},this.emitConfigChange())}isVisible(){return this.sourcesWithLayers.hillshade.isAnyLayerVisible()}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hillshade,this.config?.events),new ve(this.configChangeHandlers,[]))}},Ni=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],Mi=["trafficIncidents","trafficFlow","hillshade"],xi=(e,t,i)=>Math.min(Math.max(t,e),i),Di=e=>!e.some(Number.isNaN),Fi=e=>Number.parseInt(e.padEnd(2,e),16)/255,Pi=(e,t)=>xi(t?e/100:e,0,1),Ui=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,Hi=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,ki=e=>{const t=Hi.exec(e);if(!t)return;const[,i,r,s,a,o,n,l,c]=t,h=[r||" ",a||" ",n].join("");if(" "!==h&&" /"!==h&&",,"!==h&&",,,"!==h)return;const u=[+i,xi(+s,0,100),xi(+o,0,100),l?Pi(+l,c):1];return Di(u)?(([e,t,i,r])=>{const s=(e=>{const t=e%360;return t<0?t+360:t})(e),a=t/100,o=i/100,n=e=>{const t=(e+s/30)%12;return o-a*Math.min(o,1-o)*Math.max(-1,Math.min(t-3,9-t,1))};return[n(0),n(8),n(4),r]})(u):void 0},Wi=e=>{const t=e.toLowerCase().trim();if("transparent"===t)return[0,0,0,0];const i=Bi[t];if(i){const[e,t,r]=i;return[e/255,t/255,r/255,1]}return t.startsWith("#")?(e=>{if(!/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e))return;const t=e.length<6?1:2;return[Fi(e.slice(1,1+t)),Fi(e.slice(1+t,1+2*t)),Fi(e.slice(1+2*t,1+3*t)),Fi(e.slice(1+3*t)||"ff")]})(t):t.startsWith("rgb")?(e=>{const t=Ui.exec(e);if(!t)return;const[,i,r,s,a,o,n,l,c,h,u,d]=t,p=[s||" ",n||" ",h].join("");if(" "!==p&&" /"!==p&&",,"!==p&&",,,"!==p)return;const y=[r,o,c].join(""),f="%%%"===y?100:""===y?255:0;if(!f)return;const g=[xi(+i/f,0,1),xi(+a/f,0,1),xi(+l/f,0,1),u?Pi(+u,d):1];return Di(g)?g:void 0})(t):ki(t)},Bi={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Vi="#36A8F0",Gi="#105287",ji="#ABAFB3",zi="#3C4956",$i="#727C85",Yi=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],qi=["==",["get","routeState"],"selected"],Ki=["==",["get","routeState"],"deselected"],Xi=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],Zi={s:["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],m:Yi,l:["interpolate",["linear"],["zoom"],1,5,5,6,10,11,18,15]},Ji={s:["interpolate",["linear"],["zoom"],1,4,5,5,10,8,18,11],m:Xi,l:["interpolate",["linear"],["zoom"],1,7,5,9,10,14,18,19]},Qi={s:["interpolate",["linear"],["zoom"],8,.45,22,.6],m:["interpolate",["linear"],["zoom"],8,.6,22,.8],l:["interpolate",["linear"],["zoom"],8,.75,22,1]},er=e=>Zi[e??"m"],tr=e=>Ji[e??"m"],ir=e=>Qi[e??"m"],rr={s:["interpolate",["linear"],["zoom"],1,8,5,9,10,12,18,15],m:["interpolate",["linear"],["zoom"],1,9,5,11,10,15,18,20],l:["interpolate",["linear"],["zoom"],1,12,5,14,10,19,18,24]},sr=e=>rr[e??"m"],ar={s:["interpolate",["linear"],["zoom"],16,8,22,12],m:["interpolate",["linear"],["zoom"],16,12,22,17],l:["interpolate",["linear"],["zoom"],16,17,22,24]},or={s:["interpolate",["linear"],["zoom"],16,10,22,14],m:["interpolate",["linear"],["zoom"],16,14,22,20],l:["interpolate",["linear"],["zoom"],16,20,22,28]},nr=e=>ar[e??"m"],lr=e=>or[e??"m"],cr="#AD0000",hr="#FB2D09",ur="#FFC105",dr="#f58240",pr="#000000",yr="#C7D2D8",fr="rgba(190, 39, 27, 1)",gr="rgba(137, 150, 168, 1)",mr=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],_r=e=>({...Ke,filter:qi,minzoom:4,layout:{...Ke.layout,"text-field":mr(e?.text)},paint:{...Ke.paint}}),Lr={filter:qi,minzoom:16},Ar={"line-cap":"round"},Sr=e=>({...Lr,type:"line",layout:Ar,paint:{"line-width":lr(e),"line-color":"grey"}}),Ir=e=>({...Lr,type:"line",layout:Ar,paint:{"line-width":nr(e),"line-color":"white"}}),Er="instruction-arrow",br={...Lr,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":Er,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Rr=e=>({filter:qi,type:"line",layout:{"line-join":"round"},paint:{"line-width":er(e),"line-color":"#6dc4ed"}}),Tr={filter:qi,type:"symbol",minzoom:6,maxzoom:16.5,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-image":"poi-ferry_terminal","icon-size":["interpolate",["linear"],["zoom"],6,.8,16.5,1],"icon-ignore-placement":!0}},Cr={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},vr=e=>({...Cr,filter:Ki,paint:{"line-color":zi,"line-width":tr(e)}}),wr=e=>({...Cr,filter:Ki,paint:{"line-color":ji,"line-width":er(e)}}),Or=(e,t)=>({...Cr,filter:qi,paint:{"line-color":t??"#105287","line-width":tr(e)}}),Nr=(e,t)=>({...Cr,filter:qi,paint:{"line-color":t??"#36A8F0","line-width":er(e)}}),Mr={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},xr="selected-route-summary-popup",Dr="deselected-route-summary-popup",Fr=e=>({filter:qi,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":sr(e),"line-color":"#BEBFFA"}}),Pr={filter:qi,type:"symbol",minzoom:4,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-image":"poi-toll_plaza","icon-size":["interpolate",["linear"],["zoom"],4,.8,16.5,1]}},Ur=["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],Hr=["match",["get","magnitudeOfDelay"],"unknown",fr,gr],kr=["match",["get","magnitudeOfDelay"],"minor",dr,"moderate",hr,"major",cr,"indefinite","#666666",pr],Wr=e=>({type:"line",layout:{"line-cap":"round"},paint:{"line-width":er(e),"line-color":["match",["get","magnitudeOfDelay"],"minor",ur,"moderate",hr,"major",cr,yr]}}),Br=e=>({type:"line",filter:Ur,layout:{"line-join":"round"},paint:{"line-width":er(e),"line-color":Hr,"line-dasharray":[1.5,1]}}),Vr={filter:qi,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},Gr={...Vr,filter:["all",["has","jamIconID"],Vr.filter],layout:{...Vr.layout,"icon-image":["get","jamIconID"],"icon-anchor":"bottom-left","text-anchor":"bottom-left","text-field":["get","title"],"text-font":[Ue],"text-offset":[3.9,-1.4],"text-size":13},paint:{...Vr.paint,"text-color":kr,"text-halo-color":"#FFFFFF","text-halo-width":1}},jr={...Vr,filter:["all",["has","causeIconID"],Vr.filter],layout:{...Vr.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...Vr.paint}},zr=e=>({filter:qi,type:"line",layout:{"line-join":"round"},paint:{"line-width":er(e),"line-color":"#000000","line-opacity":.3}}),$r=e=>({filter:qi,type:"line",layout:{"line-join":"round"},paint:{"line-color":Gi,"line-width":er(e)}}),Yr=e=>({filter:qi,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":Vi,"line-width":er(e),"line-dasharray":[0,1.5]}}),qr="traffic-clear",Kr="traffic-major",Xr="traffic-moderate",Zr="traffic-minor",Jr=["has","formattedTraffic"],Qr=e=>{const t=void 0!==e?Xe(xr,e):xr,i=void 0!==e?Xe(Dr,e):Dr,r=void 0!==e?Xe(qr,e):qr,s=void 0!==e?Xe(Kr,e):Kr,a=void 0!==e?Xe(Xr,e):Xr,o=void 0!==e?Xe(Zr,e):Zr;return{type:"symbol",layout:{"icon-image":["case",qi,t,i],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",qi,0,1],"icon-text-fit":"both","icon-text-fit-padding":[10,5,5,10],"text-font":["Noto-Medium"],"text-size":13,"icon-padding":0,"text-justify":"left","text-line-height":1.5,"text-field":["format",["get","formattedDuration"],{"text-font":["literal",[Ue]],"text-color":["case",qi,"black",$i]},["concat","\t\t",["get","formattedDistance"]],{"text-color":$i},["case",Jr,"\n",""],{},["image",["case",Jr,["match",["get","magnitudeOfDelay"],"major",s,"moderate",a,"minor",o,r],""]],{},["case",Jr,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Ue]],"text-color":kr}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}}},es=Qr(),ts="start",is="middle",rs="finish",ss="indexType",as="stopDisplayIndex",os="waypointStart",ns="waypointStop",ls="waypointSoft",cs="waypointFinish",hs={"text-field":["get",as],"text-font":[Ue],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",ss],is],["!",["has",as]]],"center","bottom"],"text-allow-overlap":!0},us={type:"symbol",paint:{...$e,"text-color":"#ffffff"},layout:{...ze,...hs,"symbol-sort-key":["case",["==",["get",Be],ls],0,["abs",["-",["get","index"],1e3]]]}},ds={type:"symbol",paint:{...qe,"text-color":"black","text-halo-width":1.5,"text-halo-color":"#ffffff"},layout:{...Ye,"text-anchor":"top","text-offset":[0,.4]}},ps=(e,t)=>e&&t&&(e.startsWith("route")||e.startsWith("waypoint"))?`${t}-${e}`:e,ys=(e,t)=>e&&t?Object.fromEntries(Object.entries(e).map(([e,i])=>[e,i?.beforeID?{...i,beforeID:ps(i.beforeID,t)}:i])):e,fs=(e,t)=>t?{...e,...t,...t.paint&&{paint:{...e.paint,...t.paint}},...t.layout&&{layout:{...e.layout,...t.layout}}}:e,gs=(e,t)=>e&&void 0!==t?`${e}-${t}`:e,ms=(e={},t,i)=>{const r=e.layers,s=r?.sections,a=e.theme?.mainColor,o=a?((e,t)=>{const i=Wi(e);if(!i)return;const r=1-t;return`#${[Math.round(255*i[0]*r),Math.round(255*i[1]*r),Math.round(255*i[2]*r)].map(e=>e.toString(16).padStart(2,"0")).join("")}`})(a,.4):void 0,n=e.theme?.routeWidth,l=e.theme?.waypointSize,c=ir(l);return{mainLines:{routeLineArrows:fs({...Mr,beforeID:Ie.lowestLabel},r?.mainLines?.routeLineArrows),routeLine:fs({...Nr(n,a),beforeID:ps("routeIncidentBackgroundLine",t)},r?.mainLines?.routeLine),routeOutline:fs({...Or(n,o),beforeID:ps("routeLine",t)},r?.mainLines?.routeOutline),routeDeselectedLine:fs({...wr(n),beforeID:ps("routeOutline",t)},r?.mainLines?.routeDeselectedLine),routeDeselectedOutline:fs({...vr(n),beforeID:ps("routeDeselectedLine",t)},r?.mainLines?.routeDeselectedOutline),...ys(r?.mainLines?.additional,t)},waypoints:{routeWaypointSymbol:fs({...us,layout:{...us.layout,"icon-size":c},beforeID:ps("routeSummaryBubbleSymbol",t)},r?.waypoints?.routeWaypointSymbol),routeWaypointLabel:fs({...ds,beforeID:ps("routeWaypointSymbol",t)},r?.waypoints?.routeWaypointLabel),...ys(r?.waypoints?.additional,t)},chargingStops:{routeChargingStopSymbol:fs({..._r(e.chargingStops),beforeID:ps("routeWaypointSymbol",t)},r?.chargingStops?.routeChargingStopSymbol),...ys(r?.chargingStops?.additional,t)},sections:{incident:{routeIncidentJamSymbol:fs({...Gr,beforeID:ps("routeChargingStopSymbol",t)},s?.incident?.routeIncidentJamSymbol),routeIncidentCauseSymbol:fs({...jr,beforeID:ps("routeChargingStopSymbol",t)},s?.incident?.routeIncidentCauseSymbol),routeIncidentBackgroundLine:fs({...Wr(n),beforeID:ps("routeIncidentDashedLine",t)},s?.incident?.routeIncidentBackgroundLine),routeIncidentDashedLine:fs({...Br(n),beforeID:ps("routeTunnelLine",t)},s?.incident?.routeIncidentDashedLine),...ys(s?.incident?.additional,t)},ferry:{routeFerryLine:fs({...Rr(n),beforeID:ps("routeLineArrows",t)},s?.ferry?.routeFerryLine),routeFerrySymbol:fs({...Tr,beforeID:ps("routeIncidentJamSymbol",t)},s?.ferry?.routeFerrySymbol),...ys(s?.ferry?.additional,t)},tollRoad:{routeTollRoadOutline:fs({...Fr(n),beforeID:ps("routeDeselectedOutline",t)},s?.tollRoad?.routeTollRoadOutline),routeTollRoadSymbol:fs({...Pr,beforeID:ps("routeChargingStopSymbol",t)},s?.tollRoad?.routeTollRoadSymbol),...ys(s?.tollRoad?.additional,t)},tunnel:{routeTunnelLine:fs({...zr(n),beforeID:ps("routeLineArrows",t)},s?.tunnel?.routeTunnelLine),...ys(s?.tunnel?.additional,t)},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:fs({...$r(n),beforeID:ps("routeVehicleRestrictedForegroundLine",t)},s?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine),routeVehicleRestrictedForegroundLine:fs({...Yr(n),beforeID:Ie.lowestLabel},s?.vehicleRestricted?.routeVehicleRestrictedForegroundLine),...ys(s?.vehicleRestricted?.additional,t)}},instructionLines:{routeInstructionLine:fs({...Ir(n),beforeID:Ie.lowestLabel},r?.instructionLines?.routeInstructionLine),routeInstructionOutline:fs({...Sr(n),beforeID:ps("routeInstructionLine",t)},r?.instructionLines?.routeInstructionOutline),...ys(r?.instructionLines?.additional,t)},instructionArrows:{routeInstructionArrowSymbol:fs({...br,beforeID:ps("routeInstructionLine",t),...void 0!==i&&{layout:{...br.layout,"icon-image":gs(br.layout?.["icon-image"],i)}}},r?.instructionArrows?.routeInstructionArrowSymbol),...ys(r?.instructionArrows?.additional,t)},summaryBubbles:{routeSummaryBubbleSymbol:fs(void 0===i?es:Qr(i),r?.summaryBubbles?.routeSummaryBubbleSymbol),...ys(r?.summaryBubbles?.additional,t)}}},_s=ms();k()&&(z=W(B('<svg xmlns="http://www.w3.org/2000/svg" width="50" height="50">\n <path d="M1.562 40.569L25 1.562l23.438 39.007L25 27.566 1.562 40.569z" fill="#fff"/>\n <path d="M25.369.107c.782.429.506.167.917.682l23.438 39.007c.79 1.316-.671 2.829-2.014 2.085L25 29.281l-22.71 12.6c-1.343.744-2.804-.769-2.014-2.085L23.714.789c.461-.694.9-.682 1.656-.682zM25 1.562L1.562 40.569 25 27.566l23.438 13.003L25 1.562z"\n fill="gray"/>\n</svg>\n')));var Ls,As=e=>{if(!k())return;const t=B('<svg xmlns="http://www.w3.org/2000/svg" width="160" height="65">\n <g filter="url(#A)">\n <rect id="pin" x="81.899" y="47" width="10" height="10" rx="2" transform="rotate(45 81.899 47)"/>\n <rect id="bubble" x="10" y="10" width="140" height="45" rx="12"/>\n </g>\n <defs>\n <filter id="A">\n <feDropShadow dx="0" dy="2" stdDeviation="4" flood-opacity=".3"/>\n </filter>\n </defs>\n</svg>\n');return t.querySelector("#bubble")?.setAttribute("fill",e),t.querySelector("#pin")?.setAttribute("fill",e),W(t)},Ss={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},Is=e=>{if(!k())return;const t=B('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">\n <g id="main">\n <path fill-rule="evenodd"\n d="M11.389 4H9.025a.86.86 0 0 0-.517.173l-.001-.001a.5.5 0 0 1-.464.059l-.028-.011a.5.5 0 0 1-.129-.83A1.86 1.86 0 0 1 9.025 3h2.364a2 2 0 0 1 1.789 1.106l1.02 2.04c.471.176.802.63.802 1.156v.803c0 .543 0 .815-.071 1.038a1.5 1.5 0 0 1-.914.953c-.219.08-.491.092-1.034.114l-1.481.062v-.166-.803a2.23 2.23 0 0 0-1.055-1.897l-.74-1.479 2.326.033h.955l-.703-1.406A1 1 0 0 0 11.389 4zM12 8.4a1 1 0 1 1 2 0 .5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5z"/>\n <path d="M11.833 11.115c0-.109.089-.198.198-.198h1.979c.109 0 .198.089.198.198 0 .328-.266.594-.594.594h-1.187c-.328 0-.594-.266-.594-.594z"/>\n <path fill-rule="evenodd"\n d="M1.802 8.146C1.331 8.321 1 8.776 1 9.302v.803c0 .543 0 .815.071 1.038a1.5 1.5 0 0 0 .914.953c.219.08.491.092 1.034.114l2.731.114 2.731-.114c.543-.023.814-.034 1.034-.114a1.5 1.5 0 0 0 .914-.953c.071-.223.071-.494.071-1.038v-.803c0-.526-.331-.98-.802-1.156l-1.02-2.04A2 2 0 0 0 6.889 5H4.611a2 2 0 0 0-1.789 1.106l-1.02 2.04zM6.889 6H4.611a1 1 0 0 0-.894.553l-.703 1.406h.955 3.563.955l-.703-1.406A1 1 0 0 0 6.889 6zM2 10.4a1 1 0 1 1 2 0 .5.5 0 0 1-.5.5h-1a.5.5 0 0 1-.5-.5zm6.5-1a1 1 0 0 0-1 1 .5.5 0 0 0 .5.5h1a.5.5 0 0 0 .5-.5 1 1 0 0 0-1-1z"/>\n <path d="M1.792 13.115c0-.109.089-.198.198-.198h1.979c.109 0 .198.089.198.198 0 .328-.266.594-.594.594H2.385c-.328 0-.594-.266-.594-.594zm5.739-.198c-.109 0-.198.089-.198.198 0 .328.266.594.594.594h1.188c.328 0 .594-.266.594-.594 0-.109-.089-.198-.198-.198h-1.98z"/>\n </g>\n</svg>\n'),i=t.querySelector("#main");return i.setAttribute("transform","scale(2)"),i.setAttribute("fill",e),W(t)},Es=(e,t)=>{if(!k())return;const i=V(t);return e&&i.appendChild(e),W(i)},bs=e=>{if(k())return Es(B('<svg xmlns="http://www.w3.org/2000/svg" width="120" height="140">\n <path d="M63.734 86.383c-1.404.026-2.78-.393-3.93-1.197s-2.01-1.949-2.46-3.271l-3.15-9.339c-1.093-3.403-3.748-6.089-7.154-7.238L37.5 62.21c-2.742-.902-4.567-3.477-4.5-6.345-.058-2.874 1.761-5.457 4.5-6.388l36-11.886c2.461-.88 5.213-.27 7.062 1.567s2.466 4.571 1.578 7.015L70.17 81.918c-.938 2.719-3.54 4.526-6.436 4.469h0z"\n fill="#f4f5f6"/>\n</svg>\n'),e)},Rs=e=>{if(k())return Es(B('<svg xmlns="http://www.w3.org/2000/svg" width="120" height="140">\n <path d="M33 83.404a2.99 2.99 0 0 1-3-2.978V44.681a2.99 2.99 0 1 1 6 0v35.745a2.99 2.99 0 0 1-3 2.978zm48-38.723H39v17.872h42V44.681zm3.878 37.851a3.02 3.02 0 0 0 4.244 0c.561-.559.878-1.317.878-2.106V44.681a2.99 2.99 0 1 0-6 0v35.745c0 .789.317 1.547.878 2.106z"\n fill="#f4f5f6"/>\n</svg>\n'),e)},Ts=(e={},t)=>Object.entries(e).map(([e,i])=>({...i,id:t?`${t}-${e}`:e})),Cs=(e={},t)=>({mainLines:Ts(e.mainLines,t),waypoints:Ts(e.waypoints,t),chargingStops:Ts(e?.chargingStops,t),ferries:Ts(e.sections?.ferry,t),incidents:Ts(e.sections?.incident,t),tollRoads:Ts(e.sections?.tollRoad,t),tunnels:Ts(e.sections?.tunnel,t),vehicleRestricted:Ts(e.sections?.vehicleRestricted,t),instructionLines:Ts(e.instructionLines,t),instructionArrows:Ts(e.instructionArrows,t),summaryBubbles:Ts(e.summaryBubbles,t)}),vs=(e,t,i)=>{const r=n.instance.get().displayUnits,s=e?.displayUnits;return{...e,...s?{}:{displayUnits:r},layers:ms(e,t,i)}},ws=(e,t)=>{const i=t?.chargingStops?.icon;if(i?.mapping){const t=i.mapping;switch(t.basedOn){case"chargingSpeed":if(e.properties.chargingConnectionInfo?.chargingSpeed)return t.value[e.properties.chargingConnectionInfo?.chargingSpeed];break;case"custom":return t.fn(e)}}return"7309"},Os=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},Ns=(e,t)=>{const i=[];if(!1!==t?.chargingStops?.visible)for(const r of e.features)for(const e of r.properties.sections.leg){const s=e.summary.chargingInformationAtEndOfLeg;if(s){const e=s.properties;i.push({...s,properties:{...s.properties,id:s.properties.chargingParkId??p(),iconID:ws(s,t),title:Os(s),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:d(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:r.properties.routeState}})}}return{type:"FeatureCollection",features:i}},Ms=e=>e.categories.includes("jam"),xs=e=>{const t=(e=>{if(Ms(e))return d(e.delayInSeconds)})(e),i=((e,t)=>Ms(e)?`traffic-jam-${e.magnitudeOfDelay??"unknown"}-${(e=>e?.length?e.length<6?"small":e.length<8?"medium":"large":"collapsed")(t)}`:null)(e,t),r=(e=>{const t=e.categories.find(e=>"jam"!==e);return t?(e=>{switch(e){case"accident":return"traffic-incidents-accident";case"roadworks":return"traffic-incidents-roadworks";case"road-closed":return"traffic-incidents-road_closed";case"lane-closed":case"narrow-lanes":return"traffic-incidents-lane_closed";case"danger":case"animals-on-road":return"traffic-incidents-danger";case"broken-down-vehicle":return"traffic-incidents-broken_down_vehicle";case"wind":return"traffic-incidents-wind";case"fog":return"traffic-incidents-fog";case"rain":return"traffic-incidents-rain";case"frost":return"traffic-incidents-frost";case"flooding":return"traffic-incidents-flooding";default:return null}})(t):null})(e);return{...e,...i&&{jamIconID:i},...r&&{causeIconID:r},...t&&{title:t}}},Ds=(e,t,i)=>{if(e.properties.radiusMeters)return void 0!==i?Xe(ls,i):ls;let r;switch(t){case"start":r=os;break;case"finish":r=cs;break;default:r=ns}return void 0!==i?Xe(r,i):r},Fs=(e,t,i)=>{let r=-1;return{type:"FeatureCollection",features:e.map((s,a)=>{if(!s)return r++,null;const o=(e=>{return Array.isArray(e)?{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}:"Point"===e.type?{type:"Feature",geometry:t=e,properties:{},...t.bbox&&{bbox:t.bbox}}:e;var t})(s),n=((e,t)=>0===e?ts:e<t-1?is:rs)(a,e.length),l=(e=>!e.properties.radiusMeters)(o);l&&r++;const c=(e=>{const t=e?.properties;return t?.poi?.name??t?.address?.freeformAddress??void 0})(o),h=o.id??p();return{...o,..."main-when-available"===t?.entryPoints&&{geometry:{type:"Point",coordinates:f(o,{useEntryPoint:"main-when-available"})}},id:h,properties:{...o.properties,id:h,index:a,indexType:n,...c&&{title:c},iconID:Ds(o,n,i),...l&&"middle"===n&&{stopDisplayIndex:r}}}}).filter(e=>e)}},Ps=(e,t,i)=>({type:"FeatureCollection",features:e.features.flatMap(e=>((e,t,i)=>e.properties.sections[t]?.map(t=>{const r=t.id??p();return{type:"Feature",id:r,geometry:{type:"LineString",coordinates:e.geometry.coordinates.slice(t.startPointIndex,t.endPointIndex+1)},properties:{...i?i(t,e.properties):t,routeState:e.properties.routeState,routeIndex:e.properties.index,id:r}}})||[])(e,t,i))}),Us=(e,t)=>t.show(((e,t)=>({...t,features:t.features.map(t=>({...t,properties:{...t.properties,routeState:e.features[t.properties.routeIndex||0].properties.routeState}}))}))(e,t.shownFeatures)),Hs=(e,t=0)=>{const i="features"in e?e:{type:"FeatureCollection",features:[e]};return{...i,features:i.features.map((e,i)=>{const r=e.id??p();return{...e,id:r,properties:{...e.properties,id:r,routeState:i===t?"selected":"deselected"}}})}},ks=(e,t)=>e.some(e=>e.magnitudeOfDelay===t),Ws=(e,t)=>({type:"FeatureCollection",features:e.features.map(e=>{const i=e.properties.summary,r=e.geometry.coordinates,s=d(i.trafficDelayInSeconds,t?.time),a=(e=>{const t=e.properties.sections.traffic;if(t?.length)return ks(t,"major")?"major":ks(t,"moderate")?"moderate":ks(t,"minor")?"minor":void 0})(e),o=e.id??p();return{type:"Feature",id:o,geometry:{type:"Point",coordinates:r[Math.round(r.length/2)]},properties:{id:o,routeIndex:e.properties.index,routeState:e.properties.routeState,formattedDistance:u(i.lengthInMeters,t?.distance),...a&&{magnitudeOfDelay:a},...s&&{formattedTraffic:s},formattedDuration:d(i.travelTimeInSeconds,t?.time)}}})}),Bs=class e extends pe{static async get(t,i){return await ie(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.shownFeaturesHandlers=[]}createSourcesWithLayers(e){const t=Xe("routes",this.instanceIndex);return{mainLines:new te(this.mapLibreMap,`${t}-mainLines`,e.mainLines,!1),waypoints:new te(this.mapLibreMap,`${t}-waypoints`,e.waypoints,!1),incidents:new te(this.mapLibreMap,`${t}-incidents`,e.incidents,!1),ferries:new te(this.mapLibreMap,`${t}-ferries`,e.ferries,!1),chargingStops:new te(this.mapLibreMap,`${t}-chargingStops`,e.chargingStops,!1),tollRoads:new te(this.mapLibreMap,`${t}-tollRoads`,e.tollRoads,!1),tunnels:new te(this.mapLibreMap,`${t}-tunnels`,e.tunnels,!1),vehicleRestricted:new te(this.mapLibreMap,`${t}-vehicleRestricted`,e.vehicleRestricted,!1),instructionLines:new te(this.mapLibreMap,`${t}-instructionLines`,e.instructionLines,!1),instructionArrows:new te(this.mapLibreMap,`${t}-instructionArrows`,e.instructionArrows,!1),summaryBubbles:new te(this.mapLibreMap,`${t}-summaryBubbles`,e.summaryBubbles,!1)}}_initSourcesWithLayers(e,t){t||(this.layerIDPrefix=Xe("routes",this.instanceIndex)),this.layersSpecs=Cs(vs(e,this.layerIDPrefix,this.instanceIndex).layers,this.layerIDPrefix);const i=this.createSourcesWithLayers(this.layersSpecs);ne(Object.values(i).flatMap(e=>e._layerSpecs),this.mapLibreMap);const r={fillColor:e?.theme?.mainColor,...e?.waypoints?.icon?.style},s={pixelRatio:2},a=Xe(os,this.instanceIndex),o=Xe(ns,this.instanceIndex),n=Xe(ls,this.instanceIndex),l=Xe(cs,this.instanceIndex),c=Xe(Er,this.instanceIndex),h=Xe(xr,this.instanceIndex),u=Xe(Dr,this.instanceIndex),d=Xe(qr,this.instanceIndex),p=Xe(Kr,this.instanceIndex),y=Xe(Xr,this.instanceIndex),f=Xe(Zr,this.instanceIndex);this.addImageIfNotExisting(a,bs(r),s),this.addImageIfNotExisting(o,Es(void 0,r),s),this.addImageIfNotExisting(n,(()=>{if(k())return W(B('<svg width="32" height="32" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg">\n <circle id="circle" cx="16" cy="16" r="12" fill="white" stroke="#105287" stroke-width="4"/>\n</svg>\n'))})(),s),this.addImageIfNotExisting(l,Rs(r),s),this.addImageIfNotExisting(c,z,s),this.addImageIfNotExisting(h,As("white"),Ss),this.addImageIfNotExisting(u,As("#EEEEEE"),Ss),this.addImageIfNotExisting(d,Is(pr),s),this.addImageIfNotExisting(p,Is(cr),s),this.addImageIfNotExisting(y,Is(hr),s),this.addImageIfNotExisting(f,Is(dr),s);for(const g of e?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(g.id,g.image,{pixelRatio:g.pixelRatio??2});return i}_applyConfig(e){const i=vs(e,this.layerIDPrefix,this.instanceIndex);if(this.config){const e=Cs(i.layers,this.layerIDPrefix);Object.keys(e).forEach(t=>{const i=t;oe(e[i],this.layersSpecs[i],this.sourcesWithLayers[i],this.mapLibreMap)});const t=Object.values(this.sourcesWithLayers);ne(t.flatMap(e=>e._layerSpecs),this.mapLibreMap),t.forEach(e=>e.setLayersVisible(!!e.shownFeatures.features.length)),this.layersSpecs=e}if(e?.theme?.mainColor!==this.config?.theme?.mainColor){const t={fillColor:e?.theme?.mainColor,...e?.waypoints?.icon?.style},i={pixelRatio:2};he("add-or-update",Xe(os,this.instanceIndex),bs(t),this.mapLibreMap,i),he("add-or-update",Xe(ns,this.instanceIndex),Es(void 0,t),this.mapLibreMap,i),he("add-or-update",Xe(cs,this.instanceIndex),Rs(t),this.mapLibreMap,i)}const r=!1!==i.summaryBubbles?.visible,s=!t(this.config?.summaryBubbles?.visible,i.summaryBubbles?.visible),a=!t(this.config?.displayUnits,i.displayUnits),o=this.sourcesWithLayers.summaryBubbles.shownFeatures.features.length>0,n=this.sourcesWithLayers.mainLines.shownFeatures.features.length>0;return!r&&s?this.sourcesWithLayers.summaryBubbles.clear():r&&(s&&n||a&&o)&&this.sourcesWithLayers.summaryBubbles.show(Ws(this.sourcesWithLayers.mainLines.shownFeatures,i.displayUnits)),i}restoreDataAndConfigImpl(){const e=Object.entries(this.sourcesWithLayers).map(e=>({[e[0]]:e[1].shownFeatures})).reduce((e,t)=>({...e,...t}),{});this.initSourcesWithLayers(this.config,!0),this._applyConfig(this.config);for(const t of Object.keys(e))this.sourcesWithLayers[t].show(e[t])}addImageIfNotExisting(e,t,i){he("if-not-in-sprite",e,t,this.mapLibreMap,i)}async showRoutes(e,t){const i=Hs(e,t?.selectedIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(i),this.sourcesWithLayers.vehicleRestricted.show(Ps(i,"vehicleRestricted")),this.sourcesWithLayers.incidents.show(Ps(i,"traffic",xs)),this.sourcesWithLayers.chargingStops.show(Ns(i,this.config)),this.sourcesWithLayers.ferries.show(Ps(i,"ferry")),this.sourcesWithLayers.tunnels.show(Ps(i,"tunnel")),this.sourcesWithLayers.tollRoads.show(Ps(i,"toll")),this.sourcesWithLayers.instructionLines.show((e=>({type:"FeatureCollection",features:e.features.flatMap((e,t)=>e.properties.guidance?.instructions?.filter(e=>e.routePath?.length).map(i=>({type:"Feature",geometry:{type:"LineString",coordinates:i.routePath.map(e=>e.point)},properties:{...i,id:p(),routeIndex:t,routeState:e.properties.routeState}}))||[])}))(i)),this.sourcesWithLayers.instructionArrows.show((e=>({type:"FeatureCollection",features:e.features.flatMap((e,t)=>e.properties.guidance?.instructions?.filter(e=>e.routePath?.length&&e.routePath.length>1).map(i=>{const r=[i.routePath[i.routePath.length-2]?.point,i.routePath[i.routePath.length-1]?.point];return{type:"Feature",geometry:{type:"Point",coordinates:r[1]},properties:{...i,id:p(),routeIndex:t,routeState:e.properties.routeState,lastPointBearingDegrees:S(r[0],r[1])}}})||[])}))(i)),!1!==this.config?.summaryBubbles?.visible?this.sourcesWithLayers.summaryBubbles.show(Ws(i,this.config?.displayUnits)):this.sourcesWithLayers.summaryBubbles.clear();for(const r of this.shownFeaturesHandlers)r({routes:e})}async clearRoutes(){await this.waitUntilModuleReady();for(const e of Object.keys(this.sourcesWithLayers))"waypoints"!==e&&this.sourcesWithLayers[e].clear()}async selectRoute(e){const t=Hs(this.sourcesWithLayers.mainLines.shownFeatures,e);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(t),this.sourcesWithLayers.chargingStops.show(Ns(t,this.config)),Us(t,this.sourcesWithLayers.vehicleRestricted),Us(t,this.sourcesWithLayers.incidents),Us(t,this.sourcesWithLayers.ferries),Us(t,this.sourcesWithLayers.tollRoads),Us(t,this.sourcesWithLayers.tunnels),Us(t,this.sourcesWithLayers.instructionLines),Us(t,this.sourcesWithLayers.instructionArrows),Us(t,this.sourcesWithLayers.summaryBubbles)}async showWaypoints(e){const t=Array.isArray(e)?Fs(e,this.config?.waypoints,this.instanceIndex):Fs(e.features,this.config?.waypoints,this.instanceIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.show(t);for(const i of this.shownFeaturesHandlers)i({waypoints:e})}async clearWaypoints(){await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.clear()}getShown(){return{mainLines:this.sourcesWithLayers.mainLines.shownFeatures,waypoints:this.sourcesWithLayers.waypoints.shownFeatures,incidents:this.sourcesWithLayers.incidents.shownFeatures,ferries:this.sourcesWithLayers.ferries.shownFeatures,chargingStops:this.sourcesWithLayers.chargingStops.shownFeatures,tollRoads:this.sourcesWithLayers.tollRoads.shownFeatures,tunnels:this.sourcesWithLayers.tunnels.shownFeatures,vehicleRestricted:this.sourcesWithLayers.vehicleRestricted.shownFeatures,instructionLines:this.sourcesWithLayers.instructionLines.shownFeatures,instructionArrows:this.sourcesWithLayers.instructionArrows.shownFeatures,summaryBubbles:this.sourcesWithLayers.summaryBubbles.shownFeatures}}get events(){return{user:{mainLines:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.mainLines,this.config?.events),waypoints:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.waypoints,this.config?.events),chargingStops:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.chargingStops,this.config?.events),summaryBubbles:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.summaryBubbles,this.config?.events),incidents:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents,this.config?.events),vehicleRestricted:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vehicleRestricted,this.config?.events),ferries:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.ferries,this.config?.events),tollRoads:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tollRoads,this.config?.events),tunnels:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tunnels,this.config?.events),instructionLines:new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.instructionLines,this.config?.events)},module:new ve(this.configChangeHandlers,this.shownFeaturesHandlers)}}getLayerToRenderLinesUnder(){return Ie.lowestLabel}},Vs="standardLight",Gs={standardLight:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_light"},standardDark:{trafficIncidents:"incidents_dark",trafficFlow:"flow_relative-dark",hillshade:"hillshade_dark"},drivingLight:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_light"},drivingDark:{trafficIncidents:"incidents_dark",trafficFlow:"flow_relative-dark",hillshade:"hillshade_dark"},monoLight:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_mono-light"},monoDark:{trafficIncidents:"incidents_dark",trafficFlow:"flow_relative-dark",hillshade:"hillshade_mono-dark"},satellite:{trafficIncidents:"incidents_light",trafficFlow:"flow_relative-light",hillshade:"hillshade_satellite"}},js={standardLight:"basic_street-light",standardDark:"basic_street-dark",drivingLight:"basic_street-light-driving",drivingDark:"basic_street-dark-driving",monoLight:"basic_mono-light",monoDark:"basic_mono-dark",satellite:"basic_street-satellite"},zs=(e,t,i)=>{const r=e.id??"standardLight",s=e.version??"0.6.0-0",a=new URL(`${t}/maps/orbis/assets/styles/${s}/style.json`);a.searchParams.set("apiVersion","1"),i&&a.searchParams.set("key",i),a.searchParams.set("map",js[r]);for(const o of e.include??Mi)a.searchParams.append(o,Gs[r][o]);return a.toString()},$s=e=>{const t=e.style,i=e.commonBaseURL,r=e.apiKey;return"string"==typeof t?zs({id:t},i,r):"standard"===t?.type?zs(t,i,r):"custom"===t?.type&&t?.url?((e,t)=>{const i=new URL(e);return i.searchParams.has("key")?console.warn("The style URL is coming with an API key parameter which takes priority. If you want to use the SDK configured API key, remove the key param from the style URL"):t&&i.searchParams.set("key",t),i.toString()})(t.url,r):"custom"===t?.type&&t?.json?t.json:zs({id:Vs},i,r)},Ys=class{constructor(e){var i;this.mapReady=!1,this.styleChangeHandlers=[],this.setStyle=(e,i={keepState:!0})=>{this.mapReady=!1;for(const t of[...this.styleChangeHandlers])try{t.onStyleAboutToChange?.()}catch(s){console.error(s)}const r=i.keepState?((e,t)=>t&&"object"==typeof t&&"standard"===t.type&&t.include&&("string"==typeof e||"standard"===e.type&&!e.include)?{type:"standard",id:"string"==typeof e?e:e.id,include:t.include}:e)(e,this._params.style):e;this._params={...this._params,style:r},this.styleLightDarkTheme=de(r),this.mapLibreMap.setStyle($s(this._params),{validate:!1}),this.mapLibreMap.once("style.load",()=>{!this.mapReady&&t(r,this._params.style)&&this.handleStyleData(i.keepState||!0)})},this.getStyle=()=>this._params.style,this._params=L(e),void 0===this._params.style&&(this._params={...this._params,style:Vs}),this.styleLightDarkTheme=de(this._params.style),this.ensureMapLibreCSSLoaded(),N(4),this.mapLibreMap=new v({validateStyle:!1,maxTileCacheZoomLevels:22,cancelPendingTileRequestsWhileZooming:!1,...(i=this._params).mapLibre,style:$s(i),attributionControl:{compact:!1},transformRequest:se(i)}),this.mapLibreMap.once("style.load",()=>{this.handleStyleData(!1)}),this._eventsProxy=new Se(this.mapLibreMap,this._params?.events),this.loadRTLTextPlugin()}loadRTLTextPlugin(){setTimeout(()=>{["deferred","loaded"].includes(w())||O("https://unpkg.com/@mapbox/mapbox-gl-rtl-text@0.3.0/dist/mapbox-gl-rtl-text.js",!0).catch(e=>console.error("Something went wrong when setting RTL plugin",e))})}ensureMapLibreCSSLoaded(){if("undefined"==typeof document)return;if(Array.from(document.querySelectorAll('link[rel="stylesheet"], style')).some(e=>e.textContent?.includes(".maplibregl-map")))return;const e=document.createElement("link");e.rel="stylesheet",e.href=`https://unpkg.com/maplibre-gl@${M}/dist/maplibre-gl.css`,document.head.appendChild(e)}_setLanguage(e){this._params={...this._params,language:e};const t=e?.includes("-")?e.split("-")[0]:e;this.mapLibreMap.getStyle().layers.forEach(e=>{if("symbol"===e.type&&(e=>{const t=e.layout?.["text-field"]??"";return!!t&&("{name}"===t||2===t.length&&"name"===t[1]||3===t.length&&Array.isArray(t[1])&&"string"==typeof t[1][1]&&t[1][1].includes("name_")&&Array.isArray(t[2])&&t[2].includes("name"))})(e)){const i=t?["coalesce",["get",`name_${t}`],["get","name"]]:["get","name"];this.mapLibreMap.setLayoutProperty(e.id,"text-field",i,{validate:!1})}})}setLanguage(e){this.mapReady?this._setLanguage(e):this.mapLibreMap.once("styledata",()=>this.setLanguage(e))}getBBox(){return this.mapLibreMap.getBounds().toArray().flat()}handleStyleData(e){for(const i of Z(this.mapLibreMap,[Te,Ce,be]))this.mapLibreMap.setLayoutProperty(i.id,"visibility","none",{validate:!1});if((async(e,t)=>{const i=new URLSearchParams;e.apiKey&&i.set("key",e.apiKey),i.set("poi",`poi_${de(e.style)}`),i.set("apiVersion","1"),i.set("apiChannel","preview"),t.setSprite(`${e.commonBaseURL}/maps/orbis/assets/sprites/2.*/sprite?${i}`,{validate:!1})})(this._params,this.mapLibreMap),this._params.language&&this._setLanguage(this._params.language),this.mapReady=!0,e)for(const i of[...this.styleChangeHandlers])try{i.onStyleChanged?.()}catch(t){console.error(t)}}addStyleChangeHandler(e){this.styleChangeHandlers.push(e);let t=!1;return()=>{if(t)return;t=!0;const i=this.styleChangeHandlers.indexOf(e);-1!==i&&this.styleChangeHandlers.splice(i,1)}}},qs={visible:!0,displayMode:"hexgrid-3d",activeMetric:"congestionLevel",metricConfig:{congestionLevel:{color:{valueType:"raw",stops:[{value:0,color:"#2dc653"},{value:50,color:"#f5a623"},{value:100,color:"#e03030"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},speed:{color:{valueType:"relativeToPredefinedRangePCT",stops:[{value:0,color:"#e03030"},{value:50,color:"#f5a623"},{value:100,color:"#2dc653"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},travelTime:{color:{valueType:"relativeToPredefinedRangePCT",stops:[{value:0,color:"#2dc653"},{value:50,color:"#f5a623"},{value:100,color:"#e03030"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},freeFlowSpeed:{color:{valueType:"relativeToPredefinedRangePCT",stops:[{value:0,color:"#e03030"},{value:50,color:"#f5a623"},{value:100,color:"#2dc653"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"predefinedRange"}},networkLength:{color:{valueType:"relativeToActualRangePCT",stops:[{value:0,color:"#2dc653"},{value:50,color:"#f5a623"},{value:100,color:"#e03030"}]},height:{maxHeightMeters:1e3,minHeightMeters:0,scaleMode:"currentRange"}}},regionPolygon:{color:"#000000",fillOpacity:0,outlineOpacity:.5,outlineWidth:2,inverted:!1}},Ks={trafficLight:["#2dc653","#f5a623","#e03030"],heat:["#2196F3","#FF9800","#F44336"],monochrome:["#e0e0e0","#888888","#1a1a1a"],viridis:["#fde725","#35b779","#31688e","#440154"],plasma:["#f0f921","#ed7953","#9c179e","#0d0887"]},Xs={congestionLevel:{min:0,max:100},speed:{min:0,max:120},travelTime:{min:0,max:20},freeFlowSpeed:{min:0,max:120},networkLength:{min:0,max:5e3}},Zs=e=>"speed"===e||"freeFlowSpeed"===e,Js=e=>e?.activeMetric??qs.activeMetric,Qs=e=>{return"string"==typeof e?(t=Ks[e]).map((e,i)=>({value:1===t.length?0:i/(t.length-1),color:e})):e.stops;var t},ea=e=>{if("top"!==e)return e?Ie[e]:Ie.lowestLabel},ta=e=>{if("top"!==e)return e?Ie[e]:Ie.lowestPlaceLabel},ia=(e,t,i)=>{const r=t??qs.metricConfig[e].color??"trafficLight",s=Qs(r);let a;if("string"==typeof r){const{min:t,max:i}=Xs[e],r=Zs(e)?[...s].reverse().map(e=>e.color):s.map(e=>e.color);a=s.map(({value:e},s)=>[t+e*(i-t),r[s]])}else if("relativeToPredefinedRangePCT"===r.valueType){const{min:t,max:i}=Xs[e];a=s.map(({value:e,color:r})=>[t+e/100*(i-t),r])}else if("relativeToActualRangePCT"===r.valueType){const{min:t,max:r}=i??Xs[e];a=s.map(({value:e,color:i})=>[t+e/100*(r-t),i])}else a=s.map(({value:e,color:t})=>[e,t]);return["interpolate",["linear"],["get",e],...a.flatMap(([e,t])=>[e,t])]},ra=(e,t)=>{const i=t??qs.metricConfig[e].color??"trafficLight",r=Qs(i);let s;if("string"==typeof i){const t=Zs(e)?[...r].reverse().map(e=>e.color):r.map(e=>e.color);s=r.flatMap(({value:e},i)=>[.3+.7*e,t[i]])}else if("relativeToPredefinedRangePCT"===i.valueType||"relativeToActualRangePCT"===i.valueType)s=r.flatMap(({value:e,color:t})=>[.3+e/100*.7,t]);else{const e=Math.min(...r.map(e=>e.value)),t=Math.max(...r.map(e=>e.value))-e||1;s=r.flatMap(({value:i,color:r})=>[.3+(i-e)/t*.7,r])}return["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",...s]},sa=(e,t,i)=>{const r=qs.metricConfig[e].height,s=t?.minHeightMeters??r.minHeightMeters??0;if("raw"===t?.scaleMode){const i=t.scaleFactor??1;if("speed"===e){const{max:t}=Xs[e];return["max",s,["*",["-",t,["coalesce",["get","speed"],0]],i]]}return["max",s,["*",["coalesce",["get",e],0],i]]}const a=t?.maxHeightMeters??r.maxHeightMeters??1e3,{min:o,max:n}="currentRange"===(t?.scaleMode??r.scaleMode)?i??Xs[e]:Xs[e],l=n-o||1;return"speed"===e?["max",s,["*",["/",["-",n,["coalesce",["get","speed"],0]],l],a]]:["max",s,["*",["/",["-",["coalesce",["get",e],0],o],l],a]]},aa=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r],{min:a,max:o}=i??Xs[r];return{id:e,type:"heatmap",beforeID:ea(t?.beforeLayerConfig?.heatmap),paint:{"heatmap-weight":["interpolate",["linear"],["get",r],a,0,o,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],10,.5,14,2,16,4],"heatmap-color":ra(r,s?.color),"heatmap-radius":["interpolate",["linear"],["zoom"],4,1,8,3,12,35,14,80,16,100],"heatmap-opacity":["interpolate",["linear"],["zoom"],4,.8,13,.8,17,0]}}},oa=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill",beforeID:ea(t?.beforeLayerConfig?.hexgrid?.flat2D),paint:{"fill-color":ia(r,s?.color,i),"fill-opacity":.6}}},na=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill-extrusion",beforeID:ta(t?.beforeLayerConfig?.hexgrid?.extrusion3D),paint:{"fill-extrusion-color":ia(r,s?.color,i),"fill-extrusion-height":sa(r,s?.height,i),"fill-extrusion-base":0,"fill-extrusion-opacity":.75}}},la=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill",beforeID:ea(t?.beforeLayerConfig?.square?.flat2D),paint:{"fill-color":ia(r,s?.color,i),"fill-opacity":.6}}},ca=(e,t,i)=>{const r=Js(t),s=t?.metricConfig?.[r];return{id:e,type:"fill-extrusion",beforeID:ta(t?.beforeLayerConfig?.square?.extrusion3D),paint:{"fill-extrusion-color":ia(r,s?.color,i),"fill-extrusion-height":sa(r,s?.height,i),"fill-extrusion-base":0,"fill-extrusion-opacity":.75}}},ha=e=>({...qs.regionPolygon,...e}),ua=(e,t)=>{const{color:i,fillOpacity:r}=ha(t?.regionPolygon);return{id:e,type:"fill",beforeID:ea(),paint:{"fill-color":i,"fill-opacity":r}}},da=(e,t)=>{const{color:i,outlineOpacity:r,outlineWidth:s}=ha(t?.regionPolygon);return{id:e,type:"line",beforeID:ea(),paint:{"line-color":i,"line-opacity":r,"line-width":s}}},pa=(e,t)=>({id:e,type:"line",beforeID:t,filter:["has","eventState"],paint:{"line-color":"#ffffff","line-width":["case",Lt,3,2],"line-opacity":["case",Lt,1,.8]}}),ya=e=>({...e,filter:["has","eventState"],paint:{...e.paint,"fill-extrusion-color":["case",Lt,"#ffffff","#ffffff"],"fill-extrusion-height":["+",e.paint?.["fill-extrusion-height"],.5],"fill-extrusion-opacity":.6}}),fa=(e,t,i)=>ya(na(e,t,i)),ga=(e,t,i)=>ya(ca(e,t,i)),ma=(e,t,i)=>((e,t,i)=>{const r=[];for(let s=0;s<e.length;s++){const a=e[s];if(!a)continue;const{congestionSum:o,speedSum:n,freeFlowSum:l,travelTimeSum:c,networkLengthSum:h,count:u}=a,d=`${i}-${s}`;r.push({type:"Feature",id:d,geometry:t.features[s].geometry,properties:{id:d,congestionLevel:Math.round(o/u),speed:Math.round(n/u),freeFlowSpeed:Math.round(l/u),travelTime:Math.round(c/u*10)/10,networkLength:Math.round(h/u)}})}return r})(((e,t)=>{const i=[];for(const r of e)for(let e=0;e<t.features.length;e++)if(I(r.tileCentre,t.features[e])){let t=i[e];void 0===t&&(t={congestionSum:0,speedSum:0,freeFlowSum:0,travelTimeSum:0,networkLengthSum:0,count:0},i[e]=t),t.congestionSum+=r.congestionLevel??0,t.speedSum+=r.speed??0,t.freeFlowSum+=r.freeFlowSpeed??0,t.travelTimeSum+=r.travelTime??0,t.networkLengthSum+=r.networkLength??0,t.count++;break}return i})(e,t),t,i),_a=.005,La=(e,t,i,r)=>{const s=[];for(let a=0;a<e.features.length;a++){const o=e.features[a],n=o.properties?.tiledData?.tiles??[];if(0===n.length)continue;const l=h(o);if(!l)continue;const c=i([l[0]-_a,l[1]-_a,l[2]+_a,l[3]+_a],t);s.push(...ma(n,c,`${r}-${a}`))}return{type:"FeatureCollection",features:s}},Aa=class e extends pe{static async get(t,i){return await ie(t),new e(t,i??{})}constructor(e,t){super("geojson",e,t),this.lastAnalytics=null,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){const i=this.instanceIndex,r=`area-analytics-heatmap-${i}`,s=`area-analytics-hexgrid-${i}`,a=`area-analytics-square-${i}`,o=`area-analytics-region-${i}`,n=`${r}-layer`,l=`${s}-fill`,c=`${s}-extrusion`,h=`${s}-outline`,u=`${s}-extrusion-highlight`,d=`${a}-fill`,p=`${a}-extrusion`,y=`${a}-outline`,f=`${a}-extrusion-highlight`,g=`${o}-fill`,m=`${o}-line`;this.heatmapLayerSpec=aa(n,e),this.hexFillLayerSpec=oa(l,e),this.hexExtrusionLayerSpec=na(c,e),this.squareFillLayerSpec=la(d,e),this.squareExtrusionLayerSpec=ca(p,e),this.regionFillLayerSpec=ua(g,e),this.regionLineLayerSpec=da(m,e),this.hexOutlineLayerSpec=((e,t)=>pa(e,ea(t?.beforeLayerConfig?.hexgrid?.flat2D)))(h,e),this.hexExtrusionHighlightLayerSpec=fa(u,e),this.squareOutlineLayerSpec=((e,t)=>pa(e,ea(t?.beforeLayerConfig?.square?.flat2D)))(y,e),this.squareExtrusionHighlightLayerSpec=ga(f,e);const _={heatmap:new te(this.mapLibreMap,r,[this.heatmapLayerSpec]),hexgrid:new te(this.mapLibreMap,s,[this.hexFillLayerSpec,this.hexExtrusionLayerSpec]),square:new te(this.mapLibreMap,a,[this.squareFillLayerSpec,this.squareExtrusionLayerSpec]),region:new te(this.mapLibreMap,o,[this.regionFillLayerSpec,this.regionLineLayerSpec])};return this.addHighlightLayersToMap(s,a),_}_applyConfig(e){if(void 0===e)return;const t=e.metricConfig&&this.config?.metricConfig?{...this.config.metricConfig,...e.metricConfig}:e.metricConfig??this.config?.metricConfig,i=Object.keys(qs.metricConfig),r=Object.fromEntries(i.map(e=>[e,t?.[e]??qs.metricConfig[e]])),s={activeMetric:qs.activeMetric,displayMode:qs.displayMode,...this.config,...e,metricConfig:r};return this.applyLayerConfig(s),s.regionPolygon&&this.applyRegionConfig(s),s.beforeLayerConfig&&this._moveBeforeLayer(s.beforeLayerConfig,!1),this.config=s,this.applyModeVisibility(),s}restoreDataAndConfigImpl(){const e=this.lastAnalytics;this.initSourcesWithLayers(this.config,!0),e?(!1===this.config?.visible&&this.setVisible(!1),this.show(e)):this.config&&this._applyConfig(this.config)}async show(e){await this.waitUntilModuleReady(),this.lastAnalytics=e,this.sourcesWithLayers.heatmap.show((e=>({type:"FeatureCollection",features:e.features.flatMap(e=>e.properties?.tiledData?.tiles??[]).map((e,t)=>{const[i,r]=e.tileCentre,s=`tile-${t}-${i}-${r}`;return{type:"Feature",id:s,geometry:{type:"Point",coordinates:[i,r]},properties:{id:s,speed:e.speed??0,freeFlowSpeed:e.freeFlowSpeed??0,congestionLevel:e.congestionLevel??0,travelTime:e.travelTime??0,networkLength:e.networkLength??0}}})}))(e),{automaticVisibility:!1}),this.sourcesWithLayers.hexgrid.show(((e,t=.25)=>La(e,t,(e,t)=>R(e,t,{units:"kilometers"}),"hex"))(e),{automaticVisibility:!1}),this.sourcesWithLayers.square.show(((e,t=.5)=>La(e,t,(e,t)=>C(e,t,{units:"kilometers"}),"square"))(e),{automaticVisibility:!1});const t=this.config?.regionPolygon?.inverted??qs.regionPolygon.inverted;this.sourcesWithLayers.region.show(this.buildRegionFC(e.features,t)),this.applyLayerConfig(this.config),this.applyModeVisibility();for(const i of this.shownFeaturesHandlers)i(e)}async clear(){await this.waitUntilModuleReady(),this.lastAnalytics=null,this.sourcesWithLayers.heatmap.clear(),this.sourcesWithLayers.hexgrid.clear(),this.sourcesWithLayers.square.clear(),this.sourcesWithLayers.region.clear()}setMode(e){e!==this.mode&&(this.config={...this.config,displayMode:e},this.applyModeVisibility(),this.emitConfigChange())}setMetric(e){e!==this.activeMetric&&(this.config={...this.config,activeMetric:e},this.applyLayerConfig(this.config),this.emitConfigChange())}setColor(e,t){const i=Object.keys(qs.metricConfig),r=t??i,s={...this.config?.metricConfig};if(void 0===e)for(const a of r){const{color:e,...t}=s[a]??{};s[a]=t}else if("string"==typeof e){const t=(e=>{const t=Qs(e),i=e=>{const{min:i,max:r}=Xs[e],s=Zs(e)?[...t].reverse().map(e=>e.color):t.map(e=>e.color);return{valueType:"raw",stops:t.map(({value:e},t)=>({value:i+e*(r-i),color:s[t]}))}};return{congestionLevel:{color:i("congestionLevel")},speed:{color:i("speed")},travelTime:{color:i("travelTime")},freeFlowSpeed:{color:i("freeFlowSpeed")},networkLength:{color:i("networkLength")}}})(e);for(const e of r)s[e]={...s[e],...t[e]}}else for(const a of r)s[a]={...s[a],color:e};this.config={...this.config,metricConfig:s},this.applyLayerConfig(this.config),this.emitConfigChange()}setHeight(e,t){const i=Object.keys(qs.metricConfig),r=t??i,s={...this.config?.metricConfig};for(const a of r)s[a]={...s[a],height:e};this.config={...this.config,metricConfig:s},this.applyLayerConfig(this.config),this.emitConfigChange()}filter(e,t){const i=Object.keys(qs.metricConfig),r=t??i,s={...this.config?.metricConfig};for(const a of r)s[a]={...s[a],filters:e};this.config={...this.config,metricConfig:s},this.applyFiltersToLayers(),this.emitConfigChange()}clearFilter(e){this.filter(void 0,e)}setVisible(e){this.config={...this.config,visible:e},this.applyModeVisibility(),this.emitConfigChange()}isVisible(){return this.sourcesWithLayers.heatmap.isAnyLayerVisible()||this.sourcesWithLayers.hexgrid.isAnyLayerVisible()||this.sourcesWithLayers.square.isAnyLayerVisible()}getShown(){return{heatmap:this.sourcesWithLayers.heatmap.shownFeatures,hexgrid:this.sourcesWithLayers.hexgrid.shownFeatures,square:this.sourcesWithLayers.square.shownFeatures}}moveBeforeLayer(e){this._moveBeforeLayer(e)}_moveBeforeLayer(e,t=!0){const i=e=>"top"===e?void 0:Ie[e];void 0!==e.heatmap&&this.mapLibreMap.moveLayer(this.heatmapLayerSpec.id,i(e.heatmap)),void 0!==e.hexgrid?.flat2D&&this.mapLibreMap.moveLayer(this.hexFillLayerSpec.id,i(e.hexgrid.flat2D)),void 0!==e.hexgrid?.extrusion3D&&this.mapLibreMap.moveLayer(this.hexExtrusionLayerSpec.id,i(e.hexgrid.extrusion3D)),void 0!==e.square?.flat2D&&this.mapLibreMap.moveLayer(this.squareFillLayerSpec.id,i(e.square.flat2D)),void 0!==e.square?.extrusion3D&&this.mapLibreMap.moveLayer(this.squareExtrusionLayerSpec.id,i(e.square.extrusion3D)),t&&(this.config={...this.config,beforeLayerConfig:e})}get events(){return new ye(new we(this.tomtomMap._eventsProxy,[this.sourcesWithLayers.hexgrid,this.sourcesWithLayers.square,this.sourcesWithLayers.heatmap],this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}get mode(){return this.config?.displayMode??qs.displayMode}get activeMetric(){return Js(this.config)}applyModeVisibility(){if(!1===this.config?.visible)return void this.hideAllDataLayers();const e=this.mode,t=this.sourcesWithLayers.heatmap.shownFeatures.features.length>0,i=this.sourcesWithLayers.hexgrid.shownFeatures.features.length>0,r=this.sourcesWithLayers.square.shownFeatures.features.length>0,s=this.sourcesWithLayers.region.shownFeatures.features.length>0;this.sourcesWithLayers.heatmap.setLayersVisible("heatmap"===e&&t),this.sourcesWithLayers.hexgrid.setLayersVisible("hexgrid-3d"===e&&i,e=>e.id===this.hexExtrusionLayerSpec.id),this.sourcesWithLayers.hexgrid.setLayersVisible("hexgrid-2d"===e&&i,e=>e.id===this.hexFillLayerSpec.id),this.sourcesWithLayers.square.setLayersVisible("square-3d"===e&&r,e=>e.id===this.squareExtrusionLayerSpec.id),this.sourcesWithLayers.square.setLayersVisible("square-2d"===e&&r,e=>e.id===this.squareFillLayerSpec.id),this.sourcesWithLayers.region.setLayersVisible(s),this.setHighlightLayerVisible(this.hexOutlineLayerSpec.id,"hexgrid-2d"===e&&i),this.setHighlightLayerVisible(this.hexExtrusionHighlightLayerSpec.id,"hexgrid-3d"===e&&i),this.setHighlightLayerVisible(this.squareOutlineLayerSpec.id,"square-2d"===e&&r),this.setHighlightLayerVisible(this.squareExtrusionHighlightLayerSpec.id,"square-3d"===e&&r)}hideAllDataLayers(){this.sourcesWithLayers.heatmap.setLayersVisible(!1),this.sourcesWithLayers.hexgrid.setLayersVisible(!1),this.sourcesWithLayers.square.setLayersVisible(!1),this.sourcesWithLayers.region.setLayersVisible(!1),this.setHighlightLayerVisible(this.hexOutlineLayerSpec.id,!1),this.setHighlightLayerVisible(this.hexExtrusionHighlightLayerSpec.id,!1),this.setHighlightLayerVisible(this.squareOutlineLayerSpec.id,!1),this.setHighlightLayerVisible(this.squareExtrusionHighlightLayerSpec.id,!1)}addHighlightLayersToMap(e,t){const i=(e,t)=>{this.mapLibreMap.getLayer(e.id)||this.mapLibreMap.addLayer({...e,source:t},e.beforeID),this.mapLibreMap.setLayoutProperty(e.id,"visibility","none")};i(this.hexOutlineLayerSpec,e),i(this.hexExtrusionHighlightLayerSpec,e),i(this.squareOutlineLayerSpec,t),i(this.squareExtrusionHighlightLayerSpec,t)}setHighlightLayerVisible(e,t){this.mapLibreMap.getLayer(e)&&this.mapLibreMap.setLayoutProperty(e,"visibility",t?"visible":"none")}applyLayerConfig(e){const t=this.lastAnalytics?.properties.ranges?.[this.activeMetric],i=aa(this.heatmapLayerSpec.id,e,t),r=oa(this.hexFillLayerSpec.id,e,t),s=na(this.hexExtrusionLayerSpec.id,e,t),a=fa(this.hexExtrusionHighlightLayerSpec.id,e,t),o=la(this.squareFillLayerSpec.id,e,t),n=ca(this.squareExtrusionLayerSpec.id,e,t),l=ga(this.squareExtrusionHighlightLayerSpec.id,e,t);ae(i,this.heatmapLayerSpec,this.mapLibreMap),ae(r,this.hexFillLayerSpec,this.mapLibreMap),ae(s,this.hexExtrusionLayerSpec,this.mapLibreMap),ae(a,this.hexExtrusionHighlightLayerSpec,this.mapLibreMap),ae(o,this.squareFillLayerSpec,this.mapLibreMap),ae(n,this.squareExtrusionLayerSpec,this.mapLibreMap),ae(l,this.squareExtrusionHighlightLayerSpec,this.mapLibreMap),this.heatmapLayerSpec=i,this.hexFillLayerSpec=r,this.hexExtrusionLayerSpec=s,this.hexExtrusionHighlightLayerSpec=a,this.squareFillLayerSpec=o,this.squareExtrusionLayerSpec=n,this.squareExtrusionHighlightLayerSpec=l,this.applyFiltersToLayers()}applyRegionConfig(e){const t=ua(this.regionFillLayerSpec.id,e),i=da(this.regionLineLayerSpec.id,e);if(ae(t,this.regionFillLayerSpec,this.mapLibreMap),ae(i,this.regionLineLayerSpec,this.mapLibreMap),this.regionFillLayerSpec=t,this.regionLineLayerSpec=i,this.lastAnalytics){const t=e?.regionPolygon?.inverted??qs.regionPolygon.inverted;this.sourcesWithLayers.region.show(this.buildRegionFC(this.lastAnalytics.features,t))}}applyFiltersToLayers(){const e=this.activeMetric,t=this.config?.metricConfig?.[e]?.filters,i=[this.hexFillLayerSpec.id,this.hexExtrusionLayerSpec.id,this.squareFillLayerSpec.id,this.squareExtrusionLayerSpec.id];if(!t||void 0===t.min&&void 0===t.max){for(const e of i)this.mapLibreMap.setFilter(e,null);return}const r=[];void 0!==t.min&&r.push([">=",["get",e],t.min]),void 0!==t.max&&r.push(["<=",["get",e],t.max]);const s=1===r.length?r[0]:["any",...r];for(const a of i)this.mapLibreMap.setFilter(a,s)}buildRegionFC(e,t){return{type:"FeatureCollection",features:e.map((e,i)=>{const r=`traffic-area-analytics-region-${i}`,s=t?T(e).geometry:e.geometry;return{...e,id:r,geometry:s,properties:{id:r}}})}}},Sa=(e,t)=>e.length?1===e.length?{expression:e[0],legacy:t[0]}:{expression:["all",...e],legacy:["all",...t]}:null,Ia=(e,t,i)=>{e&&(t.push(e.expression),i.push(e.legacy))},Ea=(e,t,i,r)=>{e&&Ia(Qt(t,e),i,r)},ba=(e,t,i)=>{Ea(e.roadCategories,"road_category",t,i),Ea(e.roadSubCategories,"road_subcategory",t,i)},Ra=e=>{const t=[],i=[];return ba(e,t,i),e.incidentCategories&&Ia(Qt("icon_category_0",e.incidentCategories,e=>P[e]),t,i),e.magnitudes&&Ia(Qt("magnitude_of_delay",e.magnitudes,e=>m.indexOf(e)),t,i),e.delays&&Ia((e=>{const t=[],i=[];if(e.mustHaveDelay&&e.minDelayMinutes){const r=60*e.minDelayMinutes;t.push([">=",["get","delay"],r]),i.push([">=","delay",r])}else if(e.mustHaveDelay)t.push([">",["get","delay"],0]),i.push([">","delay",0]);else if(e.minDelayMinutes){const r=60*e.minDelayMinutes;t.push(["any",["!",["has","delay"]],["==",["get","delay"],0],[">=",["get","delay"],r]]),i.push(["any",["!has","delay"],["==","delay",0],[">=","delay",r]])}return Sa(t,i)})(e.delays),t,i),Sa(t,i)},Ta=e=>e?.any?.length?Xt(e.any.map(Ra).filter(e=>!i(e))):null,Ca=e=>{const t=[],i=[];if(ba(e,t,i),e.showRoadClosures){const r="only"===e.showRoadClosures?"==":"!=";t.push([r,["get","road_closure"],!0]),i.push([r,"road_closure",!0])}return Sa(t,i)},va=(e,t,i,r)=>{for(const s of t)i.setFilter(s.id,e?Zt(e,r[s.id]):r[s.id])},wa=class e extends pe{static async get(t,i){return await ie(t),await ce(t,Ce,"trafficFlow"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(Ce);if(!t)throw H(`init ${e.name} with source ID ${Ce}`);this.originalFilters={};for(const e of this.getLayers())this.originalFilters[e.id]=e.filter;return{trafficFlow:new J(this.mapLibreMap,t)}}_applyConfig(e){return this._setVisible(e?.visible??!1,!1),this._filter(e?.filters,!1),e}getLayers(){return Z(this.tomtomMap.mapLibreMap,[Ce])}filter(e){this._filter(e)}_filter(e,t=!0){if(this.tomtomMap.mapReady)if(e?.any?.length){const t=(r=e,r?.any?.length?Xt(r.any.map(Ca).filter(e=>!i(e))):null);t&&va(t,this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&va(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);var r;t&&(this.config=s({...this.config,filters:e},i),this.emitConfigChange())}setVisible(e){this._setVisible(e)}_setVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficFlow.setLayersVisible(e),t&&(this.config={...this.config,visible:e},this.emitConfigChange())}isVisible(){return this.sourcesWithLayers.trafficFlow.isAnyLayerVisible()}getShown(){return{trafficFlow:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.trafficFlow.sourceAndLayerIDs.layerIDs,validate:!1}).map(D)}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficFlow,this.config?.events,D),new ve(this.configChangeHandlers,[]))}},Oa="tt-traffic-incident-direction-chevron",Na='<svg xmlns="http://www.w3.org/2000/svg" width="48" height="18" viewBox="0 0 48 18">\n<path d="M 18 4 L 30 9 L 18 14" fill="none" stroke="rgba(20, 30, 50, 0.5)" stroke-width="5" stroke-linecap="round" stroke-linejoin="round"/>\n<path d="M 18 4 L 30 9 L 18 14" fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>\n</svg>',Ma=["unknown","minor","moderate","major","indefinite"],xa={unknown:{outline:"TrafficIncidents - No delay outline",inner:"TrafficIncidents - No delay pattern"},minor:{outline:"TrafficIncidents - Minor jam outline",inner:"TrafficIncidents - Minor jam"},moderate:{outline:"TrafficIncidents - Moderate jam outline",inner:"TrafficIncidents - Moderate jam"},major:{outline:"TrafficIncidents - Major jam outline",inner:"TrafficIncidents - Major jam"},indefinite:{outline:"TrafficIncidents - Closed road outline",inner:"TrafficIncidents - Closed road pattern"}},Da={outline:{unknown:"hsl(198, 20%, 54%)",minor:"hsl(45, 85%, 36%)",moderate:"hsl(9, 87%, 31%)",major:"hsl(0, 100%, 17%)",indefinite:"hsl(0, 100%, 34%)"},inner:{unknown:"hsl(198, 20%, 90%)",minor:"hsl(45, 100%, 51%)",moderate:"hsl(9, 97%, 51%)",major:"hsl(0, 100%, 34%)",indefinite:"hsl(197, 28%, 95%)"}},Fa=e=>{const t=e.getStyle()?.layers??[],i=/* @__PURE__ */new Map;for(const a of t)i.set(a.id,a);const r={outline:{...Da.outline},inner:{...Da.inner}},s=[];for(const a of Ma){const e=xa[a],t=Pa(i.get(e.outline),e.outline,s),o=Pa(i.get(e.inner),e.inner,s);t&&(r.outline[a]=t),o&&(r.inner[a]=o)}return s.length>0&&console.warn("[TrafficIncidentOverlayModule] style layers have non-literal `line-color` (match/case/etc.); falling back to default colour for: "+s.join(", ")),r},Pa=(e,t,i)=>{if(!e||"object"!=typeof e)return;const r=e.paint;if(!r||"object"!=typeof r)return;const s=r["line-color"];if("string"==typeof s)return s;void 0!==s&&i.push(t)},Ua=["interpolate",["exponential",1.5],["zoom"],5,0,9,.96,13,2.1,19,10.8],Ha=["interpolate",["exponential",1.5],["zoom"],5,.75,9,1.96,13,3.6,19,13.8],ka=e=>["match",["get","magnitudeOfDelay"],"unknown",e.unknown,"minor",e.minor,"moderate",e.moderate,"major",e.major,"indefinite",e.indefinite,e.major],Wa=["match",["get","magnitudeOfDelay"],"unknown","traffic-incidents-no_delay-pattern","indefinite","traffic-incidents-road_closed-pattern",""],Ba=e=>!1===e?null:{outlineColor:e?.outlineColor??"#000",widthScale:e?.widthScale??1.6},Va=["interpolate",["exponential",1.5],["zoom"],5,2.2,9,4.6,13,8.3,19,26],Ga=["case",["==",["feature-state","focused"],!0],1,0],ja=(e,t)=>{if(null===t)return e;const[i,r,s,...a]=e;return[i,r,s,...a.map((e,i)=>i%2==1?["case",["==",["feature-state","focused"],!0],e*t,e]:e)]},za=["in",["get","magnitudeOfDelay"],["literal",["minor","moderate","major"]]],$a=["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],Ya=(e,t,i=Da,r=Ba(void 0))=>{const s=r?.widthScale??null,a=[];return null!==r&&a.push({id:`${e}-focus-halo`,type:"line",minzoom:6,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":r.outlineColor,"line-width":Va,"line-blur":0,"line-opacity":Ga},beforeID:t}),a.push({id:`${e}-outline`,type:"line",minzoom:6,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":ka(i.outline),"line-width":ja(Ha,s)},beforeID:t},{id:`${e}-inner-solid`,type:"line",minzoom:6,filter:za,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":ka(i.inner),"line-width":ja(Ua,s)},beforeID:t},{id:`${e}-inner-chevron`,type:"line",minzoom:12,filter:za,layout:{"line-cap":"butt","line-join":"round"},paint:{"line-pattern":Oa,"line-width":ja(Ua,s)},beforeID:t},{id:`${e}-inner-pattern`,type:"line",minzoom:6,filter:$a,layout:{"line-cap":"round","line-join":"round"},paint:{"line-pattern":Wa,"line-width":ja(Ua,s)},beforeID:t}),a},qa=["step",["zoom"],.7,14,.8,16,.9,18,1],Ka=["step",["zoom"],12.6,14,14.4,16,16.2,18,18],Xa=["match",["get","category"],"other","traffic-incidents-info","accident","traffic-incidents-accident","fog","traffic-incidents-fog","danger","traffic-incidents-roadworks","rain","traffic-incidents-rain","frost","traffic-incidents-frost","lane-closed","traffic-incidents-lane_closed","roadworks","traffic-incidents-roadworks","wind","traffic-incidents-wind","flooding","traffic-incidents-flooding","broken-down-vehicle","traffic-incidents-broken_down_vehicle",""],Za=["all",["!=",["get","magnitudeOfDelay"],"indefinite"],["any",["!",["has","delayInSeconds"]],["step",["zoom"],[">",["get","delayInSeconds"],900],14,[">",["get","delayInSeconds"],600],15,[">",["get","delayInSeconds"],300],16,!0]]],Ja=["all",["==",["get","category"],"jam"],["!=",["get","magnitudeOfDelay"],"unknown"],["!=",["get","magnitudeOfDelay"],"indefinite"],["step",["zoom"],[">",["get","delayInSeconds"],900],13,[">",["get","delayInSeconds"],600],14,[">",["get","delayInSeconds"],300],15,!0]],Qa=["==",["get","magnitudeOfDelay"],"indefinite"],eo=["concat","traffic-jam-",["get","magnitudeOfDelay"],["case",["<",["get","delayInSeconds"],600],"-small",["<",["get","delayInSeconds"],3600],"-medium","-large"]],to=["case",["<=",["get","delayInSeconds"],60],"1 min",[">=",["get","delayInSeconds"],3600],["concat",["to-string",["floor",["/",["to-number",["get","delayInSeconds"]],3600]]]," hr ",["case",["==",["%",["round",["/",["to-number",["get","delayInSeconds"]],60]],60],0],"",["concat",["to-string",["round",["%",["/",["to-number",["get","delayInSeconds"]],60],60]]]," min"]]],["concat",["round",["/",["get","delayInSeconds"],60]]," min"]],io=["case",["has","delayInSeconds"],["*",-1,["get","delayInSeconds"]],0],ro=(e,t)=>[{id:`${e}-incident-marker`,type:"symbol",minzoom:13,filter:Za,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-anchor":"bottom-right","icon-offset":[-1,3],"icon-image":Xa,"icon-size":qa,"symbol-sort-key":io},beforeID:t},{id:`${e}-jam-marker`,type:"symbol",minzoom:12,filter:Ja,layout:{"symbol-placement":"point","icon-anchor":"bottom-left","icon-offset":[2,3],"icon-image":eo,"icon-size":qa,"icon-padding":0,"text-anchor":"bottom-left","text-field":to,"text-font":["NotoSans-CondensedBold"],"text-offset":[2.7,-.75],"text-size":Ka,"symbol-sort-key":io},paint:{"text-color":"hsl(210, 30%, 14%)"},beforeID:t},{id:`${e}-closed-road-marker`,type:"symbol",minzoom:12,filter:Qa,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-anchor":"bottom-right","icon-offset":[-1,3],"icon-image":"traffic-incidents-road_closed","icon-size":qa},beforeID:t}],so=e=>{if("top"!==e)return e?Ie[e]:Ie.lowestLabel},ao=class e extends pe{static async get(t,i){return await ie(t),new e(t,i??{})}constructor(e,t){super("geojson",e,t),this.lastResult=null,this.lastFeatureIds=[],this.lastFocusIds=null,this.shownFeaturesHandlers=[]}_initSourcesWithLayers(e,t){const i=`traffic-incident-overlay-${this.instanceIndex}`,r=(()=>{if(k())return Ls||(Ls=W(B(Na))),Ls})();r&&he("if-not-in-sprite",Oa,r,this.mapLibreMap);const s=so(e?.beforeLayerConfig),a=[...Ya(i,s,Fa(this.mapLibreMap),Ba(e?.focus)),...ro(i,s)];return{incidents:new te(this.mapLibreMap,i,a)}}_applyConfig(e){return!1===e?.visible?this.sourcesWithLayers.incidents.setLayersVisible(!1):this.sourcesWithLayers.incidents.setLayersVisible(!0),this.applyBeforeLayer(e?.beforeLayerConfig),e}applyBeforeLayer(e){const t=so(e);for(const i of this.sourcesWithLayers.incidents.sourceAndLayerIDs.layerIDs)this.mapLibreMap.moveLayer(i,t)}restoreDataAndConfigImpl(){this.initSourcesWithLayers(this.config,!0),this.lastResult&&this.sourcesWithLayers.incidents.show(this.lastResult),this._applyConfig(this.config),null!==this.lastFocusIds&&this.lastFocusIds.length>0&&this.setFocus(this.lastFocusIds)}async show(e){await this.waitUntilModuleReady(),this.clearFeatureState(),this.lastFocusIds=null,this.lastResult=e,this.lastFeatureIds=e.features.map(e=>e.properties.id).filter(e=>"string"==typeof e),this.sourcesWithLayers.incidents.show(e);for(const t of this.shownFeaturesHandlers)t(e)}async clear(){await this.waitUntilModuleReady(),this.clearFeatureState(),this.lastResult=null,this.lastFeatureIds=[],this.lastFocusIds=null,this.sourcesWithLayers.incidents.clear()}setVisible(e){this.config={...this.config,visible:e},this.sourcesWithLayers.incidents.setLayersVisible(e),this.emitConfigChange()}isVisible(){return this.sourcesWithLayers.incidents.isAnyLayerVisible()}moveBeforeLayer(e){this.config={...this.config,beforeLayerConfig:e},this.applyBeforeLayer(e),this.emitConfigChange()}getShown(){return{incidents:this.sourcesWithLayers.incidents.shownFeatures}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents,this.config?.events),new ve(this.configChangeHandlers,this.shownFeaturesHandlers))}setFocus(e){if(null===e||0===e.length)return this.lastFocusIds=null,void this.clearFeatureState();if(0===this.lastFeatureIds.length)return;this.lastFocusIds=e;const t=new Set(e),i=this.sourcesWithLayers.incidents.sourceAndLayerIDs.sourceID;for(const r of this.lastFeatureIds)this.mapLibreMap.setFeatureState({source:i,id:r},{focused:t.has(r)})}clearFeatureState(){if(0===this.lastFeatureIds.length)return;const e=this.sourcesWithLayers.incidents.sourceAndLayerIDs.sourceID;for(const t of this.lastFeatureIds)this.mapLibreMap.removeFeatureState({source:e,id:t})}},oo=class t extends pe{static async get(e,i){return await ie(e),await ce(e,Te,"trafficIncidents"),new t(e,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(Te);if(!e)throw H(`init ${t.name} with source ID ${Te}`);this.originalFilters={};for(const t of this.getLayers())this.originalFilters[t.id]=t.filter;return{trafficIncidents:new J(this.mapLibreMap,e)}}_applyConfig(e){return this._setVisible(e?.visible??!1,{updateConfig:!1}),i(e?.icons?.visible)||this._setIconsVisible(e.icons.visible,!1),this._filter(e?.filters,e?.icons?.filters,!1),e}filter(e,t){this._filter(e,t)}_filter(e,t,r=!0){if(this.tomtomMap.mapReady){if(e?.any?.length){const i=Ta(e);i&&va(i,t?this.getNonSymbolLayers():this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&va(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);if(t?.any?.length){const e=Ta(t);e&&va(e,this.getSymbolLayers(),this.mapLibreMap,this.originalFilters)}}r&&(this.config=s({...this.config,filters:e,icons:{...this.config?.icons,filters:t}},i),this.emitConfigChange())}getLayers(){return Z(this.tomtomMap.mapLibreMap,[Te])}getSymbolLayers(){return this.getLayers().filter(e=>"symbol"===e.type)}getNonSymbolLayers(){return this.getLayers().filter(e=>"symbol"!=e.type)}setIconsVisible(e){this._setIconsVisible(e)}_setIconsVisible(e,t=!0){this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficIncidents.setLayersVisible(e,e=>"symbol"===e.type),t&&(this.config={...this.config,icons:{...this.config?.icons,visible:e}},this.emitConfigChange())}setVisible(e){this._setVisible(e)}_setVisible(t,i){(i?.updateConfig??1)&&(delete this.config?.icons?.visible,this.config={...s({...this.config},e),visible:t},this.emitConfigChange()),this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficIncidents.setLayersVisible(t)}isVisible(){return this.sourcesWithLayers.trafficIncidents.isAnyLayerVisible()}anyIconLayersVisible(){return this.sourcesWithLayers.trafficIncidents?.isAnyLayerVisible(e=>"symbol"===e.type)}getShown(){return{trafficIncidents:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.trafficIncidents.sourceAndLayerIDs.layerIDs,validate:!1}).map(U)}}get events(){return new ye(new we(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficIncidents,this.config?.events,U),new ve(this.configChangeHandlers,[]))}},no=["motorway","motorway_link","trunk","trunk_link","primary","primary_link","secondary","secondary_link","tertiary","tertiary_link","street","service","track"],lo=["unclassified","residential","living_street"],co=["parking","driveway","alley"],ho=(e,t)=>({left:e.left-t.left,top:e.top-t.top,right:e.right-t.left,bottom:e.bottom-t.top}),uo=(e,t,i)=>e.right<=0||e.left>=t||e.bottom<=0||e.top>=i,po=(e,t,i,r)=>{e.top<=i-e.bottom?t.top=Math.max(t.top,e.bottom+r):t.bottom=Math.min(t.bottom,e.top-r)},yo=(e,t,i,r)=>{e.left<=i-e.right?t.left=Math.max(t.left,e.right+r):t.right=Math.min(t.right,e.left-r)},fo=(e,t,i,r,s)=>{const a=((e,t,i)=>({left:Math.max(0,e.left),top:Math.max(0,e.top),right:Math.min(t,e.right),bottom:Math.min(i,e.bottom)}))(e,i,r),o=e.left<=0&&e.right>=i,n=e.top<=0&&e.bottom>=r;if(o&&!n)return void po(a,t,r,s);if(n&&!o)return void yo(a,t,i,s);const l=e.left<=0,c=e.right>=i,h=e.top<=0,u=e.bottom>=r;!l&&!c||h||u?!h&&!u||l||c?((e,t,i,r,s)=>{const a=e.left,o=i-e.right,n=e.top,l=r-e.bottom,c=Math.min(a,o,n,l);c===a?t.left=Math.max(t.left,e.right+s):c===o?t.right=Math.min(t.right,e.left-s):c===n?t.top=Math.max(t.top,e.bottom+s):t.bottom=Math.min(t.bottom,e.top-s)})(a,t,i,r,s):yo(a,t,i,s):po(a,t,r,s)},go=e=>"string"==typeof e?document.querySelector(e):e,mo=e=>"mapLibreMap"in e?e.mapLibreMap:e,_o=(e,t,i)=>{const r=mo(e).getContainer().getBoundingClientRect(),{width:s,height:a}=r,o={left:i,top:i,right:s-i,bottom:a-i};for(const n of t){const e=go(n);if(!e)continue;const t=ho(e.getBoundingClientRect(),r);uo(t,s,a)||fo(t,o,s,a,i)}return o.left>=o.right||o.top>=o.bottom?null:{visibleAreaBounds:o,mapWidthPX:s,mapHeightPX:a}},Lo=e=>{const{map:t,surroundingElements:i,paddingPX:r=0}=e,s=_o(t,i,r);if(!s)return null;const{visibleAreaBounds:a}=s,o=mo(t),n=o.unproject([a.left,a.bottom]),l=o.unproject([a.right,a.top]);return[n.lng,n.lat,l.lng,l.lat]},Ao=e=>{const{map:t,surroundingElements:i}=e,r=Lo({map:t,surroundingElements:i});if(!r)return null;const[s,a,o,n]=r;return[(s+o)/2,(a+n)/2]},So=e=>{const{map:t,toBeContainedBBox:i,surroundingElements:r,paddingPX:s=0}=e,a=_o(t,r,s);if(!a)return null;const{visibleAreaBounds:o,mapWidthPX:n,mapHeightPX:l}=a,c=o.left/n,h=o.right/n,u=o.top/l,d=h-c,p=o.bottom/l-u,[y,f,g,m]=i,_=(g-y)/d,L=(m-f)/p,A=y-c*_,S=m+u*L;return[A,S-L,A+_,S]};export{pe as AbstractMapModule,X as AbstractSourceWithLayers,Q as AddedSourceWithLayers,Re as BASE_MAP_SOURCE_ID,ni as BaseMapModule,ye as CombinedEvents,ci as CustomGeoJSONModule,ji as DESELECTED_FOREGROUND_COLOR,zi as DESELECTED_OUTLINE_COLOR,Ki as DESELECTED_ROUTE_FILTER,$i as DESELECTED_SECONDARY_COLOR,Se as EventsProxy,rs as FINISH_INDEX,te as GeoJSONSourceWithLayers,Ei as GeometriesModule,be as HILLSHADE_SOURCE_ID,Oi as HillshadeModule,gr as INDEFINITE_DELAY_DASH_COLOR,ss as INDEX_TYPE,cr as MAJOR_DELAY_COLOR,is as MIDDLE_INDEX,ur as MINOR_DELAY_COLOR,dr as MINOR_DELAY_LABEL_COLOR,hr as MODERATE_DELAY_COLOR,ve as ModuleEvents,Ee as POI_SOURCE_ID,ri as POIsModule,qt as PlacesModule,Vi as ROUTE_LINE_FOREGROUND_COLOR,Yi as ROUTE_LINE_FOREGROUND_WIDTH,Gi as ROUTE_LINE_OUTLINE_COLOR,Xi as ROUTE_LINE_OUTLINE_WIDTH,Bs as RoutingModule,qi as SELECTED_ROUTE_FILTER,ts as START_INDEX,as as STOP_DISPLAY_INDEX,J as StyleSourceWithLayers,Ce as TRAFFIC_FLOW_SOURCE_ID,Te as TRAFFIC_INCIDENTS_SOURCE_ID,Ys as TomTomMap,K as TomTomMapSource,Aa as TrafficAreaAnalyticsModule,wa as TrafficFlowModule,ao as TrafficIncidentOverlayModule,oo as TrafficIncidentsModule,yr as UNKNOWN_DELAY_BG_COLOR,pr as UNKNOWN_DELAY_COLOR,fr as UNKNOWN_DELAY_DASH_COLOR,we as UserEvents,li as baseMapLayerGroupNames,De as baseMapPOICategoryValues,Ht as buildPlaceTitle,Ri as buildReachableRangeFeatures,ms as buildRoutingLayers,So as calculateFittingBBox,Lo as calculatePaddedBBox,Ao as calculatePaddedCenter,Ai as colorPaletteIDs,Li as colorPalettes,_s as defaultRoutingLayers,Z as filterLayersBySources,q as findFeatureByRefId,wi as geometryThemes,Wt as getIconIDForPlace,nr as getInstructionLineWidth,lr as getInstructionOutlineWidth,er as getLineForegroundWidth,tr as getLineOutlineWidth,Gt as getPOIGroupForPlace,Vt as getPOILayerCategoryForPlace,ii as getStyleCategories,sr as getTollRoadOutlineWidth,ir as getWaypointIconSize,Ne as mapDisplayPoiCategoryMappings,Ie as mapStyleLayerIDs,ei as poiCategoryGroups,Oe as poiLayerIDs,Yt as preparePlacesForDisplay,Ti as prepareReachableRangesForDisplay,vi as reachableRangeGeometryConfig,Y as renderedRefId,Qs as resolveColorStops,no as roadCategories,co as serviceRoadSubCategories,Ni as standardStyleIDs,lo as streetRoadSubCategories,Mi as styleModules,Ci as themedGeometryConfig,xe as toBaseMapPOICategory,Pe as toBaseMapPOIGroup,jt as toPlaces};
2
2
  //# sourceMappingURL=map.es.js.map