atriusmaps-node-sdk 3.3.387 → 3.3.389

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var name = "web-engine";
6
- var version = "3.3.387";
6
+ var version = "3.3.389";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.js";
@@ -35,7 +35,7 @@ var scripts = {
35
35
  prepare: "husky install",
36
36
  test: "jest --no-cache --verbose",
37
37
  "test-watch": "jest --verbose --watch",
38
- "test:vitest": "vitest"
38
+ "test:vitest": "vitest run"
39
39
  };
40
40
  var browserslist = [
41
41
  "defaults"
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ const dynamicRoutingData = {
4
+ 868: {
5
+ category: 'portal',
6
+ description: 'Elevator',
7
+ poiId: '868',
8
+ position: {
9
+ floorId: 'staticdca-terminals-departures',
10
+ latitude: 38.851973,
11
+ longitude: -77.082142
12
+ },
13
+ dynamicData: {
14
+ 'dynamic-routing': {
15
+ navGraphHidden: true,
16
+ navGraphHiddenReason: 'reason 2',
17
+ expiration: 2055958719000
18
+ // expiration: 1740608456150
19
+ }
20
+ }
21
+ },
22
+ 869: {
23
+ category: 'portal',
24
+ description: 'Elevator',
25
+ poiId: '869',
26
+ position: {
27
+ floorId: 'staticdca-terminals-departures',
28
+ latitude: 38.851973,
29
+ longitude: -77.082142
30
+ },
31
+ dynamicData: {
32
+ 'dynamic-routing': {
33
+ navGraphHidden: true,
34
+ navGraphHiddenReason: 'reason 2',
35
+ expiration: 2055958719000
36
+ }
37
+ }
38
+ }
39
+ };
40
+
41
+ exports.dynamicRoutingData = dynamicRoutingData;
@@ -1,8 +1,30 @@
1
1
  'use strict';
2
2
 
3
+ var luxon = require('luxon');
4
+ var R = require('ramda');
3
5
  var Zousan = require('zousan');
6
+ var mockDynamicRoutingData = require('../mocks/mockDynamicRoutingData.js');
4
7
  var processors = require('./processors.js');
5
8
 
9
+ function _interopNamespaceDefault(e) {
10
+ var n = Object.create(null);
11
+ if (e) {
12
+ Object.keys(e).forEach(function (k) {
13
+ if (k !== 'default') {
14
+ var d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: function () { return e[k]; }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ var R__namespace = /*#__PURE__*/_interopNamespaceDefault(R);
27
+
6
28
  /*
7
29
  This service obtains dynamic POI data from our own backend REST API service.
8
30
  Currently it drives dynamic data for Security Wait Times and Parking Status.
@@ -38,7 +60,8 @@ const ACCOUNT_ID_HEADER = 'x-account-id';
38
60
 
39
61
  function create (app, config = {}) {
40
62
  const state = {
41
- dynamicDataNotPending: new Zousan()
63
+ dynamicDataNotPending: new Zousan(),
64
+ poisToAvoid: new Zousan()
42
65
  };
43
66
  const T = app.gt();
44
67
 
@@ -49,6 +72,8 @@ function create (app, config = {}) {
49
72
  // by returning this dynamicDataLoaded promise, we hold sdkReady event until this is resolved
50
73
  app.bus.on('system/readywhenyouare', () => state.dynamicDataNotPending);
51
74
 
75
+ app.bus.on('dynamicRouting/poisToAvoid', () => state.poisToAvoid);
76
+
52
77
  const init = async () => {
53
78
  const [accountId, venueId] = await Promise.all([
54
79
  app.bus.get('venueData/getAccountId'),
@@ -89,10 +114,11 @@ function create (app, config = {}) {
89
114
  return state.dynamicDataNotPending.resolve(true) // no need to wait for this since there is no dynamic data
90
115
  };
91
116
 
92
- function processDynamicPois (pois) {
117
+ async function processDynamicPois (pois) {
93
118
  processParkingPOIS(pois);
94
119
  processOpenClosedPois(pois);
95
120
  processSecurityWaitTimes(pois);
121
+ await fetchDynamicRouting(mockDynamicRoutingData.dynamicRoutingData); // TODO: change this later to use the data from the api
96
122
  }
97
123
 
98
124
  function processParkingPOIS (poiMap) {
@@ -130,6 +156,32 @@ function create (app, config = {}) {
130
156
  app.bus.send('poi/setDynamicData', { plugin: 'open-closed-status', idValuesMap });
131
157
  }
132
158
 
159
+ async function fetchDynamicRouting (pois) {
160
+ let poiResults = [];
161
+
162
+ if (!config.dynamicRoutingEnabled) {
163
+ state.poisToAvoid.resolve(poiResults); // if dynamic routing is disabled, resolve to empty array
164
+ return
165
+ }
166
+
167
+ const now = luxon.DateTime.now().toMillis();
168
+
169
+ const poiIdsToAvoid = Object.values(R__namespace.filter(
170
+ poi => {
171
+ const navGraphHidden = R__namespace.path(['dynamicData', 'dynamic-routing', 'navGraphHidden'], poi);
172
+ const expiration = R__namespace.path(['dynamicData', 'dynamic-routing', 'expiration'], poi);
173
+ return navGraphHidden === true && expiration > now
174
+ },
175
+ pois
176
+ ));
177
+
178
+ if (poiIdsToAvoid.length > 0) {
179
+ const poisObj = await app.bus.get('poi/getAll');
180
+ poiResults = Object.values(poisObj).length > 0 ? poiIdsToAvoid.map(poi => poisObj[poi?.poiId]) : [];
181
+ }
182
+ state.poisToAvoid.resolve(poiResults);
183
+ }
184
+
133
185
  return {
134
186
  init
135
187
  }
@@ -40,6 +40,7 @@ const CLOSED_CHECKPOINT_EDGE_WEIGHT = 9999;
40
40
  function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityLanesMap) {
41
41
  const nodes = { };
42
42
  const geoDb = { };
43
+ const nodesToAvoid = new Set();
43
44
  let securityWaitTimes = {};
44
45
 
45
46
  data.nodes.forEach(nodeData => {
@@ -132,7 +133,17 @@ function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityL
132
133
  // options.maxOrd = Math.max(start.ordinal, end.ordinal)
133
134
  // options.structureId = start.structureId
134
135
  // }
135
- return findShortestPath(startNode, endNode, nodes, securityWaitTimes, securityLanesMap, options)
136
+ return findShortestPath(startNode, endNode, nodes, nodesToAvoid, securityWaitTimes, securityLanesMap, options)
137
+ }
138
+
139
+ /**
140
+ *
141
+ * @param {Array.<string>} nodes - Array of nodes to avoid
142
+ */
143
+ function updateNodesToAvoid (nodes) {
144
+ // We want to replace entire list when we get new nodes, not just add
145
+ nodesToAvoid.clear();
146
+ nodes.forEach(n => nodesToAvoid.add(n));
136
147
  }
137
148
  /**
138
149
  * @param {Endpoint} start - start endpoint
@@ -144,7 +155,7 @@ function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityL
144
155
  const startNode = findClosestNode(start);
145
156
  const destNodeArray = destArray.map(dest => findClosestNode(dest));
146
157
  if (!startNode || !destNodeArray.length) return []
147
- return findAllShortestPathsImpl(startNode, destNodeArray, nodes, securityWaitTimes, securityLanesMap, options)
158
+ return findAllShortestPathsImpl(startNode, destNodeArray, nodes, nodesToAvoid, securityWaitTimes, securityLanesMap, options)
148
159
  }
149
160
 
150
161
  function updateWithSecurityWaitTime (waitTimesData) {
@@ -155,6 +166,8 @@ function createNavGraph (data, floorIdToOrdinal, floorIdToStructureId, securityL
155
166
  return {
156
167
  _nodes: nodes,
157
168
  _geoDb: geoDb,
169
+ _nodesToAvoid: nodesToAvoid,
170
+ addNodesToAvoid: (nodes) => updateNodesToAvoid(nodes),
158
171
  findClosestNode: (floorId, lat, lng) => findClosestNodeByFloor(floorId, lat, lng, geoDb, nodes),
159
172
  findShortestPath: (start, end, options) => findShortestPathEntry(start, end, nodes, options),
160
173
  findAllShortestPaths,
@@ -176,12 +189,13 @@ function distanceBetweenNodes (n1, n2, nodes) {
176
189
  * @param {Object.<Node>} start - a node in the navGraph to start on
177
190
  * @param {Array.<Node>} destinations - array of nodes to find path to
178
191
  * @param {Object.<string, NavNode>} nodes - dictionary of nodes by id
192
+ * @param {Set.<string>} nodesToAvoid - set of nodes to avoid
179
193
  * @param {Object.<string, SecurityWaitTime>} securityWaitTimes - map of POI id to security wait time
180
194
  * @param {Object.<string, SecurityLane>} securityLanesMap - map of POI id to security lane
181
195
  * @param {RouteOptions} [options={}] extra options (such as requireAccessibility)
182
196
  * @returns {Array.<Array.<Node>>} list of shortest path to each destination
183
197
  */
184
- function findAllShortestPathsImpl (start, destinations, nodes, securityWaitTimes = {}, securityLanesMap = {}, options = {}) {
198
+ function findAllShortestPathsImpl (start, destinations, nodes, nodesToAvoid, securityWaitTimes = {}, securityLanesMap = {}, options = {}) {
185
199
  // const previous = findPaths(start, start, nodes, options)
186
200
 
187
201
  // const backtrackPath = node => buildBacktrackPath(nodes, previous, node)
@@ -191,7 +205,7 @@ function findAllShortestPathsImpl (start, destinations, nodes, securityWaitTimes
191
205
  // return new Map(poiPathTuples)
192
206
  return destinations.map(d => {
193
207
  try {
194
- return findShortestPath(start, d, nodes, securityWaitTimes, securityLanesMap, options)
208
+ return findShortestPath(start, d, nodes, nodesToAvoid, securityWaitTimes, securityLanesMap, options)
195
209
  } catch (e) { return null }
196
210
  })
197
211
  }
@@ -215,12 +229,13 @@ const clearCache = () => {
215
229
  * @param {Object<Node>} start a node in the navGraph to start on
216
230
  * @param {Object<Node>} end a node in the navGraph to find path to
217
231
  * @param {Object.<string, Node>} nodes dictionary of nodes by id
232
+ * @param {Set.<string>} nodesToAvoid - set of nodes to avoid
218
233
  * @param {Object.<string, SecurityWaitTime>} securityWaitTimes - map of POI id to security wait time
219
234
  * @param {Object.<string, SecurityLane>} securityLanesMap - map of POI id to security lane
220
235
  * @param {RouteOptions} options={} extra options (such as requireAccessibility)
221
236
  * @returns {Array.<Node>} an array of nodes that represent the shortest route from start to end. null if no route exists.
222
237
  */
223
- function findShortestPath (start, end, nodes, securityWaitTimes = {}, securityLanesMap = {}, options = { }) {
238
+ function findShortestPath (start, end, nodes, nodesToAvoid, securityWaitTimes = {}, securityLanesMap = {}, options = { }) {
224
239
  if (start.id !== lastStartId || lastOptionsStr !== JSON.stringify(options)) {
225
240
  clearCache();
226
241
  visitQueue.offerWithPriority(start.id, 0);
@@ -238,6 +253,9 @@ function findShortestPath (start, end, nodes, securityWaitTimes = {}, securityLa
238
253
  for (let ei = 0; ei < node.edges.length; ei++) {
239
254
  const e = node.edges[ei]; // next edge from this node
240
255
 
256
+ if (nodesToAvoid.size > 0 && nodesToAvoid.has(e.dst)) {
257
+ continue
258
+ }
241
259
  if (visited[e.dst])
242
260
  continue
243
261
 
@@ -217,7 +217,7 @@ const getSegmentType = (segment) => {
217
217
  * @param {boolean} requiresAccessibility
218
218
  * @return {{steps: Step[], segments: Segment[]}}
219
219
  */
220
- const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T, queueTypes, requiresAccessibility) => {
220
+ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois) => {
221
221
  let rawSegments = createSegments(waypoints);
222
222
  rawSegments = addCurveLineCoordinates(rawSegments);
223
223
 
@@ -259,7 +259,7 @@ const buildSegments = (waypoints, fromEndpoint, toEndpoint, floorIdToNameMap, T,
259
259
  return cookedSegment
260
260
  });
261
261
 
262
- const steps = stepBuilder(rawSegments, R__namespace.prop('title', fromEndpoint), R__namespace.prop('title', toEndpoint), floorIdToNameMap, T, queueTypes);
262
+ const steps = stepBuilder(rawSegments, R__namespace.prop('title', fromEndpoint), R__namespace.prop('title', toEndpoint), floorIdToNameMap, T, queueTypes, requiresAccessibility, securityPois);
263
263
 
264
264
  return { segments, steps }
265
265
  };
@@ -2,6 +2,7 @@
2
2
 
3
3
  var R = require('ramda');
4
4
  var bounds = require('../../../src/utils/bounds.js');
5
+ var geodesy = require('../../../src/utils/geodesy.js');
5
6
  var segmentBadges = require('./segmentBadges.js');
6
7
  var segmentCategories = require('./segmentCategories.js');
7
8
 
@@ -33,7 +34,7 @@ var segmentCategories = require('./segmentCategories.js');
33
34
  * @param {boolean} requiresAccessibility
34
35
  * @return {Step[]} steps - list of navigation steps
35
36
  */
36
- function getSteps (segments, startName = '', destinationName = '', floorIdToNameMap, T, queueTypes = {}, requiresAccessibility) {
37
+ function getSteps (segments, startName = '', destinationName = '', floorIdToNameMap, T, queueTypes = {}, requiresAccessibility, securityPois = []) {
37
38
  return segments.map((segment, index) => {
38
39
  const securityWaitTimes = findPropWaypoints('securityWaitTimes')(segment.waypoints);
39
40
  const eta = (securityWaitTimes && !securityWaitTimes.isTemporarilyClosed) // if there is dynamic wait time and checkpoint is open, then use it
@@ -42,9 +43,8 @@ function getSteps (segments, startName = '', destinationName = '', floorIdToName
42
43
  const distance = Math.round(calculateSegmentDistance(segment.waypoints));
43
44
  const icon = getIcon(segment.segmentCategory);
44
45
  const animationAnchor = getAnimationAnchor(segment.segmentCategory, segment.waypoints);
45
- const primaryText = getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T);
46
- const securityLaneName = getSecurityLaneName(queueTypes, segment.waypoints);
47
- const secondaryText = getSecondaryText(segment, eta, securityLaneName, T);
46
+ const primaryText = getPrimaryText(segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes);
47
+ const secondaryText = getSecondaryText(segment, eta, T);
48
48
  const bounds$1 = bounds.findBoundsOfWaypoints(segment.waypoints);
49
49
  const isAccessible = checkIfAccessible(segment);
50
50
 
@@ -155,17 +155,33 @@ function getAnimationAnchor (segmentCategory, waypoints) {
155
155
  return waypoints[index].position
156
156
  }
157
157
 
158
- function getPrimaryText (segments, index, startName, destinationName, floorIdToNameMap, T) {
158
+ function getPrimaryText (segments, index, startName, destinationName, floorIdToNameMap, T, securityPois, queueTypes) {
159
159
  const segment = segments[index];
160
160
  switch (segment.segmentCategory) {
161
161
  case segmentCategories.START:
162
162
  return getPositionName(segment.waypoints[0].position, startName)
163
163
  case segmentCategories.WALKING_TO_END:
164
164
  return getPositionName(segment.waypoints[segment.waypoints.length - 1].position, destinationName)
165
- case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT:
165
+ case segmentCategories.WALKING_TO_SECURITY_CHECKPOINT: {
166
+ const lookAheadWaypoints = segments[index + 1].waypoints;
167
+ const laneName = getSecurityLaneName(queueTypes, lookAheadWaypoints);
168
+ const translated = T(`wayfinder:Security Lane`);
169
+ const securityLane = laneName ? `${laneName} ${translated}` : null; // add translation
170
+
171
+ const poiTitle = getClosestSecurityPoiTitle(lookAheadWaypoints, securityPois);
172
+ const displayName = securityLane || poiTitle; // Use laneName if defined; otherwise, poiTitle
173
+ return displayName || T(`wayfinder:${segment.type}`)
174
+ }
166
175
  case segmentCategories.WALKING_TO_PORTAL:
167
176
  return T(`wayfinder:${segments[index + 1].type}`)
168
- case segmentCategories.SECURITY_CHECKPOINT:
177
+ case segmentCategories.SECURITY_CHECKPOINT: {
178
+ const laneName = getSecurityLaneName(queueTypes, segment.waypoints);
179
+ const translated = T(`wayfinder:Security Lane`);
180
+ const securityLane = laneName ? `${laneName} ${translated}` : null;
181
+ const poiTitle = getClosestSecurityPoiTitle(segment.waypoints, securityPois);
182
+ const displayName = securityLane || poiTitle; // Use securityLane if defined; otherwise, poiTitle
183
+ return displayName || getLevelName(segment, floorIdToNameMap)
184
+ }
169
185
  case segmentCategories.ELEVATOR:
170
186
  case segmentCategories.ELEVATOR_DOWN:
171
187
  case segmentCategories.ELEVATOR_UP:
@@ -189,7 +205,7 @@ function getLevelName (segment, floorIdToNameMap) {
189
205
  return floorIdToNameMap[R.last(segment.waypoints).position.floorId]
190
206
  }
191
207
 
192
- function getSecondaryText (segment, minutes, securityLaneName, T, requiresAccessibility) {
208
+ function getSecondaryText (segment, minutes, T) {
193
209
  const zeroOrOtherKeys = translateZeroOrOther(minutes, T);
194
210
  const travelVerb = 'Proceed';
195
211
  switch (segment.segmentCategory) {
@@ -209,12 +225,11 @@ function getSecondaryText (segment, minutes, securityLaneName, T, requiresAccess
209
225
  case segmentCategories.WALKING_TO_END: return zeroOrOtherKeys(`${travelVerb} <1 minute to`, `${travelVerb} xx minute to`)
210
226
  case segmentCategories.WALK_DOWN: return zeroOrOtherKeys(`${travelVerb} <1 minute down to`, `${travelVerb} xx minute down to`)
211
227
  case segmentCategories.WALK_UP: return zeroOrOtherKeys(`${travelVerb} <1 minute up to`, `${travelVerb} xx minute up to`)
212
- // todo add stops for train and bus if needed
213
228
  case segmentCategories.TRAIN: return zeroOrOtherKeys('Take train <1 minute', 'Take train xx minute')
214
229
  case segmentCategories.BUS: return zeroOrOtherKeys('Take bus <1 minute', 'Take bus xx minute')
215
- case segmentCategories.SECURITY_CHECKPOINT: return securityLaneName
216
- ? T('wayfinder:Through _security_ to', { name: securityLaneName })
217
- : T('wayfinder:Through security to')
230
+ case segmentCategories.SECURITY_CHECKPOINT: {
231
+ return T('wayfinder:Through')
232
+ }
218
233
  case segmentCategories.RAMP: return T('wayfinder:Take ramp to')
219
234
  case segmentCategories.RAMP_UP: return T('wayfinder:Take ramp up to')
220
235
  case segmentCategories.RAMP_DOWN: return T('wayfinder:Take ramp down to')
@@ -242,4 +257,39 @@ const findPropWaypoints = propName => R.compose(
242
257
  R.find(R.prop(propName)),
243
258
  R.drop(1)); // because first waypoint is the end of previous segment and can be security checkpoint
244
259
 
260
+ /**
261
+ * Given an array of waypoints (with exactly one having portalType "Security Checkpoint")
262
+ * and an array of securityPois, this function uses the checkpoint's position
263
+ * to determine the closest security POI.
264
+ *
265
+ * @param {Array} waypoints - Array of waypoint objects.
266
+ * @param {Array} securityPois - Array of security POI objects.
267
+ * @returns {string|null} - The name of the closest security POI, or null if none found.
268
+ */
269
+ const getClosestSecurityPoiTitle = (waypoints, securityPois) => {
270
+ if (!waypoints || waypoints.length === 0) return null
271
+
272
+ const checkpointWaypoint = waypoints[0];
273
+ const { lat, lng, floorId } = checkpointWaypoint.position;
274
+ // Use all POIs with a valid position on the same floor as the checkpoint.
275
+ const sameFloorCandidates = securityPois.filter(
276
+ poi => poi.position && poi.position.floorId === floorId
277
+ );
278
+ let closest = null;
279
+ let minDistance = Infinity;
280
+ sameFloorCandidates.forEach(poi => {
281
+ const d = geodesy.distance(
282
+ lat,
283
+ lng,
284
+ poi.position.latitude,
285
+ poi.position.longitude
286
+ );
287
+ if (d < minDistance) {
288
+ minDistance = d;
289
+ closest = poi;
290
+ }
291
+ });
292
+ return closest ? closest.name : null
293
+ };
294
+
245
295
  module.exports = getSteps;
@@ -119,9 +119,17 @@ function create (app, config) {
119
119
  structureLookup.floorIdToStructureId,
120
120
  securityLanesMap
121
121
  );
122
+ const nodesToAvoid = await createNodesToAvoid(graph);
123
+ graph.addNodesToAvoid(nodesToAvoid);
122
124
  graphLoadedProm.resolve(graph);
123
125
  });
124
126
 
127
+ async function createNodesToAvoid (graph) {
128
+ const poisToAvoid = await app.bus.get('dynamicRouting/poisToAvoid');
129
+ const nodesToAvoid = poisToAvoid.map(poi => graph.findClosestNode(poi.position.floorId, poi.position.latitude, poi.position.longitude).id);
130
+ return nodesToAvoid
131
+ }
132
+
125
133
  const prepareSecurityLanes = async () => {
126
134
  const securityPois = await app.bus.get('poi/getByCategoryId', { categoryId: 'security' });
127
135
  return R__namespace.pipe(R__namespace.map(getSecurityLane), R__namespace.filter(R__namespace.identity))(securityPois)
@@ -295,6 +303,13 @@ function create (app, config) {
295
303
  * @return {(Route|null)} route - route or null if no route available
296
304
  */
297
305
  async function getRoute ({ fromEndpoint, toEndpoint, options = {} }) {
306
+ const rawPois = await app.bus.get('poi/getAll') || {};
307
+ // Extract the POI objects (assuming rawPois is an array with one object)
308
+ const allPois = Array.isArray(rawPois) ? rawPois[0] : rawPois;
309
+ // Convert the object values to an array and filter by category
310
+ const securityPois = Object.values(allPois).filter(
311
+ poi => poi.category && poi.category.startsWith('security')
312
+ );
298
313
  return graphLoadedProm
299
314
  .then(async graph => {
300
315
  options.compareFindPaths = config.compareFindPaths;
@@ -305,14 +320,16 @@ function create (app, config) {
305
320
  const floorIdToNameMap = await app.bus.get('venueData/getFloorIdToNameMap');
306
321
  const queueTypes = await app.bus.get('venueData/getQueueTypes');
307
322
  const translate = app.gt();
308
- options.requiresAccessibility;
323
+ const isAccessible = options.requiresAccessibility;
309
324
  const { steps, segments } = segmentBuilder.buildSegments(
310
325
  route.waypoints,
311
326
  fromEndpoint,
312
327
  toEndpoint,
313
328
  floorIdToNameMap,
314
329
  translate,
315
- queueTypes);
330
+ queueTypes,
331
+ isAccessible,
332
+ securityPois);
316
333
 
317
334
  log.info('route', route);
318
335
  const time = Math.round(route.waypoints.reduce((total, { eta }) => total + eta, 0));
@@ -1 +1 @@
1
- var e="web-engine",s="3.3.387",o="UNLICENSED",l="module",t="src/main.js",r=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:a11y":"APPLITOOLS_IS_DISABLED=true && cypress open --browser chrome --env INPUT_MODALITY='keyboard'","cypress:comp":"APPLITOOLS_IS_DISABLED=true && cypress open --component --browser chrome","cypress:e2e":"APPLITOOLS_IS_DISABLED=true && cypress open --e2e --browser chrome",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eSDKTest:"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./cypress/e2e/sdk && npx http-server' 8080 'yarn cypress run --spec cypress/e2e/sdk/**'",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",i18nOverrides:"yarn node utils/i18nOverrideCli src/i18n src/i18n-overrides",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest"},i=["defaults"],n={react:"^18.3.1"},c={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.1.0","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^8.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-default-theme":"^0.0.113","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@locus-labs/mol-desktop-building-level-selector":"^0.1.119","@locus-labs/mol-desktop-compass":"^0.1.120","@locus-labs/mol-desktop-default-theme":"^0.2.105","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-logo":"^0.1.101","@locus-labs/mol-desktop-map-nav-button":"^0.1.130","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.141","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-floating-action-button":"^0.0.117","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.4.3","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.4","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1","axe-core":"^4.9.0",browserslist:"^4.24.2","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.1",jsdom:"^25.0.1",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^1.6.0","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.3.1","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-virtualized-auto-sizer":"^1.0.2","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.14","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-cypress":"^3.47.0","@babel/core":"^7.26.0","@babel/eslint-parser":"^7.25.9","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.25.9","@babel/plugin-transform-runtime":"^7.25.9","@babel/preset-env":"^7.26.0","@babel/preset-react":"^7.25.9","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.0","babel-plugin-styled-components":"^2.1.4","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^12.17.2","cypress-browser-permissions":"^1.1.0","cypress-real-events":"^1.11.0","cypress-wait-until":"^1.7.1",eslint:"^8.57.0","eslint-config-standard":"^16.0.3","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",glob:"^10.3.3",husky:"^6.0.0",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",nx:"19.4.2","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.0",typescript:"^5.4.5",vite:"^4.3.9",vitest:"^2.1.5",webpack:"^5.96.1","webpack-merge":"^6.0.1"},d="yarn@4.3.1",m={node:"20.x"},u={},b={name:e,version:s,private:!0,license:o,type:l,main:t,workspaces:r,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,resolutions:n,dependencies:c,devDependencies:p,packageManager:d,engines:m,nx:u};export{i as browserslist,b as default,c as dependencies,p as devDependencies,m as engines,o as license,t as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,l as type,s as version,r as workspaces};
1
+ var e="web-engine",s="3.3.389",o="UNLICENSED",l="module",t="src/main.js",r=["demo","deploy","nodesdk","src/extModules/flexapi","services/*","libraries/*"],a={colors:"cat utils/colors1.txt && node utils/processColors.js | pbcopy && cat utils/colors2.txt","cypress:a11y":"APPLITOOLS_IS_DISABLED=true && cypress open --browser chrome --env INPUT_MODALITY='keyboard'","cypress:comp":"APPLITOOLS_IS_DISABLED=true && cypress open --component --browser chrome","cypress:e2e":"APPLITOOLS_IS_DISABLED=true && cypress open --e2e --browser chrome",demo:"cd demo/ && yarn start","e2e:comp":"cypress run --component","e2e:record":"yarn cypress run --env RECORD_MODE=true",e2eSDKTest:"yarn start-server-and-test 'cd ./deploy && yarn buildDev && yarn serveLocal' 8085 'cd ./cypress/e2e/sdk && npx http-server' 8080 'yarn cypress run --spec cypress/e2e/sdk/**'",goProd:"cd deploy && scripts/goProd.sh",goStaging:"deploy/scripts/goStaging.sh",i18nOverrides:"yarn node utils/i18nOverrideCli src/i18n src/i18n-overrides",lint:"eslint .",mod:"demo/startMod.sh",mol:"demo/startMol.sh","mol:build":"demo/startMolBuild.sh",molProd:"cd deploy && yarn buildAndRunMol",prepare:"husky install",test:"jest --no-cache --verbose","test-watch":"jest --verbose --watch","test:vitest":"vitest run"},i=["defaults"],n={react:"^18.3.1"},c={"@azure/event-hubs":"^5.12.2","@dnd-kit/core":"^6.1.0","@dnd-kit/modifiers":"^7.0.0","@dnd-kit/sortable":"^8.0.0","@dnd-kit/utilities":"^3.2.2","@locus-labs/mod-badge":"^0.1.102","@locus-labs/mod-default-theme":"^0.0.113","@locus-labs/mod-footer":"^0.0.111","@locus-labs/mod-header":"^0.0.105","@locus-labs/mod-location-marker":"^0.0.104","@locus-labs/mod-map-legend":"^0.0.104","@locus-labs/mod-offscreen-indicator":"^0.0.104","@locus-labs/mod-pin":"^0.0.104","@locus-labs/mod-qr-code-card":"^0.0.104","@locus-labs/mod-qr-code-window":"^0.0.105","@locus-labs/mod-walk-time-matrix":"^0.0.103","@locus-labs/mol-desktop-building-level-selector":"^0.1.119","@locus-labs/mol-desktop-compass":"^0.1.120","@locus-labs/mol-desktop-default-theme":"^0.2.105","@locus-labs/mol-desktop-icon":"^0.1.131","@locus-labs/mol-desktop-logo":"^0.1.101","@locus-labs/mol-desktop-map-nav-button":"^0.1.130","@locus-labs/mol-desktop-tooltip":"^0.3.102","@locus-labs/mol-desktop-zoom-control":"^0.1.141","@locus-labs/mol-mobile-box":"^0.1.115","@locus-labs/mol-mobile-floating-action-button":"^0.0.117","@locus-labs/mol-mobile-icon":"^0.1.118","@locus-labs/mol-mobile-text":"^0.1.116","@locus-labs/mol-mobile-toast":"^0.1.102","@mapbox/mapbox-gl-draw":"^1.4.3","@mapbox/mapbox-gl-draw-static-mode":"^1.0.1","@microsoft/applicationinsights-web":"^3.3.4","@turf/circle":"^6.5.0","@turf/helpers":"^6.5.0","@turf/point-to-line-distance":"^6.5.0","@vitejs/plugin-react":"^4.0.1","axe-core":"^4.9.0",browserslist:"^4.24.2","crypto-browserify":"^3.12.0","cypress-axe":"^1.5.0","cypress-multi-reporters":"^1.6.4","file-loader":"^6.2.0",flexsearch:"^0.7.43","h3-js":"^4.1.0",i18next:"^20.3.4","i18next-browser-languagedetector":"^6.1.1","jest-transform-css":"6.0.1",jsdom:"^25.0.1",jsonschema:"^1.2.6",luxon:"^3.3.0","maplibre-gl":"^4.7.1","mini-css-extract-plugin":"^1.6.0","mocha-junit-reporter":"^2.2.1",mochawesome:"^7.1.3","node-polyfill-webpack-plugin":"^1.1.4","path-browserify":"^1.0.1",polished:"^4.0.2","prop-types":"^15.7.2","query-string":"^8.1.0",ramda:"^0.30.1",react:"^18.3.1","react-compound-slider":"^3.3.1","react-dom":"^18.3.1","react-json-editor-ajrm":"^2.5.13","react-qr-svg":"^2.2.1","react-svg":"^16.1.29","react-virtualized-auto-sizer":"^1.0.2","react-window":"^1.8.11","smoothscroll-polyfill":"^0.4.4","styled-components":"^6.1.14","styled-normalize":"^8.0.6","throttle-debounce":"^3.0.1",trackjs:"^3.7.4","ua-parser-js":"^0.7.23",uuid:"3.3.2",zousan:"^3.0.1","zousan-plus":"^4.0.1"},p={"@applitools/eyes-cypress":"^3.47.0","@babel/core":"^7.26.0","@babel/eslint-parser":"^7.25.9","@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-syntax-import-assertions":"^7.26.0","@babel/plugin-transform-modules-commonjs":"^7.25.9","@babel/plugin-transform-runtime":"^7.25.9","@babel/preset-env":"^7.26.0","@babel/preset-react":"^7.25.9","@testing-library/jest-dom":"^6.6.3","@types/react":"^19.0.10","@types/react-dom":"^19.0.4","@typescript-eslint/eslint-plugin":"^7.13.0","@typescript-eslint/parser":"^7.13.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","babel-plugin-inline-json-import":"^0.3.2","babel-plugin-module-resolver":"^5.0.0","babel-plugin-styled-components":"^2.1.4","babel-polyfill":"^6.26.0","chai-colors":"^1.0.1","css-loader":"^5.2.4",cypress:"^12.17.2","cypress-browser-permissions":"^1.1.0","cypress-real-events":"^1.11.0","cypress-wait-until":"^1.7.1",eslint:"^8.57.0","eslint-config-standard":"^16.0.3","eslint-import-resolver-typescript":"^3.6.1","eslint-plugin-cypress":"^2.11.1","eslint-plugin-import":"^2.16.0","eslint-plugin-jest":"^28.6.0","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^5.1.0","eslint-plugin-react":"^7.12.4","eslint-plugin-standard":"^5.0.0","fetch-mock-jest":"^1.3.0",glob:"^10.3.3",husky:"^6.0.0",jest:"29.7.0","jest-environment-jsdom":"^29.7.0","lint-staged":"^11.0.1","node-fetch":"^2.6.0","null-loader":"^4.0.1",nx:"19.4.2","nx-remotecache-azure":"^19.0.0","start-server-and-test":"^2.0.0",typescript:"^5.4.5",vite:"^4.3.9",vitest:"^2.1.5",webpack:"^5.96.1","webpack-merge":"^6.0.1"},d="yarn@4.3.1",m={node:"20.x"},u={},b={name:e,version:s,private:!0,license:o,type:l,main:t,workspaces:r,scripts:a,"lint-staged":{"*.js":["eslint --fix"]},browserslist:i,resolutions:n,dependencies:c,devDependencies:p,packageManager:d,engines:m,nx:u};export{i as browserslist,b as default,c as dependencies,p as devDependencies,m as engines,o as license,t as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,l as type,s as version,r as workspaces};
@@ -0,0 +1 @@
1
+ const a={868:{category:"portal",description:"Elevator",poiId:"868",position:{floorId:"staticdca-terminals-departures",latitude:38.851973,longitude:-77.082142},dynamicData:{"dynamic-routing":{navGraphHidden:!0,navGraphHiddenReason:"reason 2",expiration:2055958719e3}}},869:{category:"portal",description:"Elevator",poiId:"869",position:{floorId:"staticdca-terminals-departures",latitude:38.851973,longitude:-77.082142},dynamicData:{"dynamic-routing":{navGraphHidden:!0,navGraphHiddenReason:"reason 2",expiration:2055958719e3}}}};export{a as dynamicRoutingData};
@@ -1 +1 @@
1
- import e from"zousan";import{processParkingPOIS as t,processSecurityWaitTimes as n,mutateSecurityCheckpointLabel as a,processOpenClosedPois as s}from"./processors.js";let o=3e4;const c="x-account-id";function i(i,r={}){const u={dynamicDataNotPending:new e},d=i.gt();r._overrideRefreshFrequency&&(o=r._overrideRefreshFrequency),i.bus.on("system/readywhenyouare",(()=>u.dynamicDataNotPending));const y=async e=>{const t={};for(const n of e){const e=await i.bus.get("poi/getById",{id:n});e&&(t[n]=e.name)}return t};return{init:async()=>{const[e,r]=await Promise.all([i.bus.get("venueData/getAccountId"),i.bus.get("venueData/getVenueId")]),l=`https://marketplace.locuslabs.com/venueId/${r}/dynamic-poi`;let p,m=0,g=0;const f=async()=>{const o=await fetch(l,{headers:{[c]:e}});if(o.ok)return o.json().then((({data:e})=>{return function(e){const n=t(e);i.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})}(o=e),function(e){const t=s(e);i.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:t})}(o),void async function(e){const t=n(e);i.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:t});const s=await y(Object.keys(t));i.bus.send("map/mutateFeature",{functor:a(d,t,s)})}(o);var o})).then((()=>{g++})).catch(console.error);console.warn("dynamicPois: fetch response status not ok",o),m++,m>=3&&m>g&&clearInterval(p)},D=await i.bus.get("venueData/getQueueTypes");return D.SecurityLane&&D.SecurityLane.length?f().then((()=>{p=setInterval(f,o)})).finally((()=>u.dynamicDataNotPending.resolve(!0))):u.dynamicDataNotPending.resolve(!0)}}}export{i as create};
1
+ import{DateTime as t}from"luxon";import*as n from"ramda";import e from"zousan";import{dynamicRoutingData as a}from"../mocks/mockDynamicRoutingData.js";import{processParkingPOIS as o,processSecurityWaitTimes as i,mutateSecurityCheckpointLabel as s,processOpenClosedPois as c}from"./processors.js";let r=3e4;const u="x-account-id";function d(d,l={}){const m={dynamicDataNotPending:new e,poisToAvoid:new e},p=d.gt();l._overrideRefreshFrequency&&(r=l._overrideRefreshFrequency),d.bus.on("system/readywhenyouare",(()=>m.dynamicDataNotPending)),d.bus.on("dynamicRouting/poisToAvoid",(()=>m.poisToAvoid));const y=async t=>{const n={};for(const e of t){const t=await d.bus.get("poi/getById",{id:e});t&&(n[e]=t.name)}return n};return{init:async()=>{const[e,g]=await Promise.all([d.bus.get("venueData/getAccountId"),d.bus.get("venueData/getVenueId")]),f=`https://marketplace.locuslabs.com/venueId/${g}/dynamic-poi`;let v,h=0,D=0;const b=async()=>{const r=await fetch(f,{headers:{[u]:e}});if(r.ok)return r.json().then((({data:e})=>async function(e){(function(t){const n=o(t);d.bus.send("poi/setDynamicData",{plugin:"parking",idValuesMap:n})})(e),function(t){const n=c(t);d.bus.send("poi/setDynamicData",{plugin:"open-closed-status",idValuesMap:n})}(e),async function(t){const n=i(t);d.bus.send("poi/setDynamicData",{plugin:"security",idValuesMap:n});const e=await y(Object.keys(n));d.bus.send("map/mutateFeature",{functor:s(p,n,e)})}(e),await async function(e){let a=[];if(!l.dynamicRoutingEnabled)return void m.poisToAvoid.resolve(a);const o=t.now().toMillis(),i=Object.values(n.filter((t=>{const e=n.path(["dynamicData","dynamic-routing","navGraphHidden"],t),a=n.path(["dynamicData","dynamic-routing","expiration"],t);return!0===e&&a>o}),e));if(i.length>0){const t=await d.bus.get("poi/getAll");a=Object.values(t).length>0?i.map((n=>t[n?.poiId])):[]}m.poisToAvoid.resolve(a)}(a)}(e))).then((()=>{D++})).catch(console.error);console.warn("dynamicPois: fetch response status not ok",r),h++,h>=3&&h>D&&clearInterval(v)},w=await d.bus.get("venueData/getQueueTypes");return w.SecurityLane&&w.SecurityLane.length?b().then((()=>{v=setInterval(b,r)})).finally((()=>m.dynamicDataNotPending.resolve(!0))):m.dynamicDataNotPending.resolve(!0)}}}export{d as create};
@@ -1 +1 @@
1
- import{pick as t,isNil as o,map as n,omit as e,path as r}from"ramda";import{encode as i,calculateAdjacent as s}from"../../../src/extModules/geohasher.js";import{distance as l}from"../../../src/utils/geodesy.js";import u from"./minPriorityQueue.js";function d(r,s,l,u){const d={},c={};let a={};r.nodes.forEach((o=>{const n=s(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+i(t.lat,t.lng).substr(0,7),n=t.floorId+":"+i(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){return t.x?"Security Checkpoint":""===t.t?"Ground":t.t}(t),r="escalator"!==e.toLowerCase()&&"stairs"!==e.toLowerCase(),i=f(t.s,t.d,n),s=t.l||i/60,l=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]}}))),u=t.p?l(t.p):null;return{distance:i,dst:t.d,o:t.o,isAccessible:r,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:s,type:e,path:u,weight:s}}(t,d))));const h=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):C(t.ordinal,o,n,d)};return{_nodes:d,_geoDb:c,findClosestNode:(t,o,n)=>w(t,o,n,c,d),findShortestPath:(t,o,n)=>function(t,o,n,e={}){return I(h(t),h(o),n,a,u,e)}(t,o,d,n),findAllShortestPaths:function(t,o,n){const e=h(t),r=o.map((t=>h(t)));return e&&r.length?function(t,o,n,e={},r={},i={}){return o.map((o=>{try{return I(t,o,n,e,r,i)}catch(t){return null}}))}(e,r,d,a,u,n):[]},floorIdToOrdinal:s,floorIdToStructureId:l,updateWithSecurityWaitTime:function(t){a=n(e(["lastUpdated"]),t),y()},clearCache:y}}function f(t,o,n){const e=n[t],r=n[o];return l(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={}){for(t.id===g&&m===JSON.stringify(s)||(y(),p.offerWithPriority(t.id,0),c[t.id]=0,h[t.id]=!0,g=t.id,m=JSON.stringify(s));!p.isEmpty()&&!h[o.id];){const t=n[p.poll()],o=c[t.id];for(let n=0;n<t.edges.length;n++){const l=t.edges[n];if(h[l.dst])continue;if(s.requiresAccessibility&&!l.isAccessible)continue;let u=l.weight;if(l.o&&e[l.o]){const t=e[l.o];t.queueTime&&(u=t.queueTime),t.isTemporarilyClosed&&(u=9999),l.securityWaitTimes=t}if(l.o&&i[l.o]){l.securityLane=i[l.o];const{type:t,id:o}=i[l.o],n=r(["selectedSecurityLanes",t],s);if(n&&!n.includes(o))continue}void 0===c[l.dst]?(a[l.dst]=t,c[l.dst]=o+u,p.offerWithPriority(l.dst,o+u)):c[l.dst]>o+u&&(c[l.dst]=o+u,a[l.dst]=t,p.raisePriority(l.dst,o+u))}h[t.id]=!0}if(!h[o.id])return null;const l=[];let u=o;for(;u;)l.push(u),u=a[u.id];return l.reverse()}function b(t,o,n,e){const r=o.substr(0,e),i=[];i.push(t+":"+s(s(r,"top"),"left")),i.push(t+":"+s(r,"top")),i.push(t+":"+s(s(r,"top"),"right")),i.push(t+":"+s(r,"left")),i.push(t+":"+r),i.push(t+":"+s(r,"right")),i.push(t+":"+s(s(r,"bottom"),"left")),i.push(t+":"+s(r,"bottom")),i.push(t+":"+s(s(r,"bottom"),"right"));const l=[];for(let t=0;t<i.length;t++){const o=n[i[t]];if(o)for(let t=0;t<o.length;t++)l.push(o[t])}return l}function w(t,o,n,e,r){const s=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,i(o,n),e)||function(t,o,n,e){const r=Object.values(e).filter((o=>o.floorId===t)).map((t=>[t,l(t.lat,t.lng,o,n)]));if(!r.length)throw Error(`findClosestNodeByFloor2 found no nodes on floor ${t}`);return S(r)}(t,o,n,r),u=[];for(let t=0;t<s.length;t++){const e=l(o,n,s[t].lat,s[t].lng);u.push([s[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 C(t,o,n,e){const r=Object.values(e).filter((o=>o.ordinal===t)).map((t=>[t,l(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++)t[n][1]<o[1]&&(o=t[n]);return o[0]}export{d as createNavGraph,C 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{encode as i,calculateAdjacent as s}from"../../../src/extModules/geohasher.js";import{distance as l}from"../../../src/utils/geodesy.js";import d from"./minPriorityQueue.js";function u(r,s,l,d){const u={},c={},a=new Set;let h={};r.nodes.forEach((o=>{const n=s(o.floorId),e=l(o.floorId);!function(t){const o=t.floorId+":"+i(t.lat,t.lng).substr(0,7),n=t.floorId+":"+i(t.lat,t.lng).substr(0,8);c[o]||(c[o]=[]);c[o].push(t),c[n]||(c[n]=[]);c[n].push(t),u[t.id]=t}({...t(["id","lat","lng","floorId"],o),edges:[],ordinal:n,structureId:e})})),r.edges.forEach((t=>u[t.s].edges.push(function(t,n){const e=function(t){return t.x?"Security Checkpoint":""===t.t?"Ground":t.t}(t),r="escalator"!==e.toLowerCase()&&"stairs"!==e.toLowerCase(),i=f(t.s,t.d,n),s=t.l||i/60,l=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?l(t.p):null;return{distance:i,dst:t.d,o:t.o,isAccessible:r,isDriveway:!o(t.h)&&!t.h,src:t.s,transitTime:s,type:e,path:d,weight:s}}(t,u))));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,u):T(t.ordinal,o,n,u)};return{_nodes:u,_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,u),findShortestPath:(t,o,n)=>function(t,o,n,e={}){return I(p(t),p(o),n,a,h,d,e)}(t,o,u,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(t){return null}}))}(e,r,u,a,h,d,n):[]},floorIdToOrdinal:s,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 l(e.lat,e.lng,r.lat,r.lng)}let c,a,h,p,g,m;const y=()=>{c={},a={},h={},p=new d,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 d=t.edges[n];if(e.size>0&&e.has(d.dst))continue;if(h[d.dst])continue;if(l.requiresAccessibility&&!d.isAccessible)continue;let u=d.weight;if(d.o&&i[d.o]){const t=i[d.o];t.queueTime&&(u=t.queueTime),t.isTemporarilyClosed&&(u=9999),d.securityWaitTimes=t}if(d.o&&s[d.o]){d.securityLane=s[d.o];const{type:t,id:o}=s[d.o],n=r(["selectedSecurityLanes",t],l);if(n&&!n.includes(o))continue}void 0===c[d.dst]?(a[d.dst]=t,c[d.dst]=o+u,p.offerWithPriority(d.dst,o+u)):c[d.dst]>o+u&&(c[d.dst]=o+u,a[d.dst]=t,p.raisePriority(d.dst,o+u))}h[t.id]=!0}if(!h[o.id])return null;const d=[];let u=o;for(;u;)d.push(u),u=a[u.id];return d.reverse()}function b(t,o,n,e){const r=o.substr(0,e),i=[];i.push(t+":"+s(s(r,"top"),"left")),i.push(t+":"+s(r,"top")),i.push(t+":"+s(s(r,"top"),"right")),i.push(t+":"+s(r,"left")),i.push(t+":"+r),i.push(t+":"+s(r,"right")),i.push(t+":"+s(s(r,"bottom"),"left")),i.push(t+":"+s(r,"bottom")),i.push(t+":"+s(s(r,"bottom"),"right"));const l=[];for(let t=0;t<i.length;t++){const o=n[i[t]];if(o)for(let t=0;t<o.length;t++)l.push(o[t])}return l}function w(t,o,n,e,r){const s=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,i(o,n),e)||function(t,o,n,e){const r=Object.values(e).filter((o=>o.floorId===t)).map((t=>[t,l(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),d=[];for(let t=0;t<s.length;t++){const e=l(o,n,s[t].lat,s[t].lng);d.push([s[t],e])}d.sort((function(t,o){return t[1]-o[1]}));const u=[];for(let t=0;t<d.length;t++)u.push(d[t][0]);return u[0]}function T(t,o,n,e){const r=Object.values(e).filter((o=>o.ordinal===t)).map((t=>[t,l(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{u as createNavGraph,T 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:"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,p,l,g,y)=>{let c=r(t);c=n(c),s&&c[0].coordinates.unshift([s.lng,s.lat]),i&&e.last(c).coordinates.push([i.lng,i.lat]);return{segments:c.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},p=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=c[a+1];p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=p,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(c,e.prop("title",s),e.prop("title",i),p,l,g)}};export{s as buildSegments};
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:"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,p,l,g,y,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},p=[];if(o.WALKING_TO_PORTAL===t.segmentCategory){const t=m[a+1];p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)})}else o.START!==t.segmentCategory&&p.push({canonicalName:`wayfinding.${t.segmentCategory}`,coordinates:e.last(r)});return i.badges=p,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),p,l,g,y,c)}};export{s as buildSegments};
@@ -1 +1 @@
1
- import{compose as e,not as t,includes as r,__ as a,toLower as n,prop as s,last as c,find as u,propEq as i,drop as T}from"ramda";import{findBoundsOfWaypoints as o}from"../../../src/utils/bounds.js";import A from"./segmentBadges.js";import _ from"./segmentCategories.js";function R(e,t="",r="",a,n,u={},i){return e.map(((i,T)=>{const R=N("securityWaitTimes")(i.waypoints),L=R&&!R.isTemporarilyClosed?R.queueTime:Math.round(1===(y=i.waypoints).length?y[0].eta:y.map(s("eta")).slice(1).reduce(((e,t)=>e+t),0));var y;const I=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(i.waypoints)),m=function(e){switch(e){case _.START:return A.START;case _.WALKING_TO_END:return A.END;case _.ELEVATOR:return A.ELEVATOR;case _.ELEVATOR_UP:return A.ELEVATOR_UP;case _.ELEVATOR_DOWN:return A.ELEVATOR_DOWN;case _.STAIRS:return A.STAIRS;case _.STAIRS_UP:return A.STAIRS_UP;case _.STAIRS_DOWN:return A.STAIRS_DOWN;case _.ESCALATOR:return A.ESCALATOR;case _.ESCALATOR_UP:return A.ESCALATOR_UP;case _.ESCALATOR_DOWN:return A.ESCALATOR_DOWN;case _.WALKING_TO_PORTAL:case _.WALK:case _.WALK_DOWN:case _.WALK_UP:return A.WALK;case _.TRAIN:return A.TRAIN;case _.TRAIN_UP:return A.TRAIN_UP;case _.TRAIN_DOWN:return A.TRAIN_DOWN;case _.BUS:return A.BUS;case _.BUS_UP:return A.BUS_UP;case _.BUS_DOWN:return A.BUS_DOWN;case _.SECURITY_CHECKPOINT:return A.SECURITY_CHECKPOINT;case _.RAMP:return A.RAMP;case _.RAMP_UP:return A.RAMP_UP;case _.RAMP_DOWN:return A.RAMP_DOWN;default:return A.WALK}}(i.segmentCategory),p=function(e,t){let r;switch(e){case _.START:r=0;break;case _.WALKING_TO_END:r=t.length-1;break;case _.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(i.segmentCategory,i.waypoints),P=function(e,t,r,a,n,s){const u=e[t];switch(u.segmentCategory){case _.START:return O(u.waypoints[0].position,r);case _.WALKING_TO_END:return O(u.waypoints[u.waypoints.length-1].position,a);case _.WALKING_TO_SECURITY_CHECKPOINT:case _.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case _.SECURITY_CHECKPOINT:case _.ELEVATOR:case _.ELEVATOR_DOWN:case _.ELEVATOR_UP:case _.ESCALATOR:case _.ESCALATOR_DOWN:case _.ESCALATOR_UP:case _.STAIRS:case _.STAIRS_DOWN:case _.STAIRS_UP:return function(e,t){return t[c(e.waypoints).position.floorId]}(u,n);default:return s(`wayfinder:${u.type}`)}}(e,T,t,r,a,n),W=function(e,t,r,a){const n=S(t,a),s="Proceed";switch(e.segmentCategory){case _.START:return a("wayfinder:Begin route at");case _.ELEVATOR:return a("wayfinder:Take elevator to");case _.ELEVATOR_UP:return a("wayfinder:Take elevator up to");case _.ELEVATOR_DOWN:return a("wayfinder:Take elevator down to");case _.STAIRS:return a("wayfinder:Take stairs to");case _.STAIRS_UP:return a("wayfinder:Take stairs up to");case _.STAIRS_DOWN:return a("wayfinder:Take stairs down to");case _.ESCALATOR:return a("wayfinder:Take escalator to");case _.ESCALATOR_UP:return a("wayfinder:Take escalator up to");case _.ESCALATOR_DOWN:return a("wayfinder:Take escalator down to");case _.WALK:case _.WALKING_TO_SECURITY_CHECKPOINT:case _.WALKING_TO_PORTAL:case _.WALKING_TO_END:return n(`${s} <1 minute to`,`${s} xx minute to`);case _.WALK_DOWN:return n(`${s} <1 minute down to`,`${s} xx minute down to`);case _.WALK_UP:return n(`${s} <1 minute up to`,`${s} xx minute up to`);case _.TRAIN:return n("Take train <1 minute","Take train xx minute");case _.BUS:return n("Take bus <1 minute","Take bus xx minute");case _.SECURITY_CHECKPOINT:return r?a("wayfinder:Through _security_ to",{name:r}):a("wayfinder:Through security to");case _.RAMP:return a("wayfinder:Take ramp to");case _.RAMP_UP:return a("wayfinder:Take ramp up to");case _.RAMP_DOWN:return a("wayfinder:Take ramp down to");default:return""}}(i,L,d(u,i.waypoints),n),w={primaryText:P,secondaryText:W,icon:m,animationAnchor:p,eta:L,distance:I,bounds:o(i.waypoints),isAccessible:E(i),securityWaitTimes:R};return i.poiId&&(w.poiId=i.poiId),w}))}function O(e,t){return e.name?e.name:t}const S=(e,t)=>(r,a)=>0===e?t("wayfinder:"+r):t("wayfinder:"+a,{count:e}),E=e(t,r(a,["escalator","stairs"]),n,s("type")),d=(e,t)=>{const r=N("securityLane")(t);if(!r)return;const a=s(r.type,e),n=u(i(r.id,"id"),a);return s("displayText",n)},N=t=>e(s(t),u(s(t)),T(1));export{R as default};
1
+ import{compose as e,not as t,includes as r,__ as n,toLower as a,prop as s,last as i,find as o,propEq as u,drop as c}from"ramda";import{findBoundsOfWaypoints as T}from"../../../src/utils/bounds.js";import{distance as A}from"../../../src/utils/geodesy.js";import _ from"./segmentBadges.js";import R from"./segmentCategories.js";function O(e,t="",r="",n,a,i={},o,u=[]){return e.map(((o,c)=>{const A=l("securityWaitTimes")(o.waypoints),O=A&&!A.isTemporarilyClosed?A.queueTime:Math.round(1===(N=o.waypoints).length?N[0].eta:N.map(s("eta")).slice(1).reduce(((e,t)=>e+t),0));var N;const I=Math.round(function(e){return 1===e.length?e[0].distance:e.map((e=>e.distance)).slice(1).reduce(((e,t)=>e+t),0)}(o.waypoints)),f=function(e){switch(e){case R.START:return _.START;case R.WALKING_TO_END:return _.END;case R.ELEVATOR:return _.ELEVATOR;case R.ELEVATOR_UP:return _.ELEVATOR_UP;case R.ELEVATOR_DOWN:return _.ELEVATOR_DOWN;case R.STAIRS:return _.STAIRS;case R.STAIRS_UP:return _.STAIRS_UP;case R.STAIRS_DOWN:return _.STAIRS_DOWN;case R.ESCALATOR:return _.ESCALATOR;case R.ESCALATOR_UP:return _.ESCALATOR_UP;case R.ESCALATOR_DOWN:return _.ESCALATOR_DOWN;case R.WALKING_TO_PORTAL:case R.WALK:case R.WALK_DOWN:case R.WALK_UP:return _.WALK;case R.TRAIN:return _.TRAIN;case R.TRAIN_UP:return _.TRAIN_UP;case R.TRAIN_DOWN:return _.TRAIN_DOWN;case R.BUS:return _.BUS;case R.BUS_UP:return _.BUS_UP;case R.BUS_DOWN:return _.BUS_DOWN;case R.SECURITY_CHECKPOINT:return _.SECURITY_CHECKPOINT;case R.RAMP:return _.RAMP;case R.RAMP_UP:return _.RAMP_UP;case R.RAMP_DOWN:return _.RAMP_DOWN;default:return _.WALK}}(o.segmentCategory),m=function(e,t){let r;switch(e){case R.START:r=0;break;case R.WALKING_TO_END:r=t.length-1;break;case R.WALKING_TO_PORTAL:r=Math.min(t.length-1,Math.ceil(t.length/2));break;default:r=t.length-1}return t[r].position}(o.segmentCategory,o.waypoints),w=function(e,t,r,n,a,s,i,o){const u=e[t];switch(u.segmentCategory){case R.START:return d(u.waypoints[0].position,r);case R.WALKING_TO_END:return d(u.waypoints[u.waypoints.length-1].position,n);case R.WALKING_TO_SECURITY_CHECKPOINT:{const r=e[t+1].waypoints,n=p(o,r),a=s("wayfinder:Security Lane"),c=n?`${n} ${a}`:null,T=L(r,i);return c||T||s(`wayfinder:${u.type}`)}case R.WALKING_TO_PORTAL:return s(`wayfinder:${e[t+1].type}`);case R.SECURITY_CHECKPOINT:{const e=p(o,u.waypoints),t=s("wayfinder:Security Lane"),r=e?`${e} ${t}`:null,n=L(u.waypoints,i);return r||n||S(u,a)}case R.ELEVATOR:case R.ELEVATOR_DOWN:case R.ELEVATOR_UP:case R.ESCALATOR:case R.ESCALATOR_DOWN:case R.ESCALATOR_UP:case R.STAIRS:case R.STAIRS_DOWN:case R.STAIRS_UP:return S(u,a);default:return s(`wayfinder:${u.type}`)}}(e,c,t,r,n,a,u,i),P=function(e,t,r){const n=E(t,r),a="Proceed";switch(e.segmentCategory){case R.START:return r("wayfinder:Begin route at");case R.ELEVATOR:return r("wayfinder:Take elevator to");case R.ELEVATOR_UP:return r("wayfinder:Take elevator up to");case R.ELEVATOR_DOWN:return r("wayfinder:Take elevator down to");case R.STAIRS:return r("wayfinder:Take stairs to");case R.STAIRS_UP:return r("wayfinder:Take stairs up to");case R.STAIRS_DOWN:return r("wayfinder:Take stairs down to");case R.ESCALATOR:return r("wayfinder:Take escalator to");case R.ESCALATOR_UP:return r("wayfinder:Take escalator up to");case R.ESCALATOR_DOWN:return r("wayfinder:Take escalator down to");case R.WALK:case R.WALKING_TO_SECURITY_CHECKPOINT:case R.WALKING_TO_PORTAL:case R.WALKING_TO_END:return n(`${a} <1 minute to`,`${a} xx minute to`);case R.WALK_DOWN:return n(`${a} <1 minute down to`,`${a} xx minute down to`);case R.WALK_UP:return n(`${a} <1 minute up to`,`${a} xx minute up to`);case R.TRAIN:return n("Take train <1 minute","Take train xx minute");case R.BUS:return n("Take bus <1 minute","Take bus xx minute");case R.SECURITY_CHECKPOINT:return r("wayfinder:Through");case R.RAMP:return r("wayfinder:Take ramp to");case R.RAMP_UP:return r("wayfinder:Take ramp up to");case R.RAMP_DOWN:return r("wayfinder:Take ramp down to");default:return""}}(o,O,a),W={primaryText:w,secondaryText:P,icon:f,animationAnchor:m,eta:O,distance:I,bounds:T(o.waypoints),isAccessible:y(o),securityWaitTimes:A};return o.poiId&&(W.poiId=o.poiId),W}))}function d(e,t){return e.name?e.name:t}function S(e,t){return t[i(e.waypoints).position.floorId]}const E=(e,t)=>(r,n)=>0===e?t("wayfinder:"+r):t("wayfinder:"+n,{count:e}),y=e(t,r(n,["escalator","stairs"]),a,s("type")),p=(e,t)=>{const r=l("securityLane")(t);if(!r)return;const n=s(r.type,e),a=o(u(r.id,"id"),n);return s("displayText",a)},l=t=>e(s(t),o(s(t)),c(1)),L=(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,u=1/0;return i.forEach((e=>{const t=A(n,a,e.position.latitude,e.position.longitude);t<u&&(u=t,o=e)})),o?o.name:null};export{O 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 y(),a=r(t,e.floorIdToOrdinal,e.floorIdToStructureId,i);f.resolve(a)}));const y=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(m),t.filter(t.identity))(n)},m=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 h=(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 I=["lat","lng","floorId","ordinal"],g=t.pipe(t.pick(I),t.keys,t.propEq(I.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={}}){return f.then((async e=>{o.compareFindPaths=l.compareFindPaths;const r=i(e,t,n,o);if(!r)return null;t.floorId&&n.floorId&&b(t,n,r);const a=await d.bus.get("venueData/getFloorIdToNameMap"),u=await d.bus.get("venueData/getQueueTypes"),c=d.gt();o.requiresAccessibility;const{steps:f,segments:y}=s(r.waypoints,t,n,a,c,u);p.info("route",r);const m=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),h=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:y,steps:f,time:m,distance:h}}))}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 h(t,n.floorIdToOrdinal);if("string"==typeof t){if(t.match(/^\d+$/))return h(parseInt(t),n.floorIdToOrdinal);if(t.indexOf(",")>0){let[o,e,i,r]=t.split(",");if(!n.floorIdToStructureId(i))throw Error("Unknown floorId in endpoint: "+i);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(e),ordinal:n.floorIdToOrdinal(i),floorId:i,title:r}}}if(g(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);const b=(t,n,o)=>d.bus.send("session/submitEvent",{type:"navigation",startPosition:{venueId:t.floorId.split("-")[0],buildingId:o.waypoints[0].position.structureId,floorId:o.waypoints[0].position.floorId,lat:o.waypoints[0].position.lat,lng:o.waypoints[0].position.lng},endPosition:{venueId:n.floorId.split("-")[0],buildingId:o.waypoints[o.waypoints.length-1].position.structureId,floorId:o.waypoints[o.waypoints.length-1].position.floorId,lat:o.waypoints[o.waypoints.length-1].position.lat,lng:o.waypoints[o.waypoints.length-1].position.lng}});function v(n,o,e,i){let r=t.clone(n);return r=E(r,e,i),o&&o.length?{...r,transitTime:S(o,"transitTime"),distance:S(o,"distance")}:(r.distance="start"===i?P(r,e):P(e,r),r.transitTime=L(r.distance),r)}function S(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 P(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 L(t){return t/60}function O(n){const o=n.filter((t=>null!==t));return t.sortBy(t.propOr(1/0,"transitTime"),o)}function q(n,o,e,i,r){const a=F(o,i,n),s=F(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}}}function N(t,n){return t&&t.length?S(t,"transitTime"):L(n)}function F(t,n,o){return t&&t.length?S(t,"distance"):P(o,n)}return d.bus.on("wayfinder/addPathTimeSingle",(async({poi:t,startLocation:n,options:o={}})=>n?f.then((e=>function(t,n,o,e){const i=w(o,t.floorIdToOrdinal),r=t.findShortestPath(e,i,n);return v(o,r,e,"start")}(e,o,t,n))):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 O(r.map(((t,n)=>v(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,options:i={}})=>o||e?f.then((r=>function(n,o,e,i,r){try{const a=t.clone(e),s=a.map((t=>w(t,n.floorIdToOrdinal)));let u,d,l;return i&&(u=n.findAllShortestPaths(i,s,o)),r&&(d=function(t,n,o,e){const i=[];for(const r of n)i.push(t.findShortestPath(r,o,e));return i}(n,s,r,o)),l=i&&r?a.map(((t,n)=>q(t,u[n],d[n],i,r))):i?a.map(((t,n)=>v(t,u[n],i,"start"))):a.map(((t,n)=>v(t,d[n],r,"end"))),O(l)}catch(t){return p.error(t),e}}(r,i,n,o,e))):n)),d.bus.on("wayfinder/multipointAddPathTimeSingle",(async({poi:t,startLocation:n,endLocation:o,options:e={}})=>n||o?f.then((i=>function(t,n,o,e,i){const r=w(o,t.floorIdToOrdinal);let a,s;e&&(a=t.findShortestPath(e,r,n));i&&(s=t.findShortestPath(r,i,n));return e&&i?q(o,a,s,e,i):e?v(o,a,e,"start"):i?v(o,s,i,"end"):o}(i,e,t,n,o))):t)),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:y}}}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 i}from"../../../src/utils/geodesy.js";import{findRoute as e}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 i=o(n),e=await y(),a=r(t,i.floorIdToOrdinal,i.floorIdToStructureId,e),s=await async function(t){const n=(await d.bus.get("dynamicRouting/poisToAvoid")).map((n=>t.findClosestNode(n.position.floorId,n.position.latitude,n.position.longitude).id));return n}(a);a.addNodesToAvoid(s),f.resolve(a)}));const y=async()=>{const n=await d.bus.get("poi/getByCategoryId",{categoryId:"security"});return t.pipe(t.map(m),t.filter(t.identity))(n)},m=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 i=await b({fromEndpoint:t,toEndpoint:n,options:o});if(i){const{segments:t}=i;o.primary&&d.bus.send("map/resetNavlineFeatures"),d.bus.send("map/showNavlineFeatures",{segments:t,category:o.primary?"primary":"alternative"})}return i}(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 b({fromEndpoint:t,toEndpoint:n,options:o={}}){const i=await d.bus.get("poi/getAll")||{},r=Array.isArray(i)?i[0]:i,a=Object.values(r).filter((t=>t.category&&t.category.startsWith("security")));return f.then((async i=>{o.compareFindPaths=l.compareFindPaths;const r=e(i,t,n,o);if(!r)return null;t.floorId&&n.floorId&&T(t,n,r);const u=await d.bus.get("venueData/getFloorIdToNameMap"),c=await d.bus.get("venueData/getQueueTypes"),f=d.gt(),y=o.requiresAccessibility,{steps:m,segments:g}=s(r.waypoints,t,n,u,f,c,y,a);p.info("route",r);const h=Math.round(r.waypoints.reduce(((t,{eta:n})=>t+n),0)),I=Math.round(r.waypoints.reduce(((t,{distance:n})=>t+n),0));return{...r,segments:g,steps:m,time:h,distance:I}}))}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){let[o,i,e,r]=t.split(",");if(!n.floorIdToStructureId(e))throw Error("Unknown floorId in endpoint: "+e);return r||(r="Starting Point"),{lat:parseFloat(o),lng:parseFloat(i),ordinal:n.floorIdToOrdinal(e),floorId:e,title:r}}}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:i={}})=>f.then((r=>{i.compareFindPaths=l.compareFindPaths;const a=e(r,n,o,i);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",b);const T=(t,n,o)=>d.bus.send("session/submitEvent",{type:"navigation",startPosition:{venueId:t.floorId.split("-")[0],buildingId:o.waypoints[0].position.structureId,floorId:o.waypoints[0].position.floorId,lat:o.waypoints[0].position.lat,lng:o.waypoints[0].position.lng},endPosition:{venueId:n.floorId.split("-")[0],buildingId:o.waypoints[o.waypoints.length-1].position.structureId,floorId:o.waypoints[o.waypoints.length-1].position.floorId,lat:o.waypoints[o.waypoints.length-1].position.lat,lng:o.waypoints[o.waypoints.length-1].position.lng}});function v(n,o,i,e){let r=t.clone(n);return r=E(r,i,e),o&&o.length?{...r,transitTime:S(o,"transitTime"),distance:S(o,"distance")}:(r.distance="start"===e?P(r,i):P(i,r),r.transitTime=L(r.distance),r)}function S(n,o){return t.aperture(2,n).map((([n,o])=>{return(i=o.id,n=>t.find((t=>t.dst===i),n.edges))(n);var i})).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 P(t,n){return i(n?.lat||n?.position?.latitude,n?.lng||n?.position?.longitude,t?.lat||t?.position?.latitude,t?.lng||t?.position?.longitude)}function L(t){return t/60}function O(n){const o=n.filter((t=>null!==t));return t.sortBy(t.propOr(1/0,"transitTime"),o)}function A(n,o,i,e,r){const a=q(o,e,n),s=q(i,n,r);if(!a||!s)return null;const u=N(o,a),d=N(i,s);let l=t.clone(n);return l=E(l,e,"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}}}function N(t,n){return t&&t.length?S(t,"transitTime"):L(n)}function q(t,n,o){return t&&t.length?S(t,"distance"):P(o,n)}return d.bus.on("wayfinder/addPathTimeSingle",(async({poi:t,startLocation:n,options:o={}})=>n?f.then((i=>function(t,n,o,i){const e=w(o,t.floorIdToOrdinal),r=t.findShortestPath(i,e,n);return v(o,r,i,"start")}(i,o,t,n))):t)),d.bus.on("wayfinder/addPathTimeMultiple",(async({pois:n,startLocation:o,options:i={}})=>o?f.then((e=>function(n,o,i,e){try{const r=t.clone(i),a=r.map((t=>w(t,n.floorIdToOrdinal))),s=n.findAllShortestPaths(e,a,o);return O(r.map(((t,n)=>v(t,s[n],e,"start"))))}catch(t){return p.error(t),i}}(e,i,n,o))):n)),d.bus.on("wayfinder/multipointAddPathTimeMultiple",(async({pois:n,startLocation:o,endLocation:i,options:e={}})=>o||i?f.then((r=>function(n,o,i,e,r){try{const a=t.clone(i),s=a.map((t=>w(t,n.floorIdToOrdinal)));let u,d,l;return e&&(u=n.findAllShortestPaths(e,s,o)),r&&(d=function(t,n,o,i){const e=[];for(const r of n)e.push(t.findShortestPath(r,o,i));return e}(n,s,r,o)),l=e&&r?a.map(((t,n)=>A(t,u[n],d[n],e,r))):e?a.map(((t,n)=>v(t,u[n],e,"start"))):a.map(((t,n)=>v(t,d[n],r,"end"))),O(l)}catch(t){return p.error(t),i}}(r,e,n,o,i))):n)),d.bus.on("wayfinder/multipointAddPathTimeSingle",(async({poi:t,startLocation:n,endLocation:o,options:i={}})=>n||o?f.then((e=>function(t,n,o,i,e){const r=w(o,t.floorIdToOrdinal);let a,s;i&&(a=t.findShortestPath(i,r,n));e&&(s=t.findShortestPath(r,e,n));return i&&e?A(o,a,s,i,e):i?v(o,a,i,"start"):e?v(o,s,e,"end"):o}(e,i,t,n,o))):t)),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:y}}}export{u as SecurityLaneType,d as create};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.387",
3
+ "version": "3.3.389",
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",