@tomtom-org/maps-sdk 0.35.3 → 0.35.5
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 +15 -0
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +1 -1
- package/map/dist/THIRD_PARTY.txt +2 -2
- package/map/dist/index.d.ts +9 -5
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/package.json +1 -1
package/map/dist/THIRD_PARTY.txt
CHANGED
|
@@ -63,7 +63,7 @@ terms above.
|
|
|
63
63
|
---
|
|
64
64
|
|
|
65
65
|
Name: @tomtom-org/maps-sdk
|
|
66
|
-
Version: 0.35.
|
|
66
|
+
Version: 0.35.5
|
|
67
67
|
License: See in LICENSE.txt
|
|
68
68
|
Private: false
|
|
69
69
|
Description: TomTom Maps for JavaScript
|
|
@@ -346,7 +346,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
346
346
|
---
|
|
347
347
|
|
|
348
348
|
Name: maplibre-gl
|
|
349
|
-
Version: 5.
|
|
349
|
+
Version: 5.14.0
|
|
350
350
|
License: BSD-3-Clause
|
|
351
351
|
Private: false
|
|
352
352
|
Description: BSD licensed community fork of mapbox-gl, a WebGL interactive maps library
|
package/map/dist/index.d.ts
CHANGED
|
@@ -1651,6 +1651,13 @@ export declare type DisplayRouteProps = RouteProps & RouteStateProps & SupportsE
|
|
|
1651
1651
|
* @group Routing
|
|
1652
1652
|
*/
|
|
1653
1653
|
export declare type DisplayRouteRelatedProps = RouteStateProps & {
|
|
1654
|
+
/**
|
|
1655
|
+
* Unique identifier for the object to ensure it can be displayed on MapLibre.
|
|
1656
|
+
*
|
|
1657
|
+
* @remarks
|
|
1658
|
+
* This id es expected to become the main feature id by MapLibre via the 'promotedId' property.
|
|
1659
|
+
*/
|
|
1660
|
+
id: string;
|
|
1654
1661
|
/**
|
|
1655
1662
|
* Zero-based index of this route in the routes array.
|
|
1656
1663
|
*
|
|
@@ -4052,10 +4059,8 @@ export declare type PlaceDisplayProps = {
|
|
|
4052
4059
|
* Unique identifier for the place feature.
|
|
4053
4060
|
*
|
|
4054
4061
|
* @remarks
|
|
4055
|
-
*
|
|
4056
|
-
* However, MapLibre does not reuse the given feature ID. Either we generate it on the fly
|
|
4062
|
+
* MapLibre does not reuse the feature IDs. Either we generate it on the fly
|
|
4057
4063
|
* or use the one from properties via promotedId value.
|
|
4058
|
-
* We must generate "id" property based on the feature id on the fly in "prepareForDisplay" functions.
|
|
4059
4064
|
*
|
|
4060
4065
|
* Used for:
|
|
4061
4066
|
* - Feature identification in events
|
|
@@ -4066,10 +4071,9 @@ export declare type PlaceDisplayProps = {
|
|
|
4066
4071
|
* ```typescript
|
|
4067
4072
|
* id: 'place-123'
|
|
4068
4073
|
* id: 'poi-456'
|
|
4069
|
-
* id: 1234 // Numeric IDs also supported
|
|
4070
4074
|
* ```
|
|
4071
4075
|
*/
|
|
4072
|
-
id: string
|
|
4076
|
+
id: string;
|
|
4073
4077
|
/**
|
|
4074
4078
|
* Display title for the place on the map.
|
|
4075
4079
|
*
|
package/map/dist/map.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{generateTomTomHeaders as e,bboxFromCoordsArray as t,bboxCenter as r,TomTomConfig as i,formatDuration as n,generateId as o,getPosition as s,formatDistance as a,mergeFromGlobal as l,indexedMagnitudes as c}from"@tomtom-org/maps-sdk/core";import{Map as u,getRTLTextPluginStatus as h,setRTLTextPlugin as p}from"maplibre-gl";var d="object"==typeof global&&global&&global.Object===Object&&global,f="object"==typeof self&&self&&self.Object===Object&&self,y=d||f||Function("return this")(),g=y.Symbol,m=Object.prototype,b=m.hasOwnProperty,_=m.toString,L=g?g.toStringTag:void 0;var v=Object.prototype.toString;var I=g?g.toStringTag:void 0;function w(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":I&&I in Object(e)?function(e){var t=b.call(e,L),r=e[L];try{e[L]=void 0;var i=!0}catch(o){}var n=_.call(e);return i&&(t?e[L]=r:delete e[L]),n}(e):function(e){return v.call(e)}(e)}function S(e){return null!=e&&"object"==typeof e}function A(e){return"symbol"==typeof e||S(e)&&"[object Symbol]"==w(e)}function E(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}var O=Array.isArray,R=g?g.prototype:void 0,T=R?R.toString:void 0;function M(e){if("string"==typeof e)return e;if(O(e))return E(e,M)+"";if(A(e))return T?T.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function C(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function D(e){return e}function x(e){if(!C(e))return!1;var t=w(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var P,N=y["__core-js_shared__"],F=(P=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+P:"";var j=Function.prototype.toString;function W(e){if(null!=e){try{return j.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var U=/^\[object .+?Constructor\]$/,k=Function.prototype,H=Object.prototype,z=k.toString,G=H.hasOwnProperty,V=RegExp("^"+z.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function B(e){return!(!C(e)||(t=e,F&&F in t))&&(x(e)?V:U).test(W(e));var t}function $(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return B(r)?r:void 0}var Y=$(y,"WeakMap");var K=Date.now;var q,Z,J,X=function(){try{var e=$(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Q=X?function(e,t){return X(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:D,ee=(q=Q,Z=0,J=0,function(){var e=K(),t=16-(e-J);if(J=e,t>0){if(++Z>=800)return arguments[0]}else Z=0;return q.apply(void 0,arguments)});var te=/^(?:0|[1-9]\d*)$/;function re(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&te.test(e))&&e>-1&&e%1==0&&e<t}function ie(e,t,r){"__proto__"==t&&X?X(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function ne(e,t){return e===t||e!=e&&t!=t}var oe=Object.prototype.hasOwnProperty;function se(e,t,r){var i=e[t];oe.call(e,t)&&ne(i,r)&&(void 0!==r||t in e)||ie(e,t,r)}var ae=Math.max;function le(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ce(e){return null!=e&&le(e.length)&&!x(e)}var ue=Object.prototype;function he(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ue)}function pe(e){return S(e)&&"[object Arguments]"==w(e)}var de=Object.prototype,fe=de.hasOwnProperty,ye=de.propertyIsEnumerable,ge=pe(/* @__PURE__ */function(){return arguments}())?pe:function(e){return S(e)&&fe.call(e,"callee")&&!ye.call(e,"callee")};var me="object"==typeof exports&&exports&&!exports.nodeType&&exports,be=me&&"object"==typeof module&&module&&!module.nodeType&&module,_e=be&&be.exports===me?y.Buffer:void 0,Le=(_e?_e.isBuffer:void 0)||function(){return!1},ve={};function Ie(e){return function(t){return e(t)}}ve["[object Float32Array]"]=ve["[object Float64Array]"]=ve["[object Int8Array]"]=ve["[object Int16Array]"]=ve["[object Int32Array]"]=ve["[object Uint8Array]"]=ve["[object Uint8ClampedArray]"]=ve["[object Uint16Array]"]=ve["[object Uint32Array]"]=!0,ve["[object Arguments]"]=ve["[object Array]"]=ve["[object ArrayBuffer]"]=ve["[object Boolean]"]=ve["[object DataView]"]=ve["[object Date]"]=ve["[object Error]"]=ve["[object Function]"]=ve["[object Map]"]=ve["[object Number]"]=ve["[object Object]"]=ve["[object RegExp]"]=ve["[object Set]"]=ve["[object String]"]=ve["[object WeakMap]"]=!1;var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,Se=we&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=Se&&Se.exports===we&&d.process,Ee=function(){try{var e=Se&&Se.require&&Se.require("util").types;return e||Ae&&Ae.binding&&Ae.binding("util")}catch(t){}}(),Oe=Ee&&Ee.isTypedArray,Re=Oe?Ie(Oe):function(e){return S(e)&&le(e.length)&&!!ve[w(e)]},Te=Object.prototype.hasOwnProperty;function Me(e,t){var r=O(e),i=!r&&ge(e),n=!r&&!i&&Le(e),o=!r&&!i&&!n&&Re(e),s=r||i||n||o,a=s?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],l=a.length;for(var c in e)!t&&!Te.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||re(c,l))||a.push(c);return a}function Ce(e,t){return function(r){return e(t(r))}}var De=Ce(Object.keys,Object),xe=Object.prototype.hasOwnProperty;function Pe(e){if(!he(e))return De(e);var t=[];for(var r in Object(e))xe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ne(e){return ce(e)?Me(e):Pe(e)}var Fe=Object.prototype.hasOwnProperty;function je(e){if(!C(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=he(e),r=[];for(var i in e)("constructor"!=i||!t&&Fe.call(e,i))&&r.push(i);return r}function We(e){return ce(e)?Me(e,!0):je(e)}var Ue=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ke=/^\w*$/;function He(e,t){if(O(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!A(e))||(ke.test(e)||!Ue.test(e)||null!=t&&e in Object(t))}var ze=$(Object,"create");var Ge=Object.prototype.hasOwnProperty;var Ve=Object.prototype.hasOwnProperty;function Be(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function $e(e,t){for(var r=e.length;r--;)if(ne(e[r][0],t))return r;return-1}Be.prototype.clear=function(){this.__data__=ze?ze(null):{},this.size=0},Be.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Be.prototype.get=function(e){var t=this.__data__;if(ze){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ge.call(t,e)?t[e]:void 0},Be.prototype.has=function(e){var t=this.__data__;return ze?void 0!==t[e]:Ve.call(t,e)},Be.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ze&&void 0===t?"__lodash_hash_undefined__":t,this};var Ye=Array.prototype.splice;function Ke(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Ke.prototype.clear=function(){this.__data__=[],this.size=0},Ke.prototype.delete=function(e){var t=this.__data__,r=$e(t,e);return!(r<0)&&(r==t.length-1?t.pop():Ye.call(t,r,1),--this.size,!0)},Ke.prototype.get=function(e){var t=this.__data__,r=$e(t,e);return r<0?void 0:t[r][1]},Ke.prototype.has=function(e){return $e(this.__data__,e)>-1},Ke.prototype.set=function(e,t){var r=this.__data__,i=$e(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this};var qe=$(y,"Map");function Ze(e,t){var r,i,n=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof t?"string":"hash"]:n.map}function Je(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Je.prototype.clear=function(){this.size=0,this.__data__={hash:new Be,map:new(qe||Ke),string:new Be}},Je.prototype.delete=function(e){var t=Ze(this,e).delete(e);return this.size-=t?1:0,t},Je.prototype.get=function(e){return Ze(this,e).get(e)},Je.prototype.has=function(e){return Ze(this,e).has(e)},Je.prototype.set=function(e,t){var r=Ze(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this};function Xe(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(Xe.Cache||Je),r}Xe.Cache=Je;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/\\(\\)?/g,tt=function(e){var t=Xe(e,function(e){return 500===r.size&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Qe,function(e,r,i,n){t.push(i?n.replace(et,"$1"):r||e)}),t});function rt(e,t){return O(e)?e:He(e,t)?[e]:tt(function(e){return null==e?"":M(e)}(e))}function it(e){if("string"==typeof e||A(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function nt(e,t){for(var r=0,i=(t=rt(t,e)).length;null!=e&&r<i;)e=e[it(t[r++])];return r&&r==i?e:void 0}function ot(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}var st=g?g.isConcatSpreadable:void 0;function at(e){return O(e)||ge(e)||!!(st&&e&&e[st])}function lt(e){return(null==e?0:e.length)?function(e,t,r,i,n){var o=-1,s=e.length;for(r||(r=at),n||(n=[]);++o<s;){var a=e[o];r(a)?ot(n,a):n[n.length]=a}return n}(e):[]}var ct=Ce(Object.getPrototypeOf,Object),ut=Function.prototype,ht=Object.prototype,pt=ut.toString,dt=ht.hasOwnProperty,ft=pt.call(Object);function yt(e){var t=this.__data__=new Ke(e);this.size=t.size}yt.prototype.clear=function(){this.__data__=new Ke,this.size=0},yt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},yt.prototype.get=function(e){return this.__data__.get(e)},yt.prototype.has=function(e){return this.__data__.has(e)},yt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ke){var i=r.__data__;if(!qe||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Je(i)}return r.set(e,t),this.size=r.size,this};var gt="object"==typeof exports&&exports&&!exports.nodeType&&exports,mt=gt&&"object"==typeof module&&module&&!module.nodeType&&module,bt=mt&&mt.exports===gt?y.Buffer:void 0;function _t(){return[]}bt&&bt.allocUnsafe;var Lt=Object.prototype.propertyIsEnumerable,vt=Object.getOwnPropertySymbols,It=vt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,o=[];++r<i;){var s=e[r];t(s,r,e)&&(o[n++]=s)}return o}(vt(e),function(t){return Lt.call(e,t)}))}:_t,wt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ot(t,It(e)),e=ct(e);return t}:_t;function St(e,t,r){var i=t(e);return O(e)?i:ot(i,r(e))}function At(e){return St(e,Ne,It)}function Et(e){return St(e,We,wt)}var Ot=$(y,"DataView"),Rt=$(y,"Promise"),Tt=$(y,"Set"),Mt="[object Map]",Ct="[object Promise]",Dt="[object Set]",xt="[object WeakMap]",Pt="[object DataView]",Nt=W(Ot),Ft=W(qe),jt=W(Rt),Wt=W(Tt),Ut=W(Y),kt=w;(Ot&&kt(new Ot(new ArrayBuffer(1)))!=Pt||qe&&kt(new qe)!=Mt||Rt&&kt(Rt.resolve())!=Ct||Tt&&kt(new Tt)!=Dt||Y&&kt(new Y)!=xt)&&(kt=function(e){var t=w(e),r="[object Object]"==t?e.constructor:void 0,i=r?W(r):"";if(i)switch(i){case Nt:return Pt;case Ft:return Mt;case jt:return Ct;case Wt:return Dt;case Ut:return xt}return t});var Ht=Object.prototype.hasOwnProperty;var zt=y.Uint8Array;function Gt(e){var t=new e.constructor(e.byteLength);return new zt(t).set(new zt(e)),t}var Vt=/\w*$/;var Bt=g?g.prototype:void 0,$t=Bt?Bt.valueOf:void 0;function Yt(e,t,r){var i,n,o,s,a,l=e.constructor;switch(t){case"[object ArrayBuffer]":return Gt(e);case"[object Boolean]":case"[object Date]":return new l(+e);case"[object DataView]":return a=Gt((s=e).buffer),new s.constructor(a,s.byteOffset,s.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e){var t=Gt(e.buffer);return new e.constructor(t,e.byteOffset,e.length)}(e);case"[object Map]":case"[object Set]":return new l;case"[object Number]":case"[object String]":return new l(e);case"[object RegExp]":return(o=new(n=e).constructor(n.source,Vt.exec(n))).lastIndex=n.lastIndex,o;case"[object Symbol]":return i=e,$t?Object($t.call(i)):{}}}var Kt=Ee&&Ee.isMap,qt=Kt?Ie(Kt):function(e){return S(e)&&"[object Map]"==kt(e)};var Zt=Ee&&Ee.isSet,Jt=Zt?Ie(Zt):function(e){return S(e)&&"[object Set]"==kt(e)},Xt="[object Arguments]",Qt="[object Function]",er="[object Object]",tr={};function rr(e,t,r,i,n,o){var s;if(r&&(s=n?r(e,i,n,o):r(e)),void 0!==s)return s;if(!C(e))return e;var a=O(e);if(a)s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ht.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e);else{var l=kt(e),c=l==Qt||"[object GeneratorFunction]"==l;if(Le(e))return e.slice();if(l==er||l==Xt||c&&!n)s={};else{if(!tr[l])return n?e:{};s=Yt(e,l)}}o||(o=new yt);var u=o.get(e);if(u)return u;o.set(e,s),Jt(e)?e.forEach(function(i){s.add(rr(i,t,r,i,e,o))}):qt(e)&&e.forEach(function(i,n){s.set(n,rr(i,t,r,n,e,o))});var h=a?void 0:Et(e);return function(e,t){for(var r=-1,i=null==e?0:e.length;++r<i&&!1!==t(e[r],r,e););}(h||e,function(i,n){h&&(i=e[n=i]),se(s,n,rr(i,t,r,n,e,o))}),s}tr[Xt]=tr["[object Array]"]=tr["[object ArrayBuffer]"]=tr["[object DataView]"]=tr["[object Boolean]"]=tr["[object Date]"]=tr["[object Float32Array]"]=tr["[object Float64Array]"]=tr["[object Int8Array]"]=tr["[object Int16Array]"]=tr["[object Int32Array]"]=tr["[object Map]"]=tr["[object Number]"]=tr[er]=tr["[object RegExp]"]=tr["[object Set]"]=tr["[object String]"]=tr["[object Symbol]"]=tr["[object Uint8Array]"]=tr["[object Uint8ClampedArray]"]=tr["[object Uint16Array]"]=tr["[object Uint32Array]"]=!0,tr["[object Error]"]=tr[Qt]=tr["[object WeakMap]"]=!1;function ir(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Je;++t<r;)this.add(e[t])}function nr(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}ir.prototype.add=ir.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ir.prototype.has=function(e){return this.__data__.has(e)};function or(e,t,r,i,n,o){var s=1&r,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var h=-1,p=!0,d=2&r?new ir:void 0;for(o.set(e,t),o.set(t,e);++h<a;){var f=e[h],y=t[h];if(i)var g=s?i(y,f,h,t,e,o):i(f,y,h,e,t,o);if(void 0!==g){if(g)continue;p=!1;break}if(d){if(!nr(t,function(e,t){if(s=t,!d.has(s)&&(f===e||n(f,e,r,i,o)))return d.push(t);var s})){p=!1;break}}else if(f!==y&&!n(f,y,r,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function sr(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function ar(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var lr=g?g.prototype:void 0,cr=lr?lr.valueOf:void 0;var ur=Object.prototype.hasOwnProperty;var hr="[object Arguments]",pr="[object Array]",dr="[object Object]",fr=Object.prototype.hasOwnProperty;function yr(e,t,r,i,n,o){var s=O(e),a=O(t),l=s?pr:kt(e),c=a?pr:kt(t),u=(l=l==hr?dr:l)==dr,h=(c=c==hr?dr:c)==dr,p=l==c;if(p&&Le(e)){if(!Le(t))return!1;s=!0,u=!1}if(p&&!u)return o||(o=new yt),s||Re(e)?or(e,t,r,i,n,o):function(e,t,r,i,n,o,s){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new zt(e),new zt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ne(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=sr;case"[object Set]":var l=1&i;if(a||(a=ar),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;i|=2,s.set(e,t);var u=or(a(e),a(t),i,n,o,s);return s.delete(e),u;case"[object Symbol]":if(cr)return cr.call(e)==cr.call(t)}return!1}(e,t,l,r,i,n,o);if(!(1&r)){var d=u&&fr.call(e,"__wrapped__"),f=h&&fr.call(t,"__wrapped__");if(d||f){var y=d?e.value():e,g=f?t.value():t;return o||(o=new yt),n(y,g,r,i,o)}}return!!p&&(o||(o=new yt),function(e,t,r,i,n,o){var s=1&r,a=At(e),l=a.length;if(l!=At(t).length&&!s)return!1;for(var c=l;c--;){var u=a[c];if(!(s?u in t:ur.call(t,u)))return!1}var h=o.get(e),p=o.get(t);if(h&&p)return h==t&&p==e;var d=!0;o.set(e,t),o.set(t,e);for(var f=s;++c<l;){var y=e[u=a[c]],g=t[u];if(i)var m=s?i(g,y,u,t,e,o):i(y,g,u,e,t,o);if(!(void 0===m?y===g||n(y,g,r,i,o):m)){d=!1;break}f||(f="constructor"==u)}if(d&&!f){var b=e.constructor,_=t.constructor;b==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(d=!1)}return o.delete(e),o.delete(t),d}(e,t,r,i,n,o))}function gr(e,t,r,i,n){return e===t||(null==e||null==t||!S(e)&&!S(t)?e!=e&&t!=t:yr(e,t,r,i,gr,n))}function mr(e){return e==e&&!C(e)}function br(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}function _r(e){var t=function(e){for(var t=Ne(e),r=t.length;r--;){var i=t[r],n=e[i];t[r]=[i,n,mr(n)]}return t}(e);return 1==t.length&&t[0][2]?br(t[0][0],t[0][1]):function(r){return r===e||function(e,t,r,i){var n=r.length,o=n;if(null==e)return!o;for(e=Object(e);n--;){var s=r[n];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++n<o;){var a=(s=r[n])[0],l=e[a],c=s[1];if(s[2]){if(void 0===l&&!(a in e))return!1}else if(!gr(c,l,3,i,new yt))return!1}return!0}(r,0,t)}}function Lr(e,t){return null!=e&&t in Object(e)}function vr(e,t){return null!=e&&function(e,t,r){for(var i=-1,n=(t=rt(t,e)).length,o=!1;++i<n;){var s=it(t[i]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++i!=n?o:!!(n=null==e?0:e.length)&&le(n)&&re(s,n)&&(O(e)||ge(e))}(e,t,Lr)}function Ir(e,t){return He(e)&&mr(t)?br(it(e),t):function(r){var i=function(e,t,r){var i=null==e?void 0:nt(e,t);return void 0===i?r:i}(r,e);return void 0===i&&i===t?vr(r,e):gr(t,i,3)}}function wr(e){return He(e)?(t=it(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return nt(t,e)}}(e);var t}function Sr(e){return"function"==typeof e?e:null==e?D:"object"==typeof e?O(e)?Ir(e[0],e[1]):_r(e):wr(e)}function Ar(e,t){return t.length<2?e:nt(e,function(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(n);++i<n;)o[i]=e[i+t];return o}(t,0,-1))}var Er=Object.prototype.hasOwnProperty;function Or(e){if(null==e)return!0;if(ce(e)&&(O(e)||"string"==typeof e||"function"==typeof e.splice||Le(e)||Re(e)||ge(e)))return!e.length;var t=kt(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(he(e))return!Pe(e).length;for(var r in e)if(Er.call(e,r))return!1;return!0}function Rr(e,t){return gr(e,t)}function Tr(e){return null==e}function Mr(e,t){return null==(e=Ar(e,t=rt(t,e)))||delete e[it((r=t,i=null==r?0:r.length,i?r[i-1]:void 0))];var r,i}function Cr(e){return function(e){if(!S(e)||"[object Object]"!=w(e))return!1;var t=ct(e);if(null===t)return!0;var r=dt.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&pt.call(r)==ft}(e)?void 0:e}var Dr=function(e){return ee(function(e,t,r){return t=ae(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=ae(i.length-t,0),s=Array(o);++n<o;)s[n]=i[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=i[n];return a[t]=r(s),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,a)}}(e,void 0,lt),e+"")}(function(e,t){var r={};if(null==e)return r;var i=!1;t=E(t,function(t){return t=rt(t,e),i||(i=t.length>1),t}),function(e,t,r){var i=!r;r||(r={});for(var n=-1,o=t.length;++n<o;){var s=t[n],a=void 0;void 0===a&&(a=e[s]),i?ie(r,s,a):se(r,s,a)}}(e,Et(e),r),i&&(r=rr(r,7,Cr));for(var n=t.length;n--;)Mr(r,t[n]);return r});function xr(e,t,r,i){if(!C(e))return e;for(var n=-1,o=(t=rt(t,e)).length,s=o-1,a=e;null!=a&&++n<o;){var l=it(t[n]),c=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(n!=s){var u=a[l];void 0===(c=void 0)&&(c=C(u)?u:re(t[n+1])?[]:{})}se(a,l,c),a=a[l]}return e}function Pr(e,t){if(null==e)return{};var r=E(Et(e),function(e){return[e]});return t=Sr(t),function(e,t,r){for(var i=-1,n=t.length,o={};++i<n;){var s=t[i],a=nt(e,s);r(a,s)&&xr(o,rt(s,e),a)}return o}(e,r,function(e,r){return t(e,r[0])})}function Nr(e,t){return Pr(e,function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}(Sr(t)))}var Fr=Array.prototype.splice;function jr(e,t){var r=[];if(!e||!e.length)return r;var i=-1,n=[],o=e.length;for(t=Sr(t);++i<o;){var s=e[i];t(s,i,e)&&(r.push(s),n.push(i))}return function(e,t){for(var r=e?t.length:0,i=r-1;r--;){var n=t[r];if(r==i||n!==o){var o=n;re(n)?Fr.call(e,n,1):Mr(e,n)}}}(e,n),r}const Wr=e=>new Error(`Trying to ${e} while it is not in the map style. Did you exclude it when loading the map?`),Ur=()=>"undefined"!=typeof document&&"undefined"!=typeof DOMParser&&"undefined"!=typeof btoa,kr=e=>{if(!Ur())return;const t=document.createElement("img");return t.src=`data:image/svg+xml;base64,${btoa((new XMLSerializer).serializeToString(e))}`,t},Hr=e=>(new DOMParser).parseFromString(e,"image/svg+xml").documentElement,zr=e=>{const t=Hr('<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};const Gr=e=>(function(e){if(Tr(e))throw new Error(`${e} must not be null/undefined. Something went wrong with its initialization.`)}(e),e);class Vr{constructor(e,t,r){this.id=e,this.spec=t,this.runtimeSource=r}ensureAddedToMap(e){this.runtimeSource||(!e.getSource(this.id)&&this.spec&&e.addSource(this.id,this.spec),this.runtimeSource=e.getSource(this.id))}}class Br{constructor(e,t,r){this.map=e,this.source=t,this._layerSpecs=r,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 r of this.getLayerSpecs(t))this.map.setLayoutProperty(r.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,r)=>t===e.sourceAndLayerIDs.layerIDs[r])}}const $r=(e,t)=>e.getStyle().layers.filter(e=>t.includes(e?.source));class Yr extends Br{constructor(e,t,r){let i=$r(e,[t.id]);r&&(i=i.filter(r)),super(e,new Vr(t.id,e.getStyle().sources[t.id],t),i)}}class Kr extends Br{constructor(e,t,r,i){super(e,new Vr(t,r),i.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))}}const qr={type:"FeatureCollection",features:[]};class Zr extends Kr{constructor(e,t,r,i=!0){super(e,t,{type:"geojson",data:qr,promoteId:"id"},r),this.shownFeatures=qr,this.ensureAddedToMapWithVisibility(!1,i)}show(e){this.shownFeatures=e,Gr(this.source.runtimeSource).setData(e),this.setLayersVisible(!!e.features.length)}clear(){this.show(qr)}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 r of this.shownFeatures.features)r.properties?.eventState===e.state&&delete r.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 r of this.shownFeatures.features)e?.states&&!e.states.includes(r.properties?.eventState)||(delete r.properties?.eventState,t=!0);!1!==e?.show&&t&&this.show(this.shownFeatures)}}const Jr=async e=>{e.mapReady||(await e.mapLibreMap.once("styledata"),await Jr(e))},Xr=e=>{for(const r of e){if(!r||0===Object.keys(r.properties).length)return;for(const e in r.properties)if("string"==typeof r.properties[e])try{r.properties[e]=JSON.parse(r.properties[e])}catch(t){}}},Qr=(e,t,r)=>{const i=e.id;e.maxzoom===t.maxzoom&&e.minzoom===t.minzoom||r.setLayerZoomRange(i,e.minzoom??r.getMinZoom(),e.maxzoom??r.getMaxZoom()),r.setFilter(i,e.filter,{validate:!1});for(const n of Object.keys(t.layout??[]))e.layout?.[n]||r.setLayoutProperty(i,n,void 0,{validate:!1});for(const n of Object.keys(t.paint??[]))e.paint?.[n]||r.setPaintProperty(i,n,void 0,{validate:!1});for(const[n,o]of Object.entries(e.paint??[]))r.setPaintProperty(i,n,o,{validate:!1});for(const[n,o]of Object.entries(e.layout??[]))r.setLayoutProperty(i,n,o,{validate:!1})},ei=(e,t,r)=>{e.forEach((e,i)=>Qr(e,t[i],r))},ti=(e,t)=>{const r=/* @__PURE__ */new Set,i=e=>{t.getLayer(e.id)||t.addLayer({...e,layout:{...e.layout,visibility:"none"}},e.beforeID),r.add(e.id)},n={};for(e.forEach(e=>{e.beforeID?r.has(e.beforeID)||t.getLayer(e.beforeID)?(r.add(e.beforeID),i(e)):n[e.beforeID]?n[e.beforeID].push(e):n[e.beforeID]=[e]:i(e)});Object.keys(n).length>0;){const e=Object.keys(n).filter(e=>r.has(e));if(0===e.length)throw Error(`Circular dependency for before Ids ${JSON.stringify(Object.keys(n))}`);e.forEach(e=>{n[e].forEach(e=>i(e)),delete n[e]})}},ri=(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=>new Error(`Trying to add style module ${e} to the custom style!`))(t)}},ii=async(e,t,r)=>{e.mapLibreMap.getSource(t)||(e.mapLibreMap.isStyleLoaded()||await e.mapLibreMap.once("idle"),e.setStyle(ri(e.getStyle(),r)),await(async(e,t)=>{e.mapLibreMap.getSource(t)&&e.mapLibreMap.isSourceLoaded(t)||await e.mapLibreMap.once("sourcedata")})(e,t),e.mapLibreMap.once("styledata",()=>{for(const r of $r(e.mapLibreMap,[t]))e.mapLibreMap.setLayoutProperty(r.id,"visibility","none",{validate:!1})}))},ni=async(e,t,r,i,n)=>{if(!r)return void console.warn(`addOrUpdateImage called with empty image for ID ${t}`);const o=e=>{i.hasImage(t)||i.addImage(t,e,n)},s=e=>{e.complete?e.naturalWidth>0?o(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>o(e),e.onerror=()=>console.warn(`Failed to load image for ID ${t}`))};if("string"==typeof r)if(r.includes("<svg")){s(kr(Hr(r)))}else o((await i.loadImage(r)).data);else s(r)},oi=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},si=e=>{if("string"==typeof e)return oi(e);const t=e;return t?.id?oi(t.id):"light"};class ai{constructor(e,t,r){this._initializing=!0,this.moduleReady=!1,this.sourceType=e,this.tomtomMap=t,this.eventsProxy=t._eventsProxy,this.mapLibreMap=t.mapLibreMap,this.initSourcesWithLayers(r),this.applyConfig(r),this.tomtomMap.addStyleChangeHandler({onStyleAboutToChange:()=>{this.moduleReady=!1},onStyleChanged:()=>this.restoreDataAndConfig()}),this._initializing=!1}initSourcesWithLayers(e,t){this.moduleReady=!1,this.sourcesWithLayers=this._initSourcesWithLayers(e,t),this._sourceAndLayerIDs=Object.fromEntries(Object.entries(this.sourcesWithLayers).map(([e,t])=>[e,t.sourceAndLayerIDs])),t&&this.eventsProxy.updateIfRegistered(this.sourcesWithLayers),this.tomtomMap.mapReady&&(this.moduleReady=!0)}async waitUntilModuleReady(){await Jr(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?setTimeout(()=>this.restoreDataAndConfigImpl(),400):this.restoreDataAndConfigImpl()}restoreDataAndConfigImpl(){this.initSourcesWithLayers(this.config,!0),this._applyConfig(this.config)}getConfig(){return this.config&&{...this.config}}get sourceAndLayerIDs(){return this._sourceAndLayerIDs}}class li{constructor(e,t){this.eventProxy=e,this.sourceWithLayers=t}on(e,t){this.eventProxy.addEventHandler(this.sourceWithLayers,t,e)}off(e){this.eventProxy.remove(this.sourceWithLayers,e)}}class ci{constructor(){this.interactiveLayerIDs=[],this.handlers={},this.findHandlers=(e,t,r)=>t&&r&&e.flatMap(e=>{const i=this.handlers[t]?.[e];return 1===i?.length?i:this.handlers[t]?.[e]?.filter(e=>e.layerIDs.includes(r))||[]})||[]}ensureInteractiveLayerIDsAdded(e){e._layerSpecs.forEach(e=>{this.interactiveLayerIDs.includes(e.id)||this.interactiveLayerIDs.push(e.id)})}addEventHandler(e,t,r){this.ensureInteractiveLayerIDsAdded(e);const i=e.source.id;this.handlers[i]||(this.handlers[i]={[r]:[]}),this.handlers[i][r]??=[],this.handlers[i][r]?.push({sourceWithLayers:e,layerIDs:e._layerSpecs.map(e=>e.id),fn:t})}remove(e,t){const r=this.handlers[e.source.id]?.[t];r&&(jr(r,t=>{return r=e._layerSpecs,t.layerIDs.every((e,t)=>e===r[t].id);var r}),r.length||(delete this.handlers[e.source.id]?.[t],Or(this.handlers[e.source.id])&&delete this.handlers[e.source.id]));for(const i of e._layerSpecs)jr(this.interactiveLayerIDs,e=>i.id===e)}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 r of Object.values(e))for(const e of r)t.equalSourceAndLayerIDs(e.sourceWithLayers)&&(e.sourceWithLayers=t)}}}const ui=e=>"click"===e||"contextmenu"===e,hi=(e,t,r,i="updateInProps")=>{const{feature:n,index:o}=((e,t)=>{for(let r=0;r<e.length;r++){const i=e[r];if(i.id===t)return{feature:i,index:r}}})(r,t)||{};if(n&&(!ui(n.properties?.eventState)||ui(e))){const t={...n,properties:"updateInProps"===i?{...n?.properties,eventState:e}:Dr(n?.properties,"eventState")};return r.splice(o,1,t),o}},pi=(e,t,r)=>{const i=[...r.shownFeatures.features];Tr(hi(e,t.id,i,"removeFromProps"))||r.show({...r.shownFeatures,features:i})},di=(e,t,r,i,n)=>{if(t&&i instanceof Zr){const a=[...i.shownFeatures.features],l=hi(e,t.id,a);return!r||(s=t,(o=r)&&s&&o.id===s.id)||(n===i?hi(e,r.id,a,"removeFromProps"):n instanceof Zr&&pi(e,r,n)),i.show({...i.shownFeatures,features:a}),{feature:a[l],index:l}}var o,s;return r&&n instanceof Zr&&pi(e,r,n),{feature:t}},fi={precisionMode:"box",paddingBoxPx:5,cursorOnHover:"pointer",cursorOnMouseDown:"grabbing",cursorOnMap:"default",longHoverDelayAfterMapMoveMS:800,longHoverDelayOnStillMapMS:300};class yi extends ci{constructor(e,t={}){super(),this.enabled=!0,this.firstDelayedHoverSinceMapMove=!0,this.map=e,this.mapCanvas=e.getCanvas(),this.config={...fi,...t},this.mapCanvas.style.cursor=this.config.cursorOnMap,this.lastCursorStyle=this.config.cursorOnMap,this.defaultZoomLevel=Math.round(this.map.getZoom()),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){const t={layers:this.interactiveLayerIDs,validate:!1},r=this.config.precisionMode,i="point-then-box"===r||"point"===r?this.map.queryRenderedFeatures(e,t):[];return i.length||"point"===r?i: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=di("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),Xr(this.hoveringFeatures);const[t]=this.hoveringFeatures;if(t&&!this.hasSourceID(t.source))return;const{hoverChanged:r,mouseInMotionOverHoveredFeature:i}=((e,t,r,i)=>{if(t){if(!i)return{hoverChanged:!0};if(t.id&&t.id!==i.id||t.properties.id&&t.properties.id!==i.properties.id||t.source!==i.source||t.layer.id!==i.layer.id)return{hoverChanged:!0};if(r&&(e.x-r.x!=0||e.y-r.y!=0))return{mouseInMotionOverHoveredFeature:!0}}else if(i)return{hoverChanged:!0};return{}})(e.point,t,this.hoveringPoint,this.hoveringFeature);if(r||i){this.hoveringLngLat=e.lngLat,this.hoveringPoint=e.point;const i=this.hoveringFeature;this.hoveringFeature=t;const n=this.hoveringSourceWithLayers,o=this.findHandlers(["hover","long-hover","click","contextmenu"],t?.source,t?.layer.id);if(this.hoveringSourceWithLayers=o?.[0]?.sourceWithLayers,r){this.updateCursor(i);const r=di("hover",this.hoveringFeature,i,this.hoveringSourceWithLayers,n),o=this.findHandlers(["hover"],t?.source,t?.layer.id);for(const t of o)t.fn(r.feature,e.lngLat,this.hoveringFeatures,this.hoveringSourceWithLayers)}this.restartLongHoverTimeout()}}updateCursor(e){!e&&this.hoveringFeature?this.mapCanvas.style.cursor=this.config.cursorOnHover:e&&!this.hoveringFeature&&(this.mapCanvas.style.cursor=this.config.cursorOnMap)}onMapClick(e,t){if(!this.isEnabled())return;const r=this.getRenderedFeatures(t.point);Xr(r);const i=this.lastClickedFeature;this.lastClickedFeature=r[0];const n=this.lastClickedSourceWithLayers,o=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);this.lastClickedSourceWithLayers=o?.[0]?.sourceWithLayers;const s=di(e,this.lastClickedFeature,i,this.lastClickedSourceWithLayers,n);for(const a of o)a.fn(s.feature,t.lngLat,r,this.lastClickedSourceWithLayers)}}const gi={country:"Places - Country name",lowestPlaceLabel:"Places - Village / Hamlet",poi:"POI",lowestLabel:"Borders - Treaty label",lowestRoadLine:"Tunnel - Railway outline",lowestBuilding:"Buildings - Underground"},mi="vectorTiles",bi="hillshade",_i="places",Li="vectorTiles",vi="vectorTilesIncidents",Ii="vectorTilesFlow",wi=["POI","POI - Micro"],Si={ACCESS_GATEWAY:"access_gateway",ADVENTURE_SPORTS_FACILITY:"adventure_sports_facility",ADVENTURE_SPORTS_VENUE:"adventure_sports_venue",AGRICULTURE:"agriculture_business",AIRPORT:"airport",AMUSEMENT_PARK:"amusement_park",AQUATIC_ZOO:"zoo_or_aquarium",ASHRAM:"religious_site",ATM:"atm",AUTOMOTIVE_DEALER:"automotive_dealer",BANK:"bank",BEACH:"beach",BUS_STOP:"bus_station",BUSINESS_PARK:"business_park",CAFE_PUB:"cafe",CAMPING_GROUND:"camping_ground",CAR_WASH:"car_wash",CASH_DISPENSER:"atm",CASINO:"casino",CLOTHING_SHOP:"clothing_shop",CHURCH:"religious_site",CINEMA:"cinema",CLUB_ASSOCIATION:"club_and_association",COLLEGE_UNIVERSITY:"college_or_university",COMMERCIAL_BUILDING:"commercial_building",COMMUNITY_CENTER:"community_center",COMPANY:"company_or_office",CONCERT_HALL:"nightlife",COURTHOUSE:"courthouse",CULTURAL_CENTER:"cultural_center",DENTIST:"dentist",DEPARTMENT_STORE:"department_store",DOCTOR:"doctor",ELECTRIC_VEHICLE_STATION:"charging_location",EMBASSY:"institution_office",EMERGENCY_MEDICAL_SERVICE:"emergency_medical_service",EMERGENCY_ROOM:"emergency_room",ENTERTAINMENT:"entertainment",EXCHANGE:"stock_exchange",EXHIBITION_CONVENTION_CENTER:"cultural_center",FERRY_TERMINAL:"ferry_terminal",FIRE_STATION_BRIGADE:"fire_station",FRONTIER_CROSSING:"frontier_crossing",FUEL_FACILITIES:"fuel_station",GAS_STATION:"fuel_station",GEOGRAPHIC_FEATURE:"geographic_feature",GOLD_EXCHANGE:"gold_exchange",GOLF_COURSE:"golf_course",GOVERNMENT_OFFICE:"institution_office",GURUDWARA:"religious_site",HEALTH_CARE_SERVICE:"healthcare_service",HELIPAD_HELICOPTER_LANDING:"heliport_or_helipad",HILL:"elevation_point",HOLIDAY_RENTAL:"holiday_home",HOSPITAL:"hospital",HOSPITAL_POLYCLINIC:"hospital",HOTEL_MOTEL:"hotel_or_motel",ICE_SKATING_RINK:"ice_skating_rink",IMPORTANT_TOURIST_ATTRACTION:"tourist_attraction",INDUSTRIAL_BUILDING:"industrial_building",LEISURE_CENTER:"leisure_center",LIBRARY:"library",MANUFACTURING_FACILITY:"manufacturing_facility",MARINA:"marina",MARKET:"marketplace",MEDIA_FACILITY:"media_facility",MILITARY_INSTALLATION:"military_facility",MOSQUE:"religious_site",MOTORING_ORGANIZATION_OFFICE:"motoring_organization_office",MOUNTAIN_PASS:"mountain_pass",MOUNTAIN_PEAK:"elevation_point",MOVIE_THEATER:"cinema",MUSEUM:"museum",NATIVE_RESERVATION:"native_reservation",NIGHTLIFE:"nightlife",NON_GOVERNMENTAL_ORGANIZATION:"non_governmental_organization",OPEN_PARKING_AREA:"parking_facility",OPERA_HOUSE:"theater",PAGODA:"religious_site",PARK_RECREATION_AREA:"park_and_recreation_area",PARKING_GARAGE:"parking_facility",PETROL_STATION:"fuel_station",PHARMACY:"pharmacy",PLACE_OF_WORSHIP:"place_of_worship",POLICE_STATION:"police_station",PORT_WAREHOUSE_FACILITY:"port_or_warehouse_facility",POST_OFFICE:"post_office",PRIMARY_RESOURCE_UTILITY:"primary_resource_or_utility",PRISON_CORRECTIONAL_FACILITY:"prison",PUBLIC_AMENITY:"public_amenity",PUBLIC_TRANSPORT_STOP:"public_transport_stop",RAILWAY_STATION:"railway_station",RENT_A_CAR_FACILITY:"car_rental",RENT_A_CAR_PARKING:"rent_a_car_parking",REPAIR_FACILITY:"repair_facility",RESEARCH_FACILITY:"research_facility",RESIDENTIAL_ACCOMMODATION:"urban_ground",REST_AREA:"rest_area",RESTAURANT:"restaurant",RESTAURANT_AREA:"restaurant_area",SCENIC_PANORAMIC_VIEW:"viewpoint",SCHOOL:"school",SHOP:"shop_or_store",SHOPPING_CENTER:"shop_or_store",SPORTS_CENTER:"sport_facility",STADIUM:"stadium",SUPERMARKETS_HYPERMARKETS:"supermarket",SWIMMING_POOL:"swimming_pool",SYNAGOG:"religious_site",TAXI_STAND:"taxi_stand",TEMPLE:"religious_site",TENNIS_COURT:"tennis_court",THEATER:"theater",TOLL_GATE:"toll_gate",TOURIST_INFORMATION_OFFICE:"tourist_information_office",TRAFFIC_CONTROL_DEPARTMENT:"traffic_control_department",TRAFFIC_SERVICE_CENTER:"traffic_service_center",TRAIL_SYSTEM:"trail_system",TRAILS:"trails",TRANSPORT_AUTHORITY_VEHICLE_REGISTRATION:"transport_authority_or_vehicle_registration",TRUCK_STOP:"truck_stop",VACATION_RENTAL:"vacation_rental",VETERINARIAN:"veterinarian",WATER_SPORT:"water_sport",WEIGH_STATION:"weigh_station",WELFARE_ORGANIZATION:"welfare_organization",WINERY:"manufacturing_facility",ZOOS_ARBORETA_BOTANICAL_GARDEN:"zoo_or_aquarium"},Ai=e=>e in Si?Si[e]:e.toLowerCase(),Ei="Noto-Bold",Oi="title",Ri="iconID",Ti="default_place",Mi={"icon-image":["get",Ri],"icon-anchor":"bottom","icon-size":["interpolate",["linear"],["zoom"],8,.6,22,.8],"icon-allow-overlap":!0,"icon-padding":0},Ci={"icon-translate":[0,5],"icon-translate-anchor":"viewport"},Di={"text-optional":!0,"text-font":[Ei],"text-field":["get",Oi],"text-justify":"auto","text-variable-anchor":["top","left","right"],"text-variable-anchor-offset":["top",[0,.7],"left",[1.4,-1.4],"right",[-1.4,-1.4]],"text-size":["interpolate",["linear"],["zoom"],10,14,18,16],"text-padding":5},xi={"text-color":"#333333","text-halo-color":"#FFFFFF","text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"},Pi={type:"symbol",layout:{...Mi,...Di},paint:{...Ci,...xi}},Ni=["in",["get","eventState"],["literal",["click","contextmenu"]]],Fi=["has","eventState"],ji="#3f9cd9",Wi={...Pi,filter:["!",Fi]},Ui={...Pi,filter:Fi,layout:{...Pi.layout,"icon-size":["interpolate",["linear"],["zoom"],8,.8,22,1],"text-allow-overlap":!0},paint:{...Pi.paint,"text-color":ji}},ki=(e,t,r)=>{const i=t?.text,n=t?.layers?.[r];return{...e,layout:{...e.layout,...i?.size&&{"text-size":i.size},...i?.font&&{"text-font":i.font},...i?.offset&&{"text-offset":i.offset},...i?.title&&"function"!=typeof i?.title&&{"text-field":i?.title}},paint:{...e.paint,...i?.color&&{"text-color":i.color},...i?.haloColor&&{"text-halo-color":i.haloColor},...i?.haloWidth&&{"text-halo-width":i.haloWidth}},...n}},Hi=e=>JSON.parse(JSON.stringify(e)?.replace(/name/g,Oi)),zi=(e,t)=>{let r;if("base-map"===e?.theme){const e=(e=>{const t=e.getStyle().layers.filter(e=>"POI"===e.id)[0]||{},r=t.layout?.["text-size"];return{filter:["!",Ni],type:"symbol",paint:t.paint,layout:{...t.layout,"text-field":["get",Oi],"icon-image":["get",Ri],...r&&{"text-size":Hi(r)}}}})(t);r={main:e,selected:{...e,filter:Fi,layout:{...e.layout,"text-allow-overlap":!0},paint:{...e.paint,"text-color":ji}}}}else r={main:Wi,selected:Ui};return{main:ki(r.main,e,"main"),selected:ki(r.selected,e,"selected"),...e?.layers?.additional}},Gi=e=>{if(Ur())return kr(zr(e))},Vi=/* @__PURE__ */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]),Bi=e=>e.properties.poi?.name??e.properties.address.freeformAddress,$i=(e,t)=>`${e}-${t}`,Yi=(e,t,r={})=>{const i=r.theme??"pin",n=r.icon?.categoryIcons,o=e.properties.poi?.classifications?.[0]?.code,s=n?.find(e=>e.id===o);if(s)return $i(s.id,t);const a=$i(Ti,t);let l;return l="pin"===i?((e,t)=>{const r=e.properties.poi?.categoryIds?.[0];return r?Vi.has(r)?r.toString():r.toString().substring(0,4):t})(e,a):(o&&`poi-${Ai(o)}`)??a,l},Ki=e=>{const t=e.properties.poi?.classifications?.[0]?.code;return t&&Ai(t)},qi=e=>Array.isArray(e)?{type:"FeatureCollection",features:e}:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:e,Zi=(e,t,r={})=>{const i=qi(e);return{...i,features:i.features.map(e=>{const i="function"==typeof r?.text?.title?r?.text?.title(e):Bi(e),n=r.extraFeatureProps?Object.fromEntries(Object.entries(r.extraFeatureProps).map(([t,r])=>[t,"function"==typeof r?r(e):r])):{};return{...e,geometry:{...e.geometry,bbox:e.bbox},properties:{...e.properties,id:e.id,title:i,iconID:Yi(e,t,r),..."base-map"===r?.theme&&{category:Ki(e)},...n}}})}},Ji=class e extends ai{static async get(t,r){return await Jr(t),new e(t,r)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(t,r){return r||(e.lastInstanceIndex++,this.instanceIndex=e.lastInstanceIndex,this.sourceID=`${_i}-${this.instanceIndex}`,this.layerIDPrefix=`places-${this.instanceIndex}`,this.defaultPlaceIconID=$i(Ti,this.instanceIndex)),this.layerSpecs=this.buildLayerSpecs(t),{places:new Zr(this.mapLibreMap,this.sourceID,[this.layerSpecs.main,this.layerSpecs.selected])}}buildLayerSpecs(e){const t=zi(e,this.mapLibreMap);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),r=[t.main,t.selected],i=[this.layerSpecs.main,this.layerSpecs.selected];ei(r,i,this.mapLibreMap),this.layerSpecs=t,this.updateData(e)}setupImages(e){if(console.log("setupImages",this.defaultPlaceIconID),e?.icon){for(const t of e.icon.categoryIcons??[])ni(0,$i(t.id,this.instanceIndex),t.image,this.mapLibreMap,{pixelRatio:t.pixelRatio??2});e.icon.default&&(e.icon.default.image&&ni(0,this.defaultPlaceIconID,e.icon.default.image.image,this.mapLibreMap,{pixelRatio:e.icon.default.image.pixelRatio??2}),e.icon.default.style&&ni(0,this.defaultPlaceIconID,Gi(e.icon.default.style),this.mapLibreMap,{pixelRatio:2}))}else console.log("Adding default pin icon for places module",this.defaultPlaceIconID),ni(0,this.defaultPlaceIconID,Gi(),this.mapLibreMap,{pixelRatio:2})}updateData(e){this.sourcesWithLayers.places.source.runtimeSource?.setData(Zi(this.sourcesWithLayers.places.shownFeatures,this.instanceIndex,e))}async show(e){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.show(Zi(e,this.instanceIndex,this.config))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.clear()}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 li(this.eventsProxy,this.sourcesWithLayers.places)}};Ji.lastInstanceIndex=-1;let Xi=Ji;const Qi=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(!Qi(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}},en=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,tn=(e,t)=>{return t?["all",e[(r=t,Qi(r)?"expression":"legacy")],t]:e.expression;var r},rn=(e,t,r)=>{if(1===r.length){const i="only"===t?"==":"!=";return{expression:[i,["get",e],r[0]],legacy:[i,e,r[0]]}}const i=["in",["get",e],["literal",r]];return"only"===t?{expression:i,legacy:["in",e,...r]}:{expression:["!",i],legacy:["!in",e,...r]}},nn=(e,t,r)=>rn(e,t.show,r?t.values.map(r):t.values),on={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"]},sn=e=>{const t=[];return e.forEach(e=>{e in on?t.push(...on[e].map(Ai)):t.push(Ai(e))}),[...new Set(t)]};class an extends ai{static async get(e,t){return await Jr(e),new an(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(mi);if(!e)throw Wr(`init ${an.name} with source ID ${mi}`);const t=new Yr(this.mapLibreMap,e,e=>wi.includes(e.id)),r=t.sourceAndLayerIDs.layerIDs[0];return this.mapLibreMap.getLayer(r)&&(this.originalFilter=this.mapLibreMap.getFilter(r)),{poi:t}}_applyConfig(e){return e&&!Tr(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=rn("category",e.show,sn(e.values));this.mapLibreMap.setFilter("POI",tn(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}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.poi)}}const ln={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"]}},cn=(e,t)=>{const r=ln[e];return r.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&r.layerTypes.includes(t.type)},un=e=>t=>(!e||((e,t)=>{const r=t?.mode,i=t?.names;if(r&&i?.length){if("include"===r)return i.some(t=>cn(t,e));if("exclude"===r)return!i.some(t=>cn(t,e))}return!0})(t,e))&&!wi.includes(t.id);class hn extends ai{static async get(e,t){return await Jr(e),new hn(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(e){const t=this.mapLibreMap.getSource(Li);if(!t)throw Wr(`init ${hn.name} with source ID ${Li}`);return{vectorTiles:new Yr(this.mapLibreMap,t,un(e?.layerGroupsFilter))}}_applyConfig(e){return e&&!Tr(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,r=e.names;return"include"===t?e=>r.some(t=>cn(t,e)):"exclude"===t?e=>!r.some(t=>cn(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups))}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles)}}const pn=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],dn="title",fn="color",yn={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"]},gn="#0A3653",mn={type:"fill",paint:{"fill-color":["coalesce",["get",fn],gn],"fill-opacity":.15,"fill-antialias":!1}},bn={type:"line",paint:{"line-color":gn,"line-opacity":.45,"line-width":2}},_n=(e,t,r)=>{const i=r?.colorConfig,n=r?.lineConfig;return[{...mn,id:e,paint:{...mn.paint,...!Tr(i?.fillOpacity)&&{"fill-opacity":i?.fillOpacity},...i?.fillColor&&{"fill-color":["get","color"]}}},{...bn,id:t,paint:{...bn.paint,...!Tr(n?.lineColor)&&{"line-color":n?.lineColor},...!Tr(n?.lineWidth)&&{"line-width":n?.lineWidth},...!Tr(n?.lineOpacity)&&{"line-opacity":n?.lineOpacity}}}]},Ln=(e,t)=>{const r=t?.textConfig;return{type:"symbol",id:e,layout:{"text-field":["get",dn],...r?.textField&&{"text-field":r.textField},"text-padding":5,"text-size":12,"text-font":[Ei],"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"}}},vn=(e,t={})=>({...e,features:e.features.map((e,r)=>{const i=e.properties?.title?e.properties.title:((e,t)=>t.textConfig?.textField?t.textConfig.textField:e.properties?.address?.freeformAddress)(e,t),n=e.properties?.color?e.properties.color:((e,t)=>{const r=e?.colorConfig?.fillColor;if("string"==typeof r&&yn[r]){const e=yn[r];return e[t%e.length]}return r})(t,r);return{...e,properties:{...e.properties,title:i,color:n}}})}),In=e=>{const i=e.features.map(e=>{let i;if(e.properties?.placeCoordinates)i=e.properties?.placeCoordinates;else if("MultiPolygon"===e.geometry.type){const n=(e=>e.flat().reduce((e,t)=>t.length>e.length?t:e,[]))(e.geometry.coordinates),o=t(n);i=o&&r(o)||null}else i=e.geometry.coordinates.flat();return{type:"Feature",geometry:{type:"Point",coordinates:i},properties:e.properties}});return{type:"FeatureCollection",bbox:e.bbox,features:i}},wn=class e extends ai{static async get(t,r){return await Jr(t),new e(t,r)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(t,r){if(!r){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.titleLayerID=`${t}_Title`}const[i,n]=_n(this.fillLayerID,this.outlineLayerID,t),o=Ln(this.titleLayerID,t);return this.titleLayerSpecs=o,this.geometryFillLayerSpecs=i,this.geometryOutlineLayerSpecs=n,{geometry:new Zr(this.mapLibreMap,this.sourceID,[{...i},{...n}]),geometryLabel:new Zr(this.mapLibreMap,this.titleSourceID,[o])}}_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:gi[e])}applyTextConfig(e){const t={...this.config,textConfig:e};this.updateLayerAndData(t),this.sourcesWithLayers.geometryLabel.show(In(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t}updateLayerAndData(e){const[t,r]=_n(this.fillLayerID,this.outlineLayerID,e),i=Ln(this.titleLayerID,e);Qr(t,this.geometryFillLayerSpecs,this.mapLibreMap),Qr(r,this.geometryOutlineLayerSpecs,this.mapLibreMap),Qr(i,this.titleLayerSpecs,this.mapLibreMap),this.geometryFillLayerSpecs=t,this.geometryOutlineLayerSpecs=r,this.titleLayerSpecs=i}restoreDataAndConfigImpl(){const e=this.sourcesWithLayers.geometry.shownFeatures;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),this.show(e)}async show(e){await this.waitUntilModuleReady();const t=this.sourcesWithLayers.geometry;t.show(vn(e,this.config)),this.sourcesWithLayers.geometryLabel.show(In(t.shownFeatures))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.geometry.clear()}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry)}};wn.lastInstanceIndex=-1;let Sn=wn;class An extends ai{static async get(e,t){return await Jr(e),await ii(e,bi,"hillshade"),new An(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(bi);if(!e)throw Wr(`init ${An.name} with source ID ${bi}`);return{hillshade:new Yr(this.mapLibreMap,e)}}_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 li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hillshade)}}const En=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],On=["trafficIncidents","trafficFlow","hillshade"],Rn="#36A8F0",Tn="#105287",Mn="#ABAFB3",Cn="#3C4956",Dn="#727C85",xn=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],Pn=["==",["get","routeState"],"selected"],Nn=["==",["get","routeState"],"deselected"],Fn="#AD0000",jn="#FB2D09",Wn="#f58240",Un="#000000",kn=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],Hn=e=>({...Pi,filter:Pn,minzoom:4,layout:{...Pi.layout,"text-field":kn(e?.text)},paint:{...Pi.paint}}),zn={filter:Pn,minzoom:16},Gn={...zn,type:"line",layout:{"line-cap":"round"}},Vn={...Gn,paint:{"line-width":["interpolate",["linear"],["zoom"],16,14,22,20],"line-color":"grey"}},Bn={...Gn,paint:{"line-width":["interpolate",["linear"],["zoom"],16,12,22,17],"line-color":"white"}},$n="instruction-arrow",Yn={...zn,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":$n,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Kn={filter:Pn,type:"line",layout:{"line-join":"round"},paint:{"line-width":xn,"line-color":"#6dc4ed"}},qn={filter:Pn,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}},Zn={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},Jn=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],Xn={...Zn,filter:Nn,paint:{"line-color":Cn,"line-width":Jn}},Qn={...Zn,filter:Nn,paint:{"line-color":Mn,"line-width":xn}},eo={...Zn,filter:Pn,paint:{"line-color":Tn,"line-width":Jn}},to={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},ro="selected-route-summary-popup",io="deselected-route-summary-popup",no={filter:Pn,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["linear"],["zoom"],1,9,5,11,10,15,18,20],"line-color":"#BEBFFA"}},oo={filter:Pn,type:"symbol",minzoom:4,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-image":"poi-toll_gantry","icon-size":["interpolate",["linear"],["zoom"],4,.8,16.5,1]}},so=["interpolate",["linear"],["zoom"],1,2,5,3,10,4,18,6],ao={type:"line",layout:{"line-cap":"round"},paint:{"line-width":so,"line-color":["match",["get","magnitudeOfDelay"],"minor","#FFC105","moderate",jn,"major",Fn,"#C7D2D8"]}},lo={type:"line",filter:["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],layout:{"line-join":"round"},paint:{"line-width":so,"line-color":["match",["get","magnitudeOfDelay"],"unknown","rgba(190, 39, 27, 1)","rgba(137, 150, 168, 1)"],"line-dasharray":[1.5,1]}},co=["match",["get","magnitudeOfDelay"],"minor",Wn,"moderate",jn,"major",Fn,"indefinite","#666666",Un],uo={filter:Pn,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},ho={...uo,filter:["all",["has","jamIconID"],uo.filter],layout:{...uo.layout,"icon-image":["get","jamIconID"],"icon-anchor":"bottom-left","text-anchor":"bottom-left","text-field":["get","title"],"text-font":[Ei],"text-offset":[3.9,-1.4],"text-size":13},paint:{...uo.paint,"text-color":co,"text-halo-color":"#FFFFFF","text-halo-width":1}},po={...uo,filter:["all",["has","causeIconID"],uo.filter],layout:{...uo.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...uo.paint}},fo={filter:Pn,type:"line",layout:{"line-join":"round"},paint:{"line-width":xn,"line-color":"#000000","line-opacity":.3}},yo={filter:Pn,type:"line",layout:{"line-join":"round"},paint:{"line-color":Tn,"line-width":xn}},go={filter:Pn,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":Rn,"line-width":["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],"line-dasharray":[0,1.5]}},mo="traffic-clear",bo="traffic-major",_o="traffic-moderate",Lo="traffic-minor",vo=["has","formattedTraffic"],Io={type:"symbol",layout:{"icon-image":["case",Pn,ro,io],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",Pn,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",[Ei]],"text-color":["case",Pn,"black",Dn]},["concat","\t\t",["get","formattedDistance"]],{"text-color":Dn},["case",vo,"\n",""],{},["image",["case",vo,["match",["get","magnitudeOfDelay"],"major",bo,"moderate",_o,"minor",Lo,mo],""]],{},["case",vo,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Ei]],"text-color":co}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}},wo="start",So="middle",Ao="finish",Eo="indexType",Oo="stopDisplayIndex",Ro="waypointStart",To="waypointStop",Mo="waypointSoft",Co="waypointFinish",Do={"text-field":["get",Oo],"text-font":[Ei],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",Eo],So],["!",["has",Oo]]],"center","bottom"],"text-allow-overlap":!0},xo={type:"symbol",paint:{...Ci,"text-color":"#ffffff"},layout:{...Mi,...Do,"symbol-sort-key":["case",["==",["get",Ri],Mo],0,["abs",["-",["get","index"],1e3]]]}},Po={type:"symbol",paint:{...xi,"text-color":"black","text-halo-width":1.5,"text-halo-color":"#ffffff"},layout:{...Di,"text-anchor":"top","text-offset":[0,.4]}},No=(e={})=>{const t=e.layers,r=t?.sections,i=e.theme?.mainColor;return{mainLines:{routeLineArrows:{...to,beforeID:gi.lowestLabel,...t?.mainLines?.routeLineArrows},routeLine:{...(n={color:i},{...Zn,filter:Pn,paint:{"line-color":n?.color??Rn,"line-width":xn}}),beforeID:"routeIncidentBackgroundLine",...t?.mainLines?.routeLine},routeOutline:{...eo,beforeID:"routeLine",...t?.mainLines?.routeOutline},routeDeselectedLine:{...Qn,beforeID:"routeOutline",...t?.mainLines?.routeDeselectedLine},routeDeselectedOutline:{...Xn,beforeID:"routeDeselectedLine",...t?.mainLines?.routeDeselectedOutline},...t?.mainLines?.additional},waypoints:{routeWaypointSymbol:{...xo,beforeID:"routeSummaryBubbleSymbol",...t?.waypoints?.routeWaypointSymbol},routeWaypointLabel:{...Po,beforeID:"routeWaypointSymbol",...t?.waypoints?.routeWaypointLabel},...t?.waypoints?.additional},chargingStops:{routeChargingStopSymbol:{...Hn(e.chargingStops),beforeID:"routeWaypointSymbol",...t?.chargingStops?.routeChargingStopSymbol},...t?.chargingStops?.additional},sections:{incident:{routeIncidentJamSymbol:{...ho,beforeID:"routeChargingStopSymbol",...r?.incident?.routeIncidentJamSymbol},routeIncidentCauseSymbol:{...po,beforeID:"routeChargingStopSymbol",...r?.incident?.routeIncidentCauseSymbol},routeIncidentBackgroundLine:{...ao,beforeID:"routeIncidentDashedLine",...r?.incident?.routeIncidentBackgroundLine},routeIncidentDashedLine:{...lo,beforeID:"routeTunnelLine",...r?.incident?.routeIncidentDashedLine}},ferry:{routeFerryLine:{...Kn,beforeID:"routeLineArrows",...r?.ferry?.routeFerryLine},routeFerrySymbol:{...qn,beforeID:"routeIncidentJamSymbol",...r?.ferry?.routeFerrySymbol},...r?.ferry?.additional},tollRoad:{routeTollRoadOutline:{...no,beforeID:"routeDeselectedOutline",...r?.tollRoad?.routeTollRoadOutline},routeTollRoadSymbol:{...oo,beforeID:"routeChargingStopSymbol",...r?.tollRoad?.routeTollRoadSymbol},...r?.tollRoad?.additional},tunnel:{routeTunnelLine:{...fo,beforeID:"routeLineArrows",...r?.tunnel?.routeTunnelLine},...r?.tunnel?.additional},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:{...yo,beforeID:"routeVehicleRestrictedForegroundLine",...r?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine},routeVehicleRestrictedForegroundLine:{...go,beforeID:gi.lowestLabel,...r?.vehicleRestricted?.routeVehicleRestrictedForegroundLine},...r?.vehicleRestricted?.additional}},instructionLines:{routeInstructionLine:{...Bn,beforeID:gi.lowestLabel,...t?.instructionLines?.routeInstructionLine},routeInstructionOutline:{...Vn,beforeID:"routeInstructionLine",...t?.instructionLines?.routeInstructionOutline},...t?.instructionLines?.additional},instructionArrows:{routeInstructionArrowSymbol:{...Yn,beforeID:"routeInstructionLine",...t?.instructionArrows?.routeInstructionArrowSymbol},...t?.instructionArrows?.additional},summaryBubbles:{routeSummaryBubbleSymbol:{...Io,...t?.summaryBubbles?.routeSummaryBubbleSymbol},...t?.summaryBubbles?.additional}};var n},Fo=No();let jo;Ur()&&(jo=kr(Hr('<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')));const Wo=e=>{if(!Ur())return;const t=Hr('<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),kr(t)},Uo={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},ko=e=>{if(!Ur())return;const t=Hr('<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'),r=t.querySelector("#main");return r.setAttribute("transform","scale(2)"),r.setAttribute("fill",e),kr(t)},Ho=(e,t)=>{if(!Ur())return;const r=zr(t);return e&&r.appendChild(e),kr(r)},zo=(e={})=>Object.entries(e).map(([e,t])=>({...t,id:e})),Go=(e={})=>({mainLines:zo(e.mainLines),waypoints:zo(e.waypoints),chargingStops:zo(e?.chargingStops),ferries:zo(e.sections?.ferry),incidents:zo(e.sections?.incident),tollRoads:zo(e.sections?.tollRoad),tunnels:zo(e.sections?.tunnel),vehicleRestricted:zo(e.sections?.vehicleRestricted),instructionLines:zo(e.instructionLines),instructionArrows:zo(e.instructionArrows),summaryBubbles:zo(e.summaryBubbles)}),Vo=e=>{const t=i.instance.get().displayUnits,r=e?.displayUnits;return{...e,...r?{}:{displayUnits:t},layers:No(e)}},Bo={commonBaseURL:"https://api.tomtom.com",apiKey:"",apiVersion:1},$o=class{constructor(){this.config={...Bo}}put(e){this.config={...this.config,...e}}reset(){this.config={...Bo}}get(){return this.config}};$o.instance=new $o;let Yo=$o;const Ko=e=>e?.minutes??"min",qo=(e,t)=>{if(e){const i=Math.abs(e)/3600;let n=Math.floor(i),o=Math.round(i%1*60);60===o&&(o=0,n++);const s={...Yo.instance.get().displayUnits?.time,...t};if(n)return`${n} ${r=s,r?.hours??"hr"} ${o.toString().padStart(2,"0")} ${Ko(s)}`;if(o)return`${o.toString()} ${Ko(s)}`}var r},Zo=(e,t)=>{const r=t?.chargingStops?.icon;if(r?.mapping){const t=r.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"},Jo=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},Xo=(e,t)=>{const r=[];if(!1!==t?.chargingStops?.visible)for(const i of e.features)for(const e of i.properties.sections.leg){const n=e.summary.chargingInformationAtEndOfLeg;if(n){const e=n.properties;r.push({...n,properties:{...n.properties,id:n.properties.chargingParkId,iconID:Zo(n,t),title:Jo(n),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:qo(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:i.properties.routeState}})}}return{type:"FeatureCollection",features:r}},Qo=e=>e.categories.includes("jam"),es=e=>{const t=(e=>{if(Qo(e))return n(e.delayInSeconds)})(e),r=((e,t)=>Qo(e)?`traffic-jam-${e.magnitudeOfDelay??"unknown"}-${(e=>e?.length?e.length<6?"small":e.length<8?"medium":"large":"collapsed")(t)}`:null)(e,t),i=(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,...r&&{jamIconID:r},...i&&{causeIconID:i},...t&&{title:t}}},ts=(e,t)=>{if(e.properties.radiusMeters)return Mo;switch(t){case"start":return Ro;case"finish":return Co;default:return To}},rs=(e,t)=>{let r=-1;return{type:"FeatureCollection",features:e.map((i,n)=>{if(!i)return r++,null;const a=(e=>{return Array.isArray(e)?{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}:"Point"===e.type?{type:"Feature",geometry:t=e,properties:{},...t.bbox&&{bbox:t.bbox}}:e;var t})(i),l=((e,t)=>0===e?wo:e<t-1?So:Ao)(n,e.length),c=(e=>!e.properties.radiusMeters)(a);c&&r++;const u=(e=>{const t=e?.properties;return t?.poi?.name??t?.address?.freeformAddress??void 0})(a),h=a.id??o();return{...a,id:h,..."main-when-available"===t?.entryPoints&&{geometry:{type:"Point",coordinates:s(a,{useEntryPoint:"main-when-available"})}},properties:{...a.properties,id:h,index:n,indexType:l,...u&&{title:u},iconID:ts(a,l),...c&&l===So&&{stopDisplayIndex:r}}}}).filter(e=>e)}};function is(e){return e%360*Math.PI/180}function ns(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function os(e,t,r={}){if(!0===r.final)return function(e,t){let r=os(t,e);return r=(r+180)%360,r}(e,t);const i=ns(e),n=ns(t),o=is(i[0]),s=is(n[0]),a=is(i[1]),l=is(n[1]),c=Math.sin(s-o)*Math.cos(l),u=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return Math.atan2(c,u)%(2*Math.PI)*180/Math.PI}var ss=os;const as=(e,t,r)=>({type:"FeatureCollection",features:e.features.flatMap(e=>((e,t,r)=>e.properties.sections[t]?.map(t=>({type:"Feature",id:t.id,geometry:{type:"LineString",coordinates:e.geometry.coordinates.slice(t.startPointIndex,t.endPointIndex+1)},properties:{...r?r(t,e.properties):t,routeState:e.properties.routeState,...!Tr(e.properties.index)&&{routeIndex:e.properties.index}}}))||[])(e,t,r))}),ls=(e,t)=>{return t.show((r=e,i=t.shownFeatures,{...i,features:i.features.map(e=>({...e,properties:{...e.properties,routeState:r.features[e.properties.routeIndex||0].properties.routeState}}))}));var r,i},cs=(e,t=0)=>{const r="features"in e?e:{type:"FeatureCollection",features:[e]};return{...r,features:r.features.map((e,r)=>({...e,properties:{...e.properties,routeState:r===t?"selected":"deselected"}}))}},us=(e,t)=>e.some(e=>e.magnitudeOfDelay===t),hs=(e,t)=>({type:"FeatureCollection",features:e.features.map(e=>{const r=e.properties.summary,i=e.geometry.coordinates,o=n(r.trafficDelayInSeconds,t?.time),s=(e=>{const t=e.properties.sections.traffic;if(t?.length)return us(t,"major")?"major":us(t,"moderate")?"moderate":us(t,"minor")?"minor":void 0})(e);return{type:"Feature",geometry:{type:"Point",coordinates:i[Math.round(i.length/2)]},properties:{routeIndex:e.properties.index,routeState:e.properties.routeState,formattedDistance:a(r.lengthInMeters,t?.distance),formattedDuration:n(r.travelTimeInSeconds,t?.time),...s&&{magnitudeOfDelay:s},...o&&{formattedTraffic:o}}}})});class ps extends ai{static async get(e,t){return await Jr(e),new ps(e,t)}constructor(e,t){super("geojson",e,t)}createSourcesWithLayers(e){return{mainLines:new Zr(this.mapLibreMap,"routeMainLines",e.mainLines,!1),waypoints:new Zr(this.mapLibreMap,"routeWaypoints",e.waypoints,!1),incidents:new Zr(this.mapLibreMap,"routeIncidents",e.incidents,!1),ferries:new Zr(this.mapLibreMap,"routeFerries",e.ferries,!1),chargingStops:new Zr(this.mapLibreMap,"routeChargingStops",e.chargingStops,!1),tollRoads:new Zr(this.mapLibreMap,"routeTollRoads",e.tollRoads,!1),tunnels:new Zr(this.mapLibreMap,"routeTunnels",e.tunnels,!1),vehicleRestricted:new Zr(this.mapLibreMap,"routeVehicleRestricted",e.vehicleRestricted,!1),instructionLines:new Zr(this.mapLibreMap,"routeInstructionLines",e.instructionLines,!1),instructionArrows:new Zr(this.mapLibreMap,"routeInstructionArrows",e.instructionArrows,!1),summaryBubbles:new Zr(this.mapLibreMap,"routeSummaryBubbles",e.summaryBubbles,!1)}}_initSourcesWithLayers(e){this.layersSpecs=Go(Vo(e).layers);const t=this.createSourcesWithLayers(this.layersSpecs);ti(Object.values(t).flatMap(e=>e._layerSpecs),this.mapLibreMap);const r={fillColor:e?.theme?.mainColor,...e?.waypoints?.icon?.style},i={pixelRatio:2};this.addImageIfNotExisting(Ro,(e=>{if(Ur())return Ho(Hr('<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)})(r),i),this.addImageIfNotExisting(To,Ho(void 0,r),i),this.addImageIfNotExisting(Mo,(()=>{if(Ur())return kr(Hr('<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'))})(),i),this.addImageIfNotExisting(Co,(e=>{if(Ur())return Ho(Hr('<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)})(r),i),this.addImageIfNotExisting($n,jo,i),this.addImageIfNotExisting(ro,Wo("white"),Uo),this.addImageIfNotExisting(io,Wo("#EEEEEE"),Uo),this.addImageIfNotExisting(mo,ko(Un),i),this.addImageIfNotExisting(bo,ko(Fn),i),this.addImageIfNotExisting(_o,ko(jn),i),this.addImageIfNotExisting(Lo,ko(Wn),i);for(const n of e?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(n.id,n.image,{pixelRatio:n.pixelRatio??2});return t}_applyConfig(e){const t=Vo(e);if(this.config){const e=Go(t.layers);Object.keys(e).forEach(t=>{const r=t;((e,t,r,i)=>{const n=e.reduce((e,t)=>({...e,[t.id]:t}),{}),o=t.reduce((e,t)=>({...e,[t.id]:t}),{}),s=[],a=[],l=[],c=[];Object.keys(n).forEach(e=>{o[e]?(l.push(n[e]),c.push(o[e])):s.push(e)}),Object.keys(o).forEach(e=>{n[e]||a.push(e)});const u=r._layerSpecs;a.forEach(e=>{i.removeLayer(e);for(let t=0;t<u.length;t++)if(u[t].id===e){u.splice(t,1);break}}),s.forEach(e=>{const t={...n[e],source:r.source.id};u.push(t)}),r._updateSourceAndLayerIDs(),ei(l,c,i)})(e[r],this.layersSpecs[r],this.sourcesWithLayers[r],this.mapLibreMap)});const r=Object.values(this.sourcesWithLayers);ti(r.flatMap(e=>e._layerSpecs),this.mapLibreMap),r.forEach(e=>e.setLayersVisible(!!e.shownFeatures.features.length)),this.layersSpecs=e}return!Rr(this.config?.displayUnits,t.displayUnits)&&this.sourcesWithLayers.summaryBubbles.shownFeatures.features.length&&this.sourcesWithLayers.summaryBubbles.show(hs(this.sourcesWithLayers.mainLines.shownFeatures,t.displayUnits)),t}async restoreDataAndConfigImpl(){const e=Object.entries(this.sourcesWithLayers).map(e=>({[e[0]]:e[1].shownFeatures})).reduce((e,t)=>({...e,...t}),{});this.initSourcesWithLayers(),this._applyConfig(this.config);for(const t of Object.keys(e))this.sourcesWithLayers[t].show(e[t])}addImageIfNotExisting(e,t,r){ni(0,e,t,this.mapLibreMap,r)}async showRoutes(e,t){const r=cs(e,t?.selectedIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(r),this.sourcesWithLayers.vehicleRestricted.show(as(r,"vehicleRestricted")),this.sourcesWithLayers.incidents.show(as(r,"traffic",es)),this.sourcesWithLayers.chargingStops.show(Xo(r,this.config)),this.sourcesWithLayers.ferries.show(as(r,"ferry")),this.sourcesWithLayers.tunnels.show(as(r,"tunnel")),this.sourcesWithLayers.tollRoads.show(as(r,"toll")),this.sourcesWithLayers.instructionLines.show((e=>({type:"FeatureCollection",features:e.features.flatMap((e,t)=>e.properties.guidance?.instructions?.filter(e=>e.routePath?.length).map(r=>({type:"Feature",geometry:{type:"LineString",coordinates:r.routePath.map(e=>e.point)},properties:{...r,routeIndex:t,routeState:e.properties.routeState}}))||[])}))(r)),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(r=>{const i=[r.routePath[r.routePath.length-2]?.point,r.routePath[r.routePath.length-1]?.point];return{type:"Feature",geometry:{type:"Point",coordinates:i[1]},properties:{...r,routeIndex:t,routeState:e.properties.routeState,lastPointBearingDegrees:ss(i[0],i[1])}}})||[])}))(r)),this.sourcesWithLayers.summaryBubbles.show(hs(r,this.config?.displayUnits))}async clearRoutes(){await this.waitUntilModuleReady();for(const e of Object.keys(this.sourcesWithLayers))"waypoints"!==e&&this.sourcesWithLayers[e].clear()}async selectRoute(e){const t=cs(this.sourcesWithLayers.mainLines.shownFeatures,e);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(t),this.sourcesWithLayers.chargingStops.show(Xo(t,this.config)),ls(t,this.sourcesWithLayers.vehicleRestricted),ls(t,this.sourcesWithLayers.incidents),ls(t,this.sourcesWithLayers.ferries),ls(t,this.sourcesWithLayers.tollRoads),ls(t,this.sourcesWithLayers.tunnels),ls(t,this.sourcesWithLayers.instructionLines),ls(t,this.sourcesWithLayers.instructionArrows),ls(t,this.sourcesWithLayers.summaryBubbles)}async showWaypoints(e){const t=Array.isArray(e)?rs(e,this.config?.waypoints):rs(e.features,this.config?.waypoints);await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.show(t)}async clearWaypoints(){await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.clear()}get events(){return{mainLines:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.mainLines),waypoints:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.waypoints),chargingStops:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.chargingStops),summaryBubbles:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.summaryBubbles),incidents:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents),vehicleRestricted:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vehicleRestricted),ferries:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.ferries),tollRoads:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tollRoads),tunnels:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tunnels),instructionLines:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.instructionLines)}}getLayerToRenderLinesUnder(){return gi.lowestLabel}}const ds="standardLight",fs={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"}},ys=e=>`\${baseURL}/maps/orbis/assets/styles/\${version}/style.json?&apiVersion=1&key=\${apiKey}&map=${e}`,gs={standardLight:ys("basic_street-light"),standardDark:ys("basic_street-dark"),drivingLight:ys("basic_street-light-driving"),drivingDark:ys("basic_street-dark-driving"),monoLight:ys("basic_mono-light"),monoDark:ys("basic_mono-dark"),satellite:ys("basic_street-satellite")},ms=(e,t,r)=>{const i=e.id??ds,n=new URL(gs[i].replace("${baseURL}",t).replace("${version}",e.version??"0.6.0-0").replace("${apiKey}",r));for(const o of e.include??On)n.searchParams.append(o,fs[i][o]);return n.toString()},bs=e=>{const t=e.style,r=e.commonBaseURL,i=e.apiKey;return"string"==typeof t?ms({id:t},r,i):"standard"===t?.type?ms(t,r,i):"custom"===t?.type&&t?.url?((e,t)=>{const r=new URL(e);return r.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"):r.searchParams.set("key",t),r.toString()})(t.url,i):"custom"===t?.type&&t?.json?t.json:ms({id:ds},r,i)};class _s{constructor(t,r){this.mapReady=!1,this.styleChangeHandlers=[],this.setStyle=(e,t={keepState:!0})=>{this.mapReady=!1;for(const n of this.styleChangeHandlers)try{n.onStyleAboutToChange()}catch(i){console.error(i)}const r=t.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=si(r),this.mapLibreMap.once("styledata",()=>{!this.mapReady&&Rr(r,this._params.style)&&this.handleStyleData(t.keepState||!0)}),this.mapLibreMap.setStyle(bs(this._params))},this.getStyle=()=>this._params.style,this._params=l(r),this.styleLightDarkTheme=si(this._params.style),this.ensureMapLibreCSSLoaded(),this.mapLibreMap=new u(((t,r)=>{return{validateStyle:!1,maxTileCacheZoomLevels:22,cancelPendingTileRequestsWhileZooming:!1,...t,style:bs(r),attributionControl:{compact:!1},transformRequest:(i=r,(t,r)=>t.includes("tomtom.com")?"Image"===r?{url:t}:{url:t,headers:{...e(i)}}:{url:t})};var i})(t,this._params)),this.mapLibreMap.once("styledata",()=>{this.handleStyleData(!1)}),this._eventsProxy=new yi(this.mapLibreMap,this._params?.eventsConfig),this.loadRTLTextPlugin()}loadRTLTextPlugin(){setTimeout(()=>{["deferred","loaded"].includes(h())||p("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@5.12.0/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 r=t?["coalesce",["get",`name_${t}`],["get","name"]]:["get","name"];this.mapLibreMap.setLayoutProperty(e.id,"text-field",r,{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 r of $r(this.mapLibreMap,[vi,Ii,bi]))this.mapLibreMap.setLayoutProperty(r.id,"visibility","none",{validate:!1});if((async(e,t)=>{t.setSprite(`${e.commonBaseURL}/maps/orbis/assets/sprites/2.*/sprite?key=${e.apiKey}&poi=poi_${si(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 r of this.styleChangeHandlers)try{r.onStyleChanged()}catch(t){console.error(t)}}addStyleChangeHandler(e){this.styleChangeHandlers.push(e)}}const Ls=["unknown","accident","fog","dangerous_conditions","rain","ice","jam","lane_closed","road_closed","road_works","wind","flooding","broken_down_vehicle"],vs={unknown:0,accident:1,fog:2,dangerous_conditions:3,rain:4,ice:5,jam:6,lane_closed:7,road_closed:8,road_works:9,wind:10,flooding:11,broken_down_vehicle:14},Is=["motorway","trunk","primary","secondary","tertiary","street"],ws=["connecting","major_local"],Ss=["local","minor_local"],As=(e,t)=>e.length?1===e.length?{expression:e[0],legacy:t[0]}:{expression:["all",...e],legacy:["all",...t]}:null,Es=(e,t,r)=>{e&&(t.push(e.expression),r.push(e.legacy))},Os=(e,t,r,i)=>{e&&Es(nn(t,e),r,i)},Rs=(e,t,r)=>{Os(e.roadCategories,"road_category",t,r),Os(e.roadSubCategories,"road_subcategory",t,r)},Ts=e=>{const t=[],r=[];if(Rs(e,t,r),e.incidentCategories){const i=nn("icon_category_0",e.incidentCategories,e=>vs[e]);Es(i,t,r)}if(e.magnitudes){const i=nn("magnitude",e.magnitudes,e=>c.indexOf(e));Es(i,t,r)}return e.delays&&Es((e=>{const t=[],r=[];if(e.mustHaveDelay&&e.minDelayMinutes){const i=60*e.minDelayMinutes;t.push([">=",["get","delay"],i]),r.push([">=","delay",i])}else if(e.mustHaveDelay)t.push([">",["get","delay"],0]),r.push([">","delay",0]);else if(e.minDelayMinutes){const i=60*e.minDelayMinutes;t.push(["any",["!",["has","delay"]],["==",["get","delay"],0],[">=",["get","delay"],i]]),r.push(["any",["!has","delay"],["==","delay",0],[">=","delay",i]])}return As(t,r)})(e.delays),t,r),As(t,r)},Ms=e=>{if(!e?.any?.length)return null;const t=e.any.map(Ts).filter(e=>!Tr(e));return en(t)},Cs=e=>{const t=[],r=[];if(Rs(e,t,r),e.showRoadClosures){const i="only"===e.showRoadClosures?"==":"!=";t.push([i,["get","road_closure"],!0]),r.push([i,"road_closure",!0])}return As(t,r)},Ds=(e,t,r,i)=>{for(const n of t)r.setFilter(n.id,e?tn(e,i[n.id]):i[n.id])};class xs extends ai{static async get(e,t){return await Jr(e),await ii(e,Ii,"trafficFlow"),new xs(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(Ii);if(!e)throw Wr(`init ${xs.name} with source ID ${Ii}`);this.originalFilters={};for(const t of this.getLayers())this.originalFilters[t.id]=t.filter;return{trafficFlow:new Yr(this.mapLibreMap,e)}}_applyConfig(e){return this.setVisible(e?.visible??!1),this._filter(e?.filters,!1),e}getLayers(){return $r(this.tomtomMap.mapLibreMap,[Ii])}filter(e){this._filter(e)}_filter(e,t=!0){if(this.tomtomMap.mapReady)if(e?.any?.length){const t=(e=>{if(!e?.any?.length)return null;const t=e.any.map(Cs).filter(e=>!Tr(e));return en(t)})(e);t&&Ds(t,this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&Ds(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);t&&(this.config=Nr({...this.config,filters:e},Tr))}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficFlow.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.trafficFlow.isAnyLayerVisible()}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficFlow)}}class Ps extends ai{static async get(e,t){return await Jr(e),await ii(e,vi,"trafficIncidents"),new Ps(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(vi);if(!e)throw Wr(`init ${Ps.name} with source ID ${vi}`);this.originalFilters={};for(const t of this.getLayers())this.originalFilters[t.id]=t.filter;return{trafficIncidents:new Yr(this.mapLibreMap,e)}}_applyConfig(e){return this._setVisible(e?.visible??!1,{updateConfig:!1}),Tr(e?.icons?.visible)||this.setIconsVisible(e.icons.visible),this._filter(e?.filters,e?.icons?.filters,!1),console.log(e),e}filter(e,t){this._filter(e,t)}_filter(e,t,r=!0){if(this.tomtomMap.mapReady){if(e?.any?.length){const r=Ms(e);if(r){const e=t?this.getNonSymbolLayers():this.getLayers();Ds(r,e,this.mapLibreMap,this.originalFilters)}}else this.config?.filters?.any?.length&&Ds(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);if(t?.any?.length){const e=Ms(t);e&&Ds(e,this.getSymbolLayers(),this.mapLibreMap,this.originalFilters)}}r&&(this.config=Nr({...this.config,filters:e,icons:{...this.config?.icons,filters:t}},Tr))}getLayers(){return $r(this.tomtomMap.mapLibreMap,[vi])}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(e,t){(t?.updateConfig??!0)&&(delete this.config?.icons?.visible,this.config={...Nr({...this.config},Or),visible:e}),this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficIncidents.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.trafficIncidents.isAnyLayerVisible()}anyIconLayersVisible(){return!!this.sourcesWithLayers.trafficIncidents?.isAnyLayerVisible(e=>"symbol"===e.type)}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficIncidents)}}export{ai as AbstractMapModule,Br as AbstractSourceWithLayers,Kr as AddedSourceWithLayers,Li as BASE_MAP_SOURCE_ID,hn as BaseMapModule,Mn as DESELECTED_FOREGROUND_COLOR,Cn as DESELECTED_OUTLINE_COLOR,Nn as DESELECTED_ROUTE_FILTER,Dn as DESELECTED_SECONDARY_COLOR,li as EventsModule,yi as EventsProxy,Ao as FINISH_INDEX,fn as GEOMETRY_COLOR_PROP,dn as GEOMETRY_TITLE_PROP,Zr as GeoJSONSourceWithLayers,Sn as GeometriesModule,bi as HILLSHADE_SOURCE_ID,An as HillshadeModule,Eo as INDEX_TYPE,Fn as MAJOR_DELAY_COLOR,So as MIDDLE_INDEX,Wn as MINOR_DELAY_LABEL_COLOR,jn as MODERATE_DELAY_COLOR,_i as PLACES_SOURCE_PREFIX_ID,mi as POI_SOURCE_ID,an as POIsModule,Xi as PlacesModule,Rn as ROUTE_LINE_FOREGROUND_COLOR,xn as ROUTE_LINE_FOREGROUND_WIDTH,Tn as ROUTE_LINE_OUTLINE_COLOR,ps as RoutingModule,Pn as SELECTED_ROUTE_FILTER,wo as START_INDEX,Oo as STOP_DISPLAY_INDEX,Yr as StyleSourceWithLayers,Ii as TRAFFIC_FLOW_SOURCE_ID,vi as TRAFFIC_INCIDENTS_SOURCE_ID,_s as TomTomMap,Vr as TomTomMapSource,xs as TrafficFlowModule,Ps as TrafficIncidentsModule,Un as UNKNOWN_DELAY_COLOR,pn as baseMapLayerGroupNames,Bi as buildPlaceTitle,No as buildRoutingLayers,Fo as defaultRoutingLayers,$r as filterLayersBySources,Yi as getIconIDForPlace,Ki as getPOILayerCategoryForPlace,sn as getStyleCategories,$i as imageIDWithInstanceSuffix,Ls as incidentCategories,vs as incidentCategoriesMapping,gi as mapStyleLayerIDs,on as poiCategoryGroups,wi as poiLayerIDs,Zi as preparePlacesForDisplay,Is as roadCategories,En as standardStyleIDs,Ss as streetRoadCategories,On as styleModules,ws as tertiaryRoadCategories,Ai as toMapDisplayPOICategory,qi as toPlaces};
|
|
1
|
+
import{generateTomTomHeaders as e,generateId as t,bboxFromCoordsArray as r,bboxCenter as i,TomTomConfig as n,formatDuration as o,getPosition as s,formatDistance as a,mergeFromGlobal as l,indexedMagnitudes as c}from"@tomtom-org/maps-sdk/core";import{Map as u,getRTLTextPluginStatus as h,setRTLTextPlugin as p}from"maplibre-gl";var d="object"==typeof global&&global&&global.Object===Object&&global,f="object"==typeof self&&self&&self.Object===Object&&self,y=d||f||Function("return this")(),g=y.Symbol,m=Object.prototype,b=m.hasOwnProperty,_=m.toString,L=g?g.toStringTag:void 0;var v=Object.prototype.toString;var I=g?g.toStringTag:void 0;function w(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":I&&I in Object(e)?function(e){var t=b.call(e,L),r=e[L];try{e[L]=void 0;var i=!0}catch(o){}var n=_.call(e);return i&&(t?e[L]=r:delete e[L]),n}(e):function(e){return v.call(e)}(e)}function S(e){return null!=e&&"object"==typeof e}function A(e){return"symbol"==typeof e||S(e)&&"[object Symbol]"==w(e)}function E(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}var O=Array.isArray,R=g?g.prototype:void 0,T=R?R.toString:void 0;function M(e){if("string"==typeof e)return e;if(O(e))return E(e,M)+"";if(A(e))return T?T.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function C(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function D(e){return e}function x(e){if(!C(e))return!1;var t=w(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var P,N=y["__core-js_shared__"],F=(P=/[^.]+$/.exec(N&&N.keys&&N.keys.IE_PROTO||""))?"Symbol(src)_1."+P:"";var j=Function.prototype.toString;function W(e){if(null!=e){try{return j.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var U=/^\[object .+?Constructor\]$/,k=Function.prototype,H=Object.prototype,z=k.toString,G=H.hasOwnProperty,V=RegExp("^"+z.call(G).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function B(e){return!(!C(e)||(t=e,F&&F in t))&&(x(e)?V:U).test(W(e));var t}function $(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return B(r)?r:void 0}var Y=$(y,"WeakMap");var K=Date.now;var q,Z,J,X=function(){try{var e=$(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Q=X?function(e,t){return X(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:D,ee=(q=Q,Z=0,J=0,function(){var e=K(),t=16-(e-J);if(J=e,t>0){if(++Z>=800)return arguments[0]}else Z=0;return q.apply(void 0,arguments)});var te=/^(?:0|[1-9]\d*)$/;function re(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&te.test(e))&&e>-1&&e%1==0&&e<t}function ie(e,t,r){"__proto__"==t&&X?X(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function ne(e,t){return e===t||e!=e&&t!=t}var oe=Object.prototype.hasOwnProperty;function se(e,t,r){var i=e[t];oe.call(e,t)&&ne(i,r)&&(void 0!==r||t in e)||ie(e,t,r)}var ae=Math.max;function le(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function ce(e){return null!=e&&le(e.length)&&!x(e)}var ue=Object.prototype;function he(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||ue)}function pe(e){return S(e)&&"[object Arguments]"==w(e)}var de=Object.prototype,fe=de.hasOwnProperty,ye=de.propertyIsEnumerable,ge=pe(/* @__PURE__ */function(){return arguments}())?pe:function(e){return S(e)&&fe.call(e,"callee")&&!ye.call(e,"callee")};var me="object"==typeof exports&&exports&&!exports.nodeType&&exports,be=me&&"object"==typeof module&&module&&!module.nodeType&&module,_e=be&&be.exports===me?y.Buffer:void 0,Le=(_e?_e.isBuffer:void 0)||function(){return!1},ve={};function Ie(e){return function(t){return e(t)}}ve["[object Float32Array]"]=ve["[object Float64Array]"]=ve["[object Int8Array]"]=ve["[object Int16Array]"]=ve["[object Int32Array]"]=ve["[object Uint8Array]"]=ve["[object Uint8ClampedArray]"]=ve["[object Uint16Array]"]=ve["[object Uint32Array]"]=!0,ve["[object Arguments]"]=ve["[object Array]"]=ve["[object ArrayBuffer]"]=ve["[object Boolean]"]=ve["[object DataView]"]=ve["[object Date]"]=ve["[object Error]"]=ve["[object Function]"]=ve["[object Map]"]=ve["[object Number]"]=ve["[object Object]"]=ve["[object RegExp]"]=ve["[object Set]"]=ve["[object String]"]=ve["[object WeakMap]"]=!1;var we="object"==typeof exports&&exports&&!exports.nodeType&&exports,Se=we&&"object"==typeof module&&module&&!module.nodeType&&module,Ae=Se&&Se.exports===we&&d.process,Ee=function(){try{var e=Se&&Se.require&&Se.require("util").types;return e||Ae&&Ae.binding&&Ae.binding("util")}catch(t){}}(),Oe=Ee&&Ee.isTypedArray,Re=Oe?Ie(Oe):function(e){return S(e)&&le(e.length)&&!!ve[w(e)]},Te=Object.prototype.hasOwnProperty;function Me(e,t){var r=O(e),i=!r&&ge(e),n=!r&&!i&&Le(e),o=!r&&!i&&!n&&Re(e),s=r||i||n||o,a=s?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],l=a.length;for(var c in e)!t&&!Te.call(e,c)||s&&("length"==c||n&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||re(c,l))||a.push(c);return a}function Ce(e,t){return function(r){return e(t(r))}}var De=Ce(Object.keys,Object),xe=Object.prototype.hasOwnProperty;function Pe(e){if(!he(e))return De(e);var t=[];for(var r in Object(e))xe.call(e,r)&&"constructor"!=r&&t.push(r);return t}function Ne(e){return ce(e)?Me(e):Pe(e)}var Fe=Object.prototype.hasOwnProperty;function je(e){if(!C(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=he(e),r=[];for(var i in e)("constructor"!=i||!t&&Fe.call(e,i))&&r.push(i);return r}function We(e){return ce(e)?Me(e,!0):je(e)}var Ue=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ke=/^\w*$/;function He(e,t){if(O(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!A(e))||(ke.test(e)||!Ue.test(e)||null!=t&&e in Object(t))}var ze=$(Object,"create");var Ge=Object.prototype.hasOwnProperty;var Ve=Object.prototype.hasOwnProperty;function Be(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function $e(e,t){for(var r=e.length;r--;)if(ne(e[r][0],t))return r;return-1}Be.prototype.clear=function(){this.__data__=ze?ze(null):{},this.size=0},Be.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Be.prototype.get=function(e){var t=this.__data__;if(ze){var r=t[e];return"__lodash_hash_undefined__"===r?void 0:r}return Ge.call(t,e)?t[e]:void 0},Be.prototype.has=function(e){var t=this.__data__;return ze?void 0!==t[e]:Ve.call(t,e)},Be.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=ze&&void 0===t?"__lodash_hash_undefined__":t,this};var Ye=Array.prototype.splice;function Ke(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Ke.prototype.clear=function(){this.__data__=[],this.size=0},Ke.prototype.delete=function(e){var t=this.__data__,r=$e(t,e);return!(r<0)&&(r==t.length-1?t.pop():Ye.call(t,r,1),--this.size,!0)},Ke.prototype.get=function(e){var t=this.__data__,r=$e(t,e);return r<0?void 0:t[r][1]},Ke.prototype.has=function(e){return $e(this.__data__,e)>-1},Ke.prototype.set=function(e,t){var r=this.__data__,i=$e(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this};var qe=$(y,"Map");function Ze(e,t){var r,i,n=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?n["string"==typeof t?"string":"hash"]:n.map}function Je(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}Je.prototype.clear=function(){this.size=0,this.__data__={hash:new Be,map:new(qe||Ke),string:new Be}},Je.prototype.delete=function(e){var t=Ze(this,e).delete(e);return this.size-=t?1:0,t},Je.prototype.get=function(e){return Ze(this,e).get(e)},Je.prototype.has=function(e){return Ze(this,e).has(e)},Je.prototype.set=function(e,t){var r=Ze(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this};function Xe(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var r=function(){var i=arguments,n=t?t.apply(this,i):i[0],o=r.cache;if(o.has(n))return o.get(n);var s=e.apply(this,i);return r.cache=o.set(n,s)||o,s};return r.cache=new(Xe.Cache||Je),r}Xe.Cache=Je;var Qe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/\\(\\)?/g,tt=function(e){var t=Xe(e,function(e){return 500===r.size&&r.clear(),e}),r=t.cache;return t}(function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Qe,function(e,r,i,n){t.push(i?n.replace(et,"$1"):r||e)}),t});function rt(e,t){return O(e)?e:He(e,t)?[e]:tt(function(e){return null==e?"":M(e)}(e))}function it(e){if("string"==typeof e||A(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function nt(e,t){for(var r=0,i=(t=rt(t,e)).length;null!=e&&r<i;)e=e[it(t[r++])];return r&&r==i?e:void 0}function ot(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}var st=g?g.isConcatSpreadable:void 0;function at(e){return O(e)||ge(e)||!!(st&&e&&e[st])}function lt(e){return(null==e?0:e.length)?function(e,t,r,i,n){var o=-1,s=e.length;for(r||(r=at),n||(n=[]);++o<s;){var a=e[o];r(a)?ot(n,a):n[n.length]=a}return n}(e):[]}var ct=Ce(Object.getPrototypeOf,Object),ut=Function.prototype,ht=Object.prototype,pt=ut.toString,dt=ht.hasOwnProperty,ft=pt.call(Object);function yt(e){var t=this.__data__=new Ke(e);this.size=t.size}yt.prototype.clear=function(){this.__data__=new Ke,this.size=0},yt.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},yt.prototype.get=function(e){return this.__data__.get(e)},yt.prototype.has=function(e){return this.__data__.has(e)},yt.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Ke){var i=r.__data__;if(!qe||i.length<199)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new Je(i)}return r.set(e,t),this.size=r.size,this};var gt="object"==typeof exports&&exports&&!exports.nodeType&&exports,mt=gt&&"object"==typeof module&&module&&!module.nodeType&&module,bt=mt&&mt.exports===gt?y.Buffer:void 0;function _t(){return[]}bt&&bt.allocUnsafe;var Lt=Object.prototype.propertyIsEnumerable,vt=Object.getOwnPropertySymbols,It=vt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,o=[];++r<i;){var s=e[r];t(s,r,e)&&(o[n++]=s)}return o}(vt(e),function(t){return Lt.call(e,t)}))}:_t,wt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)ot(t,It(e)),e=ct(e);return t}:_t;function St(e,t,r){var i=t(e);return O(e)?i:ot(i,r(e))}function At(e){return St(e,Ne,It)}function Et(e){return St(e,We,wt)}var Ot=$(y,"DataView"),Rt=$(y,"Promise"),Tt=$(y,"Set"),Mt="[object Map]",Ct="[object Promise]",Dt="[object Set]",xt="[object WeakMap]",Pt="[object DataView]",Nt=W(Ot),Ft=W(qe),jt=W(Rt),Wt=W(Tt),Ut=W(Y),kt=w;(Ot&&kt(new Ot(new ArrayBuffer(1)))!=Pt||qe&&kt(new qe)!=Mt||Rt&&kt(Rt.resolve())!=Ct||Tt&&kt(new Tt)!=Dt||Y&&kt(new Y)!=xt)&&(kt=function(e){var t=w(e),r="[object Object]"==t?e.constructor:void 0,i=r?W(r):"";if(i)switch(i){case Nt:return Pt;case Ft:return Mt;case jt:return Ct;case Wt:return Dt;case Ut:return xt}return t});var Ht=Object.prototype.hasOwnProperty;var zt=y.Uint8Array;function Gt(e){var t=new e.constructor(e.byteLength);return new zt(t).set(new zt(e)),t}var Vt=/\w*$/;var Bt=g?g.prototype:void 0,$t=Bt?Bt.valueOf:void 0;function Yt(e,t,r){var i,n,o,s,a,l=e.constructor;switch(t){case"[object ArrayBuffer]":return Gt(e);case"[object Boolean]":case"[object Date]":return new l(+e);case"[object DataView]":return a=Gt((s=e).buffer),new s.constructor(a,s.byteOffset,s.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return function(e){var t=Gt(e.buffer);return new e.constructor(t,e.byteOffset,e.length)}(e);case"[object Map]":case"[object Set]":return new l;case"[object Number]":case"[object String]":return new l(e);case"[object RegExp]":return(o=new(n=e).constructor(n.source,Vt.exec(n))).lastIndex=n.lastIndex,o;case"[object Symbol]":return i=e,$t?Object($t.call(i)):{}}}var Kt=Ee&&Ee.isMap,qt=Kt?Ie(Kt):function(e){return S(e)&&"[object Map]"==kt(e)};var Zt=Ee&&Ee.isSet,Jt=Zt?Ie(Zt):function(e){return S(e)&&"[object Set]"==kt(e)},Xt="[object Arguments]",Qt="[object Function]",er="[object Object]",tr={};function rr(e,t,r,i,n,o){var s;if(r&&(s=n?r(e,i,n,o):r(e)),void 0!==s)return s;if(!C(e))return e;var a=O(e);if(a)s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&Ht.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e);else{var l=kt(e),c=l==Qt||"[object GeneratorFunction]"==l;if(Le(e))return e.slice();if(l==er||l==Xt||c&&!n)s={};else{if(!tr[l])return n?e:{};s=Yt(e,l)}}o||(o=new yt);var u=o.get(e);if(u)return u;o.set(e,s),Jt(e)?e.forEach(function(i){s.add(rr(i,t,r,i,e,o))}):qt(e)&&e.forEach(function(i,n){s.set(n,rr(i,t,r,n,e,o))});var h=a?void 0:Et(e);return function(e,t){for(var r=-1,i=null==e?0:e.length;++r<i&&!1!==t(e[r],r,e););}(h||e,function(i,n){h&&(i=e[n=i]),se(s,n,rr(i,t,r,n,e,o))}),s}tr[Xt]=tr["[object Array]"]=tr["[object ArrayBuffer]"]=tr["[object DataView]"]=tr["[object Boolean]"]=tr["[object Date]"]=tr["[object Float32Array]"]=tr["[object Float64Array]"]=tr["[object Int8Array]"]=tr["[object Int16Array]"]=tr["[object Int32Array]"]=tr["[object Map]"]=tr["[object Number]"]=tr[er]=tr["[object RegExp]"]=tr["[object Set]"]=tr["[object String]"]=tr["[object Symbol]"]=tr["[object Uint8Array]"]=tr["[object Uint8ClampedArray]"]=tr["[object Uint16Array]"]=tr["[object Uint32Array]"]=!0,tr["[object Error]"]=tr[Qt]=tr["[object WeakMap]"]=!1;function ir(e){var t=-1,r=null==e?0:e.length;for(this.__data__=new Je;++t<r;)this.add(e[t])}function nr(e,t){for(var r=-1,i=null==e?0:e.length;++r<i;)if(t(e[r],r,e))return!0;return!1}ir.prototype.add=ir.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},ir.prototype.has=function(e){return this.__data__.has(e)};function or(e,t,r,i,n,o){var s=1&r,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=o.get(e),u=o.get(t);if(c&&u)return c==t&&u==e;var h=-1,p=!0,d=2&r?new ir:void 0;for(o.set(e,t),o.set(t,e);++h<a;){var f=e[h],y=t[h];if(i)var g=s?i(y,f,h,t,e,o):i(f,y,h,e,t,o);if(void 0!==g){if(g)continue;p=!1;break}if(d){if(!nr(t,function(e,t){if(s=t,!d.has(s)&&(f===e||n(f,e,r,i,o)))return d.push(t);var s})){p=!1;break}}else if(f!==y&&!n(f,y,r,i,o)){p=!1;break}}return o.delete(e),o.delete(t),p}function sr(e){var t=-1,r=Array(e.size);return e.forEach(function(e,i){r[++t]=[i,e]}),r}function ar(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}var lr=g?g.prototype:void 0,cr=lr?lr.valueOf:void 0;var ur=Object.prototype.hasOwnProperty;var hr="[object Arguments]",pr="[object Array]",dr="[object Object]",fr=Object.prototype.hasOwnProperty;function yr(e,t,r,i,n,o){var s=O(e),a=O(t),l=s?pr:kt(e),c=a?pr:kt(t),u=(l=l==hr?dr:l)==dr,h=(c=c==hr?dr:c)==dr,p=l==c;if(p&&Le(e)){if(!Le(t))return!1;s=!0,u=!1}if(p&&!u)return o||(o=new yt),s||Re(e)?or(e,t,r,i,n,o):function(e,t,r,i,n,o,s){switch(r){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!o(new zt(e),new zt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return ne(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var a=sr;case"[object Set]":var l=1&i;if(a||(a=ar),e.size!=t.size&&!l)return!1;var c=s.get(e);if(c)return c==t;i|=2,s.set(e,t);var u=or(a(e),a(t),i,n,o,s);return s.delete(e),u;case"[object Symbol]":if(cr)return cr.call(e)==cr.call(t)}return!1}(e,t,l,r,i,n,o);if(!(1&r)){var d=u&&fr.call(e,"__wrapped__"),f=h&&fr.call(t,"__wrapped__");if(d||f){var y=d?e.value():e,g=f?t.value():t;return o||(o=new yt),n(y,g,r,i,o)}}return!!p&&(o||(o=new yt),function(e,t,r,i,n,o){var s=1&r,a=At(e),l=a.length;if(l!=At(t).length&&!s)return!1;for(var c=l;c--;){var u=a[c];if(!(s?u in t:ur.call(t,u)))return!1}var h=o.get(e),p=o.get(t);if(h&&p)return h==t&&p==e;var d=!0;o.set(e,t),o.set(t,e);for(var f=s;++c<l;){var y=e[u=a[c]],g=t[u];if(i)var m=s?i(g,y,u,t,e,o):i(y,g,u,e,t,o);if(!(void 0===m?y===g||n(y,g,r,i,o):m)){d=!1;break}f||(f="constructor"==u)}if(d&&!f){var b=e.constructor,_=t.constructor;b==_||!("constructor"in e)||!("constructor"in t)||"function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _||(d=!1)}return o.delete(e),o.delete(t),d}(e,t,r,i,n,o))}function gr(e,t,r,i,n){return e===t||(null==e||null==t||!S(e)&&!S(t)?e!=e&&t!=t:yr(e,t,r,i,gr,n))}function mr(e){return e==e&&!C(e)}function br(e,t){return function(r){return null!=r&&(r[e]===t&&(void 0!==t||e in Object(r)))}}function _r(e){var t=function(e){for(var t=Ne(e),r=t.length;r--;){var i=t[r],n=e[i];t[r]=[i,n,mr(n)]}return t}(e);return 1==t.length&&t[0][2]?br(t[0][0],t[0][1]):function(r){return r===e||function(e,t,r,i){var n=r.length,o=n;if(null==e)return!o;for(e=Object(e);n--;){var s=r[n];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++n<o;){var a=(s=r[n])[0],l=e[a],c=s[1];if(s[2]){if(void 0===l&&!(a in e))return!1}else if(!gr(c,l,3,i,new yt))return!1}return!0}(r,0,t)}}function Lr(e,t){return null!=e&&t in Object(e)}function vr(e,t){return null!=e&&function(e,t,r){for(var i=-1,n=(t=rt(t,e)).length,o=!1;++i<n;){var s=it(t[i]);if(!(o=null!=e&&r(e,s)))break;e=e[s]}return o||++i!=n?o:!!(n=null==e?0:e.length)&&le(n)&&re(s,n)&&(O(e)||ge(e))}(e,t,Lr)}function Ir(e,t){return He(e)&&mr(t)?br(it(e),t):function(r){var i=function(e,t,r){var i=null==e?void 0:nt(e,t);return void 0===i?r:i}(r,e);return void 0===i&&i===t?vr(r,e):gr(t,i,3)}}function wr(e){return He(e)?(t=it(e),function(e){return null==e?void 0:e[t]}):function(e){return function(t){return nt(t,e)}}(e);var t}function Sr(e){return"function"==typeof e?e:null==e?D:"object"==typeof e?O(e)?Ir(e[0],e[1]):_r(e):wr(e)}function Ar(e,t){return t.length<2?e:nt(e,function(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(n);++i<n;)o[i]=e[i+t];return o}(t,0,-1))}var Er=Object.prototype.hasOwnProperty;function Or(e){if(null==e)return!0;if(ce(e)&&(O(e)||"string"==typeof e||"function"==typeof e.splice||Le(e)||Re(e)||ge(e)))return!e.length;var t=kt(e);if("[object Map]"==t||"[object Set]"==t)return!e.size;if(he(e))return!Pe(e).length;for(var r in e)if(Er.call(e,r))return!1;return!0}function Rr(e,t){return gr(e,t)}function Tr(e){return null==e}function Mr(e,t){return null==(e=Ar(e,t=rt(t,e)))||delete e[it((r=t,i=null==r?0:r.length,i?r[i-1]:void 0))];var r,i}function Cr(e){return function(e){if(!S(e)||"[object Object]"!=w(e))return!1;var t=ct(e);if(null===t)return!0;var r=dt.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&pt.call(r)==ft}(e)?void 0:e}var Dr=function(e){return ee(function(e,t,r){return t=ae(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=ae(i.length-t,0),s=Array(o);++n<o;)s[n]=i[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=i[n];return a[t]=r(s),function(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}(e,this,a)}}(e,void 0,lt),e+"")}(function(e,t){var r={};if(null==e)return r;var i=!1;t=E(t,function(t){return t=rt(t,e),i||(i=t.length>1),t}),function(e,t,r){var i=!r;r||(r={});for(var n=-1,o=t.length;++n<o;){var s=t[n],a=void 0;void 0===a&&(a=e[s]),i?ie(r,s,a):se(r,s,a)}}(e,Et(e),r),i&&(r=rr(r,7,Cr));for(var n=t.length;n--;)Mr(r,t[n]);return r});function xr(e,t,r,i){if(!C(e))return e;for(var n=-1,o=(t=rt(t,e)).length,s=o-1,a=e;null!=a&&++n<o;){var l=it(t[n]),c=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(n!=s){var u=a[l];void 0===(c=void 0)&&(c=C(u)?u:re(t[n+1])?[]:{})}se(a,l,c),a=a[l]}return e}function Pr(e,t){if(null==e)return{};var r=E(Et(e),function(e){return[e]});return t=Sr(t),function(e,t,r){for(var i=-1,n=t.length,o={};++i<n;){var s=t[i],a=nt(e,s);r(a,s)&&xr(o,rt(s,e),a)}return o}(e,r,function(e,r){return t(e,r[0])})}function Nr(e,t){return Pr(e,function(e){if("function"!=typeof e)throw new TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}(Sr(t)))}var Fr=Array.prototype.splice;function jr(e,t){var r=[];if(!e||!e.length)return r;var i=-1,n=[],o=e.length;for(t=Sr(t);++i<o;){var s=e[i];t(s,i,e)&&(r.push(s),n.push(i))}return function(e,t){for(var r=e?t.length:0,i=r-1;r--;){var n=t[r];if(r==i||n!==o){var o=n;re(n)?Fr.call(e,n,1):Mr(e,n)}}}(e,n),r}const Wr=e=>new Error(`Trying to ${e} while it is not in the map style. Did you exclude it when loading the map?`),Ur=()=>"undefined"!=typeof document&&"undefined"!=typeof DOMParser&&"undefined"!=typeof btoa,kr=e=>{if(!Ur())return;const t=document.createElement("img");return t.src=`data:image/svg+xml;base64,${btoa((new XMLSerializer).serializeToString(e))}`,t},Hr=e=>(new DOMParser).parseFromString(e,"image/svg+xml").documentElement,zr=e=>{const t=Hr('<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};const Gr=e=>(function(e){if(Tr(e))throw new Error(`${e} must not be null/undefined. Something went wrong with its initialization.`)}(e),e);class Vr{constructor(e,t,r){this.id=e,this.spec=t,this.runtimeSource=r}ensureAddedToMap(e){this.runtimeSource||(!e.getSource(this.id)&&this.spec&&e.addSource(this.id,this.spec),this.runtimeSource=e.getSource(this.id))}}class Br{constructor(e,t,r){this.map=e,this.source=t,this._layerSpecs=r,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 r of this.getLayerSpecs(t))this.map.setLayoutProperty(r.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,r)=>t===e.sourceAndLayerIDs.layerIDs[r])}}const $r=(e,t)=>e.getStyle().layers.filter(e=>t.includes(e?.source));class Yr extends Br{constructor(e,t,r){let i=$r(e,[t.id]);r&&(i=i.filter(r)),super(e,new Vr(t.id,e.getStyle().sources[t.id],t),i)}}class Kr extends Br{constructor(e,t,r,i){super(e,new Vr(t,r),i.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))}}const qr={type:"FeatureCollection",features:[]};class Zr extends Kr{constructor(e,t,r,i=!0){super(e,t,{type:"geojson",data:qr,promoteId:"id"},r),this.shownFeatures=qr,this.ensureAddedToMapWithVisibility(!1,i)}show(e){this.shownFeatures=e,Gr(this.source.runtimeSource).setData(e),this.setLayersVisible(!!e.features.length)}clear(){this.show(qr)}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 r of this.shownFeatures.features)r.properties?.eventState===e.state&&delete r.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 r of this.shownFeatures.features)e?.states&&!e.states.includes(r.properties?.eventState)||(delete r.properties?.eventState,t=!0);!1!==e?.show&&t&&this.show(this.shownFeatures)}}const Jr=async e=>{e.mapReady||(await e.mapLibreMap.once("styledata"),await Jr(e))},Xr=e=>{for(const r of e){if(!r||0===Object.keys(r.properties).length)return;for(const e in r.properties)if("string"==typeof r.properties[e])try{r.properties[e]=JSON.parse(r.properties[e])}catch(t){}}},Qr=(e,t,r)=>{const i=e.id;e.maxzoom===t.maxzoom&&e.minzoom===t.minzoom||r.setLayerZoomRange(i,e.minzoom??r.getMinZoom(),e.maxzoom??r.getMaxZoom()),r.setFilter(i,e.filter,{validate:!1});for(const n of Object.keys(t.layout??[]))e.layout?.[n]||r.setLayoutProperty(i,n,void 0,{validate:!1});for(const n of Object.keys(t.paint??[]))e.paint?.[n]||r.setPaintProperty(i,n,void 0,{validate:!1});for(const[n,o]of Object.entries(e.paint??[]))r.setPaintProperty(i,n,o,{validate:!1});for(const[n,o]of Object.entries(e.layout??[]))r.setLayoutProperty(i,n,o,{validate:!1})},ei=(e,t,r)=>{e.forEach((e,i)=>Qr(e,t[i],r))},ti=(e,t)=>{const r=/* @__PURE__ */new Set,i=e=>{t.getLayer(e.id)||t.addLayer({...e,layout:{...e.layout,visibility:"none"}},e.beforeID),r.add(e.id)},n={};for(e.forEach(e=>{e.beforeID?r.has(e.beforeID)||t.getLayer(e.beforeID)?(r.add(e.beforeID),i(e)):n[e.beforeID]?n[e.beforeID].push(e):n[e.beforeID]=[e]:i(e)});Object.keys(n).length>0;){const e=Object.keys(n).filter(e=>r.has(e));if(0===e.length)throw Error(`Circular dependency for before Ids ${JSON.stringify(Object.keys(n))}`);e.forEach(e=>{n[e].forEach(e=>i(e)),delete n[e]})}},ri=(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=>new Error(`Trying to add style module ${e} to the custom style!`))(t)}},ii=async(e,t,r)=>{e.mapLibreMap.getSource(t)||(e.mapLibreMap.isStyleLoaded()||await e.mapLibreMap.once("idle"),e.setStyle(ri(e.getStyle(),r)),await(async(e,t)=>{e.mapLibreMap.getSource(t)&&e.mapLibreMap.isSourceLoaded(t)||await e.mapLibreMap.once("sourcedata")})(e,t),e.mapLibreMap.once("styledata",()=>{for(const r of $r(e.mapLibreMap,[t]))e.mapLibreMap.setLayoutProperty(r.id,"visibility","none",{validate:!1})}))},ni=async(e,t,r,i,n)=>{if(!r)return void console.warn(`addOrUpdateImage called with empty image for ID ${t}`);const o=e=>{i.hasImage(t)||i.addImage(t,e,n)},s=e=>{e.complete?e.naturalWidth>0?o(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>o(e),e.onerror=()=>console.warn(`Failed to load image for ID ${t}`))};if("string"==typeof r)if(r.includes("<svg")){s(kr(Hr(r)))}else o((await i.loadImage(r)).data);else s(r)},oi=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},si=e=>{if("string"==typeof e)return oi(e);const t=e;return t?.id?oi(t.id):"light"};class ai{constructor(e,t,r){this._initializing=!0,this.moduleReady=!1,this.sourceType=e,this.tomtomMap=t,this.eventsProxy=t._eventsProxy,this.mapLibreMap=t.mapLibreMap,this.initSourcesWithLayers(r),this.applyConfig(r),this.tomtomMap.addStyleChangeHandler({onStyleAboutToChange:()=>{this.moduleReady=!1},onStyleChanged:()=>this.restoreDataAndConfig()}),this._initializing=!1}initSourcesWithLayers(e,t){this.moduleReady=!1,this.sourcesWithLayers=this._initSourcesWithLayers(e,t),this._sourceAndLayerIDs=Object.fromEntries(Object.entries(this.sourcesWithLayers).map(([e,t])=>[e,t.sourceAndLayerIDs])),t&&this.eventsProxy.updateIfRegistered(this.sourcesWithLayers),this.tomtomMap.mapReady&&(this.moduleReady=!0)}async waitUntilModuleReady(){await Jr(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?setTimeout(()=>this.restoreDataAndConfigImpl(),400):this.restoreDataAndConfigImpl()}restoreDataAndConfigImpl(){this.initSourcesWithLayers(this.config,!0),this._applyConfig(this.config)}getConfig(){return this.config&&{...this.config}}get sourceAndLayerIDs(){return this._sourceAndLayerIDs}}class li{constructor(e,t){this.eventProxy=e,this.sourceWithLayers=t}on(e,t){this.eventProxy.addEventHandler(this.sourceWithLayers,t,e)}off(e){this.eventProxy.remove(this.sourceWithLayers,e)}}class ci{constructor(){this.interactiveLayerIDs=[],this.handlers={},this.findHandlers=(e,t,r)=>t&&r&&e.flatMap(e=>{const i=this.handlers[t]?.[e];return 1===i?.length?i:this.handlers[t]?.[e]?.filter(e=>e.layerIDs.includes(r))||[]})||[]}ensureInteractiveLayerIDsAdded(e){e._layerSpecs.forEach(e=>{this.interactiveLayerIDs.includes(e.id)||this.interactiveLayerIDs.push(e.id)})}addEventHandler(e,t,r){this.ensureInteractiveLayerIDsAdded(e);const i=e.source.id;this.handlers[i]||(this.handlers[i]={[r]:[]}),this.handlers[i][r]??=[],this.handlers[i][r]?.push({sourceWithLayers:e,layerIDs:e._layerSpecs.map(e=>e.id),fn:t})}remove(e,t){const r=this.handlers[e.source.id]?.[t];r&&(jr(r,t=>{return r=e._layerSpecs,t.layerIDs.every((e,t)=>e===r[t].id);var r}),r.length||(delete this.handlers[e.source.id]?.[t],Or(this.handlers[e.source.id])&&delete this.handlers[e.source.id]));for(const i of e._layerSpecs)jr(this.interactiveLayerIDs,e=>i.id===e)}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 r of Object.values(e))for(const e of r)t.equalSourceAndLayerIDs(e.sourceWithLayers)&&(e.sourceWithLayers=t)}}}const ui=e=>"click"===e||"contextmenu"===e,hi=(e,t,r,i="updateInProps")=>{const{feature:n,index:o}=((e,t)=>{for(let r=0;r<e.length;r++){const i=e[r];if(i.id===t)return{feature:i,index:r}}})(r,t)||{};if(n&&(!ui(n.properties?.eventState)||ui(e))){const t={...n,properties:"updateInProps"===i?{...n?.properties,eventState:e}:Dr(n?.properties,"eventState")};return r.splice(o,1,t),o}},pi=(e,t,r)=>{const i=[...r.shownFeatures.features];Tr(hi(e,t.id,i,"removeFromProps"))||r.show({...r.shownFeatures,features:i})},di=(e,t,r,i,n)=>{if(t&&i instanceof Zr){const a=[...i.shownFeatures.features],l=hi(e,t.id,a);return!r||(s=t,(o=r)&&s&&o.id===s.id)||(n===i?hi(e,r.id,a,"removeFromProps"):n instanceof Zr&&pi(e,r,n)),i.show({...i.shownFeatures,features:a}),{feature:a[l],index:l}}var o,s;return r&&n instanceof Zr&&pi(e,r,n),{feature:t}},fi={precisionMode:"box",paddingBoxPx:5,cursorOnHover:"pointer",cursorOnMouseDown:"grabbing",cursorOnMap:"default",longHoverDelayAfterMapMoveMS:800,longHoverDelayOnStillMapMS:300};class yi extends ci{constructor(e,t={}){super(),this.enabled=!0,this.firstDelayedHoverSinceMapMove=!0,this.map=e,this.mapCanvas=e.getCanvas(),this.config={...fi,...t},this.mapCanvas.style.cursor=this.config.cursorOnMap,this.lastCursorStyle=this.config.cursorOnMap,this.defaultZoomLevel=Math.round(this.map.getZoom()),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){const t={layers:this.interactiveLayerIDs,validate:!1},r=this.config.precisionMode,i="point-then-box"===r||"point"===r?this.map.queryRenderedFeatures(e,t):[];return i.length||"point"===r?i: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=di("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),Xr(this.hoveringFeatures);const[t]=this.hoveringFeatures;if(t&&!this.hasSourceID(t.source))return;const{hoverChanged:r,mouseInMotionOverHoveredFeature:i}=((e,t,r,i)=>{if(t){if(!i)return{hoverChanged:!0};if(t.id&&t.id!==i.id||t.properties.id&&t.properties.id!==i.properties.id||t.source!==i.source||t.layer.id!==i.layer.id)return{hoverChanged:!0};if(r&&(e.x-r.x!=0||e.y-r.y!=0))return{mouseInMotionOverHoveredFeature:!0}}else if(i)return{hoverChanged:!0};return{}})(e.point,t,this.hoveringPoint,this.hoveringFeature);if(r||i){this.hoveringLngLat=e.lngLat,this.hoveringPoint=e.point;const i=this.hoveringFeature;this.hoveringFeature=t;const n=this.hoveringSourceWithLayers,o=this.findHandlers(["hover","long-hover","click","contextmenu"],t?.source,t?.layer.id);if(this.hoveringSourceWithLayers=o?.[0]?.sourceWithLayers,r){this.updateCursor(i);const r=di("hover",this.hoveringFeature,i,this.hoveringSourceWithLayers,n),o=this.findHandlers(["hover"],t?.source,t?.layer.id);for(const t of o)t.fn(r.feature,e.lngLat,this.hoveringFeatures,this.hoveringSourceWithLayers)}this.restartLongHoverTimeout()}}updateCursor(e){!e&&this.hoveringFeature?this.mapCanvas.style.cursor=this.config.cursorOnHover:e&&!this.hoveringFeature&&(this.mapCanvas.style.cursor=this.config.cursorOnMap)}onMapClick(e,t){if(!this.isEnabled())return;const r=this.getRenderedFeatures(t.point);Xr(r);const i=this.lastClickedFeature;this.lastClickedFeature=r[0];const n=this.lastClickedSourceWithLayers,o=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);this.lastClickedSourceWithLayers=o?.[0]?.sourceWithLayers;const s=di(e,this.lastClickedFeature,i,this.lastClickedSourceWithLayers,n);for(const a of o)a.fn(s.feature,t.lngLat,r,this.lastClickedSourceWithLayers)}}const gi={country:"Places - Country name",lowestPlaceLabel:"Places - Village / Hamlet",poi:"POI",lowestLabel:"Borders - Treaty label",lowestRoadLine:"Tunnel - Railway outline",lowestBuilding:"Buildings - Underground"},mi="vectorTiles",bi="hillshade",_i="places",Li="vectorTiles",vi="vectorTilesIncidents",Ii="vectorTilesFlow",wi=["POI","POI - Micro"],Si={ACCESS_GATEWAY:"access_gateway",ADVENTURE_SPORTS_FACILITY:"adventure_sports_facility",ADVENTURE_SPORTS_VENUE:"adventure_sports_venue",AGRICULTURE:"agriculture_business",AIRPORT:"airport",AMUSEMENT_PARK:"amusement_park",AQUATIC_ZOO:"zoo_or_aquarium",ASHRAM:"religious_site",ATM:"atm",AUTOMOTIVE_DEALER:"automotive_dealer",BANK:"bank",BEACH:"beach",BUS_STOP:"bus_station",BUSINESS_PARK:"business_park",CAFE_PUB:"cafe",CAMPING_GROUND:"camping_ground",CAR_WASH:"car_wash",CASH_DISPENSER:"atm",CASINO:"casino",CLOTHING_SHOP:"clothing_shop",CHURCH:"religious_site",CINEMA:"cinema",CLUB_ASSOCIATION:"club_and_association",COLLEGE_UNIVERSITY:"college_or_university",COMMERCIAL_BUILDING:"commercial_building",COMMUNITY_CENTER:"community_center",COMPANY:"company_or_office",CONCERT_HALL:"nightlife",COURTHOUSE:"courthouse",CULTURAL_CENTER:"cultural_center",DENTIST:"dentist",DEPARTMENT_STORE:"department_store",DOCTOR:"doctor",ELECTRIC_VEHICLE_STATION:"charging_location",EMBASSY:"institution_office",EMERGENCY_MEDICAL_SERVICE:"emergency_medical_service",EMERGENCY_ROOM:"emergency_room",ENTERTAINMENT:"entertainment",EXCHANGE:"stock_exchange",EXHIBITION_CONVENTION_CENTER:"cultural_center",FERRY_TERMINAL:"ferry_terminal",FIRE_STATION_BRIGADE:"fire_station",FRONTIER_CROSSING:"frontier_crossing",FUEL_FACILITIES:"fuel_station",GAS_STATION:"fuel_station",GEOGRAPHIC_FEATURE:"geographic_feature",GOLD_EXCHANGE:"gold_exchange",GOLF_COURSE:"golf_course",GOVERNMENT_OFFICE:"institution_office",GURUDWARA:"religious_site",HEALTH_CARE_SERVICE:"healthcare_service",HELIPAD_HELICOPTER_LANDING:"heliport_or_helipad",HILL:"elevation_point",HOLIDAY_RENTAL:"holiday_home",HOSPITAL:"hospital",HOSPITAL_POLYCLINIC:"hospital",HOTEL_MOTEL:"hotel_or_motel",ICE_SKATING_RINK:"ice_skating_rink",IMPORTANT_TOURIST_ATTRACTION:"tourist_attraction",INDUSTRIAL_BUILDING:"industrial_building",LEISURE_CENTER:"leisure_center",LIBRARY:"library",MANUFACTURING_FACILITY:"manufacturing_facility",MARINA:"marina",MARKET:"marketplace",MEDIA_FACILITY:"media_facility",MILITARY_INSTALLATION:"military_facility",MOSQUE:"religious_site",MOTORING_ORGANIZATION_OFFICE:"motoring_organization_office",MOUNTAIN_PASS:"mountain_pass",MOUNTAIN_PEAK:"elevation_point",MOVIE_THEATER:"cinema",MUSEUM:"museum",NATIVE_RESERVATION:"native_reservation",NIGHTLIFE:"nightlife",NON_GOVERNMENTAL_ORGANIZATION:"non_governmental_organization",OPEN_PARKING_AREA:"parking_facility",OPERA_HOUSE:"theater",PAGODA:"religious_site",PARK_RECREATION_AREA:"park_and_recreation_area",PARKING_GARAGE:"parking_facility",PETROL_STATION:"fuel_station",PHARMACY:"pharmacy",PLACE_OF_WORSHIP:"place_of_worship",POLICE_STATION:"police_station",PORT_WAREHOUSE_FACILITY:"port_or_warehouse_facility",POST_OFFICE:"post_office",PRIMARY_RESOURCE_UTILITY:"primary_resource_or_utility",PRISON_CORRECTIONAL_FACILITY:"prison",PUBLIC_AMENITY:"public_amenity",PUBLIC_TRANSPORT_STOP:"public_transport_stop",RAILWAY_STATION:"railway_station",RENT_A_CAR_FACILITY:"car_rental",RENT_A_CAR_PARKING:"rent_a_car_parking",REPAIR_FACILITY:"repair_facility",RESEARCH_FACILITY:"research_facility",RESIDENTIAL_ACCOMMODATION:"urban_ground",REST_AREA:"rest_area",RESTAURANT:"restaurant",RESTAURANT_AREA:"restaurant_area",SCENIC_PANORAMIC_VIEW:"viewpoint",SCHOOL:"school",SHOP:"shop_or_store",SHOPPING_CENTER:"shop_or_store",SPORTS_CENTER:"sport_facility",STADIUM:"stadium",SUPERMARKETS_HYPERMARKETS:"supermarket",SWIMMING_POOL:"swimming_pool",SYNAGOG:"religious_site",TAXI_STAND:"taxi_stand",TEMPLE:"religious_site",TENNIS_COURT:"tennis_court",THEATER:"theater",TOLL_GATE:"toll_gate",TOURIST_INFORMATION_OFFICE:"tourist_information_office",TRAFFIC_CONTROL_DEPARTMENT:"traffic_control_department",TRAFFIC_SERVICE_CENTER:"traffic_service_center",TRAIL_SYSTEM:"trail_system",TRAILS:"trails",TRANSPORT_AUTHORITY_VEHICLE_REGISTRATION:"transport_authority_or_vehicle_registration",TRUCK_STOP:"truck_stop",VACATION_RENTAL:"vacation_rental",VETERINARIAN:"veterinarian",WATER_SPORT:"water_sport",WEIGH_STATION:"weigh_station",WELFARE_ORGANIZATION:"welfare_organization",WINERY:"manufacturing_facility",ZOOS_ARBORETA_BOTANICAL_GARDEN:"zoo_or_aquarium"},Ai=e=>e in Si?Si[e]:e.toLowerCase(),Ei="Noto-Bold",Oi="title",Ri="iconID",Ti="default_place",Mi={"icon-image":["get",Ri],"icon-anchor":"bottom","icon-size":["interpolate",["linear"],["zoom"],8,.6,22,.8],"icon-allow-overlap":!0,"icon-padding":0},Ci={"icon-translate":[0,5],"icon-translate-anchor":"viewport"},Di={"text-optional":!0,"text-font":[Ei],"text-field":["get",Oi],"text-justify":"auto","text-variable-anchor":["top","left","right"],"text-variable-anchor-offset":["top",[0,.7],"left",[1.4,-1.4],"right",[-1.4,-1.4]],"text-size":["interpolate",["linear"],["zoom"],10,14,18,16],"text-padding":5},xi={"text-color":"#333333","text-halo-color":"#FFFFFF","text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"},Pi={type:"symbol",layout:{...Mi,...Di},paint:{...Ci,...xi}},Ni=["in",["get","eventState"],["literal",["click","contextmenu"]]],Fi=["has","eventState"],ji="#3f9cd9",Wi={...Pi,filter:["!",Fi]},Ui={...Pi,filter:Fi,layout:{...Pi.layout,"icon-size":["interpolate",["linear"],["zoom"],8,.8,22,1],"text-allow-overlap":!0},paint:{...Pi.paint,"text-color":ji}},ki=(e,t,r)=>{const i=t?.text,n=t?.layers?.[r];return{...e,layout:{...e.layout,...i?.size&&{"text-size":i.size},...i?.font&&{"text-font":i.font},...i?.offset&&{"text-offset":i.offset},...i?.title&&"function"!=typeof i?.title&&{"text-field":i?.title}},paint:{...e.paint,...i?.color&&{"text-color":i.color},...i?.haloColor&&{"text-halo-color":i.haloColor},...i?.haloWidth&&{"text-halo-width":i.haloWidth}},...n}},Hi=e=>JSON.parse(JSON.stringify(e)?.replace(/name/g,Oi)),zi=(e,t)=>{let r;if("base-map"===e?.theme){const e=(e=>{const t=e.getStyle().layers.filter(e=>"POI"===e.id)[0]||{},r=t.layout?.["text-size"];return{filter:["!",Ni],type:"symbol",paint:t.paint,layout:{...t.layout,"text-field":["get",Oi],"icon-image":["get",Ri],...r&&{"text-size":Hi(r)}}}})(t);r={main:e,selected:{...e,filter:Fi,layout:{...e.layout,"text-allow-overlap":!0},paint:{...e.paint,"text-color":ji}}}}else r={main:Wi,selected:Ui};return{main:ki(r.main,e,"main"),selected:ki(r.selected,e,"selected"),...e?.layers?.additional}},Gi=e=>{if(Ur())return kr(zr(e))},Vi=/* @__PURE__ */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]),Bi=e=>e.properties.poi?.name??e.properties.address.freeformAddress,$i=(e,t)=>`${e}-${t}`,Yi=(e,t,r={})=>{const i=r.theme??"pin",n=r.icon?.categoryIcons,o=e.properties.poi?.classifications?.[0]?.code,s=n?.find(e=>e.id===o);if(s)return $i(s.id,t);const a=$i(Ti,t);let l;return l="pin"===i?((e,t)=>{const r=e.properties.poi?.categoryIds?.[0];return r?Vi.has(r)?r.toString():r.toString().substring(0,4):t})(e,a):(o&&`poi-${Ai(o)}`)??a,l},Ki=e=>{const t=e.properties.poi?.classifications?.[0]?.code;return t&&Ai(t)},qi=e=>Array.isArray(e)?{type:"FeatureCollection",features:e}:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:e,Zi=(e,r,i={})=>{const n=qi(e);return{...n,features:n.features.map(e=>{const n="function"==typeof i?.text?.title?i?.text?.title(e):Bi(e),o=i.extraFeatureProps?Object.fromEntries(Object.entries(i.extraFeatureProps).map(([t,r])=>[t,"function"==typeof r?r(e):r])):{};return{...e,geometry:{...e.geometry,bbox:e.bbox},properties:{...e.properties,id:e.id??t(),title:n,iconID:Yi(e,r,i),..."base-map"===i?.theme&&{category:Ki(e)},...o}}})}},Ji=class e extends ai{static async get(t,r){return await Jr(t),new e(t,r)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(t,r){return r||(e.lastInstanceIndex++,this.instanceIndex=e.lastInstanceIndex,this.sourceID=`${_i}-${this.instanceIndex}`,this.layerIDPrefix=`places-${this.instanceIndex}`,this.defaultPlaceIconID=$i(Ti,this.instanceIndex)),this.layerSpecs=this.buildLayerSpecs(t),{places:new Zr(this.mapLibreMap,this.sourceID,[this.layerSpecs.main,this.layerSpecs.selected])}}buildLayerSpecs(e){const t=zi(e,this.mapLibreMap);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),r=[t.main,t.selected],i=[this.layerSpecs.main,this.layerSpecs.selected];ei(r,i,this.mapLibreMap),this.layerSpecs=t,this.updateData(e)}setupImages(e){if(e?.icon){for(const t of e.icon.categoryIcons??[])ni(0,$i(t.id,this.instanceIndex),t.image,this.mapLibreMap,{pixelRatio:t.pixelRatio??2});e.icon.default&&(e.icon.default.image&&ni(0,this.defaultPlaceIconID,e.icon.default.image.image,this.mapLibreMap,{pixelRatio:e.icon.default.image.pixelRatio??2}),e.icon.default.style&&ni(0,this.defaultPlaceIconID,Gi(e.icon.default.style),this.mapLibreMap,{pixelRatio:2}))}else ni(0,this.defaultPlaceIconID,Gi(),this.mapLibreMap,{pixelRatio:2})}updateData(e){this.sourcesWithLayers.places.source.runtimeSource?.setData(Zi(this.sourcesWithLayers.places.shownFeatures,this.instanceIndex,e))}async show(e){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.show(Zi(e,this.instanceIndex,this.config))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.clear()}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 li(this.eventsProxy,this.sourcesWithLayers.places)}};Ji.lastInstanceIndex=-1;let Xi=Ji;const Qi=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(!Qi(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}},en=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,tn=(e,t)=>{return t?["all",e[(r=t,Qi(r)?"expression":"legacy")],t]:e.expression;var r},rn=(e,t,r)=>{if(1===r.length){const i="only"===t?"==":"!=";return{expression:[i,["get",e],r[0]],legacy:[i,e,r[0]]}}const i=["in",["get",e],["literal",r]];return"only"===t?{expression:i,legacy:["in",e,...r]}:{expression:["!",i],legacy:["!in",e,...r]}},nn=(e,t,r)=>rn(e,t.show,r?t.values.map(r):t.values),on={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"]},sn=e=>{const t=[];return e.forEach(e=>{e in on?t.push(...on[e].map(Ai)):t.push(Ai(e))}),[...new Set(t)]};class an extends ai{static async get(e,t){return await Jr(e),new an(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(mi);if(!e)throw Wr(`init ${an.name} with source ID ${mi}`);const t=new Yr(this.mapLibreMap,e,e=>wi.includes(e.id)),r=t.sourceAndLayerIDs.layerIDs[0];return this.mapLibreMap.getLayer(r)&&(this.originalFilter=this.mapLibreMap.getFilter(r)),{poi:t}}_applyConfig(e){return e&&!Tr(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=rn("category",e.show,sn(e.values));this.mapLibreMap.setFilter("POI",tn(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}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.poi)}}const ln={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"]}},cn=(e,t)=>{const r=ln[e];return r.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&r.layerTypes.includes(t.type)},un=e=>t=>(!e||((e,t)=>{const r=t?.mode,i=t?.names;if(r&&i?.length){if("include"===r)return i.some(t=>cn(t,e));if("exclude"===r)return!i.some(t=>cn(t,e))}return!0})(t,e))&&!wi.includes(t.id);class hn extends ai{static async get(e,t){return await Jr(e),new hn(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(e){const t=this.mapLibreMap.getSource(Li);if(!t)throw Wr(`init ${hn.name} with source ID ${Li}`);return{vectorTiles:new Yr(this.mapLibreMap,t,un(e?.layerGroupsFilter))}}_applyConfig(e){return e&&!Tr(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,r=e.names;return"include"===t?e=>r.some(t=>cn(t,e)):"exclude"===t?e=>!r.some(t=>cn(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups))}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles)}}const pn=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],dn="title",fn="color",yn={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"]},gn="#0A3653",mn={type:"fill",paint:{"fill-color":["coalesce",["get",fn],gn],"fill-opacity":.15,"fill-antialias":!1}},bn={type:"line",paint:{"line-color":gn,"line-opacity":.45,"line-width":2}},_n=(e,t,r)=>{const i=r?.colorConfig,n=r?.lineConfig;return[{...mn,id:e,paint:{...mn.paint,...!Tr(i?.fillOpacity)&&{"fill-opacity":i?.fillOpacity},...i?.fillColor&&{"fill-color":["get","color"]}}},{...bn,id:t,paint:{...bn.paint,...!Tr(n?.lineColor)&&{"line-color":n?.lineColor},...!Tr(n?.lineWidth)&&{"line-width":n?.lineWidth},...!Tr(n?.lineOpacity)&&{"line-opacity":n?.lineOpacity}}}]},Ln=(e,t)=>{const r=t?.textConfig;return{type:"symbol",id:e,layout:{"text-field":["get",dn],...r?.textField&&{"text-field":r.textField},"text-padding":5,"text-size":12,"text-font":[Ei],"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"}}},vn=(e,r={})=>({...e,features:e.features.map((e,i)=>{const n=e.properties?.title??((e,t)=>t.textConfig?.textField?t.textConfig.textField:e.properties?.address?.freeformAddress)(e,r),o=e.properties?.color??((e,t)=>{const r=e?.colorConfig?.fillColor;if("string"==typeof r&&yn[r]){const e=yn[r];return e[t%e.length]}return r})(r,i);return{...e,properties:{...e.properties,...n&&{title:n},...o&&{color:o},id:e.properties?.id??t()}}})}),In=e=>{const n=e.features.map(e=>{let n;if(e.properties?.placeCoordinates)n=e.properties?.placeCoordinates;else if("MultiPolygon"===e.geometry.type){const t=(e=>e.flat().reduce((e,t)=>t.length>e.length?t:e,[]))(e.geometry.coordinates),o=r(t);n=o&&i(o)||null}else n=e.geometry.coordinates.flat();return{type:"Feature",geometry:{type:"Point",coordinates:n},properties:{...e.properties,id:e.properties?.id??t()}}});return{type:"FeatureCollection",bbox:e.bbox,features:n}},wn=class e extends ai{static async get(t,r){return await Jr(t),new e(t,r)}constructor(e,t){super("geojson",e,t)}_initSourcesWithLayers(t,r){if(!r){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.titleLayerID=`${t}_Title`}const[i,n]=_n(this.fillLayerID,this.outlineLayerID,t),o=Ln(this.titleLayerID,t);return this.titleLayerSpecs=o,this.geometryFillLayerSpecs=i,this.geometryOutlineLayerSpecs=n,{geometry:new Zr(this.mapLibreMap,this.sourceID,[{...i},{...n}]),geometryLabel:new Zr(this.mapLibreMap,this.titleSourceID,[o])}}_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:gi[e])}applyTextConfig(e){const t={...this.config,textConfig:e};this.updateLayerAndData(t),this.sourcesWithLayers.geometryLabel.show(In(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t}updateLayerAndData(e){const[t,r]=_n(this.fillLayerID,this.outlineLayerID,e),i=Ln(this.titleLayerID,e);Qr(t,this.geometryFillLayerSpecs,this.mapLibreMap),Qr(r,this.geometryOutlineLayerSpecs,this.mapLibreMap),Qr(i,this.titleLayerSpecs,this.mapLibreMap),this.geometryFillLayerSpecs=t,this.geometryOutlineLayerSpecs=r,this.titleLayerSpecs=i}restoreDataAndConfigImpl(){const e=this.sourcesWithLayers.geometry.shownFeatures;this.initSourcesWithLayers(this.config,!0),this.config&&this._applyConfig(this.config),this.show(e)}async show(e){await this.waitUntilModuleReady();const t=this.sourcesWithLayers.geometry;t.show(vn(e,this.config)),this.sourcesWithLayers.geometryLabel.show(In(t.shownFeatures))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.geometry.clear()}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry)}};wn.lastInstanceIndex=-1;let Sn=wn;class An extends ai{static async get(e,t){return await Jr(e),await ii(e,bi,"hillshade"),new An(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(bi);if(!e)throw Wr(`init ${An.name} with source ID ${bi}`);return{hillshade:new Yr(this.mapLibreMap,e)}}_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 li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.hillshade)}}const En=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],On=["trafficIncidents","trafficFlow","hillshade"],Rn="#36A8F0",Tn="#105287",Mn="#ABAFB3",Cn="#3C4956",Dn="#727C85",xn=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],Pn=["==",["get","routeState"],"selected"],Nn=["==",["get","routeState"],"deselected"],Fn="#AD0000",jn="#FB2D09",Wn="#f58240",Un="#000000",kn=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],Hn=e=>({...Pi,filter:Pn,minzoom:4,layout:{...Pi.layout,"text-field":kn(e?.text)},paint:{...Pi.paint}}),zn={filter:Pn,minzoom:16},Gn={...zn,type:"line",layout:{"line-cap":"round"}},Vn={...Gn,paint:{"line-width":["interpolate",["linear"],["zoom"],16,14,22,20],"line-color":"grey"}},Bn={...Gn,paint:{"line-width":["interpolate",["linear"],["zoom"],16,12,22,17],"line-color":"white"}},$n="instruction-arrow",Yn={...zn,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":$n,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Kn={filter:Pn,type:"line",layout:{"line-join":"round"},paint:{"line-width":xn,"line-color":"#6dc4ed"}},qn={filter:Pn,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}},Zn={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},Jn=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],Xn={...Zn,filter:Nn,paint:{"line-color":Cn,"line-width":Jn}},Qn={...Zn,filter:Nn,paint:{"line-color":Mn,"line-width":xn}},eo={...Zn,filter:Pn,paint:{"line-color":Tn,"line-width":Jn}},to={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},ro="selected-route-summary-popup",io="deselected-route-summary-popup",no={filter:Pn,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-width":["interpolate",["linear"],["zoom"],1,9,5,11,10,15,18,20],"line-color":"#BEBFFA"}},oo={filter:Pn,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]}},so=["interpolate",["linear"],["zoom"],1,2,5,3,10,4,18,6],ao={type:"line",layout:{"line-cap":"round"},paint:{"line-width":so,"line-color":["match",["get","magnitudeOfDelay"],"minor","#FFC105","moderate",jn,"major",Fn,"#C7D2D8"]}},lo={type:"line",filter:["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],layout:{"line-join":"round"},paint:{"line-width":so,"line-color":["match",["get","magnitudeOfDelay"],"unknown","rgba(190, 39, 27, 1)","rgba(137, 150, 168, 1)"],"line-dasharray":[1.5,1]}},co=["match",["get","magnitudeOfDelay"],"minor",Wn,"moderate",jn,"major",Fn,"indefinite","#666666",Un],uo={filter:Pn,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},ho={...uo,filter:["all",["has","jamIconID"],uo.filter],layout:{...uo.layout,"icon-image":["get","jamIconID"],"icon-anchor":"bottom-left","text-anchor":"bottom-left","text-field":["get","title"],"text-font":[Ei],"text-offset":[3.9,-1.4],"text-size":13},paint:{...uo.paint,"text-color":co,"text-halo-color":"#FFFFFF","text-halo-width":1}},po={...uo,filter:["all",["has","causeIconID"],uo.filter],layout:{...uo.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...uo.paint}},fo={filter:Pn,type:"line",layout:{"line-join":"round"},paint:{"line-width":xn,"line-color":"#000000","line-opacity":.3}},yo={filter:Pn,type:"line",layout:{"line-join":"round"},paint:{"line-color":Tn,"line-width":xn}},go={filter:Pn,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":Rn,"line-width":["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],"line-dasharray":[0,1.5]}},mo="traffic-clear",bo="traffic-major",_o="traffic-moderate",Lo="traffic-minor",vo=["has","formattedTraffic"],Io={type:"symbol",layout:{"icon-image":["case",Pn,ro,io],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",Pn,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",[Ei]],"text-color":["case",Pn,"black",Dn]},["concat","\t\t",["get","formattedDistance"]],{"text-color":Dn},["case",vo,"\n",""],{},["image",["case",vo,["match",["get","magnitudeOfDelay"],"major",bo,"moderate",_o,"minor",Lo,mo],""]],{},["case",vo,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Ei]],"text-color":co}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}},wo="start",So="middle",Ao="finish",Eo="indexType",Oo="stopDisplayIndex",Ro="waypointStart",To="waypointStop",Mo="waypointSoft",Co="waypointFinish",Do={"text-field":["get",Oo],"text-font":[Ei],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",Eo],So],["!",["has",Oo]]],"center","bottom"],"text-allow-overlap":!0},xo={type:"symbol",paint:{...Ci,"text-color":"#ffffff"},layout:{...Mi,...Do,"symbol-sort-key":["case",["==",["get",Ri],Mo],0,["abs",["-",["get","index"],1e3]]]}},Po={type:"symbol",paint:{...xi,"text-color":"black","text-halo-width":1.5,"text-halo-color":"#ffffff"},layout:{...Di,"text-anchor":"top","text-offset":[0,.4]}},No=(e={})=>{const t=e.layers,r=t?.sections,i=e.theme?.mainColor;return{mainLines:{routeLineArrows:{...to,beforeID:gi.lowestLabel,...t?.mainLines?.routeLineArrows},routeLine:{...(n={color:i},{...Zn,filter:Pn,paint:{"line-color":n?.color??Rn,"line-width":xn}}),beforeID:"routeIncidentBackgroundLine",...t?.mainLines?.routeLine},routeOutline:{...eo,beforeID:"routeLine",...t?.mainLines?.routeOutline},routeDeselectedLine:{...Qn,beforeID:"routeOutline",...t?.mainLines?.routeDeselectedLine},routeDeselectedOutline:{...Xn,beforeID:"routeDeselectedLine",...t?.mainLines?.routeDeselectedOutline},...t?.mainLines?.additional},waypoints:{routeWaypointSymbol:{...xo,beforeID:"routeSummaryBubbleSymbol",...t?.waypoints?.routeWaypointSymbol},routeWaypointLabel:{...Po,beforeID:"routeWaypointSymbol",...t?.waypoints?.routeWaypointLabel},...t?.waypoints?.additional},chargingStops:{routeChargingStopSymbol:{...Hn(e.chargingStops),beforeID:"routeWaypointSymbol",...t?.chargingStops?.routeChargingStopSymbol},...t?.chargingStops?.additional},sections:{incident:{routeIncidentJamSymbol:{...ho,beforeID:"routeChargingStopSymbol",...r?.incident?.routeIncidentJamSymbol},routeIncidentCauseSymbol:{...po,beforeID:"routeChargingStopSymbol",...r?.incident?.routeIncidentCauseSymbol},routeIncidentBackgroundLine:{...ao,beforeID:"routeIncidentDashedLine",...r?.incident?.routeIncidentBackgroundLine},routeIncidentDashedLine:{...lo,beforeID:"routeTunnelLine",...r?.incident?.routeIncidentDashedLine}},ferry:{routeFerryLine:{...Kn,beforeID:"routeLineArrows",...r?.ferry?.routeFerryLine},routeFerrySymbol:{...qn,beforeID:"routeIncidentJamSymbol",...r?.ferry?.routeFerrySymbol},...r?.ferry?.additional},tollRoad:{routeTollRoadOutline:{...no,beforeID:"routeDeselectedOutline",...r?.tollRoad?.routeTollRoadOutline},routeTollRoadSymbol:{...oo,beforeID:"routeChargingStopSymbol",...r?.tollRoad?.routeTollRoadSymbol},...r?.tollRoad?.additional},tunnel:{routeTunnelLine:{...fo,beforeID:"routeLineArrows",...r?.tunnel?.routeTunnelLine},...r?.tunnel?.additional},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:{...yo,beforeID:"routeVehicleRestrictedForegroundLine",...r?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine},routeVehicleRestrictedForegroundLine:{...go,beforeID:gi.lowestLabel,...r?.vehicleRestricted?.routeVehicleRestrictedForegroundLine},...r?.vehicleRestricted?.additional}},instructionLines:{routeInstructionLine:{...Bn,beforeID:gi.lowestLabel,...t?.instructionLines?.routeInstructionLine},routeInstructionOutline:{...Vn,beforeID:"routeInstructionLine",...t?.instructionLines?.routeInstructionOutline},...t?.instructionLines?.additional},instructionArrows:{routeInstructionArrowSymbol:{...Yn,beforeID:"routeInstructionLine",...t?.instructionArrows?.routeInstructionArrowSymbol},...t?.instructionArrows?.additional},summaryBubbles:{routeSummaryBubbleSymbol:{...Io,...t?.summaryBubbles?.routeSummaryBubbleSymbol},...t?.summaryBubbles?.additional}};var n},Fo=No();let jo;Ur()&&(jo=kr(Hr('<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')));const Wo=e=>{if(!Ur())return;const t=Hr('<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),kr(t)},Uo={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},ko=e=>{if(!Ur())return;const t=Hr('<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'),r=t.querySelector("#main");return r.setAttribute("transform","scale(2)"),r.setAttribute("fill",e),kr(t)},Ho=(e,t)=>{if(!Ur())return;const r=zr(t);return e&&r.appendChild(e),kr(r)},zo=(e={})=>Object.entries(e).map(([e,t])=>({...t,id:e})),Go=(e={})=>({mainLines:zo(e.mainLines),waypoints:zo(e.waypoints),chargingStops:zo(e?.chargingStops),ferries:zo(e.sections?.ferry),incidents:zo(e.sections?.incident),tollRoads:zo(e.sections?.tollRoad),tunnels:zo(e.sections?.tunnel),vehicleRestricted:zo(e.sections?.vehicleRestricted),instructionLines:zo(e.instructionLines),instructionArrows:zo(e.instructionArrows),summaryBubbles:zo(e.summaryBubbles)}),Vo=e=>{const t=n.instance.get().displayUnits,r=e?.displayUnits;return{...e,...r?{}:{displayUnits:t},layers:No(e)}},Bo={commonBaseURL:"https://api.tomtom.com",apiKey:"",apiVersion:1},$o=class{constructor(){this.config={...Bo}}put(e){this.config={...this.config,...e}}reset(){this.config={...Bo}}get(){return this.config}};$o.instance=new $o;let Yo=$o;const Ko=()=>Date.now().toString(36)+Math.random().toString(36).substring(2),qo=e=>e?.minutes??"min",Zo=(e,t)=>{if(e){const i=Math.abs(e)/3600;let n=Math.floor(i),o=Math.round(i%1*60);60===o&&(o=0,n++);const s={...Yo.instance.get().displayUnits?.time,...t};if(n)return`${n} ${r=s,r?.hours??"hr"} ${o.toString().padStart(2,"0")} ${qo(s)}`;if(o)return`${o.toString()} ${qo(s)}`}var r},Jo=(e,t)=>{const r=t?.chargingStops?.icon;if(r?.mapping){const t=r.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"},Xo=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},Qo=(e,t)=>{const r=[];if(!1!==t?.chargingStops?.visible)for(const i of e.features)for(const e of i.properties.sections.leg){const n=e.summary.chargingInformationAtEndOfLeg;if(n){const e=n.properties;r.push({...n,properties:{...n.properties,id:n.properties.chargingParkId??Ko(),iconID:Jo(n,t),title:Xo(n),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:Zo(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:i.properties.routeState}})}}return{type:"FeatureCollection",features:r}},es=e=>e.categories.includes("jam"),ts=e=>{const t=(e=>{if(es(e))return o(e.delayInSeconds)})(e),r=((e,t)=>es(e)?`traffic-jam-${e.magnitudeOfDelay??"unknown"}-${(e=>e?.length?e.length<6?"small":e.length<8?"medium":"large":"collapsed")(t)}`:null)(e,t),i=(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,...r&&{jamIconID:r},...i&&{causeIconID:i},...t&&{title:t}}},rs=(e,t)=>{if(e.properties.radiusMeters)return Mo;switch(t){case"start":return Ro;case"finish":return Co;default:return To}},is=(e,r)=>{let i=-1;return{type:"FeatureCollection",features:e.map((n,o)=>{if(!n)return i++,null;const a=(e=>{return Array.isArray(e)?{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}:"Point"===e.type?{type:"Feature",geometry:t=e,properties:{},...t.bbox&&{bbox:t.bbox}}:e;var t})(n),l=((e,t)=>0===e?wo:e<t-1?So:Ao)(o,e.length),c=(e=>!e.properties.radiusMeters)(a);c&&i++;const u=(e=>{const t=e?.properties;return t?.poi?.name??t?.address?.freeformAddress??void 0})(a);return{...a,..."main-when-available"===r?.entryPoints&&{geometry:{type:"Point",coordinates:s(a,{useEntryPoint:"main-when-available"})}},properties:{...a.properties,id:a.properties?.id??t(),index:o,indexType:l,...u&&{title:u},iconID:rs(a,l),...c&&l===So&&{stopDisplayIndex:i}}}}).filter(e=>e)}};function ns(e){return e%360*Math.PI/180}function os(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if("Feature"===e.type&&null!==e.geometry&&"Point"===e.geometry.type)return[...e.geometry.coordinates];if("Point"===e.type)return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ss(e,t,r={}){if(!0===r.final)return function(e,t){let r=ss(t,e);return r=(r+180)%360,r}(e,t);const i=os(e),n=os(t),o=ns(i[0]),s=ns(n[0]),a=ns(i[1]),l=ns(n[1]),c=Math.sin(s-o)*Math.cos(l),u=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return Math.atan2(c,u)%(2*Math.PI)*180/Math.PI}var as=ss;const ls=(e,r,i)=>({type:"FeatureCollection",features:e.features.flatMap(e=>((e,r,i)=>e.properties.sections[r]?.map(r=>({type:"Feature",geometry:{type:"LineString",coordinates:e.geometry.coordinates.slice(r.startPointIndex,r.endPointIndex+1)},properties:{...i?i(r,e.properties):r,routeState:e.properties.routeState,routeIndex:e.properties.index,id:r.id??t()}}))||[])(e,r,i))}),cs=(e,t)=>{return t.show((r=e,i=t.shownFeatures,{...i,features:i.features.map(e=>({...e,properties:{...e.properties,routeState:r.features[e.properties.routeIndex||0].properties.routeState}}))}));var r,i},us=(e,r=0)=>{const i="features"in e?e:{type:"FeatureCollection",features:[e]};return{...i,features:i.features.map((e,i)=>({...e,properties:{...e.properties,id:e.properties.id??t(),routeState:i===r?"selected":"deselected"}}))}},hs=(e,t)=>e.some(e=>e.magnitudeOfDelay===t),ps=(e,r)=>({type:"FeatureCollection",features:e.features.map(e=>{const i=e.properties.summary,n=e.geometry.coordinates,s=o(i.trafficDelayInSeconds,r?.time),l=(e=>{const t=e.properties.sections.traffic;if(t?.length)return hs(t,"major")?"major":hs(t,"moderate")?"moderate":hs(t,"minor")?"minor":void 0})(e);return{type:"Feature",geometry:{type:"Point",coordinates:n[Math.round(n.length/2)]},properties:{id:e.properties.id??t(),routeIndex:e.properties.index,routeState:e.properties.routeState,formattedDistance:a(i.lengthInMeters,r?.distance),...l&&{magnitudeOfDelay:l},...s&&{formattedTraffic:s},formattedDuration:o(i.travelTimeInSeconds,r?.time)}}})});class ds extends ai{static async get(e,t){return await Jr(e),new ds(e,t)}constructor(e,t){super("geojson",e,t)}createSourcesWithLayers(e){return{mainLines:new Zr(this.mapLibreMap,"routeMainLines",e.mainLines,!1),waypoints:new Zr(this.mapLibreMap,"routeWaypoints",e.waypoints,!1),incidents:new Zr(this.mapLibreMap,"routeIncidents",e.incidents,!1),ferries:new Zr(this.mapLibreMap,"routeFerries",e.ferries,!1),chargingStops:new Zr(this.mapLibreMap,"routeChargingStops",e.chargingStops,!1),tollRoads:new Zr(this.mapLibreMap,"routeTollRoads",e.tollRoads,!1),tunnels:new Zr(this.mapLibreMap,"routeTunnels",e.tunnels,!1),vehicleRestricted:new Zr(this.mapLibreMap,"routeVehicleRestricted",e.vehicleRestricted,!1),instructionLines:new Zr(this.mapLibreMap,"routeInstructionLines",e.instructionLines,!1),instructionArrows:new Zr(this.mapLibreMap,"routeInstructionArrows",e.instructionArrows,!1),summaryBubbles:new Zr(this.mapLibreMap,"routeSummaryBubbles",e.summaryBubbles,!1)}}_initSourcesWithLayers(e){this.layersSpecs=Go(Vo(e).layers);const t=this.createSourcesWithLayers(this.layersSpecs);ti(Object.values(t).flatMap(e=>e._layerSpecs),this.mapLibreMap);const r={fillColor:e?.theme?.mainColor,...e?.waypoints?.icon?.style},i={pixelRatio:2};this.addImageIfNotExisting(Ro,(e=>{if(Ur())return Ho(Hr('<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)})(r),i),this.addImageIfNotExisting(To,Ho(void 0,r),i),this.addImageIfNotExisting(Mo,(()=>{if(Ur())return kr(Hr('<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'))})(),i),this.addImageIfNotExisting(Co,(e=>{if(Ur())return Ho(Hr('<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)})(r),i),this.addImageIfNotExisting($n,jo,i),this.addImageIfNotExisting(ro,Wo("white"),Uo),this.addImageIfNotExisting(io,Wo("#EEEEEE"),Uo),this.addImageIfNotExisting(mo,ko(Un),i),this.addImageIfNotExisting(bo,ko(Fn),i),this.addImageIfNotExisting(_o,ko(jn),i),this.addImageIfNotExisting(Lo,ko(Wn),i);for(const n of e?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(n.id,n.image,{pixelRatio:n.pixelRatio??2});return t}_applyConfig(e){const t=Vo(e);if(this.config){const e=Go(t.layers);Object.keys(e).forEach(t=>{const r=t;((e,t,r,i)=>{const n=e.reduce((e,t)=>({...e,[t.id]:t}),{}),o=t.reduce((e,t)=>({...e,[t.id]:t}),{}),s=[],a=[],l=[],c=[];Object.keys(n).forEach(e=>{o[e]?(l.push(n[e]),c.push(o[e])):s.push(e)}),Object.keys(o).forEach(e=>{n[e]||a.push(e)});const u=r._layerSpecs;a.forEach(e=>{i.removeLayer(e);for(let t=0;t<u.length;t++)if(u[t].id===e){u.splice(t,1);break}}),s.forEach(e=>{const t={...n[e],source:r.source.id};u.push(t)}),r._updateSourceAndLayerIDs(),ei(l,c,i)})(e[r],this.layersSpecs[r],this.sourcesWithLayers[r],this.mapLibreMap)});const r=Object.values(this.sourcesWithLayers);ti(r.flatMap(e=>e._layerSpecs),this.mapLibreMap),r.forEach(e=>e.setLayersVisible(!!e.shownFeatures.features.length)),this.layersSpecs=e}return!Rr(this.config?.displayUnits,t.displayUnits)&&this.sourcesWithLayers.summaryBubbles.shownFeatures.features.length&&this.sourcesWithLayers.summaryBubbles.show(ps(this.sourcesWithLayers.mainLines.shownFeatures,t.displayUnits)),t}async restoreDataAndConfigImpl(){const e=Object.entries(this.sourcesWithLayers).map(e=>({[e[0]]:e[1].shownFeatures})).reduce((e,t)=>({...e,...t}),{});this.initSourcesWithLayers(),this._applyConfig(this.config);for(const t of Object.keys(e))this.sourcesWithLayers[t].show(e[t])}addImageIfNotExisting(e,t,r){ni(0,e,t,this.mapLibreMap,r)}async showRoutes(e,r){const i=us(e,r?.selectedIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(i),this.sourcesWithLayers.vehicleRestricted.show(ls(i,"vehicleRestricted")),this.sourcesWithLayers.incidents.show(ls(i,"traffic",ts)),this.sourcesWithLayers.chargingStops.show(Qo(i,this.config)),this.sourcesWithLayers.ferries.show(ls(i,"ferry")),this.sourcesWithLayers.tunnels.show(ls(i,"tunnel")),this.sourcesWithLayers.tollRoads.show(ls(i,"toll")),this.sourcesWithLayers.instructionLines.show((e=>({type:"FeatureCollection",features:e.features.flatMap((e,r)=>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:t(),routeIndex:r,routeState:e.properties.routeState}}))||[])}))(i)),this.sourcesWithLayers.instructionArrows.show((e=>({type:"FeatureCollection",features:e.features.flatMap((e,r)=>e.properties.guidance?.instructions?.filter(e=>e.routePath?.length&&e.routePath.length>1).map(i=>{const n=[i.routePath[i.routePath.length-2]?.point,i.routePath[i.routePath.length-1]?.point];return{type:"Feature",geometry:{type:"Point",coordinates:n[1]},properties:{...i,id:t(),routeIndex:r,routeState:e.properties.routeState,lastPointBearingDegrees:as(n[0],n[1])}}})||[])}))(i)),this.sourcesWithLayers.summaryBubbles.show(ps(i,this.config?.displayUnits))}async clearRoutes(){await this.waitUntilModuleReady();for(const e of Object.keys(this.sourcesWithLayers))"waypoints"!==e&&this.sourcesWithLayers[e].clear()}async selectRoute(e){const t=us(this.sourcesWithLayers.mainLines.shownFeatures,e);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(t),this.sourcesWithLayers.chargingStops.show(Qo(t,this.config)),cs(t,this.sourcesWithLayers.vehicleRestricted),cs(t,this.sourcesWithLayers.incidents),cs(t,this.sourcesWithLayers.ferries),cs(t,this.sourcesWithLayers.tollRoads),cs(t,this.sourcesWithLayers.tunnels),cs(t,this.sourcesWithLayers.instructionLines),cs(t,this.sourcesWithLayers.instructionArrows),cs(t,this.sourcesWithLayers.summaryBubbles)}async showWaypoints(e){const t=Array.isArray(e)?is(e,this.config?.waypoints):is(e.features,this.config?.waypoints);await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.show(t)}async clearWaypoints(){await this.waitUntilModuleReady(),this.sourcesWithLayers.waypoints.clear()}get events(){return{mainLines:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.mainLines),waypoints:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.waypoints),chargingStops:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.chargingStops),summaryBubbles:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.summaryBubbles),incidents:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.incidents),vehicleRestricted:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vehicleRestricted),ferries:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.ferries),tollRoads:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tollRoads),tunnels:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.tunnels),instructionLines:new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.instructionLines)}}getLayerToRenderLinesUnder(){return gi.lowestLabel}}const fs="standardLight",ys={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"}},gs=e=>`\${baseURL}/maps/orbis/assets/styles/\${version}/style.json?&apiVersion=1&key=\${apiKey}&map=${e}`,ms={standardLight:gs("basic_street-light"),standardDark:gs("basic_street-dark"),drivingLight:gs("basic_street-light-driving"),drivingDark:gs("basic_street-dark-driving"),monoLight:gs("basic_mono-light"),monoDark:gs("basic_mono-dark"),satellite:gs("basic_street-satellite")},bs=(e,t,r)=>{const i=e.id??fs,n=new URL(ms[i].replace("${baseURL}",t).replace("${version}",e.version??"0.6.0-0").replace("${apiKey}",r));for(const o of e.include??On)n.searchParams.append(o,ys[i][o]);return n.toString()},_s=e=>{const t=e.style,r=e.commonBaseURL,i=e.apiKey;return"string"==typeof t?bs({id:t},r,i):"standard"===t?.type?bs(t,r,i):"custom"===t?.type&&t?.url?((e,t)=>{const r=new URL(e);return r.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"):r.searchParams.set("key",t),r.toString()})(t.url,i):"custom"===t?.type&&t?.json?t.json:bs({id:fs},r,i)};class Ls{constructor(t,r){this.mapReady=!1,this.styleChangeHandlers=[],this.setStyle=(e,t={keepState:!0})=>{this.mapReady=!1;for(const n of this.styleChangeHandlers)try{n.onStyleAboutToChange()}catch(i){console.error(i)}const r=t.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=si(r),this.mapLibreMap.once("styledata",()=>{!this.mapReady&&Rr(r,this._params.style)&&this.handleStyleData(t.keepState||!0)}),this.mapLibreMap.setStyle(_s(this._params),{validate:!1})},this.getStyle=()=>this._params.style,this._params=l(r),this.styleLightDarkTheme=si(this._params.style),this.ensureMapLibreCSSLoaded(),this.mapLibreMap=new u(((t,r)=>{return{validateStyle:!1,maxTileCacheZoomLevels:22,cancelPendingTileRequestsWhileZooming:!1,...t,style:_s(r),attributionControl:{compact:!1},transformRequest:(i=r,(t,r)=>t.includes("tomtom.com")?"Image"===r?{url:t}:{url:t,headers:{...e(i)}}:{url:t})};var i})(t,this._params)),this.mapLibreMap.once("styledata",()=>{this.handleStyleData(!1)}),this._eventsProxy=new yi(this.mapLibreMap,this._params?.eventsConfig),this.loadRTLTextPlugin()}loadRTLTextPlugin(){setTimeout(()=>{["deferred","loaded"].includes(h())||p("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@5.14.0/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 r=t?["coalesce",["get",`name_${t}`],["get","name"]]:["get","name"];this.mapLibreMap.setLayoutProperty(e.id,"text-field",r,{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 r of $r(this.mapLibreMap,[vi,Ii,bi]))this.mapLibreMap.setLayoutProperty(r.id,"visibility","none",{validate:!1});if((async(e,t)=>{t.setSprite(`${e.commonBaseURL}/maps/orbis/assets/sprites/2.*/sprite?key=${e.apiKey}&poi=poi_${si(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 r of this.styleChangeHandlers)try{r.onStyleChanged()}catch(t){console.error(t)}}addStyleChangeHandler(e){this.styleChangeHandlers.push(e)}}const vs=["unknown","accident","fog","dangerous_conditions","rain","ice","jam","lane_closed","road_closed","road_works","wind","flooding","broken_down_vehicle"],Is={unknown:0,accident:1,fog:2,dangerous_conditions:3,rain:4,ice:5,jam:6,lane_closed:7,road_closed:8,road_works:9,wind:10,flooding:11,broken_down_vehicle:14},ws=["motorway","trunk","primary","secondary","tertiary","street"],Ss=["connecting","major_local"],As=["local","minor_local"],Es=(e,t)=>e.length?1===e.length?{expression:e[0],legacy:t[0]}:{expression:["all",...e],legacy:["all",...t]}:null,Os=(e,t,r)=>{e&&(t.push(e.expression),r.push(e.legacy))},Rs=(e,t,r,i)=>{e&&Os(nn(t,e),r,i)},Ts=(e,t,r)=>{Rs(e.roadCategories,"road_category",t,r),Rs(e.roadSubCategories,"road_subcategory",t,r)},Ms=e=>{const t=[],r=[];if(Ts(e,t,r),e.incidentCategories){const i=nn("icon_category_0",e.incidentCategories,e=>Is[e]);Os(i,t,r)}if(e.magnitudes){const i=nn("magnitude",e.magnitudes,e=>c.indexOf(e));Os(i,t,r)}return e.delays&&Os((e=>{const t=[],r=[];if(e.mustHaveDelay&&e.minDelayMinutes){const i=60*e.minDelayMinutes;t.push([">=",["get","delay"],i]),r.push([">=","delay",i])}else if(e.mustHaveDelay)t.push([">",["get","delay"],0]),r.push([">","delay",0]);else if(e.minDelayMinutes){const i=60*e.minDelayMinutes;t.push(["any",["!",["has","delay"]],["==",["get","delay"],0],[">=",["get","delay"],i]]),r.push(["any",["!has","delay"],["==","delay",0],[">=","delay",i]])}return Es(t,r)})(e.delays),t,r),Es(t,r)},Cs=e=>{if(!e?.any?.length)return null;const t=e.any.map(Ms).filter(e=>!Tr(e));return en(t)},Ds=e=>{const t=[],r=[];if(Ts(e,t,r),e.showRoadClosures){const i="only"===e.showRoadClosures?"==":"!=";t.push([i,["get","road_closure"],!0]),r.push([i,"road_closure",!0])}return Es(t,r)},xs=(e,t,r,i)=>{for(const n of t)r.setFilter(n.id,e?tn(e,i[n.id]):i[n.id])};class Ps extends ai{static async get(e,t){return await Jr(e),await ii(e,Ii,"trafficFlow"),new Ps(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(Ii);if(!e)throw Wr(`init ${Ps.name} with source ID ${Ii}`);this.originalFilters={};for(const t of this.getLayers())this.originalFilters[t.id]=t.filter;return{trafficFlow:new Yr(this.mapLibreMap,e)}}_applyConfig(e){return this.setVisible(e?.visible??!1),this._filter(e?.filters,!1),e}getLayers(){return $r(this.tomtomMap.mapLibreMap,[Ii])}filter(e){this._filter(e)}_filter(e,t=!0){if(this.tomtomMap.mapReady)if(e?.any?.length){const t=(e=>{if(!e?.any?.length)return null;const t=e.any.map(Ds).filter(e=>!Tr(e));return en(t)})(e);t&&xs(t,this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&xs(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);t&&(this.config=Nr({...this.config,filters:e},Tr))}setVisible(e){this.config={...this.config,visible:e},this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficFlow.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.trafficFlow.isAnyLayerVisible()}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficFlow)}}class Ns extends ai{static async get(e,t){return await Jr(e),await ii(e,vi,"trafficIncidents"),new Ns(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(vi);if(!e)throw Wr(`init ${Ns.name} with source ID ${vi}`);this.originalFilters={};for(const t of this.getLayers())this.originalFilters[t.id]=t.filter;return{trafficIncidents:new Yr(this.mapLibreMap,e)}}_applyConfig(e){return this._setVisible(e?.visible??!1,{updateConfig:!1}),Tr(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 r=Cs(e);if(r){const e=t?this.getNonSymbolLayers():this.getLayers();xs(r,e,this.mapLibreMap,this.originalFilters)}}else this.config?.filters?.any?.length&&xs(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);if(t?.any?.length){const e=Cs(t);e&&xs(e,this.getSymbolLayers(),this.mapLibreMap,this.originalFilters)}}r&&(this.config=Nr({...this.config,filters:e,icons:{...this.config?.icons,filters:t}},Tr))}getLayers(){return $r(this.tomtomMap.mapLibreMap,[vi])}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(e,t){(t?.updateConfig??!0)&&(delete this.config?.icons?.visible,this.config={...Nr({...this.config},Or),visible:e}),this.tomtomMap.mapReady&&this.sourcesWithLayers.trafficIncidents.setLayersVisible(e)}isVisible(){return this.sourcesWithLayers.trafficIncidents.isAnyLayerVisible()}anyIconLayersVisible(){return!!this.sourcesWithLayers.trafficIncidents?.isAnyLayerVisible(e=>"symbol"===e.type)}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.trafficIncidents)}}export{ai as AbstractMapModule,Br as AbstractSourceWithLayers,Kr as AddedSourceWithLayers,Li as BASE_MAP_SOURCE_ID,hn as BaseMapModule,Mn as DESELECTED_FOREGROUND_COLOR,Cn as DESELECTED_OUTLINE_COLOR,Nn as DESELECTED_ROUTE_FILTER,Dn as DESELECTED_SECONDARY_COLOR,li as EventsModule,yi as EventsProxy,Ao as FINISH_INDEX,fn as GEOMETRY_COLOR_PROP,dn as GEOMETRY_TITLE_PROP,Zr as GeoJSONSourceWithLayers,Sn as GeometriesModule,bi as HILLSHADE_SOURCE_ID,An as HillshadeModule,Eo as INDEX_TYPE,Fn as MAJOR_DELAY_COLOR,So as MIDDLE_INDEX,Wn as MINOR_DELAY_LABEL_COLOR,jn as MODERATE_DELAY_COLOR,_i as PLACES_SOURCE_PREFIX_ID,mi as POI_SOURCE_ID,an as POIsModule,Xi as PlacesModule,Rn as ROUTE_LINE_FOREGROUND_COLOR,xn as ROUTE_LINE_FOREGROUND_WIDTH,Tn as ROUTE_LINE_OUTLINE_COLOR,ds as RoutingModule,Pn as SELECTED_ROUTE_FILTER,wo as START_INDEX,Oo as STOP_DISPLAY_INDEX,Yr as StyleSourceWithLayers,Ii as TRAFFIC_FLOW_SOURCE_ID,vi as TRAFFIC_INCIDENTS_SOURCE_ID,Ls as TomTomMap,Vr as TomTomMapSource,Ps as TrafficFlowModule,Ns as TrafficIncidentsModule,Un as UNKNOWN_DELAY_COLOR,pn as baseMapLayerGroupNames,Bi as buildPlaceTitle,No as buildRoutingLayers,Fo as defaultRoutingLayers,$r as filterLayersBySources,Yi as getIconIDForPlace,Ki as getPOILayerCategoryForPlace,sn as getStyleCategories,$i as imageIDWithInstanceSuffix,vs as incidentCategories,Is as incidentCategoriesMapping,gi as mapStyleLayerIDs,on as poiCategoryGroups,wi as poiLayerIDs,Zi as preparePlacesForDisplay,ws as roadCategories,En as standardStyleIDs,As as streetRoadCategories,On as styleModules,Ss as tertiaryRoadCategories,Ai as toMapDisplayPOICategory,qi as toPlaces};
|
|
2
2
|
//# sourceMappingURL=map.es.js.map
|