@wemap/routers 12.11.4 → 12.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
1
  import { Coordinates } from '@wemap/geo';
2
- import { default as ItineraryInfoManager } from '../src/ItineraryInfoManager.js';
3
- import { Step } from '../src/model/Step.js';
2
+ import { ItineraryInfoManager, Step } from '@wemap/routers';
4
3
  export default class InstructionManager {
5
4
  static useProposals: boolean;
6
5
  static getTurnInfoFromAngle(_angle: number): {
@@ -11,7 +10,7 @@ export default class InstructionManager {
11
10
  type: string;
12
11
  direction: string | undefined;
13
12
  directionExtra: string | undefined;
14
- levelChange: import('../index.js').LevelChange | undefined;
13
+ levelChange: import('@wemap/routers').LevelChange | undefined;
15
14
  name: string | null;
16
15
  indoor: boolean;
17
16
  };
@@ -1,6 +1,5 @@
1
1
  import { Coordinates } from '@wemap/geo';
2
- import { default as ItineraryInfoManager } from '../src/ItineraryInfoManager.js';
3
- import { Step } from '../src/model/Step.js';
2
+ import { ItineraryInfoManager, Step } from '@wemap/routers';
4
3
  export default class InstructionManagerV1 {
5
4
  static getInstructionFromStep(step: Step): string;
6
5
  static getInstructionFromPosition(itineraryInfoManager: ItineraryInfoManager, position: Coordinates): string | null;
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var e=Object.defineProperty,t=(t,o,r)=>(((t,o,r)=>{o in t?e(t,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[o]=r})(t,"symbol"!=typeof o?o+"":o,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./OsrmRemoteRouter-df92c42f.cjs"),r=require("@wemap/salesman.js"),i=require("@wemap/geo"),n=require("@wemap/osm"),s=require("@wemap/logger"),a=require("@mapbox/polyline"),l=require("@turf/boolean-point-in-polygon"),d=require("@turf/convex");require("@wemap/maths");var c,u,p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h={exports:{}};c=h,u=h.exports,function(e,t){var o="function",r="undefined",i="object",n="string",s="major",a="model",l="name",d="type",p="vendor",h="version",m="architecture",g="console",w="mobile",f="tablet",b="smarttv",v="wearable",y="embedded",R="Amazon",_="Apple",S="ASUS",T="BlackBerry",E="Browser",x="Chrome",N="Firefox",k="Google",A="Huawei",P="LG",M="Microsoft",I="Motorola",C="Opera",L="Samsung",U="Sharp",D="Sony",O="Xiaomi",W="Zebra",B="Facebook",F="Chromium OS",$="Mac OS",j=function(e){for(var t={},o=0;o<e.length;o++)t[e[o].toUpperCase()]=e[o];return t},G=function(e,t){return typeof e===n&&-1!==V(t).indexOf(V(e))},V=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===n)return e=e.replace(/^\s\s*/,""),typeof t===r?e:e.substring(0,350)},q=function(e,r){for(var n,s,a,l,d,c,u=0;u<r.length&&!d;){var p=r[u],h=r[u+1];for(n=s=0;n<p.length&&!d&&p[n];)if(d=p[n++].exec(e))for(a=0;a<h.length;a++)c=d[++s],typeof(l=h[a])===i&&l.length>0?2===l.length?typeof l[1]==o?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==o||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):t:this[l[0]]=c?l[1].call(this,c,l[2]):t:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):t):this[l]=c||t;u+=2}},z=function(e,o){for(var r in o)if(typeof o[r]===i&&o[r].length>0){for(var n=0;n<o[r].length;n++)if(G(o[r][n],e))return"?"===r?t:r}else if(G(o[r],e))return"?"===r?t:r;return e},H={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Q={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[h,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,h],[/opios[\/ ]+([\w\.]+)/i],[h,[l,C+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[l,C]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[l,"UC"+E]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[h,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+E],h],[/\bfocus\/([\w\.]+)/i],[h,[l,N+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[l,C+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[l,C+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[l,"MIUI "+E]],[/fxios\/([-\w\.]+)/i],[h,[l,N]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+E]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+E],h],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,B],h],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[h,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[l,x+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,x+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[l,"Android "+E]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[h,z,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[l,N+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[l,h],[/(cobalt)\/([\w\.]+)/i],[l,[h,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[m,"amd64"]],[/(ia32(?=;))/i],[[m,V]],[/((?:i[346]|x)86)[;\)]/i],[[m,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[m,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[m,"armhf"]],[/windows (ce|mobile); ppc;/i],[[m,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[m,/ower/,"",V]],[/(sun4\w)[;\)]/i],[[m,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[m,V]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[a,[p,L],[d,f]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[a,[p,L],[d,w]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[a,[p,_],[d,w]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[p,_],[d,f]],[/(macintosh);/i],[a,[p,_]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[a,[p,U],[d,w]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[a,[p,A],[d,f]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[a,[p,A],[d,w]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[a,/_/g," "],[p,O],[d,w]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[a,/_/g," "],[p,O],[d,f]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[a,[p,"OPPO"],[d,w]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[a,[p,"Vivo"],[d,w]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[a,[p,"Realme"],[d,w]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[a,[p,I],[d,w]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[a,[p,I],[d,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[a,[p,P],[d,f]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[a,[p,P],[d,w]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[a,[p,"Lenovo"],[d,f]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[a,/_/g," "],[p,"Nokia"],[d,w]],[/(pixel c)\b/i],[a,[p,k],[d,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[a,[p,k],[d,w]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[p,D],[d,w]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[a,"Xperia Tablet"],[p,D],[d,f]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[a,[p,"OnePlus"],[d,w]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[a,[p,R],[d,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[a,/(.+)/g,"Fire Phone $1"],[p,R],[d,w]],[/(playbook);[-\w\),; ]+(rim)/i],[a,p,[d,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[a,[p,T],[d,w]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[a,[p,S],[d,f]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[a,[p,S],[d,w]],[/(nexus 9)/i],[a,[p,"HTC"],[d,f]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[a,/_/g," "],[d,w]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[a,[p,"Acer"],[d,f]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[a,[p,"Meizu"],[d,w]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,a,[d,w]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,a,[d,f]],[/(surface duo)/i],[a,[p,M],[d,f]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[a,[p,"Fairphone"],[d,w]],[/(u304aa)/i],[a,[p,"AT&T"],[d,w]],[/\bsie-(\w*)/i],[a,[p,"Siemens"],[d,w]],[/\b(rct\w+) b/i],[a,[p,"RCA"],[d,f]],[/\b(venue[\d ]{2,7}) b/i],[a,[p,"Dell"],[d,f]],[/\b(q(?:mv|ta)\w+) b/i],[a,[p,"Verizon"],[d,f]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[a,[p,"Barnes & Noble"],[d,f]],[/\b(tm\d{3}\w+) b/i],[a,[p,"NuVision"],[d,f]],[/\b(k88) b/i],[a,[p,"ZTE"],[d,f]],[/\b(nx\d{3}j) b/i],[a,[p,"ZTE"],[d,w]],[/\b(gen\d{3}) b.+49h/i],[a,[p,"Swiss"],[d,w]],[/\b(zur\d{3}) b/i],[a,[p,"Swiss"],[d,f]],[/\b((zeki)?tb.*\b) b/i],[a,[p,"Zeki"],[d,f]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],a,[d,f]],[/\b(ns-?\w{0,9}) b/i],[a,[p,"Insignia"],[d,f]],[/\b((nxa|next)-?\w{0,9}) b/i],[a,[p,"NextBook"],[d,f]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],a,[d,w]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],a,[d,w]],[/\b(ph-1) /i],[a,[p,"Essential"],[d,w]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[a,[p,"Envizen"],[d,f]],[/\b(trio[-\w\. ]+) b/i],[a,[p,"MachSpeed"],[d,f]],[/\btu_(1491) b/i],[a,[p,"Rotor"],[d,f]],[/(shield[\w ]+) b/i],[a,[p,"Nvidia"],[d,f]],[/(sprint) (\w+)/i],[p,a,[d,w]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[p,M],[d,w]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[p,W],[d,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[p,W],[d,w]],[/smart-tv.+(samsung)/i],[p,[d,b]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[p,L],[d,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,P],[d,b]],[/(apple) ?tv/i],[p,[a,_+" TV"],[d,b]],[/crkey/i],[[a,x+"cast"],[p,k],[d,b]],[/droid.+aft(\w)( bui|\))/i],[a,[p,R],[d,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[a,[p,U],[d,b]],[/(bravia[\w ]+)( bui|\))/i],[a,[p,D],[d,b]],[/(mitv-\w{5}) bui/i],[a,[p,O],[d,b]],[/Hbbtv.*(technisat) (.*);/i],[p,a,[d,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,K],[a,K],[d,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,a,[d,g]],[/droid.+; (shield) bui/i],[a,[p,"Nvidia"],[d,g]],[/(playstation [345portablevi]+)/i],[a,[p,D],[d,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[a,[p,M],[d,g]],[/((pebble))app/i],[p,a,[d,v]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[a,[p,_],[d,v]],[/droid.+; (glass) \d/i],[a,[p,k],[d,v]],[/droid.+; (wt63?0{2,3})\)/i],[a,[p,W],[d,v]],[/(quest( 2| pro)?)/i],[a,[p,B],[d,v]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,y]],[/(aeobc)\b/i],[a,[p,R],[d,y]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[a,[d,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[a,[d,f]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,f]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,w]],[/(android[-\w\. ]{0,9});.+buil/i],[a,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[h,z,H]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[h,z,H]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,$],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,h],[/\(bb(10);/i],[h,[l,T]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[l,N+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[h,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[h,[l,x+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,F],h],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,h],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,h]]},J=function(c,u){if(typeof c===i&&(u=c,c=t),!(this instanceof J))return new J(c,u).getResult();var g=typeof e!==r&&e.navigator?e.navigator:t,b=c||(g&&g.userAgent?g.userAgent:""),v=g&&g.userAgentData?g.userAgentData:t,y=u?function(e,t){var o={};for(var r in e)t[r]&&t[r].length%2==0?o[r]=t[r].concat(e[r]):o[r]=e[r];return o}(Q,u):Q,R=g&&g.userAgent==b;return this.getBrowser=function(){var e,r={};return r[l]=t,r[h]=t,q.call(r,b,y.browser),r[s]=typeof(e=r[h])===n?e.replace(/[^\d\.]/g,"").split(".")[0]:t,R&&g&&g.brave&&typeof g.brave.isBrave==o&&(r[l]="Brave"),r},this.getCPU=function(){var e={};return e[m]=t,q.call(e,b,y.cpu),e},this.getDevice=function(){var e={};return e[p]=t,e[a]=t,e[d]=t,q.call(e,b,y.device),R&&!e[d]&&v&&v.mobile&&(e[d]=w),R&&"Macintosh"==e[a]&&g&&typeof g.standalone!==r&&g.maxTouchPoints&&g.maxTouchPoints>2&&(e[a]="iPad",e[d]=f),e},this.getEngine=function(){var e={};return e[l]=t,e[h]=t,q.call(e,b,y.engine),e},this.getOS=function(){var e={};return e[l]=t,e[h]=t,q.call(e,b,y.os),R&&!e[l]&&v&&"Unknown"!=v.platform&&(e[l]=v.platform.replace(/chrome os/i,F).replace(/macos/i,$)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return b},this.setUA=function(e){return b=typeof e===n&&e.length>350?K(e,350):e,this},this.setUA(b),this};J.VERSION="1.0.35",J.BROWSER=j([l,h,s]),J.CPU=j([m]),J.DEVICE=j([a,p,d,g,w,b,f,v,y]),J.ENGINE=J.OS=j([l,h]),c.exports&&(u=c.exports=J),u.UAParser=J;var X=typeof e!==r&&(e.jQuery||e.Zepto);if(X&&!X.ua){var Y=new J;X.ua=Y.getResult(),X.ua.get=function(){return Y.getUA()},X.ua.set=function(e){Y.setUA(e);var t=Y.getResult();for(var o in t)X.ua[o]=t[o]}}}("object"==typeof window?window:p);var m=Object.defineProperty,g=(e,t,o)=>(((e,t,o)=>{t in e?m(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o})(e,"symbol"!=typeof t?t+"":t,o),o);const w="Unknown",f="Safari",b="Firefox",v="Opera",y="Chrome",R="iOS-webview";class _{static getName(){if(!this._name)if("undefined"!=typeof navigator&&navigator){const{userAgent:e}=navigator;e.match(/Firefox/i)?this._name=b:e.match(/(Opera|OPR)/i)?this._name=v:e.match(/Chrome/i)?this._name=y:e.match(/Safari/i)?this._name=f:e.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Version)/i)?this._name=R:this._name=w}else this._name=w;return this._name}static get isMobile(){if(null===this._isMobile&&(this._isMobile=!1,"undefined"!=typeof navigator&&navigator)){const e=navigator.userAgent||navigator.vendor;e&&(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(this._isMobile=!0)}return this._isMobile}static clearCache(){this._name=null,this._isMobile=null}}g(_,"_name",null),g(_,"_isMobile",null);const S=[4215763,14529296,11869460,48895,16468400,45661,13290186];const T=Object.freeze(Object.defineProperty({__proto__:null,getQualitativeColor:function(e){return S[e%S.length]}},Symbol.toStringTag,{value:"Module"})),E=4,x=3,N={wheelchair:{horrible:.1,bad:.5,intermediate:.7,good:.9,excellent:1},default:{horrible:.4,bad:.7,intermediate:.8,good:.9,excellent:1}},k={wheelchair:{asphalt:1,concrete:1,paving_stones:.8,compacted:.7,wood:.6,metal:.5,gravel:.3,grass:.2,ground:.2},default:{asphalt:1,concrete:1,paving_stones:.9,compacted:.8,wood:.8,metal:.7,gravel:.6,grass:.5,ground:.4}},A=class e{constructor(){t(this,"avoidStairs",!1),t(this,"avoidEscalators",!1),t(this,"avoidElevators",!1),t(this,"avoidMovingWalkways",!1),t(this,"avoidTicketRestrictedAreas",!1),t(this,"useMultiLevelSegments",!1),t(this,"projectionMaxDistance"),t(this,"isWheelchair",!1)}setAvoidStairs(e){return this.avoidStairs=e,this}setAvoidEscalators(e){return this.avoidEscalators=e,this}setAvoidElevators(e){return this.avoidElevators=e,this}setAvoidMovingWalkways(e){return this.avoidMovingWalkways=e,this}setAvoidTicketRestrictedAreas(e){return this.avoidTicketRestrictedAreas=e,this}setUseMultiLevelSegments(e){return this.useMultiLevelSegments=e,this}setIsWheelchair(e){return this.isWheelchair=e,this}static fromJson(t){const o=new e;return Object.assign(o,t),o.build()}build(){return{input:{avoidStairs:this.avoidStairs,avoidEscalators:this.avoidEscalators,avoidElevators:this.avoidElevators,avoidMovingWalkways:this.avoidMovingWalkways,avoidTicketRestrictedAreas:this.avoidTicketRestrictedAreas,isWheelchair:this.isWheelchair,projectionMaxDistance:this.projectionMaxDistance},weightEdgeFn:e=>{if(e.properties.isElevator)return 90;const t=this.isWheelchair?x:E;let r=o.getDurationFromLength(e.length,t);if(e.properties.areStairs)r*=3;else if(e.properties.areEscalators)r*=1.5;else if(e.properties.isMovingWalkway)r*=.8;else if(e.properties.smoothness){const t=this.isWheelchair?"wheelchair":"default";r*=N[t][e.properties.smoothness]??1}else if(e.properties.surface){const t=this.isWheelchair?"wheelchair":"default";r*=k[t][e.properties.surface]??1}return r},acceptEdgeFn:e=>{if(e.properties.wheelchair){if(this.isWheelchair&&"no"===e.properties.wheelchair)return!1;if(!this.isWheelchair&&"designated"===e.properties.wheelchair)return!1}if(this.isWheelchair){if(e.properties.areStairs)return!1;if(e.properties.areEscalators)return!1;if(e.properties.isMovingWalkway)return!1}return(!this.avoidStairs||!e.properties.areStairs)&&((!this.avoidEscalators||!e.properties.areEscalators)&&((!this.avoidElevators||!e.properties.isElevator)&&((!this.avoidMovingWalkways||!e.properties.isMovingWalkway)&&(!this.avoidTicketRestrictedAreas||!e.properties.needTicket))))},projectionMaxDistance:this.projectionMaxDistance,useMultiLevelSegments:this.useMultiLevelSegments}}};t(A,"DEFAULT",(new A).build()),t(A,"WITHOUT_STAIRS",(new A).setAvoidStairs(!0).build()),t(A,"WHEELCHAIR",(new A).setIsWheelchair(!0).build());let P=A;class M{constructor(e,t,o,r,i){this.prev=e,this.dist=t,this.source=o,this.targets=r,this.edges=i}routeVertices(e=this.targets[0],t=[]){const o=this.prev[e.id];return null===o?this.source===e?[...t,e]:[]:[...this.routeVertices(o,t),e]}weightedDistance(e=this.targets[0]){const t=this.dist[e.id];return t===Number.MAX_VALUE?null:t}route(e=this.targets[0]){const t=this.routeVertices(e),r=[],i=[];for(let n=1;n<t.length;n++){const e=t[n-1],s=t[n],a=o.Edge.getEdgeByVertices(this.edges,e,s),l=new o.Edge(e,s,Object.assign({},a.properties));a.vertex1===l.vertex2&&l.reverseProperties(),r.push(l),i.push(this.dist[s.id]-this.dist[e.id])}return new o.GraphRoute(this.source.coords,e.coords,t,r,i)}toGeoJson(e){return{type:"FeatureCollection",features:[...e.vertices.map((e=>{const t=this.prev[e.id],o=this.dist[e.id],r=e===this.source,i=this.targets.includes(e),n=e.coords.level;return{type:"Feature",properties:{id:e.id,...t&&{prev:t.id},dist:o===Number.MAX_VALUE?"infinity":o,...r&&{name:"source"},...i&&{name:"target"},...null!==n&&{level:n},...e.properties},geometry:{type:"Point",coordinates:[e.coords.lng,e.coords.lat]}}})),...e.edges.map((e=>{const t=e.level;return{type:"Feature",properties:{id:e.id,...null!==t&&{level:t},...e.properties},geometry:{type:"LineString",coordinates:[[e.vertex1.coords.lng,e.vertex1.coords.lat],[e.vertex2.coords.lng,e.vertex2.coords.lat]]}}}))]}}}class I{constructor(e){t(this,"disabledEdges",new Set),this.graph=e;let o=0;e.vertices.forEach((e=>e.id=o++))}calculateShortestPathToMultipleDestinationsByVertex(e,t,o=P.DEFAULT,r=this.graph.vertices,i=this.graph.edges){const n=new Set(r),s=Array(n.size).fill(Number.MAX_VALUE),a=new Array(n.size).fill(null),l=i.filter((e=>{var t;return((null==(t=o.acceptEdgeFn)?void 0:t.call(o,e))??!0)&&!this.disabledEdges.has(e)})),d=o.weightEdgeFn||(e=>e.length),c=e=>{let t=Number.MAX_VALUE,o=null;return e.forEach((e=>{const r=s[e.id];r<=t&&(t=r,o=e)})),o},u=new Set(t);for(s[e.id]=0;n.size>0;){const e=c(n);if(n.delete(e),t.includes(e)&&(u.delete(e),0===u.size))break;l.filter((t=>t.vertex1==e||!t.properties.isOneway&&t.vertex2==e)).forEach((t=>{const o=e===t.vertex1?t.vertex2:t.vertex1,r=d(t),i=s[e.id]+r;i<s[o.id]&&(s[o.id]=i,a[o.id]=e)}))}return new M(a,s,e,t,l)}calculateShortestPathByVertex(e,t,o=P.DEFAULT,r=this.graph.vertices,i=this.graph.edges){return this.calculateShortestPathToMultipleDestinationsByVertex(e,[t],o,r,i)}calculateComponents(){function e(e){const t=e.values().next().value;return e.delete(t),t}const t=new Set(this.graph.vertices);let o,r=[];for(;t.size>0;){const o=e(t),i=this.graph.vertices.filter((e=>e.id!==o.id)),n=this.calculateShortestPathToMultipleDestinationsByVertex(o,i),s=i.filter((e=>null!==n.weightedDistance(e)));r.push([o,...s]),s.forEach((e=>t.delete(e)))}do{o=!1;for(let e=0;e<r.length-1;e++){const t=r[e];for(let i=e+1;i<r.length;i++){const e=r[i];e.some((e=>t.includes(e)))&&(t.push(...e),r=r.filter((t=>t!==e)),o=!0)}}}while(o);return r.map((e=>[...new Set(e)]))}toGeoJson(){return{type:"FeatureCollection",features:this.calculateComponents().map(((e,t)=>({type:"Feature",geometry:{type:"MultiLineString",coordinates:this.graph.edges.filter((t=>e.includes(t.vertex1)&&e.includes(t.vertex2))).map((e=>[[e.vertex1.coords.lng,e.vertex1.coords.lat],[e.vertex2.coords.lng,e.vertex2.coords.lat]]))},properties:{stroke:"#"+T.getQualitativeColor(t).toString(16)}})))}}}class C extends M{constructor(e,t,o){super(e.prev,e.dist,e.source,e.targets,e.edges),this.sourceProjection=t,this.targetsProjections=o}static createEmpty(e,t){const r=t.length,i=new M(new Array(r).fill(null),new Array(r).fill(Number.MAX_VALUE),new o.Vertex(e),t.map((e=>new o.Vertex(e))),[]),n=[e,null],s=t.map((e=>[e,null]));return new C(i,n,s)}routeVertices(e=this.targetsProjections[0][0]){var t;if(e instanceof o.Vertex)return super.routeVertices(e);if(!this.sourceProjection[1])return[];const r=null==(t=this.targetsProjections.find((([t])=>t===e)))?void 0:t[1];return r?super.routeVertices(r):[]}weightedDistance(e=this.targetsProjections[0][0]){var t;if(e instanceof o.Vertex)return super.weightedDistance(e);if(!this.sourceProjection[1])return null;const r=null==(t=this.targetsProjections.find((([t])=>t===e)))?void 0:t[1];return r?super.weightedDistance(r):null}route(e=this.targetsProjections[0][0]){var t;if(e instanceof o.Vertex)return super.route(e);const r=null==(t=this.targetsProjections.find((([t])=>t===e)))?void 0:t[1];if(!r)return new o.GraphRoute(this.sourceProjection[0],e,[],[],[]);const i=super.route(r);return i.start=this.sourceProjection[0],i.end=e,i}}class L extends I{calculateShortestPathToMultipleDestinations(e,t,r=P.DEFAULT){const i=new Set,n=new Set,s=[],a={maxDistance:r.projectionMaxDistance,acceptEdgeFn:r.acceptEdgeFn,useMultiLevelSegments:r.useMultiLevelSegments},l=e=>{const t=this.graph.getProjection(e,a);if(null===t)return null;if(t.nearestElement instanceof o.Vertex)return t.nearestElement;if(t.nearestElement instanceof o.Edge){const e=t.nearestElement,r=new o.Vertex(t.coords,{name:`proj on ${e.properties.name||null} (tmp)`,...void 0!==e.properties.externalId&&{externalId:e.properties.externalId}});r.id=this.graph.vertices.length+i.size;const a={...e.properties,...void 0!==e.properties.externalId&&{externalId:e.properties.externalId}},l=new o.Edge(e.vertex1,r,a),d=new o.Edge(r,e.vertex2,a);i.add(r),n.add(l),n.add(d);const c=s.find((t=>t[0]===e));return c?c[1].push(r):s.push([e,[r]]),r}return null},d=l(e);if(!d)return C.createEmpty(e,t);const c=t.map((e=>[e,l(e)])),u=c.map((([,e])=>e)).filter((e=>null!==e));s.filter((e=>e[1].length>=2)),s.forEach((([e,t])=>{const r={...e.properties,name:`splitted ${e.properties.name||null} (tmp)`};for(let i=0;i<t.length;i++){const s=t[i],a=s.distanceTo(e.vertex1);for(let l=i+1;l<t.length;l++){const i=t[l],d=i.distanceTo(e.vertex1)<a?new o.Edge(i,s,r):new o.Edge(s,i,r);n.add(d)}}}));const p=this.calculateShortestPathToMultipleDestinationsByVertex(d,u,r,[...this.graph.vertices,...i],[...this.graph.edges,...n]);return new C(p,[e,d],c)}calculateShortestPath(e,t,o=P.DEFAULT){return this.calculateShortestPathToMultipleDestinations(e,[t],o)}getShortestTrip(e,t,o=.99){const i=e.map((e=>{const t=new r.Point(0,0);return t.coords=e,t})),n=[],s=r.solve(i,o,void 0,((e,o)=>{const r=this.calculateShortestPath(e.coords,o.coords,t).route();return n.push(r),r.hasRoute?r.edgesWeights.reduce(((e,t)=>e+t),0):Number.MAX_VALUE})).map((e=>i[e])),a=[];for(let r=0;r<s.length;r++){const e=s[r],t=s[(r+1)%s.length];let o=n.find((o=>o.start===e.coords&&o.end===t.coords||o.end===e.coords&&o.start===t.coords));(null==o?void 0:o.end)===e.coords&&(o=o.reverse()),o&&a.push(o)}return a.some((e=>!e.hasRoute))?[]:a}}class U extends Error{constructor(e,t,o=null){super(),this.start=e,this.end=t,this.details=o}get startStr(){return this.start instanceof o.Vertex?`Vertex ${this.start.coords.toString()}`:this.start.toString()}get endStr(){return this.end instanceof o.Vertex?`Vertex ${this.end.coords.toString()}`:Array.isArray(this.end)?this.end.map((e=>e instanceof o.Vertex?e.coords.toString():e.toString())).join(","):this.end.toString()}get message(){let e=`No route found from ${this.startStr} to ${this.endStr}.`;return this.details&&(e+=` Details: ${this.details}`),e}}const D=class e{static parseNodeProperties(e){return{...e.name&&{name:e.name},...e.id&&{externalId:e.id},...e.isGate&&{isGate:e.isGate},...e.isSubwayEntrance&&{isSubwayEntrance:e.isSubwayEntrance},...e.subwayEntranceRef&&{subwayEntrsanceRef:e.subwayEntranceRef}}}static parseWayProperties(e){return{...e.name&&{name:e.name},...e.id&&{externalId:e.id},...e.isOneway&&{isOneway:e.isOneway},...e.areStairs&&{areStairs:e.areStairs},...e.isElevator&&{isElevator:e.isElevator},...e.areEscalators&&{areEscalators:e.areEscalators},...e.isMovingWalkway&&{isMovingWalkway:e.isMovingWalkway},...e.needTicket&&{needTicket:e.needTicket},...e.incline&&{incline:e.incline},...e.wheelchair&&{wheelchair:e.wheelchair},...e.smoothness&&{smoothness:e.smoothness},...e.surface&&{surface:e.surface}}}static createGraphFromOsmModel(t,r=e.DEFAULT_WAY_SELECTOR,s){const a=[],l=[],d=[],c=(e,t)=>{var r;let n=(null==(r=l.find((([o,r])=>o===e.id&&(!!i.Level.intersect(r.coords.level,t)||(null===r.coords.level||null===t)))))?void 0:r[1])||null;if(n)return i.Level.equals(n.coords.level,t)||(n.coords.level=i.Level.intersection(n.coords.level,t),null===n.coords.level&&(n.coords.level=t)),n;const s=new i.Coordinates(e.coords.lat,e.coords.lng,null,t);if(n=new o.Vertex(s,this.parseNodeProperties(e)),l.push([e.id,n]),e.isElevator){let t=d.find((([t])=>e.id===t));t||(t=[e.id,e.name,[]],d.push(t)),t[2].push(n)}return n};t.ways.forEach((e=>{if(!r(e))return;const t=this.parseWayProperties(e),n=r=>{for(let i=1;i<e.nodes.length;i++){let n=c(e.nodes[i-1],r),s=c(e.nodes[i],r);if(e.isOnewayBackward){const e=s;s=n,n=e}const l=new o.Edge(n,s,t);a.push(l)}};n(e.level),"repeat_on"in e.tags&&e.tags.repeat_on.split(";").map(i.Level.fromString).forEach(n)}));let u=-1;return t.ways.filter((e=>e.isElevator&&e.isGeometryClosed)).forEach((e=>{const t=e.nodes.map((e=>l.filter((([t])=>t===e.id)).map((e=>e[1])))).flat(),r=e.nodes.reduce(((e,t)=>[e[0]+t.coords.lat,e[1]+t.coords.lng]),[0,0]).map((t=>t/e.nodes.length)),s=t.reduce(((e,t)=>i.Level.union(e,t.coords.level)),null),d=new i.Coordinates(r[0],r[1],null,s),p=new n.OsmNode(u--,d,{highway:"elevator"});t.forEach((t=>{const r=c(p,t.coords.level);a.push(new o.Edge(r,t,{externalId:e.id}))}))})),d.forEach((([e,t,r])=>{const i={name:t,isElevator:!0,externalId:e};for(let n=0;n<r.length;n++)for(let e=n+1;e<r.length;e++)a.push(new o.Edge(r[n],r[e],i));if(1===r.length&&null===r[0].coords.level){const e=r[0],t=a.filter((t=>t.vertex1===e||t.vertex2===e));if(t.length>1){const r=[e];for(let i=1;i<t.length;i++){const n=new o.Vertex(e.coords,e.properties);l.push([e.id,n]),t[i].vertex1===e?t[i].vertex1=n:t[i].vertex2=n,r.push(n)}for(let e=0;e<r.length;e++)for(let t=e+1;t<r.length;t++)a.push(new o.Edge(r[e],r[t],i))}}})),null==s||s(l),new o.Graph(l.map((e=>e[1])),a)}};t(D,"RESTRICTED_PEDESTRIANS_HIGHWAYS",["motorway","motorway_link"]),t(D,"DEFAULT_WAY_SELECTOR",(e=>{if(e.isArea)return!1;if("yes"===e.tags.foot)return!0;if(["no","private"].includes(e.tags.access))return!1;const t="elevator"===e.tags.highway&&e.isGeometryClosed;return e.tags.highway&&!D.RESTRICTED_PEDESTRIANS_HIGHWAYS.includes(e.tags.highway)&&!t||"sidewalk"===e.tags.footway||"platform"===e.tags.public_transport||"platform"===e.tags.railway}));let O=D;function W(e,t,o,r,i,n,s="Europe/Paris"){const a=new Date(Date.UTC(e,t,o,r,i,n)),l=new Date(a.toLocaleString("en-US",{timeZone:"UTC"})),d=new Date(a.toLocaleString("en-US",{timeZone:s})),c=l.getTime()-d.getTime();return a.setTime(a.getTime()+c),a}function B(e){return new i.Coordinates(e.Lat,e.Long)}function F(e){const[t,o]=e.split(" "),[r,i,n]=t.split("/"),[s,a,l]=o.split(":");return W(Number(n),Number(i)-1,Number(r),Number(s),Number(a),Number(l)).getTime()}const $=new Map;$.set("CAR","Car"),$.set("WALK","Walk"),$.set("BIKE","Bike"),$.set("TRANSIT","PT");const j=new Map;j.set("WALK","WALK"),j.set("BICYCLE","BIKE"),j.set("TRAMWAY","TRAM"),j.set("METRO","METRO"),j.set("FUNICULAR","FUNICULAR"),j.set("BUS","BUS"),j.set("COACH","BUS"),j.set("SCHOOL","BUS"),j.set("BUS_PMR","BUS"),j.set("MINIBUS","BUS"),j.set("TROLLEY_BUS","BUS"),j.set("TAXIBUS","BUS"),j.set("SHUTTLE","BUS"),j.set("TRAIN","TRAIN"),j.set("HST","TRAIN"),j.set("LOCAL_TRAIN","TRAIN"),j.set("AIR","AIRPLANE"),j.set("FERRY","BOAT"),j.set("TAXI","UNKNOWN"),j.set("CAR_POOL","UNKNOWN"),j.set("PRIVATE_VEHICLE","CAR"),j.set("SCOOTER","MOTO");const G=new Map;function V(e){const t=e.match(/LINESTRING ?\((.*)\)/i),o=e.match(/POINT ?\((.*)\)/i);if(o){const[e,t]=o[1].split(" ");return[new i.Coordinates(Number(t),Number(e))]}return t[1].split(",").map((e=>{const t=e.trim().split(" ");return new i.Coordinates(Number(t[1]),Number(t[0]))}))}G.set(0,"BUS"),G.set(1,"WALK"),G.set(2,"BIKE"),G.set(3,"CAR"),G.set(4,"UNKNOWN"),G.set(5,"UNKNOWN"),G.set(6,"UNKNOWN"),G.set(7,"UNKNOWN"),G.set(8,"UNKNOWN"),G.set(9,"UNKNOWN"),G.set(10,"UNKNOWN"),G.set(11,"UNKNOWN"),G.set(12,"UNKNOWN"),G.set(13,"UNKNOWN"),G.set(14,"UNKNOWN");class K extends o.RemoteRouter{get rname(){return"cityway"}async getItineraries(e,t){const r=this.getURL(e,t),i=await fetch(r).catch((()=>{throw o.RemoteRoutingError.unreachableServer(this.rname,r)})),n=await i.json().catch((()=>{throw o.RemoteRoutingError.responseNotParsing(this.rname,r)}));return this.parseResponse(n)}getURL(e,t){const{origin:r,destination:i,travelMode:n,waypoints:a}=t,l=$.get(n);if(!l)throw o.RemoteRoutingError.travelModeUnimplemented(this.rname,n);(a||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==a?void 0:a.length})`);const d=`DepartureLatitude=${r.latitude}&DepartureLongitude=${r.longitude}`,c=`ArrivalLatitude=${i.latitude}&ArrivalLongitude=${i.longitude}`,u=`TripModes=${l}`,p=new URL(e);let{search:h}=p;return h=(h?`${h}&`:"?")+`${d}&${c}&${u}`,`${p.origin}${p.pathname}${h}`}parseResponse(e){if(200!==e.StatusCode||!e.Data||!e.Data.length)throw o.RemoteRoutingError.notFound(this.rname,e.Message);const t=[],r=e.Data.map((e=>e.response.trips.Trip.map((t=>({...t,...e.hasOwnProperty("PlanTripType")&&{PlanTripType:e.PlanTripType}}))))).flat();e:for(const i of r){if(i.hasOwnProperty("PlanTripType")&&"UNKNOWN"===G.get(i.PlanTripType))continue;const e=[];for(const t of i.sections.Section){const r=t.Leg?t.Leg:t.PTRide,n=j.get(r.TransportMode),a=[];let l,d,c;const u=new o.StepsBuilder;if("UNKNOWN"===n)continue e;if("WALK"===n||"BIKE"===n||"CAR"===n){l={name:r.Departure.Site.Name,coords:B(r.Departure.Site.Position)},d={name:r.Arrival.Site.Name,coords:B(r.Arrival.Site.Position)};for(const e of r.pathLinks.PathLink){let t;t=e.Geometry&&"Null"!==e.Geometry?V(e.Geometry):[l.coords,d.coords],t.forEach(((e,t)=>{0===t&&0!==a.length&&a[a.length-1].equals(e)||a.push(e)})),u.addStepInfo({coords:t[0],distance:e.Distance,name:e.Departure.Site.Name})}t===i.sections.Section[i.sections.Section.length-1]&&u.addStepInfo({coords:a[a.length-1]})}else{if(!o.isTransitModePublicTransport(n)){s.warn(`[CitywayParser] Unknown leg mode: ${r.TransportMode}`);continue}{l={name:r.Departure.StopPlace.Name,coords:B(r.Departure.StopPlace.Position)},d={name:r.Arrival.StopPlace.Name,coords:B(r.Arrival.StopPlace.Position)};let e=r.Line.Number;"TRAM"===n&&e.toLowerCase().includes("tram")&&(e=e.substr(5)),c={name:e,routeColor:r.Line.Color,routeTextColor:r.Line.TextColor,directionName:r.Destination};for(const t of r.steps.Step){V(t.Geometry).forEach(((e,t)=>{0===t&&0!==a.length&&a[a.length-1].equals(e)||a.push(e)}))}u.addStepInfo({coords:a[0],name:r.Line.Name,distance:r.Distance})}}u.setStart(l.coords),u.setEnd(d.coords),u.setPathCoords(a);const p=new o.Leg({transitMode:n,duration:this.parseDuration(r.Duration),startTime:F(r.Departure.Time),endTime:F(r.Arrival.Time),coords:a,start:l,end:d,transportInfo:c,steps:u.build()});e.push(p)}const r=new o.Itinerary({duration:this.parseDuration(i.Duration),startTime:F(i.Departure.Time),origin:B(i.Departure.Site.Position),endTime:F(i.Arrival.Time),destination:B(i.Arrival.Site.Position),legs:e});t.push(r)}return t}parseDuration(e){const t=e.match(/(-)?P(?:([.,\d]+)Y)?(?:([.,\d]+)M)?(?:([.,\d]+)W)?(?:([.,\d]+)D)?T(?:([.,\d]+)H)?(?:([.,\d]+)M)?(?:([.,\d]+)S)?/),o=void 0===t[2]?0:Number(t[2]),r=void 0===t[3]?0:Number(t[3]),i=void 0===t[4]?0:Number(t[4]),n=void 0===t[5]?0:Number(t[5]),s=void 0===t[6]?0:Number(t[6]),a=void 0===t[7]?0:Number(t[7]);return(void 0===t[8]?0:Number(t[8]))+60*a+3600*s+86400*n+604800*i+2592e3*r+31557600*o}}const q=new K,z=new Map;z.set("Air","AIRPLANE"),z.set("Boat","BOAT"),z.set("Bus","BUS"),z.set("BusRapidTransit","BUS"),z.set("Coach","BUS"),z.set("Ferry","FERRY"),z.set("Funicular","FUNICULAR"),z.set("LocalTrain","TRAIN"),z.set("LongDistanceTrain","TRAIN"),z.set("Metro","METRO"),z.set("Métro","METRO"),z.set("RailShuttle","TRAIN"),z.set("RapidTransit","BUS"),z.set("Shuttle","BUS"),z.set("SuspendedCableCar","FUNICULAR"),z.set("Taxi","TAXI"),z.set("Train","TRAIN"),z.set("RER","TRAIN"),z.set("Tramway","TRAM"),z.set("walking","WALK"),z.set("bike","BIKE");const H=["physical_mode:Air","physical_mode:Boat","physical_mode:Bus","physical_mode:BusRapidTransit","physical_mode:Coach","physical_mode:Ferry","physical_mode:Funicular","physical_mode:LocalTrain","physical_mode:LongDistanceTrain","physical_mode:Metro","physical_mode:RailShuttle","physical_mode:RapidTransit","physical_mode:Shuttle","physical_mode:SuspendedCableCar","physical_mode:Taxi","physical_mode:Train","physical_mode:Tramway"];function Q(e){return new i.Coordinates(Number(e.lat),Number(e.lon))}function J(e){return e[e.length-1]}function X(e,t){const o=e.substr(0,4),r=e.substr(4,2),i=e.substr(6,2),n=e.substr(9,2),s=e.substr(11,2),a=e.substr(13,2);return W(Number(o),Number(r)-1,Number(i),Number(n),Number(s),Number(a),t).getTime()}class Y extends o.RemoteRouter{get rname(){return"navitia"}async getItineraries(e,t){const r=this.getURL(e,t),i=r.searchParams.get("api_key");if(!i)throw o.RemoteRoutingError.missingApiKey(this.rname);const n=await fetch(r,{method:"GET",headers:{Authorization:i}}).catch((()=>{throw o.RemoteRoutingError.unreachableServer(this.rname,r.toString())})),s=await n.json().catch((()=>{throw o.RemoteRoutingError.responseNotParsing(this.rname,r.toString())}));if(s&&s.error)throw o.RemoteRoutingError.notFound(this.rname,s.error.message);const a=this.parseResponse(s);if(!a.some((e=>o.areTransitAndTravelModeConsistent(e.transitMode,t.travelMode))))throw o.RemoteRoutingError.notFound(this.rname,"Selected mode of transport was not found for this itinerary.");return a}getURL(e,t){var o;const{origin:r,destination:i,waypoints:n,travelMode:a}=t;(n||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==n?void 0:n.length})`);const l=new URL(e),d=new URLSearchParams;d.set("from",`${r.longitude};${r.latitude}`),d.set("to",`${i.longitude};${i.latitude}`),d.set("data_freshness","realtime"),(null==(o=t.itineraryModifiers)?void 0:o.isWheelchair)&&d.set("wheelchair","true");let c=new URLSearchParams;switch(a){case"WALK":c=this.getWalkingQuery();break;case"BIKE":c=this.getBikeQuery();break;case"CAR":c=this.getCarQuery()}return[d,c].map((e=>{for(const t of e.entries())l.searchParams.append(t[0],t[1])})),l}getCarQuery(){const e=new URLSearchParams;return H.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("first_section_mode[]","car"),e.append("last_section_mode[]","walking"),e.append("last_section_mode[]","car"),e}getWalkingQuery(){const e=new URLSearchParams;return H.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("last_section_mode[]","walking"),e}getBikeQuery(){const e=new URLSearchParams;return H.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","bike"),e.append("last_section_mode[]","bike"),e}getSectionCoords(e){let t,o;return t="stop_point"in e.from?e.from.stop_point.coord:"address"in e.from?e.from.address.coord:e.from.poi.coord,o="stop_point"in e.to?e.to.stop_point.coord:"address"in e.to?e.to.address.coord:e.to.poi.coord,{from:Q(t),to:Q(o)}}findStepsCoord(e,t){const o=e,r=[...o];let n=t[0],s=0;const a=[];for(const[l,d]of t.entries()){let e,c;if(0===l)c=0,e=o[0];else if(l===t.length-1)c=o.length-1,e=J(o);else if(1===r.length)s++,c=s,e=r[0],o[c]=e;else{const t=i.Utils.trimRoute(r,r[0],n.distance);s+=t.length-1,r.splice(0,t.length-1),c=s,e=J(t),o[c]=e}a.push({...d,coords:e}),n=d}return a}findStepCoords(e,t){var o;if("instruction_start_coordinate"in e)return Q(e.instruction_start_coordinate);const r=null==(o=t.vias)?void 0:o.find((t=>t.id===e.via_uri));return r?Q(r.access_point.coord):void 0}parseResponse(e){var t;if(!e||!e.journeys)throw o.RemoteRoutingError.notFound(this.rname,null==(t=e.error)?void 0:t.message);const r=[],n=e.context.timezone;for(const s of e.journeys){const e=[];for(const r of s.sections){if("waiting"===r.type||"transfer"===r.type)continue;const{from:t,to:s}=this.getSectionCoords(r);let a=[];const l=r.geojson.coordinates.reduce(((e,[t,o])=>(a.includes(`${t}-${o}`)||(a=a.concat(`${t}-${o}`),e.push(new i.Coordinates(o,t))),e)),[]),d=(new o.StepsBuilder).setStart(t).setEnd(s).setPathCoords(l);let c,u=z.get(r.mode);if(r.path){const e=r.path.every((e=>"instruction_start_coordinate"in e||e.via_uri)),t=[];for(const o of r.path){let i;if(e){i=this.findStepCoords(o,r);const e={name:o.name,distance:o.length,coords:i};d.addStepInfo(e)}else t.push({name:o.name,distance:o.length})}e||d.setStepsInfo(this.findStepsCoord(l,t))}if("public_transport"===r.type){c={name:r.display_informations.code,routeColor:r.display_informations.color,routeTextColor:r.display_informations.text_color,directionName:r.display_informations.direction},u=z.get(r.display_informations.physical_mode);const e={coords:l[0],name:c.directionName,distance:r.geojson.properties[0].length};d.setStepsInfo([e])}const p=new o.Leg({transitMode:u,duration:r.duration,startTime:X(r.departure_date_time,n),endTime:X(r.arrival_date_time,n),start:{name:r.from.name,coords:t},end:{name:r.to.name,coords:s},coords:l,transportInfo:c,steps:d.build()});e.push(p)}const t=new o.Itinerary({duration:s.duration,startTime:X(s.departure_date_time,n),endTime:X(s.arrival_date_time,n),origin:this.getSectionCoords(s.sections[0]).from,destination:this.getSectionCoords(J(s.sections)).to,legs:e});r.push(t)}return r}}const Z=new Y;class ee extends o.RemoteRouter{get rname(){return"deutsche-bahn"}async getItineraries(e,t){const r=this.getURL(e,t),i=await fetch(r).catch((()=>{throw o.RemoteRoutingError.unreachableServer(this.rname,r)})),n=await i.json().catch((()=>{throw o.RemoteRoutingError.responseNotParsing(this.rname,r)}));return this.parseResponse(n,t.origin,t.destination)}getURL(e,t){let o=e+"/route/v1/walking/";return o+=[t.origin,...t.waypoints||[],t.destination].map((e=>{if(null!==e.level){const t=i.Level.isRange(e.level)?e.level[0]:e.level;return e.longitude+","+e.latitude+","+t}return e.longitude+","+e.latitude})).join(";"),o+="?geometries=geojson&overview=full&steps=true",o}parseResponse(e,t,r){if(!e.segments)throw o.RemoteRoutingError.notFound(this.rname);const n=e.segments.map((e=>{const t=i.Level.union(e.fromLevel,e.toLevel),r=e.polyline.map((({lon:e,lat:o})=>new i.Coordinates(o,e,null,t)));return new o.Leg({transitMode:"WALK",coords:r,start:{coords:r[0]},end:{coords:r[r.length-1]}})}));return[new o.Itinerary({origin:t,destination:r,legs:n})]}}const te=new ee;function oe(e){const t=e[0];return e.slice(1).map((e=>{const o={};return t.forEach(((t,r)=>{o[t]=e[r]})),o}))}const re=new Map;re.set("BIKE","BIKE"),re.set("PEDESTRIAN","WALK");function ie(e){return new i.Coordinates(e.latitude,e.longitude)}function ne(e){return e[e.length-1]}class se extends o.RemoteRouter{get rname(){return"geovelo"}async getItineraries(e,t){const r=this.getQueryParams(),i=this.getBodyParams(t),n=new URL(e);for(const[o,l]of Object.entries(r))n.searchParams.append(o,l.toString());const s=await fetch(n,{method:"POST",headers:{apiKey:"qWHj6ax6DMttG8DX6tH9CQARaiTgQ1Di","Content-Type":"application/json"},body:JSON.stringify(i)}).catch((()=>{throw o.RemoteRoutingError.unreachableServer(this.rname,n.toString())})),a=await s.json().catch((()=>{throw o.RemoteRoutingError.responseNotParsing(this.rname,n.toString())}));if(!a||0===a.length)throw o.RemoteRoutingError.notFound(this.rname,"No itineraries found.");return this.parseResponse(a)}getQueryParams(){return{instructions:!0,elevations:!1,geometry:!0,single_result:!1,bike_stations:!1,objects_as_ids:!1,merge_instructions:!0,show_pushing_bike_instructions:!1}}getBodyParams(e){const{origin:t,destination:o,waypoints:r}=e;let i=[];return i=r&&r.length>1?r.map((e=>({longitude:e.longitude,latitude:e.latitude}))):[{latitude:t.latitude,longitude:t.longitude},{latitude:o.latitude,longitude:o.longitude}],{transportModes:["BIKE"],waypoints:i}}parseResponse(e){if(!e||!e.length)throw o.RemoteRoutingError.notFound(this.rname);const t=[];for(const r of e){const e=[];for(const t of r.sections){const r=ie(t.waypoints[0]),n=ie(ne(t.waypoints)),s=a.toGeoJSON(t.geometry,6);let l=[];const d=s.coordinates.reduce(((e,[t,o])=>(l.includes(`${t}-${o}`)||(l=l.concat(`${t}-${o}`),e.push(new i.Coordinates(o,t))),e)),[]),c=(new o.StepsBuilder).setStart(r).setEnd(n).setPathCoords(d),u=re.get(t.transportMode),p=oe(t.details.instructions);for(const e of p){const{geometryIndex:t,roadLength:o,roadName:r}=e,n=s.coordinates[t],a={name:r,distance:o,coords:new i.Coordinates(n[1],n[0])};c.addStepInfo(a)}const h=new o.Leg({transitMode:u,duration:t.duration,startTime:new Date(t.estimatedDatetimeOfDeparture).getTime(),endTime:new Date(t.estimatedDatetimeOfArrival).getTime(),start:{coords:r},end:{coords:n},coords:d,steps:c.build()});e.push(h)}const n=new o.Itinerary({duration:r.duration,startTime:new Date(r.estimatedDatetimeOfDeparture).getTime(),endTime:new Date(r.estimatedDatetimeOfArrival).getTime(),origin:ie(r.waypoints[0]),destination:ie(ne(r.waypoints)),legs:e});t.push(n)}return t}}const ae=new se,le=new Map;le.set("Air","AIRPLANE"),le.set("Boat","BOAT"),le.set("Bus","BUS"),le.set("BusRapidTransit","BUS"),le.set("Coach","BUS"),le.set("Ferry","FERRY"),le.set("Funicular","FUNICULAR"),le.set("LocalTrain","TRAIN"),le.set("LongDistanceTrain","TRAIN"),le.set("Metro","METRO"),le.set("Métro","METRO"),le.set("RailShuttle","TRAIN"),le.set("RapidTransit","BUS"),le.set("Shuttle","BUS"),le.set("SuspendedCableCar","FUNICULAR"),le.set("Taxi","TAXI"),le.set("Train","TRAIN"),le.set("RER","TRAIN"),le.set("Tramway","TRAM"),le.set("walking","WALK"),le.set("bike","BIKE");const de=["physical_mode:Air","physical_mode:Boat","physical_mode:Bus","physical_mode:BusRapidTransit","physical_mode:Coach","physical_mode:Ferry","physical_mode:Funicular","physical_mode:LocalTrain","physical_mode:LongDistanceTrain","physical_mode:Metro","physical_mode:RailShuttle","physical_mode:RapidTransit","physical_mode:Shuttle","physical_mode:SuspendedCableCar","physical_mode:Taxi","physical_mode:Train","physical_mode:Tramway"];function ce(e){return new i.Coordinates(Number(e.lat),Number(e.lon))}function ue(e){return e[e.length-1]}function pe(e,t){const o=e.substr(0,4),r=e.substr(4,2),i=e.substr(6,2),n=e.substr(9,2),s=e.substr(11,2),a=e.substr(13,2);return W(Number(o),Number(r)-1,Number(i),Number(n),Number(s),Number(a),t).getTime()}class he extends o.RemoteRouter{get rname(){return"idfm"}async getItineraries(e,t){const{travelMode:r}=t;if("BIKE"===r)return ae.getItineraries("https://idfm.getwemap.com/marketplace/computedroutes",t);const i=this.getURL(e,t),n=await fetch(i,{method:"GET",headers:{apiKey:"qWHj6ax6DMttG8DX6tH9CQARaiTgQ1Di"}}).catch((()=>{throw o.RemoteRoutingError.unreachableServer(this.rname,i)})),s=await n.json().catch((()=>{throw o.RemoteRoutingError.responseNotParsing(this.rname,i)}));if(s&&s.error)throw o.RemoteRoutingError.notFound(this.rname,s.error.message);const a=this.parseResponse(s);if(!a.some((e=>o.areTransitAndTravelModeConsistent(e.transitMode,t.travelMode))))throw o.RemoteRoutingError.notFound(this.rname,"Selected mode of transport was not found for this itinerary.");return a}getURL(e,t){var o;const{origin:r,destination:i,waypoints:n,travelMode:a}=t;(n||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==n?void 0:n.length})`);const l=new URL(e),d=new URLSearchParams;d.set("from",`${r.longitude};${r.latitude}`),d.set("to",`${i.longitude};${i.latitude}`),d.set("data_freshness","realtime"),(null==(o=t.itineraryModifiers)?void 0:o.isWheelchair)&&d.set("wheelchair","true");let c=new URLSearchParams;switch(a){case"WALK":c=this.getWalkingQuery();break;case"BIKE":c=this.getBikeQuery();break;case"CAR":c=this.getCarQuery()}return[d,c].map((e=>{for(const t of e.entries())l.searchParams.append(t[0],t[1])})),l.toString()}getCarQuery(){const e=new URLSearchParams;return de.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("first_section_mode[]","car"),e.append("last_section_mode[]","walking"),e.append("last_section_mode[]","car"),e}getWalkingQuery(){const e=new URLSearchParams;return de.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("last_section_mode[]","walking"),e}getBikeQuery(){const e=new URLSearchParams;return de.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","bike"),e.append("last_section_mode[]","bike"),e}getSectionCoords(e){let t,o;return t="stop_point"in e.from?e.from.stop_point.coord:"address"in e.from?e.from.address.coord:e.from.poi.coord,o="stop_point"in e.to?e.to.stop_point.coord:"address"in e.to?e.to.address.coord:e.to.poi.coord,{from:ce(t),to:ce(o)}}findStepsCoord(e,t){const o=e,r=[...o];let n=t[0],s=0;const a=[];for(const[l,d]of t.entries()){let e,c;if(0===l)c=0,e=o[0];else if(l===t.length-1)c=o.length-1,e=ue(o);else if(1===r.length)s++,c=s,e=r[0],o[c]=e;else{const t=i.Utils.trimRoute(r,r[0],n.distance);s+=t.length-1,r.splice(0,t.length-1),c=s,e=ue(t),o[c]=e}a.push({...d,coords:e}),n=d}return a}findStepCoords(e,t){var o;if("instruction_start_coordinate"in e)return ce(e.instruction_start_coordinate);const r=null==(o=t.vias)?void 0:o.find((t=>t.id===e.via_uri));return r?ce(r.access_point.coord):void 0}parseResponse(e){var t;if(!e||!e.journeys)throw o.RemoteRoutingError.notFound(this.rname,null==(t=e.error)?void 0:t.message);const r=[],n=e.context.timezone;for(const s of e.journeys){const e=[];for(const r of s.sections){if("waiting"===r.type||"transfer"===r.type)continue;const{from:t,to:s}=this.getSectionCoords(r);let a=[];const l=r.geojson.coordinates.reduce(((e,[t,o])=>(a.includes(`${t}-${o}`)||(a=a.concat(`${t}-${o}`),e.push(new i.Coordinates(o,t))),e)),[]),d=(new o.StepsBuilder).setStart(t).setEnd(s).setPathCoords(l);let c,u=le.get(r.mode);if(r.path){const e=r.path.every((e=>"instruction_start_coordinate"in e||e.via_uri)),t=[];for(const o of r.path){let i;if(e){i=this.findStepCoords(o,r);const e={name:o.name,distance:o.length,coords:i};d.addStepInfo(e)}else t.push({name:o.name,distance:o.length})}e||d.setStepsInfo(this.findStepsCoord(l,t))}if("public_transport"===r.type){c={name:r.display_informations.code,routeColor:r.display_informations.color,routeTextColor:r.display_informations.text_color,directionName:r.display_informations.direction},u=le.get(r.display_informations.physical_mode);const e={coords:l[0],name:c.directionName,distance:r.geojson.properties[0].length};d.setStepsInfo([e])}const p=new o.Leg({transitMode:u,duration:r.duration,startTime:pe(r.departure_date_time,n),endTime:pe(r.arrival_date_time,n),start:{name:r.from.name,coords:t},end:{name:r.to.name,coords:s},coords:l,transportInfo:c,steps:d.build()});e.push(p)}const t=new o.Itinerary({duration:s.duration,startTime:pe(s.departure_date_time,n),endTime:pe(s.arrival_date_time,n),origin:this.getSectionCoords(s.sections[0]).from,destination:this.getSectionCoords(ue(s.sections)).to,legs:e});r.push(t)}return r}}const me=new he;function ge(e){return"BUS"===e.mode||"TRAM"===e.mode}function we(e){return new i.Coordinates(e.lat,e.lon)}const fe=new Map;fe.set("CAR","CAR"),fe.set("WALK","WALK"),fe.set("BIKE","BICYCLE"),fe.set("TRANSIT","WALK,TRANSIT");class be extends o.RemoteRouter{get rname(){return"otp"}async getItineraries(e,t){const r=this.getURL(e,t),i=await fetch(r).catch((()=>{throw o.RemoteRoutingError.unreachableServer(this.rname,r)})),n=await i.json().catch((()=>{throw o.RemoteRoutingError.responseNotParsing(this.rname,r)}));return this.parseResponse(n)}getURL(e,t){const{origin:r,destination:i,waypoints:n,travelMode:a}=t,l=fe.get(a);if(!l)throw o.RemoteRoutingError.travelModeUnimplemented(this.rname,a);(n||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==n?void 0:n.length})`);const d=`fromPlace=${r.latitude},${r.longitude}`,c=`toPlace=${i.latitude},${i.longitude}`,u=`mode=${l}`,p=new URL(e);let{search:h}=p;return h=(h?`${h}&`:"?")+`${d}&${c}&${u}`,`${p.origin}${p.pathname}${h}`}parseResponse(e){const{plan:t}=e;if(!t)throw o.RemoteRoutingError.notFound(this.rname);const r=[],n=we(t.from),s=we(t.to);for(const l of t.itineraries){const e=[];for(const r of l.legs){const t=we(r.from),n=we(r.to),s=a.decode(r.legGeometry.points).map((([e,t])=>new i.Coordinates(e,t)));let l;const d=(new o.StepsBuilder).setStart(t).setEnd(n).setPathCoords(s);ge(r)?(l={name:r.routeShortName,routeColor:r.routeColor,routeTextColor:r.routeTextColor,directionName:r.headsign},d.addStepInfo({coords:s[0],name:r.headsign})):r.steps.forEach((e=>{const t=s.map((t=>t.distanceTo(we(e)))),o=t.indexOf(Math.min(...t));if(o<0)throw new Error("OTP Parser: Cannot find closest step");d.addStepInfo({coords:s[o],name:e.streetName})}));const c=new o.Leg({transitMode:r.mode,duration:r.duration,startTime:r.startTime,endTime:r.endTime,start:{name:r.from.name,coords:we(r.from)},end:{name:r.to.name,coords:we(r.to)},coords:s,transportInfo:l,steps:d.build()});e.push(c)}const t=new o.Itinerary({duration:l.duration,startTime:l.startTime,endTime:l.endTime,origin:n,destination:s,legs:e});r.push(t)}return r}}const ve=new be;class ye extends o.RemoteRouter{get rname(){return"wemap-multi"}async getItineraries(e,t){const{origin:r,destination:n,waypoints:s}=t,a={...t,origin:r instanceof i.Coordinates?r.toJson():r,destination:n instanceof i.Coordinates?n.toJson():n,...s&&{waypoints:s.map((e=>e instanceof i.Coordinates?e.toJson():e))}},l=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(a)}).catch((()=>{throw o.RemoteRoutingError.unreachableServer(this.rname,e)})),d=await l.json().catch((()=>{throw o.RemoteRoutingError.responseNotParsing(this.rname,e)}));if(d.error)throw o.RemoteRoutingError.notFound(this.rname,d.error);return(d.itineraries||[]).map(o.Itinerary.fromJson)}}const Re=new ye,_e=[q,Z,te,me,o.OsrmRemoteRouter,ve,Re];const Se=new class{getRouterByName(e){return _e.find((t=>t.rname===e))}async getItineraries(e,t,r){const i=this.getRouterByName(e);if(!i)throw o.RemoteRoutingError.notFound(e,`Unknown "${e}" remote router`);return i.getItineraries(t,r)}async getItinerariesWithFallback(e,t){let r;const i=[];for(const{name:l,endpointUrl:d}of t)try{if(r=await this.getItineraries(l,d,e),r.length)return r}catch(a){if(!(a instanceof o.RemoteRoutingError))throw a;i.push({name:l,endpointUrl:d,error:a})}const n=t.map((({name:e})=>e)).join(", "),s=i.map((e=>`(${e.name}) Could not find an itinerary on endpoint: ${e.endpointUrl}. Details: ${e.error.message}`)).join("\n");throw o.RemoteRoutingError.notFound(n,s)}};class Te{constructor(e,o,r=null,i=null){if(t(this,"name"),t(this,"graph"),t(this,"router"),t(this,"bounds"),t(this,"entryPoints"),this.name=i,this.graph=e,this.router=new L(e),o.forEach((t=>{if(!e.vertices.includes(t))throw new Error(`Cannot find entry point ${t.coords.toString()} in graph "${i}"`)})),this.entryPoints=o,r)this.bounds=r;else{const t=[e.vertices.map((e=>[e.coords.lng,e.coords.lat]))],o=d({type:"polygon",coordinates:t});if(!o)throw new Error(`Cannot calculate convexHull of graph "${i}"`);this.bounds={type:"MultiPolygon",coordinates:[o.geometry.coordinates]}}}static fromOsmXml(e,t=null,o){const r={routingIoNotFound:[],routingBoundsNotFound:!1};let i;try{i=n.OsmParser.parseOsmXmlString(e)}catch(c){return r.couldNotParseFile=c instanceof Error?c.message:"Unknown error",void(null==o||o(r))}let s=[];const a=O.createGraphFromOsmModel(i,O.DEFAULT_WAY_SELECTOR,(e=>s=e)),l=i.nodes.filter((e=>e.tags["wemap:routing-io"])).map((e=>{var t;const o=null==(t=s.find((t=>t[0]===e.id)))?void 0:t[1];return o||r.routingIoNotFound.push(e),o||null})).filter((e=>null!==e));l.forEach((e=>a.exitVertices.add(e)));const d={type:"MultiPolygon",coordinates:[]};return i.ways.filter((({tags:e})=>e["wemap:routing-bounds"])).forEach((e=>{d.coordinates.push([e.nodes.reduce(((e,t)=>(e.push([t.coords.lng,t.coords.lat]),e)),[])])})),i.relations.filter((e=>e.tags["wemap:routing-bounds"]&&e.isMultipolygon())).forEach((e=>{const t=e.getGeoJsonPolygon();t&&d.coordinates.push(t.coordinates)})),d.coordinates.length||(r.routingBoundsNotFound=!0),null==o||o(r),new Te(a,l,d,t)}isPointInside(e){return l([e.lng,e.lat],this.bounds)}getOrderedEntryPointsSortedByDistance(e,t){const o=[...this.entryPoints];return o.sort(((o,r)=>Number(o.coords.distanceTo(e))+o.coords.distanceTo(t)-(r.coords.distanceTo(e)+r.coords.distanceTo(t))+50*(Math.abs(i.Level.diff(e.level,o.coords.level)||0)+Math.abs(i.Level.diff(t.level,o.coords.level)||0)-(Math.abs(i.Level.diff(e.level,r.coords.level)||0)+Math.abs(i.Level.diff(t.level,r.coords.level)||0)))))}getBestRouteFromEntryPointsToDestination(e,t,o){const r=this.getOrderedEntryPointsSortedByDistance(e,t);for(const i of r){const e=this.router.calculateShortestPath(i.coords,t,o).route();if(e.hasRoute)return e}return null}getBestRouteFromOriginToEntryPoints(e,t,o){const r=this.getOrderedEntryPointsSortedByDistance(e,t);for(const i of r){const t=this.router.calculateShortestPath(e,i.coords,o).route();if(t.hasRoute)return t}return null}getRouteInsideMap(e,t,o){const r=this.router.calculateShortestPath(e,t,o).route();return r.hasRoute?r:null}getTripInsideMap(e,t){return this.router.getShortestTrip(e,t)}getRoutesMultipleDestinationsInsideMap(e,t,o){return this.router.calculateShortestPathToMultipleDestinations(e,t,o)}}exports.Edge=o.Edge,exports.Graph=o.Graph,exports.GraphProjection=o.GraphProjection,exports.GraphRoute=o.GraphRoute,exports.Itinerary=o.Itinerary,exports.Leg=o.Leg,exports.OsrmRemoteRouter=o.OsrmRemoteRouter,exports.RemoteRoutingError=o.RemoteRoutingError,exports.RoutingError=o.RoutingError,exports.StatusCode=o.StatusCode,exports.Vertex=o.Vertex,exports.WemapMultiRoutingError=o.WemapMultiRoutingError,exports.areTransitAndTravelModeConsistent=o.areTransitAndTravelModeConsistent,exports.getDurationFromLength=o.getDurationFromLength,exports.CitywayRemoteRouter=q,exports.CustomGraphMap=Te,exports.CustomGraphMapTester=class{static createReport(e){var t;let o;const r=Te.fromOsmXml(e,null,(e=>o=e)),i=[];if((null==o?void 0:o.couldNotParseFile)||!r)return i.push({type:"could-not-parse-file",details:null==o?void 0:o.couldNotParseFile}),{errors:i};const n=r.router.calculateComponents();return n.length>1&&i.push({type:"multiple-graph-components",data:n}),(null==o?void 0:o.routingBoundsNotFound)&&i.push({type:"routing-bounds-not-found"}),(null==(t=null==o?void 0:o.routingIoNotFound)?void 0:t.length)&&i.push({type:"routing-io-not-on-graph",data:o.routingIoNotFound}),{customGraphMap:r,errors:i}}static reportToJson(e){var t,o;return{graph:null==(o=null==(t=e.customGraphMap)?void 0:t.graph)?void 0:o.toCompressedJson(),errors:e.errors.map((e=>"multiple-graph-components"===e.type?{type:e.type,data:e.data.map((e=>e.map((e=>e.id))))}:"routing-io-not-on-graph"===e.type?{type:e.type,data:e.data.map((e=>e.id))}:{type:e.type}))}}},exports.DeutscheBahnRemoteRouter=te,exports.GeoveloRemoteRouter=ae,exports.GraphRouter=L,exports.GraphRouterOptionsBuilder=P,exports.IdfmRemoteRouter=me,exports.ItineraryInfoManager=class{constructor(e=null){t(this,"_itinerary",null),t(this,"_graph",null),t(this,"_steps",[]),t(this,"_coordsNextStep",[]),t(this,"_coordsPreviousStep",[]),t(this,"_coordsDistanceTraveled",[]),t(this,"_coordsLeg",[]),t(this,"_itineraryDistanceWithoutProjections",0),this.itinerary=e}get itinerary(){return this._itinerary}set itinerary(e){if(null===e)return void(this._itinerary=null);this._itinerary=e,this._steps=e.steps,this._graph=e.toGraph(),this._coordsNextStep=new Array(e.coords.length),this._coordsPreviousStep=new Array(e.coords.length),this._coordsDistanceTraveled=new Array(e.coords.length),this._coordsLeg=new Array(e.coords.length),this._itineraryDistanceWithoutProjections=e.distance;let t=0,o=null,r=this._steps[0],i=0;e.coords.forEach(((n,s,a)=>{0!==s&&(i+=a[s-1].distanceTo(n)),this._coordsNextStep[s]=r,this._coordsPreviousStep[s]=o,this._coordsDistanceTraveled[s]=i,this._coordsLeg[s]=e.legs.find((e=>e.coords.includes(n))),t<this._steps.length&&this._steps[t].coords.equals(n)&&(o=this._steps[t],r=t===this._steps.length-1?null:this._steps[t+1],t++)}))}getInfo(e){if(!this._itinerary||!this._graph)return null;const t=this._graph.getProjection(e);if(!t)return null;let r=null;if(t.nearestElement instanceof o.Vertex){const e=this._itinerary.coords.findIndex((e=>t.nearestElement.coords===e));if(-1===e)throw new Error("ItineraryInfoManager: could not find projection in itinerary (Node)");const o=this._coordsDistanceTraveled[e],i=o,n=this._itineraryDistanceWithoutProjections-o,s=t.distanceFromNearestElement+n,a=i/(i+s),l=1-a;r={nextStep:this._coordsNextStep[e],previousStep:this._coordsPreviousStep[e],projection:t,leg:this._coordsLeg[e],traveledDistance:o,remainingDistance:s,traveledPercentage:a,remainingPercentage:l}}else if(t.nearestElement instanceof o.Edge){let e=t.nearestElement.vertex1.coords,o=this._itinerary.coords.findIndex((t=>e===t));if(-1===o)throw new Error("ItineraryInfoManager: could not find projection in itinerary (Edge)");o!==this._itinerary.coords.length-1&&this._itinerary.coords[o+1]===t.nearestElement.vertex2.coords||(e=t.nearestElement.vertex2.coords,o--);const i=this._coordsDistanceTraveled[o]+t.coords.distanceTo(e),n=i,s=this._itineraryDistanceWithoutProjections-i,a=t.distanceFromNearestElement+s,l=n/(n+a),d=1-l;r={nextStep:this._coordsNextStep[o+1],previousStep:this._coordsPreviousStep[o+1],projection:t,leg:this._coordsLeg[o+1],traveledDistance:n,remainingDistance:a,traveledPercentage:l,remainingPercentage:d}}return r}},exports.NavitiaRemoteRouter=Z,exports.NoRouteFoundError=U,exports.OsmGraphUtils=O,exports.OtpRemoteRouter=ve,exports.RemoteRouterManager=Se,exports.WemapMultiRemoteRouter=Re,exports.WemapMultiRouter=class{constructor(){t(this,"maps",[])}get rname(){return"wemap-multi"}addIOMap(e){this.maps.push(e)}removeIOMap(e){this.maps=this.maps.filter((t=>t!==e))}removeAllMaps(){this.maps=[]}getMapByName(e){return this.maps.find((t=>t.name===e))}async getItineraries(e,t=[],r=this.maps){const{origin:i,destination:n}=e;t=t.filter((({name:e})=>e!==Re.rname))||[];const s=r;if(!s.length)return await Se.getItinerariesWithFallback(e,t);let a,l;const d=s.find((e=>e.isPointInside(i))),c=P.fromJson(e.itineraryModifiers||{});if(d&&d.isPointInside(n)){if(a=d.getRouteInsideMap(i,n,c),!a)throw o.WemapMultiRoutingError.notFound(d.name||"");return[o.Itinerary.fromGraphRoute(a)]}const u=s.find((e=>e.isPointInside(n)));let p;if(!d&&!u)return await Se.getItinerariesWithFallback(e,t);if(d&&!u){if(!d.entryPoints.length)throw o.WemapMultiRoutingError.notFound(d.name||"",`A map including the "origin" but the "destination" has been \n found (${d.name}), however, no "entrypoints" have been found to go out`);const r=e=>`Tried to calculate an itinerary from "origin" to "entrypoints" using wemap router on local map "${d.name}" and an itinerary from "entrypoints" to "destination" using remote routers (${t.map((e=>e.name)).join(", ")}), but failed. Details: ${e}.`;if(a=d.getBestRouteFromOriginToEntryPoints(i,n,c),!a){const e=`No route found from ${i.toString()} to entry points in map: ${d.name}`;throw o.WemapMultiRoutingError.notFound(d.name||"",r(e))}const s={...e,origin:a.end,destination:n,waypoints:[]};try{p=await Se.getItinerariesWithFallback(s,t)}catch(h){throw h instanceof o.RemoteRoutingError&&(h.message=r(h.message)),h}return l=o.Itinerary.fromGraphRoute(a),p.map((e=>o.Itinerary.fromItineraries(l,e)))}if(!d&&u){if(!u.entryPoints.length)throw o.WemapMultiRoutingError.notFound(u.name||"",`A map including the "destination" but the "origin" has been \n found (${u.name}), however, no "entrypoints" have been found to go in`);const r=e=>`Tried to calculate an itinerary from "origin" to "entrypoints" using remote routers (${t.map((e=>e.name)).join(", ")}) and an itinerary from "entrypoints" to "destination" using wemap router on local map "${u.name}", but failed. Details: ${e}.`;if(a=u.getBestRouteFromEntryPointsToDestination(i,n,c),!a){const e=`No route found from entry points to ${n.toString()} in map: ${u.name}`;throw o.WemapMultiRoutingError.notFound(u.name||"",r(e))}const s={...e,origin:i,destination:a.start,waypoints:[]};try{p=await Se.getItinerariesWithFallback(s,t)}catch(h){throw h instanceof o.RemoteRoutingError&&(h.message=r(h.message)),h}return l=o.Itinerary.fromGraphRoute(a),p.map((e=>o.Itinerary.fromItineraries(e,l)))}if(d&&u){if(!d.entryPoints.length)throw o.WemapMultiRoutingError.notFound(d.name||"",`One map including the "origin" (${d.name}) and another \n including the "destination" (${u.name}) has been found, however, no "entrypoints" have \n been found to go out of the origin map`);if(!u.entryPoints.length)throw o.WemapMultiRoutingError.notFound(u.name||"",`One map including the "origin" (${d.name}) and another \n including the "destination" (${u.name}) has been found, however, no "entrypoints" have \n been found to go in the second map`);const r=e=>`Tried to calculate an itinerary from "origin" to "entrypoints1" using wemap router on local map "${d.name}", an itinerary from "entrypoints1" to "entrypoints2" using remote routers (${t.map((e=>e.name)).join(", ")}) and an itinerary from "entrypoints2" to "destination" using wemap router on local map "${u.name}", but failed. Details: ${e}.`,s=d.getBestRouteFromOriginToEntryPoints(i,n,c);if(!s){const e=`No route found from ${i.toString()} to entry points in map: ${d.name}`;throw o.WemapMultiRoutingError.notFound(d.name||"",r(e))}const a=u.getBestRouteFromEntryPointsToDestination(i,n,c);if(!a){const e=`No route found from entry points to ${n.toString()} in map: ${u.name}`;throw o.WemapMultiRoutingError.notFound(u.name||"",r(e))}const l={...e,origin:s.end,destination:a.start,waypoints:[]};try{p=await Se.getItinerariesWithFallback(l,t)}catch(h){throw h instanceof o.RemoteRoutingError&&(h.message=r(h.message)),h}return p.map((e=>o.Itinerary.fromItineraries(o.Itinerary.fromGraphRoute(s),e,o.Itinerary.fromGraphRoute(a))))}throw new Error("Should never happen")}},exports.routerRequestToJson=function(e){const{origin:t,destination:o,waypoints:r,...i}=e;return{origin:t.toJson(),destination:o.toJson(),...r&&{waypoints:r.map((e=>e.toJson()))},...i}};
1
+ "use strict";var e=Object.defineProperty,t=(t,r,o)=>(((t,r,o)=>{r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[r]=o})(t,"symbol"!=typeof r?r+"":r,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@wemap/geo"),o=require("@wemap/maths"),s=require("@wemap/logger"),i=require("@wemap/salesman.js"),n=require("@wemap/osm"),a=require("@mapbox/polyline"),l=require("@turf/boolean-point-in-polygon"),d=require("@turf/convex");const c=class e{constructor(o,s,i={},n=e.currentUniqueId++){t(this,"level"),t(this,"bearing"),t(this,"length"),this.vertex1=o,this.vertex2=s,this.properties=i,this.id=n,this.level=r.Level.union(o.coords.level,s.coords.level),this.length=this.vertex1.distanceTo(this.vertex2),this.bearing=this.vertex1.bearingTo(this.vertex2)}static getEdgeByVertices(e,t,r){return e.find((e=>t===e.vertex1&&r===e.vertex2||r===e.vertex1&&t===e.vertex2))}reverseProperties(){const{properties:e}=this;e.incline&&(e.incline="up"===e.incline?"down":"up"),e.isOneway&&(e.isOneway=!1)}};t(c,"currentUniqueId",0);let u=c;class h{constructor(e,t,r,o){this.origin=e,this.distanceFromNearestElement=t,this.coords=r,this.nearestElement=o}}class p{constructor(e,r={}){t(this,"id",-1),this.coords=e,this.properties=r}distanceTo(e){return this.coords.distanceTo(e.coords)}bearingTo(e){return this.coords.bearingTo(e.coords)}toJson(){return{id:this.id,coords:this.coords.toCompressedJson(),...Object.keys(this.properties).length>0&&{properties:this.properties}}}static fromJson(e){const t=new p(r.Coordinates.fromCompressedJson(e.coords),e.properties);return t.id=e.id,t}}class m{constructor(e,r){t(this,"exitVertices"),this.vertices=e,this.edges=r;const o=r.filter((e=>null===e.level)).map((e=>[e.vertex1,e.vertex2])).flat(),s=r.filter((e=>null!==e.level)).map((e=>[e.vertex1,e.vertex2])).flat();this.exitVertices=new Set(o.filter((e=>s.includes(e))))}getEdgeByVertices(e,t){return u.getEdgeByVertices(this.edges,e,t)}getVertexByCoords(e){return m.getVertexByCoords(this.vertices,e)}static getVertexByCoords(e,t){return e.find((e=>e.coords.equals(t)))}getVertexByName(e){return this.vertices.find((t=>t.properties.name===e))}getEdgeByName(e){return this.edges.find((t=>t.properties.name===e))}getBoundingBox(e){if(!this.vertices.length)return null;const t=r.BoundingBox.fromCoordinates(this.vertices.map((e=>e.coords)));return e&&t.extendsWithMeasure(e),t}getProjection(e,t={}){const s="maxDistance"in t,i=t.maxDistance,n="maxBearingAngle"in t;if(n&&(!(e instanceof r.UserPosition)||null===e.bearing))return null;const a=t.maxBearingAngle,l="acceptEdgeFn"in t,d=!("useMultiLevelSegments"in t)||t.useMultiLevelSegments;let c=null;const u=t=>{if(!(e instanceof r.UserPosition))return t;const o=e.clone();return o.lat=t.lat,o.lng=t.lng,o.level=t.level,o.alt=t.alt,o.heightFromFloor=t.heightFromFloor,o.heightFromGround=t.heightFromGround,o};return this.edges.forEach((p=>{if(l&&!t.acceptEdgeFn(p))return;if(!d&&r.Level.isRange(p.level))return;if(!r.Level.intersect(p.level,e.level))return;if(n&&o.diffAngleLines(p.bearing,e.bearing)>a)return;const m=e.getSegmentProjection(p.vertex1.coords,p.vertex2.coords);if(!m)return;const g=m.distanceTo(e);s&&g>i||g<((null==c?void 0:c.distanceFromNearestElement)??Number.MAX_VALUE)&&(c=new h(e,g,u(m),p))})),n||this.vertices.forEach((t=>{let o=t.coords;if(this.exitVertices.has(t)&&null===e.level&&(o=t.coords.clone(),o.level=null),!d&&r.Level.isRange(o.level))return;if(!r.Level.intersect(o.level,e.level))return;const n=o.distanceTo(e);n<r.Constants.EPS_MM?c=new h(e,0,u(o),t):s&&n>i||n<((null==c?void 0:c.distanceFromNearestElement)??Number.MAX_VALUE)&&(c=new h(e,n,u(o),t))})),c}toJson(){return{vertices:this.vertices.map((e=>e.toJson())),edges:this.edges.map((e=>({id:e.id,vertex1Idx:this.vertices.indexOf(e.vertex1),vertex2Idx:this.vertices.indexOf(e.vertex2),...Object.keys(e.properties).length>0&&{properties:e.properties}})))}}static fromJson(e){const t=e.vertices.map((e=>p.fromJson(e))),r=e.edges.map((e=>new u(t[e.vertex1Idx],t[e.vertex2Idx],e.properties,e.id)));return new m(t,r)}toCompressedJson(){return{vertices:this.vertices.map((e=>e.coords.toCompressedJson())),verticesIds:this.vertices.map((e=>e.id)),edges:this.edges.map((e=>{const t=this.vertices.indexOf(e.vertex1),r=this.vertices.indexOf(e.vertex2),o=e.properties;return Object.keys(o).length>0?[t,r,o]:[t,r]}))}}static fromCompressedJson(e){const t=e.vertices.map((e=>new p(r.Coordinates.fromCompressedJson(e)))),o=e.edges.map((e=>new u(t[e[0]],t[e[1]],e.length>2?e[2]:{})));return new m(t,o)}static fromCoordinatesSegments(e){const t=[],r=[],o=e=>{const r=t.find((t=>t.coords.equals(e)));if(r)return r;const o=new p(e);return t.push(o),o};for(const s of e){let e=null;for(const t of s){const s=o(t);e&&r.push(new u(s,e)),e=s}}return new m(t,r)}getEdgesAtLevel(e,t=!0){return this.edges.filter((({level:o})=>t?r.Level.intersect(e,o):r.Level.contains(e,o)))}toDetailedString(){let e=`--- Network ---\nVertices: ${this.vertices.length}\nEdges: ${this.edges.length}\n---\nVertices\n`;return this.vertices.forEach((t=>{e+=t.id;const r=t.properties;0!==Object.keys(r).length&&(e+=` ${r}`)})),e+="---\nEdges\n",this.edges.forEach((t=>{e+=`${t.id} - [v1: ${t.vertex1.id}, v2: ${t.vertex2.id}]`;const r=t.properties;0!==Object.keys(r).length&&(e+=` ${r}`)})),e+="---",e}}function g(e,t=5){return e/(1e3*t/3600)}function f(e){return["AIRPLANE","BOAT","BUS","FERRY","FUNICULAR","METRO","MULTI","TRAIN","TRAM"].includes(e)}function w(e,t){return e===t||f(e)&&"TRANSIT"===t||"WALK"===e&&"TRANSIT"===t}function v(e){return{...e.firstStep&&{firstStep:!0},...e.lastStep&&{lastStep:!0},number:e.number,coords:e.coords.toCompressedJson(),...null!==e.name&&{name:e.name},angle:Number(e.angle.toFixed(2)),previousBearing:Number(e.previousBearing.toFixed(2)),nextBearing:Number(e.nextBearing.toFixed(2)),distance:Number(e.distance.toFixed(1)),duration:Number(e.duration.toFixed(1)),...null!==e.levelChange&&{levelChange:e.levelChange},...e.extras&&0!==Object.keys(e.extras).length&&{extras:e.extras}}}function b(e){return Object.assign({},e,{coords:r.Coordinates.fromCompressedJson(e.coords),firstStep:Boolean(e.firstStep),lastStep:Boolean(e.lastStep),name:e.name||null,levelChange:e.levelChange||null,extras:e.extras||null})}function y(e,t){var r,o,s,i,n,a;return e.coords.equals(t.coords)&&Math.abs(e.angle-t.angle)<=.005&&Math.abs(e.distance-t.distance)<=.05&&Math.abs(e.duration-t.duration)<=.05&&e.firstStep===t.firstStep&&e.lastStep===t.lastStep&&(null==(r=e.levelChange)?void 0:r.difference)===(null==(o=t.levelChange)?void 0:o.difference)&&(null==(s=e.levelChange)?void 0:s.direction)===(null==(i=t.levelChange)?void 0:i.direction)&&(null==(n=e.levelChange)?void 0:n.type)===(null==(a=t.levelChange)?void 0:a.type)&&e.name===t.name&&Math.abs(e.nextBearing-t.nextBearing)<=.005&&e.number===t.number&&Math.abs(e.previousBearing-t.previousBearing)<=.005}class T extends m{constructor(e,t,r,o,s){super(r,o),this.start=e,this.end=t,this.vertices=r,this.edges=o,this.edgesWeights=s}reverse(){const e=this.vertices.slice().reverse(),t=this.edges.slice().reverse(),r=this.edgesWeights.slice().reverse();return t.map((e=>new u(e.vertex2,e.vertex1,e.properties))),new T(this.start,this.end,e,t,r)}static fromCoordinates(e,t,r){const o=m.fromCoordinatesSegments([r]),s=o.edges.map((e=>g(e.length)));return new T(e,t,o.vertices,o.edges,s)}get hasRoute(){return Boolean(this.vertices.length)}}const S=o.deg2rad(20);class x{constructor(){t(this,"start",null),t(this,"end",null),t(this,"pathCoords",null),t(this,"stepsInfo",[])}setStart(e){return this.start=e,this}setEnd(e){return this.end=e,this}setPathCoords(e){return this.pathCoords=e,this}setStepsInfo(e){return this.stepsInfo=e,this}addStepInfo(e){return this.stepsInfo.push(e),this}setGraphRoute(e){const t=[],{start:s,end:i}=e;if(!e.hasRoute)return this;let n=null,a=s.bearingTo(e.vertices[0].coords);for(let d=0;d<e.vertices.length-1;d++){const s=0===d,i=e.vertices[d],l=i.coords,c=e.vertices[d+1],u=c.coords,h=e.edges[d],p=i.bearingTo(c),m=o.diffAngle(a,p+Math.PI),g=t.length?t[t.length-1]:null,{isSubwayEntrance:f,isGate:w,subwayEntranceRef:v}=i.properties,{isElevator:b,areEscalators:y,areStairs:T,isMovingWalkway:x,incline:_}=h.properties;let N,E=null;E=b?"elevator":y?"escalator":T?"stairs":x?"moving walkway":"incline plane",(T||b)&&_&&!(null==g?void 0:g.levelChange)&&(N=_);const R=d>0?e.edges[d-1]:null,C=(null==R?void 0:R.properties)||{},A=Boolean(C.incline&&C.areStairs&&(!_||!T)),M=i.properties.isSubwayEntrance,I=h.properties.name||null,L=e.edgesWeights[d],k={...f&&{isSubwayEntrance:f},...v&&{subwayEntranceRef:v},...w&&{isGate:w}};let P=Math.abs(o.diffAngle(Math.PI,m))>=S;const U=r.Level.isRange(h.level)&&!r.Level.isRange(l.level)||N;P=P&&!(l.level&&r.Level.isRange(l.level));const O=(null==g?void 0:g.levelChange)&&!r.Level.isRange(l.level)||A;if(s||(P||U||O||M)){let e;if(U){const t=r.Level.diff(l.level,u.level)||0;let o=t>0?"up":"down";N&&(o=N),e={difference:t,direction:o,...E&&{type:E}}}n={coords:l,...I&&{name:I},extras:k,levelChange:e,distance:0,duration:0},t.push(n)}n.distance+=l.distanceTo(u),n.duration+=L,a=p}const l=e.vertices[e.vertices.length-1].coords;return r.Coordinates.equals(l,i)||t.push({coords:l}),this.setStart(s),this.setEnd(i),this.setPathCoords(e.vertices.map((e=>e.coords))),this.setStepsInfo(t),this}build(){const{pathCoords:e,start:t,end:r}=this;if(!e)return s.warn('StepsBuilder: Missing "pathCoords" property to build steps'),[];if(!t)return s.warn('StepsBuilder: Missing "from" property to build steps'),[];if(!r)return s.warn('StepsBuilder: Missing "to" property to build steps'),[];0===this.stepsInfo.length&&this.setGraphRoute(T.fromCoordinates(t,r,e));const{stepsInfo:i}=this;return i.map(((s,n)=>{const a=e.findIndex((e=>e.equals(s.coords)));if(-1===a)throw new Error("Cannot find step coordinates in itinerary coordinates.");const l=0===a?t:e[a-1],d=a===e.length-1?r:e[a+1],c=l.bearingTo(s.coords),u=s.coords.bearingTo(d);let h=0;const p=n===i.length-1,m=p?e[e.length-1]:i[n+1].coords;let f=a;for(;!e[f].equals(m);)h+=e[f].distanceTo(e[f+1]),f++;return{coords:s.coords,name:s.name||null,number:n+1,previousBearing:c,nextBearing:u,angle:o.diffAngle(c,u+Math.PI),firstStep:0===n,lastStep:p,distance:h,duration:s.duration||g(h),levelChange:s.levelChange||null,extras:s.extras||null}}))}}class _{constructor({start:e,end:o,coords:s,transitMode:i,duration:n,startTime:a,endTime:l,transportInfo:d,steps:c}){t(this,"start"),t(this,"end"),t(this,"coords"),t(this,"distance"),t(this,"transitMode"),t(this,"duration"),t(this,"startTime"),t(this,"endTime"),t(this,"steps"),t(this,"transportInfo"),this.start={name:e.name||null,coords:e.coords},this.end={name:o.name||null,coords:o.coords},this.coords=s,this.transitMode=i,this.distance=r.Utils.calcDistance(s),this.duration="number"==typeof n?n:g(this.distance),this.startTime="number"==typeof a?a:null,this.endTime="number"==typeof l?l:null,this.transportInfo=d||null,this.steps=Array.isArray(c)?c:(new x).setStart(e.coords).setEnd(o.coords).setPathCoords(s).build()}isPublicTransport(){return f(this.transitMode)}toGraph(){return m.fromCoordinatesSegments([this.coords])}static equals(e,t){var r,o;if(!(e.transitMode===t.transitMode&&Math.abs(e.duration-t.duration)<=.05&&e.startTime===t.startTime&&e.endTime===t.endTime&&e.start.name===t.start.name&&e.start.coords.equals(t.start.coords)&&e.end.name===t.end.name&&e.end.coords.equals(t.end.coords)&&e.coords.length===t.coords.length&&(e.steps===t.steps||(null==(r=e.steps)?void 0:r.length)===(null==(o=t.steps)?void 0:o.length))))return!1;let s;for(s=0;s<e.coords.length;s++)if(!e.coords[s].equals(t.coords[s]))return!1;for(s=0;s<e.steps.length;s++)if(!y(e.steps[s],t.steps[s]))return!1;if(e.transportInfo!==t.transportInfo){if(null===e.transportInfo||null===t.transportInfo)return!1;if(e.transportInfo.name!==t.transportInfo.name||e.transportInfo.routeColor!==t.transportInfo.routeColor||e.transportInfo.routeTextColor!==t.transportInfo.routeTextColor||e.transportInfo.directionName!==t.transportInfo.directionName)return!1}return!0}equals(e){return _.equals(this,e)}toJson(){return{transitMode:this.transitMode,start:{coords:this.start.coords.toCompressedJson(),...this.start.name&&{name:this.start.name}},end:{coords:this.end.coords.toCompressedJson(),...this.end.name&&{name:this.end.name}},distance:Number(this.distance.toFixed(1)),duration:Number(this.duration.toFixed(1)),coords:this.coords.map((e=>e.toCompressedJson())),steps:this.steps.map(v),...null!==this.startTime&&{startTime:this.startTime},...null!==this.endTime&&{endTime:this.endTime},...null!==this.transportInfo&&{transportInfo:this.transportInfo}}}static fromJson(e){var t;return new _(Object.assign({},e,{start:{coords:r.Coordinates.fromCompressedJson(e.start.coords),name:e.start.name||null},end:{coords:r.Coordinates.fromCompressedJson(e.end.coords),name:e.end.name||null},coords:e.coords.map(r.Coordinates.fromCompressedJson),steps:(null==(t=e.steps)?void 0:t.map(b))||null}))}static fromGraphRoute(e,t="WALK"){return new _({start:{coords:e.start},end:{coords:e.end},coords:e.vertices.map((e=>e.coords)),duration:e.edgesWeights.reduce(((e,t)=>e+t),0),transitMode:t,steps:(new x).setGraphRoute(e).build()})}multiplyLevel(e){this.start.coords.level=r.Level.multiplyBy(this.start.coords.level,e),this.end.coords.level=r.Level.multiplyBy(this.end.coords.level,e);for(const t of this.coords)t.level=r.Level.multiplyBy(t.level,e);this.steps.forEach((t=>{t.coords.level=r.Level.multiplyBy(t.coords.level,e)}))}}class N{constructor({origin:e,destination:r,duration:o,legs:s,startTime:i,endTime:n}){t(this,"origin"),t(this,"destination"),t(this,"duration"),t(this,"legs"),t(this,"_transitMode",null),t(this,"startTime"),t(this,"endTime"),t(this,"_coords",null),t(this,"_distance",null),this.origin=e,this.destination=r,this.legs=s,this.duration="number"==typeof o?o:this.legs.reduce(((e,t)=>e+t.duration),0),this.startTime="number"==typeof i?i:null,this.endTime="number"==typeof n?n:null,this.updateStepsFromLegs()}set coords(e){throw new Error("Itinerary.coords cannot be set. They are calculated from Itinerary.legs.")}get coords(){return this._coords||(this._coords=this.legs.map((e=>e.coords)).flat().filter(((e,t,r)=>0===t||!r[t-1].equals(e)))),this._coords}set steps(e){throw new Error("Itinerary.step cannot be set. They are calculated from Itinerary.legs.")}get steps(){return this.legs.map((e=>e.steps)).flat()}set transitMode(e){throw new Error("Itinerary.transitMode cannot be set. They are calculated from Itinerary.legs.")}get transitMode(){if(!this._transitMode){const e=new Set(this.legs.map((e=>e.transitMode)));if(e.delete("WALK"),e.size>1)return this._transitMode="MULTI",this._transitMode;if(1===e.size)return this._transitMode=e.values().next().value,this._transitMode;this._transitMode="WALK"}return this._transitMode}set distance(e){throw new Error("Itinerary.distance cannot be set. They are calculated from Itinerary.legs.")}get distance(){return null===this._distance&&(this._distance=r.Utils.calcDistance(this.coords)),this._distance}toGraph(){return m.fromCoordinatesSegments([this.coords])}static fromItineraries(...e){return new N({origin:e[0].origin,destination:e[e.length-1].destination,legs:e.map((e=>e.legs)).flat()})}static fromOrderedPointsArray(e,t,o){const s=e=>new r.Coordinates(e[0],e[1],null,e[2]);return this.fromOrderedCoordinates(e.map(s),s(t),s(o))}static fromOrderedCoordinates(e,t,r,o="WALK"){const s=(new x).setPathCoords(e).setStart(t).setEnd(r).build(),i=new _({start:{coords:t},end:{coords:r},coords:e,transitMode:o,steps:s});return new N({origin:t,destination:r,legs:[i]})}static equals(e,t){if(!(e.origin.equals(t.origin)&&e.destination.equals(t.destination)&&Math.abs(e.distance-t.distance)<=.05&&Math.abs(e.duration-t.duration)<=.05&&e.startTime===t.startTime&&e.endTime===t.endTime&&e.legs.length===t.legs.length))return!1;for(let r=0;r<e.legs.length;r++)if(!e.legs[r].equals(t.legs[r]))return!1;return!0}equals(e){return N.equals(this,e)}toJson(){return{origin:this.origin.toJson(),destination:this.destination.toJson(),distance:Number(this.distance.toFixed(1)),duration:Number(this.duration.toFixed(1)),transitMode:this.transitMode,legs:this.legs.map((e=>e.toJson())),...null!==this.startTime&&{startTime:this.startTime},...null!==this.endTime&&{endTime:this.endTime}}}static fromJson(e){return new N({origin:r.Coordinates.fromJson(e.origin),destination:r.Coordinates.fromJson(e.destination),duration:e.duration,legs:e.legs.map(_.fromJson),startTime:e.startTime,endTime:e.endTime})}static fromGraphRoute(e,t="WALK"){const r=_.fromGraphRoute(e,t);return new N({origin:e.start,destination:e.end,legs:[r]})}multiplyLevel(e){this.origin.level=r.Level.multiplyBy(this.origin.level,e),this.destination.level=r.Level.multiplyBy(this.destination.level,e),this.legs.forEach((t=>t.multiplyLevel(e)))}forceUnknownLevelTo0(){this.origin.level=this.origin.level||0,this.destination.level=this.destination.level||0;for(const e of this.legs){e.start.coords.level=e.start.coords.level||0,e.end.coords.level=e.end.coords.level||0;for(const t of e.coords)t.level=t.level||0;if(e.steps)for(const t of e.steps)t.coords.level=t.coords.level||0}if(this._coords)for(const e of this._coords)e.level=e.level||0}toGeoJson(){const e=(e,t,r)=>({type:"Feature",properties:{name:t,level:e.level,...r&&{type:r}},geometry:{type:"Point",coordinates:[e.lng,e.lat]}}),t=[...new Set(this.coords.map((e=>r.Level.toString(e.level))))].map(r.Level.fromString).map((e=>[e,r.Utils.createSegmentsAtLevel(this.coords,e,!0)])).map((([e,t])=>((e,t)=>({type:"Feature",properties:{level:t,name:null==t?void 0:t.toString()},geometry:{type:"MultiLineString",coordinates:e.map((e=>e.map((({lat:e,lng:t})=>[t,e]))))}}))(t,e))),o=this.legs.map(((t,r)=>e(t.start.coords,`Leg ${r} start`,"leg-start"))),s=this.legs.map(((t,r)=>e(t.end.coords,`Leg ${r} end`,"leg-end"))),i=this.steps.map((t=>e(t.coords,`Step ${t.number}`,"step")));return{type:"FeatureCollection",features:[e(this.origin,"origin","origin"),e(this.destination,"destination","destination"),...t,...o,...s,...i]}}updateStepsFromLegs(){const e=this.coords.filter(((e,t,r)=>0===t||!r[t-1].equals(e))),t=this.legs.map((e=>e.steps)).flat();t.map(((r,s)=>{const i=e.findIndex((e=>e.equals(r.coords)));if(-1===i)throw new Error("Cannot find step coordinates in itinerary coordinates.");const n=0===i?this.origin:e[i-1],a=i===e.length-1?this.destination:e[i+1];r.previousBearing=n.bearingTo(r.coords),r.nextBearing=r.coords.bearingTo(a),r.angle=o.diffAngle(r.previousBearing,r.nextBearing+Math.PI),r.number=s+1,r.firstStep=0===s,r.lastStep=s===t.length-1}))}}var E,R,C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},A={exports:{}};E=A,R=A.exports,function(e,t){var r="function",o="undefined",s="object",i="string",n="major",a="model",l="name",d="type",c="vendor",u="version",h="architecture",p="console",m="mobile",g="tablet",f="smarttv",w="wearable",v="embedded",b="Amazon",y="Apple",T="ASUS",S="BlackBerry",x="Browser",_="Chrome",N="Firefox",C="Google",A="Huawei",M="LG",I="Microsoft",L="Motorola",k="Opera",P="Samsung",U="Sharp",O="Sony",B="Xiaomi",D="Zebra",F="Facebook",$="Chromium OS",W="Mac OS",j=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},q=function(e,t){return typeof e===i&&-1!==K(t).indexOf(K(e))},K=function(e){return e.toLowerCase()},G=function(e,t){if(typeof e===i)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},J=function(e,o){for(var i,n,a,l,d,c,u=0;u<o.length&&!d;){var h=o[u],p=o[u+1];for(i=n=0;i<h.length&&!d&&h[i];)if(d=h[i++].exec(e))for(a=0;a<p.length;a++)c=d[++n],typeof(l=p[a])===s&&l.length>0?2===l.length?typeof l[1]==r?this[l[0]]=l[1].call(this,c):this[l[0]]=l[1]:3===l.length?typeof l[1]!==r||l[1].exec&&l[1].test?this[l[0]]=c?c.replace(l[1],l[2]):t:this[l[0]]=c?l[1].call(this,c,l[2]):t:4===l.length&&(this[l[0]]=c?l[3].call(this,c.replace(l[1],l[2])):t):this[l]=c||t;u+=2}},V=function(e,r){for(var o in r)if(typeof r[o]===s&&r[o].length>0){for(var i=0;i<r[o].length;i++)if(q(r[o][i],e))return"?"===o?t:o}else if(q(r[o],e))return"?"===o?t:o;return e},z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},H={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[u,[l,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[u,[l,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[l,u],[/opios[\/ ]+([\w\.]+)/i],[u,[l,k+" Mini"]],[/\bopr\/([\w\.]+)/i],[u,[l,k]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[l,u],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[u,[l,"UC"+x]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[u,[l,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[u,[l,"WeChat"]],[/konqueror\/([\w\.]+)/i],[u,[l,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[u,[l,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[u,[l,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[l,/(.+)/,"$1 Secure "+x],u],[/\bfocus\/([\w\.]+)/i],[u,[l,N+" Focus"]],[/\bopt\/([\w\.]+)/i],[u,[l,k+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[u,[l,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[u,[l,"Dolphin"]],[/coast\/([\w\.]+)/i],[u,[l,k+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[u,[l,"MIUI "+x]],[/fxios\/([-\w\.]+)/i],[u,[l,N]],[/\bqihu|(qi?ho?o?|360)browser/i],[[l,"360 "+x]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[l,/(.+)/,"$1 "+x],u],[/(comodo_dragon)\/([\w\.]+)/i],[[l,/_/g," "],u],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[l,u],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[l],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[l,F],u],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[l,u],[/\bgsa\/([\w\.]+) .*safari\//i],[u,[l,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[u,[l,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[u,[l,_+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[l,_+" WebView"],u],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[u,[l,"Android "+x]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[l,u],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[u,[l,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[u,l],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[l,[u,V,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[l,u],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[l,"Netscape"],u],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[u,[l,N+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[l,u],[/(cobalt)\/([\w\.]+)/i],[l,[u,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,K]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows (ce|mobile); ppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[h,/ower/,"",K]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,K]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[a,[c,P],[d,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[a,[c,P],[d,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[a,[c,y],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[c,y],[d,g]],[/(macintosh);/i],[a,[c,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[a,[c,U],[d,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[a,[c,A],[d,g]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[a,[c,A],[d,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[a,/_/g," "],[c,B],[d,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[a,/_/g," "],[c,B],[d,g]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[a,[c,"OPPO"],[d,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[a,[c,"Vivo"],[d,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[a,[c,"Realme"],[d,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[a,[c,L],[d,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[a,[c,L],[d,g]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[a,[c,M],[d,g]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[a,[c,M],[d,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[a,[c,"Lenovo"],[d,g]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[a,/_/g," "],[c,"Nokia"],[d,m]],[/(pixel c)\b/i],[a,[c,C],[d,g]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[a,[c,C],[d,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[c,O],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[a,"Xperia Tablet"],[c,O],[d,g]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[a,[c,"OnePlus"],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[a,[c,b],[d,g]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[a,/(.+)/g,"Fire Phone $1"],[c,b],[d,m]],[/(playbook);[-\w\),; ]+(rim)/i],[a,c,[d,g]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[a,[c,S],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[a,[c,T],[d,g]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[a,[c,T],[d,m]],[/(nexus 9)/i],[a,[c,"HTC"],[d,g]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[a,/_/g," "],[d,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[a,[c,"Acer"],[d,g]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[a,[c,"Meizu"],[d,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[c,a,[d,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[c,a,[d,g]],[/(surface duo)/i],[a,[c,I],[d,g]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[a,[c,"Fairphone"],[d,m]],[/(u304aa)/i],[a,[c,"AT&T"],[d,m]],[/\bsie-(\w*)/i],[a,[c,"Siemens"],[d,m]],[/\b(rct\w+) b/i],[a,[c,"RCA"],[d,g]],[/\b(venue[\d ]{2,7}) b/i],[a,[c,"Dell"],[d,g]],[/\b(q(?:mv|ta)\w+) b/i],[a,[c,"Verizon"],[d,g]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[a,[c,"Barnes & Noble"],[d,g]],[/\b(tm\d{3}\w+) b/i],[a,[c,"NuVision"],[d,g]],[/\b(k88) b/i],[a,[c,"ZTE"],[d,g]],[/\b(nx\d{3}j) b/i],[a,[c,"ZTE"],[d,m]],[/\b(gen\d{3}) b.+49h/i],[a,[c,"Swiss"],[d,m]],[/\b(zur\d{3}) b/i],[a,[c,"Swiss"],[d,g]],[/\b((zeki)?tb.*\b) b/i],[a,[c,"Zeki"],[d,g]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[c,"Dragon Touch"],a,[d,g]],[/\b(ns-?\w{0,9}) b/i],[a,[c,"Insignia"],[d,g]],[/\b((nxa|next)-?\w{0,9}) b/i],[a,[c,"NextBook"],[d,g]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[c,"Voice"],a,[d,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[c,"LvTel"],a,[d,m]],[/\b(ph-1) /i],[a,[c,"Essential"],[d,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[a,[c,"Envizen"],[d,g]],[/\b(trio[-\w\. ]+) b/i],[a,[c,"MachSpeed"],[d,g]],[/\btu_(1491) b/i],[a,[c,"Rotor"],[d,g]],[/(shield[\w ]+) b/i],[a,[c,"Nvidia"],[d,g]],[/(sprint) (\w+)/i],[c,a,[d,m]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[c,I],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[c,D],[d,g]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[c,D],[d,m]],[/smart-tv.+(samsung)/i],[c,[d,f]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[c,P],[d,f]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,M],[d,f]],[/(apple) ?tv/i],[c,[a,y+" TV"],[d,f]],[/crkey/i],[[a,_+"cast"],[c,C],[d,f]],[/droid.+aft(\w)( bui|\))/i],[a,[c,b],[d,f]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[a,[c,U],[d,f]],[/(bravia[\w ]+)( bui|\))/i],[a,[c,O],[d,f]],[/(mitv-\w{5}) bui/i],[a,[c,B],[d,f]],[/Hbbtv.*(technisat) (.*);/i],[c,a,[d,f]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[c,G],[a,G],[d,f]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,f]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[c,a,[d,p]],[/droid.+; (shield) bui/i],[a,[c,"Nvidia"],[d,p]],[/(playstation [345portablevi]+)/i],[a,[c,O],[d,p]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[a,[c,I],[d,p]],[/((pebble))app/i],[c,a,[d,w]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[a,[c,y],[d,w]],[/droid.+; (glass) \d/i],[a,[c,C],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[a,[c,D],[d,w]],[/(quest( 2| pro)?)/i],[a,[c,F],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[d,v]],[/(aeobc)\b/i],[a,[c,b],[d,v]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[a,[d,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[a,[d,g]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,g]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,m]],[/(android[-\w\. ]{0,9});.+buil/i],[a,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[u,[l,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[u,[l,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[l,u],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[u,l]],os:[[/microsoft (windows) (vista|xp)/i],[l,u],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[l,[u,V,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[l,"Windows"],[u,V,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[u,/_/g,"."],[l,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[l,W],[u,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[u,l],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[l,u],[/\(bb(10);/i],[u,[l,S]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[u,[l,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[u,[l,N+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[u,[l,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[u,[l,"watchOS"]],[/crkey\/([\d\.]+)/i],[u,[l,_+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[l,$],u],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[l,u],[/(sunos) ?([\w\.\d]*)/i],[[l,"Solaris"],u],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[l,u]]},Q=function(p,f){if(typeof p===s&&(f=p,p=t),!(this instanceof Q))return new Q(p,f).getResult();var w=typeof e!==o&&e.navigator?e.navigator:t,v=p||(w&&w.userAgent?w.userAgent:""),b=w&&w.userAgentData?w.userAgentData:t,y=f?function(e,t){var r={};for(var o in e)t[o]&&t[o].length%2==0?r[o]=t[o].concat(e[o]):r[o]=e[o];return r}(H,f):H,T=w&&w.userAgent==v;return this.getBrowser=function(){var e,o={};return o[l]=t,o[u]=t,J.call(o,v,y.browser),o[n]=typeof(e=o[u])===i?e.replace(/[^\d\.]/g,"").split(".")[0]:t,T&&w&&w.brave&&typeof w.brave.isBrave==r&&(o[l]="Brave"),o},this.getCPU=function(){var e={};return e[h]=t,J.call(e,v,y.cpu),e},this.getDevice=function(){var e={};return e[c]=t,e[a]=t,e[d]=t,J.call(e,v,y.device),T&&!e[d]&&b&&b.mobile&&(e[d]=m),T&&"Macintosh"==e[a]&&w&&typeof w.standalone!==o&&w.maxTouchPoints&&w.maxTouchPoints>2&&(e[a]="iPad",e[d]=g),e},this.getEngine=function(){var e={};return e[l]=t,e[u]=t,J.call(e,v,y.engine),e},this.getOS=function(){var e={};return e[l]=t,e[u]=t,J.call(e,v,y.os),T&&!e[l]&&b&&"Unknown"!=b.platform&&(e[l]=b.platform.replace(/chrome os/i,$).replace(/macos/i,W)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return v},this.setUA=function(e){return v=typeof e===i&&e.length>350?G(e,350):e,this},this.setUA(v),this};Q.VERSION="1.0.35",Q.BROWSER=j([l,u,n]),Q.CPU=j([h]),Q.DEVICE=j([a,c,d,p,m,f,g,w,v]),Q.ENGINE=Q.OS=j([l,u]),E.exports&&(R=E.exports=Q),R.UAParser=Q;var X=typeof e!==o&&(e.jQuery||e.Zepto);if(X&&!X.ua){var Y=new Q;X.ua=Y.getResult(),X.ua.get=function(){return Y.getUA()},X.ua.set=function(e){Y.setUA(e);var t=Y.getResult();for(var r in t)X.ua[r]=t[r]}}}("object"==typeof window?window:C);var M=Object.defineProperty,I=(e,t,r)=>(((e,t,r)=>{t in e?M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r);const L="Unknown",k="Safari",P="Firefox",U="Opera",O="Chrome",B="iOS-webview";class D{static getName(){if(!this._name)if("undefined"!=typeof navigator&&navigator){const{userAgent:e}=navigator;e.match(/Firefox/i)?this._name=P:e.match(/(Opera|OPR)/i)?this._name=U:e.match(/Chrome/i)?this._name=O:e.match(/Safari/i)?this._name=k:e.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Version)/i)?this._name=B:this._name=L}else this._name=L;return this._name}static get isMobile(){if(null===this._isMobile&&(this._isMobile=!1,"undefined"!=typeof navigator&&navigator)){const e=navigator.userAgent||navigator.vendor;e&&(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(this._isMobile=!0)}return this._isMobile}static clearCache(){this._name=null,this._isMobile=null}}I(D,"_name",null),I(D,"_isMobile",null);const F=[4215763,14529296,11869460,48895,16468400,45661,13290186];const $=Object.freeze(Object.defineProperty({__proto__:null,getQualitativeColor:function(e){return F[e%F.length]}},Symbol.toStringTag,{value:"Module"})),W=4,j=3,q={wheelchair:{horrible:.1,bad:.5,intermediate:.7,good:.9,excellent:1},default:{horrible:.4,bad:.7,intermediate:.8,good:.9,excellent:1}},K={wheelchair:{asphalt:1,concrete:1,paving_stones:.8,compacted:.7,wood:.6,metal:.5,gravel:.3,grass:.2,ground:.2},default:{asphalt:1,concrete:1,paving_stones:.9,compacted:.8,wood:.8,metal:.7,gravel:.6,grass:.5,ground:.4}},G=class e{constructor(){t(this,"avoidStairs",!1),t(this,"avoidEscalators",!1),t(this,"avoidElevators",!1),t(this,"avoidMovingWalkways",!1),t(this,"avoidTicketRestrictedAreas",!1),t(this,"useMultiLevelSegments",!1),t(this,"projectionMaxDistance"),t(this,"isWheelchair",!1)}setAvoidStairs(e){return this.avoidStairs=e,this}setAvoidEscalators(e){return this.avoidEscalators=e,this}setAvoidElevators(e){return this.avoidElevators=e,this}setAvoidMovingWalkways(e){return this.avoidMovingWalkways=e,this}setAvoidTicketRestrictedAreas(e){return this.avoidTicketRestrictedAreas=e,this}setUseMultiLevelSegments(e){return this.useMultiLevelSegments=e,this}setIsWheelchair(e){return this.isWheelchair=e,this}static fromJson(t){const r=new e;return Object.assign(r,t),r.build()}build(){return{input:{avoidStairs:this.avoidStairs,avoidEscalators:this.avoidEscalators,avoidElevators:this.avoidElevators,avoidMovingWalkways:this.avoidMovingWalkways,avoidTicketRestrictedAreas:this.avoidTicketRestrictedAreas,isWheelchair:this.isWheelchair,projectionMaxDistance:this.projectionMaxDistance},weightEdgeFn:e=>{if(e.properties.isElevator)return 90;const t=this.isWheelchair?j:W;let r=g(e.length,t);if(e.properties.areStairs)r*=3;else if(e.properties.areEscalators)r*=1.5;else if(e.properties.isMovingWalkway)r*=.8;else if(e.properties.smoothness){const t=this.isWheelchair?"wheelchair":"default";r*=q[t][e.properties.smoothness]??1}else if(e.properties.surface){const t=this.isWheelchair?"wheelchair":"default";r*=K[t][e.properties.surface]??1}return r},acceptEdgeFn:e=>{if(e.properties.wheelchair){if(this.isWheelchair&&"no"===e.properties.wheelchair)return!1;if(!this.isWheelchair&&"designated"===e.properties.wheelchair)return!1}if(this.isWheelchair){if(e.properties.areStairs)return!1;if(e.properties.areEscalators)return!1;if(e.properties.isMovingWalkway)return!1}return(!this.avoidStairs||!e.properties.areStairs)&&((!this.avoidEscalators||!e.properties.areEscalators)&&((!this.avoidElevators||!e.properties.isElevator)&&((!this.avoidMovingWalkways||!e.properties.isMovingWalkway)&&(!this.avoidTicketRestrictedAreas||!e.properties.needTicket))))},projectionMaxDistance:this.projectionMaxDistance,useMultiLevelSegments:this.useMultiLevelSegments}}};t(G,"DEFAULT",(new G).build()),t(G,"WITHOUT_STAIRS",(new G).setAvoidStairs(!0).build()),t(G,"WHEELCHAIR",(new G).setIsWheelchair(!0).build());let J=G;class V{constructor(e,t,r,o,s){this.prev=e,this.dist=t,this.source=r,this.targets=o,this.edges=s}routeVertices(e=this.targets[0],t=[]){const r=this.prev[e.id];return null===r?this.source===e?[...t,e]:[]:[...this.routeVertices(r,t),e]}weightedDistance(e=this.targets[0]){const t=this.dist[e.id];return t===Number.MAX_VALUE?null:t}route(e=this.targets[0]){const t=this.routeVertices(e),r=[],o=[];for(let s=1;s<t.length;s++){const e=t[s-1],i=t[s],n=u.getEdgeByVertices(this.edges,e,i),a=new u(e,i,Object.assign({},n.properties));n.vertex1===a.vertex2&&a.reverseProperties(),r.push(a),o.push(this.dist[i.id]-this.dist[e.id])}return new T(this.source.coords,e.coords,t,r,o)}toGeoJson(e){return{type:"FeatureCollection",features:[...e.vertices.map((e=>{const t=this.prev[e.id],r=this.dist[e.id],o=e===this.source,s=this.targets.includes(e),i=e.coords.level;return{type:"Feature",properties:{id:e.id,...t&&{prev:t.id},dist:r===Number.MAX_VALUE?"infinity":r,...o&&{name:"source"},...s&&{name:"target"},...null!==i&&{level:i},...e.properties},geometry:{type:"Point",coordinates:[e.coords.lng,e.coords.lat]}}})),...e.edges.map((e=>{const t=e.level;return{type:"Feature",properties:{id:e.id,...null!==t&&{level:t},...e.properties},geometry:{type:"LineString",coordinates:[[e.vertex1.coords.lng,e.vertex1.coords.lat],[e.vertex2.coords.lng,e.vertex2.coords.lat]]}}}))]}}}class z{constructor(e){t(this,"disabledEdges",new Set),this.graph=e;let r=0;e.vertices.forEach((e=>e.id=r++))}calculateShortestPathToMultipleDestinationsByVertex(e,t,r=J.DEFAULT,o=this.graph.vertices,s=this.graph.edges){const i=new Set(o),n=Array(i.size).fill(Number.MAX_VALUE),a=new Array(i.size).fill(null),l=s.filter((e=>{var t;return((null==(t=r.acceptEdgeFn)?void 0:t.call(r,e))??!0)&&!this.disabledEdges.has(e)})),d=r.weightEdgeFn||(e=>e.length),c=e=>{let t=Number.MAX_VALUE,r=null;return e.forEach((e=>{const o=n[e.id];o<=t&&(t=o,r=e)})),r},u=new Set(t);for(n[e.id]=0;i.size>0;){const e=c(i);if(i.delete(e),t.includes(e)&&(u.delete(e),0===u.size))break;l.filter((t=>t.vertex1==e||!t.properties.isOneway&&t.vertex2==e)).forEach((t=>{const r=e===t.vertex1?t.vertex2:t.vertex1,o=d(t),s=n[e.id]+o;s<n[r.id]&&(n[r.id]=s,a[r.id]=e)}))}return new V(a,n,e,t,l)}calculateShortestPathByVertex(e,t,r=J.DEFAULT,o=this.graph.vertices,s=this.graph.edges){return this.calculateShortestPathToMultipleDestinationsByVertex(e,[t],r,o,s)}calculateComponents(){function e(e){const t=e.values().next().value;return e.delete(t),t}const t=new Set(this.graph.vertices);let r,o=[];for(;t.size>0;){const r=e(t),s=this.graph.vertices.filter((e=>e.id!==r.id)),i=this.calculateShortestPathToMultipleDestinationsByVertex(r,s),n=s.filter((e=>null!==i.weightedDistance(e)));o.push([r,...n]),n.forEach((e=>t.delete(e)))}do{r=!1;for(let e=0;e<o.length-1;e++){const t=o[e];for(let s=e+1;s<o.length;s++){const e=o[s];e.some((e=>t.includes(e)))&&(t.push(...e),o=o.filter((t=>t!==e)),r=!0)}}}while(r);return o.map((e=>[...new Set(e)]))}toGeoJson(){return{type:"FeatureCollection",features:this.calculateComponents().map(((e,t)=>({type:"Feature",geometry:{type:"MultiLineString",coordinates:this.graph.edges.filter((t=>e.includes(t.vertex1)&&e.includes(t.vertex2))).map((e=>[[e.vertex1.coords.lng,e.vertex1.coords.lat],[e.vertex2.coords.lng,e.vertex2.coords.lat]]))},properties:{stroke:"#"+$.getQualitativeColor(t).toString(16)}})))}}}class H extends V{constructor(e,t,r){super(e.prev,e.dist,e.source,e.targets,e.edges),this.sourceProjection=t,this.targetsProjections=r}static createEmpty(e,t){const r=t.length,o=new V(new Array(r).fill(null),new Array(r).fill(Number.MAX_VALUE),new p(e),t.map((e=>new p(e))),[]),s=[e,null],i=t.map((e=>[e,null]));return new H(o,s,i)}routeVertices(e=this.targetsProjections[0][0]){var t;if(e instanceof p)return super.routeVertices(e);if(!this.sourceProjection[1])return[];const r=null==(t=this.targetsProjections.find((([t])=>t===e)))?void 0:t[1];return r?super.routeVertices(r):[]}weightedDistance(e=this.targetsProjections[0][0]){var t;if(e instanceof p)return super.weightedDistance(e);if(!this.sourceProjection[1])return null;const r=null==(t=this.targetsProjections.find((([t])=>t===e)))?void 0:t[1];return r?super.weightedDistance(r):null}route(e=this.targetsProjections[0][0]){var t;if(e instanceof p)return super.route(e);const r=null==(t=this.targetsProjections.find((([t])=>t===e)))?void 0:t[1];if(!r)return new T(this.sourceProjection[0],e,[],[],[]);const o=super.route(r);return o.start=this.sourceProjection[0],o.end=e,o}}class Q extends z{calculateShortestPathToMultipleDestinations(e,t,r=J.DEFAULT){const o=new Set,s=new Set,i=[],n={maxDistance:r.projectionMaxDistance,acceptEdgeFn:r.acceptEdgeFn,useMultiLevelSegments:r.useMultiLevelSegments},a=e=>{const t=this.graph.getProjection(e,n);if(null===t)return null;if(t.nearestElement instanceof p)return t.nearestElement;if(t.nearestElement instanceof u){const e=t.nearestElement,r=new p(t.coords,{name:`proj on ${e.properties.name||null} (tmp)`,...void 0!==e.properties.externalId&&{externalId:e.properties.externalId}});r.id=this.graph.vertices.length+o.size;const n={...e.properties,...void 0!==e.properties.externalId&&{externalId:e.properties.externalId}},a=new u(e.vertex1,r,n),l=new u(r,e.vertex2,n);o.add(r),s.add(a),s.add(l);const d=i.find((t=>t[0]===e));return d?d[1].push(r):i.push([e,[r]]),r}return null},l=a(e);if(!l)return H.createEmpty(e,t);const d=t.map((e=>[e,a(e)])),c=d.map((([,e])=>e)).filter((e=>null!==e));i.filter((e=>e[1].length>=2)),i.forEach((([e,t])=>{const r={...e.properties,name:`splitted ${e.properties.name||null} (tmp)`};for(let o=0;o<t.length;o++){const i=t[o],n=i.distanceTo(e.vertex1);for(let a=o+1;a<t.length;a++){const o=t[a],l=o.distanceTo(e.vertex1)<n?new u(o,i,r):new u(i,o,r);s.add(l)}}}));const h=this.calculateShortestPathToMultipleDestinationsByVertex(l,c,r,[...this.graph.vertices,...o],[...this.graph.edges,...s]);return new H(h,[e,l],d)}calculateShortestPath(e,t,r=J.DEFAULT){return this.calculateShortestPathToMultipleDestinations(e,[t],r)}getShortestTrip(e,t,r=.99){const o=e.map((e=>{const t=new i.Point(0,0);return t.coords=e,t})),s=[],n=i.solve(o,r,void 0,((e,r)=>{const o=this.calculateShortestPath(e.coords,r.coords,t).route();return s.push(o),o.hasRoute?o.edgesWeights.reduce(((e,t)=>e+t),0):Number.MAX_VALUE})).map((e=>o[e])),a=[];for(let i=0;i<n.length;i++){const e=n[i],t=n[(i+1)%n.length];let r=s.find((r=>r.start===e.coords&&r.end===t.coords||r.end===e.coords&&r.start===t.coords));(null==r?void 0:r.end)===e.coords&&(r=r.reverse()),r&&a.push(r)}return a.some((e=>!e.hasRoute))?[]:a}}class X extends Error{constructor(e,t,r=null){super(),this.start=e,this.end=t,this.details=r}get startStr(){return this.start instanceof p?`Vertex ${this.start.coords.toString()}`:this.start.toString()}get endStr(){return this.end instanceof p?`Vertex ${this.end.coords.toString()}`:Array.isArray(this.end)?this.end.map((e=>e instanceof p?e.coords.toString():e.toString())).join(","):this.end.toString()}get message(){let e=`No route found from ${this.startStr} to ${this.endStr}.`;return this.details&&(e+=` Details: ${this.details}`),e}}const Y=class e{static parseNodeProperties(e){return{...e.name&&{name:e.name},...e.id&&{externalId:e.id},...e.isGate&&{isGate:e.isGate},...e.isSubwayEntrance&&{isSubwayEntrance:e.isSubwayEntrance},...e.subwayEntranceRef&&{subwayEntrsanceRef:e.subwayEntranceRef}}}static parseWayProperties(e){return{...e.name&&{name:e.name},...e.id&&{externalId:e.id},...e.isOneway&&{isOneway:e.isOneway},...e.areStairs&&{areStairs:e.areStairs},...e.isElevator&&{isElevator:e.isElevator},...e.areEscalators&&{areEscalators:e.areEscalators},...e.isMovingWalkway&&{isMovingWalkway:e.isMovingWalkway},...e.needTicket&&{needTicket:e.needTicket},...e.incline&&{incline:e.incline},...e.wheelchair&&{wheelchair:e.wheelchair},...e.smoothness&&{smoothness:e.smoothness},...e.surface&&{surface:e.surface}}}static createGraphFromOsmModel(t,o=e.DEFAULT_WAY_SELECTOR,s){const i=[],a=[],l=[],d=(e,t)=>{var o;let s=(null==(o=a.find((([o,s])=>o===e.id&&(!!r.Level.intersect(s.coords.level,t)||(null===s.coords.level||null===t)))))?void 0:o[1])||null;if(s)return r.Level.equals(s.coords.level,t)||(s.coords.level=r.Level.intersection(s.coords.level,t),null===s.coords.level&&(s.coords.level=t)),s;const i=new r.Coordinates(e.coords.lat,e.coords.lng,null,t);if(s=new p(i,this.parseNodeProperties(e)),a.push([e.id,s]),e.isElevator){let t=l.find((([t])=>e.id===t));t||(t=[e.id,e.name,[]],l.push(t)),t[2].push(s)}return s};t.ways.forEach((e=>{if(!o(e))return;const t=this.parseWayProperties(e),s=r=>{for(let o=1;o<e.nodes.length;o++){let s=d(e.nodes[o-1],r),n=d(e.nodes[o],r);if(e.isOnewayBackward){const e=n;n=s,s=e}const a=new u(s,n,t);i.push(a)}};s(e.level),"repeat_on"in e.tags&&e.tags.repeat_on.split(";").map(r.Level.fromString).forEach(s)}));let c=-1;return t.ways.filter((e=>e.isElevator&&e.isGeometryClosed)).forEach((e=>{const t=e.nodes.map((e=>a.filter((([t])=>t===e.id)).map((e=>e[1])))).flat(),o=e.nodes.reduce(((e,t)=>[e[0]+t.coords.lat,e[1]+t.coords.lng]),[0,0]).map((t=>t/e.nodes.length)),s=t.reduce(((e,t)=>r.Level.union(e,t.coords.level)),null),l=new r.Coordinates(o[0],o[1],null,s),h=new n.OsmNode(c--,l,{highway:"elevator"});t.forEach((t=>{const r=d(h,t.coords.level);i.push(new u(r,t,{externalId:e.id}))}))})),l.forEach((([e,t,r])=>{const o={name:t,isElevator:!0,externalId:e};for(let s=0;s<r.length;s++)for(let e=s+1;e<r.length;e++)i.push(new u(r[s],r[e],o));if(1===r.length&&null===r[0].coords.level){const e=r[0],t=i.filter((t=>t.vertex1===e||t.vertex2===e));if(t.length>1){const r=[e];for(let o=1;o<t.length;o++){const s=new p(e.coords,e.properties);a.push([e.id,s]),t[o].vertex1===e?t[o].vertex1=s:t[o].vertex2=s,r.push(s)}for(let e=0;e<r.length;e++)for(let t=e+1;t<r.length;t++)i.push(new u(r[e],r[t],o))}}})),null==s||s(a),new m(a.map((e=>e[1])),i)}};t(Y,"RESTRICTED_PEDESTRIANS_HIGHWAYS",["motorway","motorway_link"]),t(Y,"DEFAULT_WAY_SELECTOR",(e=>{if(e.isArea)return!1;if("yes"===e.tags.foot)return!0;if(["no","private"].includes(e.tags.access))return!1;const t="elevator"===e.tags.highway&&e.isGeometryClosed;return e.tags.highway&&!Y.RESTRICTED_PEDESTRIANS_HIGHWAYS.includes(e.tags.highway)&&!t||"sidewalk"===e.tags.footway||"platform"===e.tags.public_transport||"platform"===e.tags.railway}));let Z=Y;class ee{}var te=(e=>(e[e.OK=0]="OK",e[e.CANCELLED=1]="CANCELLED",e[e.UNKNOWN=2]="UNKNOWN",e[e.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",e[e.NOT_FOUND=5]="NOT_FOUND",e[e.UNIMPLEMENTED=12]="UNIMPLEMENTED",e[e.INTERNAL=13]="INTERNAL",e[e.UNAVAILABLE=14]="UNAVAILABLE",e[e.UNAUTHENTICATED=16]="UNAUTHENTICATED",e))(te||{});class re extends Error{constructor(e=te.UNKNOWN,r){super(r),t(this,"customMapName"),this.code=e}static notFound(e){return new re(te.NOT_FOUND,`Cannot found an itinerary. Details: ${e}`)}}class oe extends re{constructor(e=te.UNKNOWN,t,r){super(e,r),this.code=e,this.mapName=t,this.mapName=t}static notFound(e,t){return new oe(te.NOT_FOUND,e,`Cannot found an itinerary in map ${e}. Details: ${t||"No details"}`)}}class se extends re{constructor(e=te.UNKNOWN,t,r){super(e,r),this.code=e,this.routerName=t,this.routerName=t}static notFound(e,t){return new se(te.NOT_FOUND,e,`Cannot found an itinerary with ${e}. Details: ${t||"No details"}`)}static missingApiKey(e,t){return new se(te.UNAUTHENTICATED,e,`API key is missing for ${e}. Details: ${t}`)}static unreachableServer(e,t){return new se(te.NOT_FOUND,e,`Remote router server ${e} is unreachable. URL: ${t}`)}static responseNotParsing(e,t){return new se(te.NOT_FOUND,e,`Remote router server response ${e} cannot be parsed. URL: ${t}`)}static travelModeUnimplemented(e,t){return new se(te.UNIMPLEMENTED,e,`Travel mode "${t}" is not implemented for ${e}`)}}function ie(e,t,r,o,s,i,n="Europe/Paris"){const a=new Date(Date.UTC(e,t,r,o,s,i)),l=new Date(a.toLocaleString("en-US",{timeZone:"UTC"})),d=new Date(a.toLocaleString("en-US",{timeZone:n})),c=l.getTime()-d.getTime();return a.setTime(a.getTime()+c),a}function ne(e){return new r.Coordinates(e.Lat,e.Long)}function ae(e){const[t,r]=e.split(" "),[o,s,i]=t.split("/"),[n,a,l]=r.split(":");return ie(Number(i),Number(s)-1,Number(o),Number(n),Number(a),Number(l)).getTime()}const le=new Map;le.set("CAR","Car"),le.set("WALK","Walk"),le.set("BIKE","Bike"),le.set("TRANSIT","PT");const de=new Map;de.set("WALK","WALK"),de.set("BICYCLE","BIKE"),de.set("TRAMWAY","TRAM"),de.set("METRO","METRO"),de.set("FUNICULAR","FUNICULAR"),de.set("BUS","BUS"),de.set("COACH","BUS"),de.set("SCHOOL","BUS"),de.set("BUS_PMR","BUS"),de.set("MINIBUS","BUS"),de.set("TROLLEY_BUS","BUS"),de.set("TAXIBUS","BUS"),de.set("SHUTTLE","BUS"),de.set("TRAIN","TRAIN"),de.set("HST","TRAIN"),de.set("LOCAL_TRAIN","TRAIN"),de.set("AIR","AIRPLANE"),de.set("FERRY","BOAT"),de.set("TAXI","UNKNOWN"),de.set("CAR_POOL","UNKNOWN"),de.set("PRIVATE_VEHICLE","CAR"),de.set("SCOOTER","MOTO");const ce=new Map;function ue(e){const t=e.match(/LINESTRING ?\((.*)\)/i),o=e.match(/POINT ?\((.*)\)/i);if(o){const[e,t]=o[1].split(" ");return[new r.Coordinates(Number(t),Number(e))]}return t[1].split(",").map((e=>{const t=e.trim().split(" ");return new r.Coordinates(Number(t[1]),Number(t[0]))}))}ce.set(0,"BUS"),ce.set(1,"WALK"),ce.set(2,"BIKE"),ce.set(3,"CAR"),ce.set(4,"UNKNOWN"),ce.set(5,"UNKNOWN"),ce.set(6,"UNKNOWN"),ce.set(7,"UNKNOWN"),ce.set(8,"UNKNOWN"),ce.set(9,"UNKNOWN"),ce.set(10,"UNKNOWN"),ce.set(11,"UNKNOWN"),ce.set(12,"UNKNOWN"),ce.set(13,"UNKNOWN"),ce.set(14,"UNKNOWN");const he=new class extends ee{get rname(){return"cityway"}async getItineraries(e,t){const r=this.getURL(e,t),o=await fetch(r).catch((()=>{throw se.unreachableServer(this.rname,r)})),s=await o.json().catch((()=>{throw se.responseNotParsing(this.rname,r)}));return this.parseResponse(s)}getURL(e,t){const{origin:r,destination:o,travelMode:i,waypoints:n}=t,a=le.get(i);if(!a)throw se.travelModeUnimplemented(this.rname,i);(n||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==n?void 0:n.length})`);const l=`DepartureLatitude=${r.latitude}&DepartureLongitude=${r.longitude}`,d=`ArrivalLatitude=${o.latitude}&ArrivalLongitude=${o.longitude}`,c=`TripModes=${a}`,u=new URL(e);let{search:h}=u;return h=(h?`${h}&`:"?")+`${l}&${d}&${c}`,`${u.origin}${u.pathname}${h}`}parseResponse(e){if(200!==e.StatusCode||!e.Data||!e.Data.length)throw se.notFound(this.rname,e.Message);const t=[],r=e.Data.map((e=>e.response.trips.Trip.map((t=>({...t,...e.hasOwnProperty("PlanTripType")&&{PlanTripType:e.PlanTripType}}))))).flat();e:for(const o of r){if(o.hasOwnProperty("PlanTripType")&&"UNKNOWN"===ce.get(o.PlanTripType))continue;const e=[];for(const t of o.sections.Section){const r=t.Leg?t.Leg:t.PTRide,i=de.get(r.TransportMode),n=[];let a,l,d;const c=new x;if("UNKNOWN"===i)continue e;if("WALK"===i||"BIKE"===i||"CAR"===i){a={name:r.Departure.Site.Name,coords:ne(r.Departure.Site.Position)},l={name:r.Arrival.Site.Name,coords:ne(r.Arrival.Site.Position)};for(const e of r.pathLinks.PathLink){let t;t=e.Geometry&&"Null"!==e.Geometry?ue(e.Geometry):[a.coords,l.coords],t.forEach(((e,t)=>{0===t&&0!==n.length&&n[n.length-1].equals(e)||n.push(e)})),c.addStepInfo({coords:t[0],distance:e.Distance,name:e.Departure.Site.Name})}t===o.sections.Section[o.sections.Section.length-1]&&c.addStepInfo({coords:n[n.length-1]})}else{if(!f(i)){s.warn(`[CitywayParser] Unknown leg mode: ${r.TransportMode}`);continue}{a={name:r.Departure.StopPlace.Name,coords:ne(r.Departure.StopPlace.Position)},l={name:r.Arrival.StopPlace.Name,coords:ne(r.Arrival.StopPlace.Position)};let e=r.Line.Number;"TRAM"===i&&e.toLowerCase().includes("tram")&&(e=e.substr(5)),d={name:e,routeColor:r.Line.Color,routeTextColor:r.Line.TextColor,directionName:r.Destination};for(const t of r.steps.Step){ue(t.Geometry).forEach(((e,t)=>{0===t&&0!==n.length&&n[n.length-1].equals(e)||n.push(e)}))}c.addStepInfo({coords:n[0],name:r.Line.Name,distance:r.Distance})}}c.setStart(a.coords),c.setEnd(l.coords),c.setPathCoords(n);const u=new _({transitMode:i,duration:this.parseDuration(r.Duration),startTime:ae(r.Departure.Time),endTime:ae(r.Arrival.Time),coords:n,start:a,end:l,transportInfo:d,steps:c.build()});e.push(u)}const r=new N({duration:this.parseDuration(o.Duration),startTime:ae(o.Departure.Time),origin:ne(o.Departure.Site.Position),endTime:ae(o.Arrival.Time),destination:ne(o.Arrival.Site.Position),legs:e});t.push(r)}return t}parseDuration(e){const t=e.match(/(-)?P(?:([.,\d]+)Y)?(?:([.,\d]+)M)?(?:([.,\d]+)W)?(?:([.,\d]+)D)?T(?:([.,\d]+)H)?(?:([.,\d]+)M)?(?:([.,\d]+)S)?/),r=void 0===t[2]?0:Number(t[2]),o=void 0===t[3]?0:Number(t[3]),s=void 0===t[4]?0:Number(t[4]),i=void 0===t[5]?0:Number(t[5]),n=void 0===t[6]?0:Number(t[6]),a=void 0===t[7]?0:Number(t[7]);return(void 0===t[8]?0:Number(t[8]))+60*a+3600*n+86400*i+604800*s+2592e3*o+31557600*r}},pe=new Map;pe.set("Air","AIRPLANE"),pe.set("Boat","BOAT"),pe.set("Bus","BUS"),pe.set("BusRapidTransit","BUS"),pe.set("Coach","BUS"),pe.set("Ferry","FERRY"),pe.set("Funicular","FUNICULAR"),pe.set("LocalTrain","TRAIN"),pe.set("LongDistanceTrain","TRAIN"),pe.set("Metro","METRO"),pe.set("Métro","METRO"),pe.set("RailShuttle","TRAIN"),pe.set("RapidTransit","BUS"),pe.set("Shuttle","BUS"),pe.set("SuspendedCableCar","FUNICULAR"),pe.set("Taxi","TAXI"),pe.set("Train","TRAIN"),pe.set("RER","TRAIN"),pe.set("Tramway","TRAM"),pe.set("walking","WALK"),pe.set("bike","BIKE");const me=["physical_mode:Air","physical_mode:Boat","physical_mode:Bus","physical_mode:BusRapidTransit","physical_mode:Coach","physical_mode:Ferry","physical_mode:Funicular","physical_mode:LocalTrain","physical_mode:LongDistanceTrain","physical_mode:Metro","physical_mode:RailShuttle","physical_mode:RapidTransit","physical_mode:Shuttle","physical_mode:SuspendedCableCar","physical_mode:Taxi","physical_mode:Train","physical_mode:Tramway"];function ge(e){return new r.Coordinates(Number(e.lat),Number(e.lon))}function fe(e){return e[e.length-1]}function we(e,t){const r=e.substr(0,4),o=e.substr(4,2),s=e.substr(6,2),i=e.substr(9,2),n=e.substr(11,2),a=e.substr(13,2);return ie(Number(r),Number(o)-1,Number(s),Number(i),Number(n),Number(a),t).getTime()}const ve=new class extends ee{get rname(){return"navitia"}async getItineraries(e,t){const r=this.getURL(e,t),o=r.searchParams.get("api_key");if(!o)throw se.missingApiKey(this.rname);const s=await fetch(r,{method:"GET",headers:{Authorization:o}}).catch((()=>{throw se.unreachableServer(this.rname,r.toString())})),i=await s.json().catch((()=>{throw se.responseNotParsing(this.rname,r.toString())}));if(i&&i.error)throw se.notFound(this.rname,i.error.message);const n=this.parseResponse(i);if(!n.some((e=>w(e.transitMode,t.travelMode))))throw se.notFound(this.rname,"Selected mode of transport was not found for this itinerary.");return n}getURL(e,t){var r;const{origin:o,destination:i,waypoints:n,travelMode:a}=t;(n||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==n?void 0:n.length})`);const l=new URL(e),d=new URLSearchParams;d.set("from",`${o.longitude};${o.latitude}`),d.set("to",`${i.longitude};${i.latitude}`),d.set("data_freshness","realtime"),(null==(r=t.itineraryModifiers)?void 0:r.isWheelchair)&&d.set("wheelchair","true");let c=new URLSearchParams;switch(a){case"WALK":c=this.getWalkingQuery();break;case"BIKE":c=this.getBikeQuery();break;case"CAR":c=this.getCarQuery()}return[d,c].map((e=>{for(const t of e.entries())l.searchParams.append(t[0],t[1])})),l}getCarQuery(){const e=new URLSearchParams;return me.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("first_section_mode[]","car"),e.append("last_section_mode[]","walking"),e.append("last_section_mode[]","car"),e}getWalkingQuery(){const e=new URLSearchParams;return me.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("last_section_mode[]","walking"),e}getBikeQuery(){const e=new URLSearchParams;return me.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","bike"),e.append("last_section_mode[]","bike"),e}getSectionCoords(e){let t,r;return t="stop_point"in e.from?e.from.stop_point.coord:"address"in e.from?e.from.address.coord:e.from.poi.coord,r="stop_point"in e.to?e.to.stop_point.coord:"address"in e.to?e.to.address.coord:e.to.poi.coord,{from:ge(t),to:ge(r)}}findStepsCoord(e,t){const o=e,s=[...o];let i=t[0],n=0;const a=[];for(const[l,d]of t.entries()){let e,c;if(0===l)c=0,e=o[0];else if(l===t.length-1)c=o.length-1,e=fe(o);else if(1===s.length)n++,c=n,e=s[0],o[c]=e;else{const t=r.Utils.trimRoute(s,s[0],i.distance);n+=t.length-1,s.splice(0,t.length-1),c=n,e=fe(t),o[c]=e}a.push({...d,coords:e}),i=d}return a}findStepCoords(e,t){var r;if("instruction_start_coordinate"in e)return ge(e.instruction_start_coordinate);const o=null==(r=t.vias)?void 0:r.find((t=>t.id===e.via_uri));return o?ge(o.access_point.coord):void 0}parseResponse(e){var t;if(!e||!e.journeys)throw se.notFound(this.rname,null==(t=e.error)?void 0:t.message);const o=[],s=e.context.timezone;for(const i of e.journeys){const e=[];for(const o of i.sections){if("waiting"===o.type||"transfer"===o.type)continue;const{from:t,to:i}=this.getSectionCoords(o);let n=[];const a=o.geojson.coordinates.reduce(((e,[t,o])=>(n.includes(`${t}-${o}`)||(n=n.concat(`${t}-${o}`),e.push(new r.Coordinates(o,t))),e)),[]),l=(new x).setStart(t).setEnd(i).setPathCoords(a);let d,c=pe.get(o.mode);if(o.path){const e=o.path.every((e=>"instruction_start_coordinate"in e||e.via_uri)),t=[];for(const r of o.path){let s;if(e){s=this.findStepCoords(r,o);const e={name:r.name,distance:r.length,coords:s};l.addStepInfo(e)}else t.push({name:r.name,distance:r.length})}e||l.setStepsInfo(this.findStepsCoord(a,t))}if("public_transport"===o.type){d={name:o.display_informations.code,routeColor:o.display_informations.color,routeTextColor:o.display_informations.text_color,directionName:o.display_informations.direction},c=pe.get(o.display_informations.physical_mode);const e={coords:a[0],name:d.directionName,distance:o.geojson.properties[0].length};l.setStepsInfo([e])}const u=new _({transitMode:c,duration:o.duration,startTime:we(o.departure_date_time,s),endTime:we(o.arrival_date_time,s),start:{name:o.from.name,coords:t},end:{name:o.to.name,coords:i},coords:a,transportInfo:d,steps:l.build()});e.push(u)}const t=new N({duration:i.duration,startTime:we(i.departure_date_time,s),endTime:we(i.arrival_date_time,s),origin:this.getSectionCoords(i.sections[0]).from,destination:this.getSectionCoords(fe(i.sections)).to,legs:e});o.push(t)}return o}};const be=new class extends ee{get rname(){return"deutsche-bahn"}async getItineraries(e,t){const r=this.getURL(e,t),o=await fetch(r).catch((()=>{throw se.unreachableServer(this.rname,r)})),s=await o.json().catch((()=>{throw se.responseNotParsing(this.rname,r)}));return this.parseResponse(s,t.origin,t.destination)}getURL(e,t){let o=e+"/route/v1/walking/";return o+=[t.origin,...t.waypoints||[],t.destination].map((e=>{if(null!==e.level){const t=r.Level.isRange(e.level)?e.level[0]:e.level;return e.longitude+","+e.latitude+","+t}return e.longitude+","+e.latitude})).join(";"),o+="?geometries=geojson&overview=full&steps=true",o}parseResponse(e,t,o){if(!e.segments)throw se.notFound(this.rname);const s=e.segments.map((e=>{const t=r.Level.union(e.fromLevel,e.toLevel),o=e.polyline.map((({lon:e,lat:o})=>new r.Coordinates(o,e,null,t)));return new _({transitMode:"WALK",coords:o,start:{coords:o[0]},end:{coords:o[o.length-1]}})}));return[new N({origin:t,destination:o,legs:s})]}};function ye(e){const t=e[0];return e.slice(1).map((e=>{const r={};return t.forEach(((t,o)=>{r[t]=e[o]})),r}))}const Te=new Map;Te.set("BIKE","BIKE"),Te.set("PEDESTRIAN","WALK");function Se(e){return new r.Coordinates(e.latitude,e.longitude)}function xe(e){return e[e.length-1]}const _e=new class extends ee{get rname(){return"geovelo"}async getItineraries(e,t){const r=this.getQueryParams(),o=this.getBodyParams(t),s=new URL(e);for(const[a,l]of Object.entries(r))s.searchParams.append(a,l.toString());const i=await fetch(s,{method:"POST",headers:{apiKey:"qWHj6ax6DMttG8DX6tH9CQARaiTgQ1Di","Content-Type":"application/json"},body:JSON.stringify(o)}).catch((()=>{throw se.unreachableServer(this.rname,s.toString())})),n=await i.json().catch((()=>{throw se.responseNotParsing(this.rname,s.toString())}));if(!n||0===n.length)throw se.notFound(this.rname,"No itineraries found.");return this.parseResponse(n)}getQueryParams(){return{instructions:!0,elevations:!1,geometry:!0,single_result:!1,bike_stations:!1,objects_as_ids:!1,merge_instructions:!0,show_pushing_bike_instructions:!1}}getBodyParams(e){const{origin:t,destination:r,waypoints:o}=e;let s=[];return s=o&&o.length>1?o.map((e=>({longitude:e.longitude,latitude:e.latitude}))):[{latitude:t.latitude,longitude:t.longitude},{latitude:r.latitude,longitude:r.longitude}],{transportModes:["BIKE"],waypoints:s}}parseResponse(e){if(!e||!e.length)throw se.notFound(this.rname);const t=[];for(const o of e){const e=[];for(const t of o.sections){const o=Se(t.waypoints[0]),s=Se(xe(t.waypoints)),i=a.toGeoJSON(t.geometry,6);let n=[];const l=i.coordinates.reduce(((e,[t,o])=>(n.includes(`${t}-${o}`)||(n=n.concat(`${t}-${o}`),e.push(new r.Coordinates(o,t))),e)),[]),d=(new x).setStart(o).setEnd(s).setPathCoords(l),c=Te.get(t.transportMode),u=ye(t.details.instructions);for(const e of u){const{geometryIndex:t,roadLength:o,roadName:s}=e,n=i.coordinates[t],a={name:s,distance:o,coords:new r.Coordinates(n[1],n[0])};d.addStepInfo(a)}const h=new _({transitMode:c,duration:t.duration,startTime:new Date(t.estimatedDatetimeOfDeparture).getTime(),endTime:new Date(t.estimatedDatetimeOfArrival).getTime(),start:{coords:o},end:{coords:s},coords:l,steps:d.build()});e.push(h)}const s=new N({duration:o.duration,startTime:new Date(o.estimatedDatetimeOfDeparture).getTime(),endTime:new Date(o.estimatedDatetimeOfArrival).getTime(),origin:Se(o.waypoints[0]),destination:Se(xe(o.waypoints)),legs:e});t.push(s)}return t}},Ne=new Map;Ne.set("Air","AIRPLANE"),Ne.set("Boat","BOAT"),Ne.set("Bus","BUS"),Ne.set("BusRapidTransit","BUS"),Ne.set("Coach","BUS"),Ne.set("Ferry","FERRY"),Ne.set("Funicular","FUNICULAR"),Ne.set("LocalTrain","TRAIN"),Ne.set("LongDistanceTrain","TRAIN"),Ne.set("Metro","METRO"),Ne.set("Métro","METRO"),Ne.set("RailShuttle","TRAIN"),Ne.set("RapidTransit","BUS"),Ne.set("Shuttle","BUS"),Ne.set("SuspendedCableCar","FUNICULAR"),Ne.set("Taxi","TAXI"),Ne.set("Train","TRAIN"),Ne.set("RER","TRAIN"),Ne.set("Tramway","TRAM"),Ne.set("walking","WALK"),Ne.set("bike","BIKE");const Ee=["physical_mode:Air","physical_mode:Boat","physical_mode:Bus","physical_mode:BusRapidTransit","physical_mode:Coach","physical_mode:Ferry","physical_mode:Funicular","physical_mode:LocalTrain","physical_mode:LongDistanceTrain","physical_mode:Metro","physical_mode:RailShuttle","physical_mode:RapidTransit","physical_mode:Shuttle","physical_mode:SuspendedCableCar","physical_mode:Taxi","physical_mode:Train","physical_mode:Tramway"];function Re(e){return new r.Coordinates(Number(e.lat),Number(e.lon))}function Ce(e){return e[e.length-1]}function Ae(e,t){const r=e.substr(0,4),o=e.substr(4,2),s=e.substr(6,2),i=e.substr(9,2),n=e.substr(11,2),a=e.substr(13,2);return ie(Number(r),Number(o)-1,Number(s),Number(i),Number(n),Number(a),t).getTime()}const Me=new class extends ee{get rname(){return"idfm"}async getItineraries(e,t){const{travelMode:r}=t;if("BIKE"===r)return _e.getItineraries("https://idfm.getwemap.com/marketplace/computedroutes",t);const o=this.getURL(e,t),s=await fetch(o,{method:"GET",headers:{apiKey:"qWHj6ax6DMttG8DX6tH9CQARaiTgQ1Di"}}).catch((()=>{throw se.unreachableServer(this.rname,o)})),i=await s.json().catch((()=>{throw se.responseNotParsing(this.rname,o)}));if(i&&i.error)throw se.notFound(this.rname,i.error.message);const n=this.parseResponse(i);if(!n.some((e=>w(e.transitMode,t.travelMode))))throw se.notFound(this.rname,"Selected mode of transport was not found for this itinerary.");return n}getURL(e,t){var r;const{origin:o,destination:i,waypoints:n,travelMode:a}=t;(n||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==n?void 0:n.length})`);const l=new URL(e),d=new URLSearchParams;d.set("from",`${o.longitude};${o.latitude}`),d.set("to",`${i.longitude};${i.latitude}`),d.set("data_freshness","realtime"),(null==(r=t.itineraryModifiers)?void 0:r.isWheelchair)&&d.set("wheelchair","true");let c=new URLSearchParams;switch(a){case"WALK":c=this.getWalkingQuery();break;case"BIKE":c=this.getBikeQuery();break;case"CAR":c=this.getCarQuery()}return[d,c].map((e=>{for(const t of e.entries())l.searchParams.append(t[0],t[1])})),l.toString()}getCarQuery(){const e=new URLSearchParams;return Ee.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("first_section_mode[]","car"),e.append("last_section_mode[]","walking"),e.append("last_section_mode[]","car"),e}getWalkingQuery(){const e=new URLSearchParams;return Ee.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","walking"),e.append("last_section_mode[]","walking"),e}getBikeQuery(){const e=new URLSearchParams;return Ee.forEach((t=>{e.append("forbidden_uris[]",t)})),e.append("first_section_mode[]","bike"),e.append("last_section_mode[]","bike"),e}getSectionCoords(e){let t,r;return t="stop_point"in e.from?e.from.stop_point.coord:"address"in e.from?e.from.address.coord:e.from.poi.coord,r="stop_point"in e.to?e.to.stop_point.coord:"address"in e.to?e.to.address.coord:e.to.poi.coord,{from:Re(t),to:Re(r)}}findStepsCoord(e,t){const o=e,s=[...o];let i=t[0],n=0;const a=[];for(const[l,d]of t.entries()){let e,c;if(0===l)c=0,e=o[0];else if(l===t.length-1)c=o.length-1,e=Ce(o);else if(1===s.length)n++,c=n,e=s[0],o[c]=e;else{const t=r.Utils.trimRoute(s,s[0],i.distance);n+=t.length-1,s.splice(0,t.length-1),c=n,e=Ce(t),o[c]=e}a.push({...d,coords:e}),i=d}return a}findStepCoords(e,t){var r;if("instruction_start_coordinate"in e)return Re(e.instruction_start_coordinate);const o=null==(r=t.vias)?void 0:r.find((t=>t.id===e.via_uri));return o?Re(o.access_point.coord):void 0}parseResponse(e){var t;if(!e||!e.journeys)throw se.notFound(this.rname,null==(t=e.error)?void 0:t.message);const o=[],s=e.context.timezone;for(const i of e.journeys){const e=[];for(const o of i.sections){if("waiting"===o.type||"transfer"===o.type)continue;const{from:t,to:i}=this.getSectionCoords(o);let n=[];const a=o.geojson.coordinates.reduce(((e,[t,o])=>(n.includes(`${t}-${o}`)||(n=n.concat(`${t}-${o}`),e.push(new r.Coordinates(o,t))),e)),[]),l=(new x).setStart(t).setEnd(i).setPathCoords(a);let d,c=Ne.get(o.mode);if(o.path){const e=o.path.every((e=>"instruction_start_coordinate"in e||e.via_uri)),t=[];for(const r of o.path){let s;if(e){s=this.findStepCoords(r,o);const e={name:r.name,distance:r.length,coords:s};l.addStepInfo(e)}else t.push({name:r.name,distance:r.length})}e||l.setStepsInfo(this.findStepsCoord(a,t))}if("public_transport"===o.type){d={name:o.display_informations.code,routeColor:o.display_informations.color,routeTextColor:o.display_informations.text_color,directionName:o.display_informations.direction},c=Ne.get(o.display_informations.physical_mode);const e={coords:a[0],name:d.directionName,distance:o.geojson.properties[0].length};l.setStepsInfo([e])}const u=new _({transitMode:c,duration:o.duration,startTime:Ae(o.departure_date_time,s),endTime:Ae(o.arrival_date_time,s),start:{name:o.from.name,coords:t},end:{name:o.to.name,coords:i},coords:a,transportInfo:d,steps:l.build()});e.push(u)}const t=new N({duration:i.duration,startTime:Ae(i.departure_date_time,s),endTime:Ae(i.arrival_date_time,s),origin:this.getSectionCoords(i.sections[0]).from,destination:this.getSectionCoords(Ce(i.sections)).to,legs:e});o.push(t)}return o}},Ie=new Map;Ie.set("CAR","CAR"),Ie.set("WALK","WALK"),Ie.set("BIKE","BIKE");const Le=new class extends ee{constructor(){super(...arguments),t(this,"inputModeCorrespondance",(e=>{var t;const{travelMode:r,travelModePreference:o}=e;if("WALK"===r&&(null==(t=e.itineraryModifiers)?void 0:t.isWheelchair))return"pmr";if("WALK"===r)return"walking";if("BIKE"===r)return"FASTEST"===o?"bike-fastest":"bike-safest";if("CAR"===r)return"driving";throw se.travelModeUnimplemented(this.rname,r)}))}get rname(){return"osrm"}async getItineraries(e,t){const r=this.getURL(e,t),o=await fetch(r).catch((()=>{throw se.unreachableServer(this.rname,r)})),s=await o.json().catch((()=>{throw se.responseNotParsing(this.rname,r)}));return this.parseResponse(s,t.origin,t.destination,t.travelMode)}getURL(e,t){const{origin:r,destination:o}=t;let s=e+"/route/v1/"+this.inputModeCorrespondance(t)+"/";return s+=[r,...t.waypoints||[],o].map((e=>[e.longitude+","+e.latitude])).join(";"),s+="?geometries=geojson&overview=full&steps=true",t.provideItineraryAlternatives&&(s+="&alternatives=true"),s}coordinatesToJson({lat:e,lng:t,level:o}){return null===o?[t,e]:r.Level.isRange(o)?[t,e,o[0]]:[t,e,o]}jsonToCoordinates(e){const t=new r.Coordinates(e[1],e[0]);return e.length>2&&(t.level=e[2]),t}getModifierFromAngle(e){const t=o.positiveMod(o.rad2deg(e),360);return t>0&&t<60?"sharp right":t>=60&&t<140?"right":t>=140&&t<160?"slight right":t>=160&&t<=200?"straight":t>200&&t<=220?"slight left":t>220&&t<=300?"left":t>300&&t<360?"sharp left":"u turn"}noRouteFoundJson(e){return{code:"NoRoute",message:e}}itineraryToOsrmJson(e){const t=e.legs.length-1,r=e.steps,s=e.legs.map((({distance:e,duration:s,coords:i},n)=>{const a=r.filter((e=>i.find((t=>t.equals(e.coords))))),l=a.length-1;return{distance:e,duration:s||0,steps:a.map(((e,r,s)=>{let a=0===r&&0===n?"depart":"turn";a=r===l&&n===t?"arrive":a;const d=i.findIndex((t=>t.equals(e.coords))),c=r===l?d:i.findIndex((e=>e.equals(s[r+1].coords)));return{geometry:{type:"LineString",coordinates:i.slice(d,c+1).map(this.coordinatesToJson)},distance:e.distance,duration:e.duration||0,...e.name&&{name:e.name},maneuver:{bearing_before:o.rad2deg(e.previousBearing),bearing_after:o.rad2deg(e.nextBearing),location:this.coordinatesToJson(e.coords),modifier:this.getModifierFromAngle(e.angle),type:a}}}))}}));return{code:"Ok",routes:[{geometry:{type:"LineString",coordinates:e.coords.map(this.coordinatesToJson)},legs:s,distance:e.distance,duration:e.duration,weight_name:"routability",weight:0}],waypoints:[]}}parseResponse(e,t,r,o){const s=Ie.get(o),{routes:i}=e;if(!i)throw se.notFound(this.rname,e.message);return i.map((e=>{const o=e.legs.map((e=>{var t;const r=e.steps.map((e=>e.geometry.coordinates.map(this.jsonToCoordinates))).flat().filter(((e,t,r)=>0===t||!r[t-1].equals(e))),o=r[0],i=r[r.length-1],n=(new x).setPathCoords(r).setStart(o).setEnd(i);return null==(t=e.steps)||t.forEach((({maneuver:e,name:t,distance:o,duration:s})=>{const i=this.jsonToCoordinates(e.location),a=r.map((e=>e.distanceTo(i))),l=a.indexOf(Math.min(...a));if(l<0)throw new Error("Osrm Parser: Cannot find step coords in leg coordinates");n.addStepInfo({coords:r[l],name:t,distance:o,duration:s})})),new _({transitMode:s,duration:e.duration,coords:r,start:{coords:o},end:{coords:i},steps:n.build()})}));return new N({duration:e.duration,origin:t,destination:r,legs:o})}))}};function ke(e){return"BUS"===e.mode||"TRAM"===e.mode}function Pe(e){return new r.Coordinates(e.lat,e.lon)}const Ue=new Map;Ue.set("CAR","CAR"),Ue.set("WALK","WALK"),Ue.set("BIKE","BICYCLE"),Ue.set("TRANSIT","WALK,TRANSIT");const Oe=new class extends ee{get rname(){return"otp"}async getItineraries(e,t){const r=this.getURL(e,t),o=await fetch(r).catch((()=>{throw se.unreachableServer(this.rname,r)})),s=await o.json().catch((()=>{throw se.responseNotParsing(this.rname,r)}));return this.parseResponse(s)}getURL(e,t){const{origin:r,destination:o,waypoints:i,travelMode:n}=t,a=Ue.get(n);if(!a)throw se.travelModeUnimplemented(this.rname,n);(i||[]).length>0&&s.warn(`${this.rname} router uses only the first 2 waypoints (asked ${null==i?void 0:i.length})`);const l=`fromPlace=${r.latitude},${r.longitude}`,d=`toPlace=${o.latitude},${o.longitude}`,c=`mode=${a}`,u=new URL(e);let{search:h}=u;return h=(h?`${h}&`:"?")+`${l}&${d}&${c}`,`${u.origin}${u.pathname}${h}`}parseResponse(e){const{plan:t}=e;if(!t)throw se.notFound(this.rname);const o=[],s=Pe(t.from),i=Pe(t.to);for(const n of t.itineraries){const e=[];for(const o of n.legs){const t=Pe(o.from),s=Pe(o.to),i=a.decode(o.legGeometry.points).map((([e,t])=>new r.Coordinates(e,t)));let n;const l=(new x).setStart(t).setEnd(s).setPathCoords(i);ke(o)?(n={name:o.routeShortName,routeColor:o.routeColor,routeTextColor:o.routeTextColor,directionName:o.headsign},l.addStepInfo({coords:i[0],name:o.headsign})):o.steps.forEach((e=>{const t=i.map((t=>t.distanceTo(Pe(e)))),r=t.indexOf(Math.min(...t));if(r<0)throw new Error("OTP Parser: Cannot find closest step");l.addStepInfo({coords:i[r],name:e.streetName})}));const d=new _({transitMode:o.mode,duration:o.duration,startTime:o.startTime,endTime:o.endTime,start:{name:o.from.name,coords:Pe(o.from)},end:{name:o.to.name,coords:Pe(o.to)},coords:i,transportInfo:n,steps:l.build()});e.push(d)}const t=new N({duration:n.duration,startTime:n.startTime,endTime:n.endTime,origin:s,destination:i,legs:e});o.push(t)}return o}};const Be=new class extends ee{get rname(){return"wemap-multi"}async getItineraries(e,t){const{origin:o,destination:s,waypoints:i}=t,n={...t,origin:o instanceof r.Coordinates?o.toJson():o,destination:s instanceof r.Coordinates?s.toJson():s,...i&&{waypoints:i.map((e=>e instanceof r.Coordinates?e.toJson():e))}},a=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(n)}).catch((()=>{throw se.unreachableServer(this.rname,e)})),l=await a.json().catch((()=>{throw se.responseNotParsing(this.rname,e)}));if(l.error)throw se.notFound(this.rname,l.error);return(l.itineraries||[]).map(N.fromJson)}},De=[he,ve,be,Me,Le,Oe,Be];const Fe=new class{getRouterByName(e){return De.find((t=>t.rname===e))}async getItineraries(e,t,r){const o=this.getRouterByName(e);if(!o)throw se.notFound(e,`Unknown "${e}" remote router`);return o.getItineraries(t,r)}async getItinerariesWithFallback(e,t){let r;const o=[];for(const{name:a,endpointUrl:l}of t)try{if(r=await this.getItineraries(a,l,e),r.length)return r}catch(n){if(!(n instanceof se))throw n;o.push({name:a,endpointUrl:l,error:n})}const s=t.map((({name:e})=>e)).join(", "),i=o.map((e=>`(${e.name}) Could not find an itinerary on endpoint: ${e.endpointUrl}. Details: ${e.error.message}`)).join("\n");throw se.notFound(s,i)}};class $e{constructor(e,r,o=null,s=null){if(t(this,"name"),t(this,"graph"),t(this,"router"),t(this,"bounds"),t(this,"entryPoints"),this.name=s,this.graph=e,this.router=new Q(e),r.forEach((t=>{if(!e.vertices.includes(t))throw new Error(`Cannot find entry point ${t.coords.toString()} in graph "${s}"`)})),this.entryPoints=r,o)this.bounds=o;else{const t=[e.vertices.map((e=>[e.coords.lng,e.coords.lat]))],r=d({type:"polygon",coordinates:t});if(!r)throw new Error(`Cannot calculate convexHull of graph "${s}"`);this.bounds={type:"MultiPolygon",coordinates:[r.geometry.coordinates]}}}static fromOsmXml(e,t=null,r){const o={routingIoNotFound:[],routingBoundsNotFound:!1};let s;try{s=n.OsmParser.parseOsmXmlString(e)}catch(c){return o.couldNotParseFile=c instanceof Error?c.message:"Unknown error",void(null==r||r(o))}let i=[];const a=Z.createGraphFromOsmModel(s,Z.DEFAULT_WAY_SELECTOR,(e=>i=e)),l=s.nodes.filter((e=>e.tags["wemap:routing-io"])).map((e=>{var t;const r=null==(t=i.find((t=>t[0]===e.id)))?void 0:t[1];return r||o.routingIoNotFound.push(e),r||null})).filter((e=>null!==e));l.forEach((e=>a.exitVertices.add(e)));const d={type:"MultiPolygon",coordinates:[]};return s.ways.filter((({tags:e})=>e["wemap:routing-bounds"])).forEach((e=>{d.coordinates.push([e.nodes.reduce(((e,t)=>(e.push([t.coords.lng,t.coords.lat]),e)),[])])})),s.relations.filter((e=>e.tags["wemap:routing-bounds"]&&e.isMultipolygon())).forEach((e=>{const t=e.getGeoJsonPolygon();t&&d.coordinates.push(t.coordinates)})),d.coordinates.length||(o.routingBoundsNotFound=!0),null==r||r(o),new $e(a,l,d,t)}isPointInside(e){return l([e.lng,e.lat],this.bounds)}getOrderedEntryPointsSortedByDistance(e,t){const o=[...this.entryPoints];return o.sort(((o,s)=>Number(o.coords.distanceTo(e))+o.coords.distanceTo(t)-(s.coords.distanceTo(e)+s.coords.distanceTo(t))+50*(Math.abs(r.Level.diff(e.level,o.coords.level)||0)+Math.abs(r.Level.diff(t.level,o.coords.level)||0)-(Math.abs(r.Level.diff(e.level,s.coords.level)||0)+Math.abs(r.Level.diff(t.level,s.coords.level)||0)))))}getBestRouteFromEntryPointsToDestination(e,t,r){const o=this.getOrderedEntryPointsSortedByDistance(e,t);for(const s of o){const e=this.router.calculateShortestPath(s.coords,t,r).route();if(e.hasRoute)return e}return null}getBestRouteFromOriginToEntryPoints(e,t,r){const o=this.getOrderedEntryPointsSortedByDistance(e,t);for(const s of o){const t=this.router.calculateShortestPath(e,s.coords,r).route();if(t.hasRoute)return t}return null}getRouteInsideMap(e,t,r){const o=this.router.calculateShortestPath(e,t,r).route();return o.hasRoute?o:null}getTripInsideMap(e,t){return this.router.getShortestTrip(e,t)}getRoutesMultipleDestinationsInsideMap(e,t,r){return this.router.calculateShortestPathToMultipleDestinations(e,t,r)}}exports.CitywayRemoteRouter=he,exports.CustomGraphMap=$e,exports.CustomGraphMapTester=class{static createReport(e){var t;let r;const o=$e.fromOsmXml(e,null,(e=>r=e)),s=[];if((null==r?void 0:r.couldNotParseFile)||!o)return s.push({type:"could-not-parse-file",details:null==r?void 0:r.couldNotParseFile}),{errors:s};const i=o.router.calculateComponents();return i.length>1&&s.push({type:"multiple-graph-components",data:i}),(null==r?void 0:r.routingBoundsNotFound)&&s.push({type:"routing-bounds-not-found"}),(null==(t=null==r?void 0:r.routingIoNotFound)?void 0:t.length)&&s.push({type:"routing-io-not-on-graph",data:r.routingIoNotFound}),{customGraphMap:o,errors:s}}static reportToJson(e){var t,r;return{graph:null==(r=null==(t=e.customGraphMap)?void 0:t.graph)?void 0:r.toCompressedJson(),errors:e.errors.map((e=>"multiple-graph-components"===e.type?{type:e.type,data:e.data.map((e=>e.map((e=>e.id))))}:"routing-io-not-on-graph"===e.type?{type:e.type,data:e.data.map((e=>e.id))}:{type:e.type}))}}},exports.DeutscheBahnRemoteRouter=be,exports.Edge=u,exports.GeoveloRemoteRouter=_e,exports.Graph=m,exports.GraphProjection=h,exports.GraphRoute=T,exports.GraphRouter=Q,exports.GraphRouterOptionsBuilder=J,exports.IdfmRemoteRouter=Me,exports.Itinerary=N,exports.ItineraryInfoManager=class{constructor(e=null){t(this,"_itinerary",null),t(this,"_graph",null),t(this,"_steps",[]),t(this,"_coordsNextStep",[]),t(this,"_coordsPreviousStep",[]),t(this,"_coordsDistanceTraveled",[]),t(this,"_coordsLeg",[]),t(this,"_itineraryDistanceWithoutProjections",0),this.itinerary=e}get itinerary(){return this._itinerary}set itinerary(e){if(null===e)return void(this._itinerary=null);this._itinerary=e,this._steps=e.steps,this._graph=e.toGraph(),this._coordsNextStep=new Array(e.coords.length),this._coordsPreviousStep=new Array(e.coords.length),this._coordsDistanceTraveled=new Array(e.coords.length),this._coordsLeg=new Array(e.coords.length),this._itineraryDistanceWithoutProjections=e.distance;let t=0,r=null,o=this._steps[0],s=0;e.coords.forEach(((i,n,a)=>{0!==n&&(s+=a[n-1].distanceTo(i)),this._coordsNextStep[n]=o,this._coordsPreviousStep[n]=r,this._coordsDistanceTraveled[n]=s,this._coordsLeg[n]=e.legs.find((e=>e.coords.includes(i))),t<this._steps.length&&this._steps[t].coords.equals(i)&&(r=this._steps[t],o=t===this._steps.length-1?null:this._steps[t+1],t++)}))}getInfo(e){if(!this._itinerary||!this._graph)return null;const t=this._graph.getProjection(e);if(!t)return null;let r=null;if(t.nearestElement instanceof p){const e=this._itinerary.coords.findIndex((e=>t.nearestElement.coords===e));if(-1===e)throw new Error("ItineraryInfoManager: could not find projection in itinerary (Node)");const o=this._coordsDistanceTraveled[e],s=o,i=this._itineraryDistanceWithoutProjections-o,n=t.distanceFromNearestElement+i,a=s/(s+n),l=1-a;r={nextStep:this._coordsNextStep[e],previousStep:this._coordsPreviousStep[e],projection:t,leg:this._coordsLeg[e],traveledDistance:o,remainingDistance:n,traveledPercentage:a,remainingPercentage:l}}else if(t.nearestElement instanceof u){let e=t.nearestElement.vertex1.coords,o=this._itinerary.coords.findIndex((t=>e===t));if(-1===o)throw new Error("ItineraryInfoManager: could not find projection in itinerary (Edge)");o!==this._itinerary.coords.length-1&&this._itinerary.coords[o+1]===t.nearestElement.vertex2.coords||(e=t.nearestElement.vertex2.coords,o--);const s=this._coordsDistanceTraveled[o]+t.coords.distanceTo(e),i=s,n=this._itineraryDistanceWithoutProjections-s,a=t.distanceFromNearestElement+n,l=i/(i+a),d=1-l;r={nextStep:this._coordsNextStep[o+1],previousStep:this._coordsPreviousStep[o+1],projection:t,leg:this._coordsLeg[o+1],traveledDistance:i,remainingDistance:a,traveledPercentage:l,remainingPercentage:d}}return r}},exports.Leg=_,exports.NavitiaRemoteRouter=ve,exports.NoRouteFoundError=X,exports.OsmGraphUtils=Z,exports.OsrmRemoteRouter=Le,exports.OtpRemoteRouter=Oe,exports.RemoteRouterManager=Fe,exports.RemoteRoutingError=se,exports.RoutingError=re,exports.StatusCode=te,exports.Vertex=p,exports.WemapMultiRemoteRouter=Be,exports.WemapMultiRouter=class{constructor(){t(this,"maps",[])}get rname(){return"wemap-multi"}addIOMap(e){this.maps.push(e)}removeIOMap(e){this.maps=this.maps.filter((t=>t!==e))}removeAllMaps(){this.maps=[]}getMapByName(e){return this.maps.find((t=>t.name===e))}async getItineraries(e,t=[],r=this.maps){const{origin:o,destination:s}=e;t=t.filter((({name:e})=>e!==Be.rname))||[];const i=r;if(!i.length)return await Fe.getItinerariesWithFallback(e,t);let n,a;const l=i.find((e=>e.isPointInside(o))),d=J.fromJson(e.itineraryModifiers||{});if(l&&l.isPointInside(s)){if(n=l.getRouteInsideMap(o,s,d),!n)throw oe.notFound(l.name||"");return[N.fromGraphRoute(n)]}const c=i.find((e=>e.isPointInside(s)));let u;if(!l&&!c)return await Fe.getItinerariesWithFallback(e,t);if(l&&!c){if(!l.entryPoints.length)throw oe.notFound(l.name||"",`A map including the "origin" but the "destination" has been \n found (${l.name}), however, no "entrypoints" have been found to go out`);const r=e=>`Tried to calculate an itinerary from "origin" to "entrypoints" using wemap router on local map "${l.name}" and an itinerary from "entrypoints" to "destination" using remote routers (${t.map((e=>e.name)).join(", ")}), but failed. Details: ${e}.`;if(n=l.getBestRouteFromOriginToEntryPoints(o,s,d),!n){const e=`No route found from ${o.toString()} to entry points in map: ${l.name}`;throw oe.notFound(l.name||"",r(e))}const i={...e,origin:n.end,destination:s,waypoints:[]};try{u=await Fe.getItinerariesWithFallback(i,t)}catch(h){throw h instanceof se&&(h.message=r(h.message)),h}return a=N.fromGraphRoute(n),u.map((e=>N.fromItineraries(a,e)))}if(!l&&c){if(!c.entryPoints.length)throw oe.notFound(c.name||"",`A map including the "destination" but the "origin" has been \n found (${c.name}), however, no "entrypoints" have been found to go in`);const r=e=>`Tried to calculate an itinerary from "origin" to "entrypoints" using remote routers (${t.map((e=>e.name)).join(", ")}) and an itinerary from "entrypoints" to "destination" using wemap router on local map "${c.name}", but failed. Details: ${e}.`;if(n=c.getBestRouteFromEntryPointsToDestination(o,s,d),!n){const e=`No route found from entry points to ${s.toString()} in map: ${c.name}`;throw oe.notFound(c.name||"",r(e))}const i={...e,origin:o,destination:n.start,waypoints:[]};try{u=await Fe.getItinerariesWithFallback(i,t)}catch(h){throw h instanceof se&&(h.message=r(h.message)),h}return a=N.fromGraphRoute(n),u.map((e=>N.fromItineraries(e,a)))}if(l&&c){if(!l.entryPoints.length)throw oe.notFound(l.name||"",`One map including the "origin" (${l.name}) and another \n including the "destination" (${c.name}) has been found, however, no "entrypoints" have \n been found to go out of the origin map`);if(!c.entryPoints.length)throw oe.notFound(c.name||"",`One map including the "origin" (${l.name}) and another \n including the "destination" (${c.name}) has been found, however, no "entrypoints" have \n been found to go in the second map`);const r=e=>`Tried to calculate an itinerary from "origin" to "entrypoints1" using wemap router on local map "${l.name}", an itinerary from "entrypoints1" to "entrypoints2" using remote routers (${t.map((e=>e.name)).join(", ")}) and an itinerary from "entrypoints2" to "destination" using wemap router on local map "${c.name}", but failed. Details: ${e}.`,i=l.getBestRouteFromOriginToEntryPoints(o,s,d);if(!i){const e=`No route found from ${o.toString()} to entry points in map: ${l.name}`;throw oe.notFound(l.name||"",r(e))}const n=c.getBestRouteFromEntryPointsToDestination(o,s,d);if(!n){const e=`No route found from entry points to ${s.toString()} in map: ${c.name}`;throw oe.notFound(c.name||"",r(e))}const a={...e,origin:i.end,destination:n.start,waypoints:[]};try{u=await Fe.getItinerariesWithFallback(a,t)}catch(h){throw h instanceof se&&(h.message=r(h.message)),h}return u.map((e=>N.fromItineraries(N.fromGraphRoute(i),e,N.fromGraphRoute(n))))}throw new Error("Should never happen")}},exports.WemapMultiRoutingError=oe,exports.areTransitAndTravelModeConsistent=w,exports.getDurationFromLength=g,exports.routerRequestToJson=function(e){const{origin:t,destination:r,waypoints:o,...s}=e;return{origin:t.toJson(),destination:r.toJson(),...o&&{waypoints:o.map((e=>e.toJson()))},...s}};
2
2
  //# sourceMappingURL=index.js.map