@minmaps-dev/mm-web-sdk 1.0.0-rc.1

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.
@@ -0,0 +1,299 @@
1
+ import { IControl, ControlPosition, Map } from 'maplibre-gl';
2
+
3
+ /**
4
+ * Represents a floor in a building
5
+ */
6
+ interface Floor {
7
+ /** Unique floor identifier */
8
+ id: string | number;
9
+ /** Display name of the floor */
10
+ name: string;
11
+ /** Floor sequence/order (e.g., -1 for basement, 0 for ground, 1 for first floor) */
12
+ sequence?: number;
13
+ /** Associated map data */
14
+ geojson?: GeoJSON.FeatureCollection;
15
+ /** Whether this is the default floor to display */
16
+ isDefault?: boolean;
17
+ /** Additional floor metadata */
18
+ metadata?: Record<string, unknown>;
19
+ }
20
+ /**
21
+ * Floor metadata for display purposes
22
+ */
23
+ interface FloorMetadata {
24
+ id: string | number;
25
+ name: string;
26
+ sequence?: number;
27
+ isDefault?: boolean;
28
+ isActive?: boolean;
29
+ }
30
+
31
+ interface POI {
32
+ /** Unique identifier */
33
+ id: string | number;
34
+ /** POI type */
35
+ type: 'amenity' | 'destination';
36
+ /** Display name */
37
+ name: string;
38
+ /** Geographic coordinates [longitude, latitude] */
39
+ coordinates: [number, number];
40
+ /** Icon identifier for rendering */
41
+ iconId?: string;
42
+ /** Whether this POI should render its label */
43
+ showLabel?: boolean;
44
+ /** Floor this POI belongs to */
45
+ floorId: string | number;
46
+ /** Category/type of amenity (e.g., 'restroom', 'elevator') */
47
+ amenityType?: string;
48
+ /** Search keywords */
49
+ keywords?: string[];
50
+ /** Additional properties */
51
+ properties?: Record<string, unknown>;
52
+ /** JMap waypoint ID that this POI instance is bound to */
53
+ waypointId?: string | number;
54
+ /** Full waypoint object for this POI instance */
55
+ waypoint?: Waypoint;
56
+ /** Marks this POI as the "You are here" kiosk */
57
+ isYouAreHere?: boolean;
58
+ }
59
+ /**
60
+ * Amenity - a specific type of POI (facilities, services)
61
+ */
62
+ interface Amenity {
63
+ /** Unique identifier */
64
+ id: string | number;
65
+ /** Display name */
66
+ name: string;
67
+ /** SVG icon data */
68
+ svg?: string;
69
+ /** Search keywords */
70
+ keywords?: string[];
71
+ /** Associated waypoints */
72
+ waypoints?: Waypoint[];
73
+ /** Amenity type/category */
74
+ type?: string;
75
+ /** Extended properties */
76
+ extensors?: Record<string, unknown>;
77
+ }
78
+ /**
79
+ * Destination - a specific location or room
80
+ */
81
+ interface Destination {
82
+ /** Unique identifier */
83
+ id: string | number;
84
+ /** Display name */
85
+ name: string;
86
+ /** Associated waypoints */
87
+ waypoints?: Waypoint[];
88
+ /** Category/classification */
89
+ category?: string;
90
+ /** Additional properties */
91
+ properties?: Record<string, unknown>;
92
+ }
93
+ /**
94
+ * Waypoint - a specific point location
95
+ */
96
+ interface Waypoint {
97
+ /** Geographic coordinates [longitude, latitude] */
98
+ coordinates: number[];
99
+ /** Associated map ID */
100
+ mapId: string | number;
101
+ /** Associated floor ID */
102
+ floorId?: string | number;
103
+ /** Whether this is the primary/default waypoint */
104
+ isPrimary?: boolean;
105
+ }
106
+ /**
107
+ * Amenity enriched with the floor it belongs to
108
+ */
109
+ type AmenityWithFloor = Amenity & {
110
+ floorId: Floor['id'];
111
+ };
112
+ /**
113
+ * Search result for POIs
114
+ */
115
+ interface POISearchResult {
116
+ /** The matched POI */
117
+ poi: POI;
118
+ /** Search relevance score (0-1) */
119
+ score: number;
120
+ /** Matched keywords or fields */
121
+ matchedFields: string[];
122
+ }
123
+
124
+ interface MapEvent {
125
+ floor?: Floor;
126
+ poi?: POI;
127
+ coordinates?: [number, number];
128
+ error?: any;
129
+ venue?: any;
130
+ }
131
+ type EventCallback = (event: MapEvent) => void;
132
+
133
+ interface SDKOptions {
134
+ debug?: boolean;
135
+ theme?: 'light' | 'dark' | 'hybrid' | any;
136
+ initialFloor?: string | number;
137
+ enableInteractions?: boolean;
138
+ customSprite?: string;
139
+ minIndoorZoom?: number;
140
+ wallThickness?: number;
141
+ boundsPadding?: number;
142
+ styleMode?: 'venueStyleUrl' | 'sdkTemplate';
143
+ templateOverrideMode?: 'colorsOnly' | 'colorsAndConstants' | 'all';
144
+ }
145
+ type JMapAuth = {
146
+ clientId: string;
147
+ clientSecret: string;
148
+ };
149
+ interface JMapConfig {
150
+ host: string;
151
+ auth: JMapAuth;
152
+ customerId: number;
153
+ venueId?: number;
154
+ locale?: string;
155
+ }
156
+ type JacsAuth = {
157
+ clientId: string;
158
+ username: string;
159
+ password: string;
160
+ };
161
+ type JacsConfig = {
162
+ host: string;
163
+ auth: JacsAuth;
164
+ };
165
+ type SDKConfig = {
166
+ container: HTMLElement | string;
167
+ jmap: {
168
+ host: string;
169
+ customerId: number;
170
+ venueId: number;
171
+ locale?: string;
172
+ auth?: JMapAuth;
173
+ };
174
+ jacs: {
175
+ mode: 'proxy' | 'direct';
176
+ host?: string;
177
+ auth?: {
178
+ clientId: string;
179
+ username: string;
180
+ password: string;
181
+ };
182
+ proxyBaseUrl?: string;
183
+ };
184
+ options?: SDKOptions;
185
+ };
186
+
187
+ /** Captured camera state (center, zoom, pitch, bearing) */
188
+ type CameraState = {
189
+ center: [number, number];
190
+ zoom: number;
191
+ pitch: number;
192
+ bearing: number;
193
+ };
194
+ /** Options for animating or setting the map view */
195
+ type ViewOptions = {
196
+ center?: [number, number];
197
+ zoom?: number;
198
+ pitch?: number;
199
+ bearing?: number;
200
+ animate?: boolean;
201
+ duration?: number;
202
+ };
203
+ /** SW/NE bounding box */
204
+ type Bounds = [[number, number], [number, number]];
205
+
206
+ /** How to center the map after computing a route */
207
+ type WayfindCenterMode = 'none' | 'destination' | 'route';
208
+
209
+ type LoggerFn = (...args: unknown[]) => void;
210
+ type AmenityManagerDeps = {
211
+ getVenue: () => any;
212
+ getFloors: () => Floor[];
213
+ getFloorById: (id: Floor['id']) => Floor | null;
214
+ log?: LoggerFn;
215
+ };
216
+ declare class AmenityManager {
217
+ private getVenue;
218
+ private getFloors;
219
+ private getFloorById;
220
+ private logFn?;
221
+ constructor(deps: AmenityManagerDeps);
222
+ private get venue();
223
+ private log;
224
+ private loadForFloor;
225
+ getAll(): AmenityWithFloor[];
226
+ getByFloorId(floorId: Floor['id']): AmenityWithFloor[];
227
+ getAllKiosks(): AmenityWithFloor[];
228
+ getKioskForFloor(floorId: Floor['id']): AmenityWithFloor | null;
229
+ logKioskForFloor(floorId: Floor['id']): void;
230
+ }
231
+
232
+ declare class MinuteMaps {
233
+ private config;
234
+ private map;
235
+ private data;
236
+ private wayfindingProvider;
237
+ private events;
238
+ private floorsApi;
239
+ private venue;
240
+ private spriteKeys;
241
+ private readonly debug;
242
+ private readonly logger;
243
+ private defaultCamera;
244
+ private viewModes;
245
+ private amenityManager;
246
+ private wayfinding;
247
+ constructor(config: SDKConfig);
248
+ init(): Promise<void>;
249
+ on(event: string, cb: (e: MapEvent) => void): void;
250
+ off(event: string, cb?: (e: MapEvent) => void): void;
251
+ addControl(control: IControl, position?: ControlPosition): void;
252
+ setView(options: ViewOptions): void;
253
+ get amenities(): AmenityManager;
254
+ resetView(opts?: {
255
+ animate?: boolean;
256
+ duration?: number;
257
+ }): void;
258
+ set3dEnabled(enabled: boolean): void;
259
+ toggle3d(): void;
260
+ getIs3dEnabled(): boolean;
261
+ setUnits2dEnabled(enabled: boolean): void;
262
+ toggleUnits2d(): void;
263
+ getIsUnits2dEnabled(): boolean;
264
+ setFlatMode(enabled: boolean): void;
265
+ toggleFlatMode(): void;
266
+ getIsFlatMode(): boolean;
267
+ getFloors(): Floor[];
268
+ getCurrentFloor(): Floor | null;
269
+ getDefaultFloor(): Floor | null;
270
+ getDestinations(floor?: Floor): Destination[];
271
+ getPolygonLayers(): any[];
272
+ getFloorMapTemplate3d(floorId: string | number): any[];
273
+ getAllPOIs(floor?: Floor): POI[];
274
+ getYouAreHerePOI(floor?: Floor): POI | null;
275
+ getYouAreHereCoordinates(floor?: Floor): [number, number] | null;
276
+ searchPOIs(query: string, floor?: Floor): POI[];
277
+ wayfindBetweenWaypoints(fromWaypoint: any, toWaypoint: any, options?: {
278
+ centerMode?: 'none' | 'destination' | 'route';
279
+ zoom?: number;
280
+ }): Promise<any>;
281
+ navigateFromKioskToDestination(destination: any): Promise<any>;
282
+ clearRoute(): void;
283
+ getCameraPosition(): CameraState | null;
284
+ getMap(): Map | null;
285
+ destroy(): void;
286
+ setCurrentFloor(floor: Floor): Promise<void>;
287
+ isReady(): boolean;
288
+ private setFloorLayerVisibility;
289
+ private getBoundsPadding;
290
+ private getVenueBounds;
291
+ private applyInitialViewFromVenue;
292
+ private loadAndPatchVenueStyle;
293
+ private ensureFloorLayersFromStyle;
294
+ private ensureCoreSources;
295
+ }
296
+ declare function createMinuteMapsSDK(config: SDKConfig): MinuteMaps;
297
+
298
+ export { MinuteMaps, createMinuteMapsSDK };
299
+ export type { Amenity, AmenityWithFloor, Bounds, CameraState, Destination, EventCallback, Floor, FloorMetadata, JMapAuth, JMapConfig, JacsAuth, JacsConfig, MapEvent, POI, POISearchResult, SDKConfig, SDKOptions, ViewOptions, WayfindCenterMode, Waypoint };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import t from"maplibre-gl";import*as e from"@turf/turf";const o={ensureGeoJson(t,e){t.getSource(e)||t.addSource(e,{type:"geojson",data:{type:"FeatureCollection",features:[]}})},setData(t,e,o){const i=t.getSource(e);i?.setData?.(o)}},i="indoor-data",n="poi-data",r="unit-walls",s="route-data",a=["boundary-fill","boundary-outline","units-fill","units-wall-extrusion","units-wall-custom-extrusion","corridors-fill","corridors-outline","building-extrusion"],l=()=>{};function u(t){const e=Boolean(t?.enabled),o=function(t){const e=String(t||"").trim();return e?`[${e}]`:""}(t?.prefix||"MinuteMapsSDK");return e?{debug:(...t)=>console.debug(o,...t),log:(...t)=>console.log(o,...t),warn:(...t)=>console.warn(o,...t),error:(...t)=>console.error(o,...t)}:{debug:l,log:l,warn:l,error:l}}u({enabled:!0,prefix:"MinuteMapsSDK"});const d={applyFloor(t,e,o=1){d.updateWalls(t,e,o),d.updateIndoor(t,e)},updateIndoor(t,e){o.setData(t,i,e.geojson);try{const t=e?.geojson?.features||[],o={};for(const e of t){const t=e?.properties?.featureType,i=null==t?"(missing)":String(t);o[i]=(o[i]||0)+1}Object.entries(o).sort((t,e)=>e[1]-t[1]).slice(0,15)}catch{}},updateWalls(t,i,n=1){const s=function(t,o=1){const i=(t.features||[]).filter(t=>"Units"===t.properties?.featureType).map(t=>{try{const i=e.buffer(t,-o,{units:"feet"});if(!i)return null;const n={...t.properties,featureType:"UnitWalls"};if(null==n.custom_height){const t=n.customProperties?.custom_height??n.custom_height??n.height??n.wall_height,e="number"==typeof t?t:Number(t);Number.isFinite(e)&&(n.custom_height=e)}return{type:"Feature",geometry:{type:"Polygon",coordinates:[t.geometry.coordinates[0],i.geometry.coordinates[0]]},properties:n}}catch{return null}}).filter(Boolean);return{type:"FeatureCollection",features:i}}(i.geojson,n);o.setData(t,r,s)},boundsFromGeoJson(t){try{const[o,i,n,r]=e.bbox(t),s=Math.min(o,n),a=Math.max(o,n),l=Math.min(i,r);return[[s,l],[a,Math.max(i,r)]]}catch{return null}},selectDefaultFloor:t=>Array.isArray(t)&&0!==t.length&&(t.find(t=>t.isDefault)||t[0])||null,selectInitialFloor(t,e){if(!Array.isArray(t)||0===t.length)return null;if(null!=e){const o=t.find(t=>t.id===e);if(o)return o}return d.selectDefaultFloor(t)},async activateFloor(t,e,o){if(!t)throw new Error("activateFloor requires an initialized map");if(e?.geojson&&d.applyFloor(t,e,o.wallFeet),await o.updatePOIs(e),!o.didFit&&e?.geojson){const i=d.boundsFromGeoJson(e.geojson);i&&(t.fitBounds(i,{padding:o.boundsPadding,animate:!1}),t.once("moveend",()=>{t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom)}),o.setDidFit(!0),o.log?.("camera :: fitToFloor",{floorId:e.id,bounds:i}))}else t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom)}};class c{floors=[];currentFloor=null;didFit=!1;getMap;getConfig;updatePoiSource;logFn;constructor(t){this.getMap=t.getMap,this.getConfig=t.getConfig,this.updatePoiSource=t.updatePoiSource,this.logFn=t.log}log(...t){this.logFn&&this.logFn(...t)}setFloors(t){this.floors=t}getFloors(){return[...this.floors]}getCurrentFloor(){return this.currentFloor}setDidFit(t){this.didFit=t}getDefaultFloor(){return d.selectDefaultFloor(this.floors)}getInitialFloor(){const t=this.getConfig();return d.selectInitialFloor(this.floors,t.options?.initialFloor)}async setCurrentFloor(t){const e=this.getMap();if(!e)throw new Error("Map is not initialized");this.didFit=!1,this.currentFloor=t,this.log("floor :: setCurrentFloor",{id:t.id,name:t.name,geojsonFeatures:t.geojson?.features?.length??0});const o=this.getConfig(),i=o.options?.wallThickness??1,n=o.options?.boundsPadding??50,r=o.options?.minIndoorZoom??16.5;await d.activateFloor(e,t,{wallFeet:i,updatePOIs:t=>this.updatePoiSource(t),didFit:this.didFit,setDidFit:t=>{this.didFit=t},boundsPadding:n,minIndoorZoom:r,log:(t,e)=>this.log(t,e)})}}const p=u({enabled:!0,prefix:"MinuteMapsSDK"}),f=new Map,h={async getSpriteKeys(t){const e=function(t){if(!t)return;if("string"==typeof t)return t;if(Array.isArray(t)){const e=t[0];if(e&&"string"==typeof e.url)return e.url}if("object"==typeof t&&null!==t){const e=t?.url;if("string"==typeof e)return e}return}(t?.getStyle?.()?.sprite);if(!e||"function"!=typeof fetch)return new Set;const o=e.endsWith(".json")?e:`${e}.json`;if(f.has(o))return f.get(o);try{const t=await fetch(o);if(!t.ok)throw new Error(`Failed to load sprite JSON (${t.status})`);const e=await t.json(),i=new Set(Object.keys(e||{}));return f.set(o,i),i}catch(t){p.warn("sprite fetch failed",o,t);const e=new Set;return f.set(o,e),e}}};const g="units-outline-2d",y=["units-wall-extrusion","units-wall-custom-extrusion"];class m{getMap;is3dEnabled=!0;isUnits2dEnabled=!1;isFlatMode=!1;cachedExtrusionIds=null;extrusionOriginalVisibility=null;unitsExtrusionOriginalVisibility=null;unitsOutlineOriginalVisibility=null;constructor(t){this.getMap=t}onStyleData(){if(this.map){if(this.cachedExtrusionIds=null,!this.is3dEnabled){const t=this.listExtrusionLayerIds();this.setLayersVisibility(t,"none")}this.isUnits2dEnabled&&this.applyUnits2dVisibility(!0)}}set3dEnabled(t){const e=this.map;if(!e)return;const o=this.listExtrusionLayerIds();if(this.cachedExtrusionIds=o,!this.extrusionOriginalVisibility){const t={};o.forEach(o=>{try{const i=e.getLayoutProperty(o,"visibility")||"visible";t[o]=i}catch{t[o]="visible"}}),this.extrusionOriginalVisibility=t}if(t){const t=this.extrusionOriginalVisibility||{};o.forEach(o=>{const i=t[o]??"visible";try{e.getLayer(o)&&e.setLayoutProperty(o,"visibility",i)}catch{}})}else this.setLayersVisibility(o,"none");this.is3dEnabled=t,e.triggerRepaint()}toggle3d(){this.set3dEnabled(!this.is3dEnabled)}getIs3dEnabled(){return this.is3dEnabled}setUnits2dEnabled(t){const e=this.map;e&&(this.applyUnits2dVisibility(t),this.isUnits2dEnabled=t,e.triggerRepaint())}toggleUnits2d(){this.setUnits2dEnabled(!this.isUnits2dEnabled)}getIsUnits2dEnabled(){return this.isUnits2dEnabled}setFlatMode(t){this.map&&(t?(this.set3dEnabled(!1),this.setUnits2dEnabled(!0)):(this.setUnits2dEnabled(!1),this.set3dEnabled(!0)),this.isFlatMode=t)}toggleFlatMode(){this.setFlatMode(!this.isFlatMode)}getIsFlatMode(){return this.isFlatMode}applyUnits2dVisibility(t){const e=this.map;if(e){if(!this.unitsExtrusionOriginalVisibility){const t={};y.forEach(o=>{try{const i=e.getLayoutProperty(o,"visibility")||"visible";t[o]=i}catch{t[o]="visible"}}),this.unitsExtrusionOriginalVisibility=t}if(null==this.unitsOutlineOriginalVisibility)try{const t=e.getLayoutProperty(g,"visibility");this.unitsOutlineOriginalVisibility=t??"none"}catch{this.unitsOutlineOriginalVisibility="none"}if(e.getLayer(g)){const o=t?"visible":this.unitsOutlineOriginalVisibility??"none";try{e.setLayoutProperty(g,"visibility",o)}catch{}}if(t)y.forEach(t=>{if(e.getLayer(t))try{e.setLayoutProperty(t,"visibility","none")}catch{}});else{const t=this.unitsExtrusionOriginalVisibility||{};y.forEach(o=>{const i=t[o]??"visible";if(e.getLayer(o))try{e.setLayoutProperty(o,"visibility",i)}catch{}})}}}listExtrusionLayerIds(){const t=this.map;if(!t)return[];try{const e=t.getStyle(),o=e?.layers||[],i=o.filter(t=>"fill-extrusion"===t?.type).map(t=>t.id),n=Array.isArray(a)?a:[],r=[];return n.forEach(t=>{const e=o.find(e=>e.id===t);e&&"fill-extrusion"===e.type&&r.push(t)}),[...new Set([...i,...r])]}catch{return this.cachedExtrusionIds||[]}}setLayersVisibility(t,e){const o=this.map;o&&t.forEach(t=>{try{o.getLayer(t)&&o.setLayoutProperty(t,"visibility",e)}catch{}})}get map(){return this.getMap()}}function w(t){if(!t)return null;const e=t.getCenter(),o=(t,e=6)=>function(t,e=6){const o=Number(t.toFixed(e));return Object.is(o,-0)?0:o}(t,e);return{center:[o(e.lng),o(e.lat)],zoom:o(t.getZoom(),4),pitch:o(t.getPitch(),2),bearing:o(t.getBearing(),2)}}const b={async updatePOIs(t,e,i){const[r,s]=await Promise.all([i.getAmenities(e.id),i.getDestinations(e.id)]),a=b.buildPOIs(e,r,s,i.spriteKeys);o.setData(t,n,b.toFeatureCollection(a))},buildPOIs(t,e=[],o=[],i){const n=t?.id;if(!n)return[];const r=[];let s=!1;for(const o of e||[]){if(!o.waypoints)continue;const e=v(o),a=I(o.svg,i)||void 0,l="you-are-here";for(const i of o.waypoints||[]){if(i.mapId!==n||!x(i.coordinates))continue;const[u,d]=i.coordinates,c=e&&!s,p=c?l:a,f=i.id??i._?.id;r.push({id:o.id,type:"amenity",name:c?"You are here":o.name||"Amenity",coordinates:[u,d],iconId:p,floorId:t.id,amenityType:o.type,keywords:o.keywords||[],showLabel:!0,isYouAreHere:c,waypointId:f,waypoint:i}),c&&(s=!0)}}for(const e of o||[])if(e.waypoints)for(const o of e.waypoints||[]){if(o.mapId!==n||!x(o.coordinates))continue;const[i,s]=o.coordinates,a=o.id??o._?.id;r.push({id:e.id,type:"destination",name:e.name||"Destination",coordinates:[i,s],floorId:t.id,showLabel:!0,waypointId:a,waypoint:o})}return r},toFeatureCollection:t=>({type:"FeatureCollection",features:t.map(t=>({type:"Feature",geometry:{type:"Point",coordinates:t.coordinates},properties:{id:t.id,name:t.name,poiType:t.type,iconId:t.iconId,floorId:t.floorId,keywords:t.keywords,amenityType:t.amenityType,showLabel:!1!==t.showLabel,isYouAreHere:!0===t.isYouAreHere}}))})};function F(t){return t.find(t=>t.isYouAreHere)||null}function x(t){return Array.isArray(t)&&t.length>=2}function I(t,e){if(!t||!e)return null;const o=/<svg[^>]*\bid\s*=\s*["']([^"']+)["']/i.exec(t),i=o?.[1];return i&&e.has(i)?i:null}function v(t){const e=t=>(t??"").toLowerCase(),o=e(t.name),i=(t.keywords||[]).map(t=>e(t)),n=t.extensors||{},r=e(n.type),s="kiosk"===o||o.includes("kiosk"),a=i.some(t=>t.includes("kiosk"));return s||a||"assistance"===r}class A{deps;routeAnimationFrame=null;routeAnimationStart=null;routeAnimationDurationMs=1200;routeActive=!1;constructor(t){this.deps=t}buildWayfindFeatureCollection(t){if(!t)return this.deps.warn?.("wayfind :: no result"),null;const e=[],o=t=>{if(!t)return;const o=t.coordinates||t.xyz||t._?.coordinates;if(Array.isArray(o)&&o.length>=2){const t=Number(o[0]),i=Number(o[1]);Number.isFinite(t)&&Number.isFinite(i)&&e.push([t,i])}};return Array.isArray(t)?t.length>0&&Array.isArray(t[0]?.points)?t[0].points.forEach(o):t.forEach(o):Array.isArray(t.points)?t.points.forEach(o):Array.isArray(t.path)?t.path.forEach(o):Array.isArray(t.paths?.[0]?.points)&&t.paths[0].points.forEach(o),e.length<2?(this.deps.warn?.("wayfind :: not enough coordinates to draw a route",{resultShape:{isArray:Array.isArray(t),hasPoints:Array.isArray(t.points),hasPath:Array.isArray(t.path),hasPaths0Points:Array.isArray(t.paths?.[0]?.points)},extractedCount:e.length}),null):(this.deps.log?.("wayfind :: extracted coordinates for route",{count:e.length,first:e[0],last:e[e.length-1]}),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:e},properties:{}}]})}async wayfindBetweenWaypoints(t,e,i){const n=this.deps.getMap();if(!this.deps.getVenue()||!n)return this.deps.warn?.("wayfindBetweenWaypoints :: venue or map not ready"),null;let r=null;try{r=await this.deps.computeRoute(t,e)}catch(t){return this.deps.warn?.("wayfind :: computeRoute failed",t),null}this.deps.log?.("wayfind :: result",r);const a=this.buildWayfindFeatureCollection(r);if(!a)return r;o.setData(n,s,a),this.deps.log?.("wayfind :: route source updated",{featureCount:a.features.length}),this.startRouteAnimation();const l=i?.centerMode??"route",u=i?.zoom??19;if("none"!==l){const t=a.features[0]?.geometry;if(t&&"LineString"===t.type&&Array.isArray(t.coordinates)){const e=t.coordinates;if("destination"===l){const t=e[e.length-1];n.flyTo({center:t,zoom:u,pitch:45,bearing:0,animate:!0,duration:900})}else if("route"===l){const t=e.map(t=>t[0]),o=e.map(t=>t[1]),i=Math.min(...t),r=Math.max(...t),s=[[i,Math.min(...o)],[r,Math.max(...o)]];n.fitBounds(s,{padding:this.deps.getBoundsPadding(),animate:!0})}}}return r}async navigateFromKioskToDestination(t){const e=this.deps.getMap(),o=this.deps.getVenue();if(!e||!o)return null;const i=this.deps.getYouAreHerePOI();if(!i||!i.waypoint)return this.deps.warn?.("navigateFromKioskToDestination :: no you-are-here waypoint available",i),null;const n=t.waypoint||t.waypoints?.[0];if(!n)return this.deps.warn?.("navigateFromKioskToDestination :: destination has no waypoint",t),null;this.deps.log?.("navigateFromKioskToDestination :: from kiosk to destination",{kioskWaypoint:i.waypoint,destWaypoint:n});const r=this.deps.getYouAreHereCoordinates()??i.waypoint?.coordinates,s=n.coordinates||n.xyz||n._?.coordinates,a=Array.isArray(s)&&s.length>=2?[Number(s[0]),Number(s[1])]:null;return r&&a?this.showRouteContext(r,a):this.deps.warn?.("navigateFromKioskToDestination :: could not derive endpoint coordinates",{fromCoords:r,rawDest:s}),this.wayfindBetweenWaypoints(i.waypoint,n,{centerMode:"route"})}clearRoute(){const t=this.deps.getMap();if(!t)return;this.stopRouteAnimation();o.setData(t,s,{type:"FeatureCollection",features:[]}),this.deps.log?.("wayfind :: route cleared")}setPoiLayersVisible(t){const e=this.deps.getMap();if(!e)return;const o=t?"visible":"none";["poi-accessibility-icons","poi-destination-circles","poi-destination-labels","poi-entrance-exit-icons","poi-parking-icons","poi-other-amenity-icons"].forEach(t=>{e.getLayer(t)&&e.setLayoutProperty(t,"visibility",o)})}updateRouteEndpoints(t,e){const o=this.deps.getMap();if(!o)return;const i=o.getSource("route-endpoints");if(!i)return;const n={type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{role:"source"}},{type:"Feature",geometry:{type:"Point",coordinates:e},properties:{role:"destination"}}]};i.setData(n)}clearRouteEndpoints(){const t=this.deps.getMap();if(!t)return;const e=t.getSource("route-endpoints");if(!e)return;e.setData({type:"FeatureCollection",features:[]})}showRouteContext(t,e){this.updateRouteEndpoints(t,e)}hideRouteContext(){this.setPoiLayersVisible(!0),this.clearRouteEndpoints()}startRouteAnimation(){if(!this.deps.getMap())return;if("undefined"==typeof window)return;null!=this.routeAnimationFrame&&(cancelAnimationFrame(this.routeAnimationFrame),this.routeAnimationFrame=null),this.routeAnimationStart=performance.now(),this.routeActive=!0;const t=this.deps.debug,e=o=>{const i=this.deps.getMap();if(!i||!this.routeActive||null==this.routeAnimationStart)return;const n=o-this.routeAnimationStart,r=Math.min(1,n/this.routeAnimationDurationMs),s=Math.max(.001,r);t&&this.deps.log?.("route animation frame",{t:r,clamped:s});const a=Math.max(0,s-.01),l=Math.min(1,s+.01),u=["interpolate",["linear"],["line-progress"],0,"rgba(0,122,255,1.0)",a,"rgba(0,122,255,1.0)",l,"rgba(0,122,255,0.0)",1,"rgba(0,122,255,0.0)"],d=["interpolate",["linear"],["line-progress"],0,"rgba(255,255,255,0.7)",a,"rgba(255,255,255,0.7)",l,"rgba(255,255,255,0.0)",1,"rgba(255,255,255,0.0)"];i.getLayer("route-line")&&i.setPaintProperty("route-line","line-gradient",u),i.getLayer("route-halo")&&i.setPaintProperty("route-halo","line-gradient",d),this.routeAnimationFrame=r<1?requestAnimationFrame(e):null};this.routeAnimationFrame=requestAnimationFrame(e)}stopRouteAnimation(){this.routeActive=!1,null!=this.routeAnimationFrame&&"undefined"!=typeof window&&cancelAnimationFrame(this.routeAnimationFrame),this.routeAnimationFrame=null,this.routeAnimationStart=null;const t=this.deps.getMap();t&&(t.getLayer("route-line")&&(t.setPaintProperty("route-line","line-gradient",void 0),t.setPaintProperty("route-line","line-color","#007aff")),t.getLayer("route-halo")&&(t.setPaintProperty("route-halo","line-gradient",void 0),t.setPaintProperty("route-halo","line-color","#ffffff")))}}class C{getVenue;getFloors;getFloorById;logFn;constructor(t){this.getVenue=t.getVenue,this.getFloors=t.getFloors,this.getFloorById=t.getFloorById,this.logFn=t.log}get venue(){return this.getVenue()}log(...t){this.logFn&&this.logFn(...t)}loadForFloor(t){if(!t||!this.venue)return[];try{const e=this.venue.amenities?.getByMap(t.id)||[];return Array.isArray(e)?e.map(e=>{const o=e;return o.floorId=t.id,o}):[]}catch{return[]}}getAll(){return this.getFloors().flatMap(t=>this.loadForFloor(t))}getByFloorId(t){const e=this.getFloorById(t);return e?this.loadForFloor(e):[]}getAllKiosks(){return this.getAll().filter(t=>v(t))}getKioskForFloor(t){const e=this.getFloorById(t);if(!e)return null;return this.loadForFloor(e).find(t=>v(t))??null}logKioskForFloor(t){const e=this.getFloorById(t);if(!e)return;const o=this.getKioskForFloor(t);o?this.log("amenity :: kiosk found",{floorId:e.id,id:o.id,name:o.name,keywords:o.keywords,waypoints:o.waypoints,raw:o}):this.log("amenity :: kiosk not found on floor",{floorId:e.id})}}u({enabled:!0,prefix:"MinuteMapsSDK"});class S{mode;proxyBaseUrl;direct;fetchImpl;tokenCache=null;constructor(t){const e="undefined"!=typeof window?window:globalThis,o=t.fetchImpl??e.fetch;if("function"!=typeof o)throw new Error("Fetch API is not available in this environment");this.fetchImpl=o.bind(e),this.mode=t.mode,this.proxyBaseUrl=("proxy"===t.mode?t.proxyBaseUrl:void 0)||"/api/jacs","direct"===t.mode?this.direct={host:this.normalizeHost(t.host),clientId:t.clientId,username:t.username,password:t.password}:this.direct=null}async getPolygonLayers(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/polygon-layer`,o=await this.getJson(e);return this.extractArray(o)}async getFloorMapTemplate3d(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/floor/${encodeURIComponent(String(t.floorId))}/map-template/3d`,o=await this.getJson(e);return this.extractArray(o)}async getFloors(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/floor`,o=await this.getJson(e);return this.extractArray(o)}async getVenue(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}`,o=await this.getJson(e),i=o?.venue||o?.data||o;if(!i||"object"!=typeof i)throw new Error("JACS venue response was not a JSON object");return i}async getFloorMapGeojson(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/floor/${encodeURIComponent(String(t.floorId))}/map/geojson`,o=await this.getJson(e),i=o?.geojson||o?.data||o;if(!i||"FeatureCollection"!==i.type||!Array.isArray(i.features))throw new Error("JACS floor geojson did not look like a GeoJSON FeatureCollection");return i}async getBuildingFull(t){const e=new URLSearchParams;e.set("mapProfile",String(t.mapProfile??"public")),e.set("geojson",String(t.geojson??!0));const o=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/full?${e.toString()}`,i=await this.getJson(o),n=i?.data||i?.result||i;if(!n||"object"!=typeof n)throw new Error("JACS building full response was not a JSON object");return n}async getDestinations(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/destination`,o=await this.getJson(e);return this.extractArray(o)}async getAmenities(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/amenity`,o=await this.getJson(e);return this.extractArray(o)}async getBuildings(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building`,o=await this.getJson(e);return this.extractArray(o)}async getStylesheet3d(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/building/${encodeURIComponent(String(t.buildingId))}/stylesheet/3d`,o=await this.getJson(e),i=o?.style||o?.data||o;if(!i||"object"!=typeof i)throw new Error("JACS stylesheet response was not a JSON object");return i}invalidateToken(){this.tokenCache=null}async getJson(t){if("proxy"===this.mode){const e=this.proxyBaseUrl.replace(/\/+$/,""),o=t.startsWith("/")?t:`/${t}`,i=await this.fetchImpl(`${e}${o}`,{method:"GET",headers:{Accept:"application/json"}});if(!i.ok){const t=await this.safeReadText(i);throw new Error(`JACS proxy GET failed (${i.status} ${i.statusText}) :: ${t}`)}return await i.json()}const e=this.direct;if(!e)throw new Error("JacsProvider is not configured for direct mode");const o=await this.getJwtToken(),i=this.joinUrl(e.host,t),n=await this.fetchImpl(i,{method:"GET",headers:{Authorization:`Bearer ${o}`,Accept:"application/json"}});if(!n.ok){const t=await this.safeReadText(n);throw new Error(`JACS GET failed (${n.status} ${n.statusText}) :: ${t}`)}return await n.json()}extractArray(t){return(Array.isArray(t)?t:null)||(Array.isArray(t?.data)?t.data:null)||(Array.isArray(t?.items)?t.items:null)||(Array.isArray(t?.results)?t.results:null)||[]}async getJwtToken(){const t=this.direct;if(!t)throw new Error("getJwtToken should not be called in proxy mode");const e=Date.now(),o=this.tokenCache;if(o?.token&&e<o.expiresAtMs-3e4)return o.token;const i=this.joinUrl(t.host,"/auth/token"),n=new URLSearchParams;n.set("grant_type","password"),n.set("client_id",t.clientId),n.set("username",t.username),n.set("password",t.password);const r=await this.fetchImpl(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},body:n.toString()});if(!r.ok){const t=await this.safeReadText(r);throw new Error(`JACS auth failed (${r.status} ${r.statusText}) :: ${t}`)}const s=await r.json(),a=s?.access_token||s?.token||s?.jwt||s?.accessToken;if(!a)throw new Error("JACS auth response did not contain a token");const l=s?.expires_in??s?.expiresIn??s?.expires??s?.ttl,u="number"==typeof l?l:Number(l),d=Number.isFinite(u)&&u>0?u:600;return this.tokenCache={token:a,expiresAtMs:Date.now()+1e3*d},a}normalizeHost(t){return String(t||"").replace(/\/+$/,"")}joinUrl(t,e){const o=this.normalizeHost(t),i=String(e||"");return i?`${o}${i.startsWith("/")?"":"/"}${i}`:o}async safeReadText(t){try{return await t.text()}catch{return""}}}const E=u({enabled:!0,prefix:"MinuteMapsSDK jacs"});class M{config;jacs;floors=[];buildingId=null;destinationsByMapId=new Map;amenitiesByMapId=new Map;venueLike=null;async init(t){this.config=t;const e=t.jacs;if(!e?.mode)throw new Error("config.jacs.mode is required");if("proxy"!==e.mode){if(!e.host)throw new Error("config.jacs.host is required (direct mode)");if(!e.auth?.clientId)throw new Error("config.jacs.auth.clientId is required (direct mode)");if(!e.auth?.username)throw new Error("config.jacs.auth.username is required (direct mode)");if(!e.auth?.password)throw new Error("config.jacs.auth.password is required (direct mode)");this.jacs=new S({mode:"direct",host:e.host,clientId:e.auth.clientId,username:e.auth.username,password:e.auth.password})}else this.jacs=new S({mode:"proxy",proxyBaseUrl:e.proxyBaseUrl||"/api/jacs"})}async loadVenue(){const t=this.config.jmap.customerId,e=this.config.jmap.venueId;if(null==t)throw new Error("config.jmap.customerId is required");if(null==e)throw new Error("config.jmap.venueId is required");const o=await this.jacs.getBuildings({customerId:t,venueId:e}),i=o[0]?.id??o[0]?.buildingId;if(0===o.length||!i)throw new Error("No buildings found for this customer and venue");const[n,r]=await Promise.all([this.jacs.getVenue({customerId:t,venueId:e}),this.jacs.getBuildingFull({customerId:t,venueId:e,buildingId:i,mapProfile:"public",geojson:!0})]);this.buildingId=i;const s=(r?.floors?.items??r?.floors??[]).map(t=>{const e=t.map??{};return{id:t.id,name:t.name??t.shortName??String(t.id),sequence:t.level??t.preference,isDefault:t.id===r?.defaultFloorId,geojson:e.geojson??null,mapTemplate3d:[],_waypoints:e.waypoints?.items??[]}});this.floors=s;let a=[],l=[];try{const o=await this.jacs.getJson(`/customer/${t}/venue/${e}/full?mapProfile=public`);a=o?.destinations?.items??[],l=o?.amenities?.items??[]}catch{try{a=await this.jacs.getDestinations({customerId:t,venueId:e})}catch{}try{l=await this.jacs.getAmenities({customerId:t,venueId:e})}catch{}}this.amenitiesByMapId.clear();for(const t of l)for(const e of t?.waypoints??[]){const o=e?.mapId;if(null==o)continue;const i=this.amenitiesByMapId.get(o)??[];i.push(t),this.amenitiesByMapId.set(o,i)}this.destinationsByMapId.clear();for(const t of a)for(const e of t?.waypoints??[]){const o=e?.mapId;if(null==o)continue;const i=this.destinationsByMapId.get(o)??[];i.push(t),this.destinationsByMapId.set(o,i)}return this.venueLike={...n,floors:s,polygonLayers:[],destinations:{items:[...a],getByMap:({id:t})=>this.destinationsByMapId.get(t)??[]},amenities:{items:[...l],getByMap:({id:t})=>this.amenitiesByMapId.get(t)??[]},buildings:{items:[...o],getAllFloors:()=>this.floors},styleSheet:null},this.venueLike}async ensureFloorGeojson(t){if(t.geojson)return;const e=this.config.jmap.customerId,o=this.config.jmap.venueId;try{const i=await this.jacs.getFloorMapGeojson({customerId:e,venueId:o,buildingId:this.buildingId,floorId:t.id});t.geojson=function(t){return(t?.type?t:t?.data)??null}(i)}catch(e){E.warn("floor geojson fetch failed",{floorId:t.id,e:e})}}async preloadRemainingFloors(){const t=this.floors.filter(t=>!t.geojson);0!==t.length&&(await Promise.all(t.map(t=>this.ensureFloorGeojson(t))),E.debug("preloaded geojson for remaining floors",{count:t.length}))}async getFloors(){return this.floors}async getAmenities(t){return this.amenitiesByMapId.get(t)??[]}async getDestinations(t){return this.destinationsByMapId.get(t)??[]}}class z{handlers=new Map;on(t,e){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t).add(e)}off(t,e){e?this.handlers.get(t)?.delete(e):this.handlers.delete(t)}emit(t,e){this.handlers.get(t)?.forEach(t=>{try{t(e)}catch{}})}}var B={version:8,name:"Hospital Indoor Mapping - Hybrid Style Healthcare Compliant",metadata:{description:"Accessibility-focused hospital navigation with proper healthcare standards",author:"Hospital Mapping Team",version:"7.1.0"},sprite:"http://localhost:4000/sprites/sprite",glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{"osm-tiles":{type:"raster",tiles:["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],tileSize:256,attribution:"© OpenStreetMap contributors"},"indoor-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"poi-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"accessibility-data":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"unit-walls":{type:"geojson",data:{type:"FeatureCollection",features:[]}},"route-data":{type:"geojson",data:{type:"FeatureCollection",features:[]},lineMetrics:!0},"route-endpoints":{type:"geojson",data:{type:"FeatureCollection",features:[]}}},layers:[{id:"background",type:"background",paint:{"background-color":"#F5F5F5"}},{id:"osm",type:"raster",source:"osm-tiles",minzoom:0,paint:{"raster-opacity":["interpolate",["linear"],["zoom"],14,.8,16,.6,18,.4]}},{id:"pattern-water",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Water"],paint:{"fill-color":"#5DADE2","fill-opacity":.6}},{id:"pattern-grass",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Grass"],paint:{"fill-color":"#7CB342","fill-opacity":.5}},{id:"pattern-trees",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Trees"],paint:{"fill-color":"#4CAF50","fill-opacity":.4}},{id:"pattern-pavement",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Pavement"],paint:{"fill-color":"#E0E0E0","fill-opacity":.6}},{id:"pattern-outdoor-terrace",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-OutdoorTerrace"],paint:{"fill-color":"#8D6E63","fill-opacity":.3}},{id:"parking-lots",type:"fill",source:"indoor-data",filter:["==",["get","featureType"],"Parking-Lots"],paint:{"fill-color":"#BDBDBD","fill-opacity":.6}},{id:"parking-lots-outline",type:"line",source:"indoor-data",filter:["==",["get","featureType"],"Parking-Lots"],paint:{"line-color":"#757575","line-width":1,"line-dasharray":[3,2]}},{id:"boundary-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],paint:{"fill-color":"#FAF3E2","fill-opacity":1}},{id:"building-roof-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],paint:{"fill-color":"#6A8799","fill-opacity":1}},{id:"corridors-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],paint:{"fill-color":"#F0E6D1"}},{id:"accessible-routes",type:"line",source:"accessibility-data",minzoom:16.5,filter:["==",["get","accessible"],!0],paint:{"line-color":"#2E7D32","line-width":["interpolate",["linear"],["zoom"],15,2,18,3,20,4],"line-dasharray":[.5,1],"line-opacity":.7}},{id:"units-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Units"],paint:{"fill-color":["case",["has","category"],["match",["get","category"],"healthcare","#7C3AED","emergency","#DC2626","diagnostic","#0EA5E9","surgical","#7C3AED","retail","#FF6B6B","fnb","#FFA500","admin","#A29BFE","amenities","#48C9B0","staff","#74B9FF","security","#1A7A96","waiting","#E1BEE7","#8ecae6"],"#8ecae6"],"fill-opacity":["interpolate",["linear"],["zoom"],15,.85,17,.92,19,.95]}},{id:"units-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Units"],layout:{visibility:"none","line-join":"round","line-cap":"round"},paint:{"line-color":"#263238","line-opacity":.9,"line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.6]}},{id:"backofhouse-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"fill-color":"#D6D6CC","fill-opacity":.7}},{id:"backofhouse-pattern",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"line-color":"#90A4AE","line-width":.5,"line-opacity":.4}},{id:"backofhouse-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#7B8D93","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"restrooms-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],paint:{"fill-color":"#5B8468","fill-opacity":1}},{id:"restrooms-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#3F5D4A","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"obstacles-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],paint:{"fill-color":"#E8E9ED","fill-opacity":.85}},{id:"obstacles-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#B0B1B5","line-width":["interpolate",["linear"],["zoom"],16,.5,18,.9,20,1.2],"line-opacity":.9}},{id:"escalators-stairs-elevators",type:"fill",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],paint:{"fill-color":"#6A8799","fill-opacity":1}},{id:"escalators-stairs-elevators-outline-2d",type:"line",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#455A64","line-width":["interpolate",["linear"],["zoom"],16,.6,18,1,20,1.4],"line-opacity":.9}},{id:"exits-doors",type:"fill",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Exits","Doors","Exit","Door"]]],paint:{"fill-color":"#4CAF50","fill-opacity":.6}},{id:"kiosks-fill",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Kiosks"],paint:{"fill-color":"#9C27B0","fill-opacity":.7}},{id:"pattern-lounge",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-Lounge"],paint:{"fill-color":"#CE93D8","fill-opacity":.5}},{id:"pattern-indoor-foodcourt",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Pattern-IndoorFoodcourt"],paint:{"fill-color":"#FFCC80","fill-opacity":.6}},{id:"corridors-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],paint:{"line-color":"#BCAAA4","line-width":["interpolate",["linear"],["zoom"],15,.5,18,1,20,1.5]}},{id:"boundary-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],paint:{"line-color":"#263238","line-width":["interpolate",["linear"],["zoom"],12,2,15,2.5,18,3,20,3.5],"line-opacity":["interpolate",["linear"],["zoom"],12,.7,17,.85,18,1]}},{id:"building-roof-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Boundary"],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#263238","line-width":["interpolate",["linear"],["zoom"],15,1.2,18,1.8,20,2.4],"line-opacity":.95}},{id:"interior-parking-lots",type:"fill",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"fill-color":"#757575","fill-opacity":.8}},{id:"interior-parking-lots-outline",type:"line",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"line-color":"#616161","line-width":1.5}},{id:"building-extrusion",type:"fill-extrusion",source:"indoor-data",filter:["==",["get","featureType"],"Boundary"],maxzoom:16.5,paint:{"fill-extrusion-color":"#6A8799","fill-extrusion-height":15,"fill-extrusion-base":0,"fill-extrusion-opacity":1}},{id:"units-wall-extrusion",type:"fill-extrusion",source:"unit-walls",minzoom:16.5,filter:["all",["==",["get","featureType"],"UnitWalls"],["!",["has","custom_height"]]],paint:{"fill-extrusion-color":["case",["has","category"],["match",["get","category"],"healthcare","#5B2DB8","emergency","#B91C1C","diagnostic","#0C7FAB","surgical","#5B2DB8","retail","#CC5555","fnb","#CC8400","admin","#7B73CC","amenities","#3A9B88","staff","#5C96CC","security","#135C75","waiting","#B894C2","#eeeeee"],"#eeeeee"],"fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,2,17.5,3,18.2,3.2],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!1,"fill-extrusion-opacity":.9}},{id:"units-wall-custom-extrusion",type:"fill-extrusion",source:"unit-walls",minzoom:16.5,filter:["has","custom_height"],paint:{"fill-extrusion-color":["case",["has","category"],["match",["get","category"],"healthcare","#5B2DB8","emergency","#B91C1C","diagnostic","#0C7FAB","surgical","#5B2DB8","retail","#CC5555","fnb","#CC8400","admin","#7B73CC","amenities","#3A9B88","staff","#5C96CC","security","#135C75","waiting","#B894C2","#FDFAF2"],"#FDFAF2"],"fill-extrusion-height":["to-number",["get","custom_height"]],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!1,"fill-extrusion-opacity":.95}},{id:"corridors-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["any",["==",["get","featureType"],"Corridors"],["==",["get","featureType"],"Corridor"]],layout:{visibility:"none"},paint:{"fill-extrusion-color":"#FFF8E1","fill-extrusion-height":["step",["zoom"],0,18,3.2],"fill-extrusion-base":0,"fill-extrusion-opacity":["step",["zoom"],0,18,.85]}},{id:"backofhouse-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Back-of-house"],paint:{"fill-extrusion-color":"#D6D6CC","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,2,17.5,3,18.2,3.2],"fill-extrusion-base":0,"fill-extrusion-opacity":1}},{id:"restrooms-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Restrooms"],paint:{"fill-extrusion-color":"#5B8468","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,2,17.5,3,18.2,3.2],"fill-extrusion-base":0,"fill-extrusion-opacity":.9}},{id:"obstacles-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Obstacles"],paint:{"fill-extrusion-color":"#E8E9ED","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,.8,17.5,1.5,18.2,2],"fill-extrusion-base":0,"fill-extrusion-opacity":1}},{id:"escalators-stairs-elevators-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["in",["get","featureType"],["literal",["Escalators","Stairs","Elevators"]]],paint:{"fill-extrusion-color":"#6A8799","fill-extrusion-height":["interpolate",["linear"],["zoom"],15.5,0,16.5,2,17.5,3,18.2,3.2],"fill-extrusion-base":0,"fill-extrusion-vertical-gradient":!0,"fill-extrusion-opacity":.9}},{id:"interior-parking-extrusion",type:"fill-extrusion",source:"indoor-data",minzoom:16.5,filter:["==",["get","featureType"],"Interior-ParkingLots"],paint:{"fill-extrusion-color":"#757575","fill-extrusion-height":["interpolate",["linear"],["zoom"],15,0,16,2,17,3,18,4],"fill-extrusion-base":0,"fill-extrusion-opacity":.85}},{id:"route-line",type:"line",source:"route-data",minzoom:16.5,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#007aff","line-width":["interpolate",["linear"],["zoom"],16.5,3,18,5,20,7],"line-opacity":.9}},{id:"route-halo",type:"line",source:"route-data",minzoom:16.5,paint:{"line-color":"white","line-width":["interpolate",["linear"],["zoom"],16.5,5,18,7,20,9],"line-opacity":.7}},{id:"route-endpoint-source",type:"circle",source:"route-endpoints",minzoom:16.5,filter:["==",["get","role"],"source"],paint:{"circle-radius":6,"circle-color":"#ffffff","circle-stroke-width":3,"circle-stroke-color":"#007aff","circle-opacity":1}},{id:"route-endpoint-destination",type:"circle",source:"route-endpoints",minzoom:16.5,filter:["==",["get","role"],"destination"],paint:{"circle-radius":7,"circle-color":"#007aff","circle-stroke-width":3,"circle-stroke-color":"#ffffff","circle-opacity":1}},{id:"poi-accessibility-icons",type:"symbol",source:"poi-data",filter:["==",["get","accessible"],!0],minzoom:16.5,layout:{"icon-image":"wheelchair-accessible","icon-size":["interpolate",["linear"],["zoom"],15,.4,17,.6,19,.8],"icon-allow-overlap":!1,"icon-padding":4}},{id:"poi-destination-circles",type:"circle",source:"poi-data",filter:["==",["get","poiType"],"destination"],minzoom:16.5,paint:{"circle-radius":["interpolate",["linear"],["zoom"],15,3,17,4,19,5,20,6],"circle-color":"#162e51","circle-stroke-width":2,"circle-stroke-color":"#FFFFFF","circle-opacity":.9}},{id:"poi-destination-labels",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"destination"],["==",["get","showLabel"],!0]],minzoom:18.5,layout:{"text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],18.5,12,20,14],"text-offset":[0,.8],"text-anchor":"top","text-font":["Noto Sans Bold"],"text-max-width":12,"text-allow-overlap":!1,"text-rotation-alignment":"viewport"},paint:{"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1}},{id:"poi-entrance-exit-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["any",["!=",["index-of","entrance",["get","keywords"]],-1],["!=",["index-of","exit",["get","keywords"]],-1],["!=",["index-of","door",["get","keywords"]],-1]]],minzoom:15,layout:{"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!0,"icon-padding":2,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16.5,0,18.5,0,19,12,20,13],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-parking-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["any",["!=",["index-of","parking",["get","keywords"]],-1],["!=",["index-of","park",["get","keywords"]],-1]]],minzoom:14,layout:{"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.5,18,.6,20,.8],"icon-allow-overlap":!0,"icon-padding":2,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],16.5,0,18.5,0,19,12,20,13],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-other-amenity-icons",type:"symbol",source:"poi-data",filter:["all",["==",["get","poiType"],"amenity"],["==",["index-of","entrance",["get","keywords"]],-1],["==",["index-of","exit",["get","keywords"]],-1],["==",["index-of","door",["get","keywords"]],-1],["==",["index-of","parking",["get","keywords"]],-1],["==",["index-of","park",["get","keywords"]],-1]],minzoom:17.5,layout:{"icon-image":["get","iconId"],"icon-size":["interpolate",["linear"],["zoom"],17.5,.5,18,.6,20,.8],"icon-allow-overlap":!0,"icon-padding":2,"icon-optional":!1,"icon-rotation-alignment":"viewport","icon-pitch-alignment":"viewport","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],17.5,0,18.5,0,19,12,20,13],"text-offset":[0,1.3],"text-anchor":"top","text-optional":!0,"text-padding":4,"text-font":["Noto Sans Bold"],"text-rotation-alignment":"viewport"},paint:{"icon-halo-color":"#FFFFFF","icon-halo-width":1.5,"icon-halo-blur":.5,"text-color":"#242930","text-halo-color":"#FFFFFF","text-halo-width":1.5,"text-halo-blur":1,"icon-translate":[0,-20],"icon-translate-anchor":"viewport"}},{id:"poi-you-are-here",type:"symbol",source:"poi-data",filter:["==",["get","isYouAreHere"],!0],minzoom:16.5,layout:{"icon-image":["coalesce",["get","iconId"],"you-are-here"],"icon-size":["interpolate",["linear"],["zoom"],16.5,.8,18,1,20,1.2],"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-anchor":"bottom","text-field":["get","name"],"text-size":["interpolate",["linear"],["zoom"],17.5,11,19.5,13],"text-offset":[0,1.2],"text-anchor":"top","text-font":["Noto Sans Bold"],"text-optional":!0},paint:{"text-color":"#ffffff","text-halo-color":"#000000","text-halo-width":1.5,"text-halo-blur":.8}}]};function k(t,e,o={}){t.sources||={},t.sources[e]||(t.sources[e]={type:"geojson",data:{type:"FeatureCollection",features:[]},...o})}function j(t){let e=structuredClone(t.style);if(e.sprite=t.customSprite||e.sprite||t.defaultSpriteUrl,k(e,i),k(e,r),k(e,n),k(e,s,{lineMetrics:!0}),k(e,"route-endpoints"),t.floorLayers)for(const o of Object.keys(t.floorLayers))k(e,`amenity_${o}`),k(e,`destination_${o}`),k(e,`pathTypes_${o}`);return e}const P="https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite";class T{config;map=null;data=new M;wayfindingProvider={wayfindBetweenWaypoints:async()=>{throw new Error("Wayfinding is not yet implemented in the SDK")}};events=new z;floorsApi;venue=null;spriteKeys=null;debug;logger;defaultCamera=null;viewModes;amenityManager;wayfinding;constructor(t){this.config=t,this.debug=Boolean(t.debug??t.options?.debug),this.logger=u({enabled:this.debug,prefix:"MinuteMapsSDK"}),this.viewModes=new m(()=>this.map),this.floorsApi=new c({getMap:()=>this.map,getConfig:()=>this.config,updatePoiSource:async t=>{const e=this.map;if(!e)return;const i=this.getAllPOIs(t),r=b.toFeatureCollection(i);o.setData(e,n,r)},log:(...t)=>this.logger.debug(...t)}),this.amenityManager=new C({getVenue:()=>this.venue,getFloors:()=>this.floorsApi.getFloors(),getFloorById:t=>this.floorsApi.getFloors().find(e=>e.id===t)??null,log:(...t)=>this.logger.debug(...t)}),this.wayfinding=new A({getMap:()=>this.map,getVenue:()=>this.venue,getYouAreHerePOI:t=>this.getYouAreHerePOI(t),getYouAreHereCoordinates:t=>this.getYouAreHereCoordinates(t),getBoundsPadding:()=>this.getBoundsPadding(),computeRoute:async(t,e)=>{const o=this.config.jmap.customerId,i=this.config.jmap.venueId;if(null==o)throw new Error("config.jmap.customerId is required");if(null==i)throw new Error("config.jmap.venueId is required");return this.wayfindingProvider.wayfindBetweenWaypoints({customerId:o,venueId:i,from:t,to:e})},log:(...t)=>this.logger.debug(...t),warn:(...t)=>this.logger.warn(...t),debug:this.debug})}async init(){const{venueId:e,customerId:o}=this.config?.jmap;if(null==e||null==o)throw new Error("config.jmap.customerId and config.jmap.venueId are required");if(!this.config.container)throw new Error("config.container is required (HTMLElement or element id)");this.logger.debug("init :: starting (JACS)",{venueId:e,customerId:o});try{await this.data.init(this.config),this.logger.debug("providers :: JACS ready"),this.venue=await this.data.loadVenue(),this.logger.debug("JACS :: venue loaded",this.venue.id),this.floorsApi.setFloors(this.venue.floors),this.logger.debug("JACS :: floors loaded",{count:this.venue.floors.length});const e=j({style:B,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:P});this.ensureFloorLayersFromStyle(e),this.map=function(e,o){const i="string"==typeof e?document.getElementById(e):e;if(!i)throw new Error("Map container not found");return new t.Map({container:i,style:o,center:[0,0],zoom:16,pitch:45,bearing:0})}(this.config.container,e),await new Promise(t=>this.map.once("load",()=>t())),this.map.on("error",t=>{const e=t?.error?.message||t?.message||t;this.logger.error("map :: error",{msg:e,sourceId:t?.sourceId,tile:t?.tile})}),this.map.on("styledata",()=>{try{this.viewModes.onStyleData()}catch{}}),this.ensureCoreSources(),this.spriteKeys=await h.getSpriteKeys(this.map);const o=this.floorsApi.getInitialFloor();Boolean(o?.geojson?.features?.length)||this.applyInitialViewFromVenue(),this.defaultCamera=w(this.map),o&&await this.setCurrentFloor(o),this.events.emit("ready",{venue:this.venue}),this.events.emit("floorsLoaded",{})}catch(t){throw this.logger.error("init :: failed (JACS)",t),this.events.emit("error",{error:t}),t}}on(t,e){this.events.on(t,e)}off(t,e){this.events.off(t,e)}addControl(t,e){this.map?.addControl(t,e)}setView(t){!function(t,e){if(!t)return;const{center:o,zoom:i,pitch:n,bearing:r,animate:s,duration:a}=e;if(s){const e=t.getCenter(),s=o||[e.lng,e.lat],l=i??t.getZoom(),u=n??t.getPitch(),d=r??t.getBearing(),c="number"==typeof a?a:900;return void t.flyTo({center:s,zoom:l,pitch:u,bearing:d,duration:c,essential:!0})}o&&t.setCenter(o),void 0!==i&&t.setZoom(i),void 0!==n&&t.setPitch(n),void 0!==r&&t.setBearing(r)}(this.map,t)}get amenities(){return this.amenityManager}resetView(t){!function(t,e,o){if(!t||!e)return;const{center:i,zoom:n,pitch:r,bearing:s}=e,a=Boolean(o?.animate),l="number"==typeof o?.duration?o.duration:800;a?t.easeTo({center:i,zoom:n,pitch:r,bearing:s,duration:l}):t.jumpTo({center:i,zoom:n,pitch:r,bearing:s})}(this.map,this.defaultCamera,t)}set3dEnabled(t){this.viewModes.set3dEnabled(t)}toggle3d(){this.viewModes.toggle3d()}getIs3dEnabled(){return this.viewModes.getIs3dEnabled()}setUnits2dEnabled(t){this.viewModes.setUnits2dEnabled(t)}toggleUnits2d(){this.viewModes.toggleUnits2d()}getIsUnits2dEnabled(){return this.viewModes.getIsUnits2dEnabled()}setFlatMode(t){this.viewModes.setFlatMode(t)}toggleFlatMode(){this.viewModes.toggleFlatMode()}getIsFlatMode(){return this.viewModes.getIsFlatMode()}getFloors(){return this.floorsApi.getFloors()}getCurrentFloor(){return this.floorsApi.getCurrentFloor()}getDefaultFloor(){return this.floorsApi.getDefaultFloor()}getDestinations(t){const e=t||this.getCurrentFloor();return function(t,e){if(!t||!e)return[];try{const o=t.destinations?.getByMap?.({id:e.id})||[];return Array.isArray(o)?o:[]}catch{return[]}}(this.venue,e)}getPolygonLayers(){return this.venue?.polygonLayers??[]}getFloorMapTemplate3d(t){return this.venue?.mapTemplates3d?.[String(t)]??[]}getAllPOIs(t){const e=t||this.getCurrentFloor();if(!e)return[];return function(t,e,o,i){return b.buildPOIs(t,e,o,i)}(e,this.amenityManager.getByFloorId(e.id),this.getDestinations(e),this.spriteKeys)}getYouAreHerePOI(t){return F(this.getAllPOIs(t))}getYouAreHereCoordinates(t){return function(t){const e=F(t);return e?.coordinates??null}(this.getAllPOIs(t))}searchPOIs(t,e){return function(t,e){const o=e.trim().toLowerCase();return o?t.filter(t=>{const e=t.name?.toLowerCase().includes(o),i=(t.keywords||[]).some(t=>t.toLowerCase().includes(o));return e||i}):[]}(this.getAllPOIs(e),t)}async wayfindBetweenWaypoints(t,e,o){return this.wayfinding.wayfindBetweenWaypoints(t,e,o)}async navigateFromKioskToDestination(t){return this.wayfinding.navigateFromKioskToDestination(t)}clearRoute(){this.wayfinding.clearRoute()}getCameraPosition(){return w(this.map)}getMap(){return this.map}destroy(){this.map?.remove(),this.map=null,this.floorsApi.setFloors([]),this.defaultCamera=null,this.viewModes=new m(()=>this.map)}async setCurrentFloor(t){await this.data.ensureFloorGeojson(t),await this.floorsApi.setCurrentFloor(t),this.setFloorLayerVisibility(t.id),this.events.emit("floorChanged",{floor:t})}isReady(){return!!this.map}setFloorLayerVisibility(t){const e=this.map;if(!e)return;const o=this.venue?.styleSheet?.floorLayers;if(o)for(const[i,n]of Object.entries(o)){const o=String(i)===String(t);for(const t of n)e.getLayer(t.id)&&e.setLayoutProperty(t.id,"visibility",o?"visible":"none")}}getBoundsPadding(){return this.config.options?.boundsPadding??50}getVenueBounds(){const t=this.venue?.coordinates;if(!t)return null;const{bottomLng:e,bottomLat:o,topLng:i,topLat:n}=t;if(null==e||null==o||null==i||null==n)return null;const r=Math.min(e,i),s=Math.max(e,i);return[[r,Math.min(o,n)],[s,Math.max(o,n)]]}applyInitialViewFromVenue(){const t=this.map;if(!t)return;const e=this.getVenueBounds();if(e)try{t.resize(),t.fitBounds(e,{padding:this.getBoundsPadding(),animate:!1,duration:0,maxZoom:21})}catch(t){this.logger.warn("applyInitialViewFromVenue :: fitBounds failed",t)}}async loadAndPatchVenueStyle(){const t=this.venue?.styleSheet?.styleUrl,e=this.venue?.styleSheet?.floorLayers,o=B;if("sdkTemplate"===this.config.options?.styleMode)return this.logger.debug("style :: styleMode=sdkTemplate, ignoring venue styleUrl"),j({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:P});if(!t)return this.logger.warn("style :: venue.styleSheet.styleUrl missing, using baseStyle"),j({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:P});try{const o=await fetch(t);if(!o.ok)throw new Error(`HTTP ${o.status} ${o.statusText}`);return j({style:await o.json(),floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:P})}catch(t){return this.logger.warn("style :: failed to fetch venue styleUrl, using baseStyle",t),j({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:P})}}ensureFloorLayersFromStyle(t){const e=this.venue?.styleSheet?.floorLayers;if(e&&Object.keys(e).length)return;const o={};for(const e of t.layers||[]){const t=e.id||"",i=/_(\d+)$/.exec(t);if(!i)continue;const n=i[1];o[n]||=[],o[n].push({id:t})}this.venue||={},this.venue.styleSheet||={},this.venue.styleSheet.floorLayers=o}ensureCoreSources(){const t=this.map;if(!t)return;const e={type:"FeatureCollection",features:[]};o.ensureGeoJson(t,i),o.ensureGeoJson(t,r),o.ensureGeoJson(t,n),t.getSource(s)||t.addSource(s,{type:"geojson",data:e,lineMetrics:!0}),t.getSource("route-endpoints")||t.addSource("route-endpoints",{type:"geojson",data:e})}}function D(t){return new T(t)}export{T as MinuteMaps,D as createMinuteMapsSDK};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/map/sources.ts","../src/constants.ts","../src/logger.ts","../src/map/floors.ts","../src/map/sprites.ts","../src/map/viewModes.ts","../src/map/camera.ts","../src/map/poi.ts","../src/map/wayfinding.ts","../src/map/amenities.ts","../src/data/jacsProvider.ts","../src/data/jacsDataProvider.ts","../src/events.ts","../src/sdk.ts","../src/map/scene.ts","../src/map/destinations.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["Sources","ensureGeoJson","map","id","getSource","addSource","type","data","features","setData","fc","src","INDOOR_SOURCE_ID","POI_SOURCE_ID","WALLS_SOURCE_ID","ROUTE_SOURCE_ID","EXPECTED_INDOOR_LAYER_IDS","noop","createLogger","opts","enabled","Boolean","prefix","p","String","trim","fmtPrefix","debug","args","console","log","warn","error","FloorManager","applyFloor","floor","wallFeet","updateWalls","updateIndoor","geojson","counts","f","t","properties","featureType","key","Object","entries","sort","a","b","slice","walls","filter","unit","inner","turf","buffer","units","props","custom_height","rawHeight","customProperties","height","wall_height","numericHeight","Number","isFinite","geometry","coordinates","buildWalls","boundsFromGeoJson","aLng","aLat","bLng","bLat","bbox","westLng","Math","min","eastLng","max","southLat","selectDefaultFloor","floors","Array","isArray","length","find","isDefault","selectInitialFloor","desired","match","activateFloor","Error","updatePOIs","didFit","fitBounds","padding","boundsPadding","animate","once","getZoom","minIndoorZoom","setZoom","setDidFit","floorId","bounds","FloorsApi","currentFloor","getMap","getConfig","updatePoiSource","logFn","constructor","deps","this","setFloors","getFloors","getCurrentFloor","v","getDefaultFloor","getInitialFloor","cfg","options","initialFloor","setCurrentFloor","name","geojsonFeatures","wallThickness","message","payload","logger","spriteCache","Map","Sprites","getSpriteKeys","spriteUrl","sprite","first","url","resolveSpriteUrl","getStyle","fetch","Set","jsonUrl","endsWith","has","get","res","ok","status","json","keys","set","empty","unitsOutline2dId","unitsWallExtrusionIds","ViewModeController","is3dEnabled","isUnits2dEnabled","isFlatMode","cachedExtrusionIds","extrusionOriginalVisibility","unitsExtrusionOriginalVisibility","unitsOutlineOriginalVisibility","onStyleData","ids","listExtrusionLayerIds","setLayersVisibility","applyUnits2dVisibility","set3dEnabled","vis","forEach","getLayoutProperty","original","getLayer","setLayoutProperty","triggerRepaint","toggle3d","getIs3dEnabled","setUnits2dEnabled","toggleUnits2d","getIsUnits2dEnabled","setFlatMode","toggleFlatMode","getIsFlatMode","outlineVis","style","layers","byType","l","expected","presentExpected","layer","push","layerIds","visibility","captureCameraState","center","getCenter","round","value","precision","rounded","toFixed","is","formatNumber","lng","lat","zoom","pitch","getPitch","bearing","getBearing","PoiManager","ctx","amenities","destinations","Promise","all","getAmenities","getDestinations","pois","buildPOIs","spriteKeys","toFeatureCollection","mapId","youAreHereAssigned","amenity","waypoints","isKiosk","isKioskAmenity","defaultIconId","getIconIdFromSvg","svg","undefined","youAreHereIconId","wp","hasCoordinates","isThisWaypointYouAreHere","iconId","waypointId","_","amenityType","keywords","showLabel","isYouAreHere","waypoint","destination","poi","poiType","getYouAreHerePOI","coords","m","exec","toLower","toLowerCase","k","extensors","extType","nameLooksLikeKiosk","includes","keywordsContainKiosk","some","WayfindingManager","routeAnimationFrame","routeAnimationStart","routeAnimationDurationMs","routeActive","buildWayfindFeatureCollection","result","pushPoint","raw","xyz","points","path","paths","resultShape","hasPoints","hasPath","hasPaths0Points","extractedCount","count","last","wayfindBetweenWaypoints","fromWaypoint","toWaypoint","getVenue","routeResult","computeRoute","err","featureCount","startRouteAnimation","mode","centerMode","line","dest","flyTo","duration","lngs","c","lats","minLng","maxLng","getBoundsPadding","navigateFromKioskToDestination","venue","youAreHere","destWaypoint","kioskWaypoint","fromCoords","getYouAreHereCoordinates","rawDest","toCoords","showRouteContext","clearRoute","stopRouteAnimation","setPoiLayersVisible","visible","visibilityValue","updateRouteEndpoints","from","to","role","clearRouteEndpoints","hideRouteContext","window","cancelAnimationFrame","performance","now","step","mapInstance","elapsed","clamped","head","tail","lineGradient","haloGradient","setPaintProperty","requestAnimationFrame","AmenityManager","getFloorById","loadForFloor","getByMap","getAll","flatMap","getByFloorId","getAllKiosks","getKioskForFloor","logKioskForFloor","kiosk","JacsProvider","proxyBaseUrl","direct","fetchImpl","tokenCache","config","scope","globalThis","rawFetch","bind","host","normalizeHost","clientId","username","password","getPolygonLayers","encodeURIComponent","customerId","getJson","extractArray","getFloorMapTemplate3d","venueId","buildingId","getFloorMapGeojson","getBuildingFull","query","URLSearchParams","mapProfile","toString","full","getBuildings","getStylesheet3d","invalidateToken","base","replace","startsWith","method","headers","Accept","body","safeReadText","statusText","token","getJwtToken","joinUrl","Authorization","items","results","Date","cached","expiresAtMs","tokenUrl","formBody","access_token","jwt","accessToken","expiresInSecRaw","expires_in","expiresIn","expires","ttl","expiresInSec","ttlSec","text","JacsDataProvider","jacs","destinationsByMapId","amenitiesByMapId","venueLike","init","j","auth","loadVenue","jmap","buildings","buildingFull","sdkFloors","shortName","sequence","level","preference","defaultFloorId","mapTemplate3d","_waypoints","venueFull","clear","list","d","polygonLayers","getAllFloors","styleSheet","ensureFloorGeojson","normalizeGeojsonPayload","e","preloadRemainingFloors","pending","EventBus","handlers","on","event","cb","add","off","delete","emit","fn","ensureGeojsonSource","extra","sources","patchVenueStyleForSdk","next","structuredClone","customSprite","defaultSpriteUrl","lineMetrics","floorLayers","MinuteMaps","wayfindingProvider","async","events","floorsApi","defaultCamera","viewModes","amenityManager","wayfinding","getAllPOIs","collection","container","finalStyle","baseStyle","ensureFloorLayersFromStyle","el","document","getElementById","maplibregl","createScene","msg","sourceId","tile","ensureCoreSources","initial","applyInitialViewFromVenue","addControl","control","position","setView","currentCenter","targetCenter","targetZoom","targetPitch","targetBearing","effectiveDuration","essential","setCenter","setPitch","setBearing","setMapView","resetView","state","easeTo","jumpTo","resetMapView","target","getDestinationsForFloor","mapTemplates3d","buildAllPOIsForFloor","getYouAreHerePoiFromList","getYouAreHereCoordsFromList","searchPOIs","q","matchesName","matchesKeywords","searchPoisInList","getCameraPosition","destroy","remove","setFloorLayerVisibility","isReady","activeFloorId","isActive","getVenueBounds","bottomLng","bottomLat","topLng","topLat","resize","maxZoom","loadAndPatchVenueStyle","styleUrl","fallback","styleMode","existing","derived","floorKey","emptyFc","createMinuteMapsSDK"],"mappings":"wDAIO,MAAMA,EAAU,CACrB,aAAAC,CAAcC,EAAkBC,GACzBD,EAAIE,UAAUD,IACjBD,EAAIG,UAAUF,EAAI,CAChBG,KAAM,UACNC,KAAM,CAAED,KAAM,oBAAqBE,SAAU,KAGnD,EACA,OAAAC,CAAQP,EAAkBC,EAAYO,GACpC,MAAMC,EAAWT,EAAIE,UAAUD,GAC/BQ,GAAKF,UAAUC,EACjB,GCdWE,EAAmB,cACnBC,EAAgB,WAChBC,EAAkB,aAClBC,EAAkB,aAElBC,EAA4B,CACvC,gBACA,mBACA,aACA,uBACA,8BACA,iBACA,oBACA,sBCNIC,EAAO,OAOP,SAAUC,EAAaC,GAC3B,MAAMC,EAAUC,QAAQF,GAAMC,SACxBE,EAPR,SAAmBA,GACjB,MAAMC,EAAIC,OAAOF,GAAU,IAAIG,OAC/B,OAAOF,EAAI,IAAIA,KAAO,EACxB,CAIiBG,CAAUP,GAAMG,QAAU,iBAEzC,OAAKF,EASE,CACLO,MAAO,IAAIC,IAASC,QAAQF,MAAML,KAAWM,GAC7C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