@tomtom-org/maps-sdk 0.35.4 → 0.36.0
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 +20 -0
- package/core/dist/core.es.js +1 -1
- package/core/dist/core.es.js.map +1 -1
- package/core/dist/index.d.ts +15 -9
- package/map/dist/THIRD_PARTY.txt +2 -2
- package/map/dist/index.d.ts +21 -23
- package/map/dist/map.es.js +1 -1
- package/map/dist/map.es.js.map +1 -1
- package/package.json +1 -1
- package/services/dist/services.es.js +1 -1
- package/services/dist/services.es.js.map +1 -1
package/map/dist/map.es.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{generateTomTomHeaders as e,bboxFromCoordsArray as t,bboxCenter as r,TomTomConfig as i,formatDuration as o,generateId as n,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(n){}var o=_.call(e);return i&&(t?e[L]=r:delete e[L]),o}(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,o=Array(i);++r<i;)o[r]=t(e[r],r,e);return o}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 oe(e,t){return e===t||e!=e&&t!=t}var ne=Object.prototype.hasOwnProperty;function se(e,t,r){var i=e[t];ne.call(e,t)&&oe(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),o=!r&&!i&&Le(e),n=!r&&!i&&!o&&Re(e),s=r||i||o||n,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||o&&("offset"==c||"parent"==c)||n&&("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(oe(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,o=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?o["string"==typeof t?"string":"hash"]:o.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,o=t?t.apply(this,i):i[0],n=r.cache;if(n.has(o))return n.get(o);var s=e.apply(this,i);return r.cache=n.set(o,s)||n,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,o){t.push(i?o.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 ot(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 nt(e,t){for(var r=-1,i=t.length,o=e.length;++r<i;)e[o+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,o){var n=-1,s=e.length;for(r||(r=at),o||(o=[]);++n<s;){var a=e[n];r(a)?nt(o,a):o[o.length]=a}return o}(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,o=0,n=[];++r<i;){var s=e[r];t(s,r,e)&&(n[o++]=s)}return n}(vt(e),function(t){return Lt.call(e,t)}))}:_t,wt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)nt(t,It(e)),e=ct(e);return t}:_t;function St(e,t,r){var i=t(e);return O(e)?i:nt(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,o,n,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(n=new(o=e).constructor(o.source,Vt.exec(o))).lastIndex=o.lastIndex,n;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,o,n){var s;if(r&&(s=o?r(e,i,o,n):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&&!o)s={};else{if(!tr[l])return o?e:{};s=Yt(e,l)}}n||(n=new yt);var u=n.get(e);if(u)return u;n.set(e,s),Jt(e)?e.forEach(function(i){s.add(rr(i,t,r,i,e,n))}):qt(e)&&e.forEach(function(i,o){s.set(o,rr(i,t,r,o,e,n))});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,o){h&&(i=e[o=i]),se(s,o,rr(i,t,r,o,e,n))}),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 or(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 nr(e,t,r,i,o,n){var s=1&r,a=e.length,l=t.length;if(a!=l&&!(s&&l>a))return!1;var c=n.get(e),u=n.get(t);if(c&&u)return c==t&&u==e;var h=-1,p=!0,d=2&r?new ir:void 0;for(n.set(e,t),n.set(t,e);++h<a;){var f=e[h],y=t[h];if(i)var g=s?i(y,f,h,t,e,n):i(f,y,h,e,t,n);if(void 0!==g){if(g)continue;p=!1;break}if(d){if(!or(t,function(e,t){if(s=t,!d.has(s)&&(f===e||o(f,e,r,i,n)))return d.push(t);var s})){p=!1;break}}else if(f!==y&&!o(f,y,r,i,n)){p=!1;break}}return n.delete(e),n.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,o,n){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 n||(n=new yt),s||Re(e)?nr(e,t,r,i,o,n):function(e,t,r,i,o,n,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||!n(new zt(e),new zt(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return oe(+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=nr(a(e),a(t),i,o,n,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,o,n);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 n||(n=new yt),o(y,g,r,i,n)}}return!!p&&(n||(n=new yt),function(e,t,r,i,o,n){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=n.get(e),p=n.get(t);if(h&&p)return h==t&&p==e;var d=!0;n.set(e,t),n.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,n):i(y,g,u,e,t,n);if(!(void 0===m?y===g||o(y,g,r,i,n):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 n.delete(e),n.delete(t),d}(e,t,r,i,o,n))}function gr(e,t,r,i,o){return e===t||(null==e||null==t||!S(e)&&!S(t)?e!=e&&t!=t:yr(e,t,r,i,gr,o))}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],o=e[i];t[r]=[i,o,mr(o)]}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 o=r.length,n=o;if(null==e)return!n;for(e=Object(e);o--;){var s=r[o];if(s[2]?s[1]!==e[s[0]]:!(s[0]in e))return!1}for(;++o<n;){var a=(s=r[o])[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,o=(t=rt(t,e)).length,n=!1;++i<o;){var s=it(t[i]);if(!(n=null!=e&&r(e,s)))break;e=e[s]}return n||++i!=o?n:!!(o=null==e?0:e.length)&&le(o)&&re(s,o)&&(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:ot(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 ot(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:ot(e,function(e,t,r){var i=-1,o=e.length;t<0&&(t=-t>o?0:o+t),(r=r>o?o:r)<0&&(r+=o),o=t>r?0:r-t>>>0,t>>>=0;for(var n=Array(o);++i<o;)n[i]=e[i+t];return n}(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,o=-1,n=ae(i.length-t,0),s=Array(n);++o<n;)s[o]=i[t+o];o=-1;for(var a=Array(t+1);++o<t;)a[o]=i[o];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 o=-1,n=t.length;++o<n;){var s=t[o],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 o=t.length;o--;)Mr(r,t[o]);return r});function xr(e,t,r,i){if(!C(e))return e;for(var o=-1,n=(t=rt(t,e)).length,s=n-1,a=e;null!=a&&++o<n;){var l=it(t[o]),c=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=s){var u=a[l];void 0===(c=void 0)&&(c=C(u)?u:re(t[o+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,o=t.length,n={};++i<o;){var s=t[i],a=ot(e,s);r(a,s)&&xr(n,rt(s,e),a)}return n}(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,o=[],n=e.length;for(t=Sr(t);++i<n;){var s=e[i];t(s,i,e)&&(r.push(s),o.push(i))}return function(e,t){for(var r=e?t.length:0,i=r-1;r--;){var o=t[r];if(r==i||o!==n){var n=o;re(o)?Fr.call(e,o,1):Mr(e,o)}}}(e,o),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 o of Object.keys(t.layout??[]))e.layout?.[o]||r.setLayoutProperty(i,o,void 0,{validate:!1});for(const o of Object.keys(t.paint??[]))e.paint?.[o]||r.setPaintProperty(i,o,void 0,{validate:!1});for(const[o,n]of Object.entries(e.paint??[]))r.setPaintProperty(i,o,n,{validate:!1});for(const[o,n]of Object.entries(e.layout??[]))r.setLayoutProperty(i,o,n,{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)},o={};for(e.forEach(e=>{e.beforeID?r.has(e.beforeID)||t.getLayer(e.beforeID)?(r.add(e.beforeID),i(e)):o[e.beforeID]?o[e.beforeID].push(e):o[e.beforeID]=[e]:i(e)});Object.keys(o).length>0;){const e=Object.keys(o).filter(e=>r.has(e));if(0===e.length)throw Error(`Circular dependency for before Ids ${JSON.stringify(Object.keys(o))}`);e.forEach(e=>{o[e].forEach(e=>i(e)),delete o[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})}))},oi=async(e,t,r,i,o)=>{if(!r)return void console.warn(`addOrUpdateImage called with empty image for ID ${t}`);const n=e=>{i.hasImage(t)||i.addImage(t,e,o)},s=e=>{e.complete?e.naturalWidth>0?n(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>n(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 n((await i.loadImage(r)).data);else s(r)},ni=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},si=e=>{if("string"==typeof e)return ni(e);const t=e;return t?.id?ni(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:o,index:n}=((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(o&&(!ui(o.properties?.eventState)||ui(e))){const t={...o,properties:"updateInProps"===i?{...o?.properties,eventState:e}:Dr(o?.properties,"eventState")};return r.splice(n,1,t),n}},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,o)=>{if(t&&i instanceof Zr){const a=[...i.shownFeatures.features],l=hi(e,t.id,a);return!r||(s=t,(n=r)&&s&&n.id===s.id)||(o===i?hi(e,r.id,a,"removeFromProps"):o instanceof Zr&&pi(e,r,o)),i.show({...i.shownFeatures,features:a}),{feature:a[l],index:l}}var n,s;return r&&o instanceof Zr&&pi(e,r,o),{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 o=this.hoveringSourceWithLayers,n=this.findHandlers(["hover","long-hover","click","contextmenu"],t?.source,t?.layer.id);if(this.hoveringSourceWithLayers=n?.[0]?.sourceWithLayers,r){this.updateCursor(i);const r=di("hover",this.hoveringFeature,i,this.hoveringSourceWithLayers,o),n=this.findHandlers(["hover"],t?.source,t?.layer.id);for(const t of n)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 o=this.lastClickedSourceWithLayers,n=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);this.lastClickedSourceWithLayers=n?.[0]?.sourceWithLayers;const s=di(e,this.lastClickedFeature,i,this.lastClickedSourceWithLayers,o);for(const a of n)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,o=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}},...o}},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",o=r.icon?.categoryIcons,n=e.properties.poi?.classifications?.[0]?.code,s=o?.find(e=>e.id===n);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):(n&&`poi-${Ai(n)}`)??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),o=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)},...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(console.log("setupImages",this.defaultPlaceIconID),e?.icon){for(const t of e.icon.categoryIcons??[])oi(0,$i(t.id,this.instanceIndex),t.image,this.mapLibreMap,{pixelRatio:t.pixelRatio??2});e.icon.default&&(e.icon.default.image&&oi(0,this.defaultPlaceIconID,e.icon.default.image.image,this.mapLibreMap,{pixelRatio:e.icon.default.image.pixelRatio??2}),e.icon.default.style&&oi(0,this.defaultPlaceIconID,Gi(e.icon.default.style),this.mapLibreMap,{pixelRatio:2}))}else console.log("Adding default pin icon for places module",this.defaultPlaceIconID),oi(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}},eo=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,to=(e,t)=>{return t?["all",e[(r=t,Qi(r)?"expression":"legacy")],t]:e.expression;var r},ro=(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]}},io=(e,t,r)=>ro(e,t.show,r?t.values.map(r):t.values),oo={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"]},no=e=>{const t=[];return e.forEach(e=>{e in oo?t.push(...oo[e].map(Ai)):t.push(Ai(e))}),[...new Set(t)]};class so extends ai{static async get(e,t){return await Jr(e),new so(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(mi);if(!e)throw Wr(`init ${so.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=ro("category",e.show,no(e.values));this.mapLibreMap.setFilter("POI",to(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 ao={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"]}},lo=(e,t)=>{const r=ao[e];return r.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&r.layerTypes.includes(t.type)},co=e=>t=>(!e||((e,t)=>{const r=t?.mode,i=t?.names;if(r&&i?.length){if("include"===r)return i.some(t=>lo(t,e));if("exclude"===r)return!i.some(t=>lo(t,e))}return!0})(t,e))&&!wi.includes(t.id);class uo extends ai{static async get(e,t){return await Jr(e),new uo(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(e){const t=this.mapLibreMap.getSource(Li);if(!t)throw Wr(`init ${uo.name} with source ID ${Li}`);return{vectorTiles:new Yr(this.mapLibreMap,t,co(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=>lo(t,e)):"exclude"===t?e=>!r.some(t=>lo(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups))}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles)}}const ho=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],po="title",fo="color",yo={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"]},go="#0A3653",mo={type:"fill",paint:{"fill-color":["coalesce",["get",fo],go],"fill-opacity":.15,"fill-antialias":!1}},bo={type:"line",paint:{"line-color":go,"line-opacity":.45,"line-width":2}},_o=(e,t,r)=>{const i=r?.colorConfig,o=r?.lineConfig;return[{...mo,id:e,paint:{...mo.paint,...!Tr(i?.fillOpacity)&&{"fill-opacity":i?.fillOpacity},...i?.fillColor&&{"fill-color":["get","color"]}}},{...bo,id:t,paint:{...bo.paint,...!Tr(o?.lineColor)&&{"line-color":o?.lineColor},...!Tr(o?.lineWidth)&&{"line-width":o?.lineWidth},...!Tr(o?.lineOpacity)&&{"line-opacity":o?.lineOpacity}}}]},Lo=(e,t)=>{const r=t?.textConfig;return{type:"symbol",id:e,layout:{"text-field":["get",po],...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"}}},vo=(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),o=e.properties?.color?e.properties.color:((e,t)=>{const r=e?.colorConfig?.fillColor;if("string"==typeof r&&yo[r]){const e=yo[r];return e[t%e.length]}return r})(t,r);return{...e,properties:{...e.properties,title:i,color:o}}})}),Io=e=>{const i=e.features.map(e=>{let i;if(e.properties?.placeCoordinates)i=e.properties?.placeCoordinates;else if("MultiPolygon"===e.geometry.type){const o=(e=>e.flat().reduce((e,t)=>t.length>e.length?t:e,[]))(e.geometry.coordinates),n=t(o);i=n&&r(n)||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}},wo=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,o]=_o(this.fillLayerID,this.outlineLayerID,t),n=Lo(this.titleLayerID,t);return this.titleLayerSpecs=n,this.geometryFillLayerSpecs=i,this.geometryOutlineLayerSpecs=o,{geometry:new Zr(this.mapLibreMap,this.sourceID,[{...i},{...o}]),geometryLabel:new Zr(this.mapLibreMap,this.titleSourceID,[n])}}_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(Io(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t}updateLayerAndData(e){const[t,r]=_o(this.fillLayerID,this.outlineLayerID,e),i=Lo(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(vo(e,this.config)),this.sourcesWithLayers.geometryLabel.show(Io(t.shownFeatures))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.geometry.clear()}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry)}};wo.lastInstanceIndex=-1;let So=wo;class Ao extends ai{static async get(e,t){return await Jr(e),await ii(e,bi,"hillshade"),new Ao(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(bi);if(!e)throw Wr(`init ${Ao.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 Eo=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],Oo=["trafficIncidents","trafficFlow","hillshade"],Ro="#36A8F0",To="#105287",Mo="#ABAFB3",Co="#3C4956",Do="#727C85",xo=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],Po=["==",["get","routeState"],"selected"],No=["==",["get","routeState"],"deselected"],Fo="#AD0000",jo="#FB2D09",Wo="#f58240",Uo="#000000",ko=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],Ho=e=>({...Pi,filter:Po,minzoom:4,layout:{...Pi.layout,"text-field":ko(e?.text)},paint:{...Pi.paint}}),zo={filter:Po,minzoom:16},Go={...zo,type:"line",layout:{"line-cap":"round"}},Vo={...Go,paint:{"line-width":["interpolate",["linear"],["zoom"],16,14,22,20],"line-color":"grey"}},Bo={...Go,paint:{"line-width":["interpolate",["linear"],["zoom"],16,12,22,17],"line-color":"white"}},$o="instruction-arrow",Yo={...zo,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":$o,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Ko={filter:Po,type:"line",layout:{"line-join":"round"},paint:{"line-width":xo,"line-color":"#6dc4ed"}},qo={filter:Po,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}},Zo={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},Jo=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],Xo={...Zo,filter:No,paint:{"line-color":Co,"line-width":Jo}},Qo={...Zo,filter:No,paint:{"line-color":Mo,"line-width":xo}},en={...Zo,filter:Po,paint:{"line-color":To,"line-width":Jo}},tn={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},rn="selected-route-summary-popup",on="deselected-route-summary-popup",nn={filter:Po,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"}},sn={filter:Po,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]}},an=["interpolate",["linear"],["zoom"],1,2,5,3,10,4,18,6],ln={type:"line",layout:{"line-cap":"round"},paint:{"line-width":an,"line-color":["match",["get","magnitudeOfDelay"],"minor","#FFC105","moderate",jo,"major",Fo,"#C7D2D8"]}},cn={type:"line",filter:["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],layout:{"line-join":"round"},paint:{"line-width":an,"line-color":["match",["get","magnitudeOfDelay"],"unknown","rgba(190, 39, 27, 1)","rgba(137, 150, 168, 1)"],"line-dasharray":[1.5,1]}},un=["match",["get","magnitudeOfDelay"],"minor",Wo,"moderate",jo,"major",Fo,"indefinite","#666666",Uo],hn={filter:Po,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},pn={...hn,filter:["all",["has","jamIconID"],hn.filter],layout:{...hn.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:{...hn.paint,"text-color":un,"text-halo-color":"#FFFFFF","text-halo-width":1}},dn={...hn,filter:["all",["has","causeIconID"],hn.filter],layout:{...hn.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...hn.paint}},fn={filter:Po,type:"line",layout:{"line-join":"round"},paint:{"line-width":xo,"line-color":"#000000","line-opacity":.3}},yn={filter:Po,type:"line",layout:{"line-join":"round"},paint:{"line-color":To,"line-width":xo}},gn={filter:Po,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":Ro,"line-width":["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],"line-dasharray":[0,1.5]}},mn="traffic-clear",bn="traffic-major",_n="traffic-moderate",Ln="traffic-minor",vn=["has","formattedTraffic"],In={type:"symbol",layout:{"icon-image":["case",Po,rn,on],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",Po,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",Po,"black",Do]},["concat","\t\t",["get","formattedDistance"]],{"text-color":Do},["case",vn,"\n",""],{},["image",["case",vn,["match",["get","magnitudeOfDelay"],"major",bn,"moderate",_n,"minor",Ln,mn],""]],{},["case",vn,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Ei]],"text-color":un}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}},wn="start",Sn="middle",An="finish",En="indexType",On="stopDisplayIndex",Rn="waypointStart",Tn="waypointStop",Mn="waypointSoft",Cn="waypointFinish",Dn={"text-field":["get",On],"text-font":[Ei],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",En],Sn],["!",["has",On]]],"center","bottom"],"text-allow-overlap":!0},xn={type:"symbol",paint:{...Ci,"text-color":"#ffffff"},layout:{...Mi,...Dn,"symbol-sort-key":["case",["==",["get",Ri],Mn],0,["abs",["-",["get","index"],1e3]]]}},Pn={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]}},Nn=(e={})=>{const t=e.layers,r=t?.sections,i=e.theme?.mainColor;return{mainLines:{routeLineArrows:{...tn,beforeID:gi.lowestLabel,...t?.mainLines?.routeLineArrows},routeLine:{...(o={color:i},{...Zo,filter:Po,paint:{"line-color":o?.color??Ro,"line-width":xo}}),beforeID:"routeIncidentBackgroundLine",...t?.mainLines?.routeLine},routeOutline:{...en,beforeID:"routeLine",...t?.mainLines?.routeOutline},routeDeselectedLine:{...Qo,beforeID:"routeOutline",...t?.mainLines?.routeDeselectedLine},routeDeselectedOutline:{...Xo,beforeID:"routeDeselectedLine",...t?.mainLines?.routeDeselectedOutline},...t?.mainLines?.additional},waypoints:{routeWaypointSymbol:{...xn,beforeID:"routeSummaryBubbleSymbol",...t?.waypoints?.routeWaypointSymbol},routeWaypointLabel:{...Pn,beforeID:"routeWaypointSymbol",...t?.waypoints?.routeWaypointLabel},...t?.waypoints?.additional},chargingStops:{routeChargingStopSymbol:{...Ho(e.chargingStops),beforeID:"routeWaypointSymbol",...t?.chargingStops?.routeChargingStopSymbol},...t?.chargingStops?.additional},sections:{incident:{routeIncidentJamSymbol:{...pn,beforeID:"routeChargingStopSymbol",...r?.incident?.routeIncidentJamSymbol},routeIncidentCauseSymbol:{...dn,beforeID:"routeChargingStopSymbol",...r?.incident?.routeIncidentCauseSymbol},routeIncidentBackgroundLine:{...ln,beforeID:"routeIncidentDashedLine",...r?.incident?.routeIncidentBackgroundLine},routeIncidentDashedLine:{...cn,beforeID:"routeTunnelLine",...r?.incident?.routeIncidentDashedLine}},ferry:{routeFerryLine:{...Ko,beforeID:"routeLineArrows",...r?.ferry?.routeFerryLine},routeFerrySymbol:{...qo,beforeID:"routeIncidentJamSymbol",...r?.ferry?.routeFerrySymbol},...r?.ferry?.additional},tollRoad:{routeTollRoadOutline:{...nn,beforeID:"routeDeselectedOutline",...r?.tollRoad?.routeTollRoadOutline},routeTollRoadSymbol:{...sn,beforeID:"routeChargingStopSymbol",...r?.tollRoad?.routeTollRoadSymbol},...r?.tollRoad?.additional},tunnel:{routeTunnelLine:{...fn,beforeID:"routeLineArrows",...r?.tunnel?.routeTunnelLine},...r?.tunnel?.additional},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:{...yn,beforeID:"routeVehicleRestrictedForegroundLine",...r?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine},routeVehicleRestrictedForegroundLine:{...gn,beforeID:gi.lowestLabel,...r?.vehicleRestricted?.routeVehicleRestrictedForegroundLine},...r?.vehicleRestricted?.additional}},instructionLines:{routeInstructionLine:{...Bo,beforeID:gi.lowestLabel,...t?.instructionLines?.routeInstructionLine},routeInstructionOutline:{...Vo,beforeID:"routeInstructionLine",...t?.instructionLines?.routeInstructionOutline},...t?.instructionLines?.additional},instructionArrows:{routeInstructionArrowSymbol:{...Yo,beforeID:"routeInstructionLine",...t?.instructionArrows?.routeInstructionArrowSymbol},...t?.instructionArrows?.additional},summaryBubbles:{routeSummaryBubbleSymbol:{...In,...t?.summaryBubbles?.routeSummaryBubbleSymbol},...t?.summaryBubbles?.additional}};var o},Fn=Nn();let jn;Ur()&&(jn=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 Wn=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)},Un={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},kn=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)},Hn=(e,t)=>{if(!Ur())return;const r=zr(t);return e&&r.appendChild(e),kr(r)},zn=(e={})=>Object.entries(e).map(([e,t])=>({...t,id:e})),Gn=(e={})=>({mainLines:zn(e.mainLines),waypoints:zn(e.waypoints),chargingStops:zn(e?.chargingStops),ferries:zn(e.sections?.ferry),incidents:zn(e.sections?.incident),tollRoads:zn(e.sections?.tollRoad),tunnels:zn(e.sections?.tunnel),vehicleRestricted:zn(e.sections?.vehicleRestricted),instructionLines:zn(e.instructionLines),instructionArrows:zn(e.instructionArrows),summaryBubbles:zn(e.summaryBubbles)}),Vn=e=>{const t=i.instance.get().displayUnits,r=e?.displayUnits;return{...e,...r?{}:{displayUnits:t},layers:Nn(e)}},Bn={commonBaseURL:"https://api.tomtom.com",apiKey:"",apiVersion:1},$n=class{constructor(){this.config={...Bn}}put(e){this.config={...this.config,...e}}reset(){this.config={...Bn}}get(){return this.config}};$n.instance=new $n;let Yn=$n;const Kn=e=>e?.minutes??"min",qn=(e,t)=>{if(e){const i=Math.abs(e)/3600;let o=Math.floor(i),n=Math.round(i%1*60);60===n&&(n=0,o++);const s={...Yn.instance.get().displayUnits?.time,...t};if(o)return`${o} ${r=s,r?.hours??"hr"} ${n.toString().padStart(2,"0")} ${Kn(s)}`;if(n)return`${n.toString()} ${Kn(s)}`}var r},Zn=(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"},Jn=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},Xn=(e,t)=>{const r=[];if(!1!==t?.chargingStops?.visible)for(const i of e.features)for(const e of i.properties.sections.leg){const o=e.summary.chargingInformationAtEndOfLeg;if(o){const e=o.properties;r.push({...o,properties:{...o.properties,id:o.properties.chargingParkId,iconID:Zn(o,t),title:Jn(o),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:qn(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:i.properties.routeState}})}}return{type:"FeatureCollection",features:r}},Qn=e=>e.categories.includes("jam"),es=e=>{const t=(e=>{if(Qn(e))return o(e.delayInSeconds)})(e),r=((e,t)=>Qn(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 Mn;switch(t){case"start":return Rn;case"finish":return Cn;default:return Tn}},rs=(e,t)=>{let r=-1;return{type:"FeatureCollection",features:e.map((i,o)=>{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?wn:e<t-1?Sn:An)(o,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??n();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:o,indexType:l,...u&&{title:u},iconID:ts(a,l),...c&&l===Sn&&{stopDisplayIndex:r}}}}).filter(e=>e)}};function is(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 ns(e,t,r={}){if(!0===r.final)return function(e,t){let r=ns(t,e);return r=(r+180)%360,r}(e,t);const i=os(e),o=os(t),n=is(i[0]),s=is(o[0]),a=is(i[1]),l=is(o[1]),c=Math.sin(s-n)*Math.cos(l),u=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-n);return Math.atan2(c,u)%(2*Math.PI)*180/Math.PI}var ss=ns;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,n=o(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:o(r.travelTimeInSeconds,t?.time),...s&&{magnitudeOfDelay:s},...n&&{formattedTraffic:n}}}})});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=Gn(Vn(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(Rn,(e=>{if(Ur())return Hn(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(Tn,Hn(void 0,r),i),this.addImageIfNotExisting(Mn,(()=>{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(Cn,(e=>{if(Ur())return Hn(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($o,jn,i),this.addImageIfNotExisting(rn,Wn("white"),Un),this.addImageIfNotExisting(on,Wn("#EEEEEE"),Un),this.addImageIfNotExisting(mn,kn(Uo),i),this.addImageIfNotExisting(bn,kn(Fo),i),this.addImageIfNotExisting(_n,kn(jo),i),this.addImageIfNotExisting(Ln,kn(Wo),i);for(const o of e?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(o.id,o.image,{pixelRatio:o.pixelRatio??2});return t}_applyConfig(e){const t=Vn(e);if(this.config){const e=Gn(t.layers);Object.keys(e).forEach(t=>{const r=t;((e,t,r,i)=>{const o=e.reduce((e,t)=>({...e,[t.id]:t}),{}),n=t.reduce((e,t)=>({...e,[t.id]:t}),{}),s=[],a=[],l=[],c=[];Object.keys(o).forEach(e=>{n[e]?(l.push(o[e]),c.push(n[e])):s.push(e)}),Object.keys(n).forEach(e=>{o[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={...o[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){oi(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(Xn(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(Xn(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,o=new URL(gs[i].replace("${baseURL}",t).replace("${version}",e.version??"0.6.0-0").replace("${apiKey}",r));for(const n of e.include??Oo)o.searchParams.append(n,fs[i][n]);return o.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 o of this.styleChangeHandlers)try{o.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(io(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=io("icon_category_0",e.incidentCategories,e=>vs[e]);Es(i,t,r)}if(e.magnitudes){const i=io("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 eo(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 o of t)r.setFilter(o.id,e?to(e,i[o.id]):i[o.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 eo(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,uo as BaseMapModule,Mo as DESELECTED_FOREGROUND_COLOR,Co as DESELECTED_OUTLINE_COLOR,No as DESELECTED_ROUTE_FILTER,Do as DESELECTED_SECONDARY_COLOR,li as EventsModule,yi as EventsProxy,An as FINISH_INDEX,fo as GEOMETRY_COLOR_PROP,po as GEOMETRY_TITLE_PROP,Zr as GeoJSONSourceWithLayers,So as GeometriesModule,bi as HILLSHADE_SOURCE_ID,Ao as HillshadeModule,En as INDEX_TYPE,Fo as MAJOR_DELAY_COLOR,Sn as MIDDLE_INDEX,Wo as MINOR_DELAY_LABEL_COLOR,jo as MODERATE_DELAY_COLOR,_i as PLACES_SOURCE_PREFIX_ID,mi as POI_SOURCE_ID,so as POIsModule,Xi as PlacesModule,Ro as ROUTE_LINE_FOREGROUND_COLOR,xo as ROUTE_LINE_FOREGROUND_WIDTH,To as ROUTE_LINE_OUTLINE_COLOR,ps as RoutingModule,Po as SELECTED_ROUTE_FILTER,wn as START_INDEX,On 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,Uo as UNKNOWN_DELAY_COLOR,ho as baseMapLayerGroupNames,Bi as buildPlaceTitle,Nn as buildRoutingLayers,Fn as defaultRoutingLayers,$r as filterLayersBySources,Yi as getIconIDForPlace,Ki as getPOILayerCategoryForPlace,no as getStyleCategories,$i as imageIDWithInstanceSuffix,Ls as incidentCategories,vs as incidentCategoriesMapping,gi as mapStyleLayerIDs,oo as poiCategoryGroups,wi as poiLayerIDs,Zi as preparePlacesForDisplay,Is as roadCategories,Eo as standardStyleIDs,Ss as streetRoadCategories,Oo 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 s,getPosition as o,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,v=g?g.toStringTag:void 0;var L=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,v),r=e[v];try{e[v]=void 0;var i=!0}catch(s){}var n=_.call(e);return i&&(t?e[v]=r:delete e[v]),n}(e):function(e){return L.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 x(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function C(e){return e}function D(e){if(!x(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!(!x(e)||(t=e,F&&F in t))&&(D(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}:C,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 se=Object.prototype.hasOwnProperty;function oe(e,t,r){var i=e[t];se.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)&&!D(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,ve=(_e?_e.isBuffer:void 0)||function(){return!1},Le={};function Ie(e){return function(t){return e(t)}}Le["[object Float32Array]"]=Le["[object Float64Array]"]=Le["[object Int8Array]"]=Le["[object Int16Array]"]=Le["[object Int32Array]"]=Le["[object Uint8Array]"]=Le["[object Uint8ClampedArray]"]=Le["[object Uint16Array]"]=Le["[object Uint32Array]"]=!0,Le["[object Arguments]"]=Le["[object Array]"]=Le["[object ArrayBuffer]"]=Le["[object Boolean]"]=Le["[object DataView]"]=Le["[object Date]"]=Le["[object Error]"]=Le["[object Function]"]=Le["[object Map]"]=Le["[object Number]"]=Le["[object Object]"]=Le["[object RegExp]"]=Le["[object Set]"]=Le["[object String]"]=Le["[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)&&!!Le[w(e)]},Te=Object.prototype.hasOwnProperty;function Me(e,t){var r=O(e),i=!r&&ge(e),n=!r&&!i&&ve(e),s=!r&&!i&&!n&&Re(e),o=r||i||n||s,a=o?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)||o&&("length"==c||n&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||re(c,l))||a.push(c);return a}function xe(e,t){return function(r){return e(t(r))}}var Ce=xe(Object.keys,Object),De=Object.prototype.hasOwnProperty;function Pe(e){if(!he(e))return Ce(e);var t=[];for(var r in Object(e))De.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(!x(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],s=r.cache;if(s.has(n))return s.get(n);var o=e.apply(this,i);return r.cache=s.set(n,o)||s,o};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 st(e,t){for(var r=-1,i=t.length,n=e.length;++r<i;)e[n+r]=t[r];return e}var ot=g?g.isConcatSpreadable:void 0;function at(e){return O(e)||ge(e)||!!(ot&&e&&e[ot])}function lt(e){return(null==e?0:e.length)?function(e,t,r,i,n){var s=-1,o=e.length;for(r||(r=at),n||(n=[]);++s<o;){var a=e[s];r(a)?st(n,a):n[n.length]=a}return n}(e):[]}var ct=xe(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 vt=Object.prototype.propertyIsEnumerable,Lt=Object.getOwnPropertySymbols,It=Lt?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var r=-1,i=null==e?0:e.length,n=0,s=[];++r<i;){var o=e[r];t(o,r,e)&&(s[n++]=o)}return s}(Lt(e),function(t){return vt.call(e,t)}))}:_t,wt=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)st(t,It(e)),e=ct(e);return t}:_t;function St(e,t,r){var i=t(e);return O(e)?i:st(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]",xt="[object Promise]",Ct="[object Set]",Dt="[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())!=xt||Tt&&kt(new Tt)!=Ct||Y&&kt(new Y)!=Dt)&&(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 xt;case Wt:return Ct;case Ut:return Dt}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,s,o,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((o=e).buffer),new o.constructor(a,o.byteOffset,o.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(s=new(n=e).constructor(n.source,Vt.exec(n))).lastIndex=n.lastIndex,s;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,s){var o;if(r&&(o=n?r(e,i,n,s):r(e)),void 0!==o)return o;if(!x(e))return e;var a=O(e);if(a)o=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(ve(e))return e.slice();if(l==er||l==Xt||c&&!n)o={};else{if(!tr[l])return n?e:{};o=Yt(e,l)}}s||(s=new yt);var u=s.get(e);if(u)return u;s.set(e,o),Jt(e)?e.forEach(function(i){o.add(rr(i,t,r,i,e,s))}):qt(e)&&e.forEach(function(i,n){o.set(n,rr(i,t,r,n,e,s))});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]),oe(o,n,rr(i,t,r,n,e,s))}),o}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 sr(e,t,r,i,n,s){var o=1&r,a=e.length,l=t.length;if(a!=l&&!(o&&l>a))return!1;var c=s.get(e),u=s.get(t);if(c&&u)return c==t&&u==e;var h=-1,p=!0,d=2&r?new ir:void 0;for(s.set(e,t),s.set(t,e);++h<a;){var f=e[h],y=t[h];if(i)var g=o?i(y,f,h,t,e,s):i(f,y,h,e,t,s);if(void 0!==g){if(g)continue;p=!1;break}if(d){if(!nr(t,function(e,t){if(o=t,!d.has(o)&&(f===e||n(f,e,r,i,s)))return d.push(t);var o})){p=!1;break}}else if(f!==y&&!n(f,y,r,i,s)){p=!1;break}}return s.delete(e),s.delete(t),p}function or(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,s){var o=O(e),a=O(t),l=o?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&&ve(e)){if(!ve(t))return!1;o=!0,u=!1}if(p&&!u)return s||(s=new yt),o||Re(e)?sr(e,t,r,i,n,s):function(e,t,r,i,n,s,o){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||!s(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=or;case"[object Set]":var l=1&i;if(a||(a=ar),e.size!=t.size&&!l)return!1;var c=o.get(e);if(c)return c==t;i|=2,o.set(e,t);var u=sr(a(e),a(t),i,n,s,o);return o.delete(e),u;case"[object Symbol]":if(cr)return cr.call(e)==cr.call(t)}return!1}(e,t,l,r,i,n,s);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 s||(s=new yt),n(y,g,r,i,s)}}return!!p&&(s||(s=new yt),function(e,t,r,i,n,s){var o=1&r,a=At(e),l=a.length;if(l!=At(t).length&&!o)return!1;for(var c=l;c--;){var u=a[c];if(!(o?u in t:ur.call(t,u)))return!1}var h=s.get(e),p=s.get(t);if(h&&p)return h==t&&p==e;var d=!0;s.set(e,t),s.set(t,e);for(var f=o;++c<l;){var y=e[u=a[c]],g=t[u];if(i)var m=o?i(g,y,u,t,e,s):i(y,g,u,e,t,s);if(!(void 0===m?y===g||n(y,g,r,i,s):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 s.delete(e),s.delete(t),d}(e,t,r,i,n,s))}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&&!x(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,s=n;if(null==e)return!s;for(e=Object(e);n--;){var o=r[n];if(o[2]?o[1]!==e[o[0]]:!(o[0]in e))return!1}for(;++n<s;){var a=(o=r[n])[0],l=e[a],c=o[1];if(o[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 vr(e,t){return null!=e&&t in Object(e)}function Lr(e,t){return null!=e&&function(e,t,r){for(var i=-1,n=(t=rt(t,e)).length,s=!1;++i<n;){var o=it(t[i]);if(!(s=null!=e&&r(e,o)))break;e=e[o]}return s||++i!=n?s:!!(n=null==e?0:e.length)&&le(n)&&re(o,n)&&(O(e)||ge(e))}(e,t,vr)}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?Lr(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?C:"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 s=Array(n);++i<n;)s[i]=e[i+t];return s}(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||ve(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 xr(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 Cr=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,s=ae(i.length-t,0),o=Array(s);++n<s;)o[n]=i[t+n];n=-1;for(var a=Array(t+1);++n<t;)a[n]=i[n];return a[t]=r(o),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,s=t.length;++n<s;){var o=t[n],a=void 0;void 0===a&&(a=e[o]),i?ie(r,o,a):oe(r,o,a)}}(e,Et(e),r),i&&(r=rr(r,7,xr));for(var n=t.length;n--;)Mr(r,t[n]);return r});function Dr(e,t,r,i){if(!x(e))return e;for(var n=-1,s=(t=rt(t,e)).length,o=s-1,a=e;null!=a&&++n<s;){var l=it(t[n]),c=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(n!=o){var u=a[l];void 0===(c=void 0)&&(c=x(u)?u:re(t[n+1])?[]:{})}oe(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,s={};++i<n;){var o=t[i],a=nt(e,o);r(a,o)&&Dr(s,rt(o,e),a)}return s}(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=[],s=e.length;for(t=Sr(t);++i<s;){var o=e[i];t(o,i,e)&&(r.push(o),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!==s){var s=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,s]of Object.entries(e.paint??[]))r.setPaintProperty(i,n,s,{validate:!1});for(const[n,s]of Object.entries(e.layout??[]))r.setLayoutProperty(i,n,s,{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 s=e=>{i.hasImage(t)||i.addImage(t,e,n)},o=e=>{e.complete?e.naturalWidth>0?s(e):console.warn(`Failed to load image for ID ${t}`):(e.onload=()=>s(e),e.onerror=()=>console.warn(`Failed to load image for ID ${t}`))};if("string"==typeof r)if(r.includes("<svg")){o(kr(Hr(r)))}else s((await i.loadImage(r)).data);else o(r)},si=e=>{switch(e){case"standardDark":case"drivingDark":case"monoDark":case"satellite":return"dark";default:return"light"}},oi=e=>{if("string"==typeof e)return si(e);const t=e;return t?.id?si(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:s}=((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}:Cr(n?.properties,"eventState")};return r.splice(s,1,t),s}},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||(o=t,(s=r)&&o&&s.id===o.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 s,o;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,s=this.findHandlers(["hover","long-hover","click","contextmenu"],t?.source,t?.layer.id);if(this.hoveringSourceWithLayers=s?.[0]?.sourceWithLayers,r){this.updateCursor(i);const r=di("hover",this.hoveringFeature,i,this.hoveringSourceWithLayers,n),s=this.findHandlers(["hover"],t?.source,t?.layer.id);for(const t of s)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,s=this.findHandlers([e],this.lastClickedFeature?.source,this.lastClickedFeature?.layer.id);this.lastClickedSourceWithLayers=s?.[0]?.sourceWithLayers,console.log(this.lastClickedSourceWithLayers);const o=di(e,this.lastClickedFeature,i,this.lastClickedSourceWithLayers,n);console.log(o);for(const a of s)a.fn(o.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="vectorTiles",vi="vectorTilesIncidents",Li="vectorTilesFlow",Ii=["POI","POI - Micro"],wi={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"},Si=e=>e in wi?wi[e]:e.toLowerCase(),Ai="Noto-Bold",Ei="title",Oi="iconID",Ri="default_place",Ti={"icon-image":["get",Oi],"icon-anchor":"bottom","icon-size":["interpolate",["linear"],["zoom"],8,.6,22,.8],"icon-allow-overlap":!0,"icon-padding":0},Mi={"icon-translate":[0,5],"icon-translate-anchor":"viewport"},xi={"text-optional":!0,"text-font":[Ai],"text-field":["get",Ei],"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},Ci={"text-color":"#333333","text-halo-color":"#FFFFFF","text-halo-width":["interpolate",["linear"],["zoom"],6,1,10,1.5],"text-translate-anchor":"viewport"},Di={type:"symbol",layout:{...Ti,...xi},paint:{...Mi,...Ci}},Pi=(e,t)=>`${e}-${t}`,Ni=["in",["get","eventState"],["literal",["click","contextmenu"]]],Fi=["has","eventState"],ji="#3f9cd9",Wi={...Di,filter:["!",Fi]},Ui={...Di,filter:Fi,layout:{...Di.layout,"icon-size":["interpolate",["linear"],["zoom"],8,.8,22,1],"text-allow-overlap":!0},paint:{...Di.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,Ei)),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",Ei],"icon-image":["get",Oi],...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,r={})=>{const i=r.theme??"pin",n=r.icon?.categoryIcons,s=e.properties.poi?.classifications?.[0]?.code,o=n?.find(e=>e.id===s);if(o)return Pi(o.id,t);const a=Pi(Ri,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):(s&&`poi-${Si(s)}`)??a,l},Yi=e=>{const t=e.properties.poi?.classifications?.[0]?.code;return t&&Si(t)},Ki=e=>Array.isArray(e)?{type:"FeatureCollection",features:e}:"Feature"===e.type?{type:"FeatureCollection",features:[e]}:e,qi=(e,r,i={})=>{const n=Ki(e);return{...n,features:n.features.map(e=>{const n="function"==typeof i?.text?.title?i?.text?.title(e):Bi(e),s=i.extraFeatureProps?Object.fromEntries(Object.entries(i.extraFeatureProps).map(([t,r])=>[t,"function"==typeof r?r(e):r])):{},o=e.id??t();return{...e,id:o,geometry:{...e.geometry,bbox:e.bbox},properties:{...e.properties,id:o,title:n,iconID:$i(e,r,i),..."base-map"===i?.theme&&{category:Yi(e)},...s}}})}},Zi=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=`places-${this.instanceIndex}`,this.layerIDPrefix=this.sourceID,this.defaultPlaceIconID=Pi(Ri,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,Pi(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(qi(this.sourcesWithLayers.places.shownFeatures,this.instanceIndex,e))}async show(e){await this.waitUntilModuleReady(),this.sourcesWithLayers.places.show(qi(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)}};Zi.lastInstanceIndex=-1;let Ji=Zi;const Xi=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(!Xi(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}},Qi=e=>e?.length?1===e.length?e[0]:{expression:["any",...e.map(e=>e?.expression)],legacy:["any",...e.map(e=>e?.legacy)]}:null,en=(e,t)=>{return t?["all",e[(r=t,Xi(r)?"expression":"legacy")],t]:e.expression;var r},tn=(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]}},rn=(e,t,r)=>tn(e,t.show,r?t.values.map(r):t.values),nn={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 nn?t.push(...nn[e].map(Si)):t.push(Si(e))}),[...new Set(t)]};class on extends ai{static async get(e,t){return await Jr(e),new on(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(mi);if(!e)throw Wr(`init ${on.name} with source ID ${mi}`);const t=new Yr(this.mapLibreMap,e,e=>Ii.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=tn("category",e.show,sn(e.values));this.mapLibreMap.setFilter("POI",en(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 an={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"]}},ln=(e,t)=>{const r=an[e];return r.layerIDMatches.some(e=>t.id.toLowerCase().includes(e))&&r.layerTypes.includes(t.type)},cn=e=>t=>(!e||((e,t)=>{const r=t?.mode,i=t?.names;if(r&&i?.length){if("include"===r)return i.some(t=>ln(t,e));if("exclude"===r)return!i.some(t=>ln(t,e))}return!0})(t,e))&&!Ii.includes(t.id);class un extends ai{static async get(e,t){return await Jr(e),new un(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(e){const t=this.mapLibreMap.getSource(_i);if(!t)throw Wr(`init ${un.name} with source ID ${_i}`);return{vectorTiles:new Yr(this.mapLibreMap,t,cn(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=>ln(t,e)):"exclude"===t?e=>!r.some(t=>ln(t,e)):(console.error("Unrecognized layer group mode:",t),()=>!0)})(t.layerGroups))}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.vectorTiles)}}const hn=["land","water","borders","buildings2D","buildings3D","houseNumbers","roadLines","roadLabels","roadShields","placeLabels","smallerTownLabels","cityLabels","capitalLabels","stateLabels","countryLabels"],pn="title",dn="color",fn={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"]},yn="#0A3653",gn={type:"fill",paint:{"fill-color":["coalesce",["get",dn],yn],"fill-opacity":.15,"fill-antialias":!1}},mn={type:"line",paint:{"line-color":yn,"line-opacity":.45,"line-width":2}},bn=(e,t,r)=>{const i=r?.colorConfig,n=r?.lineConfig;return[{...gn,id:e,paint:{...gn.paint,...!Tr(i?.fillOpacity)&&{"fill-opacity":i?.fillOpacity},...i?.fillColor&&{"fill-color":["get","color"]}}},{...mn,id:t,paint:{...mn.paint,...!Tr(n?.lineColor)&&{"line-color":n?.lineColor},...!Tr(n?.lineWidth)&&{"line-width":n?.lineWidth},...!Tr(n?.lineOpacity)&&{"line-opacity":n?.lineOpacity}}}]},_n=(e,t)=>{const r=t?.textConfig;return{type:"symbol",id:e,layout:{"text-field":["get",pn],...r?.textField&&{"text-field":r.textField},"text-padding":5,"text-size":12,"text-font":[Ai],"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),s=e.properties?.color??((e,t)=>{const r=e?.colorConfig?.fillColor;if("string"==typeof r&&fn[r]){const e=fn[r];return e[t%e.length]}return r})(r,i);return{...e,properties:{...e.properties,...n&&{title:n},...s&&{color:s},id:e.properties?.id??t()}}})}),Ln=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),s=r(t);n=s&&i(s)||null}else n=e.geometry.coordinates.flat();const s=e.id??e.properties?.id??t();return{type:"Feature",id:s,geometry:{type:"Point",coordinates:n},properties:{...e.properties,id:s}}});return{type:"FeatureCollection",bbox:e.bbox,features:n}},In=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]=bn(this.fillLayerID,this.outlineLayerID,t),s=_n(this.titleLayerID,t);return this.titleLayerSpecs=s,this.geometryFillLayerSpecs=i,this.geometryOutlineLayerSpecs=n,{geometry:new Zr(this.mapLibreMap,this.sourceID,[{...i},{...n}]),geometryLabel:new Zr(this.mapLibreMap,this.titleSourceID,[s])}}_applyConfig(e){return(e?.textConfig||e?.colorConfig||e?.lineConfig)&&this.updateLayerAndData(e),e?.beforeLayerConfig&&this.moveBeforeLayer(e.beforeLayerConfig),e}moveBeforeLayerID(e){for(const t of this.sourcesWithLayers.geometry.sourceAndLayerIDs.layerIDs)this.mapLibreMap.moveLayer(t,e)}moveBeforeLayer(e){this.config={...this.config,beforeLayerConfig:e},this.moveBeforeLayerID("top"===e?this.titleLayerID:gi[e])}applyTextConfig(e){const t={...this.config,textConfig:e};this.updateLayerAndData(t),this.sourcesWithLayers.geometryLabel.show(Ln(this.sourcesWithLayers.geometry.shownFeatures)),this.config=t}updateLayerAndData(e){const[t,r]=bn(this.fillLayerID,this.outlineLayerID,e),i=_n(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(Ln(t.shownFeatures))}async clear(){await this.waitUntilModuleReady(),this.sourcesWithLayers.geometry.clear()}get events(){return new li(this.tomtomMap._eventsProxy,this.sourcesWithLayers.geometry)}};In.lastInstanceIndex=-1;let wn=In;class Sn extends ai{static async get(e,t){return await Jr(e),await ii(e,bi,"hillshade"),new Sn(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(bi);if(!e)throw Wr(`init ${Sn.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 An=["standardLight","standardDark","drivingLight","drivingDark","monoLight","monoDark","satellite"],En=["trafficIncidents","trafficFlow","hillshade"],On="#36A8F0",Rn="#105287",Tn="#ABAFB3",Mn="#3C4956",xn="#727C85",Cn=["interpolate",["linear"],["zoom"],1,3,5,4,10,7,18,10],Dn=["==",["get","routeState"],"selected"],Pn=["==",["get","routeState"],"deselected"],Nn="#AD0000",Fn="#FB2D09",jn="#f58240",Wn="#000000",Un=e=>!1===e?.visible?"":e?.title??["format",["get","title"],"\n",["get","chargingPower"]," • ",["get","chargingDuration"]],kn=e=>({...Di,filter:Dn,minzoom:4,layout:{...Di.layout,"text-field":Un(e?.text)},paint:{...Di.paint}}),Hn={filter:Dn,minzoom:16},zn={...Hn,type:"line",layout:{"line-cap":"round"}},Gn={...zn,paint:{"line-width":["interpolate",["linear"],["zoom"],16,14,22,20],"line-color":"grey"}},Vn={...zn,paint:{"line-width":["interpolate",["linear"],["zoom"],16,12,22,17],"line-color":"white"}},Bn="instruction-arrow",$n={...Hn,type:"symbol",layout:{"icon-allow-overlap":!0,"icon-image":Bn,"icon-rotation-alignment":"map","icon-rotate":["get","lastPointBearingDegrees"],"icon-size":["interpolate",["linear"],["zoom"],16,1,22,2]}},Yn={filter:Dn,type:"line",layout:{"line-join":"round"},paint:{"line-width":Cn,"line-color":"#6dc4ed"}},Kn={filter:Dn,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}},qn={type:"line",layout:{"line-join":"round","line-cap":"round","line-sort-key":["get","index"]}},Zn=["interpolate",["linear"],["zoom"],1,5,5,6,10,10,18,14],Jn={...qn,filter:Pn,paint:{"line-color":Mn,"line-width":Zn}},Xn={...qn,filter:Pn,paint:{"line-color":Tn,"line-width":Cn}},Qn={...qn,filter:Dn,paint:{"line-color":Rn,"line-width":Zn}},es={type:"symbol",layout:{"symbol-placement":"line","icon-image":"roads-arrow-white","icon-rotate":180}},ts="selected-route-summary-popup",rs="deselected-route-summary-popup",is={filter:Dn,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"}},ns={filter:Dn,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]}},ss=["interpolate",["linear"],["zoom"],1,2,5,3,10,4,18,6],os={type:"line",layout:{"line-cap":"round"},paint:{"line-width":ss,"line-color":["match",["get","magnitudeOfDelay"],"minor","#FFC105","moderate",Fn,"major",Nn,"#C7D2D8"]}},as={type:"line",filter:["in",["get","magnitudeOfDelay"],["literal",["unknown","indefinite"]]],layout:{"line-join":"round"},paint:{"line-width":ss,"line-color":["match",["get","magnitudeOfDelay"],"unknown","rgba(190, 39, 27, 1)","rgba(137, 150, 168, 1)"],"line-dasharray":[1.5,1]}},ls=["match",["get","magnitudeOfDelay"],"minor",jn,"moderate",Fn,"major",Nn,"indefinite","#666666",Wn],cs={filter:Dn,type:"symbol",minzoom:6,layout:{"symbol-placement":"point","symbol-avoid-edges":!0,"icon-ignore-placement":!0}},us={...cs,filter:["all",["has","jamIconID"],cs.filter],layout:{...cs.layout,"icon-image":["get","jamIconID"],"icon-anchor":"bottom-left","text-anchor":"bottom-left","text-field":["get","title"],"text-font":[Ai],"text-offset":[3.9,-1.4],"text-size":13},paint:{...cs.paint,"text-color":ls,"text-halo-color":"#FFFFFF","text-halo-width":1}},hs={...cs,filter:["all",["has","causeIconID"],cs.filter],layout:{...cs.layout,"icon-image":["get","causeIconID"],"icon-anchor":"bottom-right"},paint:{...cs.paint}},ps={filter:Dn,type:"line",layout:{"line-join":"round"},paint:{"line-width":Cn,"line-color":"#000000","line-opacity":.3}},ds={filter:Dn,type:"line",layout:{"line-join":"round"},paint:{"line-color":Rn,"line-width":Cn}},fs={filter:Dn,type:"line",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":On,"line-width":["interpolate",["linear"],["zoom"],1,2,5,3,10,5,18,7],"line-dasharray":[0,1.5]}},ys="traffic-clear",gs="traffic-major",ms="traffic-moderate",bs="traffic-minor",_s=["has","formattedTraffic"],vs=e=>{const t=void 0!==e?Pi(ts,e):ts,r=void 0!==e?Pi(rs,e):rs,i=void 0!==e?Pi(ys,e):ys,n=void 0!==e?Pi(gs,e):gs,s=void 0!==e?Pi(ms,e):ms,o=void 0!==e?Pi(bs,e):bs;return{type:"symbol",layout:{"icon-image":["case",Dn,t,r],"symbol-placement":"point","icon-rotation-alignment":"viewport","text-rotation-alignment":"viewport","symbol-sort-key":["case",Dn,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",[Ai]],"text-color":["case",Dn,"black",xn]},["concat","\t\t",["get","formattedDistance"]],{"text-color":xn},["case",_s,"\n",""],{},["image",["case",_s,["match",["get","magnitudeOfDelay"],"major",n,"moderate",s,"minor",o,i],""]],{},["case",_s,["concat"," ",["get","formattedTraffic"]],""],{"text-font":["literal",[Ai]],"text-color":ls}]},paint:{"icon-translate":[0,-35],"text-translate":[0,-35]}}},Ls=vs(),Is="start",ws="middle",Ss="finish",As="indexType",Es="stopDisplayIndex",Os="waypointStart",Rs="waypointStop",Ts="waypointSoft",Ms="waypointFinish",xs={"text-field":["get",Es],"text-font":[Ai],"text-size":["interpolate",["linear"],["zoom"],13,14,18,16],"text-offset":[0,-1.6],"icon-anchor":["case",["all",["==",["get",As],ws],["!",["has",Es]]],"center","bottom"],"text-allow-overlap":!0},Cs={type:"symbol",paint:{...Mi,"text-color":"#ffffff"},layout:{...Ti,...xs,"symbol-sort-key":["case",["==",["get",Oi],Ts],0,["abs",["-",["get","index"],1e3]]]}},Ds={type:"symbol",paint:{...Ci,"text-color":"black","text-halo-width":1.5,"text-halo-color":"#ffffff"},layout:{...xi,"text-anchor":"top","text-offset":[0,.4]}},Ps=(e,t)=>e&&t&&(e.startsWith("route")||e.startsWith("waypoint"))?`${t}-${e}`:e,Ns=(e,t)=>e&&void 0!==t?`${e}-${t}`:e,Fs=(e={},t,r)=>{const i=e.layers,n=i?.sections,s=e.theme?.mainColor;return{mainLines:{routeLineArrows:{...es,beforeID:gi.lowestLabel,...i?.mainLines?.routeLineArrows},routeLine:{...(o={color:s},{...qn,filter:Dn,paint:{"line-color":o?.color??On,"line-width":Cn}}),beforeID:Ps("routeIncidentBackgroundLine",t),...i?.mainLines?.routeLine},routeOutline:{...Qn,beforeID:Ps("routeLine",t),...i?.mainLines?.routeOutline},routeDeselectedLine:{...Xn,beforeID:Ps("routeOutline",t),...i?.mainLines?.routeDeselectedLine},routeDeselectedOutline:{...Jn,beforeID:Ps("routeDeselectedLine",t),...i?.mainLines?.routeDeselectedOutline},...i?.mainLines?.additional},waypoints:{routeWaypointSymbol:{...Cs,beforeID:Ps("routeSummaryBubbleSymbol",t),...i?.waypoints?.routeWaypointSymbol},routeWaypointLabel:{...Ds,beforeID:Ps("routeWaypointSymbol",t),...i?.waypoints?.routeWaypointLabel},...i?.waypoints?.additional},chargingStops:{routeChargingStopSymbol:{...kn(e.chargingStops),beforeID:Ps("routeWaypointSymbol",t),...i?.chargingStops?.routeChargingStopSymbol},...i?.chargingStops?.additional},sections:{incident:{routeIncidentJamSymbol:{...us,beforeID:Ps("routeChargingStopSymbol",t),...n?.incident?.routeIncidentJamSymbol},routeIncidentCauseSymbol:{...hs,beforeID:Ps("routeChargingStopSymbol",t),...n?.incident?.routeIncidentCauseSymbol},routeIncidentBackgroundLine:{...os,beforeID:Ps("routeIncidentDashedLine",t),...n?.incident?.routeIncidentBackgroundLine},routeIncidentDashedLine:{...as,beforeID:Ps("routeTunnelLine",t),...n?.incident?.routeIncidentDashedLine}},ferry:{routeFerryLine:{...Yn,beforeID:Ps("routeLineArrows",t),...n?.ferry?.routeFerryLine},routeFerrySymbol:{...Kn,beforeID:Ps("routeIncidentJamSymbol",t),...n?.ferry?.routeFerrySymbol},...n?.ferry?.additional},tollRoad:{routeTollRoadOutline:{...is,beforeID:Ps("routeDeselectedOutline",t),...n?.tollRoad?.routeTollRoadOutline},routeTollRoadSymbol:{...ns,beforeID:Ps("routeChargingStopSymbol",t),...n?.tollRoad?.routeTollRoadSymbol},...n?.tollRoad?.additional},tunnel:{routeTunnelLine:{...ps,beforeID:Ps("routeLineArrows",t),...n?.tunnel?.routeTunnelLine},...n?.tunnel?.additional},vehicleRestricted:{routeVehicleRestrictedBackgroundLine:{...ds,beforeID:Ps("routeVehicleRestrictedForegroundLine",t),...n?.vehicleRestricted?.routeVehicleRestrictedBackgroundLine},routeVehicleRestrictedForegroundLine:{...fs,beforeID:gi.lowestLabel,...n?.vehicleRestricted?.routeVehicleRestrictedForegroundLine},...n?.vehicleRestricted?.additional}},instructionLines:{routeInstructionLine:{...Vn,beforeID:gi.lowestLabel,...i?.instructionLines?.routeInstructionLine},routeInstructionOutline:{...Gn,beforeID:Ps("routeInstructionLine",t),...i?.instructionLines?.routeInstructionOutline},...i?.instructionLines?.additional},instructionArrows:{routeInstructionArrowSymbol:{...$n,beforeID:Ps("routeInstructionLine",t),...void 0!==r&&{layout:{...$n.layout,"icon-image":Ns($n.layout?.["icon-image"],r)}},...i?.instructionArrows?.routeInstructionArrowSymbol},...i?.instructionArrows?.additional},summaryBubbles:{routeSummaryBubbleSymbol:{...void 0!==r?vs(r):Ls,...i?.summaryBubbles?.routeSummaryBubbleSymbol},...i?.summaryBubbles?.additional}};var o},js=Fs();let Ws;Ur()&&(Ws=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 Us=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)},ks={pixelRatio:2,stretchX:[[20,45],[100,130]],stretchY:[[20,35]],content:[10,10,130,45]},Hs=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)},zs=(e,t)=>{if(!Ur())return;const r=zr(t);return e&&r.appendChild(e),kr(r)},Gs=(e={},t)=>Object.entries(e).map(([e,r])=>({...r,id:t?`${t}-${e}`:e})),Vs=(e={},t)=>({mainLines:Gs(e.mainLines,t),waypoints:Gs(e.waypoints,t),chargingStops:Gs(e?.chargingStops,t),ferries:Gs(e.sections?.ferry,t),incidents:Gs(e.sections?.incident,t),tollRoads:Gs(e.sections?.tollRoad,t),tunnels:Gs(e.sections?.tunnel,t),vehicleRestricted:Gs(e.sections?.vehicleRestricted,t),instructionLines:Gs(e.instructionLines,t),instructionArrows:Gs(e.instructionArrows,t),summaryBubbles:Gs(e.summaryBubbles,t)}),Bs=(e,t,r)=>{const i=n.instance.get().displayUnits,s=e?.displayUnits;return{...e,...s?{}:{displayUnits:i},layers:Fs(e,t,r)}},$s={commonBaseURL:"https://api.tomtom.com",apiKey:"",apiVersion:1},Ys=class{constructor(){this.config={...$s}}put(e){this.config={...this.config,...e}}reset(){this.config={...$s}}get(){return this.config}};Ys.instance=new Ys;let Ks=Ys;const qs=()=>Date.now().toString(36)+Math.random().toString(36).substring(2),Zs=e=>e?.minutes??"min",Js=(e,t)=>{if(e){const i=Math.abs(e)/3600;let n=Math.floor(i),s=Math.round(i%1*60);60===s&&(s=0,n++);const o={...Ks.instance.get().displayUnits?.time,...t};if(n)return`${n} ${r=o,r?.hours??"hr"} ${s.toString().padStart(2,"0")} ${Zs(o)}`;if(s)return`${s.toString()} ${Zs(o)}`}var r},Xs=(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"},Qs=e=>{const t=e.properties;return t.chargingParkName??t.chargingParkOperatorName},eo=(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??qs(),iconID:Xs(n,t),title:Qs(n),chargingPower:`${e.chargingConnectionInfo?.chargingPowerInkW} kW`,chargingDuration:Js(e.chargingTimeInSeconds,t?.displayUnits?.time),routeState:i.properties.routeState}})}}return{type:"FeatureCollection",features:r}},to=e=>e.categories.includes("jam"),ro=e=>{const t=(e=>{if(to(e))return s(e.delayInSeconds)})(e),r=((e,t)=>to(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}}},io=(e,t,r)=>{if(e.properties.radiusMeters)return void 0!==r?Pi(Ts,r):Ts;let i;switch(t){case"start":i=Os;break;case"finish":i=Ms;break;default:i=Rs}return void 0!==r?Pi(i,r):i},no=(e,r,i)=>{let n=-1;return{type:"FeatureCollection",features:e.map((s,a)=>{if(!s)return n++,null;const l=(e=>{return Array.isArray(e)?{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{}}:"Point"===e.type?{type:"Feature",geometry:t=e,properties:{},...t.bbox&&{bbox:t.bbox}}:e;var t})(s),c=((e,t)=>0===e?Is:e<t-1?ws:Ss)(a,e.length),u=(e=>!e.properties.radiusMeters)(l);u&&n++;const h=(e=>{const t=e?.properties;return t?.poi?.name??t?.address?.freeformAddress??void 0})(l),p=l.id??t();return{...l,..."main-when-available"===r?.entryPoints&&{geometry:{type:"Point",coordinates:o(l,{useEntryPoint:"main-when-available"})}},id:p,properties:{...l.properties,id:p,index:a,indexType:c,...h&&{title:h},iconID:io(l,c,i),...u&&c===ws&&{stopDisplayIndex:n}}}}).filter(e=>e)}};function so(e){return e%360*Math.PI/180}function oo(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 ao(e,t,r={}){if(!0===r.final)return function(e,t){let r=ao(t,e);return r=(r+180)%360,r}(e,t);const i=oo(e),n=oo(t),s=so(i[0]),o=so(n[0]),a=so(i[1]),l=so(n[1]),c=Math.sin(o-s)*Math.cos(l),u=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(o-s);return Math.atan2(c,u)%(2*Math.PI)*180/Math.PI}var lo=ao;const co=(e,r,i)=>({type:"FeatureCollection",features:e.features.flatMap(e=>((e,r,i)=>e.properties.sections[r]?.map(r=>{const n=r.id??t();return{type:"Feature",id:n,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:n}}})||[])(e,r,i))}),uo=(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},ho=(e,r=0)=>{const i="features"in e?e:{type:"FeatureCollection",features:[e]};return{...i,features:i.features.map((e,i)=>{const n=e.id??t();return{...e,id:n,properties:{...e.properties,id:n,routeState:i===r?"selected":"deselected"}}})}},po=(e,t)=>e.some(e=>e.magnitudeOfDelay===t),fo=(e,r)=>({type:"FeatureCollection",features:e.features.map(e=>{const i=e.properties.summary,n=e.geometry.coordinates,o=s(i.trafficDelayInSeconds,r?.time),l=(e=>{const t=e.properties.sections.traffic;if(t?.length)return po(t,"major")?"major":po(t,"moderate")?"moderate":po(t,"minor")?"minor":void 0})(e),c=e.id??t();return{type:"Feature",id:c,geometry:{type:"Point",coordinates:n[Math.round(n.length/2)]},properties:{id:c,routeIndex:e.properties.index,routeState:e.properties.routeState,formattedDistance:a(i.lengthInMeters,r?.distance),...l&&{magnitudeOfDelay:l},...o&&{formattedTraffic:o},formattedDuration:s(i.travelTimeInSeconds,r?.time)}}})}),yo=class e extends ai{static async get(t,r){return await Jr(t),new e(t,r)}constructor(e,t){super("geojson",e,t)}createSourcesWithLayers(e){const t=Pi("routes",this.instanceIndex);return{mainLines:new Zr(this.mapLibreMap,`${t}-mainLines`,e.mainLines,!1),waypoints:new Zr(this.mapLibreMap,`${t}-waypoints`,e.waypoints,!1),incidents:new Zr(this.mapLibreMap,`${t}-incidents`,e.incidents,!1),ferries:new Zr(this.mapLibreMap,`${t}-ferries`,e.ferries,!1),chargingStops:new Zr(this.mapLibreMap,`${t}-chargingStops`,e.chargingStops,!1),tollRoads:new Zr(this.mapLibreMap,`${t}-tollRoads`,e.tollRoads,!1),tunnels:new Zr(this.mapLibreMap,`${t}-tunnels`,e.tunnels,!1),vehicleRestricted:new Zr(this.mapLibreMap,`${t}-vehicleRestricted`,e.vehicleRestricted,!1),instructionLines:new Zr(this.mapLibreMap,`${t}-instructionLines`,e.instructionLines,!1),instructionArrows:new Zr(this.mapLibreMap,`${t}-instructionArrows`,e.instructionArrows,!1),summaryBubbles:new Zr(this.mapLibreMap,`${t}-summaryBubbles`,e.summaryBubbles,!1)}}_initSourcesWithLayers(t,r){r||(e.lastInstanceIndex++,this.instanceIndex=e.lastInstanceIndex,this.layerIDPrefix=Pi("routes",this.instanceIndex)),this.layersSpecs=Vs(Bs(t,this.layerIDPrefix,this.instanceIndex).layers,this.layerIDPrefix);const i=this.createSourcesWithLayers(this.layersSpecs);ti(Object.values(i).flatMap(e=>e._layerSpecs),this.mapLibreMap);const n={fillColor:t?.theme?.mainColor,...t?.waypoints?.icon?.style},s={pixelRatio:2},o=Pi(Os,this.instanceIndex),a=Pi(Rs,this.instanceIndex),l=Pi(Ts,this.instanceIndex),c=Pi(Ms,this.instanceIndex),u=Pi(Bn,this.instanceIndex),h=Pi(ts,this.instanceIndex),p=Pi(rs,this.instanceIndex),d=Pi(ys,this.instanceIndex),f=Pi(gs,this.instanceIndex),y=Pi(ms,this.instanceIndex),g=Pi(bs,this.instanceIndex);this.addImageIfNotExisting(o,(e=>{if(Ur())return zs(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)})(n),s),this.addImageIfNotExisting(a,zs(void 0,n),s),this.addImageIfNotExisting(l,(()=>{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'))})(),s),this.addImageIfNotExisting(c,(e=>{if(Ur())return zs(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)})(n),s),this.addImageIfNotExisting(u,Ws,s),this.addImageIfNotExisting(h,Us("white"),ks),this.addImageIfNotExisting(p,Us("#EEEEEE"),ks),this.addImageIfNotExisting(d,Hs(Wn),s),this.addImageIfNotExisting(f,Hs(Nn),s),this.addImageIfNotExisting(y,Hs(Fn),s),this.addImageIfNotExisting(g,Hs(jn),s);for(const e of t?.chargingStops?.icon?.customIcons??[])this.addImageIfNotExisting(Pi(e.id,this.instanceIndex),e.image,{pixelRatio:e.pixelRatio??2});return i}_applyConfig(e){const t=Bs(e,this.layerIDPrefix,this.instanceIndex);if(this.config){const e=Vs(t.layers,this.layerIDPrefix);Object.keys(e).forEach(t=>{const r=t;((e,t,r,i)=>{const n=e.reduce((e,t)=>({...e,[t.id]:t}),{}),s=t.reduce((e,t)=>({...e,[t.id]:t}),{}),o=[],a=[],l=[],c=[];Object.keys(n).forEach(e=>{s[e]?(l.push(n[e]),c.push(s[e])):o.push(e)}),Object.keys(s).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}}),o.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(fo(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.config,!0),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=ho(e,r?.selectedIndex);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(i),this.sourcesWithLayers.vehicleRestricted.show(co(i,"vehicleRestricted")),this.sourcesWithLayers.incidents.show(co(i,"traffic",ro)),this.sourcesWithLayers.chargingStops.show(eo(i,this.config)),this.sourcesWithLayers.ferries.show(co(i,"ferry")),this.sourcesWithLayers.tunnels.show(co(i,"tunnel")),this.sourcesWithLayers.tollRoads.show(co(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:lo(n[0],n[1])}}})||[])}))(i)),this.sourcesWithLayers.summaryBubbles.show(fo(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=ho(this.sourcesWithLayers.mainLines.shownFeatures,e);await this.waitUntilModuleReady(),this.sourcesWithLayers.mainLines.show(t),this.sourcesWithLayers.chargingStops.show(eo(t,this.config)),uo(t,this.sourcesWithLayers.vehicleRestricted),uo(t,this.sourcesWithLayers.incidents),uo(t,this.sourcesWithLayers.ferries),uo(t,this.sourcesWithLayers.tollRoads),uo(t,this.sourcesWithLayers.tunnels),uo(t,this.sourcesWithLayers.instructionLines),uo(t,this.sourcesWithLayers.instructionArrows),uo(t,this.sourcesWithLayers.summaryBubbles)}async showWaypoints(e){const t=Array.isArray(e)?no(e,this.config?.waypoints,this.instanceIndex):no(e.features,this.config?.waypoints,this.instanceIndex);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}};yo.lastInstanceIndex=-1;let go=yo;const mo="standardLight",bo={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"}},_o=e=>`\${baseURL}/maps/orbis/assets/styles/\${version}/style.json?&apiVersion=1&key=\${apiKey}&map=${e}`,vo={standardLight:_o("basic_street-light"),standardDark:_o("basic_street-dark"),drivingLight:_o("basic_street-light-driving"),drivingDark:_o("basic_street-dark-driving"),monoLight:_o("basic_mono-light"),monoDark:_o("basic_mono-dark"),satellite:_o("basic_street-satellite")},Lo=(e,t,r)=>{const i=e.id??mo,n=new URL(vo[i].replace("${baseURL}",t).replace("${version}",e.version??"0.6.0-0").replace("${apiKey}",r));for(const s of e.include??En)n.searchParams.append(s,bo[i][s]);return n.toString()},Io=e=>{const t=e.style,r=e.commonBaseURL,i=e.apiKey;return"string"==typeof t?Lo({id:t},r,i):"standard"===t?.type?Lo(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:Lo({id:mo},r,i)};class wo{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=oi(r),this.mapLibreMap.once("styledata",()=>{!this.mapReady&&Rr(r,this._params.style)&&this.handleStyleData(t.keepState||!0)}),this.mapLibreMap.setStyle(Io(this._params),{validate:!1})},this.getStyle=()=>this._params.style,this._params=l(r),this.styleLightDarkTheme=oi(this._params.style),this.ensureMapLibreCSSLoaded(),this.mapLibreMap=new u(((t,r)=>{return{validateStyle:!1,maxTileCacheZoomLevels:22,cancelPendingTileRequestsWhileZooming:!1,...t,style:Io(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,Li,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_${oi(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 So=["unknown","accident","fog","dangerous_conditions","rain","ice","jam","lane_closed","road_closed","road_works","wind","flooding","broken_down_vehicle"],Ao={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},Eo=["motorway","trunk","primary","secondary","tertiary","street"],Oo=["connecting","major_local"],Ro=["local","minor_local"],To=(e,t)=>e.length?1===e.length?{expression:e[0],legacy:t[0]}:{expression:["all",...e],legacy:["all",...t]}:null,Mo=(e,t,r)=>{e&&(t.push(e.expression),r.push(e.legacy))},xo=(e,t,r,i)=>{e&&Mo(rn(t,e),r,i)},Co=(e,t,r)=>{xo(e.roadCategories,"road_category",t,r),xo(e.roadSubCategories,"road_subcategory",t,r)},Do=e=>{const t=[],r=[];if(Co(e,t,r),e.incidentCategories){const i=rn("icon_category_0",e.incidentCategories,e=>Ao[e]);Mo(i,t,r)}if(e.magnitudes){const i=rn("magnitude",e.magnitudes,e=>c.indexOf(e));Mo(i,t,r)}return e.delays&&Mo((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 To(t,r)})(e.delays),t,r),To(t,r)},Po=e=>{if(!e?.any?.length)return null;const t=e.any.map(Do).filter(e=>!Tr(e));return Qi(t)},No=e=>{const t=[],r=[];if(Co(e,t,r),e.showRoadClosures){const i="only"===e.showRoadClosures?"==":"!=";t.push([i,["get","road_closure"],!0]),r.push([i,"road_closure",!0])}return To(t,r)},Fo=(e,t,r,i)=>{for(const n of t)r.setFilter(n.id,e?en(e,i[n.id]):i[n.id])};class jo extends ai{static async get(e,t){return await Jr(e),await ii(e,Li,"trafficFlow"),new jo(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(Li);if(!e)throw Wr(`init ${jo.name} with source ID ${Li}`);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,[Li])}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(No).filter(e=>!Tr(e));return Qi(t)})(e);t&&Fo(t,this.getLayers(),this.mapLibreMap,this.originalFilters)}else this.config?.filters?.any?.length&&Fo(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 Wo extends ai{static async get(e,t){return await Jr(e),await ii(e,vi,"trafficIncidents"),new Wo(e,t)}constructor(e,t){super("style",e,t)}_initSourcesWithLayers(){const e=this.mapLibreMap.getSource(vi);if(!e)throw Wr(`init ${Wo.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=Po(e);if(r){const e=t?this.getNonSymbolLayers():this.getLayers();Fo(r,e,this.mapLibreMap,this.originalFilters)}}else this.config?.filters?.any?.length&&Fo(void 0,this.getLayers(),this.mapLibreMap,this.originalFilters);if(t?.any?.length){const e=Po(t);e&&Fo(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,_i as BASE_MAP_SOURCE_ID,un as BaseMapModule,Tn as DESELECTED_FOREGROUND_COLOR,Mn as DESELECTED_OUTLINE_COLOR,Pn as DESELECTED_ROUTE_FILTER,xn as DESELECTED_SECONDARY_COLOR,li as EventsModule,yi as EventsProxy,Ss as FINISH_INDEX,dn as GEOMETRY_COLOR_PROP,pn as GEOMETRY_TITLE_PROP,Zr as GeoJSONSourceWithLayers,wn as GeometriesModule,bi as HILLSHADE_SOURCE_ID,Sn as HillshadeModule,As as INDEX_TYPE,Nn as MAJOR_DELAY_COLOR,ws as MIDDLE_INDEX,jn as MINOR_DELAY_LABEL_COLOR,Fn as MODERATE_DELAY_COLOR,mi as POI_SOURCE_ID,on as POIsModule,Ji as PlacesModule,On as ROUTE_LINE_FOREGROUND_COLOR,Cn as ROUTE_LINE_FOREGROUND_WIDTH,Rn as ROUTE_LINE_OUTLINE_COLOR,go as RoutingModule,Dn as SELECTED_ROUTE_FILTER,Is as START_INDEX,Es as STOP_DISPLAY_INDEX,Yr as StyleSourceWithLayers,Li as TRAFFIC_FLOW_SOURCE_ID,vi as TRAFFIC_INCIDENTS_SOURCE_ID,wo as TomTomMap,Vr as TomTomMapSource,jo as TrafficFlowModule,Wo as TrafficIncidentsModule,Wn as UNKNOWN_DELAY_COLOR,hn as baseMapLayerGroupNames,Bi as buildPlaceTitle,Fs as buildRoutingLayers,js as defaultRoutingLayers,$r as filterLayersBySources,$i as getIconIDForPlace,Yi as getPOILayerCategoryForPlace,sn as getStyleCategories,So as incidentCategories,Ao as incidentCategoriesMapping,gi as mapStyleLayerIDs,nn as poiCategoryGroups,Ii as poiLayerIDs,qi as preparePlacesForDisplay,Eo as roadCategories,An as standardStyleIDs,Ro as streetRoadCategories,En as styleModules,Oo as tertiaryRoadCategories,Si as toMapDisplayPOICategory,Ki as toPlaces};
|
|
2
2
|
//# sourceMappingURL=map.es.js.map
|