@wemap/routers 14.4.0 → 14.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/index.js +722 -458
  2. package/dist/src/Utils.d.ts +2 -2
  3. package/dist/src/Utils.d.ts.map +1 -1
  4. package/dist/src/graph/Edge.d.ts +2 -1
  5. package/dist/src/graph/Edge.d.ts.map +1 -1
  6. package/dist/src/graph/Graph.d.ts.map +1 -1
  7. package/dist/src/graph/GraphRouter.d.ts.map +1 -1
  8. package/dist/src/graph/GraphRouterEngine.d.ts.map +1 -1
  9. package/dist/src/graph/GraphRouterRules.d.ts +5 -3
  10. package/dist/src/graph/GraphRouterRules.d.ts.map +1 -1
  11. package/dist/src/graph/GraphRouterRulesBuilder.d.ts +2 -11
  12. package/dist/src/graph/GraphRouterRulesBuilder.d.ts.map +1 -1
  13. package/dist/src/graph/GraphRouterRulesMerger.d.ts.map +1 -1
  14. package/dist/src/graph/GraphRouterRulesTyping.d.ts +15 -3
  15. package/dist/src/graph/GraphRouterRulesTyping.d.ts.map +1 -1
  16. package/dist/src/import/ImportErrors.d.ts +13 -0
  17. package/dist/src/import/ImportErrors.d.ts.map +1 -0
  18. package/dist/src/import/geojson/GeoJsonGraphUtils.d.ts +2 -1
  19. package/dist/src/import/geojson/GeoJsonGraphUtils.d.ts.map +1 -1
  20. package/dist/src/import/osm/OsmGraphUtils.d.ts +2 -1
  21. package/dist/src/import/osm/OsmGraphUtils.d.ts.map +1 -1
  22. package/dist/src/model/Itinerary.d.ts +2 -2
  23. package/dist/src/model/Itinerary.d.ts.map +1 -1
  24. package/dist/src/model/Leg.d.ts +6 -0
  25. package/dist/src/model/Leg.d.ts.map +1 -1
  26. package/dist/src/model/RouterRequest.d.ts +0 -12
  27. package/dist/src/model/RouterRequest.d.ts.map +1 -1
  28. package/dist/src/model/Step.d.ts +10 -2
  29. package/dist/src/model/Step.d.ts.map +1 -1
  30. package/dist/src/model/StepsBuilder.d.ts.map +1 -1
  31. package/dist/src/types.d.ts +2 -0
  32. package/dist/src/types.d.ts.map +1 -1
  33. package/dist/src/wemap-multi/CustomGraphMap.d.ts +7 -6
  34. package/dist/src/wemap-multi/CustomGraphMap.d.ts.map +1 -1
  35. package/dist/src/wemap-multi/CustomGraphMapTester.d.ts +20 -2
  36. package/dist/src/wemap-multi/CustomGraphMapTester.d.ts.map +1 -1
  37. package/dist/tests/CommonTest.d.ts +3 -1
  38. package/dist/tests/CommonTest.d.ts.map +1 -1
  39. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -362,6 +362,12 @@ var Vertex = class e {
362
362
  static getEdgeByVertices(e, t, n) {
363
363
  return e.find((e) => t === e.vertex1 && n === e.vertex2 || n === e.vertex1 && t === e.vertex2);
364
364
  }
365
+ static intersection(e, t) {
366
+ let i = Level.intersection(e.level, t.level);
367
+ if (i === null) return null;
368
+ let o = Utils.segmentIntersection(e.vertex1.coords, e.vertex2.coords, t.vertex1.coords, t.vertex2.coords);
369
+ return o ? new Coordinates(o.lat, o.lng, null, i) : null;
370
+ }
365
371
  reverseProperties() {
366
372
  let { properties: e } = this;
367
373
  e.incline &&= e.incline === "up" ? "down" : "up", e.isOneway &&= !1;
@@ -532,26 +538,26 @@ var Graph_default = class a {
532
538
  getProjection(e, n = {}) {
533
539
  let a = "maxDistance" in n, o = n.maxDistance, s = "maxBearingAngle" in n;
534
540
  if (s && (!(e instanceof UserPosition) || e.bearing === null)) return null;
535
- let c = n.maxBearingAngle, l = "acceptEdgeFn" in n, u = !("useMultiLevelSegments" in n) || n.useMultiLevelSegments, d = null, f = (t) => {
541
+ let c = n.maxBearingAngle, l = "acceptEdgeFn" in n, u = !("useMultiLevelSegments" in n) || n.useMultiLevelSegments, d = null, f = l ? /* @__PURE__ */ new Set() : null, p = (t) => {
536
542
  if (!(e instanceof UserPosition)) return t;
537
543
  let n = e.clone();
538
544
  return n.lat = t.lat, n.lng = t.lng, n.level = t.level, n.alt = t.alt, n.heightFromFloor = t.heightFromFloor, n.heightFromGround = t.heightFromGround, n;
539
545
  };
540
546
  return this.edges.forEach((t) => {
541
- if (l && !n.acceptEdgeFn(t) || !u && Level.isRange(t.level) || !Level.intersect(t.level, e.level) || s && diffAngleLines(t.bearing, e.bearing) > c) return;
547
+ if (l && !n.acceptEdgeFn(t) || (f && (f.add(t.vertex1), f.add(t.vertex2)), !u && Level.isRange(t.level)) || !Level.intersect(t.level, e.level) || s && diffAngleLines(t.bearing, e.bearing) > c) return;
542
548
  let i = e.getSegmentProjection(t.vertex1.coords, t.vertex2.coords);
543
549
  if (!i) return;
544
- let p = i.distanceTo(e);
545
- a && p > o || p < (d?.distanceFromNearestElement ?? Number.MAX_VALUE) && (d = new GraphProjection_default(e, p, f(i), t));
546
- }), s || this.vertices.forEach((n) => {
550
+ let m = i.distanceTo(e);
551
+ a && m > o || m < (d?.distanceFromNearestElement ?? Number.MAX_VALUE) && (d = new GraphProjection_default(e, m, p(i), t));
552
+ }), s || (f ?? this.vertices).forEach((n) => {
547
553
  let i = n.coords;
548
554
  if (this.exitVertices.has(n) && e.level === null && (i = n.coords.clone(), i.level = null), !u && Level.isRange(i.level) || !Level.intersect(i.level, e.level)) return;
549
555
  let s = i.distanceTo(e);
550
556
  if (s < Constants.EPS_MM) {
551
- d = new GraphProjection_default(e, 0, f(i), n);
557
+ d = new GraphProjection_default(e, 0, p(i), n);
552
558
  return;
553
559
  }
554
- a && s > o || s < (d?.distanceFromNearestElement ?? Number.MAX_VALUE) && (d = new GraphProjection_default(e, s, f(i), n));
560
+ a && s > o || s < (d?.distanceFromNearestElement ?? Number.MAX_VALUE) && (d = new GraphProjection_default(e, s, p(i), n));
555
561
  }), d;
556
562
  }
557
563
  toJson() {
@@ -561,7 +567,8 @@ var Graph_default = class a {
561
567
  id: e.id,
562
568
  vertex1Idx: this.vertices.indexOf(e.vertex1),
563
569
  vertex2Idx: this.vertices.indexOf(e.vertex2),
564
- ...Object.keys(e.properties).length > 0 && { properties: e.properties }
570
+ ...Object.keys(e.properties).length > 0 && { properties: e.properties },
571
+ ...Object.keys(e.rawTags).length > 0 && { rawTags: e.rawTags }
565
572
  })),
566
573
  ...this.routingBounds && { routingBounds: this.routingBounds },
567
574
  ...this.routingBoundsEntryPoints.length > 0 && { routingBoundsEntryPoints: this.routingBoundsEntryPoints.map((e) => e.id) }
@@ -569,7 +576,7 @@ var Graph_default = class a {
569
576
  }
570
577
  static fromJson(e) {
571
578
  let t = e.vertices.map((e) => Vertex.fromJson(e));
572
- return new a(t, e.edges.map((e) => new Edge(t[e.vertex1Idx], t[e.vertex2Idx], e.properties, void 0, e.id)), e.routingBounds, e.routingBoundsEntryPoints?.map((e) => t[e]));
579
+ return new a(t, e.edges.map((e) => new Edge(t[e.vertex1Idx], t[e.vertex2Idx], e.properties, e.rawTags, e.id)), e.routingBounds, e.routingBoundsEntryPoints?.map((e) => t[e]));
573
580
  }
574
581
  toCompressedJson() {
575
582
  return {
@@ -674,11 +681,15 @@ function stepToJson(e) {
674
681
  return {
675
682
  ...e.firstStep && { firstStep: !0 },
676
683
  ...e.lastStep && { lastStep: !0 },
684
+ ...e.important && { important: !0 },
677
685
  number: e.number,
678
686
  type: e.type,
679
687
  coords: e.coords.toCompressedJson(),
680
688
  ...e.name !== null && { name: e.name },
681
689
  ...e.levelDifference !== null && { levelDifference: e.levelDifference },
690
+ ...e.destinationLevel != null && { destinationLevel: e.destinationLevel },
691
+ ...e.tactilePaving && { tactilePaving: e.tactilePaving },
692
+ ...e.funicular && { funicular: e.funicular },
682
693
  angle: Number(e.angle.toFixed(2)),
683
694
  previousBearing: Number(e.previousBearing.toFixed(2)),
684
695
  nextBearing: Number(e.nextBearing.toFixed(2)),
@@ -693,12 +704,14 @@ function jsonToStep(e) {
693
704
  coords: Coordinates.fromCompressedJson(e.coords),
694
705
  firstStep: !!e.firstStep,
695
706
  lastStep: !!e.lastStep,
707
+ important: !!e.important,
696
708
  name: e.name || null,
697
- levelDifference: e.levelDifference || null
709
+ levelDifference: e.levelDifference || null,
710
+ destinationLevel: e.destinationLevel
698
711
  };
699
712
  }
700
713
  function stepEquals(e, t) {
701
- 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 && e.levelDifference === t.levelDifference && e.type === t.type && e.direction === t.direction && e.name === t.name && Math.abs(e.nextBearing - t.nextBearing) <= .005 && e.number === t.number && Math.abs(e.previousBearing - t.previousBearing) <= .005;
714
+ 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 && e.important === t.important && e.levelDifference === t.levelDifference && e.destinationLevel === t.destinationLevel && e.type === t.type && e.direction === t.direction && e.name === t.name && Math.abs(e.nextBearing - t.nextBearing) <= .005 && e.number === t.number && Math.abs(e.previousBearing - t.previousBearing) <= .005;
702
715
  }
703
716
  function isStepLevelChange(e) {
704
717
  return e ? e.direction === "up" || e.direction === "down" : !1;
@@ -837,26 +850,40 @@ var Logger = _Logger, SKIP_STEP_ANGLE_MAX = deg2rad(20), StepsBuilder = class {
837
850
  if (!e.hasRoute) return this;
838
851
  let o = null, s = i.bearingTo(e.vertices[0].coords);
839
852
  for (let n = 0; n < e.vertices.length - 1; n++) {
840
- let i = e.vertices[n], a = i.coords, l = e.vertices[n + 1], u = l.coords, d = e.edges[n], f = i.bearingTo(l), p = diffAngle(s, f + Math.PI), m = t.length ? t[t.length - 1] : null, h = OsmTagsUtils.isSubwayEntrance(i.rawTags), g = OsmTagsUtils.isGate(i.rawTags), _ = OsmTagsUtils.getRef(i.rawTags), { isElevator: v, areEscalators: y, areStairs: b, isMovingWalkway: x, incline: S } = d.properties, C;
841
- (b || v) && S && (m?.levelDifference === null || m?.levelDifference === void 0) && (C = S);
842
- let w = (n > 0 ? e.edges[n - 1] : null)?.properties || {}, T = !!(w.incline && w.areStairs && (!S || !b)), E = h, D = d.properties.name || _ || null, O = e.edgesWeights[n], k = Math.abs(diffAngle(Math.PI, p)) >= SKIP_STEP_ANGLE_MAX, A = Level.isRange(d.level) && !Level.isRange(a.level) || C;
843
- k &&= !(a.level && Level.isRange(a.level));
844
- let j = isStepLevelChange(m) && !Level.isRange(a.level) || T;
845
- if (!o || k || A || j || E) {
846
- let e = null, n = "turn";
847
- v ? n = "elevator" : y ? n = "escalator" : b ? n = "stairs" : h ? n = "subway-entrance" : g ? n = "gate" : x ? n = "moving-walkway" : A && (n = "incline-plane");
848
- let i = getDirectionFromAngle(p);
849
- A && (e = Level.diff(a.level, u.level) || 0, i = e > 0 ? "up" : "down", C && (i = C)), o = {
850
- coords: a,
851
- ...D && { name: D },
852
- type: n,
853
- direction: i,
853
+ let i = e.vertices[n], l = i.coords, u = e.vertices[n + 1], d = u.coords, f = e.edges[n], p = i.bearingTo(u), m = diffAngle(s, p + Math.PI), h = t.length ? t[t.length - 1] : null, g = n > 0 ? e.edges[n - 1] : null, _ = OsmTagsUtils.isGate(i.rawTags), v = OsmTagsUtils.isTurnstile(i.rawTags), y = OsmTagsUtils.isTactilePaving(f.rawTags), b = g ? OsmTagsUtils.isTactilePaving(g.rawTags) : !1, x = y && !b ? "entrance" : !y && b ? "exit" : void 0, S = OsmTagsUtils.isFunicular(f.rawTags), C = g ? OsmTagsUtils.isFunicular(g.rawTags) : !1, w = S && !C ? "entrance" : !S && C ? "exit" : void 0, { isElevator: T, areEscalators: E, areStairs: D, isMovingWalkway: O, incline: k } = f.properties, A;
854
+ (D || T) && k && (h?.levelDifference === null || h?.levelDifference === void 0) && (A = k);
855
+ let ee = g?.properties || {};
856
+ ee.incline && ee.areStairs;
857
+ let j = OsmTagsUtils.isSubwayEntrance(i.rawTags), N = OsmTagsUtils.isEntrance(i.rawTags), P = N || j, F;
858
+ if (N) {
859
+ if (n > 0) {
860
+ let t = e.vertices[n - 1].coords.level, r = d.level;
861
+ t === null && r !== null ? F = "entrance" : t !== null && r === null && (F = "exit");
862
+ }
863
+ F ||= a.level === null ? "exit" : "entrance";
864
+ }
865
+ let I = f.properties.name || i.properties.name || OsmTagsUtils.getRef(i.rawTags), L = e.edgesWeights[n], te = Math.abs(diffAngle(Math.PI, m)) >= SKIP_STEP_ANGLE_MAX, R = Level.isRange(f.level) && !Level.isRange(l.level) || A;
866
+ te &&= !(l.level && Level.isRange(l.level));
867
+ let B = !!(R || P || w || v), V = B || x || te && g?.length !== 0;
868
+ if (!o || V) {
869
+ let e = null, i = null, a = null;
870
+ T ? a = "elevator" : E ? a = "escalator" : D ? a = "stairs" : j ? a = "subway-entrance" : _ ? a = "gate" : v ? a = "turnstile" : O ? a = "moving-walkway" : R ? a = "incline-plane" : F ? a = F : n > 0 && (a = "turn");
871
+ let s = getDirectionFromAngle(m);
872
+ R && (e = Level.diff(l.level, d.level) || 0, i = d.level, s = e > 0 ? "up" : "down", A && (s = A)), o = {
873
+ coords: l,
874
+ ...I && { name: I },
875
+ important: B,
876
+ type: a,
877
+ direction: s,
854
878
  levelDifference: e,
879
+ ...i !== null && { destinationLevel: i },
880
+ ...x && { tactilePaving: x },
881
+ ...w && { funicular: w },
855
882
  distance: 0,
856
883
  duration: 0
857
884
  }, t.push(o);
858
885
  }
859
- o.distance += a.distanceTo(u), o.duration += O, s = f;
886
+ o.distance += l.distanceTo(d), o.duration += L, s = p;
860
887
  }
861
888
  let l = e.vertices[e.vertices.length - 1].coords;
862
889
  return Coordinates.equals(l, a) || t.push({
@@ -875,22 +902,28 @@ var Logger = _Logger, SKIP_STEP_ANGLE_MAX = deg2rad(20), StepsBuilder = class {
875
902
  return r.map((i, a) => {
876
903
  let o = e.findIndex((e) => e.equals(i.coords));
877
904
  if (o === -1) throw Error("Cannot find step coordinates in itinerary coordinates.");
878
- let s = o === 0 ? t : e[o - 1], c = o === e.length - 1 ? n : e[o + 1], l = s.bearingTo(i.coords), u = i.coords.bearingTo(c), d = diffAngle(l, u + Math.PI), f = i.type, p = i.direction || getDirectionFromAngle(d), m = a === 0, h = 0, g = a === r.length - 1, _ = g ? e[e.length - 1] : r[a + 1].coords, v = o;
879
- for (; !e[v].equals(_);) h += e[v].distanceTo(e[v + 1]), v++;
880
- return f ||= p === "straight" ? "continue" : p.includes("left") || p.includes("right") || p === "u-turn" ? "turn" : m ? "depart" : g ? "arrive" : null, {
905
+ let s = o === 0 ? t : e[o - 1], c = o === e.length - 1 ? n : e[o + 1], l = s.bearingTo(i.coords), u = i.coords.bearingTo(c), d = diffAngle(l, u + Math.PI), f = i.type, p = i.direction;
906
+ !p && f !== "arrive" && (p = getDirectionFromAngle(d)), f === "arrive" && (p = i.coords.distanceTo(n) > 1 ? getDirectionFromAngle(d) : "straight");
907
+ let m = a === 0, h = a === r.length - 1, g = h ? e[e.length - 1] : r[a + 1].coords, _ = o, v = 0;
908
+ for (; !e[_].equals(g);) v += e[_].distanceTo(e[_ + 1]), _++;
909
+ return f || (m ? (f = "depart", p = "straight") : f = h ? "arrive" : p === "straight" ? "continue" : p && (p.includes("left") || p.includes("right") || p === "u-turn") ? "turn" : null), {
881
910
  coords: i.coords,
882
911
  direction: f === "transit" ? null : p,
883
912
  type: f,
884
913
  levelDifference: i.levelDifference === void 0 ? null : i.levelDifference,
914
+ ...i.destinationLevel !== null && { destinationLevel: i.destinationLevel },
915
+ ...i.tactilePaving && { tactilePaving: i.tactilePaving },
916
+ ...i.funicular && { funicular: i.funicular },
885
917
  name: i.name || null,
886
918
  number: a + 1,
887
919
  previousBearing: l,
888
920
  nextBearing: u,
889
921
  angle: d,
890
922
  firstStep: m,
891
- lastStep: g,
892
- distance: h,
893
- duration: i.duration || getDurationFromLength(h)
923
+ lastStep: h,
924
+ important: i.important,
925
+ distance: v,
926
+ duration: i.duration || getDurationFromLength(v)
894
927
  };
895
928
  });
896
929
  }
@@ -974,6 +1007,22 @@ var Logger = _Logger, SKIP_STEP_ANGLE_MAX = deg2rad(20), StepsBuilder = class {
974
1007
  steps: new StepsBuilder().setGraphRoute(t).build()
975
1008
  });
976
1009
  }
1010
+ static mergeWalkLegs(t, n) {
1011
+ return new e({
1012
+ start: {
1013
+ name: t.start.name || void 0,
1014
+ coords: t.start.coords
1015
+ },
1016
+ end: {
1017
+ name: n.end.name || void 0,
1018
+ coords: n.end.coords
1019
+ },
1020
+ coords: [...t.coords, ...n.coords],
1021
+ transitMode: "WALK",
1022
+ duration: t.duration + n.duration,
1023
+ steps: [...t.steps, ...n.steps]
1024
+ });
1025
+ }
977
1026
  multiplyLevel(e) {
978
1027
  this.start.coords.level = Level.multiplyBy(this.start.coords.level, e), this.end.coords.level = Level.multiplyBy(this.end.coords.level, e);
979
1028
  for (let t of this.coords) t.level = Level.multiplyBy(t.level, e);
@@ -1034,15 +1083,19 @@ var Logger = _Logger, SKIP_STEP_ANGLE_MAX = deg2rad(20), StepsBuilder = class {
1034
1083
  return Graph_default.fromCoordinatesSegments([this.coords]);
1035
1084
  }
1036
1085
  static fromItineraries(...t) {
1086
+ let n = t.map((e) => e.legs).flat().reduce((e, t) => {
1087
+ let n = e[e.length - 1];
1088
+ return n && n.transitMode === "WALK" && t.transitMode === "WALK" ? e[e.length - 1] = Leg.mergeWalkLegs(n, t) : e.push(t), e;
1089
+ }, []);
1037
1090
  return new e({
1038
1091
  origin: t[0].origin,
1039
1092
  destination: t[t.length - 1].destination,
1040
- legs: t.map((e) => e.legs).flat()
1093
+ legs: n
1041
1094
  });
1042
1095
  }
1043
- static fromOrderedPointsArray(e, t, r) {
1044
- let i = (e) => new Coordinates(e[0], e[1], null, e[2]);
1045
- return this.fromOrderedCoordinates(e.map(i), i(t), i(r));
1096
+ static fromOrderedPointsArray(e, t, r, i = "WALK") {
1097
+ let a = (e) => new Coordinates(e[0], e[1], null, e[2]);
1098
+ return this.fromOrderedCoordinates(e.map(a), a(t), a(r), i);
1046
1099
  }
1047
1100
  static fromOrderedCoordinates(t, n, r, i = "WALK") {
1048
1101
  let a = new StepsBuilder().setPathCoords(t).setStart(n).setEnd(r).build();
@@ -1186,7 +1239,7 @@ function getQualitativeColor(e) {
1186
1239
  }
1187
1240
  (/* @__PURE__ */ __commonJSMin(((e, t) => {
1188
1241
  (function(n, r) {
1189
- var i = "1.0.41", a = "", o = "?", s = "function", c = "undefined", l = "object", u = "string", d = "major", f = "model", p = "name", m = "type", h = "vendor", g = "version", _ = "architecture", v = "console", y = "mobile", b = "tablet", x = "smarttv", S = "wearable", C = "embedded", w = 500, T = "Amazon", E = "Apple", D = "ASUS", O = "BlackBerry", k = "Browser", A = "Chrome", j = "Edge", M = "Firefox", N = "Google", P = "Honor", F = "Huawei", I = "Lenovo", ee = "LG", L = "Microsoft", te = "Motorola", R = "Nvidia", z = "OnePlus", B = "Opera", V = "OPPO", H = "Samsung", ne = "Sharp", re = "Sony", U = "Xiaomi", W = "Zebra", G = "Facebook", ie = "Chromium OS", K = "Mac OS", q = " Browser", ae = function(e, t) {
1242
+ var i = "1.0.41", a = "", o = "?", s = "function", c = "undefined", l = "object", u = "string", d = "major", f = "model", p = "name", m = "type", h = "vendor", g = "version", _ = "architecture", v = "console", y = "mobile", b = "tablet", x = "smarttv", S = "wearable", C = "embedded", w = 500, T = "Amazon", E = "Apple", D = "ASUS", O = "BlackBerry", k = "Browser", A = "Chrome", ee = "Edge", j = "Firefox", M = "Google", N = "Honor", P = "Huawei", F = "Lenovo", I = "LG", L = "Microsoft", te = "Motorola", R = "Nvidia", z = "OnePlus", B = "Opera", V = "OPPO", H = "Samsung", ne = "Sharp", re = "Sony", U = "Xiaomi", W = "Zebra", G = "Facebook", ie = "Chromium OS", K = "Mac OS", q = " Browser", ae = function(e, t) {
1190
1243
  var n = {};
1191
1244
  for (var r in e) t[r] && t[r].length % 2 == 0 ? n[r] = t[r].concat(e[r]) : n[r] = e[r];
1192
1245
  return n;
@@ -1292,7 +1345,7 @@ function getQualitativeColor(e) {
1292
1345
  "$1 Secure " + k
1293
1346
  ], g],
1294
1347
  [/\bfocus\/([\w\.]+)/i],
1295
- [g, [p, M + " Focus"]],
1348
+ [g, [p, j + " Focus"]],
1296
1349
  [/\bopt\/([\w\.]+)/i],
1297
1350
  [g, [p, B + " Touch"]],
1298
1351
  [/coc_coc\w+\/([\w\.]+)/i],
@@ -1304,7 +1357,7 @@ function getQualitativeColor(e) {
1304
1357
  [/miuibrowser\/([\w\.]+)/i],
1305
1358
  [g, [p, "MIUI" + q]],
1306
1359
  [/fxios\/([\w\.-]+)/i],
1307
- [g, [p, M]],
1360
+ [g, [p, j]],
1308
1361
  [/\bqihoobrowser\/?([\w\.]*)/i],
1309
1362
  [g, [p, "360"]],
1310
1363
  [/\b(qq)\/([\w\.]+)/i],
@@ -1378,7 +1431,7 @@ function getQualitativeColor(e) {
1378
1431
  [/(wolvic|librewolf)\/([\w\.]+)/i],
1379
1432
  [p, g],
1380
1433
  [/mobile vr; rv:([\w\.]+)\).+firefox/i],
1381
- [g, [p, M + " Reality"]],
1434
+ [g, [p, j + " Reality"]],
1382
1435
  [
1383
1436
  /ekiohf.+(flow)\/([\w\.]+)/i,
1384
1437
  /(swiftfox)/i,
@@ -1468,25 +1521,25 @@ function getQualitativeColor(e) {
1468
1521
  [/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],
1469
1522
  [
1470
1523
  f,
1471
- [h, P],
1524
+ [h, N],
1472
1525
  [m, b]
1473
1526
  ],
1474
1527
  [/honor([-\w ]+)[;\)]/i],
1475
1528
  [
1476
1529
  f,
1477
- [h, P],
1530
+ [h, N],
1478
1531
  [m, y]
1479
1532
  ],
1480
1533
  [/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],
1481
1534
  [
1482
1535
  f,
1483
- [h, F],
1536
+ [h, P],
1484
1537
  [m, b]
1485
1538
  ],
1486
1539
  [/(?:huawei)([-\w ]+)[;\)]/i, /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],
1487
1540
  [
1488
1541
  f,
1489
- [h, F],
1542
+ [h, P],
1490
1543
  [m, y]
1491
1544
  ],
1492
1545
  [/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i, /\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],
@@ -1571,7 +1624,7 @@ function getQualitativeColor(e) {
1571
1624
  [/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],
1572
1625
  [
1573
1626
  f,
1574
- [h, ee],
1627
+ [h, I],
1575
1628
  [m, b]
1576
1629
  ],
1577
1630
  [
@@ -1581,13 +1634,13 @@ function getQualitativeColor(e) {
1581
1634
  ],
1582
1635
  [
1583
1636
  f,
1584
- [h, ee],
1637
+ [h, I],
1585
1638
  [m, y]
1586
1639
  ],
1587
1640
  [/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i, /lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],
1588
1641
  [
1589
1642
  f,
1590
- [h, I],
1643
+ [h, F],
1591
1644
  [m, b]
1592
1645
  ],
1593
1646
  [/(nokia) (t[12][01])/i],
@@ -1609,13 +1662,13 @@ function getQualitativeColor(e) {
1609
1662
  [/(pixel (c|tablet))\b/i],
1610
1663
  [
1611
1664
  f,
1612
- [h, N],
1665
+ [h, M],
1613
1666
  [m, b]
1614
1667
  ],
1615
1668
  [/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],
1616
1669
  [
1617
1670
  f,
1618
- [h, N],
1671
+ [h, M],
1619
1672
  [m, y]
1620
1673
  ],
1621
1674
  [/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],
@@ -1993,7 +2046,7 @@ function getQualitativeColor(e) {
1993
2046
  [m, x]
1994
2047
  ],
1995
2048
  [/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],
1996
- [[h, ee], [m, x]],
2049
+ [[h, I], [m, x]],
1997
2050
  [/(apple) ?tv/i],
1998
2051
  [
1999
2052
  h,
@@ -2003,7 +2056,7 @@ function getQualitativeColor(e) {
2003
2056
  [/crkey/i],
2004
2057
  [
2005
2058
  [f, A + "cast"],
2006
- [h, N],
2059
+ [h, M],
2007
2060
  [m, x]
2008
2061
  ],
2009
2062
  [/droid.+aft(\w+)( bui|\))/i],
@@ -2121,7 +2174,7 @@ function getQualitativeColor(e) {
2121
2174
  [/(g watch r)/i],
2122
2175
  [
2123
2176
  f,
2124
- [h, ee],
2177
+ [h, I],
2125
2178
  [m, S]
2126
2179
  ],
2127
2180
  [/droid.+; (wt63?0{2,3})\)/i],
@@ -2133,7 +2186,7 @@ function getQualitativeColor(e) {
2133
2186
  [/droid.+; (glass) \d/i],
2134
2187
  [
2135
2188
  f,
2136
- [h, N],
2189
+ [h, M],
2137
2190
  [m, S]
2138
2191
  ],
2139
2192
  [/(pico) (4|neo3(?: link|pro)?)/i],
@@ -2177,7 +2230,7 @@ function getQualitativeColor(e) {
2177
2230
  ],
2178
2231
  engine: [
2179
2232
  [/windows.+ edge\/([\w\.]+)/i],
2180
- [g, [p, j + "HTML"]],
2233
+ [g, [p, ee + "HTML"]],
2181
2234
  [/(arkweb)\/([\w\.]+)/i],
2182
2235
  [p, g],
2183
2236
  [/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],
@@ -2246,7 +2299,7 @@ function getQualitativeColor(e) {
2246
2299
  [/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],
2247
2300
  [g, [p, "Symbian"]],
2248
2301
  [/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],
2249
- [g, [p, M + " OS"]],
2302
+ [g, [p, j + " OS"]],
2250
2303
  [/web0s;.+rt(tv)/i, /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],
2251
2304
  [g, [p, "webOS"]],
2252
2305
  [/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],
@@ -2359,231 +2412,358 @@ function formatSO(e, ...t) {
2359
2412
  function toUpperCase(e) {
2360
2413
  return e.toUpperCase();
2361
2414
  }
2362
- const wheelchair = {
2415
+ var default_rules_default = { rules: [{
2416
+ name: "default",
2417
+ baseSpeedKmh: 4,
2418
+ useMultiLevelSegments: !1,
2419
+ edgeAccept: [{
2420
+ match: [{
2421
+ path: "tags.wheelchair",
2422
+ value: "designated"
2423
+ }],
2424
+ action: "exclude"
2425
+ }],
2426
+ edgeWeight: [
2427
+ {
2428
+ match: [{
2429
+ path: "isElevator",
2430
+ value: !0
2431
+ }],
2432
+ action: "set",
2433
+ value: 90
2434
+ },
2435
+ {
2436
+ match: [{
2437
+ path: "areStairs",
2438
+ value: !0
2439
+ }],
2440
+ action: "multiply",
2441
+ value: 3
2442
+ },
2443
+ {
2444
+ match: [{
2445
+ path: "areEscalators",
2446
+ value: !0
2447
+ }],
2448
+ action: "multiply",
2449
+ value: 1.5
2450
+ },
2451
+ {
2452
+ match: [{
2453
+ path: "isMovingWalkway",
2454
+ value: !0
2455
+ }],
2456
+ action: "multiply",
2457
+ value: .8
2458
+ },
2459
+ {
2460
+ match: [{
2461
+ path: "tags.smoothness",
2462
+ value: "horrible"
2463
+ }],
2464
+ action: "multiply",
2465
+ value: .4
2466
+ },
2467
+ {
2468
+ match: [{
2469
+ path: "tags.smoothness",
2470
+ value: "bad"
2471
+ }],
2472
+ action: "multiply",
2473
+ value: .7
2474
+ },
2475
+ {
2476
+ match: [{
2477
+ path: "tags.smoothness",
2478
+ value: "intermediate"
2479
+ }],
2480
+ action: "multiply",
2481
+ value: .8
2482
+ },
2483
+ {
2484
+ match: [{
2485
+ path: "tags.smoothness",
2486
+ value: "good"
2487
+ }],
2488
+ action: "multiply",
2489
+ value: .9
2490
+ },
2491
+ {
2492
+ match: [{
2493
+ path: "tags.smoothness",
2494
+ value: "excellent"
2495
+ }],
2496
+ action: "multiply",
2497
+ value: 1
2498
+ },
2499
+ {
2500
+ match: [{
2501
+ path: "tags.surface",
2502
+ value: "asphalt"
2503
+ }],
2504
+ action: "multiply",
2505
+ value: 1
2506
+ },
2507
+ {
2508
+ match: [{
2509
+ path: "tags.surface",
2510
+ value: "concrete"
2511
+ }],
2512
+ action: "multiply",
2513
+ value: 1
2514
+ },
2515
+ {
2516
+ match: [{
2517
+ path: "tags.surface",
2518
+ value: "paved"
2519
+ }],
2520
+ action: "multiply",
2521
+ value: 1
2522
+ },
2523
+ {
2524
+ match: [{
2525
+ path: "tags.surface",
2526
+ value: "paving_stones"
2527
+ }],
2528
+ action: "multiply",
2529
+ value: .9
2530
+ },
2531
+ {
2532
+ match: [{
2533
+ path: "tags.surface",
2534
+ value: "compacted"
2535
+ }],
2536
+ action: "multiply",
2537
+ value: .8
2538
+ },
2539
+ {
2540
+ match: [{
2541
+ path: "tags.surface",
2542
+ value: "wood"
2543
+ }],
2544
+ action: "multiply",
2545
+ value: .8
2546
+ },
2547
+ {
2548
+ match: [{
2549
+ path: "tags.surface",
2550
+ value: "metal"
2551
+ }],
2552
+ action: "multiply",
2553
+ value: .7
2554
+ },
2555
+ {
2556
+ match: [{
2557
+ path: "tags.surface",
2558
+ value: "gravel"
2559
+ }],
2560
+ action: "multiply",
2561
+ value: .6
2562
+ },
2563
+ {
2564
+ match: [{
2565
+ path: "tags.surface",
2566
+ value: "grass"
2567
+ }],
2568
+ action: "multiply",
2569
+ value: .5
2570
+ },
2571
+ {
2572
+ match: [{
2573
+ path: "tags.surface",
2574
+ value: "ground"
2575
+ }],
2576
+ action: "multiply",
2577
+ value: .4
2578
+ }
2579
+ ],
2580
+ vertexAccept: [],
2581
+ vertexWeight: [{
2582
+ match: [{
2583
+ path: "tags.barrier",
2584
+ value: "turnstile"
2585
+ }],
2586
+ action: "set",
2587
+ value: 10
2588
+ }]
2589
+ }, {
2590
+ name: "wheelchair",
2363
2591
  baseSpeedKmh: 3,
2364
2592
  edgeAccept: [
2365
2593
  {
2366
- match: { "tags.wheelchair": "no" },
2594
+ match: [{
2595
+ path: "tags.wheelchair",
2596
+ value: "no"
2597
+ }],
2367
2598
  action: "exclude"
2368
2599
  },
2369
2600
  {
2370
- match: { "tags.wheelchair": "designated" },
2601
+ match: [{
2602
+ path: "tags.wheelchair",
2603
+ value: "designated"
2604
+ }],
2371
2605
  action: "include"
2372
2606
  },
2373
2607
  {
2374
- match: { "tags.wheelchair": "yes" },
2608
+ match: [{
2609
+ path: "tags.wheelchair",
2610
+ value: "yes"
2611
+ }],
2375
2612
  action: "include"
2376
2613
  },
2377
2614
  {
2378
- match: { areStairs: !0 },
2615
+ match: [{
2616
+ path: "areStairs",
2617
+ value: !0
2618
+ }],
2379
2619
  action: "exclude"
2380
2620
  },
2381
2621
  {
2382
- match: { areEscalators: !0 },
2622
+ match: [{
2623
+ path: "areEscalators",
2624
+ value: !0
2625
+ }],
2383
2626
  action: "exclude"
2384
2627
  },
2385
2628
  {
2386
- match: { isMovingWalkway: !0 },
2629
+ match: [{
2630
+ path: "isMovingWalkway",
2631
+ value: !0
2632
+ }],
2387
2633
  action: "exclude"
2388
2634
  }
2389
2635
  ],
2390
2636
  edgeWeight: [
2391
2637
  {
2392
- match: { "tags.wheelchair": "limited" },
2638
+ match: [{
2639
+ path: "tags.wheelchair",
2640
+ value: "limited"
2641
+ }],
2393
2642
  action: "multiply",
2394
2643
  value: .5
2395
2644
  },
2396
2645
  {
2397
- match: { "tags.smoothness": "horrible" },
2646
+ match: [{
2647
+ path: "tags.smoothness",
2648
+ value: "horrible"
2649
+ }],
2398
2650
  action: "multiply",
2399
2651
  value: .25
2400
2652
  },
2401
2653
  {
2402
- match: { "tags.smoothness": "bad" },
2654
+ match: [{
2655
+ path: "tags.smoothness",
2656
+ value: "bad"
2657
+ }],
2403
2658
  action: "multiply",
2404
2659
  value: .7
2405
2660
  },
2406
2661
  {
2407
- match: { "tags.smoothness": "intermediate" },
2662
+ match: [{
2663
+ path: "tags.smoothness",
2664
+ value: "intermediate"
2665
+ }],
2408
2666
  action: "multiply",
2409
2667
  value: .9
2410
2668
  },
2411
2669
  {
2412
- match: { "tags.smoothness": "good" },
2670
+ match: [{
2671
+ path: "tags.smoothness",
2672
+ value: "good"
2673
+ }],
2413
2674
  action: "multiply",
2414
2675
  value: 1
2415
2676
  },
2416
2677
  {
2417
- match: { "tags.smoothness": "excellent" },
2678
+ match: [{
2679
+ path: "tags.smoothness",
2680
+ value: "excellent"
2681
+ }],
2418
2682
  action: "multiply",
2419
2683
  value: 1
2420
2684
  },
2421
2685
  {
2422
- match: { "tags.surface": "asphalt" },
2686
+ match: [{
2687
+ path: "tags.surface",
2688
+ value: "asphalt"
2689
+ }],
2423
2690
  action: "multiply",
2424
2691
  value: 1
2425
2692
  },
2426
2693
  {
2427
- match: { "tags.surface": "concrete" },
2694
+ match: [{
2695
+ path: "tags.surface",
2696
+ value: "concrete"
2697
+ }],
2428
2698
  action: "multiply",
2429
2699
  value: 1
2430
2700
  },
2431
2701
  {
2432
- match: { "tags.surface": "paved" },
2702
+ match: [{
2703
+ path: "tags.surface",
2704
+ value: "paved"
2705
+ }],
2433
2706
  action: "multiply",
2434
2707
  value: 1
2435
2708
  },
2436
2709
  {
2437
- match: { "tags.surface": "paving_stones" },
2710
+ match: [{
2711
+ path: "tags.surface",
2712
+ value: "paving_stones"
2713
+ }],
2438
2714
  action: "multiply",
2439
2715
  value: .9
2440
2716
  },
2441
2717
  {
2442
- match: { "tags.surface": "compacted" },
2718
+ match: [{
2719
+ path: "tags.surface",
2720
+ value: "compacted"
2721
+ }],
2443
2722
  action: "multiply",
2444
2723
  value: .9
2445
2724
  },
2446
2725
  {
2447
- match: { "tags.surface": "wood" },
2726
+ match: [{
2727
+ path: "tags.surface",
2728
+ value: "wood"
2729
+ }],
2448
2730
  action: "multiply",
2449
2731
  value: .75
2450
2732
  },
2451
2733
  {
2452
- match: { "tags.surface": "metal" },
2734
+ match: [{
2735
+ path: "tags.surface",
2736
+ value: "metal"
2737
+ }],
2453
2738
  action: "multiply",
2454
2739
  value: .7
2455
2740
  },
2456
2741
  {
2457
- match: { "tags.surface": "gravel" },
2742
+ match: [{
2743
+ path: "tags.surface",
2744
+ value: "gravel"
2745
+ }],
2458
2746
  action: "multiply",
2459
2747
  value: .5
2460
2748
  },
2461
2749
  {
2462
- match: { "tags.surface": "grass" },
2750
+ match: [{
2751
+ path: "tags.surface",
2752
+ value: "grass"
2753
+ }],
2463
2754
  action: "multiply",
2464
2755
  value: .4
2465
2756
  },
2466
2757
  {
2467
- match: { "tags.surface": "ground" },
2758
+ match: [{
2759
+ path: "tags.surface",
2760
+ value: "ground"
2761
+ }],
2468
2762
  action: "multiply",
2469
2763
  value: .5
2470
2764
  }
2471
2765
  ]
2472
- };
2473
- var default_rules_default = {
2474
- default: {
2475
- baseSpeedKmh: 4,
2476
- useMultiLevelSegments: !1,
2477
- edgeAccept: [{
2478
- match: { "tags.wheelchair": "designated" },
2479
- action: "exclude"
2480
- }],
2481
- edgeWeight: [
2482
- {
2483
- match: { isElevator: !0 },
2484
- action: "set",
2485
- value: 90
2486
- },
2487
- {
2488
- match: { areStairs: !0 },
2489
- action: "multiply",
2490
- value: 3
2491
- },
2492
- {
2493
- match: { areEscalators: !0 },
2494
- action: "multiply",
2495
- value: 1.5
2496
- },
2497
- {
2498
- match: { isMovingWalkway: !0 },
2499
- action: "multiply",
2500
- value: .8
2501
- },
2502
- {
2503
- match: { "tags.smoothness": "horrible" },
2504
- action: "multiply",
2505
- value: .4
2506
- },
2507
- {
2508
- match: { "tags.smoothness": "bad" },
2509
- action: "multiply",
2510
- value: .7
2511
- },
2512
- {
2513
- match: { "tags.smoothness": "intermediate" },
2514
- action: "multiply",
2515
- value: .8
2516
- },
2517
- {
2518
- match: { "tags.smoothness": "good" },
2519
- action: "multiply",
2520
- value: .9
2521
- },
2522
- {
2523
- match: { "tags.smoothness": "excellent" },
2524
- action: "multiply",
2525
- value: 1
2526
- },
2527
- {
2528
- match: { "tags.surface": "asphalt" },
2529
- action: "multiply",
2530
- value: 1
2531
- },
2532
- {
2533
- match: { "tags.surface": "concrete" },
2534
- action: "multiply",
2535
- value: 1
2536
- },
2537
- {
2538
- match: { "tags.surface": "paved" },
2539
- action: "multiply",
2540
- value: 1
2541
- },
2542
- {
2543
- match: { "tags.surface": "paving_stones" },
2544
- action: "multiply",
2545
- value: .9
2546
- },
2547
- {
2548
- match: { "tags.surface": "compacted" },
2549
- action: "multiply",
2550
- value: .8
2551
- },
2552
- {
2553
- match: { "tags.surface": "wood" },
2554
- action: "multiply",
2555
- value: .8
2556
- },
2557
- {
2558
- match: { "tags.surface": "metal" },
2559
- action: "multiply",
2560
- value: .7
2561
- },
2562
- {
2563
- match: { "tags.surface": "gravel" },
2564
- action: "multiply",
2565
- value: .6
2566
- },
2567
- {
2568
- match: { "tags.surface": "grass" },
2569
- action: "multiply",
2570
- value: .5
2571
- },
2572
- {
2573
- match: { "tags.surface": "ground" },
2574
- action: "multiply",
2575
- value: .4
2576
- }
2577
- ],
2578
- vertexAccept: [],
2579
- vertexWeight: [{
2580
- match: { "tags.barrier": "turnstile" },
2581
- action: "set",
2582
- value: 10
2583
- }]
2584
- },
2585
- wheelchair
2586
- }, matchAll = (e, t) => Object.entries(t).every(([t, n]) => t.split(".").reduce((e, t) => {
2766
+ }] }, matchAll = (e, t) => t.every(({ path: t, value: n }) => t.split(".").reduce((e, t) => {
2587
2767
  if (e != null) return e[t];
2588
2768
  }, e) === n), createEdgeScope = (e) => ({
2589
2769
  tags: e.rawTags,
@@ -2594,17 +2774,18 @@ var default_rules_default = {
2594
2774
  }), createVertexScope = (e) => ({ tags: e.rawTags }), GraphRouterRules = class e {
2595
2775
  baseSpeedKmh;
2596
2776
  edgeAcceptRules;
2777
+ edgeAcceptOnlyRules;
2597
2778
  edgeWeightRules;
2598
2779
  vertexAcceptRules;
2599
2780
  vertexWeightRules;
2600
2781
  projectionMaxDistance;
2601
2782
  useMultiLevelSegments;
2602
- constructor(e, t = [], n = [], r = [], i = [], a, o) {
2603
- this.baseSpeedKmh = e, this.edgeAcceptRules = t, this.edgeWeightRules = n, this.vertexAcceptRules = r, this.vertexWeightRules = i, this.projectionMaxDistance = a, this.useMultiLevelSegments = o;
2783
+ constructor(e, t = [], n = [], r = [], i = [], a = [], o, s) {
2784
+ this.baseSpeedKmh = e, this.edgeAcceptRules = t, this.edgeAcceptOnlyRules = n, this.edgeWeightRules = r, this.vertexAcceptRules = i, this.vertexWeightRules = a, this.projectionMaxDistance = o, this.useMultiLevelSegments = s;
2604
2785
  }
2605
2786
  static normalizeMatchKey(e) {
2606
- let t = Object.keys(e).sort(), n = Object.fromEntries(t.map((t) => [t, e[t]]));
2607
- return JSON.stringify(n);
2787
+ let t = [...e].sort((e, t) => e.path.localeCompare(t.path));
2788
+ return JSON.stringify(t);
2608
2789
  }
2609
2790
  evaluateAcceptRules(t, n) {
2610
2791
  let r = n.filter((e) => matchAll(t, e.match));
@@ -2622,7 +2803,7 @@ var default_rules_default = {
2622
2803
  acceptEdgeFn = (e) => {
2623
2804
  if (!this.acceptVertex(e.vertex1) || !this.acceptVertex(e.vertex2)) return !1;
2624
2805
  let t = createEdgeScope(e);
2625
- return this.evaluateAcceptRules(t, this.edgeAcceptRules);
2806
+ return this.edgeAcceptOnlyRules.length > 0 ? this.edgeAcceptOnlyRules.some((e) => matchAll(t, e.match)) : this.evaluateAcceptRules(t, this.edgeAcceptRules);
2626
2807
  };
2627
2808
  weightEdgeFn = (e) => {
2628
2809
  let t = getDurationFromLength(e.length, this.baseSpeedKmh), n = createEdgeScope(e);
@@ -2637,10 +2818,22 @@ var default_rules_default = {
2637
2818
  return 0;
2638
2819
  };
2639
2820
  static fromData(t) {
2640
- return new e(t.baseSpeedKmh, t.edgeAccept, t.edgeWeight, t.vertexAccept, t.vertexWeight, t.projectionMaxDistance, t.useMultiLevelSegments);
2821
+ return new e(t.baseSpeedKmh, t.edgeAccept, t.edgeAcceptOnly, t.edgeWeight, t.vertexAccept, t.vertexWeight, t.projectionMaxDistance, t.useMultiLevelSegments);
2822
+ }
2823
+ toData() {
2824
+ return {
2825
+ ...this.baseSpeedKmh !== void 0 && { baseSpeedKmh: this.baseSpeedKmh },
2826
+ ...this.edgeAcceptRules.length > 0 && { edgeAccept: this.edgeAcceptRules },
2827
+ ...this.edgeAcceptOnlyRules.length > 0 && { edgeAcceptOnly: this.edgeAcceptOnlyRules },
2828
+ ...this.edgeWeightRules.length > 0 && { edgeWeight: this.edgeWeightRules },
2829
+ ...this.vertexAcceptRules.length > 0 && { vertexAccept: this.vertexAcceptRules },
2830
+ ...this.vertexWeightRules.length > 0 && { vertexWeight: this.vertexWeightRules },
2831
+ ...this.projectionMaxDistance !== void 0 && { projectionMaxDistance: this.projectionMaxDistance },
2832
+ ...this.useMultiLevelSegments !== void 0 && { useMultiLevelSegments: this.useMultiLevelSegments }
2833
+ };
2641
2834
  }
2642
2835
  static fromConfig(t) {
2643
- return Object.fromEntries(Object.entries(t).map(([t, n]) => [t, e.fromData(n)]));
2836
+ return Object.fromEntries(t.rules.map((t) => [t.name, e.fromData(t)]));
2644
2837
  }
2645
2838
  };
2646
2839
  function mergeRulesRegistries(e, ...t) {
@@ -2650,13 +2843,13 @@ function mergeRulesRegistries(e, ...t) {
2650
2843
  n[t] = r;
2651
2844
  continue;
2652
2845
  }
2653
- n[t] = new GraphRouterRules(r.baseSpeedKmh ?? n[t].baseSpeedKmh, [...r.edgeAcceptRules ?? [], ...n[t].edgeAcceptRules ?? []], [...r.edgeWeightRules ?? [], ...n[t].edgeWeightRules ?? []], [...r.vertexAcceptRules ?? [], ...n[t].vertexAcceptRules ?? []], [...r.vertexWeightRules ?? [], ...n[t].vertexWeightRules ?? []], r.projectionMaxDistance ?? n[t].projectionMaxDistance, r.useMultiLevelSegments ?? n[t].useMultiLevelSegments);
2846
+ n[t] = new GraphRouterRules(r.baseSpeedKmh ?? n[t].baseSpeedKmh, [...r.edgeAcceptRules ?? [], ...n[t].edgeAcceptRules ?? []], [...r.edgeAcceptOnlyRules ?? [], ...n[t].edgeAcceptOnlyRules ?? []], [...r.edgeWeightRules ?? [], ...n[t].edgeWeightRules ?? []], [...r.vertexAcceptRules ?? [], ...n[t].vertexAcceptRules ?? []], [...r.vertexWeightRules ?? [], ...n[t].vertexWeightRules ?? []], r.projectionMaxDistance ?? n[t].projectionMaxDistance, r.useMultiLevelSegments ?? n[t].useMultiLevelSegments);
2654
2847
  }
2655
2848
  return n;
2656
2849
  }
2657
2850
  function mergeRules(e) {
2658
- let t = (e.find((e) => e.baseSpeedKmh !== void 0) ?? e[0]).baseSpeedKmh, n = e.flatMap((e) => e.edgeAcceptRules ?? []), r = e.flatMap((e) => e.edgeWeightRules ?? []), i = e.flatMap((e) => e.vertexAcceptRules ?? []), a = e.flatMap((e) => e.vertexWeightRules ?? []), o = e.find((e) => e.projectionMaxDistance !== void 0)?.projectionMaxDistance, s = e.find((e) => e.useMultiLevelSegments !== void 0)?.useMultiLevelSegments;
2659
- return new GraphRouterRules(t, n, r, i, a, o, s);
2851
+ let t = (e.find((e) => e.baseSpeedKmh !== void 0) ?? e[0]).baseSpeedKmh, n = e.flatMap((e) => e.edgeAcceptRules ?? []), r = e.flatMap((e) => e.edgeAcceptOnlyRules ?? []), i = e.flatMap((e) => e.edgeWeightRules ?? []), a = e.flatMap((e) => e.vertexAcceptRules ?? []), o = e.flatMap((e) => e.vertexWeightRules ?? []), s = e.find((e) => e.projectionMaxDistance !== void 0)?.projectionMaxDistance, c = e.find((e) => e.useMultiLevelSegments !== void 0)?.useMultiLevelSegments;
2852
+ return new GraphRouterRules(t, n, r, i, a, o, s, c);
2660
2853
  }
2661
2854
  const StatusCode = {
2662
2855
  OK: 0,
@@ -2714,27 +2907,12 @@ var RoutingError = class e extends Error {
2714
2907
  constructor(...e) {
2715
2908
  this.rulesRegistry = mergeRulesRegistries(defaultRulesModes, ...e.map(GraphRouterRules.fromConfig));
2716
2909
  }
2717
- build(e = {}) {
2718
- let t = e.itineraryRules || [];
2719
- for (let e of t) if (!this.rulesRegistry[e]) throw RoutingError.invalidRules(e, Object.keys(this.rulesRegistry));
2720
- let n = [...t.filter((e) => e !== "default"), "default"];
2721
- return mergeRules([this.createRulesFromItineraryModifiers(e.itineraryModifiers), ...n.map((e) => this.rulesRegistry[e])]);
2910
+ build(e = []) {
2911
+ for (let t of e) if (!this.rulesRegistry[t]) throw RoutingError.invalidRules(t, Object.keys(this.rulesRegistry));
2912
+ return mergeRules([...[...e.filter((e) => e !== "default"), "default"].map((e) => this.rulesRegistry[e])]);
2722
2913
  }
2723
- createRulesFromItineraryModifiers(e) {
2724
- let t = [];
2725
- return e?.avoidStairs && t.push({
2726
- match: { areStairs: !0 },
2727
- action: "exclude"
2728
- }), e?.avoidEscalators && t.push({
2729
- match: { areEscalators: !0 },
2730
- action: "exclude"
2731
- }), e?.avoidElevators && t.push({
2732
- match: { isElevator: !0 },
2733
- action: "exclude"
2734
- }), e?.avoidMovingWalkways && t.push({
2735
- match: { isMovingWalkway: !0 },
2736
- action: "exclude"
2737
- }), new GraphRouterRules(void 0, t);
2914
+ getRulesNames() {
2915
+ return Object.keys(this.rulesRegistry).filter((e) => e !== "default");
2738
2916
  }
2739
2917
  };
2740
2918
  const DefaultGraphRouterRules = new GraphRouterRulesBuilder().build();
@@ -2831,27 +3009,24 @@ var GraphRouterEngineResults = class {
2831
3009
  return this.calculateShortestPathToMultipleDestinationsByVertex(e, [t], n, r, i);
2832
3010
  }
2833
3011
  calculateComponents() {
2834
- function e(e) {
2835
- let t = e.values().next().value;
2836
- return e.delete(t), t;
2837
- }
3012
+ let e = /* @__PURE__ */ new Map();
3013
+ this.graph.vertices.forEach((t) => e.set(t, /* @__PURE__ */ new Set())), this.graph.edges.filter((e) => !this.disabledEdges.has(e)).forEach((t) => {
3014
+ e.get(t.vertex1)?.add(t.vertex2), e.get(t.vertex2)?.add(t.vertex1);
3015
+ });
2838
3016
  let t = new Set(this.graph.vertices), n = [];
2839
3017
  for (; t.size > 0;) {
2840
- let r = e(t), i = this.graph.vertices.filter((e) => e.id !== r.id), a = this.calculateShortestPathToMultipleDestinationsByVertex(r, i), o = i.filter((e) => a.weightedDistance(e) !== null);
2841
- n.push([r, ...o]), o.forEach((e) => t.delete(e));
2842
- }
2843
- let r;
2844
- do {
2845
- r = !1;
2846
- for (let e = 0; e < n.length - 1; e++) {
2847
- let t = n[e];
2848
- for (let i = e + 1; i < n.length; i++) {
2849
- let e = n[i];
2850
- e.some((e) => t.includes(e)) && (t.push(...e), n = n.filter((t) => t !== e), r = !0);
2851
- }
3018
+ let r = t.values().next().value, i = [r], a = [];
3019
+ for (t.delete(r); i.length > 0;) {
3020
+ let n = i.pop();
3021
+ a.push(n);
3022
+ let r = e.get(n);
3023
+ r && r.forEach((e) => {
3024
+ t.has(e) && (t.delete(e), i.push(e));
3025
+ });
2852
3026
  }
2853
- } while (r);
2854
- return n.map((e) => [...new Set(e)]);
3027
+ n.push(a);
3028
+ }
3029
+ return n;
2855
3030
  }
2856
3031
  toGeoJson() {
2857
3032
  return {
@@ -2906,15 +3081,12 @@ var GraphRouterEngineResults = class {
2906
3081
  if (t === null) return null;
2907
3082
  if (t.nearestElement instanceof Vertex) return t.nearestElement;
2908
3083
  if (t.nearestElement instanceof Edge) {
2909
- let e = t.nearestElement, n = new Vertex(t.coords, {
2910
- name: `proj on ${e.properties.name || null} (tmp)`,
2911
- ...e.properties.externalId !== void 0 && { externalId: e.properties.externalId }
2912
- });
3084
+ let e = t.nearestElement, n = new Vertex(t.coords, { ...e.properties.externalId !== void 0 && { externalId: e.properties.externalId } });
2913
3085
  n.id = this.graph.vertices.length + r.size;
2914
3086
  let o = {
2915
3087
  ...e.properties,
2916
3088
  ...e.properties.externalId !== void 0 && { externalId: e.properties.externalId }
2917
- }, s = new Edge(e.vertex1, n, o), c = new Edge(n, e.vertex2, o);
3089
+ }, s = new Edge(e.vertex1, n, o, e.rawTags), c = new Edge(n, e.vertex2, o, e.rawTags);
2918
3090
  r.add(n), i.add(s), i.add(c);
2919
3091
  let l = a.find((t) => t[0] === e);
2920
3092
  return l ? l[1].push(n) : a.push([e, [n]]), n;
@@ -2931,7 +3103,7 @@ var GraphRouterEngineResults = class {
2931
3103
  for (let r = 0; r < t.length; r++) {
2932
3104
  let a = t[r], o = a.distanceTo(e.vertex1);
2933
3105
  for (let s = r + 1; s < t.length; s++) {
2934
- let r = t[s], c = r.distanceTo(e.vertex1) < o ? new Edge(r, a, n) : new Edge(a, r, n);
3106
+ let r = t[s], c = r.distanceTo(e.vertex1) < o ? new Edge(r, a, n, e.rawTags) : new Edge(a, r, n, e.rawTags);
2935
3107
  i.add(c);
2936
3108
  }
2937
3109
  }
@@ -2974,6 +3146,7 @@ var GraphRouterEngineResults = class {
2974
3146
  }, CustomGraphMap = class {
2975
3147
  router;
2976
3148
  routerRulesBuilder;
3149
+ rulesConfigs;
2977
3150
  graph;
2978
3151
  name;
2979
3152
  get routingBounds() {
@@ -2983,7 +3156,7 @@ var GraphRouterEngineResults = class {
2983
3156
  return this.graph.routingBoundsEntryPoints;
2984
3157
  }
2985
3158
  constructor(e, t = null, n = []) {
2986
- this.graph = e, this.name = t, this.router = new GraphRouter_default(e), this.routerRulesBuilder = new GraphRouterRulesBuilder(...n);
3159
+ this.graph = e, this.name = t, this.router = new GraphRouter_default(e), this.routerRulesBuilder = new GraphRouterRulesBuilder(...n), this.rulesConfigs = n;
2987
3160
  }
2988
3161
  isPointInside(e) {
2989
3162
  return this.routingBounds ? pointInPolygon([e.lng, e.lat], this.routingBounds) : !1;
@@ -2994,7 +3167,7 @@ var GraphRouterEngineResults = class {
2994
3167
  return a + (o + s - (c + l)) * 50;
2995
3168
  });
2996
3169
  }
2997
- getBestRouteFromEntryPointsToDestination(e, t, n) {
3170
+ getBestRouteFromEntryPointsToDestination(e, t, n = []) {
2998
3171
  let r = this.routerRulesBuilder.build(n), i = this.getOrderedEntryPointsSortedByDistance(e, t);
2999
3172
  for (let e of i) {
3000
3173
  let n = this.router.calculateShortestPath(e.coords, t, r).route();
@@ -3002,7 +3175,7 @@ var GraphRouterEngineResults = class {
3002
3175
  }
3003
3176
  return null;
3004
3177
  }
3005
- getBestRouteFromOriginToEntryPoints(e, t, n) {
3178
+ getBestRouteFromOriginToEntryPoints(e, t, n = []) {
3006
3179
  let r = this.routerRulesBuilder.build(n), i = this.getOrderedEntryPointsSortedByDistance(e, t);
3007
3180
  for (let t of i) {
3008
3181
  let n = this.router.calculateShortestPath(e, t.coords, r).route();
@@ -3010,15 +3183,15 @@ var GraphRouterEngineResults = class {
3010
3183
  }
3011
3184
  return null;
3012
3185
  }
3013
- getRouteInsideMap(e, t, n) {
3186
+ getRouteInsideMap(e, t, n = []) {
3014
3187
  let r = this.routerRulesBuilder.build(n), i = this.router.calculateShortestPath(e, t, r).route();
3015
3188
  return i.hasRoute ? i : null;
3016
3189
  }
3017
- getTripInsideMap(e, t) {
3190
+ getTripInsideMap(e, t = []) {
3018
3191
  let n = this.routerRulesBuilder.build(t);
3019
3192
  return this.router.getShortestTrip(e, n);
3020
3193
  }
3021
- getRoutesMultipleDestinationsInsideMap(e, t, n) {
3194
+ getRoutesMultipleDestinationsInsideMap(e, t, n = []) {
3022
3195
  let r = this.routerRulesBuilder.build(n);
3023
3196
  return this.router.calculateShortestPathToMultipleDestinations(e, t, r);
3024
3197
  }
@@ -3820,27 +3993,27 @@ var OsrmRemoteRouter_default = new class extends RemoteRouter_default {
3820
3993
  let i = outputModeCorrespondance.get(r), { routes: a } = e;
3821
3994
  if (!a) throw RemoteRoutingError.notFound(this.rname, e.message);
3822
3995
  return a.map((e) => {
3823
- let r = e.legs.map((e) => {
3824
- let t = e.steps.map((e) => e.geometry.coordinates.map(this.jsonToCoordinates)).flat().filter((e, t, n) => t === 0 || !n[t - 1].equals(e)), n = t[0], r = t[t.length - 1], a = new StepsBuilder().setPathCoords(t).setStart(n).setEnd(r);
3825
- return e.steps?.forEach(({ maneuver: e, name: n, distance: r, duration: i }) => {
3826
- let o = this.jsonToCoordinates(e.location), s = t.map((e) => e.distanceTo(o)), c = s.indexOf(Math.min(...s));
3827
- if (c < 0) throw Error("Osrm Parser: Cannot find step coords in leg coordinates");
3828
- let l = e.exit === void 0 ? n : e.exit.toString();
3829
- a.addStepInfo({
3830
- coords: t[c],
3831
- name: l,
3832
- distance: r,
3833
- duration: i,
3996
+ let r = e.legs.map((r, a) => {
3997
+ let o = r.steps.map((e) => e.geometry.coordinates.map(this.jsonToCoordinates)).flat().filter((e, t, n) => t === 0 || !n[t - 1].equals(e)), s = a === 0 ? t : o[0], c = a === e.legs.length - 1 ? n : o[o.length - 1], l = new StepsBuilder().setPathCoords(o).setStart(s).setEnd(c);
3998
+ return r.steps?.forEach(({ maneuver: e, name: t, distance: n, duration: r }) => {
3999
+ let i = this.jsonToCoordinates(e.location), a = o.map((e) => e.distanceTo(i)), s = a.indexOf(Math.min(...a));
4000
+ if (s < 0) throw Error("Osrm Parser: Cannot find step coords in leg coordinates");
4001
+ let c = e.exit === void 0 ? t : e.exit.toString();
4002
+ l.addStepInfo({
4003
+ coords: o[s],
4004
+ name: c,
4005
+ distance: n,
4006
+ duration: r,
3834
4007
  type: this.osrmTypeToStepType(e.type),
3835
4008
  direction: this.osrmModifierToStepDirection(e.modifier)
3836
4009
  });
3837
4010
  }), new Leg({
3838
4011
  transitMode: i,
3839
- duration: e.duration,
3840
- coords: t,
3841
- start: { coords: n },
3842
- end: { coords: r },
3843
- steps: a.build()
4012
+ duration: r.duration,
4013
+ coords: o,
4014
+ start: { coords: s },
4015
+ end: { coords: c },
4016
+ steps: l.build()
3844
4017
  });
3845
4018
  });
3846
4019
  return new Itinerary({
@@ -4122,97 +4295,97 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
4122
4295
  return this.maps.find((t) => t.name === e);
4123
4296
  }
4124
4297
  async getItineraries(e, t = [], n = this.maps) {
4125
- let { origin: r, destination: i } = e;
4298
+ let { origin: r, destination: i, itineraryRules: a } = e;
4126
4299
  t = t.filter(({ name: e }) => e !== WemapMultiRemoteRouter_default.rname) || [];
4127
- let a = n;
4128
- if (!a.length) return await RemoteRouterManager_default.getItinerariesWithFallback(e, t);
4129
- let o, s, c = a.find((e) => e.isPointInside(r));
4130
- if (c && c.isPointInside(i)) {
4131
- if (o = c.getRouteInsideMap(r, i, e), !o) throw WemapMultiRoutingError.notFound(c.name || "");
4132
- return [Itinerary.fromGraphRoute(o)];
4133
- }
4134
- let l = a.find((e) => e.isPointInside(i)), u;
4135
- if (!c && !l) return await RemoteRouterManager_default.getItinerariesWithFallback(e, t);
4136
- if (c && !l) {
4137
- if (!c.entryPoints.length) throw WemapMultiRoutingError.notFound(c.name || "", `A map including the "origin" but the "destination" has been
4138
- found (${c.name}), however, no "entrypoints" have been found to go out`);
4139
- let n = (e) => `Tried to calculate an itinerary from "origin" to "entrypoints" using wemap router on local map "${c.name}" and an itinerary from "entrypoints" to "destination" using remote routers (${t.map((e) => e.name).join(", ")}), but failed. Details: ${e}.`;
4140
- if (o = c.getBestRouteFromOriginToEntryPoints(r, i, e), !o) {
4141
- let e = `No route found from ${r.toString()} to entry points in map: ${c.name}`;
4142
- throw WemapMultiRoutingError.notFound(c.name || "", n(e));
4300
+ let o = n;
4301
+ if (!o.length) return await RemoteRouterManager_default.getItinerariesWithFallback(e, t);
4302
+ let s, c, l = o.find((e) => e.isPointInside(r));
4303
+ if (l && l.isPointInside(i)) {
4304
+ if (s = l.getRouteInsideMap(r, i, a), !s) throw WemapMultiRoutingError.notFound(l.name || "");
4305
+ return [Itinerary.fromGraphRoute(s)];
4306
+ }
4307
+ let u = o.find((e) => e.isPointInside(i)), d;
4308
+ if (!l && !u) return await RemoteRouterManager_default.getItinerariesWithFallback(e, t);
4309
+ if (l && !u) {
4310
+ if (!l.entryPoints.length) throw WemapMultiRoutingError.notFound(l.name || "", `A map including the "origin" but the "destination" has been
4311
+ found (${l.name}), however, no "entrypoints" have been found to go out`);
4312
+ let n = (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}.`;
4313
+ if (s = l.getBestRouteFromOriginToEntryPoints(r, i, a), !s) {
4314
+ let e = `No route found from ${r.toString()} to entry points in map: ${l.name}`;
4315
+ throw WemapMultiRoutingError.notFound(l.name || "", n(e));
4143
4316
  }
4144
- let a = {
4317
+ let o = {
4145
4318
  ...e,
4146
- origin: o.end,
4319
+ origin: s.end,
4147
4320
  destination: i,
4148
4321
  waypoints: []
4149
4322
  };
4150
4323
  try {
4151
- u = await RemoteRouterManager_default.getItinerariesWithFallback(a, t);
4324
+ d = await RemoteRouterManager_default.getItinerariesWithFallback(o, t);
4152
4325
  } catch (e) {
4153
4326
  throw e instanceof RemoteRoutingError && (e.message = n(e.message)), e;
4154
4327
  }
4155
- return s = Itinerary.fromGraphRoute(o), u.map((e) => Itinerary.fromItineraries(s, e));
4156
- }
4157
- if (!c && l) {
4158
- if (!l.entryPoints.length) throw WemapMultiRoutingError.notFound(l.name || "", `A map including the "destination" but the "origin" has been
4159
- found (${l.name}), however, no "entrypoints" have been found to go in`);
4160
- let n = (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 "${l.name}", but failed. Details: ${e}.`;
4161
- if (o = l.getBestRouteFromEntryPointsToDestination(r, i, e), !o) {
4162
- let e = `No route found from entry points to ${i.toString()} in map: ${l.name}`;
4163
- throw WemapMultiRoutingError.notFound(l.name || "", n(e));
4328
+ return c = Itinerary.fromGraphRoute(s), d.map((e) => Itinerary.fromItineraries(c, e));
4329
+ }
4330
+ if (!l && u) {
4331
+ if (!u.entryPoints.length) throw WemapMultiRoutingError.notFound(u.name || "", `A map including the "destination" but the "origin" has been
4332
+ found (${u.name}), however, no "entrypoints" have been found to go in`);
4333
+ let n = (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}.`;
4334
+ if (s = u.getBestRouteFromEntryPointsToDestination(r, i, a), !s) {
4335
+ let e = `No route found from entry points to ${i.toString()} in map: ${u.name}`;
4336
+ throw WemapMultiRoutingError.notFound(u.name || "", n(e));
4164
4337
  }
4165
- let a = {
4338
+ let o = {
4166
4339
  ...e,
4167
4340
  origin: r,
4168
- destination: o.start,
4341
+ destination: s.start,
4169
4342
  waypoints: []
4170
4343
  };
4171
4344
  try {
4172
- u = await RemoteRouterManager_default.getItinerariesWithFallback(a, t);
4345
+ d = await RemoteRouterManager_default.getItinerariesWithFallback(o, t);
4173
4346
  } catch (e) {
4174
4347
  throw e instanceof RemoteRoutingError && (e.message = n(e.message)), e;
4175
4348
  }
4176
- return s = Itinerary.fromGraphRoute(o), u.map((e) => Itinerary.fromItineraries(e, s));
4349
+ return c = Itinerary.fromGraphRoute(s), d.map((e) => Itinerary.fromItineraries(e, c));
4177
4350
  }
4178
- if (c && l) {
4179
- if (!c.entryPoints.length) throw WemapMultiRoutingError.notFound(c.name || "", `One map including the "origin" (${c.name}) and another
4180
- including the "destination" (${l.name}) has been found, however, no "entrypoints" have
4351
+ if (l && u) {
4352
+ if (!l.entryPoints.length) throw WemapMultiRoutingError.notFound(l.name || "", `One map including the "origin" (${l.name}) and another
4353
+ including the "destination" (${u.name}) has been found, however, no "entrypoints" have
4181
4354
  been found to go out of the origin map`);
4182
- if (!l.entryPoints.length) throw WemapMultiRoutingError.notFound(l.name || "", `One map including the "origin" (${c.name}) and another
4183
- including the "destination" (${l.name}) has been found, however, no "entrypoints" have
4355
+ if (!u.entryPoints.length) throw WemapMultiRoutingError.notFound(u.name || "", `One map including the "origin" (${l.name}) and another
4356
+ including the "destination" (${u.name}) has been found, however, no "entrypoints" have
4184
4357
  been found to go in the second map`);
4185
- let n = (e) => `Tried to calculate an itinerary from "origin" to "entrypoints1" using wemap router on local map "${c.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 "${l.name}", but failed. Details: ${e}.`, a = c.getBestRouteFromOriginToEntryPoints(r, i, e);
4186
- if (!a) {
4187
- let e = `No route found from ${r.toString()} to entry points in map: ${c.name}`;
4188
- throw WemapMultiRoutingError.notFound(c.name || "", n(e));
4189
- }
4190
- let o = l.getBestRouteFromEntryPointsToDestination(r, i, e);
4358
+ let n = (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 "${u.name}", but failed. Details: ${e}.`, o = l.getBestRouteFromOriginToEntryPoints(r, i, a);
4191
4359
  if (!o) {
4192
- let e = `No route found from entry points to ${i.toString()} in map: ${l.name}`;
4360
+ let e = `No route found from ${r.toString()} to entry points in map: ${l.name}`;
4193
4361
  throw WemapMultiRoutingError.notFound(l.name || "", n(e));
4194
4362
  }
4195
- let s = {
4363
+ let s = u.getBestRouteFromEntryPointsToDestination(r, i, a);
4364
+ if (!s) {
4365
+ let e = `No route found from entry points to ${i.toString()} in map: ${u.name}`;
4366
+ throw WemapMultiRoutingError.notFound(u.name || "", n(e));
4367
+ }
4368
+ let c = {
4196
4369
  ...e,
4197
- origin: a.end,
4198
- destination: o.start,
4370
+ origin: o.end,
4371
+ destination: s.start,
4199
4372
  waypoints: []
4200
4373
  };
4201
4374
  try {
4202
- u = await RemoteRouterManager_default.getItinerariesWithFallback(s, t);
4375
+ d = await RemoteRouterManager_default.getItinerariesWithFallback(c, t);
4203
4376
  } catch (e) {
4204
4377
  throw e instanceof RemoteRoutingError && (e.message = n(e.message)), e;
4205
4378
  }
4206
- return u.map((e) => Itinerary.fromItineraries(Itinerary.fromGraphRoute(a), e, Itinerary.fromGraphRoute(o)));
4379
+ return d.map((e) => Itinerary.fromItineraries(Itinerary.fromGraphRoute(o), e, Itinerary.fromGraphRoute(s)));
4207
4380
  }
4208
4381
  throw Error("Should never happen");
4209
4382
  }
4210
4383
  }, require_lodash_custom = /* @__PURE__ */ __commonJSMin$1(((e, t) => {
4211
4384
  (function() {
4212
- var n, r = "4.15.0", i = 200, a = "Expected a function", o = "__lodash_hash_undefined__", s = 1, c = 2, l = Infinity, u = 9007199254740991, d = "[object Arguments]", f = "[object Array]", p = "[object Boolean]", m = "[object Date]", h = "[object Error]", g = "[object Function]", _ = "[object GeneratorFunction]", v = "[object Map]", y = "[object Number]", b = "[object Object]", x = "[object Promise]", S = "[object RegExp]", C = "[object Set]", w = "[object String]", T = "[object Symbol]", E = "[object WeakMap]", D = "[object ArrayBuffer]", O = "[object DataView]", k = "[object Float32Array]", A = "[object Float64Array]", j = "[object Int8Array]", M = "[object Int16Array]", N = "[object Int32Array]", P = "[object Uint8Array]", F = "[object Uint8ClampedArray]", I = "[object Uint16Array]", ee = "[object Uint32Array]", L = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, te = /^\w*$/, R = /^\./, z = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, B = /[\\^$.*+?()[\]{}|]/g, V = /\\(\\)?/g, H = /\w*$/, ne = /^\[object .+?Constructor\]$/, re = /^(?:0|[1-9]\d*)$/, U = {};
4213
- U[k] = U[A] = U[j] = U[M] = U[N] = U[P] = U[F] = U[I] = U[ee] = !0, U[d] = U[f] = U[D] = U[p] = U[O] = U[m] = U[h] = U[g] = U[v] = U[y] = U[b] = U[S] = U[C] = U[w] = U[E] = !1;
4385
+ var n, r = "4.15.0", i = 200, a = "Expected a function", o = "__lodash_hash_undefined__", s = 1, c = 2, l = Infinity, u = 9007199254740991, d = "[object Arguments]", f = "[object Array]", p = "[object Boolean]", m = "[object Date]", h = "[object Error]", g = "[object Function]", _ = "[object GeneratorFunction]", v = "[object Map]", y = "[object Number]", b = "[object Object]", x = "[object Promise]", S = "[object RegExp]", C = "[object Set]", w = "[object String]", T = "[object Symbol]", E = "[object WeakMap]", D = "[object ArrayBuffer]", O = "[object DataView]", k = "[object Float32Array]", A = "[object Float64Array]", ee = "[object Int8Array]", j = "[object Int16Array]", M = "[object Int32Array]", N = "[object Uint8Array]", P = "[object Uint8ClampedArray]", F = "[object Uint16Array]", I = "[object Uint32Array]", L = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, te = /^\w*$/, R = /^\./, z = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, B = /[\\^$.*+?()[\]{}|]/g, V = /\\(\\)?/g, H = /\w*$/, ne = /^\[object .+?Constructor\]$/, re = /^(?:0|[1-9]\d*)$/, U = {};
4386
+ U[k] = U[A] = U[ee] = U[j] = U[M] = U[N] = U[P] = U[F] = U[I] = !0, U[d] = U[f] = U[D] = U[p] = U[O] = U[m] = U[h] = U[g] = U[v] = U[y] = U[b] = U[S] = U[C] = U[w] = U[E] = !1;
4214
4387
  var W = {};
4215
- W[d] = W[f] = W[D] = W[O] = W[p] = W[m] = W[k] = W[A] = W[j] = W[M] = W[N] = W[v] = W[y] = W[b] = W[S] = W[C] = W[w] = W[T] = W[P] = W[F] = W[I] = W[ee] = !0, W[h] = W[g] = W[E] = !1;
4388
+ W[d] = W[f] = W[D] = W[O] = W[p] = W[m] = W[k] = W[A] = W[ee] = W[j] = W[M] = W[v] = W[y] = W[b] = W[S] = W[C] = W[w] = W[T] = W[N] = W[P] = W[F] = W[I] = !0, W[h] = W[g] = W[E] = !1;
4216
4389
  var G = typeof global == "object" && global && global.Object === Object && global, ie = typeof self == "object" && self && self.Object === Object && self, K = G || ie || Function("return this")(), q = typeof e == "object" && e && !e.nodeType && e, ae = q && typeof t == "object" && t && !t.nodeType && t, oe = ae && ae.exports === q, se = oe && G.process, ce = function() {
4217
4390
  try {
4218
4391
  return se && se.binding("util");
@@ -4813,13 +4986,13 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
4813
4986
  case O: return ln(e, r);
4814
4987
  case k:
4815
4988
  case A:
4989
+ case ee:
4816
4990
  case j:
4817
4991
  case M:
4818
4992
  case N:
4819
4993
  case P:
4820
4994
  case F:
4821
- case I:
4822
- case ee: return mn(e, r);
4995
+ case I: return mn(e, r);
4823
4996
  case v: return un(e, r, n);
4824
4997
  case y:
4825
4998
  case w: return new i(e);
@@ -5558,26 +5731,26 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
5558
5731
  t.verbose && console.warn("Multipolygon", a[p].type + "/" + a[p].id, "ignored because it has no members");
5559
5732
  continue;
5560
5733
  }
5561
- for (var j = 0, h = 0; h < a[p].members.length; h++) a[p].members[h].role == "outer" ? j++ : t.verbose && a[p].members[h].role != "inner" && console.warn("Multipolygon", a[p].type + "/" + a[p].id, "member", a[p].members[h].type + "/" + a[p].members[h].ref, "ignored because it has an invalid role: \"" + a[p].members[h].role + "\"");
5734
+ for (var ee = 0, h = 0; h < a[p].members.length; h++) a[p].members[h].role == "outer" ? ee++ : t.verbose && a[p].members[h].role != "inner" && console.warn("Multipolygon", a[p].type + "/" + a[p].id, "member", a[p].members[h].type + "/" + a[p].members[h].ref, "ignored because it has an invalid role: \"" + a[p].members[h].role + "\"");
5562
5735
  if (a[p].members.forEach(function(e) {
5563
5736
  g[e.ref] && (e.role === "outer" && !c(g[e.ref].tags, a[p].tags) && (g[e.ref].is_skippablerelationmember = !0), e.role === "inner" && !c(g[e.ref].tags) && (g[e.ref].is_skippablerelationmember = !0));
5564
- }), j == 0) {
5737
+ }), ee == 0) {
5565
5738
  t.verbose && console.warn("Multipolygon relation", a[p].type + "/" + a[p].id, "ignored because it has no outer ways");
5566
5739
  continue;
5567
5740
  }
5568
- var M = !1;
5569
- j == 1 && !c(a[p].tags, { type: !0 }) && (M = !0);
5741
+ var j = !1;
5742
+ ee == 1 && !c(a[p].tags, { type: !0 }) && (j = !0);
5570
5743
  var O = null;
5571
- if (!M) O = e(a[p], a[p]);
5744
+ if (!j) O = e(a[p], a[p]);
5572
5745
  else {
5573
- var N = a[p].members.filter(function(e) {
5746
+ var M = a[p].members.filter(function(e) {
5574
5747
  return e.role === "outer";
5575
5748
  })[0];
5576
- if (N = g[N.ref], N === void 0) {
5577
- t.verbose && console.warn("Multipolygon relation", a[p].type + "/" + a[p].id, "ignored because outer way", N.type + "/" + N.ref, "is missing");
5749
+ if (M = g[M.ref], M === void 0) {
5750
+ t.verbose && console.warn("Multipolygon relation", a[p].type + "/" + a[p].id, "ignored because outer way", M.type + "/" + M.ref, "is missing");
5578
5751
  continue;
5579
5752
  }
5580
- N.is_skippablerelationmember = !0, O = e(N, a[p]);
5753
+ M.is_skippablerelationmember = !0, O = e(M, a[p]);
5581
5754
  }
5582
5755
  if (O === !1) {
5583
5756
  t.verbose && console.warn("Multipolygon relation", a[p].type + "/" + a[p].id, "ignored because it has invalid geometry");
@@ -5585,7 +5758,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
5585
5758
  }
5586
5759
  o ? o(r(O)) : A.push(O);
5587
5760
  function e(e, r) {
5588
- var i = !1, a = M ? "way" : "relation", o = typeof e.id == "number" ? e.id : +e.id.replace("_fullGeom", ""), c = r.members.filter(function(e) {
5761
+ var i = !1, a = j ? "way" : "relation", o = typeof e.id == "number" ? e.id : +e.id.replace("_fullGeom", ""), c = r.members.filter(function(e) {
5589
5762
  return e.type === "way";
5590
5763
  });
5591
5764
  c = c.map(function(e) {
@@ -5677,14 +5850,14 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
5677
5850
  }
5678
5851
  if (!i[p].is_skippablerelationmember) {
5679
5852
  typeof i[p].id != "number" && (i[p].id = +i[p].id.replace("_fullGeom", "")), i[p].tainted = !1, i[p].hidden = !1;
5680
- var P = [];
5681
- for (h = 0; h < i[p].nodes.length; h++) typeof i[p].nodes[h] == "object" ? P.push([+i[p].nodes[h].lon, +i[p].nodes[h].lat]) : (t.verbose && console.warn("Way", i[p].type + "/" + i[p].id, "is tainted by an invalid node"), i[p].tainted = !0);
5682
- if (P.length <= 1) {
5853
+ var N = [];
5854
+ for (h = 0; h < i[p].nodes.length; h++) typeof i[p].nodes[h] == "object" ? N.push([+i[p].nodes[h].lon, +i[p].nodes[h].lat]) : (t.verbose && console.warn("Way", i[p].type + "/" + i[p].id, "is tainted by an invalid node"), i[p].tainted = !0);
5855
+ if (N.length <= 1) {
5683
5856
  t.verbose && console.warn("Way", i[p].type + "/" + i[p].id, "ignored because it contains too few nodes");
5684
5857
  continue;
5685
5858
  }
5686
- var F = "LineString";
5687
- i[p].nodes[0] !== void 0 && i[p].nodes[i[p].nodes.length - 1] !== void 0 && i[p].nodes[0].id === i[p].nodes[i[p].nodes.length - 1].id && (i[p].tags !== void 0 && d(i[p].tags) || i[p].__is_bounds_placeholder) && (F = "Polygon", P = [P]);
5859
+ var P = "LineString";
5860
+ i[p].nodes[0] !== void 0 && i[p].nodes[i[p].nodes.length - 1] !== void 0 && i[p].nodes[0].id === i[p].nodes[i[p].nodes.length - 1].id && (i[p].tags !== void 0 && d(i[p].tags) || i[p].__is_bounds_placeholder) && (P = "Polygon", N = [N]);
5688
5861
  var O = {
5689
5862
  type: "Feature",
5690
5863
  id: i[p].type + "/" + i[p].id,
@@ -5696,11 +5869,11 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
5696
5869
  meta: l(i[p])
5697
5870
  },
5698
5871
  geometry: {
5699
- type: F,
5700
- coordinates: P
5872
+ type: P,
5873
+ coordinates: N
5701
5874
  }
5702
5875
  };
5703
- i[p].tainted && (t.verbose && console.warn("Way", i[p].type + "/" + i[p].id, "is tainted"), O.properties.tainted = !0), i[p].__is_bounds_placeholder && (O.properties.geometry = "bounds"), o ? o(r(O)) : F == "LineString" ? k.push(O) : A.push(O);
5876
+ i[p].tainted && (t.verbose && console.warn("Way", i[p].type + "/" + i[p].id, "is tainted"), O.properties.tainted = !0), i[p].__is_bounds_placeholder && (O.properties.geometry = "bounds"), o ? o(r(O)) : P == "LineString" ? k.push(O) : A.push(O);
5704
5877
  }
5705
5878
  }
5706
5879
  return o ? !0 : (E = {
@@ -5992,8 +6165,8 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
5992
6165
  n && (c = a("[", r(c), "\\u{10000}-\\u{10FFFF}", "]"));
5993
6166
  var l = /[\x20\x09\x0D\x0A]/, u = r(l), d = a(l, "+"), f = a(l, "*"), p = /[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
5994
6167
  n && (p = a("[", r(p), "\\u{10000}-\\u{10FFFF}", "]"));
5995
- var m = a("[", r(p), r(/[-.0-9\xB7]/), r(/[\u0300-\u036F\u203F-\u2040]/), "]"), h = a(p, m, "*"), g = a(m, "+"), _ = o(a("&", h, ";"), "|", o(/&#[0-9]+;|&#x[0-9a-fA-F]+;/)), v = a("%", h, ";"), y = o(a("\"", o(/[^%&"]/, "|", v, "|", _), "*", "\""), "|", a("'", o(/[^%&']/, "|", v, "|", _), "*", "'")), b = o("\"", o(/[^<&"]/, "|", _), "*", "\"", "|", "'", o(/[^<&']/, "|", _), "*", "'"), x = a(i(p, ":"), i(m, ":"), "*"), S = a(x, o(":", x), "?"), C = a("^", S, "$"), w = a("(", S, ")"), T = o(/"[^"]*"|'[^']*'/), E = a(/^<\?/, "(", h, ")", o(d, "(", c, "*?)"), "?", /\?>/), D = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/, O = o("\"", D, "*\"", "|", "'", i(D, "'"), "*'"), k = "<!--", A = "-->", j = a(k, o(i(c, "-"), "|", a("-", i(c, "-"))), "*", A), M = "#PCDATA", N = o("EMPTY", "|", "ANY", "|", o(a(/\(/, f, M, o(f, /\|/, f, S), "*", f, /\)\*/), "|", a(/\(/, f, M, f, /\)/)), "|", a(/\([^>]+\)/, /[?*+]?/)), P = a("<!ELEMENT", d, o(S, "|", v), d, o(N, "|", v), f, ">"), F = a("<!ATTLIST", d, h, o(d, h, d, o(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, "|", o(a("NOTATION", d, /\(/, f, h, o(f, /\|/, f, h), "*", f, /\)/), "|", a(/\(/, f, g, o(f, /\|/, f, g), "*", f, /\)/))), d, o(/#REQUIRED|#IMPLIED/, "|", o(o("#FIXED", d), "?", b))), "*", f, ">"), I = "about:legacy-compat", ee = o("\"" + I + "\"", "|", "'" + I + "'"), L = "SYSTEM", te = "PUBLIC", R = o(o(L, d, T), "|", o(te, d, O, d, T)), z = a("^", o(o(L, d, "(?<SystemLiteralOnly>", T, ")"), "|", o(te, d, "(?<PubidLiteral>", O, ")", d, "(?<SystemLiteral>", T, ")"))), B = o(y, "|", o(R, o(d, "NDATA", d, h), "?")), V = "<!ENTITY", H = o(a(V, d, h, d, B, f, ">"), "|", a(V, d, "%", d, h, d, o(y, "|", R), f, ">")), ne = a("<!NOTATION", d, h, d, o(R, "|", a(te, d, O)), f, ">"), re = a(f, "=", f), U = /1[.]\d+/, W = a(d, "version", re, o("'", U, "'", "|", "\"", U, "\"")), G = /[A-Za-z][-A-Za-z0-9._]*/, ie = a(/^<\?xml/, W, o(d, "encoding", re, o("\"", G, "\"", "|", "'", G, "'")), "?", o(d, "standalone", re, o("'", o("yes", "|", "no"), "'", "|", "\"", o("yes", "|", "no"), "\"")), "?", f, /\?>/), K = "<!DOCTYPE", q = "<![CDATA[", ae = "]]>", oe = a(/<!\[CDATA\[/, a(c, "*?", /\]\]>/));
5996
- e.chars = r, e.chars_without = i, e.detectUnicodeSupport = t, e.reg = a, e.regg = o, e.ABOUT_LEGACY_COMPAT = I, e.ABOUT_LEGACY_COMPAT_SystemLiteral = ee, e.AttlistDecl = F, e.CDATA_START = q, e.CDATA_END = ae, e.CDSect = oe, e.Char = c, e.Comment = j, e.COMMENT_START = k, e.COMMENT_END = A, e.DOCTYPE_DECL_START = K, e.elementdecl = P, e.EntityDecl = H, e.EntityValue = y, e.ExternalID = R, e.ExternalID_match = z, e.Name = h, e.NotationDecl = ne, e.Reference = _, e.PEReference = v, e.PI = E, e.PUBLIC = te, e.PubidLiteral = O, e.QName = S, e.QName_exact = C, e.QName_group = w, e.S = d, e.SChar_s = u, e.S_OPT = f, e.SYSTEM = L, e.SystemLiteral = T, e.UNICODE_REPLACEMENT_CHARACTER = s, e.UNICODE_SUPPORT = n, e.XMLDecl = ie;
6168
+ var m = a("[", r(p), r(/[-.0-9\xB7]/), r(/[\u0300-\u036F\u203F-\u2040]/), "]"), h = a(p, m, "*"), g = a(m, "+"), _ = o(a("&", h, ";"), "|", o(/&#[0-9]+;|&#x[0-9a-fA-F]+;/)), v = a("%", h, ";"), y = o(a("\"", o(/[^%&"]/, "|", v, "|", _), "*", "\""), "|", a("'", o(/[^%&']/, "|", v, "|", _), "*", "'")), b = o("\"", o(/[^<&"]/, "|", _), "*", "\"", "|", "'", o(/[^<&']/, "|", _), "*", "'"), x = a(i(p, ":"), i(m, ":"), "*"), S = a(x, o(":", x), "?"), C = a("^", S, "$"), w = a("(", S, ")"), T = o(/"[^"]*"|'[^']*'/), E = a(/^<\?/, "(", h, ")", o(d, "(", c, "*?)"), "?", /\?>/), D = /[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/, O = o("\"", D, "*\"", "|", "'", i(D, "'"), "*'"), k = "<!--", A = "-->", ee = a(k, o(i(c, "-"), "|", a("-", i(c, "-"))), "*", A), j = "#PCDATA", M = o("EMPTY", "|", "ANY", "|", o(a(/\(/, f, j, o(f, /\|/, f, S), "*", f, /\)\*/), "|", a(/\(/, f, j, f, /\)/)), "|", a(/\([^>]+\)/, /[?*+]?/)), N = a("<!ELEMENT", d, o(S, "|", v), d, o(M, "|", v), f, ">"), P = a("<!ATTLIST", d, h, o(d, h, d, o(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/, "|", o(a("NOTATION", d, /\(/, f, h, o(f, /\|/, f, h), "*", f, /\)/), "|", a(/\(/, f, g, o(f, /\|/, f, g), "*", f, /\)/))), d, o(/#REQUIRED|#IMPLIED/, "|", o(o("#FIXED", d), "?", b))), "*", f, ">"), F = "about:legacy-compat", I = o("\"" + F + "\"", "|", "'" + F + "'"), L = "SYSTEM", te = "PUBLIC", R = o(o(L, d, T), "|", o(te, d, O, d, T)), z = a("^", o(o(L, d, "(?<SystemLiteralOnly>", T, ")"), "|", o(te, d, "(?<PubidLiteral>", O, ")", d, "(?<SystemLiteral>", T, ")"))), B = o(y, "|", o(R, o(d, "NDATA", d, h), "?")), V = "<!ENTITY", H = o(a(V, d, h, d, B, f, ">"), "|", a(V, d, "%", d, h, d, o(y, "|", R), f, ">")), ne = a("<!NOTATION", d, h, d, o(R, "|", a(te, d, O)), f, ">"), re = a(f, "=", f), U = /1[.]\d+/, W = a(d, "version", re, o("'", U, "'", "|", "\"", U, "\"")), G = /[A-Za-z][-A-Za-z0-9._]*/, ie = a(/^<\?xml/, W, o(d, "encoding", re, o("\"", G, "\"", "|", "'", G, "'")), "?", o(d, "standalone", re, o("'", o("yes", "|", "no"), "'", "|", "\"", o("yes", "|", "no"), "\"")), "?", f, /\?>/), K = "<!DOCTYPE", q = "<![CDATA[", ae = "]]>", oe = a(/<!\[CDATA\[/, a(c, "*?", /\]\]>/));
6169
+ e.chars = r, e.chars_without = i, e.detectUnicodeSupport = t, e.reg = a, e.regg = o, e.ABOUT_LEGACY_COMPAT = F, e.ABOUT_LEGACY_COMPAT_SystemLiteral = I, e.AttlistDecl = P, e.CDATA_START = q, e.CDATA_END = ae, e.CDSect = oe, e.Char = c, e.Comment = ee, e.COMMENT_START = k, e.COMMENT_END = A, e.DOCTYPE_DECL_START = K, e.elementdecl = N, e.EntityDecl = H, e.EntityValue = y, e.ExternalID = R, e.ExternalID_match = z, e.Name = h, e.NotationDecl = ne, e.Reference = _, e.PEReference = v, e.PI = E, e.PUBLIC = te, e.PubidLiteral = O, e.QName = S, e.QName_exact = C, e.QName_group = w, e.S = d, e.SChar_s = u, e.S_OPT = f, e.SYSTEM = L, e.SystemLiteral = T, e.UNICODE_REPLACEMENT_CHARACTER = s, e.UNICODE_SUPPORT = n, e.XMLDecl = ie;
5997
6170
  })), require_dom = /* @__PURE__ */ __commonJSMin$1(((e) => {
5998
6171
  var t = require_conventions(), n = t.find, r = t.hasDefaultHTMLNamespace, i = t.hasOwn, a = t.isHTMLMimeType, o = t.isHTMLRawTextElement, s = t.isHTMLVoidElement, c = t.MIME_TYPE, l = t.NAMESPACE, u = Symbol(), d = require_errors(), f = d.DOMException, p = d.DOMExceptionName, m = require_grammar();
5999
6172
  function h(e) {
@@ -6049,7 +6222,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6049
6222
  }
6050
6223
  n.constructor != e && (typeof e != "function" && console.error("unknown Class:" + e), n.constructor = e);
6051
6224
  }
6052
- var T = {}, E = T.ELEMENT_NODE = 1, D = T.ATTRIBUTE_NODE = 2, O = T.TEXT_NODE = 3, k = T.CDATA_SECTION_NODE = 4, A = T.ENTITY_REFERENCE_NODE = 5, j = T.ENTITY_NODE = 6, M = T.PROCESSING_INSTRUCTION_NODE = 7, N = T.COMMENT_NODE = 8, P = T.DOCUMENT_NODE = 9, F = T.DOCUMENT_TYPE_NODE = 10, I = T.DOCUMENT_FRAGMENT_NODE = 11, ee = T.NOTATION_NODE = 12, L = t.freeze({
6225
+ var T = {}, E = T.ELEMENT_NODE = 1, D = T.ATTRIBUTE_NODE = 2, O = T.TEXT_NODE = 3, k = T.CDATA_SECTION_NODE = 4, A = T.ENTITY_REFERENCE_NODE = 5, ee = T.ENTITY_NODE = 6, j = T.PROCESSING_INSTRUCTION_NODE = 7, M = T.COMMENT_NODE = 8, N = T.DOCUMENT_NODE = 9, P = T.DOCUMENT_TYPE_NODE = 10, F = T.DOCUMENT_FRAGMENT_NODE = 11, I = T.NOTATION_NODE = 12, L = t.freeze({
6053
6226
  DOCUMENT_POSITION_DISCONNECTED: 1,
6054
6227
  DOCUMENT_POSITION_PRECEDING: 2,
6055
6228
  DOCUMENT_POSITION_FOLLOWING: 4,
@@ -6483,7 +6656,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6483
6656
  function ge(e, t, n, r) {
6484
6657
  X(e, t, n), e.nodeType === G.DOCUMENT_NODE && (r || me)(e, t, n);
6485
6658
  var i = t.parentNode;
6486
- if (i && i.removeChild(t), t.nodeType === I) {
6659
+ if (i && i.removeChild(t), t.nodeType === F) {
6487
6660
  var a = t.firstChild;
6488
6661
  if (a == null) return t;
6489
6662
  var o = t.lastChild;
@@ -6493,17 +6666,17 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6493
6666
  do
6494
6667
  a.parentNode = e;
6495
6668
  while (a !== o && (a = a.nextSibling));
6496
- return se(e.ownerDocument || e, e, t), t.nodeType == I && (t.firstChild = t.lastChild = null), t;
6669
+ return se(e.ownerDocument || e, e, t), t.nodeType == F && (t.firstChild = t.lastChild = null), t;
6497
6670
  }
6498
6671
  q.prototype = {
6499
6672
  implementation: null,
6500
6673
  nodeName: "#document",
6501
- nodeType: P,
6674
+ nodeType: N,
6502
6675
  doctype: null,
6503
6676
  documentElement: null,
6504
6677
  _inc: 1,
6505
6678
  insertBefore: function(e, t) {
6506
- if (e.nodeType === I) {
6679
+ if (e.nodeType === F) {
6507
6680
  for (var n = e.firstChild; n;) {
6508
6681
  var r = n.nextSibling;
6509
6682
  this.insertBefore(n, t), n = r;
@@ -6658,7 +6831,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6658
6831
  });
6659
6832
  },
6660
6833
  getElementsByTagName: function(e) {
6661
- var t = (this.nodeType === P ? this : this.ownerDocument).type === "html", n = e.toLowerCase();
6834
+ var t = (this.nodeType === N ? this : this.ownerDocument).type === "html", n = e.toLowerCase();
6662
6835
  return new B(this, function(r) {
6663
6836
  var i = [];
6664
6837
  return K(r, function(a) {
@@ -6719,7 +6892,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6719
6892
  }
6720
6893
  xe.prototype = {
6721
6894
  nodeName: "#comment",
6722
- nodeType: N
6895
+ nodeType: M
6723
6896
  }, w(xe, ye);
6724
6897
  function Se(e) {
6725
6898
  h(e);
@@ -6731,15 +6904,15 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6731
6904
  function Ce(e) {
6732
6905
  h(e);
6733
6906
  }
6734
- Ce.prototype.nodeType = F, w(Ce, G);
6907
+ Ce.prototype.nodeType = P, w(Ce, G);
6735
6908
  function we(e) {
6736
6909
  h(e);
6737
6910
  }
6738
- we.prototype.nodeType = ee, w(we, G);
6911
+ we.prototype.nodeType = I, w(we, G);
6739
6912
  function Te(e) {
6740
6913
  h(e);
6741
6914
  }
6742
- Te.prototype.nodeType = j, w(Te, G);
6915
+ Te.prototype.nodeType = ee, w(Te, G);
6743
6916
  function Ee(e) {
6744
6917
  h(e);
6745
6918
  }
@@ -6747,17 +6920,17 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6747
6920
  function De(e) {
6748
6921
  h(e);
6749
6922
  }
6750
- De.prototype.nodeName = "#document-fragment", De.prototype.nodeType = I, w(De, G);
6923
+ De.prototype.nodeName = "#document-fragment", De.prototype.nodeType = F, w(De, G);
6751
6924
  function Z(e) {
6752
6925
  h(e);
6753
6926
  }
6754
- Z.prototype.nodeType = M, w(Z, ye);
6927
+ Z.prototype.nodeType = j, w(Z, ye);
6755
6928
  function Oe() {}
6756
6929
  Oe.prototype.serializeToString = function(e, t) {
6757
6930
  return ke.call(e, t);
6758
6931
  }, G.prototype.toString = ke;
6759
6932
  function ke(e) {
6760
- var t = [], n = this.nodeType === P && this.documentElement || this, r = n.prefix, i = n.namespaceURI;
6933
+ var t = [], n = this.nodeType === N && this.documentElement || this, r = n.prefix, i = n.namespaceURI;
6761
6934
  if (i && r == null) {
6762
6935
  var r = n.lookupPrefix(i);
6763
6936
  if (r == null) var a = [{
@@ -6781,7 +6954,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6781
6954
  }
6782
6955
  function Me(e, t, n, r) {
6783
6956
  r ||= [];
6784
- var i = (e.nodeType === P ? e : e.ownerDocument).type === "html";
6957
+ var i = (e.nodeType === N ? e : e.ownerDocument).type === "html";
6785
6958
  if (n) if (e = n(e), e) {
6786
6959
  if (typeof e == "string") {
6787
6960
  t.push(e);
@@ -6848,19 +7021,19 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6848
7021
  t.push("</", f, ">");
6849
7022
  }
6850
7023
  return;
6851
- case P:
6852
- case I:
7024
+ case N:
7025
+ case F:
6853
7026
  for (var u = e.firstChild; u;) Me(u, t, n, r.slice()), u = u.nextSibling;
6854
7027
  return;
6855
7028
  case D: return je(t, e.name, e.value);
6856
7029
  case O: return t.push(e.data.replace(/[<&>]/g, ie));
6857
7030
  case k: return t.push(m.CDATA_START, e.data, m.CDATA_END);
6858
- case N: return t.push(m.COMMENT_START, e.data, m.COMMENT_END);
6859
- case F:
7031
+ case M: return t.push(m.COMMENT_START, e.data, m.COMMENT_END);
7032
+ case P:
6860
7033
  var C = e.publicId, w = e.systemId;
6861
7034
  t.push(m.DOCTYPE_DECL_START, " ", e.name), C ? (t.push(" ", m.PUBLIC, " ", C), w && w !== "." && t.push(" ", w)) : w && w !== "." && t.push(" ", m.SYSTEM, " ", w), e.internalSubset && t.push(" [", e.internalSubset, "]"), t.push(">");
6862
7035
  return;
6863
- case M: return t.push("<?", e.target, " ", e.data, "?>");
7036
+ case j: return t.push("<?", e.target, " ", e.data, "?>");
6864
7037
  case A: return t.push("&", e.nodeName, ";");
6865
7038
  default: t.push("??", e.nodeName);
6866
7039
  }
@@ -6869,7 +7042,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6869
7042
  var r;
6870
7043
  switch (t.nodeType) {
6871
7044
  case E: r = t.cloneNode(!1), r.ownerDocument = e;
6872
- case I: break;
7045
+ case F: break;
6873
7046
  case D:
6874
7047
  n = !0;
6875
7048
  break;
@@ -6908,7 +7081,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6908
7081
  set: function(e) {
6909
7082
  switch (this.nodeType) {
6910
7083
  case E:
6911
- case I:
7084
+ case F:
6912
7085
  for (; this.firstChild;) this.removeChild(this.firstChild);
6913
7086
  (e || String(e)) && this.appendChild(this.ownerDocument.createTextNode(e));
6914
7087
  break;
@@ -6919,7 +7092,7 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
6919
7092
  function e(t) {
6920
7093
  switch (t.nodeType) {
6921
7094
  case E:
6922
- case I:
7095
+ case F:
6923
7096
  var n = [];
6924
7097
  for (t = t.firstChild; t;) t.nodeType !== 7 && t.nodeType !== 8 && n.push(e(t)), t = t.nextSibling;
6925
7098
  return n.join("");
@@ -9110,43 +9283,43 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
9110
9283
  if (O < 0) {
9111
9284
  if (!d && E.length > 0) return c.fatalError("unclosed xml tag(s): " + E.join(", "));
9112
9285
  if (!e.substring(D).match(/^\s*$/)) {
9113
- var M = o.doc, N = M.createTextNode(e.substring(D));
9114
- if (M.documentElement) return c.error("Extra content at the end of the document");
9115
- M.appendChild(N), o.currentElement = N;
9286
+ var j = o.doc, M = j.createTextNode(e.substring(D));
9287
+ if (j.documentElement) return c.error("Extra content at the end of the document");
9288
+ j.appendChild(M), o.currentElement = M;
9116
9289
  }
9117
9290
  return;
9118
9291
  }
9119
9292
  if (O > D) {
9120
- var P = e.substring(D, O);
9121
- !d && E.length === 0 && (P = P.replace(new RegExp(n.S_OPT.source, "g"), ""), P && c.error("Unexpected content outside root element: '" + P + "'")), m(O);
9293
+ var N = e.substring(D, O);
9294
+ !d && E.length === 0 && (N = N.replace(new RegExp(n.S_OPT.source, "g"), ""), N && c.error("Unexpected content outside root element: '" + N + "'")), m(O);
9122
9295
  }
9123
9296
  switch (e.charAt(O + 1)) {
9124
9297
  case "/":
9125
- var F = e.indexOf(">", O + 2), I = e.substring(O + 2, F > 0 ? F : void 0);
9126
- if (!I) return c.fatalError("end tag name missing");
9127
- var ee = F > 0 && n.reg("^", n.QName_group, n.S_OPT, "$").exec(I);
9128
- if (!ee) return c.fatalError("end tag name contains invalid characters: \"" + I + "\"");
9298
+ var P = e.indexOf(">", O + 2), F = e.substring(O + 2, P > 0 ? P : void 0);
9299
+ if (!F) return c.fatalError("end tag name missing");
9300
+ var I = P > 0 && n.reg("^", n.QName_group, n.S_OPT, "$").exec(F);
9301
+ if (!I) return c.fatalError("end tag name contains invalid characters: \"" + F + "\"");
9129
9302
  if (!o.currentElement && !o.doc.documentElement) return;
9130
9303
  var L = E[E.length - 1] || o.currentElement.tagName || o.doc.documentElement.tagName || "";
9131
- if (L !== ee[1]) {
9132
- var te = ee[1].toLowerCase();
9133
- if (!d || L.toLowerCase() !== te) return c.fatalError("Opening and ending tag mismatch: \"" + L + "\" != \"" + I + "\"");
9304
+ if (L !== I[1]) {
9305
+ var te = I[1].toLowerCase();
9306
+ if (!d || L.toLowerCase() !== te) return c.fatalError("Opening and ending tag mismatch: \"" + L + "\" != \"" + F + "\"");
9134
9307
  }
9135
9308
  var R = x.pop();
9136
9309
  E.pop();
9137
9310
  var z = R.localNSMap;
9138
9311
  if (o.endElement(R.uri, R.localName, L), z) for (var B in z) s(z, B) && o.endPrefixMapping(B);
9139
- F++;
9312
+ P++;
9140
9313
  break;
9141
9314
  case "?":
9142
- v && y(O), F = A(e, O, o, c);
9315
+ v && y(O), P = A(e, O, o, c);
9143
9316
  break;
9144
9317
  case "!":
9145
- v && y(O), F = k(e, O, o, c, d);
9318
+ v && y(O), P = k(e, O, o, c, d);
9146
9319
  break;
9147
9320
  default:
9148
9321
  v && y(O);
9149
- var V = new j(), H = x[x.length - 1].currentNSMap, F = C(e, O, V, H, p, c, d), ne = V.length;
9322
+ var V = new ee(), H = x[x.length - 1].currentNSMap, P = C(e, O, V, H, p, c, d), ne = V.length;
9150
9323
  if (V.closed || (d && t.isHTMLVoidElement(V.tagName) ? V.closed = !0 : E.push(V.tagName)), v && ne) {
9151
9324
  for (var re = S(v, {}), U = 0; U < ne; U++) {
9152
9325
  var W = V[U];
@@ -9154,14 +9327,14 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
9154
9327
  }
9155
9328
  o.locator = re, w(V, o, H) && x.push(V), o.locator = v;
9156
9329
  } else w(V, o, H) && x.push(V);
9157
- d && !V.closed ? F = T(e, F, V.tagName, p, o) : F++;
9330
+ d && !V.closed ? P = T(e, P, V.tagName, p, o) : P++;
9158
9331
  }
9159
9332
  } catch (e) {
9160
9333
  if (e instanceof l) throw e;
9161
9334
  if (e instanceof u) throw new l(e.name + ": " + e.message, o.locator, e);
9162
- c.error("element parse error: " + e), F = -1;
9335
+ c.error("element parse error: " + e), P = -1;
9163
9336
  }
9164
- F > D ? D = F : m(Math.max(O, D) + 1);
9337
+ P > D ? D = P : m(Math.max(O, D) + 1);
9165
9338
  }
9166
9339
  }
9167
9340
  function S(e, t) {
@@ -9397,10 +9570,10 @@ var OtpRemoteRouter_default = new class extends RemoteRouter_default {
9397
9570
  }
9398
9571
  return r.processingInstruction(a[1], a[2]), t + a[0].length;
9399
9572
  }
9400
- function j() {
9573
+ function ee() {
9401
9574
  this.attributeNames = Object.create(null);
9402
9575
  }
9403
- j.prototype = {
9576
+ ee.prototype = {
9404
9577
  setTagName: function(e) {
9405
9578
  if (!n.QName_exact.test(e)) throw Error("invalid tagName:" + e);
9406
9579
  this.tagName = e;
@@ -9576,6 +9749,7 @@ function lineStringToPolygon(e) {
9576
9749
  coordinates: [n[0] === r[0] && n[1] === r[1] ? t : [...t, n]]
9577
9750
  };
9578
9751
  }
9752
+ const ImportErrors = { CANNOT_ASSIGN_ELEVATOR_LEVEL_TO_SEGMENTS: "cannot-assign-elevator-level-to-segments" };
9579
9753
  function getFeatures(e) {
9580
9754
  return e.type === "FeatureCollection" ? e.features : e.type === "Feature" ? [e] : [{
9581
9755
  type: "Feature",
@@ -9616,7 +9790,6 @@ var GeoJsonGraphUtils = class e {
9616
9790
  ...OsmTagsUtils.isElevator(e.properties) && { isElevator: !0 },
9617
9791
  ...OsmTagsUtils.isEscalator(e.properties) && { areEscalators: !0 },
9618
9792
  ...OsmTagsUtils.isMovingWalkway(e.properties) && { isMovingWalkway: !0 },
9619
- ...OsmTagsUtils.needTicket(e.properties) && { needTicket: !0 },
9620
9793
  ...OsmTagsUtils.getIncline(e.properties) && { incline: OsmTagsUtils.getIncline(e.properties) },
9621
9794
  ...OsmTagsUtils.getWheelchair(e.properties) && { wheelchair: OsmTagsUtils.getWheelchair(e.properties) },
9622
9795
  ...OsmTagsUtils.getSmoothness(e.properties) && { smoothness: OsmTagsUtils.getSmoothness(e.properties) },
@@ -9627,38 +9800,44 @@ var GeoJsonGraphUtils = class e {
9627
9800
  let t = JSON.parse(e);
9628
9801
  return this.createGraphFromGeojson(t);
9629
9802
  }
9630
- static createGraphFromGeojson(t, i = e.DEFAULT_FEATURE_SELECTOR) {
9631
- let a = getFeatures(t), o = a.filter(i), s = [], l = [], d = 0, f = (e, t) => {
9632
- let i = new Coordinates(e[1], e[0], null, t), a = l.find((e) => e.coords.equalsWithoutLevel(i) ? Level.intersect(e.coords.level, t) ? !0 : e.coords.level === null || t === null : !1) || null;
9633
- return a ? (Level.equals(a.coords.level, t) || (a.coords.level = Level.intersection(a.coords.level, t), a.coords.level === null && (a.coords.level = t)), a) : (a = new Vertex(i), a.id = d++, l.push(a), a);
9803
+ static createGraphFromGeojson(t, i = e.DEFAULT_FEATURE_SELECTOR, a) {
9804
+ let o = getFeatures(t), s = o.filter(i), l = [], d = [], f = 0, p = [], m = [];
9805
+ o.forEach((e) => {
9806
+ if (e.geometry.type !== "Point" || !OsmTagsUtils.isElevator(e.properties || {})) return;
9807
+ let t = e.geometry, r = new Coordinates(t.coordinates[1], t.coordinates[0]);
9808
+ m.push(r);
9809
+ });
9810
+ let h = (e) => m.some((t) => t.equalsWithoutLevel(e)), g = (e, t) => {
9811
+ let i = new Coordinates(e[1], e[0], null, t), a = d.find((e) => e.coords.equalsWithoutLevel(i) ? Level.intersect(e.coords.level, t) ? !0 : h(i) ? !1 : e.coords.level === null || t === null : !1) || null;
9812
+ return a ? (Level.equals(a.coords.level, t) || (a.coords.level = Level.intersection(a.coords.level, t), a.coords.level === null && (a.coords.level = t)), a) : (a = new Vertex(i), a.id = f++, d.push(a), a);
9634
9813
  };
9635
- o.filter((e) => e.geometry.type === "LineString").forEach((e) => {
9636
- let t = e.geometry, n = e.properties || {}, i = this.parseLineStringProperties(e), a = "level" in n ? n.level : null, o = Level.fromString(a), l = (e) => {
9814
+ s.filter((e) => e.geometry.type === "LineString").forEach((e) => {
9815
+ let t = e.geometry, n = e.properties || {}, i = this.parseLineStringProperties(e), a = "level" in n ? n.level : null, o = Level.fromString(a), s = (e) => {
9637
9816
  for (let r = 1; r < t.coordinates.length; r++) {
9638
- let a = f(t.coordinates[r - 1], e), o = f(t.coordinates[r], e);
9817
+ let a = g(t.coordinates[r - 1], e), o = g(t.coordinates[r], e);
9639
9818
  if (OsmTagsUtils.isOnewayBackward(n)) {
9640
9819
  let e = o;
9641
9820
  o = a, a = e;
9642
9821
  }
9643
- let l = new Edge(a, o, i, n);
9644
- s.push(l);
9822
+ let s = new Edge(a, o, i, n);
9823
+ l.push(s);
9645
9824
  }
9646
9825
  };
9647
- l(o), "repeat_on" in n && n.repeat_on.split(";").map(Level.fromString).forEach(l);
9826
+ n.repeat_on && o === null || s(o), "repeat_on" in n && n.repeat_on.split(";").map(Level.fromString).forEach(s);
9648
9827
  });
9649
- let p = [], m = [];
9650
- a.filter((e) => e.geometry.type === "Point").forEach((e) => {
9651
- let t = e.properties || {}, i = e.geometry, a = "level" in t ? t.level : null, o = Level.fromString(a), s = new Coordinates(i.coordinates[1], i.coordinates[0], null, o), u = l.filter((e) => Coordinates.equalsWithoutLevel(e.coords, s) ? Level.intersect(e.coords.level, o) ? !0 : e.coords.level === null || o === null : !1);
9652
- if (u.forEach((n) => {
9653
- n.properties = this.parsePointProperties(e), n.rawTags = t, o !== null && (n.coords.level = Level.union(n.coords.level, o));
9828
+ let _ = [], v = [];
9829
+ o.filter((e) => e.geometry.type === "Point").forEach((e) => {
9830
+ let t = e.properties || {}, i = e.geometry, a = "level" in t ? t.level : null, o = Level.fromString(a), s = new Coordinates(i.coordinates[1], i.coordinates[0], null, o), l = d.filter((e) => Coordinates.equalsWithoutLevel(e.coords, s) ? Level.intersect(e.coords.level, o) ? !0 : e.coords.level === null || o === null : !1);
9831
+ if (l.forEach((n) => {
9832
+ n.properties = this.parsePointProperties(e), n.rawTags = t;
9654
9833
  }), OsmTagsUtils.isElevator(t)) {
9655
9834
  let e = ((e, t) => {
9656
9835
  let i = new Coordinates(e[1], e[0], null, t), a = [];
9657
- return l.forEach((e) => {
9658
- Coordinates.equalsWithoutLevel(e.coords, i) && Level.intersect(e.coords.level, t) && a.push(e);
9836
+ return d.forEach((e) => {
9837
+ Coordinates.equalsWithoutLevel(e.coords, i) && (Level.intersect(e.coords.level, t) || e.coords.level == null) && a.push(e);
9659
9838
  }), a;
9660
9839
  })(i.coordinates, o);
9661
- e.length > 0 && p.push({
9840
+ e.length > 0 && _.push({
9662
9841
  vertices: e,
9663
9842
  props: {
9664
9843
  name: t.name,
@@ -9667,49 +9846,69 @@ var GeoJsonGraphUtils = class e {
9667
9846
  }
9668
9847
  });
9669
9848
  }
9670
- OsmTagsUtils.isRoutingBoundsEntryPoint(t) && u.forEach((e) => {
9671
- m.push(e);
9849
+ OsmTagsUtils.isRoutingBoundsEntryPoint(t) && l.forEach((e) => {
9850
+ v.push(e);
9672
9851
  });
9673
- }), a.filter((e) => e.geometry.type === "Polygon" && e.properties && OsmTagsUtils.isElevator(e.properties)).filter((e) => {
9852
+ }), o.filter((e) => e.geometry.type === "Polygon" && e.properties && OsmTagsUtils.isElevator(e.properties)).filter((e) => {
9674
9853
  let t = e.geometry;
9675
- return !p.flatMap(({ vertices: e }) => e).some((e) => pointInPolygon([e.coords.lng, e.coords.lat], t));
9854
+ return !_.flatMap(({ vertices: e }) => e).some((e) => pointInPolygon([e.coords.lng, e.coords.lat], t));
9676
9855
  }).forEach((e) => {
9677
- let t = e, i = t.geometry.coordinates[0].map((e) => l.filter((t) => t.coords.equalsWithoutLevel(new Coordinates(e[1], e[0], null, t.coords.level)))).flat(), a = t.geometry.coordinates[0].slice(0, -1), o = a.reduce((e, t) => [e[0] + t[0], e[1] + t[1]], [0, 0]).map((e) => e / a.length), c = i.reduce((e, t) => Level.union(e, t.coords.level), null), u = new Coordinates(o[1], o[0], null, c), d = [];
9856
+ let t = e, i = t.geometry.coordinates[0].map((e) => d.filter((t) => t.coords.equalsWithoutLevel(new Coordinates(e[1], e[0], null, t.coords.level)))).flat(), a = t.geometry.coordinates[0].slice(0, -1), o = a.reduce((e, t) => [e[0] + t[0], e[1] + t[1]], [0, 0]).map((e) => e / a.length), s = i.reduce((e, t) => Level.union(e, t.coords.level), null), c = new Coordinates(o[1], o[0], null, s), u = [];
9678
9857
  i.forEach((t) => {
9679
- let n = f([u.lng, u.lat], t.coords.level);
9680
- s.push(new Edge(n, t, { externalId: e.properties?.id })), d.push(n);
9681
- }), p.push({
9682
- vertices: d,
9858
+ let n = g([c.lng, c.lat], t.coords.level);
9859
+ l.push(new Edge(n, t, { externalId: e.properties?.id })), u.push(n);
9860
+ }), _.push({
9861
+ vertices: u,
9683
9862
  props: {
9684
9863
  name: e.properties?.name,
9685
9864
  isElevator: !0,
9686
9865
  externalId: e.properties?.id
9687
9866
  }
9688
9867
  });
9689
- }), p.forEach(({ vertices: e, props: t }) => {
9690
- for (let n = 0; n < e.length; n++) for (let r = n + 1; r < e.length; r++) s.push(new Edge(e[n], e[r], t));
9868
+ });
9869
+ let y = (e, t) => {
9870
+ let i = o.filter((t) => t.properties && OsmTagsUtils.isElevator(t.properties) && t.geometry.type === "Point" && new Coordinates(t.geometry.coordinates[1], t.geometry.coordinates[0]).equalsWithoutLevel(e.coords));
9871
+ if (i.length !== 1) return p.push({ coordinates: e.coords }), null;
9872
+ let a = i[0];
9873
+ if (typeof a.properties?.level != "string" || !a.properties.level.includes(";")) return null;
9874
+ let s = a.properties.level.split(";").map((e) => Level.fromString(e)), l = t.map((e) => e.coords.level), u = s.filter((e) => !l.includes(e));
9875
+ return u.length === 1 || p.push({ coordinates: e.coords }), u[0];
9876
+ };
9877
+ _.forEach(({ vertices: e, props: t }) => {
9878
+ e.forEach((t) => {
9879
+ if (t.coords.level === null) {
9880
+ let n = y(t, e);
9881
+ n !== null && (t.coords.level = n);
9882
+ }
9883
+ });
9884
+ for (let n = 0; n < e.length; n++) for (let r = n + 1; r < e.length; r++) l.push(new Edge(e[n], e[r], t));
9691
9885
  if (e.length === 1 && e[0].coords.level === null) {
9692
- let n = e[0], r = s.filter((e) => e.vertex1 === n || e.vertex2 === n);
9886
+ let n = e[0], r = l.filter((e) => e.vertex1 === n || e.vertex2 === n);
9693
9887
  if (r.length > 1) {
9694
9888
  let e = [n];
9695
9889
  for (let t = 1; t < r.length; t++) {
9696
9890
  let i = new Vertex(n.coords, n.properties);
9697
- i.id = d++, l.push(i), r[t].vertex1 === n ? r[t].vertex1 = i : r[t].vertex2 = i, e.push(i);
9891
+ i.id = f++, d.push(i), r[t].vertex1 === n ? r[t].vertex1 = i : r[t].vertex2 = i, e.push(i);
9698
9892
  }
9699
- for (let n = 0; n < e.length; n++) for (let r = n + 1; r < e.length; r++) s.push(new Edge(e[n], e[r], t));
9893
+ for (let n = 0; n < e.length; n++) for (let r = n + 1; r < e.length; r++) l.push(new Edge(e[n], e[r], t));
9700
9894
  }
9701
9895
  }
9702
9896
  });
9703
- let h = {
9897
+ let b = {
9704
9898
  type: "MultiPolygon",
9705
9899
  coordinates: []
9706
9900
  };
9707
- return a.filter((e) => e.properties && OsmTagsUtils.isRoutingBounds(e.properties)).forEach((e) => {
9901
+ o.filter((e) => e.properties && OsmTagsUtils.isRoutingBounds(e.properties)).forEach((e) => {
9708
9902
  if (e.geometry.type === "LineString") {
9709
9903
  let t = lineStringToPolygon(e.geometry);
9710
- h.coordinates.push(t.coordinates);
9711
- } else e.geometry.type === "Polygon" ? h.coordinates.push(e.geometry.coordinates) : e.geometry.type === "MultiPolygon" && h.coordinates.push(...e.geometry.coordinates);
9712
- }), new Graph_default(l, s, h.coordinates.length > 0 ? h : void 0, m);
9904
+ b.coordinates.push(t.coordinates);
9905
+ } else e.geometry.type === "Polygon" ? b.coordinates.push(e.geometry.coordinates) : e.geometry.type === "MultiPolygon" && b.coordinates.push(...e.geometry.coordinates);
9906
+ });
9907
+ let x = [];
9908
+ return p.length > 0 && x.push({
9909
+ type: ImportErrors.CANNOT_ASSIGN_ELEVATOR_LEVEL_TO_SEGMENTS,
9910
+ data: p
9911
+ }), x.length > 0 && a?.(x), new Graph_default(d, l, b.coordinates.length > 0 ? b : void 0, v);
9713
9912
  }
9714
9913
  }, OsmGraphUtils = class e {
9715
9914
  static RESTRICTED_PEDESTRIANS_HIGHWAYS = ["motorway", "motorway_link"];
@@ -9718,7 +9917,7 @@ var GeoJsonGraphUtils = class e {
9718
9917
  if (t.tags.foot === "yes") return !0;
9719
9918
  if (t.tags.access && ["no", "private"].includes(t.tags.access)) return !1;
9720
9919
  let n = t.tags.highway === "elevator" && t.isGeometryClosed;
9721
- return t.tags.highway && !e.RESTRICTED_PEDESTRIANS_HIGHWAYS.includes(t.tags.highway) && !n || t.tags.footway === "sidewalk" || t.tags.public_transport === "platform" || t.tags.railway === "platform";
9920
+ return t.tags.highway && !e.RESTRICTED_PEDESTRIANS_HIGHWAYS.includes(t.tags.highway) && !n || t.tags.footway === "sidewalk" || t.tags.public_transport === "platform" || t.tags.railway === "platform" || t.tags.railway === "funicular";
9722
9921
  };
9723
9922
  static parseNodeProperties(e) {
9724
9923
  return {
@@ -9742,69 +9941,87 @@ var GeoJsonGraphUtils = class e {
9742
9941
  let t = OsmParser.parseOsmXmlString(e);
9743
9942
  return this.createGraphFromOsmModel(t);
9744
9943
  }
9745
- static createGraphFromOsmModel(t, i = e.DEFAULT_WAY_SELECTOR, a) {
9746
- let s = [], l = [], d = [], f = /* @__PURE__ */ new Set(), p = (e, t) => {
9747
- let i = l.find(([n, i]) => n === e.id ? Level.intersect(i.coords.level, t) ? !0 : i.coords.level === null || t === null : !1)?.[1] || null;
9944
+ static createGraphFromOsmModel(t, i = e.DEFAULT_WAY_SELECTOR, a, s) {
9945
+ let l = [], d = [], f = [], p = /* @__PURE__ */ new Set(), m = [], h = (e, t) => {
9946
+ let i = d.find(([n, i]) => n === e.id ? Level.intersect(i.coords.level, t) ? !0 : OsmTagsUtils.isElevator(e.tags) ? !1 : i.coords.level === null || t === null : !1)?.[1] || null;
9748
9947
  if (i) return Level.equals(i.coords.level, t) || (i.coords.level = Level.intersection(i.coords.level, t), i.coords.level === null && (i.coords.level = t)), i;
9749
- if (i = new Vertex(new Coordinates(e.coords.lat, e.coords.lng, null, t), this.parseNodeProperties(e), e.tags), l.push([e.id, i]), OsmTagsUtils.isElevator(e.tags)) {
9750
- let t = d.find(([t]) => e.id === t);
9948
+ if (i = new Vertex(new Coordinates(e.coords.lat, e.coords.lng, null, t), this.parseNodeProperties(e), e.tags), d.push([e.id, i]), OsmTagsUtils.isElevator(e.tags)) {
9949
+ let t = f.find(([t]) => e.id === t);
9751
9950
  t || (t = [
9752
9951
  e.id,
9753
9952
  e.name,
9754
9953
  []
9755
- ], d.push(t)), t[2].push(i);
9954
+ ], f.push(t)), t[2].push(i);
9756
9955
  }
9757
- return OsmTagsUtils.isRoutingBoundsEntryPoint(e.tags) && f.add(i), i;
9956
+ return OsmTagsUtils.isRoutingBoundsEntryPoint(e.tags) && p.add(i), i;
9758
9957
  };
9759
9958
  t.ways.forEach((e) => {
9760
9959
  if (!i(e)) return;
9761
9960
  let t = this.parseWayProperties(e), n = (n) => {
9762
9961
  for (let r = 1; r < e.nodes.length; r++) {
9763
- let i = p(e.nodes[r - 1], n), a = p(e.nodes[r], n);
9962
+ let i = h(e.nodes[r - 1], n), a = h(e.nodes[r], n);
9764
9963
  if (OsmTagsUtils.isOnewayBackward(e.tags)) {
9765
9964
  let e = a;
9766
9965
  a = i, i = e;
9767
9966
  }
9768
9967
  let o = new Edge(i, a, t, e.tags);
9769
- s.push(o);
9968
+ l.push(o);
9770
9969
  }
9771
9970
  };
9772
- n(e.level), e.tags.repeat_on && e.tags.repeat_on.split(";").map(Level.fromString).forEach(n);
9971
+ e.tags.repeat_on && e.level === null || n(e.level), e.tags.repeat_on && e.tags.repeat_on.split(";").map(Level.fromString).forEach(n);
9773
9972
  });
9774
- let m = -1;
9973
+ let g = -1;
9775
9974
  t.ways.filter((e) => OsmTagsUtils.isElevator(e.tags) && e.isGeometryClosed).filter((e) => {
9776
9975
  let t = e.getGeoJsonPolygon();
9777
- return !d.flatMap(([, , e]) => e).some((e) => pointInPolygon([e.coords.lng, e.coords.lat], t));
9976
+ return !f.flatMap(([, , e]) => e).some((e) => pointInPolygon([e.coords.lng, e.coords.lat], t));
9778
9977
  }).forEach((e) => {
9779
- let t = e.nodes.map((e) => l.filter(([t]) => t === e.id).map((e) => e[1])).flat(), i = e.nodes.reduce((e, t) => [e[0] + t.coords.lat, e[1] + t.coords.lng], [0, 0]).map((t) => t / e.nodes.length), a = t.reduce((e, t) => Level.union(e, t.coords.level), null), c = new Coordinates(i[0], i[1], null, a), u = new OsmNode(m--, c, { highway: "elevator" });
9978
+ let t = e.nodes.map((e) => d.filter(([t]) => t === e.id).map((e) => e[1])).flat(), i = e.nodes.reduce((e, t) => [e[0] + t.coords.lat, e[1] + t.coords.lng], [0, 0]).map((t) => t / e.nodes.length), a = t.reduce((e, t) => Level.union(e, t.coords.level), null), s = new Coordinates(i[0], i[1], null, a), c = new OsmNode(g--, s, { highway: "elevator" });
9780
9979
  t.forEach((t) => {
9781
- let n = p(u, t.coords.level);
9782
- s.push(new Edge(n, t, { externalId: e.id }));
9980
+ let n = h(c, t.coords.level);
9981
+ l.push(new Edge(n, t, { externalId: e.id }));
9783
9982
  });
9784
- }), d.forEach(([e, t, n]) => {
9983
+ });
9984
+ let _ = (e, n) => {
9985
+ let r = t.nodes.find((t) => t.id === e);
9986
+ if (!r || !r.tags.level?.includes(";")) return null;
9987
+ let i = r.tags.level.split(";").map((e) => Number(e)), a = n.map((e) => e.coords.level), o = i.filter((e) => !a.includes(e));
9988
+ return o.length === 1 || m.push({ coordinates: r.coords }), o[0];
9989
+ };
9990
+ f.forEach(([e, t, n]) => {
9785
9991
  let r = {
9786
9992
  name: t,
9787
9993
  isElevator: !0,
9788
9994
  externalId: e
9789
9995
  };
9790
- for (let e = 0; e < n.length; e++) for (let t = e + 1; t < n.length; t++) s.push(new Edge(n[e], n[t], r));
9996
+ n.forEach((t) => {
9997
+ if (t.coords.level === null) {
9998
+ let r = _(e, n);
9999
+ r !== null && (t.coords.level = r);
10000
+ }
10001
+ });
10002
+ for (let e = 0; e < n.length; e++) for (let t = e + 1; t < n.length; t++) l.push(new Edge(n[e], n[t], r));
9791
10003
  if (n.length === 1 && n[0].coords.level === null) {
9792
- let e = n[0], t = s.filter((t) => t.vertex1 === e || t.vertex2 === e);
10004
+ let e = n[0], t = l.filter((t) => t.vertex1 === e || t.vertex2 === e);
9793
10005
  if (t.length > 1) {
9794
10006
  let n = [e];
9795
10007
  for (let r = 1; r < t.length; r++) {
9796
10008
  let i = new Vertex(e.coords, e.properties, e.rawTags);
9797
- l.push([e.id, i]), t[r].vertex1 === e ? t[r].vertex1 = i : t[r].vertex2 = i, n.push(i);
10009
+ d.push([e.id, i]), t[r].vertex1 === e ? t[r].vertex1 = i : t[r].vertex2 = i, n.push(i);
9798
10010
  }
9799
- for (let e = 0; e < n.length; e++) for (let t = e + 1; t < n.length; t++) s.push(new Edge(n[e], n[t], r));
10011
+ for (let e = 0; e < n.length; e++) for (let t = e + 1; t < n.length; t++) l.push(new Edge(n[e], n[t], r));
9800
10012
  }
9801
10013
  }
9802
10014
  });
9803
- let h = {
10015
+ let v = {
9804
10016
  type: "MultiPolygon",
9805
10017
  coordinates: []
9806
10018
  };
9807
- return t.ways.filter((e) => OsmTagsUtils.isRoutingBounds(e.tags)).map((e) => e.getGeoJsonPolygon()).forEach((e) => e && h.coordinates.push(e.coordinates)), t.relations.filter((e) => OsmTagsUtils.isRoutingBounds(e.tags)).map((e) => e.getGeoJsonPolygon()).forEach((e) => e && h.coordinates.push(e.coordinates)), a?.(l), new Graph_default(l.map((e) => e[1]), s, h.coordinates.length > 0 ? h : void 0, Array.from(f));
10019
+ t.ways.filter((e) => OsmTagsUtils.isRoutingBounds(e.tags)).map((e) => e.getGeoJsonPolygon()).forEach((e) => e && v.coordinates.push(e.coordinates)), t.relations.filter((e) => OsmTagsUtils.isRoutingBounds(e.tags)).map((e) => e.getGeoJsonPolygon()).forEach((e) => e && v.coordinates.push(e.coordinates)), a?.(d);
10020
+ let y = [];
10021
+ return m.length > 0 && y.push({
10022
+ type: ImportErrors.CANNOT_ASSIGN_ELEVATOR_LEVEL_TO_SEGMENTS,
10023
+ data: m
10024
+ }), y.length > 0 && s?.(y), new Graph_default(d.map((e) => e[1]), l, v.coordinates.length > 0 ? v : void 0, Array.from(p));
9808
10025
  }
9809
10026
  }, CustomGraphMapTester = class {
9810
10027
  static createReportFromOsmXmlString(e) {
@@ -9817,8 +10034,8 @@ var GeoJsonGraphUtils = class e {
9817
10034
  details: e instanceof Error ? e.message : "Unknown error"
9818
10035
  }] };
9819
10036
  }
9820
- let n = new CustomGraphMap(OsmGraphUtils.createGraphFromOsmModel(t));
9821
- return this.createReportFromCustomGraphMap(n);
10037
+ let n = [], r = new CustomGraphMap(OsmGraphUtils.createGraphFromOsmModel(t, void 0, void 0, (e) => n = e)), i = this.createReportFromCustomGraphMap(r);
10038
+ return i.errors.push(...n), i;
9822
10039
  }
9823
10040
  static createReportFromGeoJsonString(e) {
9824
10041
  let t;
@@ -9833,19 +10050,66 @@ var GeoJsonGraphUtils = class e {
9833
10050
  return this.createReportFromGeoJson(t);
9834
10051
  }
9835
10052
  static createReportFromGeoJson(e) {
9836
- let t = new CustomGraphMap(GeoJsonGraphUtils.createGraphFromGeojson(e));
9837
- return this.createReportFromCustomGraphMap(t);
10053
+ let t = [], n = new CustomGraphMap(GeoJsonGraphUtils.createGraphFromGeojson(e, void 0, (e) => t = e)), r = this.createReportFromCustomGraphMap(n);
10054
+ return r.errors.push(...t), r;
9838
10055
  }
9839
10056
  static createReportFromCustomGraphMap(e) {
9840
- let t = e.graph, n = [];
9841
- t.routingBounds || n.push({ type: "routing-bounds-not-found" }), t.routingBoundsEntryPoints.length === 0 && n.push({ type: "routing-bounds-entry-points-not-found" });
9842
- let r = e.router.calculateComponents();
9843
- return r.length > 1 && n.push({
10057
+ let t = e.graph, i = [];
10058
+ t.routingBounds || i.push({ type: "routing-bounds-not-found" }), t.routingBoundsEntryPoints.length === 0 && i.push({ type: "routing-bounds-entry-points-not-found" });
10059
+ let a = e.router.calculateComponents();
10060
+ a.length > 1 && i.push({
9844
10061
  type: "multiple-graph-components",
9845
- data: r
10062
+ data: a
10063
+ });
10064
+ let o = /* @__PURE__ */ new Map();
10065
+ a.forEach((e, t) => {
10066
+ e.forEach((e) => o.set(e.id, t));
10067
+ });
10068
+ let s = [];
10069
+ for (let e = 0; e < t.edges.length; e++) for (let i = e + 1; i < t.edges.length; i++) {
10070
+ let a = t.edges[e], o = t.edges[i];
10071
+ if (Level.isRange(a.level) || Level.isRange(o.level)) continue;
10072
+ let c = Edge.intersection(a, o);
10073
+ c && (Coordinates.equals(c, a.vertex1.coords) || Coordinates.equals(c, a.vertex2.coords) || Coordinates.equals(c, o.vertex1.coords) || Coordinates.equals(c, o.vertex2.coords) || s.push({
10074
+ edge1: a,
10075
+ edge2: o,
10076
+ estimatedIntersection: c
10077
+ }));
10078
+ }
10079
+ s.length > 0 && i.push({
10080
+ type: "edges-not-linked",
10081
+ data: s
10082
+ });
10083
+ let c = [];
10084
+ for (let n = 0; n < t.vertices.length; n++) for (let i = n + 1; i < t.vertices.length; i++) {
10085
+ let a = t.vertices[n], s = t.vertices[i];
10086
+ if (!(Level.isRange(a.coords.level) || Level.isRange(s.coords.level)) && Level.intersect(a.coords.level, s.coords.level) && a.distanceTo(s) < .5) {
10087
+ let n = o.get(a.id), r = o.get(s.id);
10088
+ if (n !== void 0 && r !== void 0 && n !== r) continue;
10089
+ if (!Edge.getEdgeByVertices(t.edges, a, s)) {
10090
+ let n = t.edges.filter((e) => e.vertex1 === a || e.vertex2 === a), r = t.edges.filter((e) => e.vertex1 === s || e.vertex2 === s);
10091
+ if (n.some((e) => {
10092
+ let t = e.properties;
10093
+ return !!(t.isStairs || t.isStair || e.rawTags?.highway === "steps");
10094
+ }) || r.some((e) => {
10095
+ let t = e.properties;
10096
+ return !!(t.isStairs || t.isStair || e.rawTags?.highway === "steps");
10097
+ })) continue;
10098
+ let i = e.router.calculateShortestPathByVertex(a, s)?.weightedDistance();
10099
+ if (i && i < 20) continue;
10100
+ c.push({
10101
+ vertex1: a,
10102
+ vertex2: s
10103
+ });
10104
+ }
10105
+ }
10106
+ }
10107
+ return c.length > 0 && i.push({
10108
+ type: "near-points-not-linked",
10109
+ data: c
9846
10110
  }), {
9847
10111
  customGraphMap: e,
9848
- errors: n
10112
+ errors: i
9849
10113
  };
9850
10114
  }
9851
10115
  static reportToJson(e) {