@mapvx/web-js 1.4.0 → 1.5.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/cjs/domain/models/place.js.map +1 -1
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/logger/logger.js +1 -1
  4. package/dist/cjs/logger/rollbar.js +1 -1
  5. package/dist/cjs/map/fitCamera.js +124 -0
  6. package/dist/cjs/map/fitCamera.js.map +1 -0
  7. package/dist/cjs/map/map.js +53 -6
  8. package/dist/cjs/map/map.js.map +1 -1
  9. package/dist/cjs/repository/repository.js +31 -14
  10. package/dist/cjs/repository/repository.js.map +1 -1
  11. package/dist/cjs/repository/requester.js +84 -69
  12. package/dist/cjs/repository/requester.js.map +1 -1
  13. package/dist/cjs/sdk.js +18 -8
  14. package/dist/cjs/sdk.js.map +1 -1
  15. package/dist/es/domain/models/place.d.ts +51 -0
  16. package/dist/es/domain/models/place.d.ts.map +1 -1
  17. package/dist/es/domain/models/place.js.map +1 -1
  18. package/dist/es/domain/models/routeConfiguration.d.ts +38 -0
  19. package/dist/es/domain/models/routeConfiguration.d.ts.map +1 -1
  20. package/dist/es/index.d.ts +1 -0
  21. package/dist/es/index.d.ts.map +1 -1
  22. package/dist/es/index.js.map +1 -1
  23. package/dist/es/logger/logger.js +1 -1
  24. package/dist/es/logger/rollbar.js +1 -1
  25. package/dist/es/map/fitCamera.d.ts +94 -0
  26. package/dist/es/map/fitCamera.d.ts.map +1 -0
  27. package/dist/es/map/fitCamera.js +120 -0
  28. package/dist/es/map/fitCamera.js.map +1 -0
  29. package/dist/es/map/map.d.ts +33 -1
  30. package/dist/es/map/map.d.ts.map +1 -1
  31. package/dist/es/map/map.js +53 -6
  32. package/dist/es/map/map.js.map +1 -1
  33. package/dist/es/repository/repository.d.ts +15 -3
  34. package/dist/es/repository/repository.d.ts.map +1 -1
  35. package/dist/es/repository/repository.js +31 -14
  36. package/dist/es/repository/repository.js.map +1 -1
  37. package/dist/es/repository/requester.d.ts +31 -5
  38. package/dist/es/repository/requester.d.ts.map +1 -1
  39. package/dist/es/repository/requester.js +84 -69
  40. package/dist/es/repository/requester.js.map +1 -1
  41. package/dist/es/sdk.d.ts +30 -7
  42. package/dist/es/sdk.d.ts.map +1 -1
  43. package/dist/es/sdk.js +18 -8
  44. package/dist/es/sdk.js.map +1 -1
  45. package/dist/umd/index.js +763 -397
  46. package/dist/umd/index.js.map +1 -1
  47. package/package.json +1 -1
package/dist/umd/index.js CHANGED
@@ -6814,7 +6814,7 @@ var rollbar_umd_min_default = /*#__PURE__*/__webpack_require__.n(rollbar_umd_min
6814
6814
  // version placeholder is replaced with the package version by
6815
6815
  // scripts/inject-build-defines.js. The access token falls back to the MapVX
6816
6816
  // SDK-web Rollbar project token when none is injected at build time.
6817
- var SDK_VERSION = true ? "1.4.0" : 0;
6817
+ var SDK_VERSION = true ? "1.5.0-dev.2" : 0;
6818
6818
  var ACCESS_TOKEN = false ? 0 : "28279d52df43411ebd138c2bee0ab1df";
6819
6819
  var _rollbarConfig = {
6820
6820
  accessToken: ACCESS_TOKEN,
@@ -6861,7 +6861,7 @@ function logger_toPrimitive(t, r) { if ("object" != logger_typeof(t) || !t) retu
6861
6861
  // by scripts/inject-build-defines.js. The Countly key falls back to the
6862
6862
  // MapVX key when none is injected at build time.
6863
6863
  var IS_DEBUG = true ? false : 0;
6864
- var logger_SDK_VERSION = true ? "1.4.0" : 0;
6864
+ var logger_SDK_VERSION = true ? "1.5.0-dev.2" : 0;
6865
6865
  var COUNTLY_API_KEY = false ? 0 : "f0c8d3b96d336e857a8628f49dd1baf7d7add0e9";
6866
6866
  var logger_countly = {
6867
6867
  apiKey: COUNTLY_API_KEY,
@@ -9550,6 +9550,16 @@ function InternalDrawRouteConfiguration(config) {
9550
9550
  /**
9551
9551
  * Interface that represent a place with their id.
9552
9552
  * @group Routes
9553
+ * @example
9554
+ * ```typescript
9555
+ * // Resolve an internal alias that is reused across several malls by
9556
+ * // pinning the building (and, optionally, the floor) it belongs to.
9557
+ * const origin: IdLocation = {
9558
+ * id: "store-204", // integrator alias, may repeat across buildings
9559
+ * buildingId: "mall-santiago",
9560
+ * floorId: "level-2", // takes precedence over `level`
9561
+ * }
9562
+ * ```
9553
9563
  */
9554
9564
 
9555
9565
  /**
@@ -9641,208 +9651,6 @@ var InternalAnimationDrawingConfig = /*#__PURE__*/function () {
9641
9651
  }
9642
9652
  }]);
9643
9653
  }();
9644
- ;// ./src/utils/error.ts
9645
- /**
9646
- * Convert an unknown error to an Error object.
9647
- * @group Utils
9648
- * @param error - The unknown error.
9649
- * @returns An Error object.
9650
- */
9651
- function convertToError(error) {
9652
- if (error instanceof Error) {
9653
- return error;
9654
- } else {
9655
- var text = String(error);
9656
- return new Error(text);
9657
- }
9658
- }
9659
- ;// ./src/domain/models/loggeable.ts
9660
- function loggeable_typeof(o) { "@babel/helpers - typeof"; return loggeable_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, loggeable_typeof(o); }
9661
- function loggeable_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
9662
- function loggeable_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, loggeable_toPropertyKey(o.key), o); } }
9663
- function loggeable_createClass(e, r, t) { return r && loggeable_defineProperties(e.prototype, r), t && loggeable_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
9664
- function loggeable_toPropertyKey(t) { var i = loggeable_toPrimitive(t, "string"); return "symbol" == loggeable_typeof(i) ? i : i + ""; }
9665
- function loggeable_toPrimitive(t, r) { if ("object" != loggeable_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != loggeable_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9666
-
9667
-
9668
-
9669
- /**
9670
- * Represents the abstract class for the loggeable.
9671
- * @hidden
9672
- */
9673
- var Loggeable = /*#__PURE__*/function () {
9674
- /**
9675
- * The object to log the events and errors.
9676
- */
9677
-
9678
- function Loggeable() {
9679
- loggeable_classCallCheck(this, Loggeable);
9680
- this.logger = Logger.getInstance();
9681
- }
9682
-
9683
- /**
9684
- * Add values to identify the client.
9685
- * @param segmentation The pair values to use as segmentation.
9686
- * @returns The segmentation with the added values.
9687
- */
9688
- return loggeable_createClass(Loggeable, [{
9689
- key: "logEvent",
9690
- value:
9691
- /**
9692
- * To log a event in this class.
9693
- * @param eventName The event name.
9694
- * @param eventSegmentation The pair key, value to segment this event count.
9695
- */
9696
- function logEvent(eventName) {
9697
- var eventSegmentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9698
- this.logger.logEvent(eventName, this.prepareSegmentation(eventSegmentation));
9699
- }
9700
-
9701
- /**
9702
- * To log a captured error in this class.
9703
- * @param error The captured error
9704
- * @param args The rest of the arguments.
9705
- */
9706
- }, {
9707
- key: "logError",
9708
- value: function logError(error) {
9709
- var _this$logger;
9710
- var errorTyped = convertToError(error);
9711
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9712
- args[_key - 1] = arguments[_key];
9713
- }
9714
- (_this$logger = this.logger).logError.apply(_this$logger, [errorTyped].concat(args));
9715
- }
9716
-
9717
- /**
9718
- * To log a captured error as a warning.
9719
- * @param error The captured error
9720
- * @param args The rest of the arguments.
9721
- */
9722
- }, {
9723
- key: "logWarning",
9724
- value: function logWarning(error) {
9725
- var _this$logger2;
9726
- var errorTyped = convertToError(error);
9727
- for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
9728
- args[_key2 - 1] = arguments[_key2];
9729
- }
9730
- (_this$logger2 = this.logger).logWarning.apply(_this$logger2, [errorTyped].concat(args));
9731
- }
9732
- }, {
9733
- key: "logDebug",
9734
- value: function logDebug() {
9735
- var _this$logger3;
9736
- (_this$logger3 = this.logger).logDebug.apply(_this$logger3, arguments);
9737
- }
9738
-
9739
- /**
9740
- * Prints in console any number of given arguments, if and only if, app is running in debug mode.
9741
- * @param args An array of arguments to log
9742
- */
9743
- }, {
9744
- key: "debugLog",
9745
- value: function debugLog() {
9746
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
9747
- args[_key3] = arguments[_key3];
9748
- }
9749
- this.logger.debugLog(args);
9750
- }
9751
- }]);
9752
- }();
9753
- ;// ./src/domain/models/mapConfig.ts
9754
- /**
9755
- * Configuration options for map tile caching.
9756
- * Allows controlling how map tiles are cached in memory and persisted via service worker.
9757
- *
9758
- * @example
9759
- * ```typescript
9760
- * const tileCacheConfig: MapTileCacheConfig = {
9761
- * enabled: true,
9762
- * maxTiles: 500,
9763
- * ttlMs: 60 * 60 * 1000, // 1 hour
9764
- * persistToServiceWorker: true,
9765
- * preloadAdjacentZooms: false,
9766
- * maxConcurrentTileFetches: 6
9767
- * };
9768
- * ```
9769
- *
9770
- * @group Configuration
9771
- */
9772
-
9773
- /**
9774
- * Default values for tile cache configuration
9775
- * @internal
9776
- */
9777
- var DEFAULT_TILE_CACHE_CONFIG = {
9778
- enabled: true,
9779
- maxTiles: 400,
9780
- ttlMs: 30 * 60 * 1000,
9781
- // 30 minutes
9782
- persistToServiceWorker: true,
9783
- preloadAdjacentZooms: false,
9784
- maxConcurrentTileFetches: 6
9785
- };
9786
-
9787
- /**
9788
- * Hard cap for {@link MapTileCacheConfig.maxTiles}.
9789
- * Configurations above this (e.g. millions) are clamped to avoid memory pressure
9790
- * and excessive interaction with the tile CDN / service worker.
9791
- *
9792
- * @internal
9793
- */
9794
- var MAPLIBRE_MAX_TILE_CACHE_HARD_CAP = 100000;
9795
-
9796
- /**
9797
- * Basic configuration for the map.
9798
- * Provides essential settings for initializing and customizing map behavior.
9799
- *
9800
- * @example
9801
- * ```typescript
9802
- * const mapConfig: MapConfig = {
9803
- * zoom: 15,
9804
- * center: { lat: 40.7128, lng: -74.0060 },
9805
- * parentPlaceId: "building-1",
9806
- * onMapReady: () => console.log("Map is ready!"),
9807
- * enableHover: true,
9808
- * showCompass: true
9809
- * };
9810
- * ```
9811
- *
9812
- * @group Map
9813
- *
9814
- * @property zoom - The initial zoom level of the map.
9815
- * @property center - The initial center coordinates of the map.
9816
- * @property parentPlaceId - (Optional) The ID of the parent place to display.
9817
- * @property otherPotentialParentPlacesIds - (Optional) List of alternative parent place IDs.
9818
- * @property onMapReady - (Optional) Callback invoked when the map is ready.
9819
- * @property onZoomEnd - (Optional) Callback invoked when the zoom operation ends. Receives the new zoom level.
9820
- * @property onRotate - (Optional) Callback invoked when the map is rotated. Receives the rotation in degrees.
9821
- * @property onFloorChange - (Optional) Callback invoked when the floor changes. Receives the new floor ID.
9822
- * @property onParentPlaceChange - (Optional) Callback invoked when the parent place changes. Receives the new parent place ID.
9823
- * @property lang - (Optional) Language code for map labels and UI.
9824
- * @property minZoom - (Optional) Minimum allowed zoom level.
9825
- * @property maxZoom - (Optional) Maximum allowed zoom level.
9826
- * @property pitch - (Optional) The pitch (tilt) of the map in degrees.
9827
- * @property maxBounds - (Optional) Array of coordinates defining the maximum bounds of the map.
9828
- * @property enableHover - (Optional) Whether to enable hover interactions on the map.
9829
- * @property showCompass - (Optional) Whether to display the compass control.
9830
- * @property showZoom - (Optional) Whether to display the zoom control.
9831
- * @property navigationPosition - (Optional) Position of the navigation controls on the map.
9832
- * @property bearingSnap - (Optional) The bearing snap threshold in degrees.
9833
- * @property bearing - (Optional) Initial bearing (rotation) of the map in degrees, clockwise from north.
9834
- * @property interactive - (Optional) Master switch for all user interaction (pan/zoom/rotate).
9835
- * @property rotateEnabled - (Optional) Whether the user can rotate the map; keeps pinch-zoom when disabled.
9836
- * @property dragPan - (Optional) Whether the user can pan by dragging/swiping.
9837
- * @property scrollZoom - (Optional) Whether the scroll wheel/trackpad can zoom the map.
9838
- * @property doubleClickZoom - (Optional) Whether double-click/double-tap zooms the map.
9839
- * @property touchZoomRotate - (Optional) Whether pinch gestures can zoom the map on touch devices.
9840
- * @property keyboard - (Optional) Whether keyboard shortcuts can pan/zoom/rotate the map.
9841
- * @property institutionId - (Optional) The institution identifier for map context. Required for loading map related data from Portal.
9842
- * @property authToken - (Optional) Authentication token for accessing protected map resources. Required for loading map related data from Portal.
9843
- * @property apiUrl - (Optional) Injected by SDK when creating map; base API URL for map requests.
9844
- * @property mapvxRequestContext - (Optional) Injected by SDK when creating map; context sent as headers to public-api.mapvx.com.
9845
- */
9846
9654
  ;// ./src/domain/models/circle.ts
9847
9655
  function circle_typeof(o) { "@babel/helpers - typeof"; return circle_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, circle_typeof(o); }
9848
9656
  function circle_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -10066,62 +9874,264 @@ function resolveCircleConfig(config) {
10066
9874
  }
10067
9875
 
10068
9876
  /**
10069
- * Builds a closed GeoJSON polygon ring approximating a geographic circle.
10070
- *
10071
- * The ring is computed with an equirectangular approximation: meters are
10072
- * converted to degrees independently per axis, with the longitude scale
10073
- * corrected by the cosine of the latitude. For the radii the SDK works with
10074
- * (tens to hundreds of meters) the metric error is negligible (≤1%) at any latitude
10075
- * where the projection is defined. At extreme polar latitudes, the approximation
10076
- * breaks down, so circles near poles (|lat| > 85°) should be used with caution.
9877
+ * Builds a closed GeoJSON polygon ring approximating a geographic circle.
9878
+ *
9879
+ * The ring is computed with an equirectangular approximation: meters are
9880
+ * converted to degrees independently per axis, with the longitude scale
9881
+ * corrected by the cosine of the latitude. For the radii the SDK works with
9882
+ * (tens to hundreds of meters) the metric error is negligible (≤1%) at any latitude
9883
+ * where the projection is defined. At extreme polar latitudes, the approximation
9884
+ * breaks down, so circles near poles (|lat| > 85°) should be used with caution.
9885
+ *
9886
+ * @param lng Longitude of the circle center in degrees.
9887
+ * @param lat Latitude of the circle center in degrees.
9888
+ * @param radiusMeters Radius of the circle in meters. Must be positive and finite.
9889
+ * @param points Number of segments in the ring. Defaults to 64. Non-integer
9890
+ * values are floored and the count is clamped to a minimum of 3,
9891
+ * the smallest valid GeoJSON linear ring; non-finite values fall
9892
+ * back to the default.
9893
+ * @returns A closed ring of `[lng, lat]` positions (first equals last).
9894
+ *
9895
+ * @example
9896
+ * ```typescript
9897
+ * import { circleRing } from '@mapvx/web-js';
9898
+ *
9899
+ * // Create a 150-meter radius circle ring
9900
+ * const ring = circleRing(-74.0060, 40.7128, 150);
9901
+ * const polygon = { type: "Polygon", coordinates: [ring] };
9902
+ *
9903
+ * // Custom segments (32 instead of 64) for lower resolution
9904
+ * const coarseRing = circleRing(-74.0060, 40.7128, 150, 32);
9905
+ * ```
9906
+ *
9907
+ * @note Equirectangular approximation is accurate for radii up to ~500 km and
9908
+ * latitudes between approximately ±80°. Beyond these limits, visual
9909
+ * distortion may occur near the poles.
9910
+ * @note Generated rings do not account for geographic obstacles, walls, or
9911
+ * buildings. For complex geofencing, consider server-side validation.
9912
+ *
9913
+ * @group Circles
9914
+ */
9915
+ function circleRing(lng, lat, radiusMeters) {
9916
+ var points = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 64;
9917
+ // A linear ring needs at least 3 distinct positions to be valid GeoJSON
9918
+ var segments = Number.isFinite(points) ? Math.max(3, Math.floor(points)) : 64;
9919
+ var ring = [];
9920
+ var latRad = lat * Math.PI / 180;
9921
+ var metersPerDegLat = 110574;
9922
+ var metersPerDegLng = 111320 * Math.cos(latRad || 0.000001);
9923
+ var latR = radiusMeters / metersPerDegLat;
9924
+ var lngR = radiusMeters / (metersPerDegLng || 1);
9925
+ for (var i = 0; i < segments; i += 1) {
9926
+ var a = i / segments * Math.PI * 2;
9927
+ ring.push([lng + lngR * Math.cos(a), lat + latR * Math.sin(a)]);
9928
+ }
9929
+ // Close the ring with an exact copy of the first position, as GeoJSON requires
9930
+ ring.push([ring[0][0], ring[0][1]]);
9931
+ return ring;
9932
+ }
9933
+ ;// ./src/utils/error.ts
9934
+ /**
9935
+ * Convert an unknown error to an Error object.
9936
+ * @group Utils
9937
+ * @param error - The unknown error.
9938
+ * @returns An Error object.
9939
+ */
9940
+ function convertToError(error) {
9941
+ if (error instanceof Error) {
9942
+ return error;
9943
+ } else {
9944
+ var text = String(error);
9945
+ return new Error(text);
9946
+ }
9947
+ }
9948
+ ;// ./src/domain/models/loggeable.ts
9949
+ function loggeable_typeof(o) { "@babel/helpers - typeof"; return loggeable_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, loggeable_typeof(o); }
9950
+ function loggeable_classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
9951
+ function loggeable_defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, loggeable_toPropertyKey(o.key), o); } }
9952
+ function loggeable_createClass(e, r, t) { return r && loggeable_defineProperties(e.prototype, r), t && loggeable_defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
9953
+ function loggeable_toPropertyKey(t) { var i = loggeable_toPrimitive(t, "string"); return "symbol" == loggeable_typeof(i) ? i : i + ""; }
9954
+ function loggeable_toPrimitive(t, r) { if ("object" != loggeable_typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != loggeable_typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9955
+
9956
+
9957
+
9958
+ /**
9959
+ * Represents the abstract class for the loggeable.
9960
+ * @hidden
9961
+ */
9962
+ var Loggeable = /*#__PURE__*/function () {
9963
+ /**
9964
+ * The object to log the events and errors.
9965
+ */
9966
+
9967
+ function Loggeable() {
9968
+ loggeable_classCallCheck(this, Loggeable);
9969
+ this.logger = Logger.getInstance();
9970
+ }
9971
+
9972
+ /**
9973
+ * Add values to identify the client.
9974
+ * @param segmentation The pair values to use as segmentation.
9975
+ * @returns The segmentation with the added values.
9976
+ */
9977
+ return loggeable_createClass(Loggeable, [{
9978
+ key: "logEvent",
9979
+ value:
9980
+ /**
9981
+ * To log a event in this class.
9982
+ * @param eventName The event name.
9983
+ * @param eventSegmentation The pair key, value to segment this event count.
9984
+ */
9985
+ function logEvent(eventName) {
9986
+ var eventSegmentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9987
+ this.logger.logEvent(eventName, this.prepareSegmentation(eventSegmentation));
9988
+ }
9989
+
9990
+ /**
9991
+ * To log a captured error in this class.
9992
+ * @param error The captured error
9993
+ * @param args The rest of the arguments.
9994
+ */
9995
+ }, {
9996
+ key: "logError",
9997
+ value: function logError(error) {
9998
+ var _this$logger;
9999
+ var errorTyped = convertToError(error);
10000
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
10001
+ args[_key - 1] = arguments[_key];
10002
+ }
10003
+ (_this$logger = this.logger).logError.apply(_this$logger, [errorTyped].concat(args));
10004
+ }
10005
+
10006
+ /**
10007
+ * To log a captured error as a warning.
10008
+ * @param error The captured error
10009
+ * @param args The rest of the arguments.
10010
+ */
10011
+ }, {
10012
+ key: "logWarning",
10013
+ value: function logWarning(error) {
10014
+ var _this$logger2;
10015
+ var errorTyped = convertToError(error);
10016
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
10017
+ args[_key2 - 1] = arguments[_key2];
10018
+ }
10019
+ (_this$logger2 = this.logger).logWarning.apply(_this$logger2, [errorTyped].concat(args));
10020
+ }
10021
+ }, {
10022
+ key: "logDebug",
10023
+ value: function logDebug() {
10024
+ var _this$logger3;
10025
+ (_this$logger3 = this.logger).logDebug.apply(_this$logger3, arguments);
10026
+ }
10027
+
10028
+ /**
10029
+ * Prints in console any number of given arguments, if and only if, app is running in debug mode.
10030
+ * @param args An array of arguments to log
10031
+ */
10032
+ }, {
10033
+ key: "debugLog",
10034
+ value: function debugLog() {
10035
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
10036
+ args[_key3] = arguments[_key3];
10037
+ }
10038
+ this.logger.debugLog(args);
10039
+ }
10040
+ }]);
10041
+ }();
10042
+ ;// ./src/domain/models/mapConfig.ts
10043
+ /**
10044
+ * Configuration options for map tile caching.
10045
+ * Allows controlling how map tiles are cached in memory and persisted via service worker.
10046
+ *
10047
+ * @example
10048
+ * ```typescript
10049
+ * const tileCacheConfig: MapTileCacheConfig = {
10050
+ * enabled: true,
10051
+ * maxTiles: 500,
10052
+ * ttlMs: 60 * 60 * 1000, // 1 hour
10053
+ * persistToServiceWorker: true,
10054
+ * preloadAdjacentZooms: false,
10055
+ * maxConcurrentTileFetches: 6
10056
+ * };
10057
+ * ```
10058
+ *
10059
+ * @group Configuration
10060
+ */
10061
+
10062
+ /**
10063
+ * Default values for tile cache configuration
10064
+ * @internal
10065
+ */
10066
+ var DEFAULT_TILE_CACHE_CONFIG = {
10067
+ enabled: true,
10068
+ maxTiles: 400,
10069
+ ttlMs: 30 * 60 * 1000,
10070
+ // 30 minutes
10071
+ persistToServiceWorker: true,
10072
+ preloadAdjacentZooms: false,
10073
+ maxConcurrentTileFetches: 6
10074
+ };
10075
+
10076
+ /**
10077
+ * Hard cap for {@link MapTileCacheConfig.maxTiles}.
10078
+ * Configurations above this (e.g. millions) are clamped to avoid memory pressure
10079
+ * and excessive interaction with the tile CDN / service worker.
10077
10080
  *
10078
- * @param lng Longitude of the circle center in degrees.
10079
- * @param lat Latitude of the circle center in degrees.
10080
- * @param radiusMeters Radius of the circle in meters. Must be positive and finite.
10081
- * @param points Number of segments in the ring. Defaults to 64. Non-integer
10082
- * values are floored and the count is clamped to a minimum of 3,
10083
- * the smallest valid GeoJSON linear ring; non-finite values fall
10084
- * back to the default.
10085
- * @returns A closed ring of `[lng, lat]` positions (first equals last).
10081
+ * @internal
10082
+ */
10083
+ var MAPLIBRE_MAX_TILE_CACHE_HARD_CAP = 100000;
10084
+
10085
+ /**
10086
+ * Basic configuration for the map.
10087
+ * Provides essential settings for initializing and customizing map behavior.
10086
10088
  *
10087
10089
  * @example
10088
10090
  * ```typescript
10089
- * import { circleRing } from '@mapvx/web-js';
10090
- *
10091
- * // Create a 150-meter radius circle ring
10092
- * const ring = circleRing(-74.0060, 40.7128, 150);
10093
- * const polygon = { type: "Polygon", coordinates: [ring] };
10094
- *
10095
- * // Custom segments (32 instead of 64) for lower resolution
10096
- * const coarseRing = circleRing(-74.0060, 40.7128, 150, 32);
10091
+ * const mapConfig: MapConfig = {
10092
+ * zoom: 15,
10093
+ * center: { lat: 40.7128, lng: -74.0060 },
10094
+ * parentPlaceId: "building-1",
10095
+ * onMapReady: () => console.log("Map is ready!"),
10096
+ * enableHover: true,
10097
+ * showCompass: true
10098
+ * };
10097
10099
  * ```
10098
10100
  *
10099
- * @note Equirectangular approximation is accurate for radii up to ~500 km and
10100
- * latitudes between approximately ±80°. Beyond these limits, visual
10101
- * distortion may occur near the poles.
10102
- * @note Generated rings do not account for geographic obstacles, walls, or
10103
- * buildings. For complex geofencing, consider server-side validation.
10101
+ * @group Map
10104
10102
  *
10105
- * @group Circles
10103
+ * @property zoom - The initial zoom level of the map.
10104
+ * @property center - The initial center coordinates of the map.
10105
+ * @property parentPlaceId - (Optional) The ID of the parent place to display.
10106
+ * @property otherPotentialParentPlacesIds - (Optional) List of alternative parent place IDs.
10107
+ * @property onMapReady - (Optional) Callback invoked when the map is ready.
10108
+ * @property onZoomEnd - (Optional) Callback invoked when the zoom operation ends. Receives the new zoom level.
10109
+ * @property onRotate - (Optional) Callback invoked when the map is rotated. Receives the rotation in degrees.
10110
+ * @property onFloorChange - (Optional) Callback invoked when the floor changes. Receives the new floor ID.
10111
+ * @property onParentPlaceChange - (Optional) Callback invoked when the parent place changes. Receives the new parent place ID.
10112
+ * @property lang - (Optional) Language code for map labels and UI.
10113
+ * @property minZoom - (Optional) Minimum allowed zoom level.
10114
+ * @property maxZoom - (Optional) Maximum allowed zoom level.
10115
+ * @property pitch - (Optional) The pitch (tilt) of the map in degrees.
10116
+ * @property maxBounds - (Optional) Array of coordinates defining the maximum bounds of the map.
10117
+ * @property enableHover - (Optional) Whether to enable hover interactions on the map.
10118
+ * @property showCompass - (Optional) Whether to display the compass control.
10119
+ * @property showZoom - (Optional) Whether to display the zoom control.
10120
+ * @property navigationPosition - (Optional) Position of the navigation controls on the map.
10121
+ * @property bearingSnap - (Optional) The bearing snap threshold in degrees.
10122
+ * @property bearing - (Optional) Initial bearing (rotation) of the map in degrees, clockwise from north.
10123
+ * @property interactive - (Optional) Master switch for all user interaction (pan/zoom/rotate).
10124
+ * @property rotateEnabled - (Optional) Whether the user can rotate the map; keeps pinch-zoom when disabled.
10125
+ * @property dragPan - (Optional) Whether the user can pan by dragging/swiping.
10126
+ * @property scrollZoom - (Optional) Whether the scroll wheel/trackpad can zoom the map.
10127
+ * @property doubleClickZoom - (Optional) Whether double-click/double-tap zooms the map.
10128
+ * @property touchZoomRotate - (Optional) Whether pinch gestures can zoom the map on touch devices.
10129
+ * @property keyboard - (Optional) Whether keyboard shortcuts can pan/zoom/rotate the map.
10130
+ * @property institutionId - (Optional) The institution identifier for map context. Required for loading map related data from Portal.
10131
+ * @property authToken - (Optional) Authentication token for accessing protected map resources. Required for loading map related data from Portal.
10132
+ * @property apiUrl - (Optional) Injected by SDK when creating map; base API URL for map requests.
10133
+ * @property mapvxRequestContext - (Optional) Injected by SDK when creating map; context sent as headers to public-api.mapvx.com.
10106
10134
  */
10107
- function circleRing(lng, lat, radiusMeters) {
10108
- var points = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 64;
10109
- // A linear ring needs at least 3 distinct positions to be valid GeoJSON
10110
- var segments = Number.isFinite(points) ? Math.max(3, Math.floor(points)) : 64;
10111
- var ring = [];
10112
- var latRad = lat * Math.PI / 180;
10113
- var metersPerDegLat = 110574;
10114
- var metersPerDegLng = 111320 * Math.cos(latRad || 0.000001);
10115
- var latR = radiusMeters / metersPerDegLat;
10116
- var lngR = radiusMeters / (metersPerDegLng || 1);
10117
- for (var i = 0; i < segments; i += 1) {
10118
- var a = i / segments * Math.PI * 2;
10119
- ring.push([lng + lngR * Math.cos(a), lat + latR * Math.sin(a)]);
10120
- }
10121
- // Close the ring with an exact copy of the first position, as GeoJSON requires
10122
- ring.push([ring[0][0], ring[0][1]]);
10123
- return ring;
10124
- }
10125
10135
  ;// ./node_modules/.pnpm/@googlemaps+polyline-codec@1.0.28/node_modules/@googlemaps/polyline-codec/dist/index.esm.js
10126
10136
  /**
10127
10137
  * Copyright 2020 Google LLC
@@ -10745,6 +10755,30 @@ function place_toPrimitive(t, r) { if ("object" != place_typeof(t) || !t) return
10745
10755
 
10746
10756
 
10747
10757
 
10758
+ /**
10759
+ * Query used to look up a single place.
10760
+ *
10761
+ * The {@link PlaceQuery.id} can be an internal alias defined by the integrator.
10762
+ * Because aliases are not guaranteed to be globally unique (the same alias may be
10763
+ * reused across different buildings/venues, e.g. the same store alias present in
10764
+ * several shopping malls), provide {@link PlaceQuery.buildingId} —and optionally
10765
+ * {@link PlaceQuery.floorId}— to disambiguate which place the alias refers to.
10766
+ *
10767
+ * This mirrors the disambiguation already available for routes via `IdLocation`.
10768
+ *
10769
+ * @example
10770
+ * ```typescript
10771
+ * // Resolve an alias reused across several malls by pinning the building.
10772
+ * const query: PlaceQuery = {
10773
+ * id: "store-204", // integrator alias, may repeat across buildings
10774
+ * buildingId: "mall-santiago",
10775
+ * floorId: "level-2", // optional; takes precedence over `level`
10776
+ * }
10777
+ * ```
10778
+ *
10779
+ * @group Places & Locations
10780
+ */
10781
+
10748
10782
  /**
10749
10783
  * MapVX place object, is a custom object containing data of a specific real place.
10750
10784
  * Represents a physical location with all its associated metadata and properties.
@@ -11615,16 +11649,23 @@ var Requester = /*#__PURE__*/function () {
11615
11649
  return fetchPlacesFromAnyInstitution;
11616
11650
  }()
11617
11651
  /**
11618
- * Obtain info about specific place. Use mainly to obtain innerFloors
11619
- * @param placeId
11652
+ * Obtain info about specific place. Use mainly to obtain innerFloors.
11653
+ *
11654
+ * When `placeId` is an internal alias that may be reused across buildings, pass
11655
+ * `buildingId` (and optionally `floorId`/`level`) to disambiguate which venue the
11656
+ * alias refers to. `floorId` takes precedence over the numeric `level`.
11620
11657
  * @param token
11658
+ * @param placeId
11659
+ * @param buildingId (Optional) Parent building/venue that contains the place.
11660
+ * @param floorId (Optional) Floor ID within the building.
11661
+ * @param level (Optional) Numeric floor level; used only when `floorId` is absent.
11621
11662
  * @returns
11622
11663
  */
11623
11664
  )
11624
11665
  }, {
11625
11666
  key: "fetchPlaceDetail",
11626
11667
  value: (function () {
11627
- var _fetchPlaceDetail = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee8(token, placeId) {
11668
+ var _fetchPlaceDetail = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee8(token, placeId, buildingId, floorId, level) {
11628
11669
  var options, params;
11629
11670
  return requester_regenerator().w(function (_context8) {
11630
11671
  while (1) switch (_context8.n) {
@@ -11640,11 +11681,19 @@ var Requester = /*#__PURE__*/function () {
11640
11681
  place_id: placeId,
11641
11682
  lang: this.lang
11642
11683
  };
11684
+ if (buildingId !== undefined) {
11685
+ params.building = buildingId;
11686
+ }
11687
+ if (floorId !== undefined) {
11688
+ params.floor = floorId;
11689
+ } else if (level !== undefined) {
11690
+ params.floor = level;
11691
+ }
11643
11692
  return _context8.a(2, this.fetchFromUrl(this.baseUrl + "place", params, options));
11644
11693
  }
11645
11694
  }, _callee8, this);
11646
11695
  }));
11647
- function fetchPlaceDetail(_x14, _x15) {
11696
+ function fetchPlaceDetail(_x14, _x15, _x16, _x17, _x18) {
11648
11697
  return _fetchPlaceDetail.apply(this, arguments);
11649
11698
  }
11650
11699
  return fetchPlaceDetail;
@@ -11654,8 +11703,15 @@ var Requester = /*#__PURE__*/function () {
11654
11703
  * Can be used to obtain any place detail, without the limitation of the ApiKey.
11655
11704
  * Therefore, does not make use of an ApiKey but rather an authentication token.
11656
11705
  *
11657
- * @param token - The authentication token used for authorization in the request header.
11706
+ * When `placeId` is an internal alias that may be reused across buildings, pass
11707
+ * `buildingId` (and optionally `floorId`/`level`) to disambiguate which venue the
11708
+ * alias refers to. `floorId` takes precedence over the numeric `level`.
11709
+ *
11710
+ * @param authToken - The authentication token used for authorization in the request header.
11658
11711
  * @param placeId - The unique identifier of the place to retrieve details for.
11712
+ * @param buildingId - (Optional) Parent building/venue that contains the place.
11713
+ * @param floorId - (Optional) Floor ID within the building.
11714
+ * @param level - (Optional) Numeric floor level; used only when `floorId` is absent.
11659
11715
  * @returns A promise that resolves to the HTTP response containing the place details.
11660
11716
  *
11661
11717
  */
@@ -11663,7 +11719,7 @@ var Requester = /*#__PURE__*/function () {
11663
11719
  }, {
11664
11720
  key: "fetchAnyPlaceDetail",
11665
11721
  value: (function () {
11666
- var _fetchAnyPlaceDetail = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee9(authToken, placeId) {
11722
+ var _fetchAnyPlaceDetail = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee9(authToken, placeId, buildingId, floorId, level) {
11667
11723
  var options, params;
11668
11724
  return requester_regenerator().w(function (_context9) {
11669
11725
  while (1) switch (_context9.n) {
@@ -11679,11 +11735,19 @@ var Requester = /*#__PURE__*/function () {
11679
11735
  place_id: placeId,
11680
11736
  lang: this.lang
11681
11737
  };
11738
+ if (buildingId !== undefined) {
11739
+ params.building = buildingId;
11740
+ }
11741
+ if (floorId !== undefined) {
11742
+ params.floor = floorId;
11743
+ } else if (level !== undefined) {
11744
+ params.floor = level;
11745
+ }
11682
11746
  return _context9.a(2, this.fetchFromUrl(this.baseUrlPortal + "place", params, options));
11683
11747
  }
11684
11748
  }, _callee9, this);
11685
11749
  }));
11686
- function fetchAnyPlaceDetail(_x16, _x17) {
11750
+ function fetchAnyPlaceDetail(_x19, _x20, _x21, _x22, _x23) {
11687
11751
  return _fetchAnyPlaceDetail.apply(this, arguments);
11688
11752
  }
11689
11753
  return fetchAnyPlaceDetail;
@@ -11718,7 +11782,7 @@ var Requester = /*#__PURE__*/function () {
11718
11782
  }
11719
11783
  }, _callee0, this);
11720
11784
  }));
11721
- function fetchSubPlaces(_x18, _x19) {
11785
+ function fetchSubPlaces(_x24, _x25) {
11722
11786
  return _fetchSubPlaces.apply(this, arguments);
11723
11787
  }
11724
11788
  return fetchSubPlaces;
@@ -11759,22 +11823,112 @@ var Requester = /*#__PURE__*/function () {
11759
11823
  }
11760
11824
  }, _callee1, this);
11761
11825
  }));
11762
- function fetchAnySubPlaces(_x20, _x21) {
11826
+ function fetchAnySubPlaces(_x26, _x27) {
11763
11827
  return _fetchAnySubPlaces.apply(this, arguments);
11764
11828
  }
11765
11829
  return fetchAnySubPlaces;
11766
11830
  }()
11831
+ /**
11832
+ * Build the cleaned query parameters for a route request.
11833
+ *
11834
+ * Resolves both the origin (`from*`) and destination (`to*`) sides of the route
11835
+ * from the provided configuration. For {@link IdLocation} endpoints this also
11836
+ * forwards the building (`fromBuilding`/`toBuilding`) and floor
11837
+ * (`fromFloor`/`toFloor`) so internal aliases that are reused across buildings
11838
+ * can be disambiguated. Parameters that resolve to `null`/`undefined` are dropped.
11839
+ * @param routeConfig The route configuration to translate into query params.
11840
+ * @returns The cleaned query parameters ready to be appended to the request URL.
11841
+ */
11842
+ )
11843
+ }, {
11844
+ key: "buildRouteParams",
11845
+ value: function buildRouteParams(routeConfig) {
11846
+ var params = {
11847
+ fromLatLng: undefined,
11848
+ fromBuilding: undefined,
11849
+ fromFloor: undefined,
11850
+ toLatLng: undefined,
11851
+ toBuilding: undefined,
11852
+ toFloor: undefined,
11853
+ fromPlaceId: undefined,
11854
+ toPlaceId: undefined,
11855
+ travelMode: TransportationMode.walking,
11856
+ reducedMobility: routeConfig.preferAccessibleRoute ? 1 : 0,
11857
+ announceFormat: routeConfig.announceFormat,
11858
+ userBearing: routeConfig.userBearing,
11859
+ lang: this.lang,
11860
+ unitSystem: routeConfig.unitSystem
11861
+ };
11862
+ if ("id" in routeConfig.initialLocation) {
11863
+ var _routeConfig$initialL = routeConfig.initialLocation,
11864
+ id = _routeConfig$initialL.id,
11865
+ buildingId = _routeConfig$initialL.buildingId,
11866
+ floorId = _routeConfig$initialL.floorId,
11867
+ level = _routeConfig$initialL.level;
11868
+ params.fromPlaceId = id;
11869
+ if (buildingId !== undefined) {
11870
+ params.fromBuilding = buildingId;
11871
+ }
11872
+ if (floorId !== undefined) {
11873
+ params.fromFloor = floorId;
11874
+ } else if (level !== undefined) {
11875
+ params.fromFloor = level;
11876
+ }
11877
+ } else {
11878
+ var _routeConfig$initialL2 = routeConfig.initialLocation,
11879
+ lat = _routeConfig$initialL2.lat,
11880
+ lng = _routeConfig$initialL2.lng,
11881
+ _floorId = _routeConfig$initialL2.floorId,
11882
+ placeId = _routeConfig$initialL2.placeId;
11883
+ params.fromLatLng = "".concat(lat, ",").concat(lng);
11884
+ params.fromFloor = _floorId;
11885
+ params.fromBuilding = placeId;
11886
+ }
11887
+ if ("id" in routeConfig.finalLocation) {
11888
+ var _routeConfig$finalLoc = routeConfig.finalLocation,
11889
+ _id = _routeConfig$finalLoc.id,
11890
+ _buildingId = _routeConfig$finalLoc.buildingId,
11891
+ _floorId2 = _routeConfig$finalLoc.floorId,
11892
+ _level = _routeConfig$finalLoc.level;
11893
+ params.toPlaceId = _id;
11894
+ if (_buildingId !== undefined) {
11895
+ params.toBuilding = _buildingId;
11896
+ }
11897
+ if (_floorId2 !== undefined) {
11898
+ params.toFloor = _floorId2;
11899
+ } else if (_level !== undefined) {
11900
+ params.toFloor = _level;
11901
+ }
11902
+ } else {
11903
+ var _routeConfig$finalLoc2 = routeConfig.finalLocation,
11904
+ _lat = _routeConfig$finalLoc2.lat,
11905
+ _lng = _routeConfig$finalLoc2.lng,
11906
+ _floorId3 = _routeConfig$finalLoc2.floorId,
11907
+ _placeId = _routeConfig$finalLoc2.placeId;
11908
+ params.toLatLng = "".concat(_lat, ",").concat(_lng);
11909
+ params.toFloor = _floorId3;
11910
+ params.toBuilding = _placeId;
11911
+ }
11912
+ var cleanParams = {};
11913
+ for (var key in params) {
11914
+ var value = params[key];
11915
+ if (value != null) {
11916
+ cleanParams[key] = value;
11917
+ }
11918
+ }
11919
+ return cleanParams;
11920
+ }
11921
+
11767
11922
  /**
11768
11923
  * To obtain the route
11769
11924
  * @param routeConfig
11770
11925
  * @returns
11771
11926
  */
11772
- )
11773
11927
  }, {
11774
11928
  key: "fetchRoute",
11775
11929
  value: (function () {
11776
11930
  var _fetchRoute = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee10(routeConfig, token) {
11777
- var options, params, _routeConfig$initialL, lat, lng, floorId, placeId, _routeConfig$finalLoc, _lat, _lng, _floorId, _placeId, cleanParams, key, value;
11931
+ var options, cleanParams;
11778
11932
  return requester_regenerator().w(function (_context10) {
11779
11933
  while (1) switch (_context10.n) {
11780
11934
  case 0:
@@ -11785,56 +11939,12 @@ var Requester = /*#__PURE__*/function () {
11785
11939
  Authorization: "Bearer ".concat(token)
11786
11940
  }
11787
11941
  };
11788
- params = {
11789
- fromLatLng: undefined,
11790
- fromBuilding: undefined,
11791
- fromFloor: undefined,
11792
- toLatLng: undefined,
11793
- toBuilding: undefined,
11794
- toFloor: undefined,
11795
- fromPlaceId: undefined,
11796
- toPlaceId: undefined,
11797
- travelMode: TransportationMode.walking,
11798
- reducedMobility: routeConfig.preferAccessibleRoute ? 1 : 0,
11799
- announceFormat: routeConfig.announceFormat,
11800
- userBearing: routeConfig.userBearing,
11801
- lang: this.lang,
11802
- unitSystem: routeConfig.unitSystem
11803
- };
11804
- if ("id" in routeConfig.initialLocation) {
11805
- params.fromPlaceId = routeConfig.initialLocation.id;
11806
- if (routeConfig.initialLocation.level !== undefined) {
11807
- params.fromFloor = routeConfig.initialLocation.level;
11808
- }
11809
- } else {
11810
- _routeConfig$initialL = routeConfig.initialLocation, lat = _routeConfig$initialL.lat, lng = _routeConfig$initialL.lng, floorId = _routeConfig$initialL.floorId, placeId = _routeConfig$initialL.placeId;
11811
- params.fromLatLng = "".concat(lat, ",").concat(lng);
11812
- params.fromFloor = floorId;
11813
- params.fromBuilding = placeId;
11814
- }
11815
- if ("id" in routeConfig.finalLocation) {
11816
- params.toPlaceId = routeConfig.finalLocation.id;
11817
- if (routeConfig.finalLocation.level !== undefined) {
11818
- params.toFloor = routeConfig.finalLocation.level;
11819
- }
11820
- } else {
11821
- _routeConfig$finalLoc = routeConfig.finalLocation, _lat = _routeConfig$finalLoc.lat, _lng = _routeConfig$finalLoc.lng, _floorId = _routeConfig$finalLoc.floorId, _placeId = _routeConfig$finalLoc.placeId;
11822
- params.toLatLng = "".concat(_lat, ",").concat(_lng);
11823
- params.toFloor = _floorId;
11824
- params.toBuilding = _placeId;
11825
- }
11826
- cleanParams = {};
11827
- for (key in params) {
11828
- value = params[key];
11829
- if (value != null) {
11830
- cleanParams[key] = value;
11831
- }
11832
- }
11942
+ cleanParams = this.buildRouteParams(routeConfig);
11833
11943
  return _context10.a(2, this.fetchFromUrl(this.routeBaseUrl + "route", cleanParams, options));
11834
11944
  }
11835
11945
  }, _callee10, this);
11836
11946
  }));
11837
- function fetchRoute(_x22, _x23) {
11947
+ function fetchRoute(_x28, _x29) {
11838
11948
  return _fetchRoute.apply(this, arguments);
11839
11949
  }
11840
11950
  return fetchRoute;
@@ -11849,7 +11959,7 @@ var Requester = /*#__PURE__*/function () {
11849
11959
  key: "fetchRouteV2",
11850
11960
  value: (function () {
11851
11961
  var _fetchRouteV = requester_asyncToGenerator(/*#__PURE__*/requester_regenerator().m(function _callee11(routeConfig, token) {
11852
- var options, params, _routeConfig$initialL2, lat, lng, floorId, placeId, _routeConfig$finalLoc2, _lat2, _lng2, _floorId2, _placeId2, cleanParams, key, value;
11962
+ var options, cleanParams;
11853
11963
  return requester_regenerator().w(function (_context11) {
11854
11964
  while (1) switch (_context11.n) {
11855
11965
  case 0:
@@ -11860,56 +11970,12 @@ var Requester = /*#__PURE__*/function () {
11860
11970
  Authorization: "Bearer ".concat(token)
11861
11971
  }
11862
11972
  };
11863
- params = {
11864
- fromLatLng: undefined,
11865
- fromBuilding: undefined,
11866
- fromFloor: undefined,
11867
- toLatLng: undefined,
11868
- toBuilding: undefined,
11869
- toFloor: undefined,
11870
- fromPlaceId: undefined,
11871
- toPlaceId: undefined,
11872
- travelMode: TransportationMode.walking,
11873
- reducedMobility: routeConfig.preferAccessibleRoute ? 1 : 0,
11874
- announceFormat: routeConfig.announceFormat,
11875
- userBearing: routeConfig.userBearing,
11876
- lang: this.lang,
11877
- unitSystem: routeConfig.unitSystem
11878
- };
11879
- if ("id" in routeConfig.initialLocation) {
11880
- params.fromPlaceId = routeConfig.initialLocation.id;
11881
- if (routeConfig.initialLocation.level !== undefined) {
11882
- params.fromFloor = routeConfig.initialLocation.level;
11883
- }
11884
- } else {
11885
- _routeConfig$initialL2 = routeConfig.initialLocation, lat = _routeConfig$initialL2.lat, lng = _routeConfig$initialL2.lng, floorId = _routeConfig$initialL2.floorId, placeId = _routeConfig$initialL2.placeId;
11886
- params.fromLatLng = "".concat(lat, ",").concat(lng);
11887
- params.fromFloor = floorId;
11888
- params.fromBuilding = placeId;
11889
- }
11890
- if ("id" in routeConfig.finalLocation) {
11891
- params.toPlaceId = routeConfig.finalLocation.id;
11892
- if (routeConfig.finalLocation.level !== undefined) {
11893
- params.toFloor = routeConfig.finalLocation.level;
11894
- }
11895
- } else {
11896
- _routeConfig$finalLoc2 = routeConfig.finalLocation, _lat2 = _routeConfig$finalLoc2.lat, _lng2 = _routeConfig$finalLoc2.lng, _floorId2 = _routeConfig$finalLoc2.floorId, _placeId2 = _routeConfig$finalLoc2.placeId;
11897
- params.toLatLng = "".concat(_lat2, ",").concat(_lng2);
11898
- params.toFloor = _floorId2;
11899
- params.toBuilding = _placeId2;
11900
- }
11901
- cleanParams = {};
11902
- for (key in params) {
11903
- value = params[key];
11904
- if (value != null) {
11905
- cleanParams[key] = value;
11906
- }
11907
- }
11973
+ cleanParams = this.buildRouteParams(routeConfig);
11908
11974
  return _context11.a(2, this.fetchFromUrl(this.routeBaseUrl + "v2/route", cleanParams, options));
11909
11975
  }
11910
11976
  }, _callee11, this);
11911
11977
  }));
11912
- function fetchRouteV2(_x24, _x25) {
11978
+ function fetchRouteV2(_x30, _x31) {
11913
11979
  return _fetchRouteV.apply(this, arguments);
11914
11980
  }
11915
11981
  return fetchRouteV2;
@@ -11944,7 +12010,7 @@ var Requester = /*#__PURE__*/function () {
11944
12010
  }
11945
12011
  }, _callee12, this);
11946
12012
  }));
11947
- function fetchInstitutions(_x26) {
12013
+ function fetchInstitutions(_x32) {
11948
12014
  return _fetchInstitutions.apply(this, arguments);
11949
12015
  }
11950
12016
  return fetchInstitutions;
@@ -12001,7 +12067,7 @@ var Requester = /*#__PURE__*/function () {
12001
12067
  }
12002
12068
  }, _callee13, this);
12003
12069
  }));
12004
- function fetchSearchResults(_x27, _x28, _x29, _x30, _x31, _x32, _x33, _x34) {
12070
+ function fetchSearchResults(_x33, _x34, _x35, _x36, _x37, _x38, _x39, _x40) {
12005
12071
  return _fetchSearchResults.apply(this, arguments);
12006
12072
  }
12007
12073
  return fetchSearchResults;
@@ -12069,7 +12135,7 @@ var Requester = /*#__PURE__*/function () {
12069
12135
  }
12070
12136
  }, _callee14, this);
12071
12137
  }));
12072
- function fetchSearchPlacesByTags(_x35, _x36, _x37, _x38, _x39, _x40, _x41, _x42, _x43) {
12138
+ function fetchSearchPlacesByTags(_x41, _x42, _x43, _x44, _x45, _x46, _x47, _x48, _x49) {
12073
12139
  return _fetchSearchPlacesByTags.apply(this, arguments);
12074
12140
  }
12075
12141
  return fetchSearchPlacesByTags;
@@ -12098,7 +12164,7 @@ var Requester = /*#__PURE__*/function () {
12098
12164
  }
12099
12165
  }, _callee15, this);
12100
12166
  }));
12101
- function fetchConfiguration(_x44, _x45, _x46) {
12167
+ function fetchConfiguration(_x50, _x51, _x52) {
12102
12168
  return _fetchConfiguration.apply(this, arguments);
12103
12169
  }
12104
12170
  return fetchConfiguration;
@@ -12126,7 +12192,7 @@ var Requester = /*#__PURE__*/function () {
12126
12192
  }
12127
12193
  }, _callee16, this);
12128
12194
  }));
12129
- function fetchCategories(_x47, _x48) {
12195
+ function fetchCategories(_x53, _x54) {
12130
12196
  return _fetchCategories.apply(this, arguments);
12131
12197
  }
12132
12198
  return fetchCategories;
@@ -12158,7 +12224,7 @@ var Requester = /*#__PURE__*/function () {
12158
12224
  }
12159
12225
  }, _callee17, this);
12160
12226
  }));
12161
- function fetchRoutesForOrigin(_x49, _x50, _x51, _x52, _x53, _x54) {
12227
+ function fetchRoutesForOrigin(_x55, _x56, _x57, _x58, _x59, _x60) {
12162
12228
  return _fetchRoutesForOrigin.apply(this, arguments);
12163
12229
  }
12164
12230
  return fetchRoutesForOrigin;
@@ -12185,7 +12251,7 @@ var Requester = /*#__PURE__*/function () {
12185
12251
  }
12186
12252
  }, _callee18, this);
12187
12253
  }));
12188
- function fetchCacheTimestamp(_x55, _x56) {
12254
+ function fetchCacheTimestamp(_x61, _x62) {
12189
12255
  return _fetchCacheTimestamp.apply(this, arguments);
12190
12256
  }
12191
12257
  return fetchCacheTimestamp;
@@ -12212,7 +12278,7 @@ var Requester = /*#__PURE__*/function () {
12212
12278
  }
12213
12279
  }, _callee19, this);
12214
12280
  }));
12215
- function fetchCssCustomization(_x57, _x58) {
12281
+ function fetchCssCustomization(_x63, _x64) {
12216
12282
  return _fetchCssCustomization.apply(this, arguments);
12217
12283
  }
12218
12284
  return fetchCssCustomization;
@@ -12245,7 +12311,7 @@ var Requester = /*#__PURE__*/function () {
12245
12311
  }
12246
12312
  }, _callee20, this);
12247
12313
  }));
12248
- function postHealth(_x59, _x60, _x61, _x62, _x63) {
12314
+ function postHealth(_x65, _x66, _x67, _x68, _x69) {
12249
12315
  return _postHealth.apply(this, arguments);
12250
12316
  }
12251
12317
  return postHealth;
@@ -12517,13 +12583,15 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
12517
12583
  }, {
12518
12584
  key: "fetchAndParsePlaceDetail",
12519
12585
  value: function () {
12520
- var _fetchAndParsePlaceDetail = repository_asyncToGenerator(/*#__PURE__*/repository_regenerator().m(function _callee4(placeId) {
12521
- var cachedPlace, response, errorBody, responseData, place, _t4;
12586
+ var _fetchAndParsePlaceDetail = repository_asyncToGenerator(/*#__PURE__*/repository_regenerator().m(function _callee4(query) {
12587
+ var id, buildingId, floorId, level, cacheKey, cachedPlace, response, errorBody, responseData, place, _t4;
12522
12588
  return repository_regenerator().w(function (_context4) {
12523
12589
  while (1) switch (_context4.p = _context4.n) {
12524
12590
  case 0:
12525
12591
  _context4.p = 0;
12526
- cachedPlace = this.cache.getPlace(placeId, this.currentLang);
12592
+ id = query.id, buildingId = query.buildingId, floorId = query.floorId, level = query.level;
12593
+ cacheKey = this.placeCacheKey(id, buildingId);
12594
+ cachedPlace = this.cache.getPlace(cacheKey, this.currentLang);
12527
12595
  if (!(cachedPlace != null)) {
12528
12596
  _context4.n = 1;
12529
12597
  break;
@@ -12534,7 +12602,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
12534
12602
  return _context4.a(2, cachedPlace);
12535
12603
  case 1:
12536
12604
  _context4.n = 2;
12537
- return this.requester.fetchPlaceDetail(this.token, placeId);
12605
+ return this.requester.fetchPlaceDetail(this.token, id, buildingId, floorId, level);
12538
12606
  case 2:
12539
12607
  response = _context4.v;
12540
12608
  if (response.ok) {
@@ -12552,10 +12620,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
12552
12620
  case 5:
12553
12621
  responseData = _context4.v;
12554
12622
  place = new place_MVXPlace(responseData);
12555
- this.cache.setPlace(place.mapvxId, place, this.currentLang);
12556
- if (place.clientId != null) {
12557
- this.cache.setPlace(place.clientId, place, this.currentLang);
12558
- }
12623
+ this.cachePlace(place, buildingId);
12559
12624
  this.logEvent("fetchAndParsePlaceDetail", {
12560
12625
  cached: "false"
12561
12626
  });
@@ -12577,13 +12642,15 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
12577
12642
  }, {
12578
12643
  key: "fetchAndParseAnyPlaceDetail",
12579
12644
  value: function () {
12580
- var _fetchAndParseAnyPlaceDetail = repository_asyncToGenerator(/*#__PURE__*/repository_regenerator().m(function _callee5(placeId, authToken) {
12581
- var cachedPlace, response, errorBody, responseData, place, _t5;
12645
+ var _fetchAndParseAnyPlaceDetail = repository_asyncToGenerator(/*#__PURE__*/repository_regenerator().m(function _callee5(query, authToken) {
12646
+ var id, buildingId, floorId, level, cacheKey, cachedPlace, response, errorBody, responseData, place, _t5;
12582
12647
  return repository_regenerator().w(function (_context5) {
12583
12648
  while (1) switch (_context5.p = _context5.n) {
12584
12649
  case 0:
12585
12650
  _context5.p = 0;
12586
- cachedPlace = this.cache.getPlace(placeId, this.currentLang);
12651
+ id = query.id, buildingId = query.buildingId, floorId = query.floorId, level = query.level;
12652
+ cacheKey = this.placeCacheKey(id, buildingId);
12653
+ cachedPlace = this.cache.getPlace(cacheKey, this.currentLang);
12587
12654
  if (!(cachedPlace != null)) {
12588
12655
  _context5.n = 1;
12589
12656
  break;
@@ -12594,7 +12661,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
12594
12661
  return _context5.a(2, cachedPlace);
12595
12662
  case 1:
12596
12663
  _context5.n = 2;
12597
- return this.requester.fetchAnyPlaceDetail(authToken, placeId);
12664
+ return this.requester.fetchAnyPlaceDetail(authToken, id, buildingId, floorId, level);
12598
12665
  case 2:
12599
12666
  response = _context5.v;
12600
12667
  if (response.ok) {
@@ -12612,10 +12679,7 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
12612
12679
  case 5:
12613
12680
  responseData = _context5.v;
12614
12681
  place = new place_MVXPlace(responseData);
12615
- this.cache.setPlace(place.mapvxId, place, this.currentLang);
12616
- if (place.clientId != null) {
12617
- this.cache.setPlace(place.clientId, place, this.currentLang);
12618
- }
12682
+ this.cachePlace(place, buildingId);
12619
12683
  this.logEvent("fetchAndParseAnyPlaceDetail", {
12620
12684
  cached: "false"
12621
12685
  });
@@ -12634,6 +12698,30 @@ var Repository = /*#__PURE__*/function (_Loggeable) {
12634
12698
  }
12635
12699
  return fetchAndParseAnyPlaceDetail;
12636
12700
  }()
12701
+ /**
12702
+ * Build the cache key for a place lookup. The canonical `mapvxId` is globally
12703
+ * unique, but integrator aliases (`clientId`) may be reused across buildings, so
12704
+ * alias-based keys are namespaced by `buildingId` to prevent aliases from
12705
+ * different venues from colliding in the cache.
12706
+ */
12707
+ }, {
12708
+ key: "placeCacheKey",
12709
+ value: function placeCacheKey(id, buildingId) {
12710
+ return buildingId != null ? "".concat(id, "_").concat(buildingId) : id;
12711
+ }
12712
+
12713
+ /**
12714
+ * Cache a place under its globally-unique `mapvxId` and, when present, under its
12715
+ * (possibly non-unique) `clientId` alias namespaced by `buildingId`.
12716
+ */
12717
+ }, {
12718
+ key: "cachePlace",
12719
+ value: function cachePlace(place, buildingId) {
12720
+ this.cache.setPlace(place.mapvxId, place, this.currentLang);
12721
+ if (place.clientId != null) {
12722
+ this.cache.setPlace(this.placeCacheKey(place.clientId, buildingId), place, this.currentLang);
12723
+ }
12724
+ }
12637
12725
  }, {
12638
12726
  key: "fetchAndParseSubPlaces",
12639
12727
  value: function () {
@@ -13670,6 +13758,197 @@ function extractStepCoordinates(step) {
13670
13758
  }
13671
13759
  return coords;
13672
13760
  }
13761
+ ;// ./src/map/fitCamera.ts
13762
+ function fitCamera_createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = fitCamera_unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
13763
+ function fitCamera_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return fitCamera_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? fitCamera_arrayLikeToArray(r, a) : void 0; } }
13764
+ function fitCamera_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
13765
+
13766
+
13767
+ /**
13768
+ * Padding, in pixels, already resolved from any unit-based {@link PaddingOptions}.
13769
+ */
13770
+
13771
+ /**
13772
+ * A camera target (center + zoom) that fits a set of coordinates.
13773
+ */
13774
+
13775
+ /**
13776
+ * Parameters shared by the flat and pitch-aware fit computations.
13777
+ */
13778
+
13779
+ /**
13780
+ * Minimal structural view of a maplibre transform clone (`map.transform.clone()`).
13781
+ *
13782
+ * We depend on the shape rather than the (non-exported) `ITransform` interface so
13783
+ * the coupling stays explicit and version changes surface as type errors here.
13784
+ */
13785
+
13786
+ /** maplibre world size (px) at zoom 0: tileSize (512) * 2^0. */
13787
+ var TILE_SIZE = 512;
13788
+ var clamp = function clamp(value, min, max) {
13789
+ return Math.min(Math.max(value, min), max);
13790
+ };
13791
+
13792
+ /**
13793
+ * Compute the camera (center + zoom) that tightly fits `coordinates` into the
13794
+ * padded viewport for a given bearing, using an ORIENTED bounding box.
13795
+ *
13796
+ * maplibre's `fitBounds` only fits a north-up `LngLatBounds`, which wastes
13797
+ * viewport space for diagonal geometries under a bearing. Instead we rotate the
13798
+ * mercator-projected points by the bearing, measure their axis-aligned extent in
13799
+ * that rotated frame, and derive zoom + center analytically.
13800
+ *
13801
+ * This calculation is orthographic (assumes `pitch: 0`). For a tilted camera use
13802
+ * {@link refineCameraForPitch} to correct for perspective.
13803
+ *
13804
+ * @param coordinates Points to fit (must contain at least one).
13805
+ * @param params Bearing, padding and viewport constraints.
13806
+ * @returns The fitting camera center and zoom.
13807
+ */
13808
+ function computeOrientedCamera(coordinates, params) {
13809
+ var bearing = params.bearing,
13810
+ padding = params.padding,
13811
+ containerWidth = params.containerWidth,
13812
+ containerHeight = params.containerHeight,
13813
+ maxZoom = params.maxZoom,
13814
+ minZoom = params.minZoom;
13815
+
13816
+ // Rotate the mercator plane by -bearing so the target bearing becomes axis-aligned.
13817
+ var rad = -bearing * Math.PI / 180;
13818
+ var cos = Math.cos(rad);
13819
+ var sin = Math.sin(rad);
13820
+ var minX = Infinity;
13821
+ var minY = Infinity;
13822
+ var maxX = -Infinity;
13823
+ var maxY = -Infinity;
13824
+ var _iterator = fitCamera_createForOfIteratorHelper(coordinates),
13825
+ _step;
13826
+ try {
13827
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
13828
+ var coord = _step.value;
13829
+ var m = maplibre_gl.MercatorCoordinate.fromLngLat({
13830
+ lat: coord.lat,
13831
+ lng: coord.lng
13832
+ });
13833
+ var rx = m.x * cos - m.y * sin;
13834
+ var ry = m.x * sin + m.y * cos;
13835
+ minX = Math.min(minX, rx);
13836
+ minY = Math.min(minY, ry);
13837
+ maxX = Math.max(maxX, rx);
13838
+ maxY = Math.max(maxY, ry);
13839
+ }
13840
+ } catch (err) {
13841
+ _iterator.e(err);
13842
+ } finally {
13843
+ _iterator.f();
13844
+ }
13845
+ var boxW = maxX - minX || Number.EPSILON;
13846
+ var boxH = maxY - minY || Number.EPSILON;
13847
+ var availW = Math.max(1, containerWidth - padding.left - padding.right);
13848
+ var availH = Math.max(1, containerHeight - padding.top - padding.bottom);
13849
+
13850
+ // worldSize (px) = TILE_SIZE * 2^zoom
13851
+ var worldSize = Math.min(availW / boxW, availH / boxH);
13852
+ var zoom = clamp(Math.log2(worldSize / TILE_SIZE), minZoom, maxZoom);
13853
+
13854
+ // Center of the oriented box, rotated back to geographic space.
13855
+ var cxr = (minX + maxX) / 2;
13856
+ var cyr = (minY + maxY) / 2;
13857
+ var center = new maplibre_gl.MercatorCoordinate(cxr * cos + cyr * sin, -cxr * sin + cyr * cos, 0).toLngLat();
13858
+ return {
13859
+ center: center,
13860
+ zoom: zoom
13861
+ };
13862
+ }
13863
+
13864
+ /**
13865
+ * Refine a fit camera for a non-zero pitch.
13866
+ *
13867
+ * With `pitch > 0` the ground-to-screen mapping is non-linear (perspective), so
13868
+ * the orthographic result from {@link computeOrientedCamera} either overshoots
13869
+ * (geometry spills past the padding) or leaves extra space. This iteratively
13870
+ * projects every point through maplibre's real perspective projection on a cloned
13871
+ * transform (no visible camera movement) and adjusts zoom + center until the
13872
+ * projected bounding box fits the padded viewport.
13873
+ *
13874
+ * If any point falls behind the horizon during refinement, it bails out and
13875
+ * returns the best camera computed so far (never worse than the flat input).
13876
+ *
13877
+ * @param transform A `map.transform.clone()` used purely for projection.
13878
+ * @param coordinates Points to fit.
13879
+ * @param initial The orthographic camera to refine.
13880
+ * @param params Bearing, pitch, padding and viewport constraints.
13881
+ * @returns The refined camera center and zoom.
13882
+ */
13883
+ function refineCameraForPitch(transform, coordinates, initial, params) {
13884
+ var bearing = params.bearing,
13885
+ pitch = params.pitch,
13886
+ padding = params.padding,
13887
+ containerWidth = params.containerWidth,
13888
+ containerHeight = params.containerHeight,
13889
+ maxZoom = params.maxZoom,
13890
+ minZoom = params.minZoom;
13891
+ transform.setBearing(bearing);
13892
+ transform.setPitch(pitch);
13893
+ transform.setPadding(padding);
13894
+ transform.setCenter(initial.center);
13895
+ transform.setZoom(initial.zoom);
13896
+ var availW = Math.max(1, containerWidth - padding.left - padding.right);
13897
+ var availH = Math.max(1, containerHeight - padding.top - padding.bottom);
13898
+ var MAX_ITERATIONS = 4;
13899
+ var CONVERGENCE_EPSILON = 0.01;
13900
+ var best = {
13901
+ center: initial.center,
13902
+ zoom: initial.zoom
13903
+ };
13904
+ for (var i = 0; i < MAX_ITERATIONS; i++) {
13905
+ var minX = Infinity;
13906
+ var minY = Infinity;
13907
+ var maxX = -Infinity;
13908
+ var maxY = -Infinity;
13909
+ var allOnSurface = true;
13910
+ var _iterator2 = fitCamera_createForOfIteratorHelper(coordinates),
13911
+ _step2;
13912
+ try {
13913
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
13914
+ var coord = _step2.value;
13915
+ var screen = transform.locationToScreenPoint(new maplibre_gl.LngLat(coord.lng, coord.lat));
13916
+ if (!transform.isPointOnMapSurface(screen)) {
13917
+ allOnSurface = false;
13918
+ break;
13919
+ }
13920
+ minX = Math.min(minX, screen.x);
13921
+ minY = Math.min(minY, screen.y);
13922
+ maxX = Math.max(maxX, screen.x);
13923
+ maxY = Math.max(maxY, screen.y);
13924
+ }
13925
+ // A point behind the horizon makes the projected box meaningless; keep the
13926
+ // last valid camera rather than risk an over-zoomed result.
13927
+ } catch (err) {
13928
+ _iterator2.e(err);
13929
+ } finally {
13930
+ _iterator2.f();
13931
+ }
13932
+ if (!allOnSurface) break;
13933
+
13934
+ // Recenter: move the projected box center onto the padded screen center.
13935
+ var boxCenter = new maplibre_gl.Point((minX + maxX) / 2, (minY + maxY) / 2);
13936
+ transform.setCenter(transform.screenPointToLocation(boxCenter));
13937
+
13938
+ // Rescale zoom so the projected box fills the padded viewport.
13939
+ var boxW = Math.max(maxX - minX, 1e-6);
13940
+ var boxH = Math.max(maxY - minY, 1e-6);
13941
+ var scale = Math.min(availW / boxW, availH / boxH);
13942
+ var zoomDelta = Math.log2(scale);
13943
+ transform.setZoom(clamp(transform.zoom + zoomDelta, minZoom, maxZoom));
13944
+ best = {
13945
+ center: transform.center,
13946
+ zoom: transform.zoom
13947
+ };
13948
+ if (Math.abs(zoomDelta) < CONVERGENCE_EPSILON) break;
13949
+ }
13950
+ return best;
13951
+ }
13673
13952
  ;// ./src/map/mapInteractionOptions.ts
13674
13953
  /**
13675
13954
  * Subset of MapLibre {@link MapOptions} that can be derived from the interaction
@@ -13920,6 +14199,7 @@ function convertPaddingToPixels(padding, containerWidth, containerHeight) {
13920
14199
 
13921
14200
 
13922
14201
 
14202
+
13923
14203
  /**
13924
14204
  * @group Map
13925
14205
  */
@@ -14026,13 +14306,17 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
14026
14306
  value: function initialPlaceDetailSetUp(parentPlaceId, withBearerToken) {
14027
14307
  var _this2 = this;
14028
14308
  if (withBearerToken) {
14029
- this.repository.fetchAndParseAnyPlaceDetail(parentPlaceId, withBearerToken).then(function (place) {
14309
+ this.repository.fetchAndParseAnyPlaceDetail({
14310
+ id: parentPlaceId
14311
+ }, withBearerToken).then(function (place) {
14030
14312
  _this2.changeParentPlaceTo(place);
14031
14313
  _this2.potentialParentPlaces.push(place);
14032
14314
  })["catch"](console.error);
14033
14315
  return;
14034
14316
  }
14035
- this.repository.fetchAndParsePlaceDetail(parentPlaceId).then(function (place) {
14317
+ this.repository.fetchAndParsePlaceDetail({
14318
+ id: parentPlaceId
14319
+ }).then(function (place) {
14036
14320
  _this2.changeParentPlaceTo(place);
14037
14321
  _this2.potentialParentPlaces.push(place);
14038
14322
  })["catch"](console.error);
@@ -14042,7 +14326,9 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
14042
14326
  value: function loadOtherPotentialParentPlaces(ids) {
14043
14327
  var _this3 = this;
14044
14328
  Promise.all(ids.map(function (id) {
14045
- return _this3.repository.fetchAndParsePlaceDetail(id);
14329
+ return _this3.repository.fetchAndParsePlaceDetail({
14330
+ id: id
14331
+ });
14046
14332
  })).then(function (places) {
14047
14333
  var _this3$potentialParen;
14048
14334
  (_this3$potentialParen = _this3.potentialParentPlaces).push.apply(_this3$potentialParen, map_toConsumableArray(places));
@@ -15141,6 +15427,71 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
15141
15427
  this.map.fitBounds(bounds, fitOptions);
15142
15428
  }
15143
15429
  }
15430
+ }, {
15431
+ key: "easeToCoordinates",
15432
+ value: function easeToCoordinates(coordinates, options) {
15433
+ var _options$maxZoom;
15434
+ if (coordinates.length === 0) {
15435
+ return;
15436
+ }
15437
+ var onComplete = options === null || options === void 0 ? void 0 : options.onComplete;
15438
+
15439
+ // Get container dimensions for percentage-based padding calculations
15440
+ var container = this.map.getContainer();
15441
+ var containerWidth = container.clientWidth;
15442
+ var containerHeight = container.clientHeight;
15443
+
15444
+ // Convert padding values with units to pixels
15445
+ var padding = convertPaddingToPixels(options === null || options === void 0 ? void 0 : options.padding, containerWidth, containerHeight);
15446
+ if (coordinates.length === 1) {
15447
+ var _coordinates2 = map_slicedToArray(coordinates, 1),
15448
+ coord = _coordinates2[0];
15449
+ if (onComplete) {
15450
+ void this.map.once("moveend", onComplete);
15451
+ }
15452
+ this.map.easeTo(map_objectSpread(map_objectSpread({}, options), {}, {
15453
+ center: {
15454
+ lat: coord.lat,
15455
+ lng: coord.lng
15456
+ },
15457
+ padding: padding
15458
+ }));
15459
+ return;
15460
+ }
15461
+ var bearing = (options === null || options === void 0 ? void 0 : options.bearing) !== undefined ? options.bearing : this.map.getBearing();
15462
+ var pitch = (options === null || options === void 0 ? void 0 : options.pitch) !== undefined ? options.pitch : this.map.getPitch();
15463
+ var cameraParams = {
15464
+ bearing: bearing,
15465
+ padding: padding,
15466
+ containerWidth: containerWidth,
15467
+ containerHeight: containerHeight,
15468
+ maxZoom: (_options$maxZoom = options === null || options === void 0 ? void 0 : options.maxZoom) !== null && _options$maxZoom !== void 0 ? _options$maxZoom : this.map.getMaxZoom(),
15469
+ minZoom: this.map.getMinZoom()
15470
+ };
15471
+
15472
+ // Orthographic oriented fit (exact for pitch 0). maplibre's fitBounds only
15473
+ // fits a north-up LngLatBounds, which wastes viewport space for diagonal
15474
+ // geometries under a bearing.
15475
+ var camera = computeOrientedCamera(coordinates, cameraParams);
15476
+
15477
+ // With a tilted camera the orthographic zoom is off due to perspective, so
15478
+ // refine it against maplibre's real projection on a cloned transform.
15479
+ if (pitch > 0) {
15480
+ camera = refineCameraForPitch(this.map.transform.clone(), coordinates, camera, map_objectSpread(map_objectSpread({}, cameraParams), {}, {
15481
+ pitch: pitch
15482
+ }));
15483
+ }
15484
+ if (onComplete) {
15485
+ void this.map.once("moveend", onComplete);
15486
+ }
15487
+ this.map.easeTo(map_objectSpread(map_objectSpread({}, options), {}, {
15488
+ center: camera.center,
15489
+ zoom: camera.zoom,
15490
+ bearing: bearing,
15491
+ pitch: pitch,
15492
+ padding: padding
15493
+ }));
15494
+ }
15144
15495
  }, {
15145
15496
  key: "fitRouteByPlace",
15146
15497
  value: function fitRouteByPlace(route, placeId, options) {
@@ -15393,7 +15744,9 @@ var InternalMapVXMap = /*#__PURE__*/function (_Loggeable) {
15393
15744
  }
15394
15745
  console.log("fetching place detail from server", ref);
15395
15746
  _context2.n = 8;
15396
- return _this12.repository.fetchAndParsePlaceDetail(ref);
15747
+ return _this12.repository.fetchAndParsePlaceDetail({
15748
+ id: ref
15749
+ });
15397
15750
  case 8:
15398
15751
  clickedPlace = _context2.v;
15399
15752
  _context2.n = 10;
@@ -16140,6 +16493,17 @@ function sdk_toPrimitive(t, r) { if ("object" != sdk_typeof(t) || !t) return t;
16140
16493
  * @group Main
16141
16494
  */
16142
16495
 
16496
+ /**
16497
+ * Normalize the argument accepted by the place-detail methods into a
16498
+ * {@link PlaceQuery}. A plain string is treated as the place id/alias with no
16499
+ * building/floor disambiguation, preserving backward compatibility.
16500
+ */
16501
+ function normalizePlaceQuery(place) {
16502
+ return typeof place === "string" ? {
16503
+ id: place
16504
+ } : place;
16505
+ }
16506
+
16143
16507
  /**
16144
16508
  * Initialize the SDK.
16145
16509
  * @group Main
@@ -16226,20 +16590,21 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
16226
16590
  }, {
16227
16591
  key: "getPlaceDetail",
16228
16592
  value: function () {
16229
- var _getPlaceDetail = sdk_asyncToGenerator(/*#__PURE__*/sdk_regenerator().m(function _callee(id) {
16230
- var place, _t;
16593
+ var _getPlaceDetail = sdk_asyncToGenerator(/*#__PURE__*/sdk_regenerator().m(function _callee(place) {
16594
+ var query, result, _t;
16231
16595
  return sdk_regenerator().w(function (_context) {
16232
16596
  while (1) switch (_context.p = _context.n) {
16233
16597
  case 0:
16234
16598
  _context.p = 0;
16599
+ query = normalizePlaceQuery(place);
16235
16600
  _context.n = 1;
16236
- return this.repository.fetchAndParsePlaceDetail(id);
16601
+ return this.repository.fetchAndParsePlaceDetail(query);
16237
16602
  case 1:
16238
- place = _context.v;
16603
+ result = _context.v;
16239
16604
  this.logEvent("getPlaceDetail", {
16240
- id: id
16605
+ id: query.id
16241
16606
  });
16242
- return _context.a(2, place);
16607
+ return _context.a(2, result);
16243
16608
  case 2:
16244
16609
  _context.p = 2;
16245
16610
  _t = _context.v;
@@ -16257,20 +16622,21 @@ var InternalMapVXSDK = /*#__PURE__*/function (_Loggeable) {
16257
16622
  }, {
16258
16623
  key: "getAnyPlaceDetail",
16259
16624
  value: function () {
16260
- var _getAnyPlaceDetail = sdk_asyncToGenerator(/*#__PURE__*/sdk_regenerator().m(function _callee2(id, authToken) {
16261
- var place, _t2;
16625
+ var _getAnyPlaceDetail = sdk_asyncToGenerator(/*#__PURE__*/sdk_regenerator().m(function _callee2(place, authToken) {
16626
+ var query, result, _t2;
16262
16627
  return sdk_regenerator().w(function (_context2) {
16263
16628
  while (1) switch (_context2.p = _context2.n) {
16264
16629
  case 0:
16265
16630
  _context2.p = 0;
16631
+ query = normalizePlaceQuery(place);
16266
16632
  _context2.n = 1;
16267
- return this.repository.fetchAndParseAnyPlaceDetail(id, authToken);
16633
+ return this.repository.fetchAndParseAnyPlaceDetail(query, authToken);
16268
16634
  case 1:
16269
- place = _context2.v;
16635
+ result = _context2.v;
16270
16636
  this.logEvent("getAnyPlaceDetail", {
16271
- id: id
16637
+ id: query.id
16272
16638
  });
16273
- return _context2.a(2, place);
16639
+ return _context2.a(2, result);
16274
16640
  case 2:
16275
16641
  _context2.p = 2;
16276
16642
  _t2 = _context2.v;