atriusmaps-node-sdk 3.3.924 → 3.3.925

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.
@@ -2,210 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var name = "web-engine";
6
- var version = "3.3.924";
7
- var license = "UNLICENSED";
8
- var type = "module";
9
- var main = "src/main.ts";
10
- var workspaces = [
11
- "demo",
12
- "deploy",
13
- "nodesdk",
14
- "src/extModules/flexapi",
15
- "services/*",
16
- "libraries/*"
17
- ];
18
- var scripts = {
19
- "build-storybook": "storybook build",
20
- colors: "cat utils/colors1.txt && node utils/processColors.ts | pbcopy && cat utils/colors2.txt",
21
- demo: "cd demo/ && yarn start",
22
- dev: "yarn mol e2e",
23
- "format:check": "yarn prettier . --check",
24
- "format:fix": "yarn prettier . --write",
25
- goProd: "cd deploy && scripts/goProd.sh",
26
- goStaging: "deploy/scripts/goStaging.sh",
27
- "icons:convert": "node scripts/convertSvgToJsx.mjs",
28
- lint: "eslint . --ext .js,.jsx,.ts,.tsx",
29
- mod: "demo/startMod.sh",
30
- mol: "demo/startMol.sh",
31
- "mol:build": "demo/startMolBuild.sh",
32
- "mol:preview": "demo/startMolPreview.sh",
33
- molProd: "cd deploy && yarn buildAndRunMol",
34
- "playwright:ci": "yarn playwright test --grep-invert sdk",
35
- "playwright:ci:failed": "yarn playwright test --last-failed --grep-invert sdk",
36
- "playwright:sdk": "yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'",
37
- "playwright:ui": "yarn playwright test --ui --grep-invert sdk",
38
- prepare: "husky",
39
- storybook: "storybook dev -p 6006",
40
- test: "vitest run --project unit",
41
- "test:all": "yarn lint && yarn format:check && yarn test && yarn playwright:ci",
42
- "test:comp": "vitest run --project browser",
43
- "test:comp:ci": "vitest run --project browser --reporter=dot",
44
- "test:comp:ui": "VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false",
45
- "test:mod": "playwright test --config=playwright.mod.config.ts",
46
- "test-watch": "vitest --watch",
47
- typecheck: "tsc -p tsconfig.checkjs.json",
48
- "typecheck:strict": "tsc -p tsconfig.strict.json"
49
- };
50
- var browserslist = [
51
- "defaults"
52
- ];
53
- var resolutions = {
54
- "@swc/core": "1.15.40",
55
- "@swc/plugin-styled-components": "12.14.0",
56
- vite: "7.3.2"
57
- };
58
- var dependencies = {
59
- "@azure/event-hubs": "^5.12.2",
60
- "@csstools/normalize.css": "^11.0.1",
61
- "@dnd-kit/core": "^6.3.1",
62
- "@dnd-kit/modifiers": "^9.0.0",
63
- "@dnd-kit/sortable": "^10.0.0",
64
- "@dnd-kit/utilities": "^3.2.2",
65
- "@fontsource/roboto": "^5.2.10",
66
- "@mapbox/mapbox-gl-draw": "^1.5.0",
67
- "@mapbox/mapbox-gl-draw-static-mode": "^1.0.1",
68
- "@microsoft/applicationinsights-web": "^3.3.6",
69
- "@styled-system/prop-types": "^5.1.5",
70
- "@turf/area": "^7.2.0",
71
- "@turf/bbox-clip": "^7.2.0",
72
- "@turf/bbox-polygon": "^7.2.0",
73
- "@turf/bearing": "^7.2.0",
74
- "@turf/circle": "^7.2.0",
75
- "@turf/helpers": "^7.2.0",
76
- "@turf/point-to-line-distance": "^7.2.0",
77
- "@vitejs/plugin-react": "^5.2.0",
78
- "@zumer/snapdom": "^2.9.0",
79
- "axe-core": "^4.10.3",
80
- browserslist: "^4.27.0",
81
- "crypto-browserify": "^3.12.1",
82
- dompurify: "^3.3.3",
83
- flexsearch: "^0.7.43",
84
- "h3-js": "^4.1.0",
85
- i18next: "^26.0.0",
86
- "i18next-browser-languagedetector": "^6.1.1",
87
- jsdom: "^25.0.1",
88
- jsonschema: "^1.5.0",
89
- luxon: "^3.5.0",
90
- "maplibre-gl": "^4.7.1",
91
- "path-browserify": "^1.0.1",
92
- pmtiles: "^4.4.0",
93
- "prop-types": "^15.8.1",
94
- "qrcode.react": "^4.2.0",
95
- ramda: "^0.32.0",
96
- react: "^19.2.4",
97
- "react-compound-slider": "^3.4.0",
98
- "react-dom": "^19.2.4",
99
- "react-json-editor-ajrm": "^2.5.14",
100
- "react-svg": "^16.3.0",
101
- "react-virtualized-auto-sizer": "^1.0.25",
102
- "react-window": "^1.8.11",
103
- "smoothscroll-polyfill": "^0.4.4",
104
- "styled-components": "^6.1.15",
105
- "styled-normalize": "^8.1.1",
106
- "styled-system": "^5.1.5",
107
- "styled-tools": "^1.7.2",
108
- "throttle-debounce": "^5.0.2",
109
- "ua-parser-js": "^0.7.40",
110
- uuid: "^11.1.0",
111
- zousan: "^3.0.1",
112
- "zousan-plus": "^4.0.1"
113
- };
114
- var devDependencies = {
115
- "@axe-core/playwright": "^4.10.2",
116
- "@azure/identity": "^4.13.0",
117
- "@azure/playwright": "^1.0.0",
118
- "@playwright/test": "~1.59.1",
119
- "@rollup/plugin-typescript": "^12.3.0",
120
- "@storybook/addon-essentials": "^8.6.15",
121
- "@storybook/blocks": "^8.6.15",
122
- "@storybook/react": "^8.6.15",
123
- "@storybook/react-vite": "^8.6.15",
124
- "@testing-library/dom": "^10.4.1",
125
- "@testing-library/jest-dom": "^6.6.3",
126
- "@testing-library/react": "^16.3.0",
127
- "@testing-library/user-event": "^14.5.2",
128
- "@types/luxon": "^3.7.2",
129
- "@types/react": "^19.0.10",
130
- "@types/react-dom": "^19.0.4",
131
- "@types/styled-system": "^5.1.25",
132
- "@typescript-eslint/eslint-plugin": "^8.26.1",
133
- "@typescript-eslint/parser": "^8.26.1",
134
- "@vitest/browser": "4.1.6",
135
- "@vitest/browser-playwright": "4.1.6",
136
- "@vitest/ui": "4.1.6",
137
- eslint: "^8.57.1",
138
- "eslint-config-prettier": "^10.1.8",
139
- "eslint-import-resolver-alias": "^1.1.2",
140
- "eslint-plugin-playwright": "^2.2.2",
141
- "eslint-plugin-react": "^7.37.4",
142
- "eslint-plugin-vitest": "^0.5.4",
143
- "fetch-mock": "^12.6.0",
144
- glob: "^11.0.1",
145
- husky: "^9.1.7",
146
- "lint-staged": "^16.4.0",
147
- "node-fetch": "^2.7.0",
148
- nx: "19.8.14",
149
- "nx-remotecache-azure": "^19.0.0",
150
- "os-browserify": "^0.3.0",
151
- prettier: "^3.8.3",
152
- "rollup-plugin-esbuild": "^6.2.1",
153
- "start-server-and-test": "^2.0.11",
154
- storybook: "^8.6.15",
155
- typescript: "^5.8.2",
156
- vite: "^7.3.2",
157
- "vite-plugin-node-polyfills": "^0.26.0",
158
- vitest: "^4.1.8"
159
- };
160
- var packageManager = "yarn@4.13.0";
161
- var engines = {
162
- node: "24.x"
163
- };
164
- var nx = {
165
- };
5
+ var version = "3.3.925";
166
6
  var pkg = {
167
- name: name,
168
- version: version,
169
- "private": true,
170
- license: license,
171
- type: type,
172
- main: main,
173
- workspaces: workspaces,
174
- scripts: scripts,
175
- "lint-staged": {
176
- "*.{js,ts,tsx}": [
177
- "eslint --fix",
178
- "prettier --write"
179
- ],
180
- "*": [
181
- "prettier --write --ignore-unknown"
182
- ],
183
- "src/i18n/**/*.json": [
184
- "node utils/sort-json.ts",
185
- "prettier --write"
186
- ]
187
- },
188
- browserslist: browserslist,
189
- resolutions: resolutions,
190
- dependencies: dependencies,
191
- devDependencies: devDependencies,
192
- packageManager: packageManager,
193
- engines: engines,
194
- nx: nx
195
- };
7
+ version: version};
196
8
 
197
- exports.browserslist = browserslist;
198
9
  exports.default = pkg;
199
- exports.dependencies = dependencies;
200
- exports.devDependencies = devDependencies;
201
- exports.engines = engines;
202
- exports.license = license;
203
- exports.main = main;
204
- exports.name = name;
205
- exports.nx = nx;
206
- exports.packageManager = packageManager;
207
- exports.resolutions = resolutions;
208
- exports.scripts = scripts;
209
- exports.type = type;
210
10
  exports.version = version;
211
- exports.workspaces = workspaces;
@@ -83,7 +83,10 @@ const findRoute = (graph, start, destination, options = {}) => {
83
83
  waypoints.push(waypoint);
84
84
  previousRouteNode = routeNodes[i];
85
85
  }
86
- R__namespace.last(waypoints).isDestination = true;
86
+ const lastWaypoint = R__namespace.last(waypoints);
87
+ if (lastWaypoint) {
88
+ lastWaypoint.isDestination = true;
89
+ }
87
90
  return {
88
91
  waypoints,
89
92
  queues,
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  class MinPriorityQueue {
4
+ heap;
5
+ heapMap;
4
6
  constructor() {
5
7
  this.heap = [null];
6
8
  this.heapMap = {};
@@ -12,7 +14,11 @@ class MinPriorityQueue {
12
14
  }
13
15
  raisePriority(node, priority) {
14
16
  const index = this.heapMap[node];
15
- this.heap[index][1] = priority;
17
+ const entry = this.heap[index];
18
+ if (!entry) {
19
+ return;
20
+ }
21
+ entry[1] = priority;
16
22
  this.bubble(index);
17
23
  }
18
24
  poll() {
@@ -20,14 +26,22 @@ class MinPriorityQueue {
20
26
  return null;
21
27
  }
22
28
  if (this.heap.length === 2) {
23
- const value2 = this.heap.pop()[0];
29
+ const value2 = this.heap.pop()?.[0];
30
+ if (value2 === void 0) {
31
+ return null;
32
+ }
24
33
  delete this.heapMap[value2];
25
34
  return value2;
26
35
  }
27
- const value = this.heap[1][0];
36
+ const value = this.heap[1]?.[0];
37
+ if (value === void 0) {
38
+ return null;
39
+ }
28
40
  delete this.heapMap[value];
29
- this.heap[1] = this.heap.pop();
30
- this.heapMap[this.heap[1][0]] = 1;
41
+ this.heap[1] = this.heap.pop() ?? null;
42
+ if (this.heap[1]) {
43
+ this.heapMap[this.heap[1][0]] = 1;
44
+ }
31
45
  this.sink(1);
32
46
  return value;
33
47
  }
@@ -56,14 +70,21 @@ class MinPriorityQueue {
56
70
  }
57
71
  }
58
72
  swap(i, j) {
59
- this.heapMap[this.heap[i][0]] = j;
60
- this.heapMap[this.heap[j][0]] = i;
73
+ const first = this.heap[i];
74
+ const second = this.heap[j];
75
+ if (!first || !second) {
76
+ return;
77
+ }
78
+ this.heapMap[first[0]] = j;
79
+ this.heapMap[second[0]] = i;
61
80
  const temp = this.heap[i];
62
81
  this.heap[i] = this.heap[j];
63
82
  this.heap[j] = temp;
64
83
  }
65
84
  isHigherPriority(i, j) {
66
- return this.heap[i][1] < this.heap[j][1];
85
+ const first = this.heap[i];
86
+ const second = this.heap[j];
87
+ return !!first && !!second && first[1] < second[1];
67
88
  }
68
89
  }
69
90
 
@@ -142,7 +142,12 @@ function findAllShortestPathsImpl(start, destinations, nodes, nodesToAvoid, secu
142
142
  }
143
143
  });
144
144
  }
145
- let cost, prev, visited, visitQueue, lastStartId, lastOptionsStr;
145
+ let cost;
146
+ let prev;
147
+ let visited;
148
+ let visitQueue;
149
+ let lastStartId;
150
+ let lastOptionsStr;
146
151
  const clearCache = () => {
147
152
  cost = {};
148
153
  prev = {};
@@ -161,7 +166,11 @@ function findShortestPath(start, end, nodes, nodesToAvoid, securityWaitTimes = {
161
166
  lastOptionsStr = JSON.stringify(options);
162
167
  }
163
168
  while (!visitQueue.isEmpty() && !visited[end.id]) {
164
- const node2 = nodes[visitQueue.poll()];
169
+ const nextNodeId = visitQueue.poll();
170
+ if (nextNodeId == null) {
171
+ break;
172
+ }
173
+ const node2 = nodes[nextNodeId];
165
174
  const ccost = cost[node2.id];
166
175
  for (let ei = 0; ei < node2.edges.length; ei++) {
167
176
  const e = node2.edges[ei];
@@ -185,9 +194,10 @@ function findShortestPath(start, end, nodes, nodesToAvoid, securityWaitTimes = {
185
194
  }
186
195
  e.securityWaitTimes = dynamicData;
187
196
  }
188
- if (e.o && securityLanesMap[e.o]) {
189
- e.securityLane = securityLanesMap[e.o];
190
- const { type, id } = securityLanesMap[e.o];
197
+ const securityLanesById = securityLanesMap;
198
+ if (e.o && securityLanesById[e.o]) {
199
+ e.securityLane = securityLanesById[e.o];
200
+ const { type, id } = securityLanesById[e.o];
191
201
  const securityLanesIds = R.path(["selectedSecurityLanes", type], options);
192
202
  if (securityLanesIds && !securityLanesIds.includes(id)) {
193
203
  continue;
@@ -251,7 +261,8 @@ function findNodesByGeohash(floorId, geohash, geoDb) {
251
261
  return null;
252
262
  }
253
263
  function findClosestNodeByFloor(floorId, lat, lng, geoDb, nodes) {
254
- const cnodes = findNodesByGeohash(floorId, geohasher.encode(lat, lng), geoDb) || findClosestNodeByFloor2(floorId, lat, lng, nodes);
264
+ const hashedNodes = findNodesByGeohash(floorId, geohasher.encode(lat, lng), geoDb);
265
+ const cnodes = hashedNodes ?? [findClosestNodeByFloor2(floorId, lat, lng, nodes)];
255
266
  const nodeWithDistance = [];
256
267
  for (let i = 0; i < cnodes.length; i++) {
257
268
  const distance = geodesy.distance(lat, lng, cnodes[i].lat, cnodes[i].lng);
@@ -262,7 +273,10 @@ function findClosestNodeByFloor(floorId, lat, lng, geoDb, nodes) {
262
273
  });
263
274
  const nodesSortedByDistance = [];
264
275
  for (let i = 0; i < nodeWithDistance.length; i++) {
265
- nodesSortedByDistance.push(nodeWithDistance[i][0]);
276
+ const nodeWithDistanceEntry = nodeWithDistance[i];
277
+ if (nodeWithDistanceEntry) {
278
+ nodesSortedByDistance.push(nodeWithDistanceEntry[0]);
279
+ }
266
280
  }
267
281
  return nodesSortedByDistance[0];
268
282
  }
@@ -283,8 +297,9 @@ function findClosestNodeByOrdinal(ord, lat, lng, nodes) {
283
297
  function selectShortest(ar) {
284
298
  let shortest = ar[0];
285
299
  for (let i = 1; i < ar.length; i++) {
286
- if (ar[i][1] < shortest[1]) {
287
- shortest = ar[i];
300
+ const current = ar[i];
301
+ if (current && current[1] < shortest[1]) {
302
+ shortest = current;
288
303
  }
289
304
  }
290
305
  return shortest[0];
@@ -84,7 +84,7 @@ const setSegmentCategory = (segments) => {
84
84
  });
85
85
  };
86
86
  const existsEnd = (segments, lastWaypoint) => {
87
- if (segments.length === 1) {
87
+ if (segments.length === 1 && lastWaypoint) {
88
88
  const segment = { segmentCategory: void 0, waypoints: [] };
89
89
  segment.segmentCategory = segmentCategories.WALKING_TO_END;
90
90
  segment.type = "Walk";
@@ -96,7 +96,7 @@ const joinSegments = (segments) => {
96
96
  segments.forEach((segment, index) => {
97
97
  if (index > 1) {
98
98
  const firstWaypointOfSegment = R__namespace.head(segment.waypoints);
99
- if (firstWaypointOfSegment.levelDifference === 0) {
99
+ if (firstWaypointOfSegment?.levelDifference === 0) {
100
100
  const lastWaypointOfPreviousSegment = R__namespace.last(segments[index - 1].waypoints);
101
101
  segment.waypoints = R__namespace.prepend(lastWaypointOfPreviousSegment, segment.waypoints);
102
102
  }
@@ -112,7 +112,10 @@ const calculateCurveLineCoordinates = (segment) => segment.waypoints.flatMap((wa
112
112
  return [[waypoint.position.lng, waypoint.position.lat]];
113
113
  }
114
114
  });
115
- const addCurveLineCoordinates = R__namespace.map(R__namespace.converge(R__namespace.assoc("coordinates"), [calculateCurveLineCoordinates, R__namespace.identity]));
115
+ const addCurveLineCoordinates = (segments) => segments.map((segment) => ({
116
+ ...segment,
117
+ coordinates: calculateCurveLineCoordinates(segment)
118
+ }));
116
119
  const createSegments = (waypoints) => {
117
120
  const segments = [];
118
121
  let segment = { segmentCategory: void 0, waypoints: [] };
@@ -157,7 +160,9 @@ const createSegments = (waypoints) => {
157
160
  });
158
161
  segment.waypoints = segmentWaypoints;
159
162
  if (segmentWaypoints.length === 0) {
160
- segment.waypoints = [lastWaypoint];
163
+ if (lastWaypoint) {
164
+ segment.waypoints = [lastWaypoint];
165
+ }
161
166
  }
162
167
  segments.push(segment);
163
168
  setSegmentCategory(segments);
@@ -181,15 +186,15 @@ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T,
181
186
  let rawSegments = createSegments(waypoints);
182
187
  rawSegments = addCurveLineCoordinates(rawSegments);
183
188
  if (fromEndpoint) {
184
- rawSegments[0].coordinates.unshift([fromEndpoint.lng, fromEndpoint.lat]);
189
+ rawSegments[0]?.coordinates.unshift([fromEndpoint.lng, fromEndpoint.lat]);
185
190
  }
186
191
  if (toEndpoint) {
187
- R__namespace.last(rawSegments).coordinates.push([toEndpoint.lng, toEndpoint.lat]);
192
+ R__namespace.last(rawSegments)?.coordinates.push([toEndpoint.lng, toEndpoint.lat]);
188
193
  }
189
194
  const segments = rawSegments.map((segment, index) => {
190
195
  const startWaypoint = R__namespace.last(segment.waypoints);
191
196
  const coordinates = segment.coordinates;
192
- const shouldDrawSegment = !(segment.levelDifference && segment.waypoints.every(R__namespace.prop("isPortal")));
197
+ const shouldDrawSegment = !(segment.levelDifference && segment.waypoints.every((waypoint) => waypoint.isPortal));
193
198
  const cookedSegment = {
194
199
  levelId: startWaypoint.position.structureId,
195
200
  ordinalId: `ordinal: ${startWaypoint.position.ordinal}`,
@@ -275,9 +275,9 @@ const getSecurityLaneName = (queueTypes, waypoints) => {
275
275
  }
276
276
  const types = R.prop(lane.type, queueTypes);
277
277
  const laneType = R.find(R.propEq(lane.id, "id"), types);
278
- return R.prop("displayText", laneType);
278
+ return laneType?.displayText;
279
279
  };
280
- const findPropWaypoints = (propName) => R.compose(R.prop(propName), R.find(R.prop(propName)), R.drop(1));
280
+ const findPropWaypoints = (propName) => (waypoints) => waypoints.slice(1).find((waypoint) => waypoint[propName])?.[propName];
281
281
  const getClosestSecurityPoiTitle = (waypoints, securityPois) => {
282
282
  if (!waypoints || waypoints.length === 0) {
283
283
  return null;
@@ -64,7 +64,7 @@ function create(app, config) {
64
64
  const securityPois = await app.bus.get("poi/getByCategoryId", {
65
65
  categoryId: "security"
66
66
  });
67
- return R__namespace.pipe(R__namespace.map(getSecurityLane), R__namespace.filter(R__namespace.identity))(securityPois);
67
+ return R__namespace.pipe(R__namespace.map(getSecurityLane), R__namespace.filter(Boolean))(securityPois);
68
68
  };
69
69
  const getSecurityLane = (poi) => poi.queue && {
70
70
  type: R__namespace.path(["queue", "queueType"], poi),
@@ -184,7 +184,9 @@ function create(app, config) {
184
184
  async function getRoute({ fromEndpoint, toEndpoint, options = {} }) {
185
185
  const rawPois = await app.bus.get("poi/getAll") || {};
186
186
  const allPois = Array.isArray(rawPois) ? rawPois[0] : rawPois;
187
- const securityPois = Object.values(allPois).filter((poi) => poi.category && poi.category.startsWith("security"));
187
+ const securityPois = Object.values(allPois).filter(
188
+ (poi) => poi.category && poi.category.startsWith("security")
189
+ );
188
190
  const currentUnits = await app.bus.getFirst("directions/getPreferredUnits") || "meters";
189
191
  return graphLoadedProm.then(async (graph) => {
190
192
  options.compareFindPaths = config.compareFindPaths;
@@ -209,7 +211,9 @@ function create(app, config) {
209
211
  );
210
212
  log.info("route", route);
211
213
  const time = Math.round(route.waypoints.reduce((total, { eta }) => total + eta, 0));
212
- const distance = Math.round(route.waypoints.reduce((total, { distance: distance2 }) => total + distance2, 0));
214
+ const distance = Math.round(
215
+ route.waypoints.reduce((total, { distance: distance2 }) => total + distance2, 0)
216
+ );
213
217
  return { ...route, segments, steps, time, distance };
214
218
  });
215
219
  }
@@ -224,7 +228,9 @@ function create(app, config) {
224
228
  const poisList = R__namespace.clone(pois);
225
229
  const poiLocations = poisList.map((poi) => poiToNavigationEndpoint(poi, graph.floorIdToOrdinal));
226
230
  const paths = graph.findAllShortestPaths(start, poiLocations, options);
227
- const poisWithPathProps = poisList.map((poi, i) => resolveAndAddPathProps(poi, paths[i], start, "start"));
231
+ const poisWithPathProps = poisList.map(
232
+ (poi, i) => resolveAndAddPathProps(poi, paths[i], start, "start")
233
+ );
228
234
  return filterAndSort(poisWithPathProps);
229
235
  } catch (e) {
230
236
  log.error(e);
@@ -247,7 +253,7 @@ function create(app, config) {
247
253
  }
248
254
  }
249
255
  function calculateTotalPathProperty(path, propertyName) {
250
- return R__namespace.aperture(2, path).map(([from, to]) => getEdgeTo(to.id)(from)).map(R__namespace.prop(propertyName)).reduce((totalTime, edgeTime) => totalTime + edgeTime, 0);
256
+ return R__namespace.aperture(2, path).map(([from, to]) => getEdgeTo(to.id)(from)).map((edge) => edge?.[propertyName] ?? 0).reduce((totalTime, edgeTime) => totalTime + edgeTime, 0);
251
257
  }
252
258
  function addEndpointInformation(poi, endpoint, endpointType) {
253
259
  return {
@@ -287,7 +293,8 @@ function create(app, config) {
287
293
  const end = endPoi ? poiToNavigationEndpoint(endPoi, graph.floorIdToOrdinal) : null;
288
294
  const poisList = R__namespace.clone(pois);
289
295
  const poiLocations = poisList.map((poi) => poiToNavigationEndpoint(poi, graph.floorIdToOrdinal));
290
- let pathsPrimary, pathsSecondary;
296
+ let pathsPrimary = [];
297
+ let pathsSecondary = [];
291
298
  if (start) {
292
299
  pathsPrimary = graph.findAllShortestPaths(start, poiLocations, options);
293
300
  }
@@ -300,9 +307,13 @@ function create(app, config) {
300
307
  (poi, i) => resolveAndAddMultipointPathProps(poi, pathsPrimary[i], pathsSecondary[i], start, end)
301
308
  );
302
309
  } else if (start) {
303
- poisWithPathProps = poisList.map((poi, i) => resolveAndAddPathProps(poi, pathsPrimary[i], start, "start"));
310
+ poisWithPathProps = poisList.map(
311
+ (poi, i) => resolveAndAddPathProps(poi, pathsPrimary[i], start, "start")
312
+ );
304
313
  } else {
305
- poisWithPathProps = poisList.map((poi, i) => resolveAndAddPathProps(poi, pathsSecondary[i], end, "end"));
314
+ poisWithPathProps = poisList.map(
315
+ (poi, i) => resolveAndAddPathProps(poi, pathsSecondary[i], end, "end")
316
+ );
306
317
  }
307
318
  return filterAndSort(poisWithPathProps);
308
319
  } catch (e) {
@@ -364,7 +375,10 @@ function create(app, config) {
364
375
  }
365
376
  graphLoadedProm.then((graph) => graph.updateWithSecurityWaitTime(idValuesMap));
366
377
  });
367
- app.bus.on("wayfinder/getNavGraphFeatures", () => graphLoadedProm.then(({ _nodes }) => navGraphDebug.enrichDebugNavGraph(_nodes)));
378
+ app.bus.on(
379
+ "wayfinder/getNavGraphFeatures",
380
+ () => graphLoadedProm.then(({ _nodes }) => navGraphDebug.enrichDebugNavGraph(_nodes))
381
+ );
368
382
  return {
369
383
  init,
370
384
  internal: {
@@ -90,11 +90,13 @@ async function create(rawConfig) {
90
90
  const appInstance = /* @__PURE__ */ Object.create(null);
91
91
  let config = rawConfig.extends ? await extendConfig(rawConfig, rawConfig.extends) : rawConfig;
92
92
  if (config.plugins?.monitoring) {
93
+ const monConfig = config.plugins.monitoring;
93
94
  try {
94
95
  const mon = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('../_virtual/_empty_module_placeholder.js')); });
95
- await mon.activate(config.plugins.monitoring);
96
+ await mon.activate(monConfig);
96
97
  } catch (err) {
97
- console.warn("Monitoring plugin failed to load (continuing without it):", err?.message || err);
98
+ const message = err instanceof Error ? err.message : String(err);
99
+ console.warn("Monitoring plugin failed to load (continuing without it):", message);
98
100
  }
99
101
  }
100
102
  config = await handleConfigPostProcess(config);
@@ -118,7 +120,7 @@ async function create(rawConfig) {
118
120
  reportAllErrors: true,
119
121
  log: appLog
120
122
  });
121
- appInstance.info = { wePkg: _package };
123
+ appInstance.info = { wePkg: { version: _package.version } };
122
124
  if (typeof window !== "undefined") {
123
125
  if (config.debug) {
124
126
  appInstance.debug = R.map((fn) => fn.bind(appInstance), debugTools);
@@ -1 +1 @@
1
- var t="web-engine",e="3.3.924",s="UNLICENSED",r="module",o="src/main.ts",i=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],l={"build-storybook":"storybook build",colors:"cat utils/colors1.txt && node utils/processColors.ts | pbcopy && cat utils/colors2.txt",demo:"cd demo/ && yarn start",dev:"yarn mol e2e","format:check":"yarn prettier . --check","format:fix":"yarn prettier . --write",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh","icons:convert":"node scripts/convertSvgToJsx.mjs",lint:"eslint . --ext .js,.jsx,.ts,.tsx",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh","mol:preview":"demo/startMolPreview.sh",molProd:"cd deploy && yarn buildAndRunMol","playwright:ci":"yarn playwright test --grep-invert sdk","playwright:ci:failed":"yarn playwright test --last-failed --grep-invert sdk","playwright:sdk":"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./test/sdk && npx http-server' 8080 'yarn playwright test sdk --ui'","playwright:ui":"yarn playwright test --ui --grep-invert sdk",prepare:"husky",storybook:"storybook dev -p 6006",test:"vitest run --project unit","test:all":"yarn lint && yarn format:check && yarn test && yarn playwright:ci","test:comp":"vitest run --project browser","test:comp:ci":"vitest run --project browser --reporter=dot","test:comp:ui":"VITE_COMP_UI=1 vitest --project browser --ui --browser.headless=false","test:mod":"playwright test --config=playwright.mod.config.ts","test-watch":"vitest --watch",typecheck:"tsc -p tsconfig.checkjs.json","typecheck:strict":"tsc -p tsconfig.strict.json"},a=["defaults"],n={"@swc/core":"1.15.40","@swc/plugin-styled-components":"12.14.0",vite:"7.3.2"},p={"@azure/event-hubs":"^5.12.2","@csstools/normalize.css":"^11.0.1","@dnd-kit/core":"^6.3.1","@dnd-kit/modifiers":"^9.0.0","@dnd-kit/sortable":"^10.0.0","@dnd-kit/utilities":"^3.2.2","@fontsource/roboto":"^5.2.10","@mapbox/mapbox-gl-draw":"^1.5.0","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.6","@styled-system/prop-types":"^5.1.5","@turf/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@turf/bearing":"^7.2.0","@turf/circle":"^7.2.0","@turf/helpers":"^7.2.0","@turf/point-to-line-distance":"^7.2.0","@vitejs/plugin-react":"^5.2.0","@zumer/snapdom":"^2.9.0","axe-core":"^4.10.3",browserslist:"^4.27.0","crypto-browserify":"^3.12.1",dompurify:"^3.3.3",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^26.0.0","i18next-browser-languagedetector":"^6.1.1",jsdom:"^25.0.1",jsonschema:"^1.5.0",luxon:"^3.5.0","maplibre-gl":"^4.7.1","path-browserify":"^1.0.1",pmtiles:"^4.4.0","prop-types":"^15.8.1","qrcode.react":"^4.2.0",ramda:"^0.32.0",react:"^19.2.4","react-compound-slider":"^3.4.0","react-dom":"^19.2.4","react-json-editor-ajrm":"^2.5.14","react-svg":"^16.3.0","react-virtualized-auto-sizer":"^1.0.25","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.15","styled-normalize":"^8.1.1","styled-system":"^5.1.5","styled-tools":"^1.7.2","throttle-debounce":"^5.0.2","ua-parser-js":"^0.7.40",uuid:"^11.1.0",zousan:"^3.0.1","zousan-plus":"^4.0.1"},c={"@axe-core/playwright":"^4.10.2","@azure/identity":"^4.13.0","@azure/playwright":"^1.0.0","@playwright/test":"~1.59.1","@rollup/plugin-typescript":"^12.3.0","@storybook/addon-essentials":"^8.6.15","@storybook/blocks":"^8.6.15","@storybook/react":"^8.6.15","@storybook/react-vite":"^8.6.15","@testing-library/dom":"^10.4.1","@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.5.2","@types/luxon":"^3.7.2","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@types/styled-system":"^5.1.25","@typescript-eslint/eslint-plugin":"^8.26.1","@typescript-eslint/parser":"^8.26.1","@vitest/browser":"4.1.6","@vitest/browser-playwright":"4.1.6","@vitest/ui":"4.1.6",eslint:"^8.57.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-alias":"^1.1.2","eslint-plugin-playwright":"^2.2.2","eslint-plugin-react":"^7.37.4","eslint-plugin-vitest":"^0.5.4","fetch-mock":"^12.6.0",glob:"^11.0.1",husky:"^9.1.7","lint-staged":"^16.4.0","node-fetch":"^2.7.0",nx:"19.8.14","nx-remotecache-azure":"^19.0.0","os-browserify":"^0.3.0",prettier:"^3.8.3","rollup-plugin-esbuild":"^6.2.1","start-server-and-test":"^2.0.11",storybook:"^8.6.15",typescript:"^5.8.2",vite:"^7.3.2","vite-plugin-node-polyfills":"^0.26.0",vitest:"^4.1.8"},d="yarn@4.13.0",y={node:"24.x"},u={},g={name:t,version:e,private:!0,license:s,type:r,main:o,workspaces:i,scripts:l,"lint-staged":{"*.{js,ts,tsx}":["eslint --fix","prettier --write"],"*":["prettier --write --ignore-unknown"],"src/i18n/**/*.json":["node utils/sort-json.ts","prettier --write"]},browserslist:a,resolutions:n,dependencies:p,devDependencies:c,packageManager:d,engines:y,nx:u};export{a as browserslist,g as default,p as dependencies,c as devDependencies,y as engines,s as license,o as main,t as name,u as nx,d as packageManager,n as resolutions,l as scripts,r as type,e as version,i as workspaces};
1
+ var a="3.3.925",e={version:a};export{e as default,a as version};
@@ -1 +1 @@
1
- import*as e from"ramda";import{SecurityLaneType as t}from"./wayfinder.js";const i=t=>i=>e.find(e=>e.dst===t,i.edges),r=(r,s,a,n={})=>{const o=[],u=[];let c=!1,l=!1;const d=((e,t,i,r)=>{if(!t||!i)throw Error("bad calculate Route request!");return e.findShortestPath(t,i,r)})(r,s,a,n);if(null===d)return null;let y=null;for(let r=0;r<d.length;r++){const s={distance:0,eta:0};if(y){const e=i(d[r].id)(y);null!=e&&(s.distance=e.distance,s.eta=e.transitTime,"Ground"!==e.type&&(s.portalType=e.type,s.isPortal=!0),e.o&&(s.poiId=e.o),e.path&&(s.curvedPathForward=e.path),e.securityWaitTimes&&(s.securityWaitTimes=e.securityWaitTimes,s.eta=s.securityWaitTimes.queueTime),e.securityLane&&(s.securityLane=e.securityLane,s.isSecurityCheckpoint=!0,e.securityLane.type===t.SECURITY&&(c=!0),e.securityLane.type===t.IMMIGRATION&&(l=!0),e.o&&u.push(e.o)))}s.levelDifference=y?d[r].ordinal-y.ordinal:0,s.position=e.omit(["edges","id"],{...d[r]}),o.push(s),y=d[r]}return e.last(o).isDestination=!0,{waypoints:o,queues:u,hasSecurity:c,hasImmigration:l}};export{r as findRoute};
1
+ import*as t from"ramda";import{SecurityLaneType as e}from"./wayfinder.js";const i=e=>i=>t.find(t=>t.dst===e,i.edges),r=(r,s,a,n={})=>{const o=[],u=[];let c=!1,l=!1;const d=((t,e,i,r)=>{if(!e||!i)throw Error("bad calculate Route request!");return t.findShortestPath(e,i,r)})(r,s,a,n);if(null===d)return null;let y=null;for(let r=0;r<d.length;r++){const s={distance:0,eta:0};if(y){const t=i(d[r].id)(y);null!=t&&(s.distance=t.distance,s.eta=t.transitTime,"Ground"!==t.type&&(s.portalType=t.type,s.isPortal=!0),t.o&&(s.poiId=t.o),t.path&&(s.curvedPathForward=t.path),t.securityWaitTimes&&(s.securityWaitTimes=t.securityWaitTimes,s.eta=s.securityWaitTimes.queueTime),t.securityLane&&(s.securityLane=t.securityLane,s.isSecurityCheckpoint=!0,t.securityLane.type===e.SECURITY&&(c=!0),t.securityLane.type===e.IMMIGRATION&&(l=!0),t.o&&u.push(t.o)))}s.levelDifference=y?d[r].ordinal-y.ordinal:0,s.position=t.omit(["edges","id"],{...d[r]}),o.push(s),y=d[r]}const p=t.last(o);return p&&(p.isDestination=!0),{waypoints:o,queues:u,hasSecurity:c,hasImmigration:l}};export{r as findRoute};
@@ -1 +1 @@
1
- class h{constructor(){this.heap=[null],this.heapMap={}}offerWithPriority(h,i){const t=this.heap.push([h,i])-1;this.heapMap[h]=t,this.bubble(t)}raisePriority(h,i){const t=this.heapMap[h];this.heap[t][1]=i,this.bubble(t)}poll(){if(1===this.heap.length)return null;if(2===this.heap.length){const h=this.heap.pop()[0];return delete this.heapMap[h],h}const h=this.heap[1][0];return delete this.heapMap[h],this.heap[1]=this.heap.pop(),this.heapMap[this.heap[1][0]]=1,this.sink(1),h}isEmpty(){return 1===this.heap.length}bubble(h){for(;h>1;){const i=h>>1;if(!this.isHigherPriority(h,i))break;this.swap(h,i),h=i}}sink(h){for(;2*h<this.heap.length;){const i=void 0!==this.heap[2*h+1]&&this.isHigherPriority(2*h+1,2*h)?2*h+1:2*h;if(this.isHigherPriority(h,i))break;this.swap(h,i),h=i}}swap(h,i){this.heapMap[this.heap[h][0]]=i,this.heapMap[this.heap[i][0]]=h;const t=this.heap[h];this.heap[h]=this.heap[i],this.heap[i]=t}isHigherPriority(h,i){return this.heap[h][1]<this.heap[i][1]}}export{h as default};
1
+ class h{heap;heapMap;constructor(){this.heap=[null],this.heapMap={}}offerWithPriority(h,i){const t=this.heap.push([h,i])-1;this.heapMap[h]=t,this.bubble(t)}raisePriority(h,i){const t=this.heapMap[h],s=this.heap[t];s&&(s[1]=i,this.bubble(t))}poll(){if(1===this.heap.length)return null;if(2===this.heap.length){const h=this.heap.pop()?.[0];return void 0===h?null:(delete this.heapMap[h],h)}const h=this.heap[1]?.[0];return void 0===h?null:(delete this.heapMap[h],this.heap[1]=this.heap.pop()??null,this.heap[1]&&(this.heapMap[this.heap[1][0]]=1),this.sink(1),h)}isEmpty(){return 1===this.heap.length}bubble(h){for(;h>1;){const i=h>>1;if(!this.isHigherPriority(h,i))break;this.swap(h,i),h=i}}sink(h){for(;2*h<this.heap.length;){const i=void 0!==this.heap[2*h+1]&&this.isHigherPriority(2*h+1,2*h)?2*h+1:2*h;if(this.isHigherPriority(h,i))break;this.swap(h,i),h=i}}swap(h,i){const t=this.heap[h],s=this.heap[i];if(!t||!s)return;this.heapMap[t[0]]=i,this.heapMap[s[0]]=h;const e=this.heap[h];this.heap[h]=this.heap[i],this.heap[i]=e}isHigherPriority(h,i){const t=this.heap[h],s=this.heap[i];return!!t&&!!s&&t[1]<s[1]}}export{h as default};
@@ -1 +1 @@
1
- import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{distance as i}from"../../../src/utils/geodesy.js";import{encode as s,calculateAdjacent as l}from"../../../src/extModules/geohasher.js";import u from"./minPriorityQueue.js";function d(r,i,l,u){const d={},c={},a=new Set;let h={};r.nodes.forEach(o=>{const n=i(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+s(t.lat,t.lng).substr(0,7),n=t.floorId+":"+s(t.lat,t.lng).substr(0,8);c[o]||(c[o]=[]);c[o].push(t),c[n]||(c[n]=[]);c[n].push(t),d[t.id]=t}({...t(["id","lat","lng","floorId"],o),edges:[],ordinal:n,structureId:e})}),r.edges.forEach(t=>d[t.s].edges.push(function(t,n){const e=function(t){if(t.x)return"Security Checkpoint";if(""===t.t)return"Ground";return t.t}(t),r=e.toLowerCase(),i="escalator"!==r&&"stairs"!==r,s=f(t.s,t.d,n),l=t.l||s/60,u=t=>t.map(t=>({start:{lat:t.s[0],lng:t.s[1]},out:{lat:t.o[0],lng:t.o[1]},in:{lat:t.i[0],lng:t.i[1]},end:{lat:t.e[0],lng:t.e[1]}})),d=t.p?u(t.p):null;return{distance:s,dst:t.d,o:t.o,isAccessible:i,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:l,type:e,path:d,weight:l}}(t,d)));const p=t=>{if(void 0===t.floorId&&void 0===t.ordinal)throw Error("Endpoint specified in findRoute without floorId nor an ordinal");const o=t.lat||t.latitude,n=t.lng||t.longitude;return t.floorId?w(t.floorId,o,n,c,d):T(t.ordinal,o,n,d)};return{_nodes:d,_geoDb:c,_nodesToAvoid:a,addNodesToAvoid:t=>function(t){a.clear(),t.forEach(t=>a.add(t))}(t),findClosestNode:(t,o,n)=>w(t,o,n,c,d),findShortestPath:(t,o,n)=>function(t,o,n,e={}){return I(p(t),p(o),n,a,h,u,e)}(t,o,d,n),findAllShortestPaths:function(t,o,n){const e=p(t),r=o.map(t=>p(t));return e&&r.length?function(t,o,n,e,r={},i={},s={}){return o.map(o=>{try{return I(t,o,n,e,r,i,s)}catch{return null}})}(e,r,d,a,h,u,n):[]},floorIdToOrdinal:i,floorIdToStructureId:l,updateWithSecurityWaitTime:function(t){h=n(e(["lastUpdated"]),t),y()},clearCache:y}}function f(t,o,n){const e=n[t],r=n[o];return i(e.lat,e.lng,r.lat,r.lng)}let c,a,h,p,g,m;const y=()=>{c={},a={},h={},p=new u,g=null,m={}};function I(t,o,n,e,i={},s={},l={}){for(t.id===g&&m===JSON.stringify(l)||(y(),p.offerWithPriority(t.id,0),c[t.id]=0,h[t.id]=!0,g=t.id,m=JSON.stringify(l));!p.isEmpty()&&!h[o.id];){const t=n[p.poll()],o=c[t.id];for(let n=0;n<t.edges.length;n++){const u=t.edges[n];if(e.size>0&&e.has(u.dst))continue;if(h[u.dst])continue;if(l.requiresAccessibility&&!u.isAccessible)continue;let d=u.weight;if(u.o&&i[u.o]){const t=i[u.o];t.queueTime&&(d=t.queueTime),t.isTemporarilyClosed&&(d=9999),u.securityWaitTimes=t}if(u.o&&s[u.o]){u.securityLane=s[u.o];const{type:t,id:o}=s[u.o],n=r(["selectedSecurityLanes",t],l);if(n&&!n.includes(o))continue}void 0===c[u.dst]?(a[u.dst]=t,c[u.dst]=o+d,p.offerWithPriority(u.dst,o+d)):c[u.dst]>o+d&&(c[u.dst]=o+d,a[u.dst]=t,p.raisePriority(u.dst,o+d))}h[t.id]=!0}if(!h[o.id])return null;const u=[];let d=o;for(;d;)u.push(d),d=a[d.id];return u.reverse()}function b(t,o,n,e){const r=o.substr(0,e),i=[];i.push(t+":"+l(l(r,"top"),"left")),i.push(t+":"+l(r,"top")),i.push(t+":"+l(l(r,"top"),"right")),i.push(t+":"+l(r,"left")),i.push(t+":"+r),i.push(t+":"+l(r,"right")),i.push(t+":"+l(l(r,"bottom"),"left")),i.push(t+":"+l(r,"bottom")),i.push(t+":"+l(l(r,"bottom"),"right"));const s=[];for(let t=0;t<i.length;t++){const o=n[i[t]];if(o)for(let t=0;t<o.length;t++)s.push(o[t])}return s}function w(t,o,n,e,r){const l=function(t,o,n){let e=b(t,o,n,8);return e.length>0?e:(e=b(t,o,n,7),e.length>0?e:null)}(t,s(o,n),e)||function(t,o,n,e){const r=Object.values(e).filter(o=>o.floorId===t).map(t=>[t,i(t.lat,t.lng,o,n)]);if(!r.length)throw Error(`findClosestNodeByFloor2 found no nodes on floor ${t}`);return v(r)}(t,o,n,r),u=[];for(let t=0;t<l.length;t++){const e=i(o,n,l[t].lat,l[t].lng);u.push([l[t],e])}u.sort(function(t,o){return t[1]-o[1]});const d=[];for(let t=0;t<u.length;t++)d.push(u[t][0]);return d[0]}function T(t,o,n,e){const r=Object.values(e).filter(o=>o.ordinal===t).map(t=>[t,i(t.lat,t.lng,o,n)]);if(!r.length)throw Error(`findClosestNodeByOrdinal found no nodes on ordinal ${t}`);return v(r)}function v(t){let o=t[0];for(let n=1;n<t.length;n++)t[n][1]<o[1]&&(o=t[n]);return o[0]}export{d as createNavGraph,T as findClosestNodeByOrdinal,I as findShortestPath};
1
+ import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{distance as i}from"../../../src/utils/geodesy.js";import{encode as s,calculateAdjacent as l}from"../../../src/extModules/geohasher.js";import u from"./minPriorityQueue.js";function d(r,i,l,u){const d={},f={},a=new Set;let h={};r.nodes.forEach(o=>{const n=i(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+s(t.lat,t.lng).substr(0,7),n=t.floorId+":"+s(t.lat,t.lng).substr(0,8);f[o]||(f[o]=[]);f[o].push(t),f[n]||(f[n]=[]);f[n].push(t),d[t.id]=t}({...t(["id","lat","lng","floorId"],o),edges:[],ordinal:n,structureId:e})}),r.edges.forEach(t=>d[t.s].edges.push(function(t,n){const e=function(t){if(t.x)return"Security Checkpoint";if(""===t.t)return"Ground";return t.t}(t),r=e.toLowerCase(),i="escalator"!==r&&"stairs"!==r,s=c(t.s,t.d,n),l=t.l||s/60,u=t=>t.map(t=>({start:{lat:t.s[0],lng:t.s[1]},out:{lat:t.o[0],lng:t.o[1]},in:{lat:t.i[0],lng:t.i[1]},end:{lat:t.e[0],lng:t.e[1]}})),d=t.p?u(t.p):null;return{distance:s,dst:t.d,o:t.o,isAccessible:i,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:l,type:e,path:d,weight:l}}(t,d)));const p=t=>{if(void 0===t.floorId&&void 0===t.ordinal)throw Error("Endpoint specified in findRoute without floorId nor an ordinal");const o=t.lat||t.latitude,n=t.lng||t.longitude;return t.floorId?w(t.floorId,o,n,f,d):v(t.ordinal,o,n,d)};return{_nodes:d,_geoDb:f,_nodesToAvoid:a,addNodesToAvoid:t=>function(t){a.clear(),t.forEach(t=>a.add(t))}(t),findClosestNode:(t,o,n)=>w(t,o,n,f,d),findShortestPath:(t,o,n)=>function(t,o,n,e={}){return I(p(t),p(o),n,a,h,u,e)}(t,o,d,n),findAllShortestPaths:function(t,o,n){const e=p(t),r=o.map(t=>p(t));return e&&r.length?function(t,o,n,e,r={},i={},s={}){return o.map(o=>{try{return I(t,o,n,e,r,i,s)}catch{return null}})}(e,r,d,a,h,u,n):[]},floorIdToOrdinal:i,floorIdToStructureId:l,updateWithSecurityWaitTime:function(t){h=n(e(["lastUpdated"]),t),y()},clearCache:y}}function c(t,o,n){const e=n[t],r=n[o];return i(e.lat,e.lng,r.lat,r.lng)}let f,a,h,p,g,m;const y=()=>{f={},a={},h={},p=new u,g=null,m={}};function I(t,o,n,e,i={},s={},l={}){for(t.id===g&&m===JSON.stringify(l)||(y(),p.offerWithPriority(t.id,0),f[t.id]=0,h[t.id]=!0,g=t.id,m=JSON.stringify(l));!p.isEmpty()&&!h[o.id];){const t=p.poll();if(null==t)break;const o=n[t],u=f[o.id];for(let t=0;t<o.edges.length;t++){const n=o.edges[t];if(e.size>0&&e.has(n.dst))continue;if(h[n.dst])continue;if(l.requiresAccessibility&&!n.isAccessible)continue;let d=n.weight;if(n.o&&i[n.o]){const t=i[n.o];t.queueTime&&(d=t.queueTime),t.isTemporarilyClosed&&(d=9999),n.securityWaitTimes=t}const c=s;if(n.o&&c[n.o]){n.securityLane=c[n.o];const{type:t,id:o}=c[n.o],e=r(["selectedSecurityLanes",t],l);if(e&&!e.includes(o))continue}void 0===f[n.dst]?(a[n.dst]=o,f[n.dst]=u+d,p.offerWithPriority(n.dst,u+d)):f[n.dst]>u+d&&(f[n.dst]=u+d,a[n.dst]=o,p.raisePriority(n.dst,u+d))}h[o.id]=!0}if(!h[o.id])return null;const u=[];let d=o;for(;d;)u.push(d),d=a[d.id];return u.reverse()}function b(t,o,n,e){const r=o.substr(0,e),i=[];i.push(t+":"+l(l(r,"top"),"left")),i.push(t+":"+l(r,"top")),i.push(t+":"+l(l(r,"top"),"right")),i.push(t+":"+l(r,"left")),i.push(t+":"+r),i.push(t+":"+l(r,"right")),i.push(t+":"+l(l(r,"bottom"),"left")),i.push(t+":"+l(r,"bottom")),i.push(t+":"+l(l(r,"bottom"),"right"));const s=[];for(let t=0;t<i.length;t++){const o=n[i[t]];if(o)for(let t=0;t<o.length;t++)s.push(o[t])}return s}function w(t,o,n,e,r){const l=function(t,o,n){let e=b(t,o,n,8);return e.length>0?e:(e=b(t,o,n,7),e.length>0?e:null)}(t,s(o,n),e),u=l??[T(t,o,n,r)],d=[];for(let t=0;t<u.length;t++){const e=i(o,n,u[t].lat,u[t].lng);d.push([u[t],e])}d.sort(function(t,o){return t[1]-o[1]});const c=[];for(let t=0;t<d.length;t++){const o=d[t];o&&c.push(o[0])}return c[0]}function T(t,o,n,e){const r=Object.values(e).filter(o=>o.floorId===t).map(t=>[t,i(t.lat,t.lng,o,n)]);if(!r.length)throw Error(`findClosestNodeByFloor2 found no nodes on floor ${t}`);return S(r)}function v(t,o,n,e){const r=Object.values(e).filter(o=>o.ordinal===t).map(t=>[t,i(t.lat,t.lng,o,n)]);if(!r.length)throw Error(`findClosestNodeByOrdinal found no nodes on ordinal ${t}`);return S(r)}function S(t){let o=t[0];for(let n=1;n<t.length;n++){const e=t[n];e&&e[1]<o[1]&&(o=e)}return o[0]}export{d as createNavGraph,v as findClosestNodeByOrdinal,I as findShortestPath};
@@ -1 +1 @@
1
- import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import o from"./segmentCategories.js";import a from"./stepBuilder.js";const n=e.map(e.converge(e.assoc("coordinates"),[e=>e.waypoints.flatMap((e,o)=>o>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap(e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat)).map(e=>[e.x,e.y]):[[e.position.lng,e.position.lat]]),e.identity])),r=t=>{const a=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",a.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach(e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),a.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)}),n.waypoints=s,0===s.length&&(n.waypoints=[r]),a.push(n),(e=>{e.forEach((t,a)=>{0===a?t.segmentCategory=o.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=o.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=o.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=o.BUS:"Train"===t.type?t.segmentCategory=o.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=o.STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.STAIRS_DOWN:t.segmentCategory=o.STAIRS:"AccessibleStairs"===t.type?t.levelDifference>0?t.segmentCategory=o.ACCESSIBLE_STAIRS_UP:t.levelDifference<0?t.segmentCategory=o.ACCESSIBLE_STAIRS_DOWN:t.segmentCategory=o.ACCESSIBLE_STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=o.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=o.ELEVATOR_DOWN:t.segmentCategory=o.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=o.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=o.ESCALATOR_DOWN:t.segmentCategory=o.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=o.RAMP_UP:t.levelDifference<0?t.segmentCategory=o.RAMP_DOWN:t.segmentCategory=o.RAMP:"Security Checkpoint"===e[a+1].type?t.segmentCategory=o.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[a+1].type&&(t.segmentCategory=o.WALKING_TO_PORTAL)})})(a),((e,t)=>{if(1===e.length){const a={segmentCategory:void 0,waypoints:[]};a.segmentCategory=o.WALKING_TO_END,a.type="Walk",a.waypoints=[t],e.push(a)}})(a,r),(t=>{t.forEach((o,a)=>{if(a>1&&0===e.head(o.waypoints).levelDifference){const n=e.last(t[a-1].waypoints);o.waypoints=e.prepend(n,o.waypoints)}})})(a),a},s=(t,s,i,l,p,g,y,c,C)=>{let m=r(t);m=n(m),s&&m[0].coordinates.unshift([s.lng,s.lat]),i&&e.last(m).coordinates.push([i.lng,i.lat]);return{segments:m.map((t,a)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e.prop("isPortal"))),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},l=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=m[a+1];l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=l,i.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),t.poiId&&(i.poiId=t.poiId),i}),steps:a(m,e.prop("title",s),e.prop("title",i),l,p,g,y,c,C)}};export{s as buildSegments};
1
+ import*as e from"ramda";import{bezierCurveTo as t}from"../../../src/utils/geom.js";import a from"./segmentCategories.js";import o from"./stepBuilder.js";const n=e=>e.waypoints.flatMap((e,a)=>a>0&&e.curvedPathForward&&e.curvedPathForward.length>0?e.curvedPathForward.flatMap(e=>t(e.start.lng,e.start.lat,e.in.lng,e.in.lat,e.out.lng,e.out.lat,e.end.lng,e.end.lat)).map(e=>[e.x,e.y]):[[e.position.lng,e.position.lat]]),r=t=>{const o=[];let n={segmentCategory:void 0,waypoints:[]},r=null,s=[];return n.waypoints=[t[0]],n.type=t[0].isPortal?t[0].portalType:"Walk",o.push(n),n={segmentCategory:void 0,waypoints:[]},t.forEach(e=>{s.push(e),r?(r.isPortal===e.isPortal&&r.isSecurityCheckpoint===e.isSecurityCheckpoint||(n.waypoints=s,e.isPortal||r.isPortal?(s.length>1&&s.pop(),s=!e.isPortal||"train"!==e.portalType.toLowerCase()&&"bus"!==e.portalType.toLowerCase()?[e]:[s[s.length-1],e]):s=[],r.poiId&&(n.poiId=r.poiId),o.push(n),n={segmentCategory:void 0,waypoints:[]},n.type=e.isPortal?e.portalType:"Walk"),n.levelDifference=e.levelDifference,r=e):(n.type=e.isPortal?e.portalType:"Walk",r=e)}),n.waypoints=s,0===s.length&&r&&(n.waypoints=[r]),o.push(n),(e=>{e.forEach((t,o)=>{0===o?t.segmentCategory=a.START:t.waypoints[t.waypoints.length-1].isDestination?t.segmentCategory=a.WALKING_TO_END:"Security Checkpoint"===t.type?t.segmentCategory=a.SECURITY_CHECKPOINT:"Bus"===t.type?t.segmentCategory=a.BUS:"Train"===t.type?t.segmentCategory=a.TRAIN:"Stairs"===t.type?t.levelDifference>0?t.segmentCategory=a.STAIRS_UP:t.levelDifference<0?t.segmentCategory=a.STAIRS_DOWN:t.segmentCategory=a.STAIRS:"AccessibleStairs"===t.type?t.levelDifference>0?t.segmentCategory=a.ACCESSIBLE_STAIRS_UP:t.levelDifference<0?t.segmentCategory=a.ACCESSIBLE_STAIRS_DOWN:t.segmentCategory=a.ACCESSIBLE_STAIRS:"Elevator"===t.type?t.levelDifference>0?t.segmentCategory=a.ELEVATOR_UP:t.levelDifference<0?t.segmentCategory=a.ELEVATOR_DOWN:t.segmentCategory=a.ELEVATOR:"Escalator"===t.type?t.levelDifference>0?t.segmentCategory=a.ESCALATOR_UP:t.levelDifference<0?t.segmentCategory=a.ESCALATOR_DOWN:t.segmentCategory=a.ESCALATOR:"Ramp"===t.type?t.levelDifference>0?t.segmentCategory=a.RAMP_UP:t.levelDifference<0?t.segmentCategory=a.RAMP_DOWN:t.segmentCategory=a.RAMP:"Security Checkpoint"===e[o+1].type?t.segmentCategory=a.WALKING_TO_SECURITY_CHECKPOINT:"Walk"!==e[o+1].type&&(t.segmentCategory=a.WALKING_TO_PORTAL)})})(o),((e,t)=>{if(1===e.length&&t){const o={segmentCategory:void 0,waypoints:[]};o.segmentCategory=a.WALKING_TO_END,o.type="Walk",o.waypoints=[t],e.push(o)}})(o,r),(t=>{t.forEach((a,o)=>{if(o>1){const n=e.head(a.waypoints);if(0===n?.levelDifference){const n=e.last(t[o-1].waypoints);a.waypoints=e.prepend(n,a.waypoints)}}})})(o),o},s=(t,s,i,l,p,g,y,c,C)=>{let m=r(t);m=(e=>e.map(e=>({...e,coordinates:n(e)})))(m),s&&m[0]?.coordinates.unshift([s.lng,s.lat]),i&&e.last(m)?.coordinates.push([i.lng,i.lat]);return{segments:m.map((t,o)=>{const n=e.last(t.waypoints),r=t.coordinates,s=!(t.levelDifference&&t.waypoints.every(e=>e.isPortal)),i={levelId:n.position.structureId,ordinalId:`ordinal: ${n.position.ordinal}`,coordinates:r,shouldDrawSegment:s},l=[];if(a.WALKING_TO_PORTAL===t.segmentCategory){const t=m[o+1];l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else a.START!==t.segmentCategory&&l.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=l,i.segmentType=(e=>"Train"===e.type?"nav.train":"Bus"===e.type?"nav.transit":"Security Checkpoint"===e.type?"nav.secure":"nav.primary")(t),t.poiId&&(i.poiId=t.poiId),i}),steps:o(m,e.prop("title",s),e.prop("title",i),l,p,g,y,c,C)}};export{s as buildSegments};
@@ -1 +1 @@
1
- import{bearing as e}from"@turf/bearing";import{point as t}from"@turf/helpers";import{compose as r,not as n,includes as a,__ as s,toLower as i,prop as o,find as c,drop as u,last as T,propEq as A}from"ramda";import{findBoundsOfWaypoints as S}from"../../../src/utils/bounds.js";import{metersToYards as _}from"../../../src/utils/distance.js";import{bearingToDirection as R,distance as E}from"../../../src/utils/geodesy.js";import d from"./segmentBadges.js";import I from"./segmentCategories.js";function O(r,n="",a="",s,i,c={},u,T=[],A){return r.map((u,E)=>{const O=m("securityWaitTimes")(u.waypoints),p=O&&!O.isTemporarilyClosed?O.queueTime:Math.round(function(e){if(1===e.length)return e[0].eta;return e.map(o("eta")).slice(1).reduce((e,t)=>e+t,0)}(u.waypoints)),C=Math.round(function(e){if(1===e.length)return e[0].distance;return e.map(e=>e.distance).slice(1).reduce((e,t)=>e+t,0)}(u.waypoints)),P="yards"===A?_(C):C,W=function(e){switch(e){case I.START:return d.START;case I.WALKING_TO_END:return d.END;case I.ELEVATOR:return d.ELEVATOR;case I.ELEVATOR_UP:return d.ELEVATOR_UP;case I.ELEVATOR_DOWN:return d.ELEVATOR_DOWN;case I.STAIRS:return d.STAIRS;case I.STAIRS_UP:return d.STAIRS_UP;case I.STAIRS_DOWN:return d.STAIRS_DOWN;case I.ACCESSIBLE_STAIRS:return d.ACCESSIBLE_STAIRS;case I.ACCESSIBLE_STAIRS_UP:return d.ACCESSIBLE_STAIRS_UP;case I.ACCESSIBLE_STAIRS_DOWN:return d.ACCESSIBLE_STAIRS_DOWN;case I.ESCALATOR:return d.ESCALATOR;case I.ESCALATOR_UP:return d.ESCALATOR_UP;case I.ESCALATOR_DOWN:return d.ESCALATOR_DOWN;case I.WALKING_TO_PORTAL:case I.WALK:case I.WALK_DOWN:case I.WALK_UP:return d.WALK;case I.TRAIN:return d.TRAIN;case I.TRAIN_UP:return d.TRAIN_UP;case I.TRAIN_DOWN:return d.TRAIN_DOWN;case I.BUS:return d.BUS;case I.BUS_UP:return d.BUS_UP;case I.BUS_DOWN:return d.BUS_DOWN;case I.SECURITY_CHECKPOINT:return d.SECURITY_CHECKPOINT;case I.RAMP:return d.RAMP;case I.RAMP_UP:return d.RAMP_UP;case I.RAMP_DOWN:return d.RAMP_DOWN;default:return d.WALK}}(u.segmentCategory),U=function(e,t){let r;switch(e){case I.START:r=0;break;case I.WALKING_TO_END:r=t.length-1;break;case I.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(u.segmentCategory,u.waypoints),D=(({waypoints:r},n)=>{const[a]=r,s=r[r.length-1],i=t([a.position.lng,a.position.lat]),o=t([s.position.lng,s.position.lat]),c=e(i,o);return R(c,n)})(u,i),g=function(e,t,r,n,a,s,i,o){const c=e[t];switch(c.segmentCategory){case I.START:return l(c.waypoints[0].position,r);case I.WALKING_TO_END:return l(c.waypoints[c.waypoints.length-1].position,n);case I.WALKING_TO_SECURITY_CHECKPOINT:{const r=e[t+1].waypoints,n=N(o,r),a=n?s("wayfinder:Security Lane",{laneName:n}):null,u=w(r,i);return a||u||s(`wayfinder:${c.type}`)}case I.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case I.SECURITY_CHECKPOINT:{const e=N(o,c.waypoints),t=e?s("wayfinder:Security Lane",{laneName:e}):null,r=w(c.waypoints,i);return t||r||y(c,a)}case I.ELEVATOR:case I.ELEVATOR_DOWN:case I.ELEVATOR_UP:case I.ESCALATOR:case I.ESCALATOR_DOWN:case I.ESCALATOR_UP:case I.STAIRS:case I.STAIRS_DOWN:case I.STAIRS_UP:case I.ACCESSIBLE_STAIRS:case I.ACCESSIBLE_STAIRS_DOWN:case I.ACCESSIBLE_STAIRS_UP:return y(c,a);default:return s(`wayfinder:${c.type}`)}}(r,E,n,a,s,i,T,c),K={primaryText:g,secondaryText:L(u,p,i,!1),secondaryTextUI:L(u,p,i,!0,D,A,P),icon:W,animationAnchor:U,eta:p,distance:C,bounds:S(u.waypoints),isAccessible:f(u),securityWaitTimes:O};return u.poiId&&(K.poiId=u.poiId),K})}function l(e,t){return e.name?e.name:t}function y(e,t){return t[T(e.waypoints).position.floorId]}function L(e,t,r,n,a,s,i){const o=C(t,r),c="Proceed";switch(e.segmentCategory){case I.START:return r("wayfinder:Begin route at");case I.ELEVATOR:return r("wayfinder:Take elevator to");case I.ELEVATOR_UP:return r("wayfinder:Take elevator up to");case I.ELEVATOR_DOWN:return r("wayfinder:Take elevator down to");case I.STAIRS:return r("wayfinder:Take stairs to");case I.STAIRS_UP:return r("wayfinder:Take stairs up to");case I.STAIRS_DOWN:return r("wayfinder:Take stairs down to");case I.ACCESSIBLE_STAIRS:return r("wayfinder:Take accessible stairs to");case I.ACCESSIBLE_STAIRS_UP:return r("wayfinder:Take accessible stairs up to");case I.ACCESSIBLE_STAIRS_DOWN:return r("wayfinder:Take accessible stairs down to");case I.ESCALATOR:return r("wayfinder:Take escalator to");case I.ESCALATOR_UP:return r("wayfinder:Take escalator up to");case I.ESCALATOR_DOWN:return r("wayfinder:Take escalator down to");case I.WALK:case I.WALKING_TO_SECURITY_CHECKPOINT:case I.WALKING_TO_PORTAL:case I.WALKING_TO_END:return n?p(i,s,a,r):o(`${c} <1 minute to`,`${c} xx minute to`);case I.WALK_DOWN:return o(`${c} <1 minute down to`,`${c} xx minute down to`);case I.WALK_UP:return o(`${c} <1 minute up to`,`${c} xx minute up to`);case I.TRAIN:return o("Take train <1 minute","Take train xx minute");case I.BUS:return o("Take bus <1 minute","Take bus xx minute");case I.SECURITY_CHECKPOINT:return r("wayfinder:Through");case I.RAMP:return r("wayfinder:Take ramp to");case I.RAMP_UP:return r("wayfinder:Take ramp up to");case I.RAMP_DOWN:return r("wayfinder:Take ramp down to");default:return""}}const p=(e,t,r,n)=>n("meters"===t?"wayfinder:Proceed __direction__ __count__ meter to":"wayfinder:Proceed __direction__ __count__ yard to",{direction:r,count:e}),C=(e,t)=>(r,n)=>0===e?t("wayfinder:"+r):t("wayfinder:"+n,{count:e}),f=r(n,a(s,["escalator","stairs"]),i,o("type")),N=(e,t)=>{const r=m("securityLane")(t);if(!r)return;const n=o(r.type,e),a=c(A(r.id,"id"),n);return o("displayText",a)},m=e=>r(o(e),c(o(e)),u(1)),w=(e,t)=>{if(!e||0===e.length)return null;const r=e[0],{lat:n,lng:a,floorId:s}=r.position,i=t.filter(e=>e.position&&e.position.floorId===s);let o=null,c=1/0;return i.forEach(e=>{const t=E(n,a,e.position.latitude,e.position.longitude);t<c&&(c=t,o=e)}),o?o.name:null};export{O as default};
1
+ import{bearing as e}from"@turf/bearing";import{point as t}from"@turf/helpers";import{compose as r,not as n,includes as a,__ as s,toLower as i,prop as o,last as c,find as u,propEq as T}from"ramda";import{findBoundsOfWaypoints as A}from"../../../src/utils/bounds.js";import{metersToYards as S}from"../../../src/utils/distance.js";import{bearingToDirection as _,distance as R}from"../../../src/utils/geodesy.js";import E from"./segmentBadges.js";import d from"./segmentCategories.js";function I(r,n="",a="",s,i,c={},u,T=[],R){return r.map((u,I)=>{const L=N("securityWaitTimes")(u.waypoints),f=L&&!L.isTemporarilyClosed?L.queueTime:Math.round(function(e){if(1===e.length)return e[0].eta;return e.map(o("eta")).slice(1).reduce((e,t)=>e+t,0)}(u.waypoints)),w=Math.round(function(e){if(1===e.length)return e[0].distance;return e.map(e=>e.distance).slice(1).reduce((e,t)=>e+t,0)}(u.waypoints)),P="yards"===R?S(w):w,W=function(e){switch(e){case d.START:return E.START;case d.WALKING_TO_END:return E.END;case d.ELEVATOR:return E.ELEVATOR;case d.ELEVATOR_UP:return E.ELEVATOR_UP;case d.ELEVATOR_DOWN:return E.ELEVATOR_DOWN;case d.STAIRS:return E.STAIRS;case d.STAIRS_UP:return E.STAIRS_UP;case d.STAIRS_DOWN:return E.STAIRS_DOWN;case d.ACCESSIBLE_STAIRS:return E.ACCESSIBLE_STAIRS;case d.ACCESSIBLE_STAIRS_UP:return E.ACCESSIBLE_STAIRS_UP;case d.ACCESSIBLE_STAIRS_DOWN:return E.ACCESSIBLE_STAIRS_DOWN;case d.ESCALATOR:return E.ESCALATOR;case d.ESCALATOR_UP:return E.ESCALATOR_UP;case d.ESCALATOR_DOWN:return E.ESCALATOR_DOWN;case d.WALKING_TO_PORTAL:case d.WALK:case d.WALK_DOWN:case d.WALK_UP:return E.WALK;case d.TRAIN:return E.TRAIN;case d.TRAIN_UP:return E.TRAIN_UP;case d.TRAIN_DOWN:return E.TRAIN_DOWN;case d.BUS:return E.BUS;case d.BUS_UP:return E.BUS_UP;case d.BUS_DOWN:return E.BUS_DOWN;case d.SECURITY_CHECKPOINT:return E.SECURITY_CHECKPOINT;case d.RAMP:return E.RAMP;case d.RAMP_UP:return E.RAMP_UP;case d.RAMP_DOWN:return E.RAMP_DOWN;default:return E.WALK}}(u.segmentCategory),U=function(e,t){let r;switch(e){case d.START:r=0;break;case d.WALKING_TO_END:r=t.length-1;break;case d.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(u.segmentCategory,u.waypoints),D=(({waypoints:r},n)=>{const[a]=r,s=r[r.length-1],i=t([a.position.lng,a.position.lat]),o=t([s.position.lng,s.position.lat]),c=e(i,o);return _(c,n)})(u,i),g=function(e,t,r,n,a,s,i,o){const c=e[t];switch(c.segmentCategory){case d.START:return O(c.waypoints[0].position,r);case d.WALKING_TO_END:return O(c.waypoints[c.waypoints.length-1].position,n);case d.WALKING_TO_SECURITY_CHECKPOINT:{const r=e[t+1].waypoints,n=C(o,r),a=n?s("wayfinder:Security Lane",{laneName:n}):null,u=m(r,i);return a||u||s(`wayfinder:${c.type}`)}case d.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case d.SECURITY_CHECKPOINT:{const e=C(o,c.waypoints),t=e?s("wayfinder:Security Lane",{laneName:e}):null,r=m(c.waypoints,i);return t||r||l(c,a)}case d.ELEVATOR:case d.ELEVATOR_DOWN:case d.ELEVATOR_UP:case d.ESCALATOR:case d.ESCALATOR_DOWN:case d.ESCALATOR_UP:case d.STAIRS:case d.STAIRS_DOWN:case d.STAIRS_UP:case d.ACCESSIBLE_STAIRS:case d.ACCESSIBLE_STAIRS_DOWN:case d.ACCESSIBLE_STAIRS_UP:return l(c,a);default:return s(`wayfinder:${c.type}`)}}(r,I,n,a,s,i,T,c),K={primaryText:g,secondaryText:y(u,f,i,!1),secondaryTextUI:y(u,f,i,!0,D,R,P),icon:W,animationAnchor:U,eta:f,distance:w,bounds:A(u.waypoints),isAccessible:p(u),securityWaitTimes:L};return u.poiId&&(K.poiId=u.poiId),K})}function O(e,t){return e.name?e.name:t}function l(e,t){return t[c(e.waypoints).position.floorId]}function y(e,t,r,n,a,s,i){const o=f(t,r),c="Proceed";switch(e.segmentCategory){case d.START:return r("wayfinder:Begin route at");case d.ELEVATOR:return r("wayfinder:Take elevator to");case d.ELEVATOR_UP:return r("wayfinder:Take elevator up to");case d.ELEVATOR_DOWN:return r("wayfinder:Take elevator down to");case d.STAIRS:return r("wayfinder:Take stairs to");case d.STAIRS_UP:return r("wayfinder:Take stairs up to");case d.STAIRS_DOWN:return r("wayfinder:Take stairs down to");case d.ACCESSIBLE_STAIRS:return r("wayfinder:Take accessible stairs to");case d.ACCESSIBLE_STAIRS_UP:return r("wayfinder:Take accessible stairs up to");case d.ACCESSIBLE_STAIRS_DOWN:return r("wayfinder:Take accessible stairs down to");case d.ESCALATOR:return r("wayfinder:Take escalator to");case d.ESCALATOR_UP:return r("wayfinder:Take escalator up to");case d.ESCALATOR_DOWN:return r("wayfinder:Take escalator down to");case d.WALK:case d.WALKING_TO_SECURITY_CHECKPOINT:case d.WALKING_TO_PORTAL:case d.WALKING_TO_END:return n?L(i,s,a,r):o(`${c} <1 minute to`,`${c} xx minute to`);case d.WALK_DOWN:return o(`${c} <1 minute down to`,`${c} xx minute down to`);case d.WALK_UP:return o(`${c} <1 minute up to`,`${c} xx minute up to`);case d.TRAIN:return o("Take train <1 minute","Take train xx minute");case d.BUS:return o("Take bus <1 minute","Take bus xx minute");case d.SECURITY_CHECKPOINT:return r("wayfinder:Through");case d.RAMP:return r("wayfinder:Take ramp to");case d.RAMP_UP:return r("wayfinder:Take ramp up to");case d.RAMP_DOWN:return r("wayfinder:Take ramp down to");default:return""}}const L=(e,t,r,n)=>n("meters"===t?"wayfinder:Proceed __direction__ __count__ meter to":"wayfinder:Proceed __direction__ __count__ yard to",{direction:r,count:e}),f=(e,t)=>(r,n)=>0===e?t("wayfinder:"+r):t("wayfinder:"+n,{count:e}),p=r(n,a(s,["escalator","stairs"]),i,o("type")),C=(e,t)=>{const r=N("securityLane")(t);if(!r)return;const n=o(r.type,e),a=u(T(r.id,"id"),n);return a?.displayText},N=e=>t=>t.slice(1).find(t=>t[e])?.[e],m=(e,t)=>{if(!e||0===e.length)return null;const r=e[0],{lat:n,lng:a,floorId:s}=r.position,i=t.filter(e=>e.position&&e.position.floorId===s);let o=null,c=1/0;return i.forEach(e=>{const t=R(n,a,e.position.latitude,e.position.longitude);t<c&&(c=t,o=e)}),o?o.name:null};export{I as default};
@@ -1 +1 @@
1
- import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as e}from"../../../src/utils/geodesy.js";import{findRoute as i}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function d(d,l){const p=d.log.sublog("wayfinder"),c=async()=>{d.bus.send("venueData/loadNavGraph")};let f=new n;d.bus.on("wayfinder/_getNavGraph",()=>f),d.bus.on("venueData/navGraphLoaded",async({navGraphData:t,structures:n})=>{const e=o(n),i=await m(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}),d.bus.on("poi/setDynamicRouting",async({idValuesMap:t})=>{const n=await f,o=Object.values(t).filter(t=>t.position&&void 0!==t.position.floorId&&t.position.latitude&&t.position.longitude).map(t=>n.findClosestNode(t.position.floorId,t.position.latitude,t.position.longitude).id);n.addNodesToAvoid(o)});const m=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(y),t.filter(t.identity))(n)},y=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};d.bus.on("wayfinder/showNavLineFromPhysicalLocation",async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const e=await T({fromEndpoint:t,toEndpoint:n,options:o});if(e){const{segments:t}=e;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return e}(await d.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0}));const g=(t,n)=>d.bus.get("poi/getById",{id:t}).then(o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)});const h=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(h),t.keys,t.propEq(h.length,"length"),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function T({fromEndpoint:t,toEndpoint:n,options:o={}}){const e=await d.bus.get("poi/getAll")||{},r=Array.isArray(e)?e[0]:e,a=Object.values(r).filter(t=>t.category&&t.category.startsWith("security")),u=await d.bus.getFirst("directions/getPreferredUnits")||"meters";return f.then(async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;const c=await d.bus.get("venueData/getFloorIdToNameMap"),f=await d.bus.get("venueData/getQueueTypes"),m=d.gt(),y=o.requiresAccessibility,{steps:g,segments:h}=s(r.waypoints,t,n,c,m,f,y,a,u);p.info("route",r);const I=Math.round(r.waypoints.reduce((t,{eta:n})=>t+n,0)),w=Math.round(r.waypoints.reduce((t,{distance:n})=>t+n,0));return{...r,segments:h,steps:g,time:I,distance:w}})}function b(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:v(o,"transitTime"),distance:v(o,"distance")}:(r.distance="start"===i?O(r,e):O(e,r),r.transitTime=S(r.distance),r)}function v(n,o){return t.aperture(2,n).map(([n,o])=>{return(e=o.id,n=>t.find(t=>t.dst===e,n.edges))(n);var e}).map(t.prop(o)).reduce((t,n)=>t+n,0)}function E(t,n,o){return{...t,[o+"Information"]:{lat:n?.lat||n?.position?.latitude,lng:n?.lng||n?.position?.longitude,floorId:n?.floorId||n?.position?.floorId}}}function O(t,n){return e(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function S(t){return t/60}function L(n){const o=n.filter(t=>null!==t);return t.sortBy(t.propOr(1/0,"transitTime"),o)}function N(t,n){return t&&t.length?v(t,"transitTime"):S(n)}function P(t,n,o){return t&&t.length?v(t,"distance"):O(o,n)}return d.bus.on("wayfinder/getNavigationEndpoint",({ep:t})=>async function(t){return f.then(n=>{if(!t)throw Error("wayfinder: Invalid endpoint definition",t);if("number"==typeof t)return g(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return g(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){const[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);let a=r;return a||(a="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:a}}}if(I(t))return t;if(t.latitude)return{lat:t.latitude,lng:t.longitude,floorId:t.floorId,ordinal:n.floorIdToOrdinal(t.floorId),title:t.title};if(t.position&&t.name)return w(t,n.floorIdToOrdinal);throw Error("Invalid start or end point: "+t)})}(t)),d.bus.on("wayfinder/checkIfPathHasSecurity",({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then(r=>{e.compareFindPaths=l.compareFindPaths;const a=i(r,n,o,e);if(!a)return{routeExists:!1};const s=n=>Boolean(a.waypoints.find(t.pathEq(n,["securityLane","type"])));return{routeExists:!0,queues:a.waypoints.filter(n=>t.pathEq(u.SECURITY,["securityLane","type"],n)||t.pathEq(u.IMMIGRATION,["securityLane","type"],n)),hasSecurity:s(u.SECURITY),hasImmigration:s(u.IMMIGRATION)}})),d.bus.on("wayfinder/getRoute",T),d.bus.on("wayfinder/addPathTimeMultiple",async({pois:n,startLocation:o,options:e={}})=>o?f.then(i=>function(n,o,e,i){try{const r=t.clone(e),a=r.map(t=>w(t,n.floorIdToOrdinal)),s=n.findAllShortestPaths(i,a,o);return L(r.map((t,n)=>b(t,s[n],i,"start")))}catch(t){return p.error(t),e}}(i,e,n,o)):n),d.bus.on("wayfinder/multipointAddPathTimeMultiple",async({pois:n,startLocation:o,endLocation:e,currentLocation:i,options:r={}})=>o||e||i?f.then(a=>function(n,o,e,i,r,a){try{const s=i?w(i,n.floorIdToOrdinal):a,u=r?w(r,n.floorIdToOrdinal):null,d=t.clone(e),l=d.map(t=>w(t,n.floorIdToOrdinal));let p,c,f;return s&&(p=n.findAllShortestPaths(s,l,o)),u&&(c=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,l,u,o)),f=s&&u?d.map((n,o)=>function(n,o,e,i,r){const a=P(o,i,n),s=P(e,n,r);if(!a||!s)return null;const u=N(o,a),d=N(e,s);let l=t.clone(n);return l=E(l,i,"start"),l=E(l,r,"end"),{...l,transitTime:u+d,distance:a+s,startInformation:{...l.startInformation,transitTime:u,distance:a},endInformation:{...l.endInformation,transitTime:d,distance:s}}}(n,p[o],c[o],s,u)):s?d.map((t,n)=>b(t,p[n],s,"start")):d.map((t,n)=>b(t,c[n],u,"end")),L(f)}catch(t){return p.error(t),e}}(a,r,n,o,e,i)):n),d.bus.on("venueData/loadNewVenue",()=>{f=new n,c()}),d.bus.on("poi/setDynamicData",({plugin:t,idValuesMap:n})=>{"security"===t&&f.then(t=>t.updateWithSecurityWaitTime(n))}),d.bus.on("wayfinder/getNavGraphFeatures",()=>f.then(({_nodes:t})=>a(t))),{init:c,internal:{resolveNavGraph:t=>f.resolve(t),prepareSecurityLanes:m}}}export{u as SecurityLaneType,d as create};
1
+ import*as t from"ramda";import n from"zousan";import{buildStructuresLookup as o}from"../../../src/utils/buildStructureLookup.js";import{distance as e}from"../../../src/utils/geodesy.js";import{findRoute as i}from"./findRoute.js";import{createNavGraph as r}from"./navGraph.js";import{enrichDebugNavGraph as a}from"./navGraphDebug.js";import{buildSegments as s}from"./segmentBuilder.js";const u={SECURITY:"SecurityLane",IMMIGRATION:"ImmigrationLane"};function d(d,l){const p=d.log.sublog("wayfinder"),c=async()=>{d.bus.send("venueData/loadNavGraph")};let f=new n;d.bus.on("wayfinder/_getNavGraph",()=>f),d.bus.on("venueData/navGraphLoaded",async({navGraphData:t,structures:n})=>{const e=o(n),i=await m(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}),d.bus.on("poi/setDynamicRouting",async({idValuesMap:t})=>{const n=await f,o=Object.values(t).filter(t=>t.position&&void 0!==t.position.floorId&&t.position.latitude&&t.position.longitude).map(t=>n.findClosestNode(t.position.floorId,t.position.latitude,t.position.longitude).id);n.addNodesToAvoid(o)});const m=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(y),t.filter(Boolean))(n)},y=n=>n.queue&&{type:t.path(["queue","queueType"],n),id:t.path(["queue","queueSubtype"],n)};d.bus.on("wayfinder/showNavLineFromPhysicalLocation",async({toEndpoint:t,selectedSecurityLanes:n=null,requiresAccessibility:o})=>async function(t,n,o){const e=await T({fromEndpoint:t,toEndpoint:n,options:o});if(e){const{segments:t}=e;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return e}(await d.bus.getFirst("user/getPhysicalLocation"),t,{selectedSecurityLanes:n,requiresAccessibility:o,primary:!0}));const g=(t,n)=>d.bus.get("poi/getById",{id:t}).then(o=>{if(o&&o.position)return w(o,n);throw Error("Unknown POI ID "+t)});const h=["lat","lng","floorId","ordinal"],I=t.pipe(t.pick(h),t.keys,t.propEq(h.length,"length"),Boolean),w=(t,n)=>({lat:t.position.latitude,lng:t.position.longitude,floorId:t.position.floorId,ordinal:n(t.position.floorId),title:t.name});async function T({fromEndpoint:t,toEndpoint:n,options:o={}}){const e=await d.bus.get("poi/getAll")||{},r=Array.isArray(e)?e[0]:e,a=Object.values(r).filter(t=>t.category&&t.category.startsWith("security")),u=await d.bus.getFirst("directions/getPreferredUnits")||"meters";return f.then(async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;const c=await d.bus.get("venueData/getFloorIdToNameMap"),f=await d.bus.get("venueData/getQueueTypes"),m=d.gt(),y=o.requiresAccessibility,{steps:g,segments:h}=s(r.waypoints,t,n,c,m,f,y,a,u);p.info("route",r);const I=Math.round(r.waypoints.reduce((t,{eta:n})=>t+n,0)),w=Math.round(r.waypoints.reduce((t,{distance:n})=>t+n,0));return{...r,segments:h,steps:g,time:I,distance:w}})}function b(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:v(o,"transitTime"),distance:v(o,"distance")}:(r.distance="start"===i?O(r,e):O(e,r),r.transitTime=S(r.distance),r)}function v(n,o){return t.aperture(2,n).map(([n,o])=>{return(e=o.id,n=>t.find(t=>t.dst===e,n.edges))(n);var e}).map(t=>t?.[o]??0).reduce((t,n)=>t+n,0)}function E(t,n,o){return{...t,[o+"Information"]:{lat:n?.lat||n?.position?.latitude,lng:n?.lng||n?.position?.longitude,floorId:n?.floorId||n?.position?.floorId}}}function O(t,n){return e(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function S(t){return t/60}function L(n){const o=n.filter(t=>null!==t);return t.sortBy(t.propOr(1/0,"transitTime"),o)}function N(t,n){return t&&t.length?v(t,"transitTime"):S(n)}function P(t,n,o){return t&&t.length?v(t,"distance"):O(o,n)}return d.bus.on("wayfinder/getNavigationEndpoint",({ep:t})=>async function(t){return f.then(n=>{if(!t)throw Error("wayfinder: Invalid endpoint definition",t);if("number"==typeof t)return g(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return g(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){const[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);let a=r;return a||(a="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:a}}}if(I(t))return t;if(t.latitude)return{lat:t.latitude,lng:t.longitude,floorId:t.floorId,ordinal:n.floorIdToOrdinal(t.floorId),title:t.title};if(t.position&&t.name)return w(t,n.floorIdToOrdinal);throw Error("Invalid start or end point: "+t)})}(t)),d.bus.on("wayfinder/checkIfPathHasSecurity",({fromEndpoint:n,toEndpoint:o,options:e={}})=>f.then(r=>{e.compareFindPaths=l.compareFindPaths;const a=i(r,n,o,e);if(!a)return{routeExists:!1};const s=n=>Boolean(a.waypoints.find(t.pathEq(n,["securityLane","type"])));return{routeExists:!0,queues:a.waypoints.filter(n=>t.pathEq(u.SECURITY,["securityLane","type"],n)||t.pathEq(u.IMMIGRATION,["securityLane","type"],n)),hasSecurity:s(u.SECURITY),hasImmigration:s(u.IMMIGRATION)}})),d.bus.on("wayfinder/getRoute",T),d.bus.on("wayfinder/addPathTimeMultiple",async({pois:n,startLocation:o,options:e={}})=>o?f.then(i=>function(n,o,e,i){try{const r=t.clone(e),a=r.map(t=>w(t,n.floorIdToOrdinal)),s=n.findAllShortestPaths(i,a,o);return L(r.map((t,n)=>b(t,s[n],i,"start")))}catch(t){return p.error(t),e}}(i,e,n,o)):n),d.bus.on("wayfinder/multipointAddPathTimeMultiple",async({pois:n,startLocation:o,endLocation:e,currentLocation:i,options:r={}})=>o||e||i?f.then(a=>function(n,o,e,i,r,a){try{const s=i?w(i,n.floorIdToOrdinal):a,u=r?w(r,n.floorIdToOrdinal):null,d=t.clone(e),l=d.map(t=>w(t,n.floorIdToOrdinal));let p,c=[],f=[];return s&&(c=n.findAllShortestPaths(s,l,o)),u&&(f=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,l,u,o)),p=s&&u?d.map((n,o)=>function(n,o,e,i,r){const a=P(o,i,n),s=P(e,n,r);if(!a||!s)return null;const u=N(o,a),d=N(e,s);let l=t.clone(n);return l=E(l,i,"start"),l=E(l,r,"end"),{...l,transitTime:u+d,distance:a+s,startInformation:{...l.startInformation,transitTime:u,distance:a},endInformation:{...l.endInformation,transitTime:d,distance:s}}}(n,c[o],f[o],s,u)):s?d.map((t,n)=>b(t,c[n],s,"start")):d.map((t,n)=>b(t,f[n],u,"end")),L(p)}catch(t){return p.error(t),e}}(a,r,n,o,e,i)):n),d.bus.on("venueData/loadNewVenue",()=>{f=new n,c()}),d.bus.on("poi/setDynamicData",({plugin:t,idValuesMap:n})=>{"security"===t&&f.then(t=>t.updateWithSecurityWaitTime(n))}),d.bus.on("wayfinder/getNavGraphFeatures",()=>f.then(({_nodes:t})=>a(t))),{init:c,internal:{resolveNavGraph:t=>f.resolve(t),prepareSecurityLanes:m}}}export{u as SecurityLaneType,d as create};
package/dist/src/app.js CHANGED
@@ -1 +1 @@
1
- import{map as e,mergeDeepRight as t}from"ramda";import n from"zousan-plus";import i from"./utils/i18n.js";import{startInitialStateListener as o}from"./utils/isInitialState.js";import*as a from"../package.json.js";import r from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";const c="undefined"!=typeof window;async function g(e,t,n){if(!n)return e.log.info(`Plugin ${t} explicitly disabled`),null;if(void 0!==n.active&&(!1===n.active||"notLocalhost"===n.active&&e.env.isLocalhost()))return e.log.info(`Plugin ${t} explicitly deativated`),null;return(t.includes("/")?(()=>{const[e,n]=t.split("/");return import(`../plugins/${e}/${n}/src/index.js`)})():import(`../plugins/${t}/src/index.js`)).then(i=>(e.log.info(`Creating plugin ${t}`),i.create(e,n)))}async function d(e){return c?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function p(e,n){let i={};const o=await Promise.all(n.map(d));for(const e of o){let n=e.default;n=n.extends?await p(n,n.extends):n,i=t(i,n)}return i=t(i,e),i}const m=e=>t=>import(`./configs/postproc-${e}.ts`).then(e=>e.process(t));async function f(t){const d=Object.create(null);let f=t.extends?await p(t,t.extends):t;if(f.plugins?.monitoring)try{const e=await import("../_virtual/_empty_module_placeholder.js");await e.activate(f.plugins.monitoring)}catch(e){console.warn("Monitoring plugin failed to load (continuing without it):",e?.message||e)}f=await(async e=>e.configPostProc?n.series(e,...e.configPostProc.map(m)):e)(f);const w=(e=>{const t=e.supportedLanguages||["am","ar","de","el-GR","en","es","fr","hi","is","it","ja","ko","nl","pl","pt","ru","so","th","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=new URLSearchParams(location.search).get("lang")||navigator.language;for(;e;){if(e&&t.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"))}}return e.defaultLanguage||"en"})(f),h=await i(w,{debug:f.debug});d.i18n=()=>h,d.gt=()=>h.t.bind(h),d.config=f,d.plugins={};const y=u("web-engine",{enabled:!!f.debug,isBrowser:c,color:"cyan",logFilter:f.logFilter,truncateObjects:!c,trace:false});if(d.log=y.sublog(f.name),d.bus=l({showEvents:!0,reportAllErrors:!0,log:y}),d.info={wePkg:a},"undefined"!=typeof window&&(f.debug?(d.debug=e(e=>e.bind(d),r),r.dndGo.call(d)):d.debug={},window._app=d,window.document&&window.document.title&&f.setWindowTitle&&(document.title=f.name)),d.env=s(d),f.theme?await n.evaluate({name:"ThemeManagerModule",value:import("../_virtual/_empty_module_placeholder.js")},{name:"HistoryManager",value:import("./historyManager.js")},{name:"LayerManager",value:import("../_virtual/_empty_module_placeholder.js")}).then(async({LayerManager:e,HistoryManager:t,ThemeManagerModule:n})=>{const i=n.initThemeManager(d);d.themePack=await i.buildTheme(f.theme,f.defaultTheme),o(),e.initLayerManager(d),t.initHistoryManager(d),d.destroy=()=>e.destroy(d)}):d.destroy=()=>{},f.plugins){for(const e in f.plugins)try{const t=f.plugins[e];if(d.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const n=await g(d,e,t);n&&(d.plugins[e]=n)}catch(t){y.error("Error instantiating plugin "+e),y.error(t)}for(const e in d.plugins)d.plugins[e].init()}return d}export{f as create};
1
+ import{map as e,mergeDeepRight as t}from"ramda";import n from"zousan-plus";import o from"./utils/i18n.js";import{startInitialStateListener as i}from"./utils/isInitialState.js";import{version as r}from"../package.json.js";import a from"./debugTools.js";import{buildEnv as s}from"./env.js";import{create as l}from"./extModules/bustle.js";import{initLog as u}from"./extModules/log.js";const c="undefined"!=typeof window;async function g(e,t,n){if(!n)return e.log.info(`Plugin ${t} explicitly disabled`),null;if(void 0!==n.active&&(!1===n.active||"notLocalhost"===n.active&&e.env.isLocalhost()))return e.log.info(`Plugin ${t} explicitly deativated`),null;return(t.includes("/")?(()=>{const[e,n]=t.split("/");return import(`../plugins/${e}/${n}/src/index.js`)})():import(`../plugins/${t}/src/index.js`)).then(o=>(e.log.info(`Creating plugin ${t}`),o.create(e,n)))}async function d(e){return c?import(`./configs/${e}.json`):import(`./configs/${e}.json.js`)}async function p(e,n){let o={};const i=await Promise.all(n.map(d));for(const e of i){let n=e.default;n=n.extends?await p(n,n.extends):n,o=t(o,n)}return o=t(o,e),o}const m=e=>t=>import(`./configs/postproc-${e}.ts`).then(e=>e.process(t));async function f(t){const d=Object.create(null);let f=t.extends?await p(t,t.extends):t;if(f.plugins?.monitoring){const e=f.plugins.monitoring;try{const t=await import("../_virtual/_empty_module_placeholder.js");await t.activate(e)}catch(e){const t=e instanceof Error?e.message:String(e);console.warn("Monitoring plugin failed to load (continuing without it):",t)}}f=await(async e=>e.configPostProc?n.series(e,...e.configPostProc.map(m)):e)(f);const w=(e=>{const t=e.supportedLanguages||["am","ar","de","el-GR","en","es","fr","hi","is","it","ja","ko","nl","pl","pt","ru","so","th","zh-Hans","zh-Hant"];if("undefined"!=typeof window){let e=new URLSearchParams(location.search).get("lang")||navigator.language;for(;e;){if(e&&t.includes(e))return e;e=e.substring(0,e.lastIndexOf("-"))}}return e.defaultLanguage||"en"})(f),h=await o(w,{debug:f.debug});d.i18n=()=>h,d.gt=()=>h.t.bind(h),d.config=f,d.plugins={};const y=u("web-engine",{enabled:!!f.debug,isBrowser:c,color:"cyan",logFilter:f.logFilter,truncateObjects:!c,trace:false});if(d.log=y.sublog(f.name),d.bus=l({showEvents:!0,reportAllErrors:!0,log:y}),d.info={wePkg:{version:r}},"undefined"!=typeof window&&(f.debug?(d.debug=e(e=>e.bind(d),a),a.dndGo.call(d)):d.debug={},window._app=d,window.document&&window.document.title&&f.setWindowTitle&&(document.title=f.name)),d.env=s(d),f.theme?await n.evaluate({name:"ThemeManagerModule",value:import("../_virtual/_empty_module_placeholder.js")},{name:"HistoryManager",value:import("./historyManager.js")},{name:"LayerManager",value:import("../_virtual/_empty_module_placeholder.js")}).then(async({LayerManager:e,HistoryManager:t,ThemeManagerModule:n})=>{const o=n.initThemeManager(d);d.themePack=await o.buildTheme(f.theme,f.defaultTheme),i(),e.initLayerManager(d),t.initHistoryManager(d),d.destroy=()=>e.destroy(d)}):d.destroy=()=>{},f.plugins){for(const e in f.plugins)try{const t=f.plugins[e];if(d.plugins[e])throw Error(`Duplicate plugin name "${e}"`);const n=await g(d,e,t);n&&(d.plugins[e]=n)}catch(t){y.error("Error instantiating plugin "+e),y.error(t)}for(const e in d.plugins)d.plugins[e].init()}return d}export{f as create};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.924",
3
+ "version": "3.3.925",
4
4
  "description": "This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information",
5
5
  "keywords": [
6
6
  "map",