@tomtom-org/maps-sdk 0.46.7 → 0.46.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +14 -16
- package/map/dist/index.d.ts +1 -1
- package/map/dist/map.es.js +2 -2
- package/map/dist/map.es.js.map +1 -1
- package/package.json +5 -5
- package/services/dist/index.d.ts +0 -7
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
package/map/dist/map.es.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{isEmpty as e,isEqual as t,isNil as i,omit as r,omitBy as a,remove as s}from"lodash-es";import{TomTomConfig as o,bboxCenter as n,bboxFromCoordsArray as l,formatDistance as c,formatDuration as h,generateId as u,generateTomTomHeaders as d,getPosition as p,iconToTrafficIncidentCategory as y,indexedMagnitudes as _,mergeFromGlobal as m,poiCategoriesToID as f}from"@tomtom-org/maps-sdk/core";import{bearing as g,booleanPointInPolygon as A,difference as I,featureCollection as E,hexGrid as R,mask as L,point as T}from"@turf/turf";import{Map as S,getRTLTextPluginStatus as b,setRTLTextPlugin as N,setWorkerCount as O}from"maplibre-gl";import{version as C}from"maplibre-gl/package.json";var v=["road_category","road_subcategory","relative_speed","left_hand_traffic","road_closure","absolute_speed","part_of_two_way_road","openlr","display_class"],w=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}}}},M=["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"],D={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},P=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{id:t.id??u(),description:t?.description_0??"",category:y(t?.icon_category_0),magnitudeOfDelay:_[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}}}},x=e=>/* @__PURE__ */new Error(`Trying to ${e} while it is not in the map style. Did you exclude it when loading the map?`),U=()=>"undefined"!=typeof document&&"undefined"!=typeof DOMParser&&"undefined"!=typeof btoa,F=e=>{if(!U())return;const t=document.createElement("img");return t.src=`data:image/svg+xml;base64,${btoa((new XMLSerializer).serializeToString(e))}`,t},H=e=>(new DOMParser).parseFromString(e,"image/svg+xml").documentElement,W=e=>{const t=H('<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');return e?.fillColor&&t.querySelector("#background")?.setAttribute("fill",e.fillColor),e?.outlineColor&&t.querySelector("#outline")?.setAttribute("fill",e.outlineColor),void 0!==e?.outlineOpacity&&t.querySelector("#outline")?.setAttribute("fill-opacity",e.outlineOpacity.toString()),t};var k,G=e=>(function(e){if(i(e))throw new Error(`${e} must not be null/undefined. Something went wrong with its initialization.`)}(e),e),B=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))}},V=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"none"!==this.map.getLayoutProperty(e.id,"visibility")}setLayersVisible(e,t){for(const i of this.getLayerSpecs(t))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])}},Y=(e,t)=>e.getStyle().layers.filter(e=>t.includes(e?.source)),$=class extends V{constructor(e,t,i){let r=Y(e,[t.id]);i&&(r=r.filter(i)),super(e,new B(t.id,e.getStyle().sources[t.id],t),r)}},z=class extends V{constructor(e,t,i,r){super(e,new B(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))}},K={type:"FeatureCollection",features:[]},j=class extends z{constructor(e,t,i,r=!0){super(e,t,{type:"geojson",data:K,promoteId:"id"},i),this.shownFeatures=K,this.ensureAddedToMapWithVisibility(!1,r)}show(e){this.shownFeatures=e,G(this.source.runtimeSource).setData(e),this.setLayersVisible(!!e.features.length)}clear(){this.show(K)}findFeature(e){return"index"in e?this.shownFeatures.features[e.index]:"id"in e?this.shownFeatures.features.find(t=>t.id===e.id):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)}cleanEventState(e){const t=this.findFeature(e);t?.properties?.eventState&&(delete t?.properties?.eventState,!1!==e?.show&&this.show(this.shownFeatures))}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)}},q=async e=>{e.mapReady||(await e.mapLibreMap.once("styledata"),await q(e))},X=e=>{for(const i of e)if(i&&Object.keys(i.properties).length)for(const e in i.properties)if("string"==typeof i.properties[e])try{i.properties[e]=JSON.parse(i.properties[e])}catch(t){}},Z=(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 a of Object.keys(t.layout??[]))e.layout?.[a]||i.setLayoutProperty(r,a,void 0,{validate:!1});for(const a of Object.keys(t.paint??[]))e.paint?.[a]||i.setPaintProperty(r,a,void 0,{validate:!1});for(const[a,s]of Object.entries(e.paint??[]))i.setPaintProperty(r,a,s,{validate:!1});for(const[a,s]of Object.entries(e.layout??[]))i.setLayoutProperty(r,a,s,{validate:!1})},J=(e,t,i)=>{e.forEach((e,r)=>Z(e,t[r],i))},Q=(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)},a={};for(e.forEach(e=>{e.beforeID?i.has(e.beforeID)||t.getLayer(e.beforeID)?(i.add(e.beforeID),r(e)):a[e.beforeID]?a[e.beforeID].push(e):a[e.beforeID]=[e]:r(e)});Object.keys(a).length>0;){const e=Object.keys(a).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(a))}`);e.forEach(e=>{a[e].forEach(e=>r(e)),delete a[e]})}},ee=(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)}},te=async(e,t,i)=>{if(!e.mapLibreMap.getSource(t)){const r=e.mapLibreMap;r.isStyleLoaded()||await r.once("idle"),e.setStyle(ee(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 Y(r,[t]))r.setLayoutProperty(e.id,"visibility","none",{validate:!1});await r.once("styledata")}},ie=async(e,t,i,r,a)=>{if(!i)return void console.warn(`addOrUpdateImage called with empty image for ID ${t}`);const s=i=>{const s=r.hasImage(t);s&&"add-or-update"==e?r.updateImage(t,i):s||r.addImage(t,i,a)},o=e=>{e.complete?e.naturalWidth>0?s(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>s(e),e.onerror=()=>console.warn(`Failed to load image for ID ${t}`))};"string"==typeof i?i.includes("<svg")?o(F(H(i))):s((await r.loadImage(i)).data):o(i)},re=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},ae=e=>{if("string"==typeof e)return re(e);const t=e;return t?.id?re(t.id):"light"},se=class{constructor(e,t,i){this._initializing=!0,this.moduleReady=!1,this.sourceType=e,this.tomtomMap=t,this.eventsProxy=t._eventsProxy,this.mapLibreMap=t.mapLibreMap,this.initSourcesWithLayers(i),this.applyConfig(i),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 q(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)}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}},oe=class{constructor(e,t,i,r){this.eventProxy=e,this.sourceWithLayers=t,this.config=i,this.mapping=r}on(e,t){if(this.mapping){const i=this.mapping;this.eventProxy.addEventHandler(this.sourceWithLayers,(e,...r)=>t(i(e),...r),e,this.config)}else this.eventProxy.addEventHandler(this.sourceWithLayers,t,e,this.config)}off(e){this.eventProxy.remove(this.sourceWithLayers,e)}},ne=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 a=e.source.id;this.handlers[a]||(this.handlers[a]={[i]:[]}),this.handlers[a][i]??=[],this.handlers[a][i]?.push({sourceWithLayers:e,layerIDs:e._layerSpecs.map(e=>e.id),fn:t,config:r})}remove(t,i){const r=this.handlers[t.source.id]?.[i];r&&(s(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)s(this.interactiveLayerIDs,t=>e.id===t)}removeAll(){this.interactiveLayerIDs=[],this.handlers={}}hasSourceID(e){return!!this.handlers[e]}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)}}},le=e=>"click"===e||"contextmenu"===e,ce=(e,t,i,a="updateInProps")=>{const{feature:s,index:o}=((e,t)=>{for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return{feature:r,index:i}}})(i,t)||{};if(s&&(!le(s.properties?.eventState)||le(e))){const t={...s,properties:"updateInProps"===a?{...s?.properties,eventState:e}:r(s?.properties,"eventState")};return i.splice(o,1,t),o}},he=(e,t,r)=>{const a=[...r.shownFeatures.features];i(ce(e,t.id,a,"removeFromProps"))||r.show({...r.shownFeatures,features:a})},ue=(e,t,i,r,a)=>{if(t&&r instanceof j){const n=[...r.shownFeatures.features],l=ce(e,t.id,n);return!i||(o=t,(s=i)&&o&&s.id===o.id)||(a===r?ce(e,i.id,n,"removeFromProps"):a instanceof j&&he(e,i,a)),r.show({...r.shownFeatures,features:n}),{feature:n[l],index:l}}var s,o;return i&&a instanceof j&&he(e,i,a),{feature:t}},de={precisionMode:"box",paddingBoxPx:5,cursorOnHover:"pointer",cursorOnMouseDown:"grabbing",cursorOnMap:"default",longHoverDelayAfterMapMoveMS:800,longHoverDelayOnStillMapMS:300},pe=class extends ne{constructor(e,t={}){super(),this.enabled=!0,this.firstDelayedHoverSinceMapMove=!0,this.map=e,this.mapCanvas=e.getCanvas(),this.config={...de,...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()}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){const e=ue("long-hover",this.hoveringFeature,void 0,this.hoveringSourceWithLayers,void 0);this.findHandlers(["long-hover"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id).forEach(t=>t.fn(e.feature,this.hoveringLngLat,this.hoveringFeatures,this.hoveringSourceWithLayers))}}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),X(this.hoveringFeatures);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 a=this.hoveringFeature;this.hoveringFeature=t;const s=this.hoveringSourceWithLayers,o=this.findHandlers(["hover","hover-move","long-hover","click","contextmenu"],t?.source,t?.layer.id)?.[0];if(this.hoveringSourceWithLayers=o?.sourceWithLayers,i){this.updateHoverCursor(o?.config);const i=ue("hover",this.hoveringFeature,a,this.hoveringSourceWithLayers,s),r=this.findHandlers(["hover"],t?.source,t?.layer.id);for(const t of r)t.fn(i.feature,e.lngLat,this.hoveringFeatures,this.hoveringSourceWithLayers)}if(r){const t=this.findHandlers(["hover-move"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id);for(const i of t)i.fn(this.hoveringFeature,e.lngLat,this.hoveringFeatures,this.hoveringSourceWithLayers)}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);X(i);const r=this.lastClickedFeature;this.lastClickedFeature=i[0];const a=this.lastClickedSourceWithLayers,s=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);this.lastClickedSourceWithLayers=s?.[0]?.sourceWithLayers;const o=ue(e,this.lastClickedFeature,r,this.lastClickedSourceWithLayers,a);for(const n of s)n.fn(o.feature,t.lngLat,i,this.lastClickedSourceWithLayers)}},ye={country:"Places - Country name",lowestPlaceLabel:"Places - Village / Hamlet",poi:"POI",lowestLabel:"Borders - Treaty label",lowestRoadLine:"Tunnel - Railway outline",lowestBuilding:"Buildings - Underground"},_e="vectorTiles",me="hillshade",fe="vectorTiles",ge="vectorTilesIncidents",Ae="vectorTilesFlow",Ie=["POI","POI - Micro"],Ee={NATIVE_RESERVATION:"aboriginal_land",AIRPORT:"airport",AMUSEMENT_PARK:"amusement_park",ATM:"atm",CASH_DISPENSER:"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",FUEL_FACILITIES:"fuel_station",GAS_STATION:"fuel_station",PETROL_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",VACATION_RENTAL:"holiday_home",GENERAL_HOSPITAL_AND_POLYCLINIC:"hospital",HOSPITAL:"hospital",HOSPITAL_POLYCLINIC:"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",TRAILS:"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",ADVENTURE_SPORTS_VENUE:"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",IMPORTANT_TOURIST_ATTRACTION:"tourist_attraction",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",TRAFFIC_SERVICE_CENTER:"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"},Re={...Ee,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_BUSINESS:"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",REPAIR_SHOP:"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"},Le=e=>Re[e],Te="Noto-Bold",Se=.8,be=["interpolate",["linear"],["zoom"],8,.6,22,Se],Ne="title",Oe="iconID",Ce=.7,ve=1.4,we="default_place",Me={"icon-image":["get",Oe],"icon-anchor":"bottom","icon-size":be,"icon-allow-overlap":!0,"icon-padding":0},De={"icon-translate":[0,5],"icon-translate-anchor":"viewport"},Pe={"text-optional":!0,"text-font":[Te],"text-field":["get",Ne],"text-justify":"auto","text-variable-anchor":["top","left","right"],"text-variable-anchor-offset":["top",[0,Ce],"left",[ve,-1.4],"right",[-1.4,-1.4]],"text-size":["interpolate",["linear"],["zoom"],10,14,18,16],"text-padding":5},xe={"text-color":"#333333","text-halo-color":"#FFFFFF","text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"},Ue={type:"symbol",layout:{...Me,...Pe},paint:{...De,...xe}},Fe=(e,t)=>`${e}-${t}`,He=(e,t)=>{if(!e)return;const i=(e=>{try{if("string"==typeof e){if(e.includes("<svg")){const t=H(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"),a=t.getAttribute("height");if(r&&a)return{width:Number.parseFloat(r),height:Number.parseFloat(a)}}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);return i?"base-map"===t?{heightScale:i.height/54,widthScale:i.width/54}:{heightScale:i.height/140,widthScale:i.width/120}:void 0},We=e=>Boolean(e&&"availability"in e&&e.availability),ke=e=>"ELECTRIC_VEHICLE_STATION"===e.properties.poi?.categories?.[0]&&We(e.properties.chargingPark),Ge=e=>{const t=e.properties.chargingPark;if(We(t)){const e=t.availability.chargingPointAvailability,i=e.statusCounts.Available??0;return{availableCount:i,totalCount:e.count,ratio:i/e.count}}},Be=(e,t)=>`${e}/${t}`,Ve=e=>Ge(e)?.ratio??0,Ye=e=>["case",[">=",["get","evAvailabilityRatio"],e?.threshold??0],"green","red"],$e=(e,t,i,r)=>{const a=void 0!==r;return{top:a?[0,r]:[0,e],left:a?[r,i]:[t,i],right:a?[-r,i]:[-t,i]}},ze=(e,t,i,r)=>{const a=(e=>{if(!e)return Se;if("number"==typeof e)return e;if(Array.isArray(e)){const t=e.at(-1);if("number"==typeof t)return t}return Se})(e)/Se,s="base-map"===i;if(s&&void 0!==r)return{"text-offset":[r,r]};const o=ve*a,n=$e(Ce*a,o,s?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=(s?1.4:Ce)*u.heightScale,t=ve*u.widthScale,i=$e(e,t,s?0:-t,r);c.push(["==",["get",Oe],h],["literal",["top",i.top,"left",i.left,"right",i.right]])}return c.push(["literal",l]),{"text-variable-anchor-offset":c}},Ke=(e,t,i,r,a)=>{const s=t?.text,o=t?.layers?.[i],n=a&&a.size>0,l={...e.layout};(n||void 0!==s?.offset)&&(delete l["text-offset"],delete l["text-variable-anchor-offset"],delete l["text-radial-offset"]);const c={...l,...o?.layout,...s?.size&&{"text-size":s.size},...s?.font&&{"text-font":s.font},"text-field":r};if(n||void 0!==s?.offset){const i=e.layout?.["icon-size"],r=a??/* @__PURE__ */new Map;Object.assign(c,ze(i,r,t?.theme,s?.offset))}return c},je=(e,t,i,r)=>{const a=t?.text,s=t?.layers?.[i],{textColor:o,haloColor:n}=(e=>({textColor:"dark"===e?"#FFFFFF":"#333333",haloColor:"dark"===e?"#333333":"#FFFFFF"}))(r);return{...e.paint,...!a?.color&&{"text-color":o},...!a?.haloColor&&{"text-halo-color":n},...a?.color&&{"text-color":a.color},...a?.haloColor&&{"text-halo-color":a.haloColor},...a?.haloWidth&&{"text-halo-width":a.haloWidth},...s?.paint}},qe=["in",["get","eventState"],["literal",["click","contextmenu"]]],Xe=e=>JSON.parse(JSON.stringify(e)?.replaceAll("name",Ne)),Ze=["has","eventState"],Je="#3f9cd9",Qe={...Ue,filter:["!",Ze]},et={...Ue,filter:Ze,layout:{...Ue.layout,"icon-size":["interpolate",["linear"],["zoom"],8,.8,22,1],"text-allow-overlap":!0},paint:{...Ue.paint,"text-color":Je}},tt=(e,t,i,r,a)=>{const s=t?.text,o=t?.layers?.[i],n=((e,t)=>t?["case",["has","evAvailabilityText"],["format",["get",Ne],{},"\n",{},["get","evAvailabilityText"],{"font-scale":1.1,"text-color":Ye(e?.evAvailability)}],["get",Ne]]:["get",Ne])(t,!0===t?.evAvailability?.enabled),l=s?.title&&"function"!=typeof s?.title?s.title:n;return{...e,layout:Ke(e,t,i,l,a),paint:je(e,t,i,r),...o}},it=(e,t,i,r)=>{const a=((e,t)=>{const i=/* @__PURE__ */new Map,r=e?.icon?.categoryIcons??[];for(const a of r)if(a.image){const r=He(a.image,e?.theme);if(void 0!==r){const e=Fe(a.id,t);if(i.set(e,r),a.availabilityLevel){const e=Fe(`${a.id}-${a.availabilityLevel}`,t);i.set(e,r)}}}return i})(e,r);let s,o;if("base-map"===e?.theme){const e=(e=>{const t=e.getStyle().layers.find(e=>"POI"===e.id)||{},i=t.layout?.["text-size"];return{filter:["!",qe],type:"symbol",paint:t.paint,layout:{...t.layout,"text-field":["get",Ne],"icon-image":["get",Oe],...i&&{"text-size":Xe(i)}}}})(t);s=e,o={...e,filter:Ze,layout:{...e.layout,"text-allow-overlap":!0},paint:{...e.paint,"text-color":Je}}}else s=Qe,o=et;return{main:tt(s,e,"main",i,a),selected:tt(o,e,"selected",i,a),...e?.layers?.additional}},rt=e=>{if(U())return F(W(e))},at=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]),st=e=>e.properties.poi?.name??e.properties.address.freeformAddress,ot=(e,t,i)=>{if("pin"===t)return(e=>{if(e)return at.has(e)?e.toString():e.toString().substring(0,4)})(f[e])??i;{const t=Le(e);return t?`poi-${t}`:i}},nt=(e,t,i={})=>{const r=i.theme??"pin",a=Fe(we,t),s=i.icon?.mapping;if(s)return"imageID"===s.to?s.fn(e):ot(s.fn(e),r,a);const o=e.properties.poi?.categories?.[0],n=((e,t,i,r,a)=>{if(!r.evAvailability?.enabled||!ke(e))return;const s=Ve(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===s);return n?Fe(`${n.id}-${s}`,i):o||"pin"!==a?void 0:`7309-${s}`})(e,o,t,i,r);if(n)return n;const l=i.icon?.categoryIcons?.find(e=>e.id===o);return l?Fe(l.id,t):ot(o,r,a)},lt=e=>{const t=e.properties.poi?.categories?.[0];return t&&Le(t)},ct=e=>Array.isArray(e)?{type:"FeatureCollection",features:e}:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:e,ht=(e,t,i)=>{if(!0!==t?.enabled)return e;let r=!1,a=!1;for(const s of i.features)if("ELECTRIC_VEHICLE_STATION"===s.properties.poi?.categories?.[0]&&(r=!0,ke(s))){a=!0;break}return r&&!a&&console.warn("PlacesModule: evAvailability is enabled but no availability data found. Did you call getPlacesWithEVAvailability()?"),{...e,evAvailabilityText:e=>ke(e)?((e,t)=>{const i=Ge(e);return i?(t?.formatText??Be)(i.availableCount,i.totalCount):""})(e,t):"",evAvailabilityRatio:e=>ke(e)?Ve(e):0}},ut=(e,t,i={})=>{const r=ct(e),a=!0===i.evAvailability?.enabled?ht(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):st(e),s=a?Object.fromEntries(Object.entries(a).map(([t,i])=>[t,"function"==typeof i?i(e):i])):{},o=e.id??u();return{...e,id:o,geometry:{...e.geometry,bbox:e.bbox},properties:{...e.properties,id:o,title:r,iconID:nt(e,t,i),..."base-map"===i?.theme&&{category:lt(e)},...s}}})}},dt=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(t,i){return i||(e.lastInstanceIndex++,this.instanceIndex=e.lastInstanceIndex,this.sourceID=`places-${this.instanceIndex}`,this.layerIDPrefix=this.sourceID,this.defaultPlaceIconID=Fe(we,this.instanceIndex)),this.layerSpecs=this.buildLayerSpecs(t),{places:new j(this.mapLibreMap,this.sourceID,[this.layerSpecs.main,this.layerSpecs.selected])}}buildLayerSpecs(e){const t=it(e,this.tomtomMap.mapLibreMap,this.tomtomMap.styleLightDarkTheme,this.instanceIndex);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,{...t,id:`${this.layerIDPrefix}-${e}`}]))}_applyConfig(e){return this.updateLayersAndData(e),e}restoreDataAndConfigImpl(){const e=this.sourcesWithLayers.places.shownFeatures;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),this.show(e)}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}applyExtraFeatureProps(e){const t={...this.config,extraFeatureProps:e};this.updateData(t),this.config=t}updateLayersAndData(e){this.setupImages(e);const t=this.buildLayerSpecs(e);J([t.main,t.selected],[this.layerSpecs.main,this.layerSpecs.selected],this.mapLibreMap),this.layerSpecs=t,this.updateData(e)}setupImages(e){if(e?.icon){for(const t of e.icon.categoryIcons??[])ie("if-not-in-sprite",Fe(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&&ie("if-not-in-sprite",this.defaultPlaceIconID,e.icon.default.image.image,this.mapLibreMap,{pixelRatio:e.icon.default.image.pixelRatio??2}),e.icon.default.style&&ie("if-not-in-sprite",this.defaultPlaceIconID,rt(e.icon.default.style),this.mapLibreMap,{pixelRatio:2}))}else ie("if-not-in-sprite",this.defaultPlaceIconID,rt(),this.mapLibreMap,{pixelRatio:2})}updateData(e){this.sourcesWithLayers.places.source.runtimeSource?.setData(ut(this.sourcesWithLayers.places.shownFeatures,this.instanceIndex,e))}async show(e){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.show(ut(e,this.instanceIndex,this.config))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.clear()}getShown(){return{places:this.sourcesWithLayers.places.shownFeatures}}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 oe(this.eventsProxy,this.sourcesWithLayers.places,this.config?.events)}},pt=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(!pt(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}},yt=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,_t=(e,t)=>{return t?["all",e[(i=t,pt(i)?"expression":"legacy")],t]:e.expression;var i},mt=(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]}},ft=(e,t,i)=>mt(e,t.show,i?t.values.map(i):t.values),gt={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","HOSPITAL_POLYCLINIC","PHARMACY","DENTIST","WELFARE_ORGANIZATION"],PARKING_GROUP:["PARKING_GARAGE","OPEN_PARKING_AREA"],HOLIDAY_TOURISM_GROUP:["AMUSEMENT_PARK","BEACH","HOLIDAY_RENTAL","GEOGRAPHIC_FEATURE","IMPORTANT_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","PETROL_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"]},At=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}}},It=e=>{const t=[];return e.forEach(e=>{e in gt?t.push(...gt[e].map(Le)):t.push(Le(e))}),[...new Set(t)]},Et=class e extends se{static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(_e);if(!t)throw x(`init ${e.name} with source ID ${_e}`);const i=new $(this.mapLibreMap,t,e=>Ie.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):this._initializing||this.isVisible()||this.setVisible(!0),this.filterCategories(e?.filters?.categories),e}isVisible(){return this.sourcesWithLayers.poi.isAnyLayerVisible()}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.poi.setLayersVisible(e)}filterCategories(e){if(e){if(this.tomtomMap.mapReady){const t=mt("category",e.show,It(e.values));this.mapLibreMap.setFilter("POI",_t(t,this.originalFilter))}this.config={...this.config,filters:{categories:e}}}else this.categoriesFilter&&(this.config={...this.config,filters:{categories:{show:"all_except",values:[]}}},this.tomtomMap.mapReady&&this.mapLibreMap.setFilter("POI",this.originalFilter));this.categoriesFilter=e}getShown(){return{poi:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.poi.sourceAndLayerIDs.layerIDs,validate:!1}).map(At)}}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.poi,this.config?.events,At)}},Rt={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"]}},Lt=(e,t)=>{const i=Rt[e];return i.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&i.layerTypes.includes(t.type)},Tt=e=>t=>(!e||((e,t)=>{const i=t?.mode,r=t?.names;if(i&&r?.length){if("include"===i)return r.some(t=>Lt(t,e));if("exclude"===i)return!r.some(t=>Lt(t,e))}return!0})(t,e))&&!Ie.includes(t.id),St=class e extends se{static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(t){const i=this.mapLibreMap.getSource(fe);if(!i)throw x(`init ${e.name} with source ID ${fe}`);return{vectorTiles:new $(this.mapLibreMap,i,Tt(t?.layerGroupsFilter))}}_applyConfig(e){return e&&!i(e.visible)?this.setVisible(e.visible):this._initializing||this.isVisible()||this.setVisible(!0),e?.layerGroupsVisibility&&this.setVisible(e.layerGroupsVisibility.visible,{layerGroups:e.layerGroupsVisibility}),this.config||e?{...this.config,...e}:void 0}isVisible(){return this.sourcesWithLayers.vectorTiles.isAnyLayerVisible()}setVisible(e,t){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=>Lt(t,e)):"exclude"===t?e=>!i.some(t=>Lt(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups))}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles,this.config?.events)}},bt=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],Nt="#0A3653",Ot="#555555",Ct={type:"fill",paint:{"fill-color":["coalesce",["get","color"],Nt],"fill-opacity":["case",["==",["get","theme"],"outline"],0,.15],"fill-antialias":!1}},vt={type:"line",paint:{"line-color":["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],Ot],["coalesce",["get","color"],Nt]],"line-opacity":["case",["==",["get","theme"],"outline"],.9,1],"line-width":["case",["==",["get","theme"],"outline"],5,2]}},wt=(e,t,r)=>{const a=r?.colorConfig,s=r?.lineConfig;return[{...Ct,id:e,paint:{...Ct.paint,...!i(a?.fillOpacity)&&{"fill-opacity":a?.fillOpacity},...a?.fillColor&&{"fill-color":["get","color"]}}},{...vt,id:t,paint:{...vt.paint,...!i(s?.lineColor)&&{"line-color":s?.lineColor},...!i(s?.lineWidth)&&{"line-width":s?.lineWidth},...!i(s?.lineOpacity)&&{"line-opacity":s?.lineOpacity}}}]},Mt=(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":[Te],"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"}}},Dt=(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":[Te],"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}}}},Pt={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"]},xt=Object.keys(Pt),Ut=(e,t={})=>({...e,features:e.features.map((e,i)=>{const r=(e.properties??{}).theme??t.theme,a="inverted"===r?(e=>{const t=L(e);return{...e,geometry:t.geometry}})(e):e,s=a.properties??{},o=s.title??((e,t)=>t.textConfig?.textField?t.textConfig.textField:e.properties?.address?.freeformAddress)(a,t),n=s.color??((e,t)=>{const i=e?.colorConfig?.fillColor;if("string"==typeof i&&Pt[i]){const e=Pt[i];return e[t%e.length]}return i})(t,i);return{...a,properties:{...a.properties,...r&&{theme:r},...o&&{title:o},...n&&{color:n},id:s.id??u()}}})}),Ft=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=l((e=>e.flat().reduce((e,t)=>t.length>e.length?t:e,[]))(e.geometry.coordinates));t=i&&n(i)||null}else t=e.geometry.coordinates.flat();const i=e.id??e.properties?.id??u();return{type:"Feature",id:i,geometry:{type:"Point",coordinates:t},properties:{...e.properties,id:i}}});return{type:"FeatureCollection",bbox:e.bbox,features:t}},Ht=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.lineLabelLayerSpecs=null,this.lastRawInput=null}_initSourcesWithLayers(t,i){if(!i){e.lastInstanceIndex++,this.sourceID=`geometry-${e.lastInstanceIndex}`,this.titleSourceID=`geometryTitle-${e.lastInstanceIndex}`;const t=`geometry-${e.lastInstanceIndex}`;this.fillLayerID=`${t}_Fill`,this.outlineLayerID=`${t}_Outline`,this.lineLabelLayerID=`${t}_LineLabel`,this.titleLayerID=`${t}_Title`}const[r,a]=wt(this.fillLayerID,this.outlineLayerID,t),s=Mt(this.titleLayerID,t);this.titleLayerSpecs=s,this.geometryFillLayerSpecs=r,this.geometryOutlineLayerSpecs=a;const o=void 0===t?.lineLabelConfig?null:Dt(this.lineLabelLayerID,t);return this.lineLabelLayerSpecs=o,{geometry:new j(this.mapLibreMap,this.sourceID,[{...r},{...a},...o?[o]:[]]),geometryLabel:new j(this.mapLibreMap,this.titleSourceID,[s])}}_applyConfig(e){return(e?.textConfig||e?.colorConfig||e?.lineConfig)&&this.updateLayerAndData(e),e?.beforeLayerConfig&&this.moveBeforeLayer(e.beforeLayerConfig),e}moveBeforeLayerID(e){for(const t of this.sourcesWithLayers.geometry.sourceAndLayerIDs.layerIDs)this.mapLibreMap.moveLayer(t,e)}moveBeforeLayer(e){this.config={...this.config,beforeLayerConfig:e},this.moveBeforeLayerID("top"===e?this.titleLayerID:ye[e])}applyTextConfig(e){const t={...this.config,textConfig:e};this.updateLayerAndData(t),this.sourcesWithLayers.geometryLabel.show(Ft(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t}updateLayerAndData(e){const[t,i]=wt(this.fillLayerID,this.outlineLayerID,e),r=Mt(this.titleLayerID,e);if(Z(t,this.geometryFillLayerSpecs,this.mapLibreMap),Z(i,this.geometryOutlineLayerSpecs,this.mapLibreMap),Z(r,this.titleLayerSpecs,this.mapLibreMap),this.geometryFillLayerSpecs=t,this.geometryOutlineLayerSpecs=i,this.titleLayerSpecs=r,this.lineLabelLayerSpecs){const t=Dt(this.lineLabelLayerID,e);Z(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(Ut(i,this.config)),this.sourcesWithLayers.geometryLabel.show(Ft(r.shownFeatures))}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 oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry,this.config?.events)}},Wt={timeMinutes:"min",distanceKM:"km",remainingChargeCPT:"% remaining",spentChargePCT:"% spent",spentFuelLiters:"L"},kt=(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?L(t):I(E([e[i-1],t])),{title:a,theme:s,...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},Gt=(e,t="filled",i)=>{const r=e.features,a=r.map((e,t)=>{if(i)return i(e,t);const r=e.properties?.budget;return void 0!==r?.value&&r?.type?`${r.value} ${Wt[r.type]??r.type}`:String(t+1)});return{type:"FeatureCollection",...e.bbox&&{bbox:e.bbox},features:kt(r,a,t)}},Bt=(e="fadedRainbow",t="lowestLabel")=>({beforeLayerConfig:t,lineConfig:{lineWidth:["case",["==",["get","theme"],"outline"],5,1],lineColor:["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],Ot],"grey"],lineOpacity:["case",["==",["get","theme"],"outline"],.9,1]},colorConfig:{fillColor:e,fillOpacity:["case",["==",["get","theme"],"outline"],0,.6]},lineLabelConfig:{}}),Vt=(e="fadedRainbow",t,i,r)=>{const a=Bt(e,i),s=e=>Gt(e,t,r);return"inverted"!==t?{...a,transformFeaturesForDisplay:s}:{...a,lineConfig:{...a.lineConfig,lineOpacity:["case",["==",["get","theme"],"filled"],1,0]},colorConfig:{...a.colorConfig,fillOpacity:["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:s}},Yt=["filled","outline","inverted"],$t=class e extends se{static async get(t,i){return await q(t),await te(t,me,"hillshade"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(me);if(!t)throw x(`init ${e.name} with source ID ${me}`);return{hillshade:new $(this.mapLibreMap,t)}}_applyConfig(e){return this.setVisible(e?.visible??!1),e}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.hillshade.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.hillshade.isAnyLayerVisible()}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hillshade,this.config?.events)}},zt=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],Kt=["trafficIncidents","trafficFlow","hillshade"],jt=(e,t,i)=>Math.min(Math.max(t,e),i),qt=e=>!e.some(Number.isNaN),Xt=e=>Number.parseInt(e.padEnd(2,e),16)/255,Zt=(e,t)=>jt(t?e/100:e,0,1),Jt=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,Qt=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,ei=e=>{const t=Qt.exec(e);if(!t)return;const[,i,r,a,s,o,n,l,c]=t,h=[r||" ",s||" ",n].join("");if(" "!==h&&" /"!==h&&",,"!==h&&",,,"!==h)return;const u=[+i,jt(+a,0,100),jt(+o,0,100),l?Zt(+l,c):1];return qt(u)?(([e,t,i,r])=>{const a=(e=>{const t=e%360;return t<0?t+360:t})(e),s=t/100,o=i/100,n=e=>{const t=(e+a/30)%12;return o-s*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},ti=e=>{const t=e.toLowerCase().trim();if("transparent"===t)return[0,0,0,0];const i=ii[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[Xt(e.slice(1,1+t)),Xt(e.slice(1+t,1+2*t)),Xt(e.slice(1+2*t,1+3*t)),Xt(e.slice(1+3*t)||"ff")]})(t):t.startsWith("rgb")?(e=>{const t=Jt.exec(e);if(!t)return;const[,i,r,a,s,o,n,l,c,h,u,d]=t,p=[a||" ",n||" ",h].join("");if(" "!==p&&" /"!==p&&",,"!==p&&",,,"!==p)return;const y=[r,o,c].join(""),_="%%%"===y?100:""===y?255:0;if(!_)return;const m=[jt(+i/_,0,1),jt(+s/_,0,1),jt(+l/_,0,1),u?Zt(+u,d):1];return qt(m)?m:void 0})(t):ei(t)},ii={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]},ri="#36A8F0",ai="#105287",si="#ABAFB3",oi="#3C4956",ni="#727C85",li=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],ci=["==",["get","routeState"],"selected"],hi=["==",["get","routeState"],"deselected"],ui=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],di={s:["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],m:li,l:["interpolate",["linear"],["zoom"],1,5,5,6,10,11,18,15]},pi={s:["interpolate",["linear"],["zoom"],1,4,5,5,10,8,18,11],m:ui,l:["interpolate",["linear"],["zoom"],1,7,5,9,10,14,18,19]},yi={s:["interpolate",["linear"],["zoom"],8,.45,22,.6],m:["interpolate",["linear"],["zoom"],8,.6,22,.8],l:["interpolate",["linear"],["zoom"],8,.75,22,1]},_i=e=>di[e??"m"],mi=e=>pi[e??"m"],fi=e=>yi[e??"m"],gi={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]},Ai=e=>gi[e??"m"],Ii={s:["interpolate",["linear"],["zoom"],16,8,22,12],m:["interpolate",["linear"],["zoom"],16,12,22,17],l:["interpolate",["linear"],["zoom"],16,17,22,24]},Ei={s:["interpolate",["linear"],["zoom"],16,10,22,14],m:["interpolate",["linear"],["zoom"],16,14,22,20],l:["interpolate",["linear"],["zoom"],16,20,22,28]},Ri=e=>Ii[e??"m"],Li=e=>Ei[e??"m"],Ti="#AD0000",Si="#FB2D09",bi="#f58240",Ni="#000000",Oi=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],Ci=e=>({...Ue,filter:ci,minzoom:4,layout:{...Ue.layout,"text-field":Oi(e?.text)},paint:{...Ue.paint}}),vi={filter:ci,minzoom:16},wi={"line-cap":"round"},Mi=e=>({...vi,type:"line",layout:wi,paint:{"line-width":Li(e),"line-color":"grey"}}),Di=e=>({...vi,type:"line",layout:wi,paint:{"line-width":Ri(e),"line-color":"white"}}),Pi="instruction-arrow",xi={...vi,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":Pi,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Ui=e=>({filter:ci,type:"line",layout:{"line-join":"round"},paint:{"line-width":_i(e),"line-color":"#6dc4ed"}}),Fi={filter:ci,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}},Hi={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},Wi=e=>({...Hi,filter:hi,paint:{"line-color":oi,"line-width":mi(e)}}),ki=e=>({...Hi,filter:hi,paint:{"line-color":si,"line-width":_i(e)}}),Gi=(e,t)=>({...Hi,filter:ci,paint:{"line-color":t??"#105287","line-width":mi(e)}}),Bi=(e,t)=>({...Hi,filter:ci,paint:{"line-color":t??"#36A8F0","line-width":_i(e)}}),Vi={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},Yi="selected-route-summary-popup",$i="deselected-route-summary-popup",zi=e=>({filter:ci,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":Ai(e),"line-color":"#BEBFFA"}}),Ki={filter:ci,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]}},ji=["match",["get","magnitudeOfDelay"],"minor",bi,"moderate",Si,"major",Ti,"indefinite","#666666",Ni],qi=e=>({type:"line",layout:{"line-cap":"round"},paint:{"line-width":_i(e),"line-color":["match",["get","magnitudeOfDelay"],"minor","#FFC105","moderate",Si,"major",Ti,"#C7D2D8"]}}),Xi=e=>({type:"line",filter:["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],layout:{"line-join":"round"},paint:{"line-width":_i(e),"line-color":["match",["get","magnitudeOfDelay"],"unknown","rgba(190, 39, 27, 1)","rgba(137, 150, 168, 1)"],"line-dasharray":[1.5,1]}}),Zi={filter:ci,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},Ji={...Zi,filter:["all",["has","jamIconID"],Zi.filter],layout:{...Zi.layout,"icon-image":["get","jamIconID"],"icon-anchor":"bottom-left","text-anchor":"bottom-left","text-field":["get","title"],"text-font":[Te],"text-offset":[3.9,-1.4],"text-size":13},paint:{...Zi.paint,"text-color":ji,"text-halo-color":"#FFFFFF","text-halo-width":1}},Qi={...Zi,filter:["all",["has","causeIconID"],Zi.filter],layout:{...Zi.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...Zi.paint}},er=e=>({filter:ci,type:"line",layout:{"line-join":"round"},paint:{"line-width":_i(e),"line-color":"#000000","line-opacity":.3}}),tr=e=>({filter:ci,type:"line",layout:{"line-join":"round"},paint:{"line-color":ai,"line-width":_i(e)}}),ir=e=>({filter:ci,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":ri,"line-width":_i(e),"line-dasharray":[0,1.5]}}),rr="traffic-clear",ar="traffic-major",sr="traffic-moderate",or="traffic-minor",nr=["has","formattedTraffic"],lr=e=>{const t=void 0!==e?Fe(Yi,e):Yi,i=void 0!==e?Fe($i,e):$i,r=void 0!==e?Fe(rr,e):rr,a=void 0!==e?Fe(ar,e):ar,s=void 0!==e?Fe(sr,e):sr,o=void 0!==e?Fe(or,e):or;return{type:"symbol",layout:{"icon-image":["case",ci,t,i],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",ci,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",[Te]],"text-color":["case",ci,"black",ni]},["concat","\t\t",["get","formattedDistance"]],{"text-color":ni},["case",nr,"\n",""],{},["image",["case",nr,["match",["get","magnitudeOfDelay"],"major",a,"moderate",s,"minor",o,r],""]],{},["case",nr,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Te]],"text-color":ji}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}}},cr=lr(),hr="start",ur="middle",dr="finish",pr="indexType",yr="stopDisplayIndex",_r="waypointStart",mr="waypointStop",fr="waypointSoft",gr="waypointFinish",Ar={"text-field":["get",yr],"text-font":[Te],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",pr],ur],["!",["has",yr]]],"center","bottom"],"text-allow-overlap":!0},Ir={type:"symbol",paint:{...De,"text-color":"#ffffff"},layout:{...Me,...Ar,"symbol-sort-key":["case",["==",["get",Oe],fr],0,["abs",["-",["get","index"],1e3]]]}},Er={type:"symbol",paint:{...xe,"text-color":"black","text-halo-width":1.5,"text-halo-color":"#ffffff"},layout:{...Pe,"text-anchor":"top","text-offset":[0,.4]}},Rr=(e,t)=>e&&t&&(e.startsWith("route")||e.startsWith("waypoint"))?`${t}-${e}`:e,Lr=(e,t)=>e&&t?Object.fromEntries(Object.entries(e).map(([e,i])=>[e,i?.beforeID?{...i,beforeID:Rr(i.beforeID,t)}:i])):e,Tr=(e,t)=>t?{...e,...t,...t.paint&&{paint:{...e.paint,...t.paint}},...t.layout&&{layout:{...e.layout,...t.layout}}}:e,Sr=(e,t)=>e&&void 0!==t?`${e}-${t}`:e,br=(e={},t,i)=>{const r=e.layers,a=r?.sections,s=e.theme?.mainColor,o=s?((e,t)=>{const i=ti(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("")}`})(s,.4):void 0,n=e.theme?.routeWidth,l=e.theme?.waypointSize,c=fi(l);return{mainLines:{routeLineArrows:Tr({...Vi,beforeID:ye.lowestLabel},r?.mainLines?.routeLineArrows),routeLine:Tr({...Bi(n,s),beforeID:Rr("routeIncidentBackgroundLine",t)},r?.mainLines?.routeLine),routeOutline:Tr({...Gi(n,o),beforeID:Rr("routeLine",t)},r?.mainLines?.routeOutline),routeDeselectedLine:Tr({...ki(n),beforeID:Rr("routeOutline",t)},r?.mainLines?.routeDeselectedLine),routeDeselectedOutline:Tr({...Wi(n),beforeID:Rr("routeDeselectedLine",t)},r?.mainLines?.routeDeselectedOutline),...Lr(r?.mainLines?.additional,t)},waypoints:{routeWaypointSymbol:Tr({...Ir,layout:{...Ir.layout,"icon-size":c},beforeID:Rr("routeSummaryBubbleSymbol",t)},r?.waypoints?.routeWaypointSymbol),routeWaypointLabel:Tr({...Er,beforeID:Rr("routeWaypointSymbol",t)},r?.waypoints?.routeWaypointLabel),...Lr(r?.waypoints?.additional,t)},chargingStops:{routeChargingStopSymbol:Tr({...Ci(e.chargingStops),beforeID:Rr("routeWaypointSymbol",t)},r?.chargingStops?.routeChargingStopSymbol),...Lr(r?.chargingStops?.additional,t)},sections:{incident:{routeIncidentJamSymbol:Tr({...Ji,beforeID:Rr("routeChargingStopSymbol",t)},a?.incident?.routeIncidentJamSymbol),routeIncidentCauseSymbol:Tr({...Qi,beforeID:Rr("routeChargingStopSymbol",t)},a?.incident?.routeIncidentCauseSymbol),routeIncidentBackgroundLine:Tr({...qi(n),beforeID:Rr("routeIncidentDashedLine",t)},a?.incident?.routeIncidentBackgroundLine),routeIncidentDashedLine:Tr({...Xi(n),beforeID:Rr("routeTunnelLine",t)},a?.incident?.routeIncidentDashedLine),...Lr(a?.incident?.additional,t)},ferry:{routeFerryLine:Tr({...Ui(n),beforeID:Rr("routeLineArrows",t)},a?.ferry?.routeFerryLine),routeFerrySymbol:Tr({...Fi,beforeID:Rr("routeIncidentJamSymbol",t)},a?.ferry?.routeFerrySymbol),...Lr(a?.ferry?.additional,t)},tollRoad:{routeTollRoadOutline:Tr({...zi(n),beforeID:Rr("routeDeselectedOutline",t)},a?.tollRoad?.routeTollRoadOutline),routeTollRoadSymbol:Tr({...Ki,beforeID:Rr("routeChargingStopSymbol",t)},a?.tollRoad?.routeTollRoadSymbol),...Lr(a?.tollRoad?.additional,t)},tunnel:{routeTunnelLine:Tr({...er(n),beforeID:Rr("routeLineArrows",t)},a?.tunnel?.routeTunnelLine),...Lr(a?.tunnel?.additional,t)},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:Tr({...tr(n),beforeID:Rr("routeVehicleRestrictedForegroundLine",t)},a?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine),routeVehicleRestrictedForegroundLine:Tr({...ir(n),beforeID:ye.lowestLabel},a?.vehicleRestricted?.routeVehicleRestrictedForegroundLine),...Lr(a?.vehicleRestricted?.additional,t)}},instructionLines:{routeInstructionLine:Tr({...Di(n),beforeID:ye.lowestLabel},r?.instructionLines?.routeInstructionLine),routeInstructionOutline:Tr({...Mi(n),beforeID:Rr("routeInstructionLine",t)},r?.instructionLines?.routeInstructionOutline),...Lr(r?.instructionLines?.additional,t)},instructionArrows:{routeInstructionArrowSymbol:Tr({...xi,beforeID:Rr("routeInstructionLine",t),...void 0!==i&&{layout:{...xi.layout,"icon-image":Sr(xi.layout?.["icon-image"],i)}}},r?.instructionArrows?.routeInstructionArrowSymbol),...Lr(r?.instructionArrows?.additional,t)},summaryBubbles:{routeSummaryBubbleSymbol:Tr(void 0===i?cr:lr(i),r?.summaryBubbles?.routeSummaryBubbleSymbol),...Lr(r?.summaryBubbles?.additional,t)}}},Nr=br();U()&&(k=F(H('<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 Or=e=>{if(!U())return;const t=H('<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),F(t)},Cr={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},vr=e=>{if(!U())return;const t=H('<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),F(t)},wr=(e,t)=>{if(!U())return;const i=W(t);return e&&i.appendChild(e),F(i)},Mr=e=>{if(U())return wr(H('<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)},Dr=e=>{if(U())return wr(H('<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)},Pr=(e={},t)=>Object.entries(e).map(([e,i])=>({...i,id:t?`${t}-${e}`:e})),xr=(e={},t)=>({mainLines:Pr(e.mainLines,t),waypoints:Pr(e.waypoints,t),chargingStops:Pr(e?.chargingStops,t),ferries:Pr(e.sections?.ferry,t),incidents:Pr(e.sections?.incident,t),tollRoads:Pr(e.sections?.tollRoad,t),tunnels:Pr(e.sections?.tunnel,t),vehicleRestricted:Pr(e.sections?.vehicleRestricted,t),instructionLines:Pr(e.instructionLines,t),instructionArrows:Pr(e.instructionArrows,t),summaryBubbles:Pr(e.summaryBubbles,t)}),Ur=(e,t,i)=>{const r=o.instance.get().displayUnits,a=e?.displayUnits;return{...e,...a?{}:{displayUnits:r},layers:br(e,t,i)}},Fr=(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"},Hr=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},Wr=(e,t)=>{const i=[];if(!1!==t?.chargingStops?.visible)for(const r of e.features)for(const e of r.properties.sections.leg){const a=e.summary.chargingInformationAtEndOfLeg;if(a){const e=a.properties;i.push({...a,properties:{...a.properties,id:a.properties.chargingParkId??u(),iconID:Fr(a,t),title:Hr(a),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:h(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:r.properties.routeState}})}}return{type:"FeatureCollection",features:i}},kr=e=>e.categories.includes("jam"),Gr=e=>{const t=(e=>{if(kr(e))return h(e.delayInSeconds)})(e),i=((e,t)=>kr(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=>{switch(e.categories.find(e=>"jam"!==e)){case"accident":return"traffic-incidents-accident";case"roadworks":return"traffic-incidents-roadworks";case"road-closed":return"traffic-incidents-road_closed";case"danger":case"animals-on-road":return"traffic-incidents-danger";case"broken-down-vehicle":return"traffic-incidents-broken_down_vehicle";case"lane-closed":case"narrow-lanes":return"traffic-incidents-lane_closed";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}})(e);return{...e,...i&&{jamIconID:i},...r&&{causeIconID:r},...t&&{title:t}}},Br=(e,t,i)=>{if(e.properties.radiusMeters)return void 0!==i?Fe(fr,i):fr;let r;switch(t){case"start":r=_r;break;case"finish":r=gr;break;default:r=mr}return void 0!==i?Fe(r,i):r},Vr=(e,t,i)=>{let r=-1;return{type:"FeatureCollection",features:e.map((a,s)=>{if(!a)return r++,null;const o=(e=>Array.isArray(e)?{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}:"Point"===e.type?(e=>({type:"Feature",geometry:e,properties:{},...e.bbox&&{bbox:e.bbox}}))(e):e)(a),n=((e,t)=>0===e?hr:e<t-1?ur:dr)(s,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??u();return{...o,..."main-when-available"===t?.entryPoints&&{geometry:{type:"Point",coordinates:p(o,{useEntryPoint:"main-when-available"})}},id:h,properties:{...o.properties,id:h,index:s,indexType:n,...c&&{title:c},iconID:Br(o,n,i),...l&&"middle"===n&&{stopDisplayIndex:r}}}}).filter(e=>e)}},Yr=(e,t,i)=>({type:"FeatureCollection",features:e.features.flatMap(e=>((e,t,i)=>e.properties.sections[t]?.map(t=>{const r=t.id??u();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))}),$r=(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)),zr=(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??u();return{...e,id:r,properties:{...e.properties,id:r,routeState:i===t?"selected":"deselected"}}})}},Kr=(e,t)=>e.some(e=>e.magnitudeOfDelay===t),jr=(e,t)=>({type:"FeatureCollection",features:e.features.map(e=>{const i=e.properties.summary,r=e.geometry.coordinates,a=h(i.trafficDelayInSeconds,t?.time),s=(e=>{const t=e.properties.sections.traffic;if(t?.length)return Kr(t,"major")?"major":Kr(t,"moderate")?"moderate":Kr(t,"minor")?"minor":void 0})(e),o=e.id??u();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:c(i.lengthInMeters,t?.distance),...s&&{magnitudeOfDelay:s},...a&&{formattedTraffic:a},formattedDuration:h(i.travelTimeInSeconds,t?.time)}}})}),qr=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t)}createSourcesWithLayers(e){const t=Fe("routes",this.instanceIndex);return{mainLines:new j(this.mapLibreMap,`${t}-mainLines`,e.mainLines,!1),waypoints:new j(this.mapLibreMap,`${t}-waypoints`,e.waypoints,!1),incidents:new j(this.mapLibreMap,`${t}-incidents`,e.incidents,!1),ferries:new j(this.mapLibreMap,`${t}-ferries`,e.ferries,!1),chargingStops:new j(this.mapLibreMap,`${t}-chargingStops`,e.chargingStops,!1),tollRoads:new j(this.mapLibreMap,`${t}-tollRoads`,e.tollRoads,!1),tunnels:new j(this.mapLibreMap,`${t}-tunnels`,e.tunnels,!1),vehicleRestricted:new j(this.mapLibreMap,`${t}-vehicleRestricted`,e.vehicleRestricted,!1),instructionLines:new j(this.mapLibreMap,`${t}-instructionLines`,e.instructionLines,!1),instructionArrows:new j(this.mapLibreMap,`${t}-instructionArrows`,e.instructionArrows,!1),summaryBubbles:new j(this.mapLibreMap,`${t}-summaryBubbles`,e.summaryBubbles,!1)}}_initSourcesWithLayers(t,i){i||(e.lastInstanceIndex++,this.instanceIndex=e.lastInstanceIndex,this.layerIDPrefix=Fe("routes",this.instanceIndex)),this.layersSpecs=xr(Ur(t,this.layerIDPrefix,this.instanceIndex).layers,this.layerIDPrefix);const r=this.createSourcesWithLayers(this.layersSpecs);Q(Object.values(r).flatMap(e=>e._layerSpecs),this.mapLibreMap);const a={fillColor:t?.theme?.mainColor,...t?.waypoints?.icon?.style},s={pixelRatio:2},o=Fe(_r,this.instanceIndex),n=Fe(mr,this.instanceIndex),l=Fe(fr,this.instanceIndex),c=Fe(gr,this.instanceIndex),h=Fe(Pi,this.instanceIndex),u=Fe(Yi,this.instanceIndex),d=Fe($i,this.instanceIndex),p=Fe(rr,this.instanceIndex),y=Fe(ar,this.instanceIndex),_=Fe(sr,this.instanceIndex),m=Fe(or,this.instanceIndex);this.addImageIfNotExisting(o,Mr(a),s),this.addImageIfNotExisting(n,wr(void 0,a),s),this.addImageIfNotExisting(l,(()=>{if(U())return F(H('<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(c,Dr(a),s),this.addImageIfNotExisting(h,k,s),this.addImageIfNotExisting(u,Or("white"),Cr),this.addImageIfNotExisting(d,Or("#EEEEEE"),Cr),this.addImageIfNotExisting(p,vr(Ni),s),this.addImageIfNotExisting(y,vr(Ti),s),this.addImageIfNotExisting(_,vr(Si),s),this.addImageIfNotExisting(m,vr(bi),s);for(const e of t?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(e.id,e.image,{pixelRatio:e.pixelRatio??2});return r}_applyConfig(e){const i=Ur(e,this.layerIDPrefix,this.instanceIndex);if(this.config){const e=xr(i.layers,this.layerIDPrefix);Object.keys(e).forEach(t=>{const i=t;((e,t,i,r)=>{const a=e.reduce((e,t)=>({...e,[t.id]:t}),{}),s=t.reduce((e,t)=>({...e,[t.id]:t}),{}),o=[],n=[],l=[],c=[];Object.keys(a).forEach(e=>{s[e]?(l.push(a[e]),c.push(s[e])):o.push(e)}),Object.keys(s).forEach(e=>{a[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={...a[e],source:i.source.id};h.push(t)}),i._updateSourceAndLayerIDs(),J(l,c,r)})(e[i],this.layersSpecs[i],this.sourcesWithLayers[i],this.mapLibreMap)});const t=Object.values(this.sourcesWithLayers);Q(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};ie("add-or-update",Fe(_r,this.instanceIndex),Mr(t),this.mapLibreMap,i),ie("add-or-update",Fe(mr,this.instanceIndex),wr(void 0,t),this.mapLibreMap,i),ie("add-or-update",Fe(gr,this.instanceIndex),Dr(t),this.mapLibreMap,i)}const r=!1!==i.summaryBubbles?.visible,a=!t(this.config?.summaryBubbles?.visible,i.summaryBubbles?.visible),s=!t(this.config?.displayUnits,i.displayUnits),o=this.sourcesWithLayers.summaryBubbles.shownFeatures.features.length>0,n=this.sourcesWithLayers.mainLines.shownFeatures.features.length>0;return!r&&a?this.sourcesWithLayers.summaryBubbles.clear():r&&(a&&n||s&&o)&&this.sourcesWithLayers.summaryBubbles.show(jr(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){ie("if-not-in-sprite",e,t,this.mapLibreMap,i)}async showRoutes(e,t){const i=zr(e,t?.selectedIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(i),this.sourcesWithLayers.vehicleRestricted.show(Yr(i,"vehicleRestricted")),this.sourcesWithLayers.incidents.show(Yr(i,"traffic",Gr)),this.sourcesWithLayers.chargingStops.show(Wr(i,this.config)),this.sourcesWithLayers.ferries.show(Yr(i,"ferry")),this.sourcesWithLayers.tunnels.show(Yr(i,"tunnel")),this.sourcesWithLayers.tollRoads.show(Yr(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:u(),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:u(),routeIndex:t,routeState:e.properties.routeState,lastPointBearingDegrees:g(r[0],r[1])}}})||[])}))(i)),!1!==this.config?.summaryBubbles?.visible?this.sourcesWithLayers.summaryBubbles.show(jr(i,this.config?.displayUnits)):this.sourcesWithLayers.summaryBubbles.clear()}async clearRoutes(){await this.waitUntilModuleReady();for(const e of Object.keys(this.sourcesWithLayers))"waypoints"!==e&&this.sourcesWithLayers[e].clear()}async selectRoute(e){const t=zr(this.sourcesWithLayers.mainLines.shownFeatures,e);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(t),this.sourcesWithLayers.chargingStops.show(Wr(t,this.config)),$r(t,this.sourcesWithLayers.vehicleRestricted),$r(t,this.sourcesWithLayers.incidents),$r(t,this.sourcesWithLayers.ferries),$r(t,this.sourcesWithLayers.tollRoads),$r(t,this.sourcesWithLayers.tunnels),$r(t,this.sourcesWithLayers.instructionLines),$r(t,this.sourcesWithLayers.instructionArrows),$r(t,this.sourcesWithLayers.summaryBubbles)}async showWaypoints(e){const t=Array.isArray(e)?Vr(e,this.config?.waypoints,this.instanceIndex):Vr(e.features,this.config?.waypoints,this.instanceIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.show(t)}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{mainLines:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.mainLines,this.config?.events),waypoints:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.waypoints,this.config?.events),chargingStops:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.chargingStops,this.config?.events),summaryBubbles:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.summaryBubbles,this.config?.events),incidents:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents,this.config?.events),vehicleRestricted:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vehicleRestricted,this.config?.events),ferries:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.ferries,this.config?.events),tollRoads:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tollRoads,this.config?.events),tunnels:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tunnels,this.config?.events),instructionLines:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.instructionLines,this.config?.events)}}getLayerToRenderLinesUnder(){return ye.lowestLabel}},Xr="standardLight",Zr={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"}},Jr=e=>`\${baseURL}/maps/orbis/assets/styles/\${version}/style.json?&apiVersion=1&key=\${apiKey}&map=${e}`,Qr={standardLight:Jr("basic_street-light"),standardDark:Jr("basic_street-dark"),drivingLight:Jr("basic_street-light-driving"),drivingDark:Jr("basic_street-dark-driving"),monoLight:Jr("basic_mono-light"),monoDark:Jr("basic_mono-dark"),satellite:Jr("basic_street-satellite")},ea=(e,t,i)=>{const r=e.id??"standardLight",a=new URL(Qr[r].replace("${baseURL}",t).replace("${version}",e.version??"0.6.0-0").replace("${apiKey}",i));for(const s of e.include??Kt)a.searchParams.append(s,Zr[r][s]);return a.toString()},ta=e=>{const t=e.style,i=e.commonBaseURL,r=e.apiKey;return"string"==typeof t?ea({id:t},i,r):"standard"===t?.type?ea(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"):i.searchParams.set("key",t),i.toString()})(t.url,r):"custom"===t?.type&&t?.json?t.json:ea({id:Xr},i,r)},ia=class{constructor(e){var i,r;this.mapReady=!1,this.styleChangeHandlers=[],this.setStyle=(e,i={keepState:!0})=>{this.mapReady=!1;for(const t of this.styleChangeHandlers)try{t.onStyleAboutToChange?.()}catch(a){console.error(a)}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=ae(r),this.mapLibreMap.once("styledata",()=>{!this.mapReady&&t(r,this._params.style)&&this.handleStyleData(i.keepState||!0)}),this.mapLibreMap.setStyle(ta(this._params),{validate:!1})},this.getStyle=()=>this._params.style,this._params=m(e),void 0===this._params.style&&(this._params={...this._params,style:Xr}),this.styleLightDarkTheme=ae(this._params.style),this.ensureMapLibreCSSLoaded(),O(4),this.mapLibreMap=new S({validateStyle:!1,maxTileCacheZoomLevels:22,cancelPendingTileRequestsWhileZooming:!1,...(i=this._params).mapLibre,style:ta(i),attributionControl:{compact:!1},transformRequest:(r=i,(e,t)=>{if(e.includes("tomtom.com")){if("Image"===t)return{url:e};const i=new URL(e);return i.pathname.includes("incidents")?i.searchParams.set("tags",`${M.join(",")}`):i.pathname.includes("flow")&&i.searchParams.set("tags",`${v.join(",")}`),{url:i.toString(),headers:{...d(r)}}}return{url:e}})}),this.mapLibreMap.once("styledata",()=>{this.handleStyleData(!1)}),this._eventsProxy=new pe(this.mapLibreMap,this._params?.events),this.loadRTLTextPlugin()}loadRTLTextPlugin(){setTimeout(()=>{["deferred","loaded"].includes(b())||N("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@${C}/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 Y(this.mapLibreMap,[ge,Ae,me]))this.mapLibreMap.setLayoutProperty(i.id,"visibility","none",{validate:!1});if((async(e,t)=>{t.setSprite(`${e.commonBaseURL}/maps/orbis/assets/sprites/2.*/sprite?key=${e.apiKey}&poi=poi_${ae(e.style)}&apiVersion=1&apiChannel=preview`,{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)}},ra={congestion:{low:"#2dc653",mid:"#f5a623",high:"#e03030"},thermal:{low:"#2196F3",mid:"#FF9800",high:"#F44336"},monochrome:{low:"#e0e0e0",mid:"#888888",high:"#1a1a1a"}},aa="congestion",sa={congestionLevel:{min:0,mid:50,max:100},speed:{min:0,mid:50,max:120},travelTime:{min:0,mid:10,max:20}},oa={congestionLevel:50,speed:40,travelTime:200};function na(e,t=aa){const{min:i,mid:r,max:a}=sa[e],{low:s,mid:o,high:n}=ra[t];return"speed"===e?["interpolate",["linear"],["get",e],i,n,r,o,a,s]:["interpolate",["linear"],["get",e],i,s,r,o,a,n]}function la(e){const t=oa[e];return"speed"===e?["max",10,["*",["-",sa.speed.max,["coalesce",["get","speed"],0]],t]]:["max",10,["*",["coalesce",["get",e],0],t]]}var ca={type:"heatmap",paint:{"heatmap-weight":["interpolate",["linear"],["get","congestionLevel"],0,0,100,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],6,.5,12,1.5],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(45,198,83,0)",.3,ra.congestion.low,.6,ra.congestion.mid,1,ra.congestion.high],"heatmap-radius":["interpolate",["linear"],["zoom"],6,15,12,30],"heatmap-opacity":.8}},ha={type:"fill",paint:{"fill-color":na("congestionLevel"),"fill-opacity":.6}},ua={type:"fill-extrusion",paint:{"fill-extrusion-color":na("congestionLevel"),"fill-extrusion-height":la("congestionLevel"),"fill-extrusion-base":0,"fill-extrusion-opacity":.75}};function da(e){return{...ha,id:e,beforeID:ye.lowestLabel}}function pa(e){return{...ua,id:e}}function ya(e){return{type:"FeatureCollection",features:e.map((e,t)=>{const[i,r]=e.tileCentre,a=`tile-${t}-${i}-${r}`;return{type:"Feature",id:a,geometry:{type:"Point",coordinates:[i,r]},properties:{id:a,speed:e.speed??0,freeFlowSpeed:e.freeFlowSpeed??0,congestionLevel:e.congestionLevel??0,travelTime:e.travelTime??0,networkLength:e.networkLength??0}}})}}function _a(e,t=.5){if(0===e.length)return{type:"FeatureCollection",features:[]};let i=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const l of e){const[e,t]=l.tileCentre;e<i&&(i=e),t<r&&(r=t),e>a&&(a=e),t>s&&(s=t)}const o=R([i,r,a,s],t,{units:"kilometers"}),n=[];for(let l=0;l<o.features.length;l++){const t=o.features[l];let i=0,r=0,a=0,s=0,c=0;for(const o of e){const[e,n]=o.tileCentre;A(T([e,n]),t)&&(i+=o.congestionLevel??0,r+=o.speed??0,a+=o.freeFlowSpeed??0,s+=o.travelTime??0,c++)}if(0===c)continue;const h=`hex-${l}`;n.push({type:"Feature",id:h,geometry:t.geometry,properties:{id:h,congestionLevel:Math.round(i/c),speed:Math.round(r/c),freeFlowSpeed:Math.round(a/c),travelTime:Math.round(s/c*10)/10}})}return{type:"FeatureCollection",features:n}}var ma=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.heatmapLayerId="",this.hexFillLayerId="",this.hexExtrusionLayerId="",this.lastAnalytics=null}get mode(){return this.config?.mode??"hexgrid"}get metric(){return this.config?.metric??"congestionLevel"}get colorScheme(){return this.config?.colorScheme??"congestion"}_initSourcesWithLayers(t,i){i||e.lastInstanceIndex++;const r=e.lastInstanceIndex,a=`area-analytics-heatmap-${r}`,s=`area-analytics-hexgrid-${r}`;return this.heatmapLayerId=`${a}-layer`,this.hexFillLayerId=`${s}-fill`,this.hexExtrusionLayerId=`${s}-extrusion`,{heatmap:new j(this.mapLibreMap,a,[(o=this.heatmapLayerId,{...ca,id:o,beforeID:ye.lowestLabel})]),hexgrid:new j(this.mapLibreMap,s,[da(this.hexFillLayerId),pa(this.hexExtrusionLayerId)])};var o}_applyConfig(e){return e?.metric&&this.applyMetricToLayers(e.metric),!1===e?.visible&&this.setVisible(!1),this.applyModeVisibility(),e}restoreDataAndConfigImpl(){const e=this.lastAnalytics;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),e&&this.show(e)}async show(e){await this.waitUntilModuleReady(),this.lastAnalytics=e;const t=(e.features[0]?.properties)?.tiledData?.tiles??[];this.sourcesWithLayers.heatmap.show(ya(t)),this.sourcesWithLayers.hexgrid.show(_a(t)),this.applyModeVisibility()}async clear(){await this.waitUntilModuleReady(),this.lastAnalytics=null,this.sourcesWithLayers.heatmap.clear(),this.sourcesWithLayers.hexgrid.clear()}setMode(e){e!==this.mode&&(this.config={...this.config,mode:e},this.applyModeVisibility())}setMetric(e){e!==this.metric&&(this.config={...this.config,metric:e},this.applyMetricToLayers(e))}setColorScheme(e){e!==this.colorScheme&&(this.config={...this.config,colorScheme:e},this.applyMetricToLayers(this.metric))}setVisible(e){this.config={...this.config,visible:e},e?this.applyModeVisibility():(this.sourcesWithLayers.heatmap.setLayersVisible(!1),this.sourcesWithLayers.hexgrid.setLayersVisible(!1))}isVisible(){return this.sourcesWithLayers.heatmap.isAnyLayerVisible()||this.sourcesWithLayers.hexgrid.isAnyLayerVisible()}getShown(){return{heatmap:this.sourcesWithLayers.heatmap.shownFeatures,hexgrid:this.sourcesWithLayers.hexgrid.shownFeatures}}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hexgrid,this.config?.events)}applyModeVisibility(){if(!1===this.config?.visible)return this.sourcesWithLayers.heatmap.setLayersVisible(!1),void this.sourcesWithLayers.hexgrid.setLayersVisible(!1);const e=this.sourcesWithLayers.heatmap.shownFeatures.features.length>0,t=this.sourcesWithLayers.hexgrid.shownFeatures.features.length>0;this.sourcesWithLayers.heatmap.setLayersVisible("heatmap"===this.mode&&e),this.sourcesWithLayers.hexgrid.setLayersVisible("hexgrid"===this.mode&&t)}applyMetricToLayers(e){const t=na(e,this.colorScheme),i=la(e);this.mapLibreMap.setPaintProperty(this.hexFillLayerId,"fill-color",t,{validate:!1}),this.mapLibreMap.setPaintProperty(this.hexExtrusionLayerId,"fill-extrusion-color",t,{validate:!1}),this.mapLibreMap.setPaintProperty(this.hexExtrusionLayerId,"fill-extrusion-height",i,{validate:!1});const{min:r,max:a}=sa[e];this.mapLibreMap.setPaintProperty(this.heatmapLayerId,"heatmap-weight",["interpolate",["linear"],["get",e],r,0,a,1],{validate:!1}),this.mapLibreMap.setPaintProperty(this.heatmapLayerId,"heatmap-color",function(e=aa){const{low:t,mid:i,high:r}=ra[e];return["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.3,t,.6,i,1,r]}(this.colorScheme),{validate:!1})}},fa=(e,t)=>e.length?1===e.length?{expression:e[0],legacy:t[0]}:{expression:["all",...e],legacy:["all",...t]}:null,ga=(e,t,i)=>{e&&(t.push(e.expression),i.push(e.legacy))},Aa=(e,t,i,r)=>{e&&ga(ft(t,e),i,r)},Ia=(e,t,i)=>{Aa(e.roadCategories,"road_category",t,i),Aa(e.roadSubCategories,"road_subcategory",t,i)},Ea=e=>{const t=[],i=[];return Ia(e,t,i),e.incidentCategories&&ga(ft("icon_category_0",e.incidentCategories,e=>D[e]),t,i),e.magnitudes&&ga(ft("magnitude_of_delay",e.magnitudes,e=>_.indexOf(e)),t,i),e.delays&&ga((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 fa(t,i)})(e.delays),t,i),fa(t,i)},Ra=e=>e?.any?.length?yt(e.any.map(Ea).filter(e=>!i(e))):null,La=e=>{const t=[],i=[];if(Ia(e,t,i),e.showRoadClosures){const r="only"===e.showRoadClosures?"==":"!=";t.push([r,["get","road_closure"],!0]),i.push([r,"road_closure",!0])}return fa(t,i)},Ta=(e,t,i,r)=>{for(const a of t)i.setFilter(a.id,e?_t(e,r[a.id]):r[a.id])},Sa=class e extends se{static async get(t,i){return await q(t),await te(t,Ae,"trafficFlow"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(Ae);if(!t)throw x(`init ${e.name} with source ID ${Ae}`);this.originalFilters={};for(const e of this.getLayers())this.originalFilters[e.id]=e.filter;return{trafficFlow:new $(this.mapLibreMap,t)}}_applyConfig(e){return this.setVisible(e?.visible??!1),this._filter(e?.filters,!1),e}getLayers(){return Y(this.tomtomMap.mapLibreMap,[Ae])}filter(e){this._filter(e)}_filter(e,t=!0){if(this.tomtomMap.mapReady)if(e?.any?.length){const t=(r=e,r?.any?.length?yt(r.any.map(La).filter(e=>!i(e))):null);t&&Ta(t,this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&Ta(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);var r;t&&(this.config=a({...this.config,filters:e},i))}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficFlow.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.trafficFlow.isAnyLayerVisible()}getShown(){return{trafficFlow:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.trafficFlow.sourceAndLayerIDs.layerIDs,validate:!1}).map(w)}}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficFlow,this.config?.events,w)}};function ba(e){const t=e.replace("#","");return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function Na(e,t,i){return`rgb(${Math.round(e[0]+(t[0]-e[0])*i)},${Math.round(e[1]+(t[1]-e[1])*i)},${Math.round(e[2]+(t[2]-e[2])*i)})`}function Oa(e,t="congestion"){const i=Math.max(0,Math.min(100,e)),{low:r,mid:a,high:s}=ra[t],o=ba(r),n=ba(a),l=ba(s);return i<=50?Na(o,n,i/50):Na(n,l,(i-50)/50)}var Ca=20;function va(e,t){const i=/* @__PURE__ */new Date(`${e}T00:00:00`);return i.setDate(i.getDate()+t),`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function wa(e){/* @__PURE__ */
|
|
2
|
-
return new Date(`${e}T00:00:00`).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function
|
|
1
|
+
import{isEmpty as e,isEqual as t,isNil as i,omit as r,omitBy as a,remove as s}from"lodash-es";import{TomTomConfig as o,bboxCenter as n,bboxFromCoordsArray as l,formatDistance as c,formatDuration as h,generateId as u,generateTomTomHeaders as d,getPosition as p,iconToTrafficIncidentCategory as y,indexedMagnitudes as _,mergeFromGlobal as m,poiCategoriesToID as f}from"@tomtom-org/maps-sdk/core";import{bearing as g,booleanPointInPolygon as A,difference as I,featureCollection as E,hexGrid as R,mask as L,point as S}from"@turf/turf";import{Map as T,getRTLTextPluginStatus as b,setRTLTextPlugin as N,setWorkerCount as O}from"maplibre-gl";import{version as C}from"maplibre-gl/package.json";var v=["road_category","road_subcategory","relative_speed","left_hand_traffic","road_closure","absolute_speed","part_of_two_way_road","openlr","display_class"],w=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}}}},M=["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"],D={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},P=e=>{const{properties:t}=e;return{id:e.id,type:e.type,geometry:e.geometry,properties:{id:t.id??u(),description:t?.description_0??"",category:y(t?.icon_category_0),magnitudeOfDelay:_[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}}}},x=e=>/* @__PURE__ */new Error(`Trying to ${e} while it is not in the map style. Did you exclude it when loading the map?`),U=()=>"undefined"!=typeof document&&"undefined"!=typeof DOMParser&&"undefined"!=typeof btoa,F=e=>{if(!U())return;const t=document.createElement("img");return t.src=`data:image/svg+xml;base64,${btoa((new XMLSerializer).serializeToString(e))}`,t},H=e=>(new DOMParser).parseFromString(e,"image/svg+xml").documentElement,W=e=>{const t=H('<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');return e?.fillColor&&t.querySelector("#background")?.setAttribute("fill",e.fillColor),e?.outlineColor&&t.querySelector("#outline")?.setAttribute("fill",e.outlineColor),void 0!==e?.outlineOpacity&&t.querySelector("#outline")?.setAttribute("fill-opacity",e.outlineOpacity.toString()),t};var k,G=e=>(function(e){if(i(e))throw new Error(`${e} must not be null/undefined. Something went wrong with its initialization.`)}(e),e),B=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))}},V=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"none"!==this.map.getLayoutProperty(e.id,"visibility")}setLayersVisible(e,t){for(const i of this.getLayerSpecs(t))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])}},Y=(e,t)=>e.getStyle().layers.filter(e=>t.includes(e?.source)),$=class extends V{constructor(e,t,i){let r=Y(e,[t.id]);i&&(r=r.filter(i)),super(e,new B(t.id,e.getStyle().sources[t.id],t),r)}},z=class extends V{constructor(e,t,i,r){super(e,new B(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))}},K={type:"FeatureCollection",features:[]},j=class extends z{constructor(e,t,i,r=!0){super(e,t,{type:"geojson",data:K,promoteId:"id"},i),this.shownFeatures=K,this.ensureAddedToMapWithVisibility(!1,r)}show(e){this.shownFeatures=e,G(this.source.runtimeSource).setData(e),this.setLayersVisible(!!e.features.length)}clear(){this.show(K)}findFeature(e){return"index"in e?this.shownFeatures.features[e.index]:"id"in e?this.shownFeatures.features.find(t=>t.id===e.id):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)}cleanEventState(e){const t=this.findFeature(e);t?.properties?.eventState&&(delete t?.properties?.eventState,!1!==e?.show&&this.show(this.shownFeatures))}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)}},q=async e=>{e.mapReady||(await e.mapLibreMap.once("styledata"),await q(e))},X=e=>{for(const i of e)if(i&&Object.keys(i.properties).length)for(const e in i.properties)if("string"==typeof i.properties[e])try{i.properties[e]=JSON.parse(i.properties[e])}catch(t){}},Z=(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 a of Object.keys(t.layout??[]))e.layout?.[a]||i.setLayoutProperty(r,a,void 0,{validate:!1});for(const a of Object.keys(t.paint??[]))e.paint?.[a]||i.setPaintProperty(r,a,void 0,{validate:!1});for(const[a,s]of Object.entries(e.paint??[]))i.setPaintProperty(r,a,s,{validate:!1});for(const[a,s]of Object.entries(e.layout??[]))i.setLayoutProperty(r,a,s,{validate:!1})},J=(e,t,i)=>{e.forEach((e,r)=>Z(e,t[r],i))},Q=(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)},a={};for(e.forEach(e=>{e.beforeID?i.has(e.beforeID)||t.getLayer(e.beforeID)?(i.add(e.beforeID),r(e)):a[e.beforeID]?a[e.beforeID].push(e):a[e.beforeID]=[e]:r(e)});Object.keys(a).length>0;){const e=Object.keys(a).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(a))}`);e.forEach(e=>{a[e].forEach(e=>r(e)),delete a[e]})}},ee=(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)}},te=async(e,t,i)=>{if(!e.mapLibreMap.getSource(t)){const r=e.mapLibreMap;r.isStyleLoaded()||await r.once("idle"),e.setStyle(ee(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 Y(r,[t]))r.setLayoutProperty(e.id,"visibility","none",{validate:!1});await r.once("styledata")}},ie=async(e,t,i,r,a)=>{if(!i)return void console.warn(`addOrUpdateImage called with empty image for ID ${t}`);const s=i=>{const s=r.hasImage(t);s&&"add-or-update"==e?r.updateImage(t,i):s||r.addImage(t,i,a)},o=e=>{e.complete?e.naturalWidth>0?s(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>s(e),e.onerror=()=>console.warn(`Failed to load image for ID ${t}`))};"string"==typeof i?i.includes("<svg")?o(F(H(i))):s((await r.loadImage(i)).data):o(i)},re=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},ae=e=>{if("string"==typeof e)return re(e);const t=e;return t?.id?re(t.id):"light"},se=class{constructor(e,t,i){this._initializing=!0,this.moduleReady=!1,this.sourceType=e,this.tomtomMap=t,this.eventsProxy=t._eventsProxy,this.mapLibreMap=t.mapLibreMap,this.initSourcesWithLayers(i),this.applyConfig(i),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 q(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)}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}},oe=class{constructor(e,t,i,r){this.eventProxy=e,this.sourceWithLayers=t,this.config=i,this.mapping=r}on(e,t){if(this.mapping){const i=this.mapping;this.eventProxy.addEventHandler(this.sourceWithLayers,(e,...r)=>t(i(e),...r),e,this.config)}else this.eventProxy.addEventHandler(this.sourceWithLayers,t,e,this.config)}off(e){this.eventProxy.remove(this.sourceWithLayers,e)}},ne=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 a=e.source.id;this.handlers[a]||(this.handlers[a]={[i]:[]}),this.handlers[a][i]??=[],this.handlers[a][i]?.push({sourceWithLayers:e,layerIDs:e._layerSpecs.map(e=>e.id),fn:t,config:r})}remove(t,i){const r=this.handlers[t.source.id]?.[i];r&&(s(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)s(this.interactiveLayerIDs,t=>e.id===t)}removeAll(){this.interactiveLayerIDs=[],this.handlers={}}hasSourceID(e){return!!this.handlers[e]}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)}}},le=e=>"click"===e||"contextmenu"===e,ce=(e,t,i,a="updateInProps")=>{const{feature:s,index:o}=((e,t)=>{for(let i=0;i<e.length;i++){const r=e[i];if(r.id===t)return{feature:r,index:i}}})(i,t)||{};if(s&&(!le(s.properties?.eventState)||le(e))){const t={...s,properties:"updateInProps"===a?{...s?.properties,eventState:e}:r(s?.properties,"eventState")};return i.splice(o,1,t),o}},he=(e,t,r)=>{const a=[...r.shownFeatures.features];i(ce(e,t.id,a,"removeFromProps"))||r.show({...r.shownFeatures,features:a})},ue=(e,t,i,r,a)=>{if(t&&r instanceof j){const n=[...r.shownFeatures.features],l=ce(e,t.id,n);return!i||(o=t,(s=i)&&o&&s.id===o.id)||(a===r?ce(e,i.id,n,"removeFromProps"):a instanceof j&&he(e,i,a)),r.show({...r.shownFeatures,features:n}),{feature:n[l],index:l}}var s,o;return i&&a instanceof j&&he(e,i,a),{feature:t}},de={precisionMode:"box",paddingBoxPx:5,cursorOnHover:"pointer",cursorOnMouseDown:"grabbing",cursorOnMap:"default",longHoverDelayAfterMapMoveMS:800,longHoverDelayOnStillMapMS:300},pe=class extends ne{constructor(e,t={}){super(),this.enabled=!0,this.firstDelayedHoverSinceMapMove=!0,this.map=e,this.mapCanvas=e.getCanvas(),this.config={...de,...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()}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){const e=ue("long-hover",this.hoveringFeature,void 0,this.hoveringSourceWithLayers,void 0);this.findHandlers(["long-hover"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id).forEach(t=>t.fn(e.feature,this.hoveringLngLat,this.hoveringFeatures,this.hoveringSourceWithLayers))}}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),X(this.hoveringFeatures);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 a=this.hoveringFeature;this.hoveringFeature=t;const s=this.hoveringSourceWithLayers,o=this.findHandlers(["hover","hover-move","long-hover","click","contextmenu"],t?.source,t?.layer.id)?.[0];if(this.hoveringSourceWithLayers=o?.sourceWithLayers,i){this.updateHoverCursor(o?.config);const i=ue("hover",this.hoveringFeature,a,this.hoveringSourceWithLayers,s),r=this.findHandlers(["hover"],t?.source,t?.layer.id);for(const t of r)t.fn(i.feature,e.lngLat,this.hoveringFeatures,this.hoveringSourceWithLayers)}if(r){const t=this.findHandlers(["hover-move"],this.hoveringFeature?.source,this.hoveringFeature?.layer.id);for(const i of t)i.fn(this.hoveringFeature,e.lngLat,this.hoveringFeatures,this.hoveringSourceWithLayers)}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);X(i);const r=this.lastClickedFeature;this.lastClickedFeature=i[0];const a=this.lastClickedSourceWithLayers,s=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);this.lastClickedSourceWithLayers=s?.[0]?.sourceWithLayers;const o=ue(e,this.lastClickedFeature,r,this.lastClickedSourceWithLayers,a);for(const n of s)n.fn(o.feature,t.lngLat,i,this.lastClickedSourceWithLayers)}},ye={country:"Places - Country name",lowestPlaceLabel:"Places - Village / Hamlet",poi:"POI",lowestLabel:"Borders - Treaty label",lowestRoadLine:"Tunnel - Railway outline",lowestBuilding:"Buildings - Underground"},_e="vectorTiles",me="hillshade",fe="vectorTiles",ge="vectorTilesIncidents",Ae="vectorTilesFlow",Ie=["POI","POI - Micro"],Ee={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"},Re={...Ee,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"},Le=e=>Re[e],Se="Noto-Bold",Te=.8,be=["interpolate",["linear"],["zoom"],8,.6,22,Te],Ne="title",Oe="iconID",Ce=.7,ve=1.4,we="default_place",Me={"icon-image":["get",Oe],"icon-anchor":"bottom","icon-size":be,"icon-allow-overlap":!0,"icon-padding":0},De={"icon-translate":[0,5],"icon-translate-anchor":"viewport"},Pe={"text-optional":!0,"text-font":[Se],"text-field":["get",Ne],"text-justify":"auto","text-variable-anchor":["top","left","right"],"text-variable-anchor-offset":["top",[0,Ce],"left",[ve,-1.4],"right",[-1.4,-1.4]],"text-size":["interpolate",["linear"],["zoom"],10,14,18,16],"text-padding":5},xe={"text-color":"#333333","text-halo-color":"#FFFFFF","text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"},Ue={type:"symbol",layout:{...Me,...Pe},paint:{...De,...xe}},Fe=(e,t)=>`${e}-${t}`,He=(e,t)=>{if(!e)return;const i=(e=>{try{if("string"==typeof e){if(e.includes("<svg")){const t=H(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"),a=t.getAttribute("height");if(r&&a)return{width:Number.parseFloat(r),height:Number.parseFloat(a)}}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"===t,a=r?54:140,s=r?54:120;return{heightScale:i.height/a,widthScale:i.width/s}},We=e=>Boolean(e&&"availability"in e&&e.availability),ke=e=>"ELECTRIC_VEHICLE_STATION"===e.properties.poi?.categories?.[0]&&We(e.properties.chargingPark),Ge=e=>{const t=e.properties.chargingPark;if(We(t)){const e=t.availability.chargingPointAvailability,i=e.statusCounts.Available??0;return{availableCount:i,totalCount:e.count,ratio:i/e.count}}},Be=(e,t)=>`${e}/${t}`,Ve=e=>Ge(e)?.ratio??0,Ye=e=>["case",[">=",["get","evAvailabilityRatio"],e?.threshold??0],"green","red"],$e=e=>Math.round(1e4*e)/1e4,ze=(e,t,i,r)=>{const a=void 0!==r;return{top:a?[0,r]:[0,$e(e)],left:a?[r,$e(i)]:[$e(t),$e(i)],right:a?[-r,$e(i)]:[-$e(t),$e(i)]}},Ke=(e,t,i,r)=>{const a=(e=>{if(!e)return Te;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 Te})(e)/Te,s="base-map"===i||"circle"===i;if(s&&void 0!==r)return{"text-offset":[r,r]};const o=ve*a,n=ze(Ce*a,o,s?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=(s?1.4:Ce)*u.heightScale,t=ve*u.widthScale,i=ze(e,t,s?0:-t,r);c.push(["==",["get",Oe],h],["literal",["top",i.top,"left",i.left,"right",i.right]])}return c.push(["literal",l]),{"text-variable-anchor-offset":c}},je=(e,t,i,r,a)=>{const s=t?.text,o=t?.layers?.[i],n=a&&a.size>0,l={...e.layout},c=n||void 0!==s?.offset||"circle"===t?.theme;c&&(delete l["text-offset"],delete l["text-variable-anchor-offset"],delete l["text-radial-offset"]);const h={...l,...o?.layout,...s?.size&&{"text-size":s.size},...s?.font&&{"text-font":s.font},"text-field":r};if(c){const e=h["icon-size"],i=a??/* @__PURE__ */new Map;return{...h,...Ke(e,i,t?.theme,s?.offset)}}return h},qe=(e,t,i,r)=>{const a=t?.text,s=t?.layers?.[i],{textColor:o,haloColor:n}=(e=>({textColor:"dark"===e?"#FFFFFF":"#333333",haloColor:"dark"===e?"#333333":"#FFFFFF"}))(r);return{...e.paint,...!a?.color&&{"text-color":o},...!a?.haloColor&&{"text-halo-color":n},...a?.color&&{"text-color":a.color},...a?.haloColor&&{"text-halo-color":a.haloColor},...a?.haloWidth&&{"text-halo-width":a.haloWidth},...s?.paint}},Xe=["in",["get","eventState"],["literal",["click","contextmenu"]]],Ze=e=>JSON.parse(JSON.stringify(e)?.replaceAll("name",Ne)),Je=["has","eventState"],Qe="#3f9cd9",et={...Ue,filter:["!",Je]},tt={...Ue,filter:Je,layout:{...Ue.layout,"icon-size":["interpolate",["linear"],["zoom"],8,.8,22,1],"text-allow-overlap":!0},paint:{...Ue.paint,"text-color":Qe}},it=(e,t,i,r,a)=>{const s=t?.text,o=t?.layers?.[i],n=((e,t)=>t?["case",["has","evAvailabilityText"],["format",["get",Ne],{},"\n",{},["get","evAvailabilityText"],{"font-scale":1.1,"text-color":Ye(e?.evAvailability)}],["get",Ne]]:["get",Ne])(t,!0===t?.evAvailability?.enabled),l=s?.title&&"function"!=typeof s?.title?s.title:n;return{...e,...o,layout:je(e,t,i,l,a),paint:qe(e,t,i,r)}},rt=(e,t,i,r)=>{const a=((e,t)=>{const i=/* @__PURE__ */new Map,r=e?.icon?.categoryIcons??[];for(const a of r)if(a.image){const r=He(a.image,e?.theme);if(void 0!==r){const e=Fe(a.id,t);if(i.set(e,r),a.availabilityLevel){const e=Fe(`${a.id}-${a.availabilityLevel}`,t);i.set(e,r)}}}return i})(e,r);let s,o;if("base-map"===e?.theme){const e=(e=>{const t=e.getStyle().layers.find(e=>"POI"===e.id)??{},i=t.layout?.["text-size"];return{filter:["!",Xe],type:"symbol",paint:t.paint,layout:{...t.layout,"text-field":["get",Ne],"icon-image":["get",Oe],...i&&{"text-size":Ze(i)}}}})(t);s=e,o={...e,filter:Je,layout:{...e.layout,"text-allow-overlap":!0},paint:{...e.paint,"text-color":Qe}}}else if("circle"===e?.theme){const e=(e=>{const t=(e.getStyle().layers.find(e=>"POI"===e.id)??{}).layout??{};return{...Ue,layout:{...Ue.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:{...Ue.paint,"icon-translate":[0,0]}}})(t);s={...e,filter:["!",Je]},o={...e,filter:Je,layout:{...e.layout,"text-allow-overlap":!0},paint:{...e.paint,"text-color":Qe}}}else s=et,o=tt;return{main:it(s,e,"main",i,a),selected:it(o,e,"selected",i,a),...e?.layers?.additional}},at=e=>{if(U())return F(W(e))},st=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]),ot=e=>e.properties.poi?.name??e.properties.address.freeformAddress,nt=(e,t,i)=>{if("pin"===t)return(e=>{if(e)return st.has(e)?e.toString():e.toString().substring(0,4)})(f[e])??i;{const t=Le(e);return t?`poi-${t}`:i}},lt=(e,t,i={})=>{const r=i.theme??"pin",a=Fe(we,t),s=i.icon?.mapping;if(s)return"imageID"===s.to?s.fn(e):nt(s.fn(e),r,a);const o=e.properties.poi?.categories?.[0],n=((e,t,i,r,a)=>{if(!r.evAvailability?.enabled||!ke(e))return;const s=Ve(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===s);return n?Fe(`${n.id}-${s}`,i):o||"pin"!==a?void 0:`7309-${s}`})(e,o,t,i,r);if(n)return n;const l=i.icon?.categoryIcons?.find(e=>e.id===o);return l?Fe(l.id,t):nt(o,r,a)},ct=e=>{const t=e.properties.poi?.categories?.[0];return t&&Le(t)},ht=e=>Array.isArray(e)?{type:"FeatureCollection",features:e}:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:e,ut=(e,t,i)=>{if(!0!==t?.enabled)return e;let r=!1,a=!1;for(const s of i.features)if("ELECTRIC_VEHICLE_STATION"===s.properties.poi?.categories?.[0]&&(r=!0,ke(s))){a=!0;break}return r&&!a&&console.warn("PlacesModule: evAvailability is enabled but no availability data found. Did you call getPlacesWithEVAvailability()?"),{...e,evAvailabilityText:e=>ke(e)?((e,t)=>{const i=Ge(e);return i?(t?.formatText??Be)(i.availableCount,i.totalCount):""})(e,t):"",evAvailabilityRatio:e=>ke(e)?Ve(e):0}},dt=(e,t,i={})=>{const r=ht(e),a=!0===i.evAvailability?.enabled?ut(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):ot(e),s=a?Object.fromEntries(Object.entries(a).map(([t,i])=>[t,"function"==typeof i?i(e):i])):{},o=e.id??u();return{...e,id:o,geometry:{...e.geometry,bbox:e.bbox},properties:{...e.properties,id:o,title:r,iconID:lt(e,t,i),..."base-map"===i?.theme&&{category:ct(e)},...s}}})}},pt=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(t,i){return i||(e.lastInstanceIndex++,this.instanceIndex=e.lastInstanceIndex,this.sourceID=`places-${this.instanceIndex}`,this.layerIDPrefix=this.sourceID,this.defaultPlaceIconID=Fe(we,this.instanceIndex)),this.layerSpecs=this.buildLayerSpecs(t),{places:new j(this.mapLibreMap,this.sourceID,[this.layerSpecs.main,this.layerSpecs.selected])}}buildLayerSpecs(e){const t=rt(e,this.tomtomMap.mapLibreMap,this.tomtomMap.styleLightDarkTheme,this.instanceIndex);return Object.fromEntries(Object.entries(t).map(([e,t])=>[e,{...t,id:`${this.layerIDPrefix}-${e}`}]))}_applyConfig(e){return this.updateLayersAndData(e),e}restoreDataAndConfigImpl(){const e=this.sourcesWithLayers.places.shownFeatures;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),this.show(e)}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}applyExtraFeatureProps(e){const t={...this.config,extraFeatureProps:e};this.updateData(t),this.config=t}updateLayersAndData(e){this.setupImages(e);const t=this.buildLayerSpecs(e);J([t.main,t.selected],[this.layerSpecs.main,this.layerSpecs.selected],this.mapLibreMap),this.layerSpecs=t,this.updateData(e)}setupImages(e){if(e?.icon){for(const t of e.icon.categoryIcons??[])ie("if-not-in-sprite",Fe(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&&ie("if-not-in-sprite",this.defaultPlaceIconID,e.icon.default.image.image,this.mapLibreMap,{pixelRatio:e.icon.default.image.pixelRatio??2}),e.icon.default.style&&ie("if-not-in-sprite",this.defaultPlaceIconID,at(e.icon.default.style),this.mapLibreMap,{pixelRatio:2}))}else ie("if-not-in-sprite",this.defaultPlaceIconID,at(),this.mapLibreMap,{pixelRatio:2})}updateData(e){this.sourcesWithLayers.places.source.runtimeSource?.setData(dt(this.sourcesWithLayers.places.shownFeatures,this.instanceIndex,e))}async show(e){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.show(dt(e,this.instanceIndex,this.config))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.clear()}getShown(){return{places:this.sourcesWithLayers.places.shownFeatures}}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 oe(this.eventsProxy,this.sourcesWithLayers.places,this.config?.events)}},yt=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(!yt(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}},_t=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,mt=(e,t)=>{return t?["all",e[(i=t,yt(i)?"expression":"legacy")],t]:e.expression;var i},ft=(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]}},gt=(e,t,i)=>ft(e,t.show,i?t.values.map(i):t.values),At={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"]},It=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}}},Et=e=>{const t=[];return e.forEach(e=>{e in At?t.push(...At[e].map(Le)):t.push(Le(e))}),[...new Set(t)]},Rt=class e extends se{static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(_e);if(!t)throw x(`init ${e.name} with source ID ${_e}`);const i=new $(this.mapLibreMap,t,e=>Ie.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):this._initializing||this.isVisible()||this.setVisible(!0),this.filterCategories(e?.filters?.categories),e}isVisible(){return this.sourcesWithLayers.poi.isAnyLayerVisible()}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.poi.setLayersVisible(e)}filterCategories(e){if(e){if(this.tomtomMap.mapReady){const t=ft("category",e.show,Et(e.values));this.mapLibreMap.setFilter("POI",mt(t,this.originalFilter))}this.config={...this.config,filters:{categories:e}}}else this.categoriesFilter&&(this.config={...this.config,filters:{categories:{show:"all_except",values:[]}}},this.tomtomMap.mapReady&&this.mapLibreMap.setFilter("POI",this.originalFilter));this.categoriesFilter=e}getShown(){return{poi:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.poi.sourceAndLayerIDs.layerIDs,validate:!1}).map(It)}}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.poi,this.config?.events,It)}},Lt={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"]}},St=(e,t)=>{const i=Lt[e];return i.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&i.layerTypes.includes(t.type)},Tt=e=>t=>(!e||((e,t)=>{const i=t?.mode,r=t?.names;if(i&&r?.length){if("include"===i)return r.some(t=>St(t,e));if("exclude"===i)return!r.some(t=>St(t,e))}return!0})(t,e))&&!Ie.includes(t.id),bt=class e extends se{static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(t){const i=this.mapLibreMap.getSource(fe);if(!i)throw x(`init ${e.name} with source ID ${fe}`);return{vectorTiles:new $(this.mapLibreMap,i,Tt(t?.layerGroupsFilter))}}_applyConfig(e){return e&&!i(e.visible)?this.setVisible(e.visible):this._initializing||this.isVisible()||this.setVisible(!0),e?.layerGroupsVisibility&&this.setVisible(e.layerGroupsVisibility.visible,{layerGroups:e.layerGroupsVisibility}),this.config||e?{...this.config,...e}:void 0}isVisible(){return this.sourcesWithLayers.vectorTiles.isAnyLayerVisible()}setVisible(e,t){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=>St(t,e)):"exclude"===t?e=>!i.some(t=>St(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups))}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles,this.config?.events)}},Nt=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],Ot="#0A3653",Ct="#555555",vt={type:"fill",paint:{"fill-color":["coalesce",["get","color"],Ot],"fill-opacity":["case",["==",["get","theme"],"outline"],0,.15],"fill-antialias":!1}},wt={type:"line",paint:{"line-color":["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],Ct],["coalesce",["get","color"],Ot]],"line-opacity":["case",["==",["get","theme"],"outline"],.9,1],"line-width":["case",["==",["get","theme"],"outline"],5,2]}},Mt=(e,t,r)=>{const a=r?.colorConfig,s=r?.lineConfig;return[{...vt,id:e,paint:{...vt.paint,...!i(a?.fillOpacity)&&{"fill-opacity":a?.fillOpacity},...a?.fillColor&&{"fill-color":["get","color"]}}},{...wt,id:t,paint:{...wt.paint,...!i(s?.lineColor)&&{"line-color":s?.lineColor},...!i(s?.lineWidth)&&{"line-width":s?.lineWidth},...!i(s?.lineOpacity)&&{"line-opacity":s?.lineOpacity}}}]},Dt=(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":[Se],"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"}}},Pt=(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":[Se],"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}}}},xt={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"]},Ut=Object.keys(xt),Ft=(e,t={})=>({...e,features:e.features.map((e,i)=>{const r=(e.properties??{}).theme??t.theme,a="inverted"===r?(e=>{const t=L(e);return{...e,geometry:t.geometry}})(e):e,s=a.properties??{},o=s.title??((e,t)=>t.textConfig?.textField?t.textConfig.textField:e.properties?.address?.freeformAddress)(a,t),n=s.color??((e,t)=>{const i=e?.colorConfig?.fillColor;if("string"==typeof i&&xt[i]){const e=xt[i];return e[t%e.length]}return i})(t,i);return{...a,properties:{...a.properties,...r&&{theme:r},...o&&{title:o},...n&&{color:n},id:s.id??u()}}})}),Ht=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=l((e=>e.flat().reduce((e,t)=>t.length>e.length?t:e,[]))(e.geometry.coordinates));t=i&&n(i)||null}else t=e.geometry.coordinates.flat();const i=e.id??e.properties?.id??u();return{type:"Feature",id:i,geometry:{type:"Point",coordinates:t},properties:{...e.properties,id:i}}});return{type:"FeatureCollection",bbox:e.bbox,features:t}},Wt=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.lineLabelLayerSpecs=null,this.lastRawInput=null}_initSourcesWithLayers(t,i){if(!i){e.lastInstanceIndex++,this.sourceID=`geometry-${e.lastInstanceIndex}`,this.titleSourceID=`geometryTitle-${e.lastInstanceIndex}`;const t=`geometry-${e.lastInstanceIndex}`;this.fillLayerID=`${t}_Fill`,this.outlineLayerID=`${t}_Outline`,this.lineLabelLayerID=`${t}_LineLabel`,this.titleLayerID=`${t}_Title`}const[r,a]=Mt(this.fillLayerID,this.outlineLayerID,t),s=Dt(this.titleLayerID,t);this.titleLayerSpecs=s,this.geometryFillLayerSpecs=r,this.geometryOutlineLayerSpecs=a;const o=void 0===t?.lineLabelConfig?null:Pt(this.lineLabelLayerID,t);return this.lineLabelLayerSpecs=o,{geometry:new j(this.mapLibreMap,this.sourceID,[{...r},{...a},...o?[o]:[]]),geometryLabel:new j(this.mapLibreMap,this.titleSourceID,[s])}}_applyConfig(e){return(e?.textConfig||e?.colorConfig||e?.lineConfig)&&this.updateLayerAndData(e),e?.beforeLayerConfig&&this.moveBeforeLayer(e.beforeLayerConfig),e}moveBeforeLayerID(e){for(const t of this.sourcesWithLayers.geometry.sourceAndLayerIDs.layerIDs)this.mapLibreMap.moveLayer(t,e)}moveBeforeLayer(e){this.config={...this.config,beforeLayerConfig:e},this.moveBeforeLayerID("top"===e?this.titleLayerID:ye[e])}applyTextConfig(e){const t={...this.config,textConfig:e};this.updateLayerAndData(t),this.sourcesWithLayers.geometryLabel.show(Ht(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t}updateLayerAndData(e){const[t,i]=Mt(this.fillLayerID,this.outlineLayerID,e),r=Dt(this.titleLayerID,e);if(Z(t,this.geometryFillLayerSpecs,this.mapLibreMap),Z(i,this.geometryOutlineLayerSpecs,this.mapLibreMap),Z(r,this.titleLayerSpecs,this.mapLibreMap),this.geometryFillLayerSpecs=t,this.geometryOutlineLayerSpecs=i,this.titleLayerSpecs=r,this.lineLabelLayerSpecs){const t=Pt(this.lineLabelLayerID,e);Z(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(Ft(i,this.config)),this.sourcesWithLayers.geometryLabel.show(Ht(r.shownFeatures))}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 oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry,this.config?.events)}},kt={timeMinutes:"min",distanceKM:"km",remainingChargeCPT:"% remaining",spentChargePCT:"% spent",spentFuelLiters:"L"},Gt=(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?L(t):I(E([e[i-1],t])),{title:a,theme:s,...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},Bt=(e,t="filled",i)=>{const r=e.features,a=r.map((e,t)=>{if(i)return i(e,t);const r=e.properties?.budget;return void 0!==r?.value&&r?.type?`${r.value} ${kt[r.type]??r.type}`:String(t+1)});return{type:"FeatureCollection",...e.bbox&&{bbox:e.bbox},features:Gt(r,a,t)}},Vt=(e="fadedRainbow",t="lowestLabel")=>({beforeLayerConfig:t,lineConfig:{lineWidth:["case",["==",["get","theme"],"outline"],5,1],lineColor:["case",["==",["get","theme"],"outline"],["coalesce",["get","color"],Ct],"grey"],lineOpacity:["case",["==",["get","theme"],"outline"],.9,1]},colorConfig:{fillColor:e,fillOpacity:["case",["==",["get","theme"],"outline"],0,.6]},lineLabelConfig:{}}),Yt=(e="fadedRainbow",t,i,r)=>{const a=Vt(e,i),s=e=>Bt(e,t,r);return"inverted"!==t?{...a,transformFeaturesForDisplay:s}:{...a,lineConfig:{...a.lineConfig,lineOpacity:["case",["==",["get","theme"],"filled"],1,0]},colorConfig:{...a.colorConfig,fillOpacity:["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:s}},$t=["filled","outline","inverted"],zt=class e extends se{static async get(t,i){return await q(t),await te(t,me,"hillshade"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(me);if(!t)throw x(`init ${e.name} with source ID ${me}`);return{hillshade:new $(this.mapLibreMap,t)}}_applyConfig(e){return this.setVisible(e?.visible??!1),e}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.hillshade.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.hillshade.isAnyLayerVisible()}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hillshade,this.config?.events)}},Kt=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],jt=["trafficIncidents","trafficFlow","hillshade"],qt=(e,t,i)=>Math.min(Math.max(t,e),i),Xt=e=>!e.some(Number.isNaN),Zt=e=>Number.parseInt(e.padEnd(2,e),16)/255,Jt=(e,t)=>qt(t?e/100:e,0,1),Qt=/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,ei=/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,/])\s*([\de.+-]+)(%)?)?\s*\)$/,ti=e=>{const t=ei.exec(e);if(!t)return;const[,i,r,a,s,o,n,l,c]=t,h=[r||" ",s||" ",n].join("");if(" "!==h&&" /"!==h&&",,"!==h&&",,,"!==h)return;const u=[+i,qt(+a,0,100),qt(+o,0,100),l?Jt(+l,c):1];return Xt(u)?(([e,t,i,r])=>{const a=(e=>{const t=e%360;return t<0?t+360:t})(e),s=t/100,o=i/100,n=e=>{const t=(e+a/30)%12;return o-s*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},ii=e=>{const t=e.toLowerCase().trim();if("transparent"===t)return[0,0,0,0];const i=ri[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[Zt(e.slice(1,1+t)),Zt(e.slice(1+t,1+2*t)),Zt(e.slice(1+2*t,1+3*t)),Zt(e.slice(1+3*t)||"ff")]})(t):t.startsWith("rgb")?(e=>{const t=Qt.exec(e);if(!t)return;const[,i,r,a,s,o,n,l,c,h,u,d]=t,p=[a||" ",n||" ",h].join("");if(" "!==p&&" /"!==p&&",,"!==p&&",,,"!==p)return;const y=[r,o,c].join(""),_="%%%"===y?100:""===y?255:0;if(!_)return;const m=[qt(+i/_,0,1),qt(+s/_,0,1),qt(+l/_,0,1),u?Jt(+u,d):1];return Xt(m)?m:void 0})(t):ti(t)},ri={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]},ai="#36A8F0",si="#105287",oi="#ABAFB3",ni="#3C4956",li="#727C85",ci=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],hi=["==",["get","routeState"],"selected"],ui=["==",["get","routeState"],"deselected"],di=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],pi={s:["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],m:ci,l:["interpolate",["linear"],["zoom"],1,5,5,6,10,11,18,15]},yi={s:["interpolate",["linear"],["zoom"],1,4,5,5,10,8,18,11],m:di,l:["interpolate",["linear"],["zoom"],1,7,5,9,10,14,18,19]},_i={s:["interpolate",["linear"],["zoom"],8,.45,22,.6],m:["interpolate",["linear"],["zoom"],8,.6,22,.8],l:["interpolate",["linear"],["zoom"],8,.75,22,1]},mi=e=>pi[e??"m"],fi=e=>yi[e??"m"],gi=e=>_i[e??"m"],Ai={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]},Ii=e=>Ai[e??"m"],Ei={s:["interpolate",["linear"],["zoom"],16,8,22,12],m:["interpolate",["linear"],["zoom"],16,12,22,17],l:["interpolate",["linear"],["zoom"],16,17,22,24]},Ri={s:["interpolate",["linear"],["zoom"],16,10,22,14],m:["interpolate",["linear"],["zoom"],16,14,22,20],l:["interpolate",["linear"],["zoom"],16,20,22,28]},Li=e=>Ei[e??"m"],Si=e=>Ri[e??"m"],Ti="#AD0000",bi="#FB2D09",Ni="#f58240",Oi="#000000",Ci=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],vi=e=>({...Ue,filter:hi,minzoom:4,layout:{...Ue.layout,"text-field":Ci(e?.text)},paint:{...Ue.paint}}),wi={filter:hi,minzoom:16},Mi={"line-cap":"round"},Di=e=>({...wi,type:"line",layout:Mi,paint:{"line-width":Si(e),"line-color":"grey"}}),Pi=e=>({...wi,type:"line",layout:Mi,paint:{"line-width":Li(e),"line-color":"white"}}),xi="instruction-arrow",Ui={...wi,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":xi,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Fi=e=>({filter:hi,type:"line",layout:{"line-join":"round"},paint:{"line-width":mi(e),"line-color":"#6dc4ed"}}),Hi={filter:hi,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}},Wi={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},ki=e=>({...Wi,filter:ui,paint:{"line-color":ni,"line-width":fi(e)}}),Gi=e=>({...Wi,filter:ui,paint:{"line-color":oi,"line-width":mi(e)}}),Bi=(e,t)=>({...Wi,filter:hi,paint:{"line-color":t??"#105287","line-width":fi(e)}}),Vi=(e,t)=>({...Wi,filter:hi,paint:{"line-color":t??"#36A8F0","line-width":mi(e)}}),Yi={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},$i="selected-route-summary-popup",zi="deselected-route-summary-popup",Ki=e=>({filter:hi,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":Ii(e),"line-color":"#BEBFFA"}}),ji={filter:hi,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]}},qi=["match",["get","magnitudeOfDelay"],"minor",Ni,"moderate",bi,"major",Ti,"indefinite","#666666",Oi],Xi=e=>({type:"line",layout:{"line-cap":"round"},paint:{"line-width":mi(e),"line-color":["match",["get","magnitudeOfDelay"],"minor","#FFC105","moderate",bi,"major",Ti,"#C7D2D8"]}}),Zi=e=>({type:"line",filter:["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],layout:{"line-join":"round"},paint:{"line-width":mi(e),"line-color":["match",["get","magnitudeOfDelay"],"unknown","rgba(190, 39, 27, 1)","rgba(137, 150, 168, 1)"],"line-dasharray":[1.5,1]}}),Ji={filter:hi,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},Qi={...Ji,filter:["all",["has","jamIconID"],Ji.filter],layout:{...Ji.layout,"icon-image":["get","jamIconID"],"icon-anchor":"bottom-left","text-anchor":"bottom-left","text-field":["get","title"],"text-font":[Se],"text-offset":[3.9,-1.4],"text-size":13},paint:{...Ji.paint,"text-color":qi,"text-halo-color":"#FFFFFF","text-halo-width":1}},er={...Ji,filter:["all",["has","causeIconID"],Ji.filter],layout:{...Ji.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...Ji.paint}},tr=e=>({filter:hi,type:"line",layout:{"line-join":"round"},paint:{"line-width":mi(e),"line-color":"#000000","line-opacity":.3}}),ir=e=>({filter:hi,type:"line",layout:{"line-join":"round"},paint:{"line-color":si,"line-width":mi(e)}}),rr=e=>({filter:hi,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":ai,"line-width":mi(e),"line-dasharray":[0,1.5]}}),ar="traffic-clear",sr="traffic-major",or="traffic-moderate",nr="traffic-minor",lr=["has","formattedTraffic"],cr=e=>{const t=void 0!==e?Fe($i,e):$i,i=void 0!==e?Fe(zi,e):zi,r=void 0!==e?Fe(ar,e):ar,a=void 0!==e?Fe(sr,e):sr,s=void 0!==e?Fe(or,e):or,o=void 0!==e?Fe(nr,e):nr;return{type:"symbol",layout:{"icon-image":["case",hi,t,i],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",hi,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",[Se]],"text-color":["case",hi,"black",li]},["concat","\t\t",["get","formattedDistance"]],{"text-color":li},["case",lr,"\n",""],{},["image",["case",lr,["match",["get","magnitudeOfDelay"],"major",a,"moderate",s,"minor",o,r],""]],{},["case",lr,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Se]],"text-color":qi}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}}},hr=cr(),ur="start",dr="middle",pr="finish",yr="indexType",_r="stopDisplayIndex",mr="waypointStart",fr="waypointStop",gr="waypointSoft",Ar="waypointFinish",Ir={"text-field":["get",_r],"text-font":[Se],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",yr],dr],["!",["has",_r]]],"center","bottom"],"text-allow-overlap":!0},Er={type:"symbol",paint:{...De,"text-color":"#ffffff"},layout:{...Me,...Ir,"symbol-sort-key":["case",["==",["get",Oe],gr],0,["abs",["-",["get","index"],1e3]]]}},Rr={type:"symbol",paint:{...xe,"text-color":"black","text-halo-width":1.5,"text-halo-color":"#ffffff"},layout:{...Pe,"text-anchor":"top","text-offset":[0,.4]}},Lr=(e,t)=>e&&t&&(e.startsWith("route")||e.startsWith("waypoint"))?`${t}-${e}`:e,Sr=(e,t)=>e&&t?Object.fromEntries(Object.entries(e).map(([e,i])=>[e,i?.beforeID?{...i,beforeID:Lr(i.beforeID,t)}:i])):e,Tr=(e,t)=>t?{...e,...t,...t.paint&&{paint:{...e.paint,...t.paint}},...t.layout&&{layout:{...e.layout,...t.layout}}}:e,br=(e,t)=>e&&void 0!==t?`${e}-${t}`:e,Nr=(e={},t,i)=>{const r=e.layers,a=r?.sections,s=e.theme?.mainColor,o=s?((e,t)=>{const i=ii(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("")}`})(s,.4):void 0,n=e.theme?.routeWidth,l=e.theme?.waypointSize,c=gi(l);return{mainLines:{routeLineArrows:Tr({...Yi,beforeID:ye.lowestLabel},r?.mainLines?.routeLineArrows),routeLine:Tr({...Vi(n,s),beforeID:Lr("routeIncidentBackgroundLine",t)},r?.mainLines?.routeLine),routeOutline:Tr({...Bi(n,o),beforeID:Lr("routeLine",t)},r?.mainLines?.routeOutline),routeDeselectedLine:Tr({...Gi(n),beforeID:Lr("routeOutline",t)},r?.mainLines?.routeDeselectedLine),routeDeselectedOutline:Tr({...ki(n),beforeID:Lr("routeDeselectedLine",t)},r?.mainLines?.routeDeselectedOutline),...Sr(r?.mainLines?.additional,t)},waypoints:{routeWaypointSymbol:Tr({...Er,layout:{...Er.layout,"icon-size":c},beforeID:Lr("routeSummaryBubbleSymbol",t)},r?.waypoints?.routeWaypointSymbol),routeWaypointLabel:Tr({...Rr,beforeID:Lr("routeWaypointSymbol",t)},r?.waypoints?.routeWaypointLabel),...Sr(r?.waypoints?.additional,t)},chargingStops:{routeChargingStopSymbol:Tr({...vi(e.chargingStops),beforeID:Lr("routeWaypointSymbol",t)},r?.chargingStops?.routeChargingStopSymbol),...Sr(r?.chargingStops?.additional,t)},sections:{incident:{routeIncidentJamSymbol:Tr({...Qi,beforeID:Lr("routeChargingStopSymbol",t)},a?.incident?.routeIncidentJamSymbol),routeIncidentCauseSymbol:Tr({...er,beforeID:Lr("routeChargingStopSymbol",t)},a?.incident?.routeIncidentCauseSymbol),routeIncidentBackgroundLine:Tr({...Xi(n),beforeID:Lr("routeIncidentDashedLine",t)},a?.incident?.routeIncidentBackgroundLine),routeIncidentDashedLine:Tr({...Zi(n),beforeID:Lr("routeTunnelLine",t)},a?.incident?.routeIncidentDashedLine),...Sr(a?.incident?.additional,t)},ferry:{routeFerryLine:Tr({...Fi(n),beforeID:Lr("routeLineArrows",t)},a?.ferry?.routeFerryLine),routeFerrySymbol:Tr({...Hi,beforeID:Lr("routeIncidentJamSymbol",t)},a?.ferry?.routeFerrySymbol),...Sr(a?.ferry?.additional,t)},tollRoad:{routeTollRoadOutline:Tr({...Ki(n),beforeID:Lr("routeDeselectedOutline",t)},a?.tollRoad?.routeTollRoadOutline),routeTollRoadSymbol:Tr({...ji,beforeID:Lr("routeChargingStopSymbol",t)},a?.tollRoad?.routeTollRoadSymbol),...Sr(a?.tollRoad?.additional,t)},tunnel:{routeTunnelLine:Tr({...tr(n),beforeID:Lr("routeLineArrows",t)},a?.tunnel?.routeTunnelLine),...Sr(a?.tunnel?.additional,t)},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:Tr({...ir(n),beforeID:Lr("routeVehicleRestrictedForegroundLine",t)},a?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine),routeVehicleRestrictedForegroundLine:Tr({...rr(n),beforeID:ye.lowestLabel},a?.vehicleRestricted?.routeVehicleRestrictedForegroundLine),...Sr(a?.vehicleRestricted?.additional,t)}},instructionLines:{routeInstructionLine:Tr({...Pi(n),beforeID:ye.lowestLabel},r?.instructionLines?.routeInstructionLine),routeInstructionOutline:Tr({...Di(n),beforeID:Lr("routeInstructionLine",t)},r?.instructionLines?.routeInstructionOutline),...Sr(r?.instructionLines?.additional,t)},instructionArrows:{routeInstructionArrowSymbol:Tr({...Ui,beforeID:Lr("routeInstructionLine",t),...void 0!==i&&{layout:{...Ui.layout,"icon-image":br(Ui.layout?.["icon-image"],i)}}},r?.instructionArrows?.routeInstructionArrowSymbol),...Sr(r?.instructionArrows?.additional,t)},summaryBubbles:{routeSummaryBubbleSymbol:Tr(void 0===i?hr:cr(i),r?.summaryBubbles?.routeSummaryBubbleSymbol),...Sr(r?.summaryBubbles?.additional,t)}}},Or=Nr();U()&&(k=F(H('<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 Cr=e=>{if(!U())return;const t=H('<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),F(t)},vr={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},wr=e=>{if(!U())return;const t=H('<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),F(t)},Mr=(e,t)=>{if(!U())return;const i=W(t);return e&&i.appendChild(e),F(i)},Dr=e=>{if(U())return Mr(H('<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)},Pr=e=>{if(U())return Mr(H('<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)},xr=(e={},t)=>Object.entries(e).map(([e,i])=>({...i,id:t?`${t}-${e}`:e})),Ur=(e={},t)=>({mainLines:xr(e.mainLines,t),waypoints:xr(e.waypoints,t),chargingStops:xr(e?.chargingStops,t),ferries:xr(e.sections?.ferry,t),incidents:xr(e.sections?.incident,t),tollRoads:xr(e.sections?.tollRoad,t),tunnels:xr(e.sections?.tunnel,t),vehicleRestricted:xr(e.sections?.vehicleRestricted,t),instructionLines:xr(e.instructionLines,t),instructionArrows:xr(e.instructionArrows,t),summaryBubbles:xr(e.summaryBubbles,t)}),Fr=(e,t,i)=>{const r=o.instance.get().displayUnits,a=e?.displayUnits;return{...e,...a?{}:{displayUnits:r},layers:Nr(e,t,i)}},Hr=(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"},Wr=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},kr=(e,t)=>{const i=[];if(!1!==t?.chargingStops?.visible)for(const r of e.features)for(const e of r.properties.sections.leg){const a=e.summary.chargingInformationAtEndOfLeg;if(a){const e=a.properties;i.push({...a,properties:{...a.properties,id:a.properties.chargingParkId??u(),iconID:Hr(a,t),title:Wr(a),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:h(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:r.properties.routeState}})}}return{type:"FeatureCollection",features:i}},Gr=e=>e.categories.includes("jam"),Br=e=>{const t=(e=>{if(Gr(e))return h(e.delayInSeconds)})(e),i=((e,t)=>Gr(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=>{switch(e.categories.find(e=>"jam"!==e)){case"accident":return"traffic-incidents-accident";case"roadworks":return"traffic-incidents-roadworks";case"road-closed":return"traffic-incidents-road_closed";case"danger":case"animals-on-road":return"traffic-incidents-danger";case"broken-down-vehicle":return"traffic-incidents-broken_down_vehicle";case"lane-closed":case"narrow-lanes":return"traffic-incidents-lane_closed";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}})(e);return{...e,...i&&{jamIconID:i},...r&&{causeIconID:r},...t&&{title:t}}},Vr=(e,t,i)=>{if(e.properties.radiusMeters)return void 0!==i?Fe(gr,i):gr;let r;switch(t){case"start":r=mr;break;case"finish":r=Ar;break;default:r=fr}return void 0!==i?Fe(r,i):r},Yr=(e,t,i)=>{let r=-1;return{type:"FeatureCollection",features:e.map((a,s)=>{if(!a)return r++,null;const o=(e=>Array.isArray(e)?{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}:"Point"===e.type?(e=>({type:"Feature",geometry:e,properties:{},...e.bbox&&{bbox:e.bbox}}))(e):e)(a),n=((e,t)=>0===e?ur:e<t-1?dr:pr)(s,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??u();return{...o,..."main-when-available"===t?.entryPoints&&{geometry:{type:"Point",coordinates:p(o,{useEntryPoint:"main-when-available"})}},id:h,properties:{...o.properties,id:h,index:s,indexType:n,...c&&{title:c},iconID:Vr(o,n,i),...l&&"middle"===n&&{stopDisplayIndex:r}}}}).filter(e=>e)}},$r=(e,t,i)=>({type:"FeatureCollection",features:e.features.flatMap(e=>((e,t,i)=>e.properties.sections[t]?.map(t=>{const r=t.id??u();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))}),zr=(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)),Kr=(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??u();return{...e,id:r,properties:{...e.properties,id:r,routeState:i===t?"selected":"deselected"}}})}},jr=(e,t)=>e.some(e=>e.magnitudeOfDelay===t),qr=(e,t)=>({type:"FeatureCollection",features:e.features.map(e=>{const i=e.properties.summary,r=e.geometry.coordinates,a=h(i.trafficDelayInSeconds,t?.time),s=(e=>{const t=e.properties.sections.traffic;if(t?.length)return jr(t,"major")?"major":jr(t,"moderate")?"moderate":jr(t,"minor")?"minor":void 0})(e),o=e.id??u();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:c(i.lengthInMeters,t?.distance),...s&&{magnitudeOfDelay:s},...a&&{formattedTraffic:a},formattedDuration:h(i.travelTimeInSeconds,t?.time)}}})}),Xr=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t)}createSourcesWithLayers(e){const t=Fe("routes",this.instanceIndex);return{mainLines:new j(this.mapLibreMap,`${t}-mainLines`,e.mainLines,!1),waypoints:new j(this.mapLibreMap,`${t}-waypoints`,e.waypoints,!1),incidents:new j(this.mapLibreMap,`${t}-incidents`,e.incidents,!1),ferries:new j(this.mapLibreMap,`${t}-ferries`,e.ferries,!1),chargingStops:new j(this.mapLibreMap,`${t}-chargingStops`,e.chargingStops,!1),tollRoads:new j(this.mapLibreMap,`${t}-tollRoads`,e.tollRoads,!1),tunnels:new j(this.mapLibreMap,`${t}-tunnels`,e.tunnels,!1),vehicleRestricted:new j(this.mapLibreMap,`${t}-vehicleRestricted`,e.vehicleRestricted,!1),instructionLines:new j(this.mapLibreMap,`${t}-instructionLines`,e.instructionLines,!1),instructionArrows:new j(this.mapLibreMap,`${t}-instructionArrows`,e.instructionArrows,!1),summaryBubbles:new j(this.mapLibreMap,`${t}-summaryBubbles`,e.summaryBubbles,!1)}}_initSourcesWithLayers(t,i){i||(e.lastInstanceIndex++,this.instanceIndex=e.lastInstanceIndex,this.layerIDPrefix=Fe("routes",this.instanceIndex)),this.layersSpecs=Ur(Fr(t,this.layerIDPrefix,this.instanceIndex).layers,this.layerIDPrefix);const r=this.createSourcesWithLayers(this.layersSpecs);Q(Object.values(r).flatMap(e=>e._layerSpecs),this.mapLibreMap);const a={fillColor:t?.theme?.mainColor,...t?.waypoints?.icon?.style},s={pixelRatio:2},o=Fe(mr,this.instanceIndex),n=Fe(fr,this.instanceIndex),l=Fe(gr,this.instanceIndex),c=Fe(Ar,this.instanceIndex),h=Fe(xi,this.instanceIndex),u=Fe($i,this.instanceIndex),d=Fe(zi,this.instanceIndex),p=Fe(ar,this.instanceIndex),y=Fe(sr,this.instanceIndex),_=Fe(or,this.instanceIndex),m=Fe(nr,this.instanceIndex);this.addImageIfNotExisting(o,Dr(a),s),this.addImageIfNotExisting(n,Mr(void 0,a),s),this.addImageIfNotExisting(l,(()=>{if(U())return F(H('<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(c,Pr(a),s),this.addImageIfNotExisting(h,k,s),this.addImageIfNotExisting(u,Cr("white"),vr),this.addImageIfNotExisting(d,Cr("#EEEEEE"),vr),this.addImageIfNotExisting(p,wr(Oi),s),this.addImageIfNotExisting(y,wr(Ti),s),this.addImageIfNotExisting(_,wr(bi),s),this.addImageIfNotExisting(m,wr(Ni),s);for(const e of t?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(e.id,e.image,{pixelRatio:e.pixelRatio??2});return r}_applyConfig(e){const i=Fr(e,this.layerIDPrefix,this.instanceIndex);if(this.config){const e=Ur(i.layers,this.layerIDPrefix);Object.keys(e).forEach(t=>{const i=t;((e,t,i,r)=>{const a=e.reduce((e,t)=>({...e,[t.id]:t}),{}),s=t.reduce((e,t)=>({...e,[t.id]:t}),{}),o=[],n=[],l=[],c=[];Object.keys(a).forEach(e=>{s[e]?(l.push(a[e]),c.push(s[e])):o.push(e)}),Object.keys(s).forEach(e=>{a[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={...a[e],source:i.source.id};h.push(t)}),i._updateSourceAndLayerIDs(),J(l,c,r)})(e[i],this.layersSpecs[i],this.sourcesWithLayers[i],this.mapLibreMap)});const t=Object.values(this.sourcesWithLayers);Q(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};ie("add-or-update",Fe(mr,this.instanceIndex),Dr(t),this.mapLibreMap,i),ie("add-or-update",Fe(fr,this.instanceIndex),Mr(void 0,t),this.mapLibreMap,i),ie("add-or-update",Fe(Ar,this.instanceIndex),Pr(t),this.mapLibreMap,i)}const r=!1!==i.summaryBubbles?.visible,a=!t(this.config?.summaryBubbles?.visible,i.summaryBubbles?.visible),s=!t(this.config?.displayUnits,i.displayUnits),o=this.sourcesWithLayers.summaryBubbles.shownFeatures.features.length>0,n=this.sourcesWithLayers.mainLines.shownFeatures.features.length>0;return!r&&a?this.sourcesWithLayers.summaryBubbles.clear():r&&(a&&n||s&&o)&&this.sourcesWithLayers.summaryBubbles.show(qr(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){ie("if-not-in-sprite",e,t,this.mapLibreMap,i)}async showRoutes(e,t){const i=Kr(e,t?.selectedIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(i),this.sourcesWithLayers.vehicleRestricted.show($r(i,"vehicleRestricted")),this.sourcesWithLayers.incidents.show($r(i,"traffic",Br)),this.sourcesWithLayers.chargingStops.show(kr(i,this.config)),this.sourcesWithLayers.ferries.show($r(i,"ferry")),this.sourcesWithLayers.tunnels.show($r(i,"tunnel")),this.sourcesWithLayers.tollRoads.show($r(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:u(),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:u(),routeIndex:t,routeState:e.properties.routeState,lastPointBearingDegrees:g(r[0],r[1])}}})||[])}))(i)),!1!==this.config?.summaryBubbles?.visible?this.sourcesWithLayers.summaryBubbles.show(qr(i,this.config?.displayUnits)):this.sourcesWithLayers.summaryBubbles.clear()}async clearRoutes(){await this.waitUntilModuleReady();for(const e of Object.keys(this.sourcesWithLayers))"waypoints"!==e&&this.sourcesWithLayers[e].clear()}async selectRoute(e){const t=Kr(this.sourcesWithLayers.mainLines.shownFeatures,e);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(t),this.sourcesWithLayers.chargingStops.show(kr(t,this.config)),zr(t,this.sourcesWithLayers.vehicleRestricted),zr(t,this.sourcesWithLayers.incidents),zr(t,this.sourcesWithLayers.ferries),zr(t,this.sourcesWithLayers.tollRoads),zr(t,this.sourcesWithLayers.tunnels),zr(t,this.sourcesWithLayers.instructionLines),zr(t,this.sourcesWithLayers.instructionArrows),zr(t,this.sourcesWithLayers.summaryBubbles)}async showWaypoints(e){const t=Array.isArray(e)?Yr(e,this.config?.waypoints,this.instanceIndex):Yr(e.features,this.config?.waypoints,this.instanceIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.show(t)}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{mainLines:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.mainLines,this.config?.events),waypoints:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.waypoints,this.config?.events),chargingStops:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.chargingStops,this.config?.events),summaryBubbles:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.summaryBubbles,this.config?.events),incidents:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents,this.config?.events),vehicleRestricted:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vehicleRestricted,this.config?.events),ferries:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.ferries,this.config?.events),tollRoads:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tollRoads,this.config?.events),tunnels:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tunnels,this.config?.events),instructionLines:new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.instructionLines,this.config?.events)}}getLayerToRenderLinesUnder(){return ye.lowestLabel}},Zr="standardLight",Jr={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"}},Qr=e=>`\${baseURL}/maps/orbis/assets/styles/\${version}/style.json?&apiVersion=1&key=\${apiKey}&map=${e}`,ea={standardLight:Qr("basic_street-light"),standardDark:Qr("basic_street-dark"),drivingLight:Qr("basic_street-light-driving"),drivingDark:Qr("basic_street-dark-driving"),monoLight:Qr("basic_mono-light"),monoDark:Qr("basic_mono-dark"),satellite:Qr("basic_street-satellite")},ta=(e,t,i)=>{const r=e.id??"standardLight",a=new URL(ea[r].replace("${baseURL}",t).replace("${version}",e.version??"0.6.0-0").replace("${apiKey}",i));for(const s of e.include??jt)a.searchParams.append(s,Jr[r][s]);return a.toString()},ia=e=>{const t=e.style,i=e.commonBaseURL,r=e.apiKey;return"string"==typeof t?ta({id:t},i,r):"standard"===t?.type?ta(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"):i.searchParams.set("key",t),i.toString()})(t.url,r):"custom"===t?.type&&t?.json?t.json:ta({id:Zr},i,r)},ra=class{constructor(e){var i,r;this.mapReady=!1,this.styleChangeHandlers=[],this.setStyle=(e,i={keepState:!0})=>{this.mapReady=!1;for(const t of this.styleChangeHandlers)try{t.onStyleAboutToChange?.()}catch(a){console.error(a)}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=ae(r),this.mapLibreMap.once("styledata",()=>{!this.mapReady&&t(r,this._params.style)&&this.handleStyleData(i.keepState||!0)}),this.mapLibreMap.setStyle(ia(this._params),{validate:!1})},this.getStyle=()=>this._params.style,this._params=m(e),void 0===this._params.style&&(this._params={...this._params,style:Zr}),this.styleLightDarkTheme=ae(this._params.style),this.ensureMapLibreCSSLoaded(),O(4),this.mapLibreMap=new T({validateStyle:!1,maxTileCacheZoomLevels:22,cancelPendingTileRequestsWhileZooming:!1,...(i=this._params).mapLibre,style:ia(i),attributionControl:{compact:!1},transformRequest:(r=i,(e,t)=>{if(e.includes("tomtom.com")){if("Image"===t)return{url:e};const i=new URL(e);return i.pathname.includes("incidents")?i.searchParams.set("tags",`${M.join(",")}`):i.pathname.includes("flow")&&i.searchParams.set("tags",`${v.join(",")}`),{url:i.toString(),headers:{...d(r)}}}return{url:e}})}),this.mapLibreMap.once("styledata",()=>{this.handleStyleData(!1)}),this._eventsProxy=new pe(this.mapLibreMap,this._params?.events),this.loadRTLTextPlugin()}loadRTLTextPlugin(){setTimeout(()=>{["deferred","loaded"].includes(b())||N("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@${C}/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 Y(this.mapLibreMap,[ge,Ae,me]))this.mapLibreMap.setLayoutProperty(i.id,"visibility","none",{validate:!1});if((async(e,t)=>{t.setSprite(`${e.commonBaseURL}/maps/orbis/assets/sprites/2.*/sprite?key=${e.apiKey}&poi=poi_${ae(e.style)}&apiVersion=1&apiChannel=preview`,{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)}},aa={congestion:{low:"#2dc653",mid:"#f5a623",high:"#e03030"},thermal:{low:"#2196F3",mid:"#FF9800",high:"#F44336"},monochrome:{low:"#e0e0e0",mid:"#888888",high:"#1a1a1a"}},sa="congestion",oa={congestionLevel:{min:0,mid:50,max:100},speed:{min:0,mid:50,max:120},travelTime:{min:0,mid:10,max:20}},na={congestionLevel:50,speed:40,travelTime:200},la=(e,t=sa)=>{const{min:i,mid:r,max:a}=oa[e],{low:s,mid:o,high:n}=aa[t];return"speed"===e?["interpolate",["linear"],["get",e],i,n,r,o,a,s]:["interpolate",["linear"],["get",e],i,s,r,o,a,n]},ca=e=>{const t=na[e];return"speed"===e?["max",10,["*",["-",oa.speed.max,["coalesce",["get","speed"],0]],t]]:["max",10,["*",["coalesce",["get",e],0],t]]},ha={type:"heatmap",paint:{"heatmap-weight":["interpolate",["linear"],["get","congestionLevel"],0,0,100,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],6,.5,12,1.5],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(45,198,83,0)",.3,aa.congestion.low,.6,aa.congestion.mid,1,aa.congestion.high],"heatmap-radius":["interpolate",["linear"],["zoom"],6,15,12,30],"heatmap-opacity":.8}},ua={type:"fill",paint:{"fill-color":la("congestionLevel"),"fill-opacity":.6}},da={type:"fill-extrusion",paint:{"fill-extrusion-color":la("congestionLevel"),"fill-extrusion-height":ca("congestionLevel"),"fill-extrusion-base":0,"fill-extrusion-opacity":.75}},pa=e=>({...ua,id:e,beforeID:ye.lowestLabel}),ya=e=>({...da,id:e,beforeID:ye.lowestPlaceLabel});function _a(e){return{type:"FeatureCollection",features:e.map((e,t)=>{const[i,r]=e.tileCentre,a=`tile-${t}-${i}-${r}`;return{type:"Feature",id:a,geometry:{type:"Point",coordinates:[i,r]},properties:{id:a,speed:e.speed??0,freeFlowSpeed:e.freeFlowSpeed??0,congestionLevel:e.congestionLevel??0,travelTime:e.travelTime??0,networkLength:e.networkLength??0}}})}}function ma(e,t=.5){if(0===e.length)return{type:"FeatureCollection",features:[]};let i=Number.POSITIVE_INFINITY,r=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const l of e){const[e,t]=l.tileCentre;e<i&&(i=e),t<r&&(r=t),e>a&&(a=e),t>s&&(s=t)}const o=R([i,r,a,s],t,{units:"kilometers"}),n=[];for(let l=0;l<o.features.length;l++){const t=o.features[l];let i=0,r=0,a=0,s=0,c=0;for(const o of e){const[e,n]=o.tileCentre;A(S([e,n]),t)&&(i+=o.congestionLevel??0,r+=o.speed??0,a+=o.freeFlowSpeed??0,s+=o.travelTime??0,c++)}if(0===c)continue;const h=`hex-${l}`;n.push({type:"Feature",id:h,geometry:t.geometry,properties:{id:h,congestionLevel:Math.round(i/c),speed:Math.round(r/c),freeFlowSpeed:Math.round(a/c),travelTime:Math.round(s/c*10)/10}})}return{type:"FeatureCollection",features:n}}var fa=class e extends se{static{this.lastInstanceIndex=-1}static async get(t,i){return await q(t),new e(t,i)}constructor(e,t){super("geojson",e,t),this.lastAnalytics=null}get mode(){return this.config?.mode??"hexgrid"}get metric(){return this.config?.metric??"congestionLevel"}get colorScheme(){return this.config?.colorScheme??"congestion"}_initSourcesWithLayers(t,i){i||e.lastInstanceIndex++;const r=e.lastInstanceIndex,a=`area-analytics-heatmap-${r}`,s=`area-analytics-hexgrid-${r}`;return this.heatmapLayerId=`${a}-layer`,this.hexFillLayerId=`${s}-fill`,this.hexExtrusionLayerId=`${s}-extrusion`,{heatmap:new j(this.mapLibreMap,a,[(o=this.heatmapLayerId,{...ha,id:o,beforeID:ye.lowestLabel})]),hexgrid:new j(this.mapLibreMap,s,[pa(this.hexFillLayerId),ya(this.hexExtrusionLayerId)])};var o}_applyConfig(e){return e?.metric&&this.applyMetricToLayers(e.metric),!1===e?.visible&&this.setVisible(!1),this.applyModeVisibility(),e}restoreDataAndConfigImpl(){const e=this.lastAnalytics;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),e&&this.show(e)}async show(e){await this.waitUntilModuleReady(),this.lastAnalytics=e;const t=(e.features[0]?.properties)?.tiledData?.tiles??[];this.sourcesWithLayers.heatmap.show(_a(t)),this.sourcesWithLayers.hexgrid.show(ma(t)),this.applyModeVisibility()}async clear(){await this.waitUntilModuleReady(),this.lastAnalytics=null,this.sourcesWithLayers.heatmap.clear(),this.sourcesWithLayers.hexgrid.clear()}setMode(e){e!==this.mode&&(this.config={...this.config,mode:e},this.applyModeVisibility())}setMetric(e){e!==this.metric&&(this.config={...this.config,metric:e},this.applyMetricToLayers(e))}setColorScheme(e){e!==this.colorScheme&&(this.config={...this.config,colorScheme:e},this.applyMetricToLayers(this.metric))}setVisible(e){this.config={...this.config,visible:e},this.applyModeVisibility()}isVisible(){return this.sourcesWithLayers.heatmap.isAnyLayerVisible()||this.sourcesWithLayers.hexgrid.isAnyLayerVisible()}getShown(){return{heatmap:this.sourcesWithLayers.heatmap.shownFeatures,hexgrid:this.sourcesWithLayers.hexgrid.shownFeatures}}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hexgrid,this.config?.events)}applyModeVisibility(){if(!1===this.config?.visible)return this.sourcesWithLayers.heatmap.setLayersVisible(!1),void this.sourcesWithLayers.hexgrid.setLayersVisible(!1);const e=this.sourcesWithLayers.heatmap.shownFeatures.features.length>0,t=this.sourcesWithLayers.hexgrid.shownFeatures.features.length>0;this.sourcesWithLayers.heatmap.setLayersVisible("heatmap"===this.mode&&e),this.sourcesWithLayers.hexgrid.setLayersVisible("hexgrid"===this.mode&&t)}applyMetricToLayers(e){const t=la(e,this.colorScheme),i=ca(e);this.mapLibreMap.setPaintProperty(this.hexFillLayerId,"fill-color",t,{validate:!1}),this.mapLibreMap.setPaintProperty(this.hexExtrusionLayerId,"fill-extrusion-color",t,{validate:!1}),this.mapLibreMap.setPaintProperty(this.hexExtrusionLayerId,"fill-extrusion-height",i,{validate:!1});const{min:r,max:a}=oa[e];this.mapLibreMap.setPaintProperty(this.heatmapLayerId,"heatmap-weight",["interpolate",["linear"],["get",e],r,0,a,1],{validate:!1}),this.mapLibreMap.setPaintProperty(this.heatmapLayerId,"heatmap-color",((e=sa)=>{const{low:t,mid:i,high:r}=aa[e];return["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.3,t,.6,i,1,r]})(this.colorScheme),{validate:!1})}},ga=(e,t)=>e.length?1===e.length?{expression:e[0],legacy:t[0]}:{expression:["all",...e],legacy:["all",...t]}:null,Aa=(e,t,i)=>{e&&(t.push(e.expression),i.push(e.legacy))},Ia=(e,t,i,r)=>{e&&Aa(gt(t,e),i,r)},Ea=(e,t,i)=>{Ia(e.roadCategories,"road_category",t,i),Ia(e.roadSubCategories,"road_subcategory",t,i)},Ra=e=>{const t=[],i=[];return Ea(e,t,i),e.incidentCategories&&Aa(gt("icon_category_0",e.incidentCategories,e=>D[e]),t,i),e.magnitudes&&Aa(gt("magnitude_of_delay",e.magnitudes,e=>_.indexOf(e)),t,i),e.delays&&Aa((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 ga(t,i)})(e.delays),t,i),ga(t,i)},La=e=>e?.any?.length?_t(e.any.map(Ra).filter(e=>!i(e))):null,Sa=e=>{const t=[],i=[];if(Ea(e,t,i),e.showRoadClosures){const r="only"===e.showRoadClosures?"==":"!=";t.push([r,["get","road_closure"],!0]),i.push([r,"road_closure",!0])}return ga(t,i)},Ta=(e,t,i,r)=>{for(const a of t)i.setFilter(a.id,e?mt(e,r[a.id]):r[a.id])},ba=class e extends se{static async get(t,i){return await q(t),await te(t,Ae,"trafficFlow"),new e(t,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const t=this.mapLibreMap.getSource(Ae);if(!t)throw x(`init ${e.name} with source ID ${Ae}`);this.originalFilters={};for(const e of this.getLayers())this.originalFilters[e.id]=e.filter;return{trafficFlow:new $(this.mapLibreMap,t)}}_applyConfig(e){return this.setVisible(e?.visible??!1),this._filter(e?.filters,!1),e}getLayers(){return Y(this.tomtomMap.mapLibreMap,[Ae])}filter(e){this._filter(e)}_filter(e,t=!0){if(this.tomtomMap.mapReady)if(e?.any?.length){const t=(r=e,r?.any?.length?_t(r.any.map(Sa).filter(e=>!i(e))):null);t&&Ta(t,this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&Ta(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);var r;t&&(this.config=a({...this.config,filters:e},i))}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficFlow.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.trafficFlow.isAnyLayerVisible()}getShown(){return{trafficFlow:this.mapLibreMap.queryRenderedFeatures({layers:this.sourcesWithLayers.trafficFlow.sourceAndLayerIDs.layerIDs,validate:!1}).map(w)}}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficFlow,this.config?.events,w)}},Na=class t extends se{static async get(e,i){return await q(e),await te(e,ge,"trafficIncidents"),new t(e,i)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(ge);if(!e)throw x(`init ${t.name} with source ID ${ge}`);this.originalFilters={};for(const t of this.getLayers())this.originalFilters[t.id]=t.filter;return{trafficIncidents:new $(this.mapLibreMap,e)}}_applyConfig(e){return this._setVisible(e?.visible??!1,{updateConfig:!1}),i(e?.icons?.visible)||this.setIconsVisible(e.icons.visible),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=La(e);i&&Ta(i,t?this.getNonSymbolLayers():this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&Ta(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);if(t?.any?.length){const e=La(t);e&&Ta(e,this.getSymbolLayers(),this.mapLibreMap,this.originalFilters)}}r&&(this.config=a({...this.config,filters:e,icons:{...this.config?.icons,filters:t}},i))}getLayers(){return Y(this.tomtomMap.mapLibreMap,[ge])}getSymbolLayers(){return this.getLayers().filter(e=>"symbol"===e.type)}getNonSymbolLayers(){return this.getLayers().filter(e=>"symbol"!=e.type)}setIconsVisible(e){this.config={...this.config,icons:{...this.config?.icons,visible:e}},this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficIncidents.setLayersVisible(e,e=>"symbol"===e.type)}setVisible(e){this._setVisible(e)}_setVisible(t,i){(i?.updateConfig??1)&&(delete this.config?.icons?.visible,this.config={...a({...this.config},e),visible:t}),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(P)}}get events(){return new oe(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficIncidents,this.config?.events,P)}},Oa=["motorway","motorway_link","trunk","trunk_link","primary","primary_link","secondary","secondary_link","tertiary","tertiary_link","street","service","track"],Ca=["unclassified","residential","living_street"],va=["parking","driveway","alley"];function wa(e){const t=e.replace("#","");return[Number.parseInt(t.slice(0,2),16),Number.parseInt(t.slice(2,4),16),Number.parseInt(t.slice(4,6),16)]}function Ma(e,t,i){return`rgb(${Math.round(e[0]+(t[0]-e[0])*i)},${Math.round(e[1]+(t[1]-e[1])*i)},${Math.round(e[2]+(t[2]-e[2])*i)})`}function Da(e,t="congestion"){const i=Math.max(0,Math.min(100,e)),{low:r,mid:a,high:s}=aa[t],o=wa(r),n=wa(a),l=wa(s);return i<=50?Ma(o,n,i/50):Ma(n,l,(i-50)/50)}var Pa=20;function xa(e,t){const i=/* @__PURE__ */new Date(`${e}T00:00:00`);return i.setDate(i.getDate()+t),`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function Ua(e){/* @__PURE__ */
|
|
2
|
+
return new Date(`${e}T00:00:00`).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})}function Fa(e,t,i,r="congestion"){if(0===t.length)return;const a=24,s=Math.ceil(t.length/a),o=[],n=[];for(let d=0;d<s;d++){const e=[];for(let i=0;i<a;i++){const r=t[d*a+i];e.push(r?.congestionLevel??0)}o.push(e),n.push(Ua(xa(i,d)))}const l=20+20*s+4,c=window.devicePixelRatio||1;e.width=544*c,e.height=l*c,e.style.width="544px",e.style.height=`${l}px`;const h=e.getContext("2d");if(!h)return;h.scale(c,c),h.fillStyle="#f7f8fa",h.fillRect(0,0,544,l);const u='Gilroy, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';h.font=`10px ${u}`,h.fillStyle="#6b7280",h.textAlign="center";for(let d=0;d<a;d+=3)h.fillText(`${d}h`,56+d*Pa+10,15);for(let d=0;d<s;d++){const e=20+20*d;h.font=`9px ${u}`,h.fillStyle="#6b7280",h.textAlign="right",h.textBaseline="middle",h.fillText(n[d],52,e+10);for(let t=0;t<a;t++){const i=56+t*Pa,a=o[d][t];h.fillStyle=Da(a,r),h.fillRect(i,e,19,19),a>0&&(h.font=`8px ${u}`,h.fillStyle=a>60?"rgba(255,255,255,0.9)":"rgba(0,0,0,0.5)",h.textAlign="center",h.textBaseline="middle",h.fillText(`${Math.round(a)}`,i+10,e+10))}}}var Ha=(e,t)=>({left:e.left-t.left,top:e.top-t.top,right:e.right-t.left,bottom:e.bottom-t.top}),Wa=(e,t,i)=>e.right<=0||e.left>=t||e.bottom<=0||e.top>=i,ka=(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)},Ga=(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)},Ba=(e,t,i,r,a)=>{const s=((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 ka(s,t,r,a);if(n&&!o)return void Ga(s,t,i,a);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,a)=>{const s=e.left,o=i-e.right,n=e.top,l=r-e.bottom,c=Math.min(s,o,n,l);c===s?t.left=Math.max(t.left,e.right+a):c===o?t.right=Math.min(t.right,e.left-a):c===n?t.top=Math.max(t.top,e.bottom+a):t.bottom=Math.min(t.bottom,e.top-a)})(s,t,i,r,a):Ga(s,t,i,a):ka(s,t,r,a)},Va=e=>"string"==typeof e?document.querySelector(e):e,Ya=e=>"mapLibreMap"in e?e.mapLibreMap:e,$a=(e,t,i)=>{const r=Ya(e).getContainer().getBoundingClientRect(),{width:a,height:s}=r,o={left:i,top:i,right:a-i,bottom:s-i};for(const n of t){const e=Va(n);if(!e)continue;const t=Ha(e.getBoundingClientRect(),r);Wa(t,a,s)||Ba(t,o,a,s,i)}return o.left>=o.right||o.top>=o.bottom?null:{visibleAreaBounds:o,mapWidthPX:a,mapHeightPX:s}},za=e=>{const{map:t,surroundingElements:i,paddingPX:r=0}=e,a=$a(t,i,r);if(!a)return null;const{visibleAreaBounds:s}=a,o=Ya(t),n=o.unproject([s.left,s.bottom]),l=o.unproject([s.right,s.top]);return[n.lng,n.lat,l.lng,l.lat]},Ka=e=>{const{map:t,surroundingElements:i}=e,r=za({map:t,surroundingElements:i});if(!r)return null;const[a,s,o,n]=r;return[(a+o)/2,(s+n)/2]},ja=e=>{const{map:t,toBeContainedBBox:i,surroundingElements:r,paddingPX:a=0}=e,s=$a(t,r,a);if(!s)return null;const{visibleAreaBounds:o,mapWidthPX:n,mapHeightPX:l}=s,c=o.left/n,h=o.right/n,u=o.top/l,d=h-c,p=o.bottom/l-u,[y,_,m,f]=i,g=(m-y)/d,A=(f-_)/p,I=y-c*g,E=f+u*A;return[I,E-A,I+g,E]};export{se as AbstractMapModule,V as AbstractSourceWithLayers,z as AddedSourceWithLayers,fe as BASE_MAP_SOURCE_ID,bt as BaseMapModule,aa as COLOR_SCHEMES,oi as DESELECTED_FOREGROUND_COLOR,ni as DESELECTED_OUTLINE_COLOR,ui as DESELECTED_ROUTE_FILTER,li as DESELECTED_SECONDARY_COLOR,oe as EventsModule,pe as EventsProxy,pr as FINISH_INDEX,j as GeoJSONSourceWithLayers,Wt as GeometriesModule,me as HILLSHADE_SOURCE_ID,zt as HillshadeModule,yr as INDEX_TYPE,Ti as MAJOR_DELAY_COLOR,dr as MIDDLE_INDEX,Ni as MINOR_DELAY_LABEL_COLOR,bi as MODERATE_DELAY_COLOR,_e as POI_SOURCE_ID,Rt as POIsModule,pt as PlacesModule,ai as ROUTE_LINE_FOREGROUND_COLOR,ci as ROUTE_LINE_FOREGROUND_WIDTH,si as ROUTE_LINE_OUTLINE_COLOR,di as ROUTE_LINE_OUTLINE_WIDTH,Xr as RoutingModule,hi as SELECTED_ROUTE_FILTER,ur as START_INDEX,_r as STOP_DISPLAY_INDEX,$ as StyleSourceWithLayers,Ae as TRAFFIC_FLOW_SOURCE_ID,ge as TRAFFIC_INCIDENTS_SOURCE_ID,ra as TomTomMap,B as TomTomMapSource,fa as TrafficAreaAnalyticsModule,ba as TrafficFlowModule,Na as TrafficIncidentsModule,Oi as UNKNOWN_DELAY_COLOR,Nt as baseMapLayerGroupNames,ot as buildPlaceTitle,Gt as buildReachableRangeFeatures,Nr as buildRoutingLayers,ja as calculateFittingBBox,za as calculatePaddedBBox,Ka as calculatePaddedCenter,Ut as colorPaletteIDs,xt as colorPalettes,Or as defaultRoutingLayers,Y as filterLayersBySources,$t as geometryThemes,lt as getIconIDForPlace,Li as getInstructionLineWidth,Si as getInstructionOutlineWidth,mi as getLineForegroundWidth,fi as getLineOutlineWidth,ct as getPOILayerCategoryForPlace,Et as getStyleCategories,Ii as getTollRoadOutlineWidth,gi as getWaypointIconSize,Ee as mapDisplayPoiCategoryMappings,ye as mapStyleLayerIDs,At as poiCategoryGroups,Ie as poiLayerIDs,dt as preparePlacesForDisplay,Bt as prepareReachableRangesForDisplay,Yt as reachableRangeGeometryConfig,Fa as renderAreaAnalyticsChart,Oa as roadCategories,va as serviceRoadSubCategories,Kt as standardStyleIDs,Ca as streetRoadSubCategories,jt as styleModules,Vt as themedGeometryConfig,ma as tilesToHexFeatures,_a as tilesToPointFeatures,Le as toBaseMapPOICategory,ht as toPlaces};
|
|
3
3
|
//# sourceMappingURL=map.es.js.map
|