atriusmaps-node-sdk 3.3.390 → 3.3.392

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.390";
6
+ var version = "3.3.392";
7
7
  var license = "UNLICENSED";
8
8
  var type = "module";
9
9
  var main = "src/main.js";
@@ -76,6 +76,9 @@ var dependencies = {
76
76
  "@mapbox/mapbox-gl-draw": "^1.4.3",
77
77
  "@mapbox/mapbox-gl-draw-static-mode": "^1.0.1",
78
78
  "@microsoft/applicationinsights-web": "^3.3.4",
79
+ "@turf/area": "^7.2.0",
80
+ "@turf/bbox-clip": "^7.2.0",
81
+ "@turf/bbox-polygon": "^7.2.0",
79
82
  "@turf/circle": "^6.5.0",
80
83
  "@turf/helpers": "^6.5.0",
81
84
  "@turf/point-to-line-distance": "^6.5.0",
@@ -83,8 +86,9 @@ var dependencies = {
83
86
  "axe-core": "^4.9.0",
84
87
  browserslist: "^4.24.2",
85
88
  "crypto-browserify": "^3.12.0",
86
- "cypress-axe": "^1.5.0",
89
+ "cypress-axe": "^1.6.0",
87
90
  "cypress-multi-reporters": "^1.6.4",
91
+ "cypress-real-events": "^1.14.0",
88
92
  "file-loader": "^6.2.0",
89
93
  flexsearch: "^0.7.43",
90
94
  "h3-js": "^4.1.0",
@@ -146,10 +150,9 @@ var devDependencies = {
146
150
  "babel-polyfill": "^6.26.0",
147
151
  "chai-colors": "^1.0.1",
148
152
  "css-loader": "^5.2.4",
149
- cypress: "^12.17.2",
153
+ cypress: "^12.17.4",
150
154
  "cypress-browser-permissions": "^1.1.0",
151
- "cypress-real-events": "^1.11.0",
152
- "cypress-wait-until": "^1.7.1",
155
+ "cypress-wait-until": "^1.7.2",
153
156
  eslint: "^8.57.0",
154
157
  "eslint-config-standard": "^16.0.3",
155
158
  "eslint-import-resolver-typescript": "^3.6.1",
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var throttleDebounce = require('throttle-debounce');
3
4
  var geom = require('../../../src/utils/geom.js');
4
5
  var observable = require('../../../src/utils/observable.js');
5
6
  var sdkHeadless = require('./sdkHeadless.js');
@@ -145,10 +146,12 @@ function registerEvents (app, sendEvent) {
145
146
  sendEvent('userMoveStart', { lat, lng, floorId, ord: ordinal, structureId, pitch, zoom, bearing });
146
147
  });
147
148
 
148
- app.bus.monitor('map/userMoving', async ({ pitch, zoom, bearing }) => {
149
+ const userMoving = async ({ pitch, zoom, bearing }) => {
149
150
  const { lat, lng, floorId, ordinal, structureId } = await app.bus.get('map/getMapCenter');
150
151
  sendEvent('userMoving', { lat, lng, floorId, ord: ordinal, structureId, pitch, zoom, bearing });
151
- });
152
+ };
153
+
154
+ app.bus.monitor('map/userMoving', throttleDebounce.throttle(500, userMoving));
152
155
 
153
156
  app.bus.monitor('map/moveEnd', async ({ pitch, zoom, bearing }) => {
154
157
  const { lat, lng, floorId, ordinal, structureId } = await app.bus.get('map/getMapCenter');
@@ -172,8 +175,9 @@ function registerEvents (app, sendEvent) {
172
175
 
173
176
  app.bus.monitor('map/click', async ({ lat, lng, ord }) => {
174
177
  const structures = await app.bus.get('venueData/getStructures');
175
- const { building, floor } = geom.getBuildingAndFloorAtPoint(structures, lat, lng, ord, true);
176
- sendEvent('mapClicked', { lat, lng, ord, building, floor });
178
+ const mapviewBBox = await app.bus.get('map/getViewBBox');
179
+ const { building: structure, floor } = geom.getStructureAndFloorAtPoint(structures, lat, lng, ord, mapviewBBox, true);
180
+ sendEvent('mapClicked', { lat, lng, ord, building: structure, floor });
177
181
  });
178
182
  }
179
183
 
@@ -105,7 +105,7 @@ const buildStructures = (venueData) => {
105
105
  return structureOrder.map(structureId => {
106
106
  const structure = structures[structureId];
107
107
  // Was going to use this for selecting floors - but it seems floor bounds are incorrect? (was testing LAX/lax-msc-2 for example)
108
- // Object.values(structure.levels).forEach(level => (level.bounds = findBoundsOfCoordinates(level.boundsPolygon)))
108
+ Object.values(structure.levels).forEach(level => (level.bounds = bounds.findBoundsOfCoordinates(level.boundsPolygon)));
109
109
  const bounds$1 = bounds.findBoundsOfCoordinates(structure.boundsPolygon);
110
110
  return { ...structure, bounds: bounds$1 }
111
111
  })
@@ -71,6 +71,7 @@ async function bounds () {
71
71
  async function buildingBounds (nameFilter) {
72
72
  this.bus.send('map/showBuildingBounds', { nameFilter });
73
73
  monitorDebugFeaturesReset('map/resetVenueBounds', this.bus);
74
+ showCenter.apply(this);
74
75
  }
75
76
 
76
77
  async function floorBounds (nameFilter) {
@@ -78,9 +79,11 @@ async function floorBounds (nameFilter) {
78
79
  bus.send('map/showFloorBounds', { nameFilter });
79
80
 
80
81
  monitorDebugFeaturesReset('map/resetVenueBounds', bus);
82
+
81
83
  const unsubFloorChanges = bus.monitor('map/floorChanged', () =>
82
84
  bus.send('map/showFloorBounds', { nameFilter }));
83
85
  onNextSearchClear(unsubFloorChanges, bus);
86
+ showCenter.apply(this);
84
87
  }
85
88
 
86
89
  async function padding () {
@@ -100,6 +103,14 @@ const onNextSearchClear = (fn, bus) => {
100
103
  });
101
104
  };
102
105
 
106
+ async function showCenter () {
107
+ const padding = await this.bus.get('map/getPadding');
108
+ const leftAdj = (padding.left - padding.right) / 2; // how much to adjust left from true center to account for padding
109
+ const topAdj = (padding.top - padding.bottom) / 2; // how much to adjust top from true center to account for padding
110
+ const crosshair = dom.ad({ html: `<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path stroke="#fF000080" stroke-width="2" d="M0 50h45M55 50h45M50 0v45M50 55v45"/></svg>`, styles: { position: 'absolute', left: '50%', top: '50%', 'margin-left': (-50 + leftAdj) + 'px', 'margin-top': (-50 + topAdj) + 'px' } }, dom.$('.maplibregl-map'));
111
+ onNextSearchClear(() => dom.del(crosshair), this.bus);
112
+ }
113
+
103
114
  function dndGo () {
104
115
  const bus = this.bus;
105
116
  const toggleActive = (e, indicateDragVisual) => {
@@ -152,6 +163,7 @@ var debugTools = {
152
163
  orphanTest: navGraphDebug.orphanTest,
153
164
  padding,
154
165
  poisByCategory,
166
+ showCenter,
155
167
  showgraph,
156
168
  showIcons,
157
169
  showOrphaned
@@ -67,15 +67,21 @@ function create (opts = { }) {
67
67
  }
68
68
 
69
69
  function off (ev, fn) {
70
- if (!ons[ev])
71
- return
72
- arRm(ons[ev], fn);
70
+ // run ASAP but not immediate, in case it removes in its own function
71
+ Zousan.soon(() => {
72
+ if (!ons[ev])
73
+ return
74
+ arRm(ons[ev], fn);
75
+ });
73
76
  }
74
77
 
75
78
  function moff (ev, fn) {
76
- if (!mons[ev])
77
- return
78
- arRm(mons[ev], fn);
79
+ // run ASAP but not immediate, in case it removes in its own function
80
+ Zousan.soon(() => {
81
+ if (!mons[ev])
82
+ return
83
+ arRm(mons[ev], fn);
84
+ });
79
85
  }
80
86
 
81
87
  const serve = (ev, ob, done) => () => {
@@ -40,6 +40,8 @@ function ad (eConf, parent) {
40
40
  return node
41
41
  }
42
42
 
43
+ const del = element => element?.parentNode?.removeChild(element);
44
+
43
45
  const setStyles = (node, styles) => {
44
46
  for (const style in styles)
45
47
  node.style[style] = styles[style];
@@ -48,4 +50,5 @@ const setStyles = (node, styles) => {
48
50
  exports.$ = $;
49
51
  exports.$$ = $$;
50
52
  exports.ad = ad;
53
+ exports.del = del;
51
54
  exports.setStyles = setStyles;
@@ -1,6 +1,9 @@
1
1
  'use strict';
2
2
 
3
- require('@turf/helpers');
3
+ var area = require('@turf/area');
4
+ var bboxClip = require('@turf/bbox-clip');
5
+ var bboxPolygon = require('@turf/bbox-polygon');
6
+ var helpers = require('@turf/helpers');
4
7
  require('@turf/point-to-line-distance');
5
8
  var R = require('ramda');
6
9
 
@@ -44,57 +47,130 @@ const pointInPolygon = (point, vs) => {
44
47
  return inside
45
48
  };
46
49
 
47
- const getBoundsCoords = building => {
48
- const { n, s, e, w } = building.bounds;
49
- return [[n, e], [n, w], [s, w], [s, e], [n, e]]
50
- };
50
+ const bounds2Coords = ({ n, s, e, w }) => [[n, e], [n, w], [s, w], [s, e], [n, e]];
51
+ const NULL_STRUCTURE_AND_FLOOR = { structure: null, floor: null };
51
52
 
52
53
  /**
53
- * Pass in a buildings array and a lat,lng and this will return the building at that point
54
- * or undefined if no building exists at that point. This runs very quickly as we very often
54
+ * Pass in a structures array and a lat,lng and ord, and this will return the structure and floor
55
+ * at that point or nulls if no structure exists at that point/ord. This runs very quickly as we very often
55
56
  * can skip the slowest path (which runs pointInPolygon). Without preciseFlag we sometimes return
56
- * a building when the point falls outside it - but won't return a wrong building. In some cases this
57
- * is actually desired behavior anyway (such as building selector)
58
- * @param {Array.Object} buildings
57
+ * a structure when the point falls outside it - but won't return a wrong structure. In some cases this
58
+ * is actually desired behavior anyway (such as structure selector)
59
+ * @param {object} structures the venue data structures
59
60
  * @param {float} lat latitude of point to check
60
61
  * @param {float} lng longitude of point to check
61
- * @param {boolean} preciseFlag if not true we take a shortcut when a single building falls within bounding box (very common case)
62
- * @returns {object} building that contains the point passed, or undefined if none
62
+ * @param {[float]} mapviewBBox the minx,miny,maxx,maxy lat lng values that define the viewable map (not req if preciseFlag === true)
63
+ * @param {boolean} preciseFlag if false, we provide a fuzzy reading, allowing for the map center to be "close enough" to a building/floor
64
+ * @returns {structure: object, floor: object} structure/building and floor that contains the point passed (or {structure:null,floor:null})
63
65
  */
64
- function getStructureAtPoint (buildings, lat, lng, preciseFlag) {
65
- if (!R__namespace.length(buildings)) return null
66
+ function getStructureAndFloorAtPoint (structures, lat, lng, ord, mapviewBBox, preciseFlag = false) { // Step 1 of logic flow
67
+ if (!R__namespace.length(structures)) return NULL_STRUCTURE_AND_FLOOR
68
+
69
+ structures = structures.filter(s => s.shouldDisplay == null || s.shouldDisplay === true);
70
+
71
+ const floorsToConsider = structures
72
+ .map(structure => ({ structure, floor: ordToFloor(structure, ord) })); // array of {structure,floor} obs
73
+
74
+ return getStructureAndFloorWithinFloorsAtPoint(structures, floorsToConsider, lat, lng, mapviewBBox, preciseFlag)
75
+ }
76
+
77
+ /**
78
+ * Given a list of candidate floors, and a lat,lng point, determine which
79
+ * @param {object} structures the venue data structures
80
+ * @param {[{structure, floor}]} floorsToConsider A list of "tuple" objects containing structure and floor (both can be null)
81
+ * @param {float} lat latitude of point to check
82
+ * @param {float} lng longitude of point to check
83
+ * @param {[float]} mapviewBBox the minx,miny,maxx,maxy lat lng values that define the viewable map (not req if preciseFlag === true)
84
+ * @param {boolean} preciseFlag if false, we provide a fuzzy reading, allowing for the map center to be "close enough" to a building/floor
85
+ * @returns {structure: object, floor: object} structure/building and floor that contains the point passed (or {structure:null,floor:null})
86
+ */
87
+ function getStructureAndFloorWithinFloorsAtPoint (structures, floorsToConsider, lat, lng, mapviewBBox, preciseFlag) {
88
+ // Step 2 - Select floors whose bounding box contains map center
89
+ const pointWithinFloorsBBox = floorsToConsider
90
+ .filter(ftc => ftc.floor) // ignore structures with no floor on this ord
91
+ .filter(ftc => pointInPolygon([lat, lng], bounds2Coords(ftc.floor.bounds)));
92
+
93
+ //
94
+ // First, lets handle the simpler case, where preciseFlag is true.
95
+ // All preciseFlag=true cases are handled within this code block.
96
+ //
97
+ if (preciseFlag) {
98
+ // not within any floor's bounding box? return nulls
99
+ if (pointWithinFloorsBBox.length === 0)
100
+ return NULL_STRUCTURE_AND_FLOOR
101
+
102
+ // Step 3 (precise) - We need to determine which of the floors found above are we ACTUALLY in:
103
+ const floorsWithinBoundsPolygon = pointWithinFloorsBBox
104
+ .filter(ftc => pointInPolygon([lat, lng], ftc.floor.boundsPolygon));
105
+
106
+ // We should never be in MORE than one floor's bounding polygon, so return 1st one
107
+ // and in unlikely case we ARE in multiple, user will get first one...
108
+ if (floorsWithinBoundsPolygon.length >= 1)
109
+ return R__namespace.head(floorsWithinBoundsPolygon)
110
+
111
+ // precise yet not within any floor polygon, "so you get nothing. you lose. good day sir!"
112
+ return NULL_STRUCTURE_AND_FLOOR
113
+ }
66
114
 
67
- buildings = buildings.filter(b => b.shouldDisplay == null || b.shouldDisplay === true);
115
+ //
116
+ // From here forward, we handle the non-precise case (more complicated)
117
+ //
68
118
 
69
- const buildingsWithinBoundingBox = buildings.filter(b =>
70
- pointInPolygon([lat, lng], getBoundsCoords(b)));
119
+ // Step 3 (non-precise) - We are not within any *floor* bounding box..
120
+ if (pointWithinFloorsBBox.length === 0) {
121
+ // Check to see if we are over a building (perhaps with no floor or tiny floor at this ordinal)
122
+ const floorsWithinBuildingBoundingBox = structures
123
+ .filter(structure => pointInPolygon([lat, lng], bounds2Coords(structure.bounds)))
124
+ // .map(structure => ({ structure, floor: structure.levels[structure.defaultLevelId] }))
125
+ .map(structure => ({ structure, floor: null }));
71
126
 
72
- if (buildingsWithinBoundingBox.length === 0) return null
73
- if (buildingsWithinBoundingBox.length === 1 && !preciseFlag)
74
- return R__namespace.head(buildingsWithinBoundingBox)
127
+ if (floorsWithinBuildingBoundingBox.length >= 1)
128
+ return floorsWithinBuildingBoundingBox[0]
75
129
 
76
- const buildingsWithinBoundsPolygon = buildingsWithinBoundingBox
77
- .filter(b => pointInPolygon([lat, lng], b.boundsPolygon));
130
+ return NULL_STRUCTURE_AND_FLOOR // user does not seem to be near ANYTHING!
131
+ }
132
+
133
+ // Step 4 - If we are only in the bounding box of a single floor, return it
134
+ if (pointWithinFloorsBBox.length === 1)
135
+ return pointWithinFloorsBBox[0]
136
+
137
+ // Step 5 - Ok, so from here, we are NOT precise, and the map center is within MULTIPLE bounding boxes
138
+ // so how do we determine WHICH item to select...?
78
139
 
79
- if (buildingsWithinBoundsPolygon.length === 1)
80
- return R__namespace.head(buildingsWithinBoundsPolygon)
140
+ const floorsContainingPoint = pointWithinFloorsBBox.filter(ftc => pointInPolygon([lat, lng], ftc.floor.boundsPolygon));
81
141
 
82
- // If we are within more than 1 building (WTF?) then return the smaller one
83
- if (buildingsWithinBoundsPolygon.length)
84
- return findBuildingWithMinArea(buildingsWithinBoundingBox)
142
+ // We will score the building/floor's "prominence" and pick the highest scoring building/floor
143
+ const prominenceScores = pointWithinFloorsBBox.map(ftc => prominence(ftc, mapviewBBox, floorsContainingPoint.some(fcp => fcp.floor.id === ftc.floor.id)));
144
+ console.log('!pointWithinFloorsBBox:', pointWithinFloorsBBox.map(ftc => ftc.floor.id));
145
+ console.log('!prominenceScores:', prominenceScores);
146
+ const bestScore = Math.max.apply(null, prominenceScores);
147
+ console.log('!bestScore:', bestScore);
85
148
 
86
- return null
149
+ return pointWithinFloorsBBox[prominenceScores.indexOf(bestScore)]
87
150
  }
88
151
 
89
- const calcBuildingArea = currentBuilding => {
90
- if (!currentBuilding.bounds) return 0
91
- const { n, s, e, w } = currentBuilding.bounds;
92
- return Math.abs((n - s) * (e - w))
93
- };
152
+ // Returns a prominenceScore from 0 to 100
153
+ // This is calculated by a % of screen taken by the
154
+ // floor polygon
155
+ function prominence ({ structure, floor }, mapviewBBox, pointWithinFloorPoly) {
156
+ // Take the polygon of the floor...
157
+ const floorPolygon = coords2Poly(floor.boundsPolygon);
158
+
159
+ // ...and the bounding box of the viewable map...
160
+ const mapviewBBoxPoly = bboxPolygon.bboxPolygon(mapviewBBox);
161
+
162
+ // ...and create a viewable floor polygone from the intercection.
163
+ const viewableFloorPoly = bboxClip.bboxClip(floorPolygon, mapviewBBox);
94
164
 
95
- // takes a function and two objects and returns the object that evaluates less against the function
96
- const less = fn => (o1, o2) => fn(o1) < fn(o2) ? o1 : o2;
97
- const findBuildingWithMinArea = ba => ba.reduce(less(calcBuildingArea)); // returns the building with least area within bounding
165
+ const floorArea = area.area(viewableFloorPoly);
166
+ const viewableMapArea = area.area(mapviewBBoxPoly);
167
+
168
+ // now the prominence is simply the ratio of viewable floor to viewable map (with 20% bonus if center within floor)
169
+ return floorArea * (pointWithinFloorPoly ? 150 : 100) / viewableMapArea
170
+ }
171
+
172
+ const latLngSwap = point => [point[1], point[0]];
173
+ const coords2Poly = coords => helpers.polygon([coords.map(latLngSwap)]);
98
174
 
99
175
  /**
100
176
  * given a building and ord, return the floor (or undefined if doesn't exist)
@@ -105,23 +181,15 @@ const ordToFloor = (building, ord) =>
105
181
  /**
106
182
  * Return the floor based on its ID (pass in buildings array and floorId)
107
183
  */
108
- const getFloor = (buildings, selectedLevelId) =>
109
- buildings.reduce((fmatch, building) =>
184
+ const getFloor = (structures, selectedLevelId) =>
185
+ structures.reduce((fmatch, building) =>
110
186
  Object.values(building.levels).find(floor => floor.id === selectedLevelId) || fmatch, undefined);
111
187
 
112
- function getBuildingAndFloorAtPoint (buildings, lat, lng, ord, preciseFlag) {
113
- const building = getStructureAtPoint(buildings, lat, lng, preciseFlag);
114
- const floor = building
115
- ? ordToFloor(building, ord)
116
- : null;
117
- return { building, floor }
118
- }
119
-
120
188
  // pass in the structures array and a floorId and this will return the structure
121
189
  // that contains the floorId.
122
- const getStructureForFloorId = (buildings, floorId) =>
123
- buildings.reduce((sMatch, building) =>
124
- buildContainsFloorWithId(building, floorId) ? building : sMatch, null);
190
+ const getStructureForFloorId = (structures, floorId) =>
191
+ structures.reduce((sMatch, structure) =>
192
+ buildContainsFloorWithId(structure, floorId) ? structure : sMatch, null);
125
193
 
126
194
  // returns true if the building specified contains the floorId specified
127
195
  const buildContainsFloorWithId = (building, floorId) =>
@@ -171,9 +239,8 @@ function bezierCurveTo (fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY) {
171
239
  }
172
240
 
173
241
  exports.bezierCurveTo = bezierCurveTo;
174
- exports.getBuildingAndFloorAtPoint = getBuildingAndFloorAtPoint;
175
242
  exports.getFloor = getFloor;
176
- exports.getStructureAtPoint = getStructureAtPoint;
243
+ exports.getStructureAndFloorAtPoint = getStructureAndFloorAtPoint;
177
244
  exports.getStructureForFloorId = getStructureForFloorId;
178
245
  exports.ordToFloor = ordToFloor;
179
246
  exports.pointInPolygon = pointInPolygon;
@@ -37,9 +37,10 @@ async function locationToEndpoint (app, location) {
37
37
  }
38
38
  } else {
39
39
  if (floorId == null) {
40
- const { building, floor } = geom.getBuildingAndFloorAtPoint(structures, lat, lng, ordinal, true);
40
+ const mapviewBBox = await app.bus.get('map/getViewBBox');
41
+ const { structure, floor } = geom.getStructureAndFloorAtPoint(structures, lat, lng, ordinal, mapviewBBox, true);
41
42
  floorId = floor?.id;
42
- structureId = building?.id;
43
+ structureId = structure?.id;
43
44
  }
44
45
  }
45
46
 
@@ -1 +1 @@
1
- var e="web-engine",s="3.3.390",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};
1
+ var e="web-engine",s="3.3.392",o="UNLICENSED",t="module",l="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/area":"^7.2.0","@turf/bbox-clip":"^7.2.0","@turf/bbox-polygon":"^7.2.0","@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.6.0","cypress-multi-reporters":"^1.6.4","cypress-real-events":"^1.14.0","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.4","cypress-browser-permissions":"^1.1.0","cypress-wait-until":"^1.7.2",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:t,main:l,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,l as main,e as name,u as nx,d as packageManager,n as resolutions,a as scripts,t as type,s as version,r as workspaces};
@@ -1 +1 @@
1
- import{getBuildingAndFloorAtPoint as e}from"../../../src/utils/geom.js";import t from"../../../src/utils/observable.js";import{headlessCommands as o,handleHeadless as n}from"./sdkHeadless.js";let a=null;function s(e){const t=(e,t)=>{const o={payload:e,type:"LL-server"};t&&(o.clientMsgId=t);try{window.postMessage(o,"*")}catch(e){window.postMessage((e=>JSON.parse(JSON.stringify(e)))(o),"*")}};function o(o){const n=o.data;n&&"LL-client"===n.type&&e.bus.get("clientAPI/execute",n.payload).then((e=>t(e,n.msgId))).catch((t=>{e.config.debug&&console.error(t),((e,t)=>{const o={error:!0,payload:e,type:"LL-server"};t&&(o.clientMsgId=t),window.postMessage(o,"*")})(t.message,n.msgId)}))}return a&&a(),window.addEventListener("message",o),a=()=>window.removeEventListener("message",o),(e,t)=>{const o={event:e,payload:t,type:"LL-server"};window.postMessage(o,"*")}}async function r(a,r){const i=a.env.isBrowser?s(a):function(e){const o=t();return e.eventListener=o,(e,t)=>o.fire(e,t)}(a);return function(t,o){t.bus.monitor("map/userMoveStart",(async({pitch:e,zoom:n,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");o("userMoveStart",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:n,bearing:a})})),t.bus.monitor("map/userMoving",(async({pitch:e,zoom:n,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");o("userMoving",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:n,bearing:a})})),t.bus.monitor("map/moveEnd",(async({pitch:e,zoom:n,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await t.bus.get("map/getMapCenter");o("moveEnd",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:n,bearing:a})})),t.bus.monitor("map/floorChanged",(({structure:e,floor:t})=>o("levelChange",{floorId:t?t.id:null,floorName:t?t.name:null,ord:t?t.ordinal:null,structureId:e?e.id:null,structureName:e?e.name:null}))),t.bus.monitor("map/poiClicked",(({poi:e})=>o("poiSelected",e))),t.bus.monitor("poiDetails/showPoi",(({poi:e})=>o("poiShown",e))),t.bus.monitor("map/click",(async({lat:n,lng:a,ord:s})=>{const r=await t.bus.get("venueData/getStructures"),{building:i,floor:l}=e(r,n,a,s,!0);o("mapClicked",{lat:n,lng:a,ord:s,building:i,floor:l})}))}(a,i),{init:async()=>{!function(e){e.bus.send("clientAPI/registerCustomType",{name:"latLngOrdLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"ord",type:"integer"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"latLngFloorLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"floorId",type:"string"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"poiIdLocation",spec:{type:"object",props:[{name:"poiId",type:"integer",min:0}]}}),e.bus.send("clientAPI/registerCustomType",{name:"location",spec:{type:"multi",types:[{type:"poiIdLocation"},{type:"latLngOrdLocation"},{type:"latLngFloorLocation"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"viewSettings",spec:{type:"object",props:[{name:"zoom",type:"float",optional:!0},{name:"pitch",type:"float",optional:!0},{name:"bearing",type:"float",optional:!0}]}})}(a),o.forEach((e=>a.bus.send("clientAPI/registerCommand",e))),n(a),r.headless||await import("../../../_virtual/_empty_module_placeholder.js").then((e=>{e.visualCommands.forEach((e=>a.bus.send("clientAPI/registerCommand",e))),e.handleVisual(a,i)}));const e=async()=>{await a.bus.send("system/readywhenyouare"),a.bus.get("clientAPI/execute",{command:"getCommandJSON"}).then((e=>i("ready",{commandJSON:e}))),!r.headless&&a.config.uiHide&&a.config.uiHide.sidebar&&a.env.isDesktop()&&a.bus.send("map/changePadding",{padding:{left:55,right:55,top:72,bottom:22}})};r.headless?Promise.all([new Promise((e=>a.bus.monitor("venueData/navGraphLoaded",e))),new Promise((e=>a.bus.monitor("venueData/poiDataLoaded",e)))]).then(e):a.bus.on("map/mapReadyToShow",e),a.bus.on("sdkServer/sendEvent",(({eventName:e,...t})=>i(e,t)))}}}export{r as create};
1
+ import{throttle as e}from"throttle-debounce";import{getStructureAndFloorAtPoint as t}from"../../../src/utils/geom.js";import o from"../../../src/utils/observable.js";import{headlessCommands as n,handleHeadless as a}from"./sdkHeadless.js";let s=null;function r(e){const t=(e,t)=>{const o={payload:e,type:"LL-server"};t&&(o.clientMsgId=t);try{window.postMessage(o,"*")}catch(e){window.postMessage((e=>JSON.parse(JSON.stringify(e)))(o),"*")}};function o(o){const n=o.data;n&&"LL-client"===n.type&&e.bus.get("clientAPI/execute",n.payload).then((e=>t(e,n.msgId))).catch((t=>{e.config.debug&&console.error(t),((e,t)=>{const o={error:!0,payload:e,type:"LL-server"};t&&(o.clientMsgId=t),window.postMessage(o,"*")})(t.message,n.msgId)}))}return s&&s(),window.addEventListener("message",o),s=()=>window.removeEventListener("message",o),(e,t)=>{const o={event:e,payload:t,type:"LL-server"};window.postMessage(o,"*")}}async function i(s,i){const l=s.env.isBrowser?r(s):function(e){const t=o();return e.eventListener=t,(e,o)=>t.fire(e,o)}(s);return function(o,n){o.bus.monitor("map/userMoveStart",(async({pitch:e,zoom:t,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await o.bus.get("map/getMapCenter");n("userMoveStart",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:t,bearing:a})})),o.bus.monitor("map/userMoving",e(500,(async({pitch:e,zoom:t,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await o.bus.get("map/getMapCenter");n("userMoving",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:t,bearing:a})}))),o.bus.monitor("map/moveEnd",(async({pitch:e,zoom:t,bearing:a})=>{const{lat:s,lng:r,floorId:i,ordinal:l,structureId:d}=await o.bus.get("map/getMapCenter");n("moveEnd",{lat:s,lng:r,floorId:i,ord:l,structureId:d,pitch:e,zoom:t,bearing:a})})),o.bus.monitor("map/floorChanged",(({structure:e,floor:t})=>n("levelChange",{floorId:t?t.id:null,floorName:t?t.name:null,ord:t?t.ordinal:null,structureId:e?e.id:null,structureName:e?e.name:null}))),o.bus.monitor("map/poiClicked",(({poi:e})=>n("poiSelected",e))),o.bus.monitor("poiDetails/showPoi",(({poi:e})=>n("poiShown",e))),o.bus.monitor("map/click",(async({lat:e,lng:a,ord:s})=>{const r=await o.bus.get("venueData/getStructures"),i=await o.bus.get("map/getViewBBox"),{building:l,floor:d}=t(r,e,a,s,i,!0);n("mapClicked",{lat:e,lng:a,ord:s,building:l,floor:d})}))}(s,l),{init:async()=>{!function(e){e.bus.send("clientAPI/registerCustomType",{name:"latLngOrdLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"ord",type:"integer"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"latLngFloorLocation",spec:{type:"object",props:[{name:"lat",type:"float"},{name:"lng",type:"float"},{name:"floorId",type:"string"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"poiIdLocation",spec:{type:"object",props:[{name:"poiId",type:"integer",min:0}]}}),e.bus.send("clientAPI/registerCustomType",{name:"location",spec:{type:"multi",types:[{type:"poiIdLocation"},{type:"latLngOrdLocation"},{type:"latLngFloorLocation"}]}}),e.bus.send("clientAPI/registerCustomType",{name:"viewSettings",spec:{type:"object",props:[{name:"zoom",type:"float",optional:!0},{name:"pitch",type:"float",optional:!0},{name:"bearing",type:"float",optional:!0}]}})}(s),n.forEach((e=>s.bus.send("clientAPI/registerCommand",e))),a(s),i.headless||await import("../../../_virtual/_empty_module_placeholder.js").then((e=>{e.visualCommands.forEach((e=>s.bus.send("clientAPI/registerCommand",e))),e.handleVisual(s,l)}));const e=async()=>{await s.bus.send("system/readywhenyouare"),s.bus.get("clientAPI/execute",{command:"getCommandJSON"}).then((e=>l("ready",{commandJSON:e}))),!i.headless&&s.config.uiHide&&s.config.uiHide.sidebar&&s.env.isDesktop()&&s.bus.send("map/changePadding",{padding:{left:55,right:55,top:72,bottom:22}})};i.headless?Promise.all([new Promise((e=>s.bus.monitor("venueData/navGraphLoaded",e))),new Promise((e=>s.bus.monitor("venueData/poiDataLoaded",e)))]).then(e):s.bus.on("map/mapReadyToShow",e),s.bus.on("sdkServer/sendEvent",(({eventName:e,...t})=>l(e,t)))}}}export{i as create};
@@ -1 +1 @@
1
- import*as e from"ramda";import{findBoundsOfCoordinates as t}from"../../../src/utils/bounds.js";import{global as n}from"../../../src/utils/configUtils.js";const a=async(e,t)=>fetch(t),s=e=>e=>a(0,e).then((e=>e.json())),o=e=>e=>a(0,e).then((e=>e.text())),l=e=>`https://api.content.locuslabs.com/${e}`,r=(t,n,a,s,o)=>e.mapObjIndexed(((e,n)=>((e,t,n,a,s,o)=>"theme"===o||"style"===o?`${l(n)}/${t}/${o}/${s}/${a}/${o}.json`:e.replace(/https:\/\/content.locuslabs.com/gi,l(n)))(e,t,a,s,o,n)),n),c=async(e,t,a)=>{const s={alpha:"alpha-a.locuslabs.com",beta:"beta-a.locuslabs.com",gamma:"gamma-a.locuslabs.com",prod:"a.locuslabs.com"},{assetStage:o,accountId:l,formatVersion:c}=e;let{venueId:i}=e;const u=`https://${s[o]||s.prod}/accounts/${l}`,d=c||"v5",g=e.dataFetch&&n[e.dataFetch]&&n[e.dataFetch].getFiles?await n[e.dataFetch].getFiles(e):await t(`${u}/${d}.json`);if(a.length>0){const t=a.map((e=>e.slice(0,2)));for(let n=0;n<t.length;n+=1)if(g[`${i}${t[n]}`]){i=`${i}${t[n]}`,e.venueId=`${i}`;break}}if(!g[i])throw Error(`Attempt to access venue ${i} which is not within venue list: ${Object.keys(g)}`);const m=g[i].files,h=(e.dataFetch&&n[e.dataFetch]&&n[e.dataFetch].getVenueData?await n[e.dataFetch].getVenueData(e):await t(m.venueData))[i];h.tileServerAuthInfo&&function(e){const t={defaultOrdinal:0,defaultStructureId:"singleBuilding",formatVersion:"v5",structures:{singleBuilding:{name:"singleBuilding",boundsPolygon:[],defaultLevelId:"singleLevel",id:"singleBuilding",levels:{singleLevel:{boundsPolygon:[],clfloor:0,details:"",id:"singleLevel",name:"singleLevel",ordinal:0}}}},structureOrder:["singleBuilding"]};for(const n in t)e[n]=t[n]}(h),h.venueList=g;const p=(e=>{const t=e.deepLinkProps?e.deepLinkProps.contentStage:null;return"alpha"===t||"beta"===t||"prod"===t?t:null})(e);return h.files=p?r(h.category,m,p,l,i):m,h},i=e=>{const{structureOrder:n,structures:a}=e;return n.map((e=>{const n=a[e],s=t(n.boundsPolygon);return{...n,bounds:s}}))};const u=([e,t,...n])=>[t,e,...n],d=(e,t)=>{return!e||!Array.isArray(e)||e.length<1?e:(n=e[0][0],a=t.ne.lng,s=t.sw.lng,(n>a?n<=s:e=>s)?e:e.map(u));var n,a,s};export{i as buildStructures,s as createFetchJson,o as createFetchText,c as getVenueDataFromUrls,d as normalizeCoords};
1
+ import*as e from"ramda";import{findBoundsOfCoordinates as t}from"../../../src/utils/bounds.js";import{global as n}from"../../../src/utils/configUtils.js";const s=async(e,t)=>fetch(t),a=e=>e=>s(0,e).then((e=>e.json())),o=e=>e=>s(0,e).then((e=>e.text())),l=e=>`https://api.content.locuslabs.com/${e}`,r=(t,n,s,a,o)=>e.mapObjIndexed(((e,n)=>((e,t,n,s,a,o)=>"theme"===o||"style"===o?`${l(n)}/${t}/${o}/${a}/${s}/${o}.json`:e.replace(/https:\/\/content.locuslabs.com/gi,l(n)))(e,t,s,a,o,n)),n),c=async(e,t,s)=>{const a={alpha:"alpha-a.locuslabs.com",beta:"beta-a.locuslabs.com",gamma:"gamma-a.locuslabs.com",prod:"a.locuslabs.com"},{assetStage:o,accountId:l,formatVersion:c}=e;let{venueId:i}=e;const u=`https://${a[o]||a.prod}/accounts/${l}`,d=c||"v5",g=e.dataFetch&&n[e.dataFetch]&&n[e.dataFetch].getFiles?await n[e.dataFetch].getFiles(e):await t(`${u}/${d}.json`);if(s.length>0){const t=s.map((e=>e.slice(0,2)));for(let n=0;n<t.length;n+=1)if(g[`${i}${t[n]}`]){i=`${i}${t[n]}`,e.venueId=`${i}`;break}}if(!g[i])throw Error(`Attempt to access venue ${i} which is not within venue list: ${Object.keys(g)}`);const h=g[i].files,m=(e.dataFetch&&n[e.dataFetch]&&n[e.dataFetch].getVenueData?await n[e.dataFetch].getVenueData(e):await t(h.venueData))[i];m.tileServerAuthInfo&&function(e){const t={defaultOrdinal:0,defaultStructureId:"singleBuilding",formatVersion:"v5",structures:{singleBuilding:{name:"singleBuilding",boundsPolygon:[],defaultLevelId:"singleLevel",id:"singleBuilding",levels:{singleLevel:{boundsPolygon:[],clfloor:0,details:"",id:"singleLevel",name:"singleLevel",ordinal:0}}}},structureOrder:["singleBuilding"]};for(const n in t)e[n]=t[n]}(m),m.venueList=g;const p=(e=>{const t=e.deepLinkProps?e.deepLinkProps.contentStage:null;return"alpha"===t||"beta"===t||"prod"===t?t:null})(e);return m.files=p?r(m.category,h,p,l,i):h,m},i=e=>{const{structureOrder:n,structures:s}=e;return n.map((e=>{const n=s[e];Object.values(n.levels).forEach((e=>e.bounds=t(e.boundsPolygon)));const a=t(n.boundsPolygon);return{...n,bounds:a}}))};const u=([e,t,...n])=>[t,e,...n],d=(e,t)=>{return!e||!Array.isArray(e)||e.length<1?e:(n=e[0][0],s=t.ne.lng,a=t.sw.lng,(n>s?n<=a:e=>a)?e:e.map(u));var n,s,a};export{i as buildStructures,a as createFetchJson,o as createFetchText,c as getVenueDataFromUrls,d as normalizeCoords};
@@ -1 +1 @@
1
- import*as e from"ramda";import{orphanTest as n}from"../plugins/wayfinder/src/navGraphDebug.js";import{$ as o,$$ as s,ad as t}from"./utils/dom.js";import{singleFile as a}from"./utils/funcs.js";"undefined"!=typeof window&&(window.R=e);const r=(e,n)=>i((()=>n.send(e)),n),i=(e,n)=>{const o=n.monitor("homeview/performSearch",(({term:n})=>{n||(e(),o())}))};var d={bounds:async function(){const e=await this.bus.get("venueData/getVenueCenter"),{venueRadius:n,bounds:o}=await this.bus.get("venueData/getVenueData");this.bus.send("map/showVenueBounds",{venueCenter:e,venueRadius:n,bounds:o}),r("map/resetVenueBounds",this.bus)},buildingBounds:async function(e){this.bus.send("map/showBuildingBounds",{nameFilter:e}),r("map/resetVenueBounds",this.bus)},dndGo:function(){const e=this.bus,n=(e,n)=>{e.preventDefault(),n?e.target.classList.add("dragover"):e.target.classList.remove("dragover")},o={drop:async function(o){n(o,!1);for(const n of o.dataTransfer.files){const o=n.name;if("application/json"===n.type||n.type.startsWith("text/")){const s=new FileReader;s.onload=a((async s=>e.send("debugTools/fileDrop",{file:n,filename:o,content:s.target.result}))),s.readAsText(n)}}},dragover:function(e){n(e,!0)},dragleave:function(e){n(e,!1)}};Object.keys(o).forEach((function(e){document.body.addEventListener(e,o[e])})),console.log("DnD Listeners installed")},floorBounds:async function(e){const n=this.bus;n.send("map/showFloorBounds",{nameFilter:e}),r("map/resetVenueBounds",n);const o=n.monitor("map/floorChanged",(()=>n.send("map/showFloorBounds",{nameFilter:e})));i(o,n)},getPoiById:function(e){return this.bus.send("poi/getById",{id:e}).then((e=>e[0]))},highlightNodes:()=>t({tag:"style",html:"* { background-color: rgba(255,0,0,.2); } * * { background-color: rgba(0,255,0,.2); } * * * { background-color: rgba(0,0,255,.2); } * * * * { background-color: rgba(255,0,255,.2); } * * * * * { background-color: rgba(0,255,255,.2); } * * * * * * { background-color: rgba(255,255,0,.2); } * * * * * * * { background-color: rgba(255,0,0,.2); } * * * * * * * * { background-color: rgba(0,255,0,.2); } * * * * * * * * * { background-color: rgba(0,0,255,.2); }"},o("head")),orphanTest:n,padding:async function(){this.bus.send("map/togglePadding"),r("map/togglePadding",this.bus)},poisByCategory:function(){return this.bus.send("poi/getAll").then((e=>e[0])).then((e=>Object.values(e))).then(e.groupBy((e=>e.category)))},showgraph:async function(){const e=await this.bus.get("wayfinder/getNavGraphFeatures");this.bus.send("map/showNavGraphFeatures",{navGraph:e}),r("map/resetNavGraphFeatures",this.bus)},showIcons:()=>{o("#mapRenderDiv").innerHTML="<style> div { display: inline-block; text-align: center; border: 1px solid lightblue; }</style>"+s("svg symbol").map((e=>`<div><svg><use xlink:href="#${e.id}"/></svg><br/>${e.id}</div>`)).join("")},showOrphaned:async function(){const e=await this.bus.get("wayfinder/_getNavGraph"),o=n(e._nodes);this.bus.send("map/showOrphanedGraphNodes",{orphanedNodes:o.orphaned})}};export{d as default};
1
+ import*as e from"ramda";import{orphanTest as t}from"../plugins/wayfinder/src/navGraphDebug.js";import{$ as n,$$ as s,ad as o,del as a}from"./utils/dom.js";import{singleFile as r}from"./utils/funcs.js";"undefined"!=typeof window&&(window.R=e);const i=(e,t)=>d((()=>t.send(e)),t),d=(e,t)=>{const n=t.monitor("homeview/performSearch",(({term:t})=>{t||(e(),n())}))};async function u(){const e=await this.bus.get("map/getPadding"),t=(e.left-e.right)/2,s=(e.top-e.bottom)/2,r=o({html:'<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path stroke="#fF000080" stroke-width="2" d="M0 50h45M55 50h45M50 0v45M50 55v45"/></svg>',styles:{position:"absolute",left:"50%",top:"50%","margin-left":-50+t+"px","margin-top":-50+s+"px"}},n(".maplibregl-map"));d((()=>a(r)),this.bus)}var g={bounds:async function(){const e=await this.bus.get("venueData/getVenueCenter"),{venueRadius:t,bounds:n}=await this.bus.get("venueData/getVenueData");this.bus.send("map/showVenueBounds",{venueCenter:e,venueRadius:t,bounds:n}),i("map/resetVenueBounds",this.bus)},buildingBounds:async function(e){this.bus.send("map/showBuildingBounds",{nameFilter:e}),i("map/resetVenueBounds",this.bus),u.apply(this)},dndGo:function(){const e=this.bus,t=(e,t)=>{e.preventDefault(),t?e.target.classList.add("dragover"):e.target.classList.remove("dragover")},n={drop:async function(n){t(n,!1);for(const t of n.dataTransfer.files){const n=t.name;if("application/json"===t.type||t.type.startsWith("text/")){const s=new FileReader;s.onload=r((async s=>e.send("debugTools/fileDrop",{file:t,filename:n,content:s.target.result}))),s.readAsText(t)}}},dragover:function(e){t(e,!0)},dragleave:function(e){t(e,!1)}};Object.keys(n).forEach((function(e){document.body.addEventListener(e,n[e])})),console.log("DnD Listeners installed")},floorBounds:async function(e){const t=this.bus;t.send("map/showFloorBounds",{nameFilter:e}),i("map/resetVenueBounds",t);const n=t.monitor("map/floorChanged",(()=>t.send("map/showFloorBounds",{nameFilter:e})));d(n,t),u.apply(this)},getPoiById:function(e){return this.bus.send("poi/getById",{id:e}).then((e=>e[0]))},highlightNodes:()=>o({tag:"style",html:"* { background-color: rgba(255,0,0,.2); } * * { background-color: rgba(0,255,0,.2); } * * * { background-color: rgba(0,0,255,.2); } * * * * { background-color: rgba(255,0,255,.2); } * * * * * { background-color: rgba(0,255,255,.2); } * * * * * * { background-color: rgba(255,255,0,.2); } * * * * * * * { background-color: rgba(255,0,0,.2); } * * * * * * * * { background-color: rgba(0,255,0,.2); } * * * * * * * * * { background-color: rgba(0,0,255,.2); }"},n("head")),orphanTest:t,padding:async function(){this.bus.send("map/togglePadding"),i("map/togglePadding",this.bus)},poisByCategory:function(){return this.bus.send("poi/getAll").then((e=>e[0])).then((e=>Object.values(e))).then(e.groupBy((e=>e.category)))},showCenter:u,showgraph:async function(){const e=await this.bus.get("wayfinder/getNavGraphFeatures");this.bus.send("map/showNavGraphFeatures",{navGraph:e}),i("map/resetNavGraphFeatures",this.bus)},showIcons:()=>{n("#mapRenderDiv").innerHTML="<style> div { display: inline-block; text-align: center; border: 1px solid lightblue; }</style>"+s("svg symbol").map((e=>`<div><svg><use xlink:href="#${e.id}"/></svg><br/>${e.id}</div>`)).join("")},showOrphaned:async function(){const e=await this.bus.get("wayfinder/_getNavGraph"),n=t(e._nodes);this.bus.send("map/showOrphanedGraphNodes",{orphanedNodes:n.orphaned})}};export{g as default};
@@ -1 +1 @@
1
- import r from"zousan";const n=(r,n)=>null==r.responseOrder?null==n.responseOrder?0:1:null==n.responseOrder?-1:r.responseOrder-n.responseOrder,o=(r,n)=>r.splice(n,1)[0],e=(r,n)=>{let e=0;do{e=r.indexOf(n,e),e>=0&&o(r,e)}while(e>=0);return r};function t(o={}){const t=o.log?o.log.sublog?o.log.sublog("bustle",{color:"pink"}):o.log:console,s={},l={};function u(r,n){s[r]&&e(s[r],n)}function c(r,n){l[r]&&e(l[r],n)}function i(n,e){return o.showEvents&&("function"==typeof o.showEvents?o.showEvents(n,e)&&t.info("send with",n," and ",e):t.info("send with",n," and ",e)),new r((u=>r.soon(((n,e,u)=>()=>{const c=s[n],i=l[n],f=[];if(c)for(const n of c)try{f.push(n(e))}catch(n){o.reportAllErrors&&t.error(n),o.rejectOnError?f.push(r.reject(n)):f.push(n)}const h=r.all(f);if(i)for(const r of i)try{r(e,h)}catch(r){o.reportAllErrors&&t.error(r)}u(h)})(n,e,u))))}return{get:(n,o)=>i(n,o).then((o=>1!==o.length?r.reject(`${n} event did not return a single result, but ${o.length} results.`):o[0])),getFirst:(r,o)=>i(r,o).then((r=>r.length>=1?r.sort(n)[0]:void 0)),moff:c,monitor:function(r,n){return l[r]||(l[r]=[]),l[r].push(n),()=>c(r,n)},off:u,on:function(r,n){return s[r]||(s[r]=[]),s[r].push(n),()=>u(r,n)},send:i}}export{t as create};
1
+ import o from"zousan";const n=(o,n)=>null==o.responseOrder?null==n.responseOrder?0:1:null==n.responseOrder?-1:o.responseOrder-n.responseOrder,r=(o,n)=>o.splice(n,1)[0],e=(o,n)=>{let e=0;do{e=o.indexOf(n,e),e>=0&&r(o,e)}while(e>=0);return o};function t(r={}){const t=r.log?r.log.sublog?r.log.sublog("bustle",{color:"pink"}):r.log:console,s={},l={};function u(n,r){o.soon((()=>{s[n]&&e(s[n],r)}))}function c(n,r){o.soon((()=>{l[n]&&e(l[n],r)}))}function i(n,e){return r.showEvents&&("function"==typeof r.showEvents?r.showEvents(n,e)&&t.info("send with",n," and ",e):t.info("send with",n," and ",e)),new o((u=>o.soon(((n,e,u)=>()=>{const c=s[n],i=l[n],f=[];if(c)for(const n of c)try{f.push(n(e))}catch(n){r.reportAllErrors&&t.error(n),r.rejectOnError?f.push(o.reject(n)):f.push(n)}const h=o.all(f);if(i)for(const o of i)try{o(e,h)}catch(o){r.reportAllErrors&&t.error(o)}u(h)})(n,e,u))))}return{get:(n,r)=>i(n,r).then((r=>1!==r.length?o.reject(`${n} event did not return a single result, but ${r.length} results.`):r[0])),getFirst:(o,r)=>i(o,r).then((o=>o.length>=1?o.sort(n)[0]:void 0)),moff:c,monitor:function(o,n){return l[o]||(l[o]=[]),l[o].push(n),()=>c(o,n)},off:u,on:function(o,n){return s[o]||(s[o]=[]),s[o].push(n),()=>u(o,n)},send:i}}export{t as create};
@@ -1 +1 @@
1
- const t=(t,e)=>"string"==typeof t?(e||document).querySelector(t):t||null,e=(t,e)=>Array.prototype.slice.call(document.querySelectorAll(t));function n(t,e){const n=t||{};e=e?"string"==typeof e?document.querySelector(e):e:document.body;let l="div";n.tag&&(l=n.tag);const s=document.createElement(l);for(const t in n)null!=n[t]&&("klass"===t?s.setAttribute("class",n.klass):"tag"===t||("styles"===t?o(s,n.styles):"text"===t?s.textContent=n.text:"html"===t?s.innerHTML=n.html:s.setAttribute(t,n[t])));return e.appendChild(s),s}const o=(t,e)=>{for(const n in e)t.style[n]=e[n]};export{t as $,e as $$,n as ad,o as setStyles};
1
+ const t=(t,e)=>"string"==typeof t?(e||document).querySelector(t):t||null,e=(t,e)=>Array.prototype.slice.call(document.querySelectorAll(t));function n(t,e){const n=t||{};e=e?"string"==typeof e?document.querySelector(e):e:document.body;let o="div";n.tag&&(o=n.tag);const r=document.createElement(o);for(const t in n)null!=n[t]&&("klass"===t?r.setAttribute("class",n.klass):"tag"===t||("styles"===t?l(r,n.styles):"text"===t?r.textContent=n.text:"html"===t?r.innerHTML=n.html:r.setAttribute(t,n[t])));return e.appendChild(r),r}const o=t=>t?.parentNode?.removeChild(t),l=(t,e)=>{for(const n in e)t.style[n]=e[n]};export{t as $,e as $$,n as ad,o as del,l as setStyles};
@@ -1 +1 @@
1
- import"@turf/helpers";import"@turf/point-to-line-distance";import*as n from"ramda";const e=(n,e)=>{const t=n[0],l=n[1];let r=!1;for(let n=0,u=e.length-1;n<e.length;u=n++){const o=e[n][0],s=e[n][1],i=e[u][0],c=e[u][1];s>l!=c>l&&t<(i-o)*(l-s)/(c-s)+o&&(r=!r)}return r};function t(t,l,u,o){if(!n.length(t))return null;const s=(t=t.filter((n=>null==n.shouldDisplay||!0===n.shouldDisplay))).filter((n=>e([l,u],(n=>{const{n:e,s:t,e:l,w:r}=n.bounds;return[[e,l],[e,r],[t,r],[t,l],[e,l]]})(n))));if(0===s.length)return null;if(1===s.length&&!o)return n.head(s);const i=s.filter((n=>e([l,u],n.boundsPolygon)));return 1===i.length?n.head(i):i.length?r(s):null}const l=n=>{if(!n.bounds)return 0;const{n:e,s:t,e:l,w:r}=n.bounds;return Math.abs((e-t)*(l-r))},r=n=>{return n.reduce((e=l,(n,t)=>e(n)<e(t)?n:t));var e},u=(n,e)=>Object.values(n.levels).find((n=>n.ordinal===e)),o=(n,e)=>n.reduce(((n,t)=>Object.values(t.levels).find((n=>n.id===e))||n),void 0);function s(n,e,l,r,o){const s=t(n,e,l,o);return{building:s,floor:s?u(s,r):null}}const i=(n,e)=>n.reduce(((n,t)=>c(t,e)?t:n),null),c=(n,e)=>Object.values(n.levels).reduce(((n,t)=>t.id===e||n),!1);function d(n,e,t,l,r,u,o,s){let i=0,c=0,d=0,f=0,a=0;const h=[{x:n,y:e}];for(let b=1,g=0;b<=20;++b)g=b/20,i=1-g,c=i*i,d=c*i,f=g*g,a=f*g,h.push({x:d*n+3*c*g*t+3*i*f*r+a*o,y:d*e+3*c*g*l+3*i*f*u+a*s});return h}export{d as bezierCurveTo,s as getBuildingAndFloorAtPoint,o as getFloor,t as getStructureAtPoint,i as getStructureForFloorId,u as ordToFloor,e as pointInPolygon};
1
+ import{area as o}from"@turf/area";import{bboxClip as r}from"@turf/bbox-clip";import{bboxPolygon as t}from"@turf/bbox-polygon";import{polygon as l}from"@turf/helpers";import"@turf/point-to-line-distance";import*as e from"ramda";const n=(o,r)=>{const t=o[0],l=o[1];let e=!1;for(let o=0,n=r.length-1;o<r.length;n=o++){const u=r[o][0],s=r[o][1],f=r[n][0],i=r[n][1];s>l!=i>l&&t<(f-u)*(l-s)/(i-s)+u&&(e=!e)}return e},u=({n:o,s:r,e:t,w:l})=>[[o,t],[o,l],[r,l],[r,t],[o,t]],s={structure:null,floor:null};function f(l,f,i,p,a,m=!1){if(!e.length(l))return s;const g=(l=l.filter((o=>null==o.shouldDisplay||!0===o.shouldDisplay))).map((o=>({structure:o,floor:d(o,p)})));return function(l,f,i,d,p,a){const m=f.filter((o=>o.floor)).filter((o=>n([i,d],u(o.floor.bounds))));if(a){if(0===m.length)return s;const o=m.filter((o=>n([i,d],o.floor.boundsPolygon)));return o.length>=1?e.head(o):s}if(0===m.length){const o=l.filter((o=>n([i,d],u(o.bounds)))).map((o=>({structure:o,floor:null})));return o.length>=1?o[0]:s}if(1===m.length)return m[0];const g=m.filter((o=>n([i,d],o.floor.boundsPolygon))),h=m.map((l=>function({structure:l,floor:e},n,u){const s=c(e.boundsPolygon),f=t(n),i=r(s,n),d=o(i),p=o(f);return d*(u?150:100)/p}(l,p,g.some((o=>o.floor.id===l.floor.id)))));console.log("!pointWithinFloorsBBox:",m.map((o=>o.floor.id))),console.log("!prominenceScores:",h);const b=Math.max.apply(null,h);return console.log("!bestScore:",b),m[h.indexOf(b)]}(l,g,f,i,a,m)}const i=o=>[o[1],o[0]],c=o=>l([o.map(i)]),d=(o,r)=>Object.values(o.levels).find((o=>o.ordinal===r)),p=(o,r)=>o.reduce(((o,t)=>Object.values(t.levels).find((o=>o.id===r))||o),void 0),a=(o,r)=>o.reduce(((o,t)=>m(t,r)?t:o),null),m=(o,r)=>Object.values(o.levels).reduce(((o,t)=>t.id===r||o),!1);function g(o,r,t,l,e,n,u,s){let f=0,i=0,c=0,d=0,p=0;const a=[{x:o,y:r}];for(let m=1,g=0;m<=20;++m)g=m/20,f=1-g,i=f*f,c=i*f,d=g*g,p=d*g,a.push({x:c*o+3*i*g*t+3*f*d*e+p*u,y:c*r+3*i*g*l+3*f*d*n+p*s});return a}export{g as bezierCurveTo,p as getFloor,f as getStructureAndFloorAtPoint,a as getStructureForFloorId,d as ordToFloor,n as pointInPolygon};
@@ -1 +1 @@
1
- import{getFloor as o,getBuildingAndFloorAtPoint as t,getStructureForFloorId as n}from"./geom.js";async function l(l,i){if(i.poiId)return l.bus.get("wayfinder/getNavigationEndpoint",{ep:i.poiId});let{lat:a,lng:d,ord:e,ordinal:u,floorId:f,title:s="",structureId:c}=i;if(null==a||null==d)throw Error("To obtain a location, you must provide a lat,lng or a poiId");void 0===u&&void 0!==e&&(u=e);const g=await r(l);if(null==u){if(null==f)throw Error("Call to locationToEndpoint with no ordinal and no floorId");{const t=o(g,f);if(!t)throw Error(`floor with id ${f} not found.`);u=t.ordinal}}else if(null==f){const{building:o,floor:n}=t(g,a,d,u,!0);f=n?.id,c=o?.id}return null!=f&&null==c&&(c=n(g,f)?.id),{lat:a,lng:d,floorId:f,ordinal:u,title:s,structureId:c}}const r=async o=>o.bus.get("venueData/getVenueData").then((o=>o.structures));export{r as getStructures,l as locationToEndpoint};
1
+ import{getFloor as o,getStructureAndFloorAtPoint as t,getStructureForFloorId as n}from"./geom.js";async function r(r,l){if(l.poiId)return r.bus.get("wayfinder/getNavigationEndpoint",{ep:l.poiId});let{lat:a,lng:e,ord:u,ordinal:d,floorId:s,title:f="",structureId:c}=l;if(null==a||null==e)throw Error("To obtain a location, you must provide a lat,lng or a poiId");void 0===d&&void 0!==u&&(d=u);const g=await i(r);if(null==d){if(null==s)throw Error("Call to locationToEndpoint with no ordinal and no floorId");{const t=o(g,s);if(!t)throw Error(`floor with id ${s} not found.`);d=t.ordinal}}else if(null==s){const o=await r.bus.get("map/getViewBBox"),{structure:n,floor:i}=t(g,a,e,d,o,!0);s=i?.id,c=n?.id}return null!=s&&null==c&&(c=n(g,s)?.id),{lat:a,lng:e,floorId:s,ordinal:d,title:f,structureId:c}}const i=async o=>o.bus.get("venueData/getVenueData").then((o=>o.structures));export{i as getStructures,r as locationToEndpoint};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "atriusmaps-node-sdk",
3
- "version": "3.3.390",
3
+ "version": "3.3.392",
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",
@@ -44,6 +44,7 @@
44
44
  "flexsearch": "^0.7.43",
45
45
  "https-proxy-agent": "^7.0.4",
46
46
  "i18next": "^20.3.4",
47
+ "luxon": "^3.3.0",
47
48
  "node-fetch": "^2.6.1",
48
49
  "query-string": "^7.0.1",
49
50
  "ramda": "^0.30.1",