@minmaps-dev/mm-web-sdk 1.0.0-rc.10 → 1.0.0-rc.11

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/map/sources.ts","../src/constants.ts","../src/logger.ts","../src/map/floors.ts","../src/map/sprites.ts","../src/map/amenityIcons.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,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","adjusted","Number","isFinite","f","t","properties","featureType","EXTRUDED_INTERIOR_FEATURE_TYPES","has","geom","geometry","inset","turf","buffer","units","insetExtrudedInteriors","geojson","counts","key","Object","entries","sort","a","b","slice","walls","filter","unit","inner","props","custom_height","rawHeight","customProperties","height","wall_height","numericHeight","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","getZoom","minIndoorZoom","setZoom","newBounds","isFirstActivation","didFit","shouldFit","newWest","newSouth","newEast","newNorth","view","getBounds","getWest","getEast","getSouth","getNorth","fitBounds","padding","boundsPadding","animate","duration","bearing","getBearing","pitch","getPitch","once","setDidFit","floorId","animated","Set","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","jsonUrl","endsWith","get","res","ok","status","json","keys","set","empty","AmenityIcons","register","amenities","size","Promise","all","async","amenity","preferredLocale","uris","isSvg","u","mimeType","resourceType","pickLocale","locales","l","locale","uriPath","uri","pickIconUrl","iconId","hasImage","img","mode","text","serialized","doc","DOMParser","parseFromString","svg","documentElement","getElementsByTagName","nodeName","toLowerCase","hasAttribute","setAttribute","XMLSerializer","serializeToString","blob","Blob","blobUrl","URL","createObjectURL","resolve","reject","Image","onload","revokeObjectURL","onerror","err","loadSvgAsImage","addImage","e","amenityId","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","expected","presentExpected","layer","push","layerIds","visibility","captureCameraState","center","getCenter","round","value","precision","rounded","toFixed","is","formatNumber","lng","lat","zoom","PoiManager","ctx","destinations","getAmenities","getDestinations","pois","buildPOIs","spriteKeys","toFeatureCollection","wpMapId","mapId","youAreHereAssigned","waypoints","isKiosk","isKioskAmenity","defaultIconId","getIconIdFromSvg","undefined","youAreHereIconId","wp","hasCoordinates","isThisWaypointYouAreHere","waypointId","_","amenityType","keywords","showLabel","isYouAreHere","waypoint","destination","poi","poiType","getYouAreHerePOI","coords","m","exec","toLower","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","featureCount","startRouteAnimation","centerMode","line","dest","flyTo","lngs","c","lats","minLng","maxLng","bounds","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","getVenueAll","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","resolveByMapArg","arg","JacsDataProvider","jacs","destinationsByMapId","amenitiesByMapId","venueLike","init","j","auth","loadVenue","jmap","venueAll","buildings","firstBuilding","waypointsByMapId","list","rawFloors","defaultFloorId","sdkFloors","shortName","sequence","level","preference","mapTemplate3d","_waypoints","floorIdByMapId","venueBounds","viewBoxByMapId","parts","split","n","w","h","width","pixelToLngLat","x","y","vb","topLng","bottomLng","topLat","bottomLat","waypointsById","ll","hydrateWaypoints","refs","ref","d","clear","polygonLayers","getAllFloors","styleSheet","ensureFloorGeojson","normalizeGeojsonPayload","preloadRemainingFloors","pending","EventBus","handlers","on","event","cb","add","off","delete","emit","fn","ensureGeojsonSource","extra","sources","patchVenueStyleForSdk","next","structuredClone","customSprite","defaultSpriteUrl","lineMetrics","floorLayers","MinuteMaps","wayfindingProvider","events","floorsApi","defaultCamera","viewModes","amenityManager","wayfinding","getAllPOIs","collection","container","finalStyle","baseStyle","ensureFloorLayersFromStyle","el","document","getElementById","maplibregl","createScene","msg","sourceId","tile","camera","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","resize","maxZoom","loadAndPatchVenueStyle","styleUrl","fallback","styleMode","existing","derived","floorKey","emptyFc"],"mappings":"0UAIO,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,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,aAAc7Z,KAAKyR,OAAOjR,SAASqZ,cAAgB,KACnDC,oBAEJ,CACF,CAEQ,0BAAAgB,CAA2BjT,GACjC,MAAM2W,EAAWxe,KAAKuO,OAAOiK,YAAYwB,YACzC,GAAIwE,GAAY3jB,OAAOsH,KAAKqc,GAAUxhB,OAAQ,OAE9C,MAAMyhB,EAAiD,CAAA,EAEvD,IAAK,MAAMvW,KAASL,EAAMC,QAAU,GAAI,CACtC,MAAMxQ,EAAK4Q,EAAM5Q,IAAM,GACjB+T,EAAI,UAAUC,KAAKhU,GACzB,IAAK+T,EAAG,SAER,MAAMqT,EAAWrT,EAAE,GACnBoT,EAAQC,KAAc,GACtBD,EAAQC,GAAUvW,KAAK,CAAE7Q,MAC3B,CAEA0I,KAAKuO,QAAU,CAAA,EACfvO,KAAKuO,MAAMiK,aAAe,CAAA,EAC1BxY,KAAKuO,MAAMiK,WAAWwB,YAAcyE,CACtC,CAEQ,iBAAAjD,GACN,MAAMnkB,EAAM2I,KAAK3I,IACjB,IAAKA,EAAK,OAEV,MAAMsnB,EAAqC,CAAElnB,KAAM,oBAAqBE,SAAU,IAGlFR,EAAQC,cAAcC,EAAKU,GAC3BZ,EAAQC,cAAcC,EAAKY,GAG3Bd,EAAQC,cAAcC,EAAKW,GAGtBX,EAAIE,UAAUW,IACjBb,EAAIG,UAAUU,EAAiB,CAC7BT,KAAM,UACNC,KAAMinB,EACN5E,aAAa,IAIZ1iB,EAAIE,UAAU,oBACjBF,EAAIG,UAAU,kBAAmB,CAC/BC,KAAM,UACNC,KAAMinB,GAGZ,mDAGI,SAA8BlN,GAClC,OAAO,IAAIwI,EAAWxI,EACxB"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/map/scene.ts","../src/map/sources.ts","../src/constants.ts","../src/logger.ts","../src/map/floors.ts","../src/map/sprites.ts","../src/map/amenityIcons.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/destinations.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["pmtilesRegistered","createScene","container","style","el","document","getElementById","Error","protocol","Protocol","maplibregl","addProtocol","tile","ensurePmtilesProtocol","Map","center","zoom","pitch","bearing","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","adjusted","Number","isFinite","f","t","properties","featureType","EXTRUDED_INTERIOR_FEATURE_TYPES","has","geom","geometry","inset","turf","buffer","units","insetExtrudedInteriors","geojson","counts","key","Object","entries","sort","a","b","slice","walls","filter","unit","inner","props","custom_height","rawHeight","customProperties","height","wall_height","numericHeight","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","updatePOIs","getZoom","minIndoorZoom","setZoom","newBounds","isFirstActivation","didFit","shouldFit","newWest","newSouth","newEast","newNorth","view","getBounds","getWest","getEast","getSouth","getNorth","fitBounds","padding","boundsPadding","animate","duration","getBearing","getPitch","once","setDidFit","floorId","animated","Set","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","Sprites","getSpriteKeys","spriteUrl","sprite","first","url","resolveSpriteUrl","getStyle","fetch","jsonUrl","endsWith","get","res","ok","status","json","keys","set","empty","AmenityIcons","register","amenities","size","Promise","all","async","amenity","preferredLocale","uris","isSvg","u","mimeType","resourceType","pickLocale","locales","l","locale","uriPath","uri","pickIconUrl","iconId","hasImage","img","mode","text","serialized","doc","DOMParser","parseFromString","svg","documentElement","getElementsByTagName","nodeName","toLowerCase","hasAttribute","setAttribute","XMLSerializer","serializeToString","blob","Blob","blobUrl","URL","createObjectURL","resolve","reject","Image","onload","revokeObjectURL","onerror","err","loadSvgAsImage","addImage","e","amenityId","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","layers","byType","expected","presentExpected","layer","push","layerIds","visibility","captureCameraState","getCenter","round","value","precision","rounded","toFixed","is","formatNumber","lng","lat","PoiManager","ctx","destinations","getAmenities","getDestinations","pois","buildPOIs","spriteKeys","toFeatureCollection","wpMapId","mapId","youAreHereAssigned","waypoints","isKiosk","isKioskAmenity","defaultIconId","getIconIdFromSvg","undefined","youAreHereIconId","wp","hasCoordinates","isThisWaypointYouAreHere","waypointId","_","amenityType","keywords","showLabel","isYouAreHere","waypoint","destination","poi","poiType","getYouAreHerePOI","coords","m","exec","toLower","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","featureCount","startRouteAnimation","centerMode","line","dest","flyTo","lngs","c","lats","minLng","maxLng","bounds","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","getVenueAll","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","resolveByMapArg","arg","JacsDataProvider","jacs","destinationsByMapId","amenitiesByMapId","venueLike","init","j","auth","loadVenue","jmap","venueAll","buildings","firstBuilding","waypointsByMapId","list","rawFloors","defaultFloorId","sdkFloors","shortName","sequence","level","preference","mapTemplate3d","_waypoints","floorIdByMapId","venueBounds","viewBoxByMapId","parts","split","n","w","h","width","pixelToLngLat","x","y","vb","topLng","bottomLng","topLat","bottomLat","waypointsById","ll","hydrateWaypoints","refs","ref","d","clear","polygonLayers","getAllFloors","styleSheet","ensureFloorGeojson","normalizeGeojsonPayload","preloadRemainingFloors","pending","EventBus","handlers","on","event","cb","add","off","delete","emit","fn","ensureGeojsonSource","extra","sources","patchVenueStyleForSdk","next","structuredClone","customSprite","defaultSpriteUrl","lineMetrics","floorLayers","MinuteMaps","wayfindingProvider","events","floorsApi","defaultCamera","viewModes","amenityManager","wayfinding","getAllPOIs","collection","finalStyle","baseStyle","ensureFloorLayersFromStyle","msg","sourceId","camera","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","resize","maxZoom","loadAndPatchVenueStyle","styleUrl","fallback","styleMode","existing","derived","floorKey","emptyFc"],"mappings":"+VAKA,IAAIA,GAAoB,EASlB,SAAUC,EACdC,EACAC,GAEA,MAAMC,EAA0B,iBAAdF,EAAyBG,SAASC,eAAeJ,GAAaA,EAChF,IAAKE,EAAI,MAAM,IAAIG,MAAM,2BAIzB,OAhBF,WACE,GAAIP,EAAmB,OACvB,MAAMQ,EAAW,IAAIC,WACrBC,EAAWC,YAAY,UAAWH,EAASI,MAC3CZ,GAAoB,CACtB,CASEa,GAEO,IAAIH,EAAWI,IAAI,CACxBZ,UAAWE,EACXD,QACAY,OAAQ,CAAC,EAAG,GACZC,KAAM,GACNC,MAAO,GACPC,QAAS,GAEb,CC3BO,MAAMC,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,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iK,YAAYwB,YACzC,GAAIiE,GAAY7iB,OAAOkH,KAAK2b,GAAU1gB,OAAQ,OAE9C,MAAM2gB,EAAiD,CAAA,EAEvD,IAAK,MAAM9V,KAAS1R,EAAMsR,QAAU,GAAI,CACtC,MAAMnQ,EAAKuQ,EAAMvQ,IAAM,GACjBwT,EAAI,UAAUC,KAAKzT,GACzB,IAAKwT,EAAG,SAER,MAAM8S,EAAW9S,EAAE,GACnB6S,EAAQC,KAAc,GACtBD,EAAQC,GAAU9V,KAAK,CAAExQ,MAC3B,CAEAuI,KAAKmO,QAAU,CAAA,EACfnO,KAAKmO,MAAMiK,aAAe,CAAA,EAC1BpY,KAAKmO,MAAMiK,WAAWwB,YAAckE,CACtC,CAEQ,iBAAAjD,GACN,MAAMrjB,EAAMwI,KAAKxI,IACjB,IAAKA,EAAK,OAEV,MAAMwmB,EAAqC,CAAEpmB,KAAM,oBAAqBE,SAAU,IAGlFR,EAAQC,cAAcC,EAAKU,GAC3BZ,EAAQC,cAAcC,EAAKY,GAG3Bd,EAAQC,cAAcC,EAAKW,GAGtBX,EAAIE,UAAUW,IACjBb,EAAIG,UAAUU,EAAiB,CAC7BT,KAAM,UACNC,KAAMmmB,EACNrE,aAAa,IAIZniB,EAAIE,UAAU,oBACjBF,EAAIG,UAAU,kBAAmB,CAC/BC,KAAM,UACNC,KAAMmmB,GAGZ,mDAGI,SAA8B3M,GAClC,OAAO,IAAIwI,EAAWxI,EACxB"}
package/dist/index.js CHANGED
@@ -1,2 +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 c={applyFloor(t,e,o=1){c.updateWalls(t,e,o),c.updateIndoor(t,e,o)},updateIndoor(t,n,r=1){const s=function(t,o){if(!t)return{type:"FeatureCollection",features:[]};if(!Number.isFinite(o)||o<=0)return t;const i=(t.features||[]).map(t=>{const i=t?.properties?.featureType;if(!i||!d.has(i))return t;const n=t?.geometry?.type;if("Polygon"!==n&&"MultiPolygon"!==n)return t;try{const i=e.buffer(t,-o,{units:"feet"});return i?.geometry?{...t,geometry:i.geometry}:t}catch{return t}});return{...t,features:i}}(n.geojson,r);o.setData(t,i,s);try{const t=n?.geojson?.features||[],e={};for(const o of t){const t=o?.properties?.featureType,i=null==t?"(missing)":String(t);e[i]=(e[i]||0)+1}Object.entries(e).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 c.selectDefaultFloor(t)},async activateFloor(t,e,o){if(!t)throw new Error("activateFloor requires an initialized map");if(e?.geojson&&c.applyFloor(t,e,o.wallFeet),await o.updatePOIs(e),!e?.geojson)return void(t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom));const i=c.boundsFromGeoJson(e.geojson);if(!i)return;const n=!o.didFit;let r=n;if(!r){const[[e,o],[n,s]]=i,a=t.getBounds();r=a.getWest()>n||a.getEast()<e||a.getSouth()>s||a.getNorth()<o}r?(t.fitBounds(i,{padding:o.boundsPadding,animate:!n,duration:700,bearing:t.getBearing(),pitch:t.getPitch()}),t.once("moveend",()=>{t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom)}),o.setDidFit(!0),o.log?.("camera :: fitToFloor",{floorId:e.id,animated:!n})):(t.getZoom()<o.minIndoorZoom&&t.setZoom(o.minIndoorZoom),o.log?.("camera :: fit skipped (floor overlaps viewport)",{floorId:e.id}))}},d=new Set(["Restrooms","Back-of-house","Obstacles","Escalators","Stairs","Elevators"]);class p{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 c.selectDefaultFloor(this.floors)}getInitialFloor(){const t=this.getConfig();return c.selectInitialFloor(this.floors,t.options?.initialFloor)}async setCurrentFloor(t){const e=this.getMap();if(!e)throw new Error("Map is not initialized");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 c.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 f=u({enabled:!0,prefix:"MinuteMapsSDK"}),g=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(g.has(o))return g.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 g.set(o,i),i}catch(t){f.warn("sprite fetch failed",o,t);const e=new Set;return g.set(o,e),e}}};const y=u({enabled:!0,prefix:"MinuteMapsSDK amenityIcons"});const m={async register(t,e,o={}){if(!Array.isArray(e)||0===e.length)return;const i=o.size??64;await Promise.all(e.map(async e=>{const n=function(t,e){const o=t?.uris;if(!Array.isArray(o)||0===o.length)return null;const i=t=>"image/svg+xml"===t?.mimeType||"svg-icon"===t?.resourceType,n=t=>{if(!Array.isArray(t)||0===t.length)return null;if(e){const o=t.find(t=>t?.locale===e);if(o?.uriPath)return o.uriPath}return t.find(t=>t?.uriPath)?.uriPath??null};for(const t of o){if(!i(t))continue;const e=n(t.locales);if(e)return e}for(const t of o){const e=n(t?.locales);if(e)return e}return null}(e,o.preferredLocale);if(!n)return;const r=`amenity-${e.id}`;if(t.hasImage(r))e.iconId=r;else try{const o=await async function(t,e){const o=await fetch(t,{mode:"cors"});if(!o.ok)throw new Error(`HTTP ${o.status}`);const i=await o.text();let n=i;try{const t=(new DOMParser).parseFromString(i,"image/svg+xml"),o=t.documentElement;!(t.getElementsByTagName("parsererror").length>0)&&o&&"svg"===o.nodeName.toLowerCase()&&(o.hasAttribute("width")||o.setAttribute("width",String(e)),o.hasAttribute("height")||o.setAttribute("height",String(e)),n=(new XMLSerializer).serializeToString(o))}catch{}const r=new Blob([n],{type:"image/svg+xml"}),s=URL.createObjectURL(r);return new Promise((t,e)=>{const o=new Image;o.onload=()=>{URL.revokeObjectURL(s),t(o)},o.onerror=t=>{URL.revokeObjectURL(s),e(t)},o.src=s})}(n,i);t.hasImage(r)||t.addImage(r,o),e.iconId=r}catch(t){y.warn("icon load failed",{amenityId:e.id,url:n,error:t?.message??String(t)})}}))}},w="units-outline-2d",b=["units-wall-extrusion","units-wall-custom-extrusion"];class F{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={};b.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(w,"visibility");this.unitsOutlineOriginalVisibility=t??"none"}catch{this.unitsOutlineOriginalVisibility="none"}if(e.getLayer(w)){const o=t?"visible":this.unitsOutlineOriginalVisibility??"none";try{e.setLayoutProperty(w,"visibility",o)}catch{}}if(t)b.forEach(t=>{if(e.getLayer(t))try{e.setLayoutProperty(t,"visibility","none")}catch{}});else{const t=this.unitsExtrusionOriginalVisibility||{};b.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 x(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 I={async updatePOIs(t,e,i){const[r,s]=await Promise.all([i.getAmenities(e.id),i.getDestinations(e.id)]),a=I.buildPOIs(e,r,s,i.spriteKeys);o.setData(t,n,I.toFeatureCollection(a))},buildPOIs(t,e=[],o=[],i){if(!t?.id)return[];const n=t.mapId??t.id,r=[];let s=!1;for(const o of e||[]){if(!o.waypoints)continue;const e=S(o),a=o.iconId||C(o.svg,i)||void 0,l="you-are-here";for(const i of o.waypoints||[]){if(i.mapId!==n||!A(i.coordinates))continue;const[u,c]=i.coordinates,d=e&&!s,p=d?l:a,f=i.id??i._?.id;r.push({id:o.id,type:"amenity",name:d?"You are here":o.name||"Amenity",coordinates:[u,c],iconId:p,floorId:t.id,amenityType:o.type,keywords:o.keywords||[],showLabel:!0,isYouAreHere:d,waypointId:f,waypoint:i}),d&&(s=!0)}}for(const e of o||[])if(e.waypoints)for(const o of e.waypoints||[]){if(o.mapId!==n||!A(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 v(t){return t.find(t=>t.isYouAreHere)||null}function A(t){return Array.isArray(t)&&t.length>=2}function C(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 S(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 E{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)"],c=["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",c),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 M{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=>S(t))}getKioskForFloor(t){const e=this.getFloorById(t);if(!e)return null;return this.loadForFloor(e).find(t=>S(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 B{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 getVenueAll(t){const e=`/customer/${encodeURIComponent(String(t.customerId))}/venue/${encodeURIComponent(String(t.venueId))}/all`,o=await this.getJson(e),i=o?.data||o?.result||o;if(!i||"object"!=typeof i)throw new Error("JACS venue/all response was not a JSON object");return i}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),c=Number.isFinite(u)&&u>0?u:600;return this.tokenCache={token:a,expiresAtMs:Date.now()+1e3*c},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 k=u({enabled:!0,prefix:"MinuteMapsSDK jacs"});function z(t){return null!=t&&"object"==typeof t?t.id:t}class P{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 B({mode:"direct",host:e.host,clientId:e.auth.clientId,username:e.auth.username,password:e.auth.password})}else this.jacs=new B({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.getVenueAll({customerId:t,venueId:e}),i=Array.isArray(o?.buildings)?o.buildings:[],n=i[0],r=n?.id??n?.buildingId;if(!n||!r)throw new Error("No buildings found for this venue in /all response");this.buildingId=r;const s=Array.isArray(o?.waypoints)?o.waypoints:[],a=Array.isArray(o?.destinations)?o.destinations:[],l=Array.isArray(o?.amenities)?o.amenities:[],u=new Map;for(const t of s){const e=t?.mapId;if(null==e)continue;const o=u.get(e)??[];o.push(t),u.set(e,o)}const c=Array.isArray(n?.floors)?n.floors:[],d=n?.defaultFloorId,p=c.map(t=>{const e=t.map?.id??t.mapId;return{id:t.id,mapId:e,name:t.name??t.shortName??String(t.id),sequence:t.level??t.preference,isDefault:t.id===d,geojson:void 0,mapTemplate3d:[],_waypoints:null!=e?u.get(e)??[]:[]}});this.floors=p;const f=new Map;for(const t of p)null!=t.mapId&&f.set(t.mapId,t.id);const g=o?.venue?.coordinates,h=new Map;for(const t of c){const e=t?.map?.id??t?.mapId,o="string"==typeof t?.map?.svg?t.map.svg:"";if(null==e||!o)continue;const i=/viewBox\s*=\s*["']([^"']+)["']/i.exec(o);if(!i)continue;const n=i[1].trim().split(/\s+/).map(Number);if(4!==n.length||n.some(t=>!Number.isFinite(t)))continue;const[,,r,s]=n;r>0&&s>0&&h.set(e,{width:r,height:s})}const y=(t,e,o)=>{if(!g)return null;const i=h.get(t);if(!i)return null;return[g.topLng+e/i.width*(g.bottomLng-g.topLng),g.topLat+o/i.height*(g.bottomLat-g.topLat)]},m=new Map;for(const t of s){const e=t?.id;if(null!=e){if(!Array.isArray(t.coordinates)&&null!=t.x&&null!=t.y&&null!=t.mapId){const e=y(t.mapId,Number(t.x),Number(t.y));e&&(t.coordinates=e)}m.set(e,t)}}const w=t=>Array.isArray(t)?t.map(t=>t&&"object"==typeof t?t:m.get(t)).filter(Boolean):[];for(const t of l)t.waypoints=w(t?.waypoints);for(const t of a)t.waypoints=w(t?.waypoints);this.amenitiesByMapId.clear();for(const t of l)for(const e of t?.waypoints??[]){const o=e?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.amenitiesByMapId.get(i)??[];n.push(t),this.amenitiesByMapId.set(i,n)}this.destinationsByMapId.clear();for(const t of a)for(const e of t?.waypoints??[]){const o=e?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.destinationsByMapId.get(i)??[];n.push(t),this.destinationsByMapId.set(i,n)}const b=o?.venue??{};return this.venueLike={...b,floors:p,polygonLayers:[],destinations:{items:[...a],getByMap:t=>this.destinationsByMapId.get(z(t))??[]},amenities:{items:[...l],getByMap:t=>this.amenitiesByMapId.get(z(t))??[]},buildings:{items:[...i],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){k.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))),k.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 T{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 j={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":"#162e51","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":"#162e51","line-opacity":.9,"line-width":["interpolate",["linear"],["zoom"],16,.8,18,1.4,20,2.2]}},{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":"#face00","line-width":["interpolate",["linear"],["zoom"],15,1.6,18,2.4,20,3.2],"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":"#162e51","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 L(t,e,o={}){t.sources||={},t.sources[e]||(t.sources[e]={type:"geojson",data:{type:"FeatureCollection",features:[]},...o})}function U(t){let e=structuredClone(t.style);if(e.sprite=t.customSprite||e.sprite||t.defaultSpriteUrl,L(e,i),L(e,r),L(e,n),L(e,s,{lineMetrics:!0}),L(e,"route-endpoints"),t.floorLayers)for(const o of Object.keys(t.floorLayers))L(e,`amenity_${o}`),L(e,`destination_${o}`),L(e,`pathTypes_${o}`);return e}const D="https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite";class R{config;map=null;data=new P;wayfindingProvider={wayfindBetweenWaypoints:async()=>{throw new Error("Wayfinding is not yet implemented in the SDK")}};events=new T;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 F(()=>this.map),this.floorsApi=new p({getMap:()=>this.map,getConfig:()=>this.config,updatePoiSource:async t=>{const e=this.map;if(!e)return;const i=this.getAllPOIs(t),r=I.toFeatureCollection(i);o.setData(e,n,r)},log:(...t)=>this.logger.debug(...t)}),this.amenityManager=new M({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 E({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=U({style:j,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:D});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.map.on("move",()=>{if(!this.map)return;const t=x(this.map);t&&this.events.emit("cameraChange",{camera:t})}),this.ensureCoreSources(),this.spriteKeys=await h.getSpriteKeys(this.map);try{await m.register(this.map,this.venue?.amenities?.items)}catch(t){this.logger.warn("amenity icon registration failed",t)}const o=this.floorsApi.getInitialFloor();Boolean(o?.geojson?.features?.length)||this.applyInitialViewFromVenue(),o&&await this.setCurrentFloor(o),this.defaultCamera=x(this.map),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(),c=r??t.getBearing(),d="number"==typeof a?a:900;return void t.flyTo({center:s,zoom:l,pitch:u,bearing:c,duration:d,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 I.buildPOIs(t,e,o,i)}(e,this.amenityManager.getByFloorId(e.id),this.getDestinations(e),this.spriteKeys)}getYouAreHerePOI(t){return v(this.getAllPOIs(t))}getYouAreHereCoordinates(t){return function(t){const e=v(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 x(this.map)}getMap(){return this.map}destroy(){this.map?.remove(),this.map=null,this.floorsApi.setFloors([]),this.defaultCamera=null,this.viewModes=new F(()=>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=j;if("sdkTemplate"===this.config.options?.styleMode)return this.logger.debug("style :: styleMode=sdkTemplate, ignoring venue styleUrl"),U({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:D});if(!t)return this.logger.warn("style :: venue.styleSheet.styleUrl missing, using baseStyle"),U({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:D});try{const o=await fetch(t);if(!o.ok)throw new Error(`HTTP ${o.status} ${o.statusText}`);return U({style:await o.json(),floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:D})}catch(t){return this.logger.warn("style :: failed to fetch venue styleUrl, using baseStyle",t),U({style:o,floorLayers:e,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:D})}}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 $(t){return new R(t)}export{R as MinuteMaps,$ as createMinuteMapsSDK};
1
+ import e from"maplibre-gl";import{Protocol as t}from"pmtiles";import*as o from"@turf/turf";let i=!1;function n(o,n){const r="string"==typeof o?document.getElementById(o):o;if(!r)throw new Error("Map container not found");return function(){if(i)return;const o=new t;e.addProtocol("pmtiles",o.tile),i=!0}(),new e.Map({container:r,style:n,center:[0,0],zoom:16,pitch:45,bearing:0})}const r={ensureGeoJson(e,t){e.getSource(t)||e.addSource(t,{type:"geojson",data:{type:"FeatureCollection",features:[]}})},setData(e,t,o){const i=e.getSource(t);i?.setData?.(o)}},s="indoor-data",a="poi-data",l="unit-walls",u="route-data",c=["boundary-fill","boundary-outline","units-fill","units-wall-extrusion","units-wall-custom-extrusion","corridors-fill","corridors-outline","building-extrusion"],d=()=>{};function p(e){const t=Boolean(e?.enabled),o=function(e){const t=String(e||"").trim();return t?`[${t}]`:""}(e?.prefix||"MinuteMapsSDK");return t?{debug:(...e)=>console.debug(o,...e),log:(...e)=>console.log(o,...e),warn:(...e)=>console.warn(o,...e),error:(...e)=>console.error(o,...e)}:{debug:d,log:d,warn:d,error:d}}p({enabled:!0,prefix:"MinuteMapsSDK"});const f={applyFloor(e,t,o=1){f.updateWalls(e,t,o),f.updateIndoor(e,t,o)},updateIndoor(e,t,i=1){const n=function(e,t){if(!e)return{type:"FeatureCollection",features:[]};if(!Number.isFinite(t)||t<=0)return e;const i=(e.features||[]).map(e=>{const i=e?.properties?.featureType;if(!i||!g.has(i))return e;const n=e?.geometry?.type;if("Polygon"!==n&&"MultiPolygon"!==n)return e;try{const i=o.buffer(e,-t,{units:"feet"});return i?.geometry?{...e,geometry:i.geometry}:e}catch{return e}});return{...e,features:i}}(t.geojson,i);r.setData(e,s,n);try{const e=t?.geojson?.features||[],o={};for(const t of e){const e=t?.properties?.featureType,i=null==e?"(missing)":String(e);o[i]=(o[i]||0)+1}Object.entries(o).sort((e,t)=>t[1]-e[1]).slice(0,15)}catch{}},updateWalls(e,t,i=1){const n=function(e,t=1){const i=(e.features||[]).filter(e=>"Units"===e.properties?.featureType).map(e=>{try{const i=o.buffer(e,-t,{units:"feet"});if(!i)return null;const n={...e.properties,featureType:"UnitWalls"};if(null==n.custom_height){const e=n.customProperties?.custom_height??n.custom_height??n.height??n.wall_height,t="number"==typeof e?e:Number(e);Number.isFinite(t)&&(n.custom_height=t)}return{type:"Feature",geometry:{type:"Polygon",coordinates:[e.geometry.coordinates[0],i.geometry.coordinates[0]]},properties:n}}catch{return null}}).filter(Boolean);return{type:"FeatureCollection",features:i}}(t.geojson,i);r.setData(e,l,n)},boundsFromGeoJson(e){try{const[t,i,n,r]=o.bbox(e),s=Math.min(t,n),a=Math.max(t,n),l=Math.min(i,r);return[[s,l],[a,Math.max(i,r)]]}catch{return null}},selectDefaultFloor:e=>Array.isArray(e)&&0!==e.length&&(e.find(e=>e.isDefault)||e[0])||null,selectInitialFloor(e,t){if(!Array.isArray(e)||0===e.length)return null;if(null!=t){const o=e.find(e=>e.id===t);if(o)return o}return f.selectDefaultFloor(e)},async activateFloor(e,t,o){if(!e)throw new Error("activateFloor requires an initialized map");if(t?.geojson&&f.applyFloor(e,t,o.wallFeet),await o.updatePOIs(t),!t?.geojson)return void(e.getZoom()<o.minIndoorZoom&&e.setZoom(o.minIndoorZoom));const i=f.boundsFromGeoJson(t.geojson);if(!i)return;const n=!o.didFit;let r=n;if(!r){const[[t,o],[n,s]]=i,a=e.getBounds();r=a.getWest()>n||a.getEast()<t||a.getSouth()>s||a.getNorth()<o}r?(e.fitBounds(i,{padding:o.boundsPadding,animate:!n,duration:700,bearing:e.getBearing(),pitch:e.getPitch()}),e.once("moveend",()=>{e.getZoom()<o.minIndoorZoom&&e.setZoom(o.minIndoorZoom)}),o.setDidFit(!0),o.log?.("camera :: fitToFloor",{floorId:t.id,animated:!n})):(e.getZoom()<o.minIndoorZoom&&e.setZoom(o.minIndoorZoom),o.log?.("camera :: fit skipped (floor overlaps viewport)",{floorId:t.id}))}},g=new Set(["Restrooms","Back-of-house","Obstacles","Escalators","Stairs","Elevators"]);class h{floors=[];currentFloor=null;didFit=!1;getMap;getConfig;updatePoiSource;logFn;constructor(e){this.getMap=e.getMap,this.getConfig=e.getConfig,this.updatePoiSource=e.updatePoiSource,this.logFn=e.log}log(...e){this.logFn&&this.logFn(...e)}setFloors(e){this.floors=e}getFloors(){return[...this.floors]}getCurrentFloor(){return this.currentFloor}setDidFit(e){this.didFit=e}getDefaultFloor(){return f.selectDefaultFloor(this.floors)}getInitialFloor(){const e=this.getConfig();return f.selectInitialFloor(this.floors,e.options?.initialFloor)}async setCurrentFloor(e){const t=this.getMap();if(!t)throw new Error("Map is not initialized");this.currentFloor=e,this.log("floor :: setCurrentFloor",{id:e.id,name:e.name,geojsonFeatures:e.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 f.activateFloor(t,e,{wallFeet:i,updatePOIs:e=>this.updatePoiSource(e),didFit:this.didFit,setDidFit:e=>{this.didFit=e},boundsPadding:n,minIndoorZoom:r,log:(e,t)=>this.log(e,t)})}}const y=p({enabled:!0,prefix:"MinuteMapsSDK"}),m=new Map,w={async getSpriteKeys(e){const t=function(e){if(!e)return;if("string"==typeof e)return e;if(Array.isArray(e)){const t=e[0];if(t&&"string"==typeof t.url)return t.url}if("object"==typeof e&&null!==e){const t=e?.url;if("string"==typeof t)return t}return}(e?.getStyle?.()?.sprite);if(!t||"function"!=typeof fetch)return new Set;const o=t.endsWith(".json")?t:`${t}.json`;if(m.has(o))return m.get(o);try{const e=await fetch(o);if(!e.ok)throw new Error(`Failed to load sprite JSON (${e.status})`);const t=await e.json(),i=new Set(Object.keys(t||{}));return m.set(o,i),i}catch(e){y.warn("sprite fetch failed",o,e);const t=new Set;return m.set(o,t),t}}};const b=p({enabled:!0,prefix:"MinuteMapsSDK amenityIcons"});const F={async register(e,t,o={}){if(!Array.isArray(t)||0===t.length)return;const i=o.size??64;await Promise.all(t.map(async t=>{const n=function(e,t){const o=e?.uris;if(!Array.isArray(o)||0===o.length)return null;const i=e=>"image/svg+xml"===e?.mimeType||"svg-icon"===e?.resourceType,n=e=>{if(!Array.isArray(e)||0===e.length)return null;if(t){const o=e.find(e=>e?.locale===t);if(o?.uriPath)return o.uriPath}return e.find(e=>e?.uriPath)?.uriPath??null};for(const e of o){if(!i(e))continue;const t=n(e.locales);if(t)return t}for(const e of o){const t=n(e?.locales);if(t)return t}return null}(t,o.preferredLocale);if(!n)return;const r=`amenity-${t.id}`;if(e.hasImage(r))t.iconId=r;else try{const o=await async function(e,t){const o=await fetch(e,{mode:"cors"});if(!o.ok)throw new Error(`HTTP ${o.status}`);const i=await o.text();let n=i;try{const e=(new DOMParser).parseFromString(i,"image/svg+xml"),o=e.documentElement;!(e.getElementsByTagName("parsererror").length>0)&&o&&"svg"===o.nodeName.toLowerCase()&&(o.hasAttribute("width")||o.setAttribute("width",String(t)),o.hasAttribute("height")||o.setAttribute("height",String(t)),n=(new XMLSerializer).serializeToString(o))}catch{}const r=new Blob([n],{type:"image/svg+xml"}),s=URL.createObjectURL(r);return new Promise((e,t)=>{const o=new Image;o.onload=()=>{URL.revokeObjectURL(s),e(o)},o.onerror=e=>{URL.revokeObjectURL(s),t(e)},o.src=s})}(n,i);e.hasImage(r)||e.addImage(r,o),t.iconId=r}catch(e){b.warn("icon load failed",{amenityId:t.id,url:n,error:e?.message??String(e)})}}))}},x="units-outline-2d",I=["units-wall-extrusion","units-wall-custom-extrusion"];class v{getMap;is3dEnabled=!0;isUnits2dEnabled=!1;isFlatMode=!1;cachedExtrusionIds=null;extrusionOriginalVisibility=null;unitsExtrusionOriginalVisibility=null;unitsOutlineOriginalVisibility=null;constructor(e){this.getMap=e}onStyleData(){if(this.map){if(this.cachedExtrusionIds=null,!this.is3dEnabled){const e=this.listExtrusionLayerIds();this.setLayersVisibility(e,"none")}this.isUnits2dEnabled&&this.applyUnits2dVisibility(!0)}}set3dEnabled(e){const t=this.map;if(!t)return;const o=this.listExtrusionLayerIds();if(this.cachedExtrusionIds=o,!this.extrusionOriginalVisibility){const e={};o.forEach(o=>{try{const i=t.getLayoutProperty(o,"visibility")||"visible";e[o]=i}catch{e[o]="visible"}}),this.extrusionOriginalVisibility=e}if(e){const e=this.extrusionOriginalVisibility||{};o.forEach(o=>{const i=e[o]??"visible";try{t.getLayer(o)&&t.setLayoutProperty(o,"visibility",i)}catch{}})}else this.setLayersVisibility(o,"none");this.is3dEnabled=e,t.triggerRepaint()}toggle3d(){this.set3dEnabled(!this.is3dEnabled)}getIs3dEnabled(){return this.is3dEnabled}setUnits2dEnabled(e){const t=this.map;t&&(this.applyUnits2dVisibility(e),this.isUnits2dEnabled=e,t.triggerRepaint())}toggleUnits2d(){this.setUnits2dEnabled(!this.isUnits2dEnabled)}getIsUnits2dEnabled(){return this.isUnits2dEnabled}setFlatMode(e){this.map&&(e?(this.set3dEnabled(!1),this.setUnits2dEnabled(!0)):(this.setUnits2dEnabled(!1),this.set3dEnabled(!0)),this.isFlatMode=e)}toggleFlatMode(){this.setFlatMode(!this.isFlatMode)}getIsFlatMode(){return this.isFlatMode}applyUnits2dVisibility(e){const t=this.map;if(t){if(!this.unitsExtrusionOriginalVisibility){const e={};I.forEach(o=>{try{const i=t.getLayoutProperty(o,"visibility")||"visible";e[o]=i}catch{e[o]="visible"}}),this.unitsExtrusionOriginalVisibility=e}if(null==this.unitsOutlineOriginalVisibility)try{const e=t.getLayoutProperty(x,"visibility");this.unitsOutlineOriginalVisibility=e??"none"}catch{this.unitsOutlineOriginalVisibility="none"}if(t.getLayer(x)){const o=e?"visible":this.unitsOutlineOriginalVisibility??"none";try{t.setLayoutProperty(x,"visibility",o)}catch{}}if(e)I.forEach(e=>{if(t.getLayer(e))try{t.setLayoutProperty(e,"visibility","none")}catch{}});else{const e=this.unitsExtrusionOriginalVisibility||{};I.forEach(o=>{const i=e[o]??"visible";if(t.getLayer(o))try{t.setLayoutProperty(o,"visibility",i)}catch{}})}}}listExtrusionLayerIds(){const e=this.map;if(!e)return[];try{const t=e.getStyle(),o=t?.layers||[],i=o.filter(e=>"fill-extrusion"===e?.type).map(e=>e.id),n=Array.isArray(c)?c:[],r=[];return n.forEach(e=>{const t=o.find(t=>t.id===e);t&&"fill-extrusion"===t.type&&r.push(e)}),[...new Set([...i,...r])]}catch{return this.cachedExtrusionIds||[]}}setLayersVisibility(e,t){const o=this.map;o&&e.forEach(e=>{try{o.getLayer(e)&&o.setLayoutProperty(e,"visibility",t)}catch{}})}get map(){return this.getMap()}}function A(e){if(!e)return null;const t=e.getCenter(),o=(e,t=6)=>function(e,t=6){const o=Number(e.toFixed(t));return Object.is(o,-0)?0:o}(e,t);return{center:[o(t.lng),o(t.lat)],zoom:o(e.getZoom(),4),pitch:o(e.getPitch(),2),bearing:o(e.getBearing(),2)}}const C={async updatePOIs(e,t,o){const[i,n]=await Promise.all([o.getAmenities(t.id),o.getDestinations(t.id)]),s=C.buildPOIs(t,i,n,o.spriteKeys);r.setData(e,a,C.toFeatureCollection(s))},buildPOIs(e,t=[],o=[],i){if(!e?.id)return[];const n=e.mapId??e.id,r=[];let s=!1;for(const o of t||[]){if(!o.waypoints)continue;const t=k(o),a=o.iconId||M(o.svg,i)||void 0,l="you-are-here";for(const i of o.waypoints||[]){if(i.mapId!==n||!E(i.coordinates))continue;const[u,c]=i.coordinates,d=t&&!s,p=d?l:a,f=i.id??i._?.id;r.push({id:o.id,type:"amenity",name:d?"You are here":o.name||"Amenity",coordinates:[u,c],iconId:p,floorId:e.id,amenityType:o.type,keywords:o.keywords||[],showLabel:!0,isYouAreHere:d,waypointId:f,waypoint:i}),d&&(s=!0)}}for(const t of o||[])if(t.waypoints)for(const o of t.waypoints||[]){if(o.mapId!==n||!E(o.coordinates))continue;const[i,s]=o.coordinates,a=o.id??o._?.id;r.push({id:t.id,type:"destination",name:t.name||"Destination",coordinates:[i,s],floorId:e.id,showLabel:!0,waypointId:a,waypoint:o})}return r},toFeatureCollection:e=>({type:"FeatureCollection",features:e.map(e=>({type:"Feature",geometry:{type:"Point",coordinates:e.coordinates},properties:{id:e.id,name:e.name,poiType:e.type,iconId:e.iconId,floorId:e.floorId,keywords:e.keywords,amenityType:e.amenityType,showLabel:!1!==e.showLabel,isYouAreHere:!0===e.isYouAreHere}}))})};function S(e){return e.find(e=>e.isYouAreHere)||null}function E(e){return Array.isArray(e)&&e.length>=2}function M(e,t){if(!e||!t)return null;const o=/<svg[^>]*\bid\s*=\s*["']([^"']+)["']/i.exec(e),i=o?.[1];return i&&t.has(i)?i:null}function k(e){const t=e=>(e??"").toLowerCase(),o=t(e.name),i=(e.keywords||[]).map(e=>t(e)),n=e.extensors||{},r=t(n.type),s="kiosk"===o||o.includes("kiosk"),a=i.some(e=>e.includes("kiosk"));return s||a||"assistance"===r}class z{deps;routeAnimationFrame=null;routeAnimationStart=null;routeAnimationDurationMs=1200;routeActive=!1;constructor(e){this.deps=e}buildWayfindFeatureCollection(e){if(!e)return this.deps.warn?.("wayfind :: no result"),null;const t=[],o=e=>{if(!e)return;const o=e.coordinates||e.xyz||e._?.coordinates;if(Array.isArray(o)&&o.length>=2){const e=Number(o[0]),i=Number(o[1]);Number.isFinite(e)&&Number.isFinite(i)&&t.push([e,i])}};return Array.isArray(e)?e.length>0&&Array.isArray(e[0]?.points)?e[0].points.forEach(o):e.forEach(o):Array.isArray(e.points)?e.points.forEach(o):Array.isArray(e.path)?e.path.forEach(o):Array.isArray(e.paths?.[0]?.points)&&e.paths[0].points.forEach(o),t.length<2?(this.deps.warn?.("wayfind :: not enough coordinates to draw a route",{resultShape:{isArray:Array.isArray(e),hasPoints:Array.isArray(e.points),hasPath:Array.isArray(e.path),hasPaths0Points:Array.isArray(e.paths?.[0]?.points)},extractedCount:t.length}),null):(this.deps.log?.("wayfind :: extracted coordinates for route",{count:t.length,first:t[0],last:t[t.length-1]}),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:t},properties:{}}]})}async wayfindBetweenWaypoints(e,t,o){const i=this.deps.getMap();if(!this.deps.getVenue()||!i)return this.deps.warn?.("wayfindBetweenWaypoints :: venue or map not ready"),null;let n=null;try{n=await this.deps.computeRoute(e,t)}catch(e){return this.deps.warn?.("wayfind :: computeRoute failed",e),null}this.deps.log?.("wayfind :: result",n);const s=this.buildWayfindFeatureCollection(n);if(!s)return n;r.setData(i,u,s),this.deps.log?.("wayfind :: route source updated",{featureCount:s.features.length}),this.startRouteAnimation();const a=o?.centerMode??"route",l=o?.zoom??19;if("none"!==a){const e=s.features[0]?.geometry;if(e&&"LineString"===e.type&&Array.isArray(e.coordinates)){const t=e.coordinates;if("destination"===a){const e=t[t.length-1];i.flyTo({center:e,zoom:l,pitch:45,bearing:0,animate:!0,duration:900})}else if("route"===a){const e=t.map(e=>e[0]),o=t.map(e=>e[1]),n=Math.min(...e),r=Math.max(...e),s=[[n,Math.min(...o)],[r,Math.max(...o)]];i.fitBounds(s,{padding:this.deps.getBoundsPadding(),animate:!0})}}}return n}async navigateFromKioskToDestination(e){const t=this.deps.getMap(),o=this.deps.getVenue();if(!t||!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=e.waypoint||e.waypoints?.[0];if(!n)return this.deps.warn?.("navigateFromKioskToDestination :: destination has no waypoint",e),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 e=this.deps.getMap();if(!e)return;this.stopRouteAnimation();r.setData(e,u,{type:"FeatureCollection",features:[]}),this.deps.log?.("wayfind :: route cleared")}setPoiLayersVisible(e){const t=this.deps.getMap();if(!t)return;const o=e?"visible":"none";["poi-accessibility-icons","poi-destination-circles","poi-destination-labels","poi-entrance-exit-icons","poi-parking-icons","poi-other-amenity-icons"].forEach(e=>{t.getLayer(e)&&t.setLayoutProperty(e,"visibility",o)})}updateRouteEndpoints(e,t){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:e},properties:{role:"source"}},{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{role:"destination"}}]};i.setData(n)}clearRouteEndpoints(){const e=this.deps.getMap();if(!e)return;const t=e.getSource("route-endpoints");if(!t)return;t.setData({type:"FeatureCollection",features:[]})}showRouteContext(e,t){this.updateRouteEndpoints(e,t)}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 e=this.deps.debug,t=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);e&&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)"],c=["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",c),this.routeAnimationFrame=r<1?requestAnimationFrame(t):null};this.routeAnimationFrame=requestAnimationFrame(t)}stopRouteAnimation(){this.routeActive=!1,null!=this.routeAnimationFrame&&"undefined"!=typeof window&&cancelAnimationFrame(this.routeAnimationFrame),this.routeAnimationFrame=null,this.routeAnimationStart=null;const e=this.deps.getMap();e&&(e.getLayer("route-line")&&(e.setPaintProperty("route-line","line-gradient",void 0),e.setPaintProperty("route-line","line-color","#007aff")),e.getLayer("route-halo")&&(e.setPaintProperty("route-halo","line-gradient",void 0),e.setPaintProperty("route-halo","line-color","#ffffff")))}}class B{getVenue;getFloors;getFloorById;logFn;constructor(e){this.getVenue=e.getVenue,this.getFloors=e.getFloors,this.getFloorById=e.getFloorById,this.logFn=e.log}get venue(){return this.getVenue()}log(...e){this.logFn&&this.logFn(...e)}loadForFloor(e){if(!e||!this.venue)return[];try{const t=this.venue.amenities?.getByMap(e.id)||[];return Array.isArray(t)?t.map(t=>{const o=t;return o.floorId=e.id,o}):[]}catch{return[]}}getAll(){return this.getFloors().flatMap(e=>this.loadForFloor(e))}getByFloorId(e){const t=this.getFloorById(e);return t?this.loadForFloor(t):[]}getAllKiosks(){return this.getAll().filter(e=>k(e))}getKioskForFloor(e){const t=this.getFloorById(e);if(!t)return null;return this.loadForFloor(t).find(e=>k(e))??null}logKioskForFloor(e){const t=this.getFloorById(e);if(!t)return;const o=this.getKioskForFloor(e);o?this.log("amenity :: kiosk found",{floorId:t.id,id:o.id,name:o.name,keywords:o.keywords,waypoints:o.waypoints,raw:o}):this.log("amenity :: kiosk not found on floor",{floorId:t.id})}}p({enabled:!0,prefix:"MinuteMapsSDK"});class j{mode;proxyBaseUrl;direct;fetchImpl;tokenCache=null;constructor(e){const t="undefined"!=typeof window?window:globalThis,o=e.fetchImpl??t.fetch;if("function"!=typeof o)throw new Error("Fetch API is not available in this environment");this.fetchImpl=o.bind(t),this.mode=e.mode,this.proxyBaseUrl=("proxy"===e.mode?e.proxyBaseUrl:void 0)||"/api/jacs","direct"===e.mode?this.direct={host:this.normalizeHost(e.host),clientId:e.clientId,username:e.username,password:e.password}:this.direct=null}async getPolygonLayers(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/polygon-layer`,o=await this.getJson(t);return this.extractArray(o)}async getFloorMapTemplate3d(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/floor/${encodeURIComponent(String(e.floorId))}/map-template/3d`,o=await this.getJson(t);return this.extractArray(o)}async getFloors(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/floor`,o=await this.getJson(t);return this.extractArray(o)}async getVenueAll(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/all`,o=await this.getJson(t),i=o?.data||o?.result||o;if(!i||"object"!=typeof i)throw new Error("JACS venue/all response was not a JSON object");return i}async getVenue(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}`,o=await this.getJson(t),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(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/floor/${encodeURIComponent(String(e.floorId))}/map/geojson`,o=await this.getJson(t),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(e){const t=new URLSearchParams;t.set("mapProfile",String(e.mapProfile??"public")),t.set("geojson",String(e.geojson??!0));const o=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/full?${t.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(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/destination`,o=await this.getJson(t);return this.extractArray(o)}async getAmenities(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/amenity`,o=await this.getJson(t);return this.extractArray(o)}async getBuildings(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building`,o=await this.getJson(t);return this.extractArray(o)}async getStylesheet3d(e){const t=`/customer/${encodeURIComponent(String(e.customerId))}/venue/${encodeURIComponent(String(e.venueId))}/building/${encodeURIComponent(String(e.buildingId))}/stylesheet/3d`,o=await this.getJson(t),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(e){if("proxy"===this.mode){const t=this.proxyBaseUrl.replace(/\/+$/,""),o=e.startsWith("/")?e:`/${e}`,i=await this.fetchImpl(`${t}${o}`,{method:"GET",headers:{Accept:"application/json"}});if(!i.ok){const e=await this.safeReadText(i);throw new Error(`JACS proxy GET failed (${i.status} ${i.statusText}) :: ${e}`)}return await i.json()}const t=this.direct;if(!t)throw new Error("JacsProvider is not configured for direct mode");const o=await this.getJwtToken(),i=this.joinUrl(t.host,e),n=await this.fetchImpl(i,{method:"GET",headers:{Authorization:`Bearer ${o}`,Accept:"application/json"}});if(!n.ok){const e=await this.safeReadText(n);throw new Error(`JACS GET failed (${n.status} ${n.statusText}) :: ${e}`)}return await n.json()}extractArray(e){return(Array.isArray(e)?e:null)||(Array.isArray(e?.data)?e.data:null)||(Array.isArray(e?.items)?e.items:null)||(Array.isArray(e?.results)?e.results:null)||[]}async getJwtToken(){const e=this.direct;if(!e)throw new Error("getJwtToken should not be called in proxy mode");const t=Date.now(),o=this.tokenCache;if(o?.token&&t<o.expiresAtMs-3e4)return o.token;const i=this.joinUrl(e.host,"/auth/token"),n=new URLSearchParams;n.set("grant_type","password"),n.set("client_id",e.clientId),n.set("username",e.username),n.set("password",e.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 e=await this.safeReadText(r);throw new Error(`JACS auth failed (${r.status} ${r.statusText}) :: ${e}`)}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),c=Number.isFinite(u)&&u>0?u:600;return this.tokenCache={token:a,expiresAtMs:Date.now()+1e3*c},a}normalizeHost(e){return String(e||"").replace(/\/+$/,"")}joinUrl(e,t){const o=this.normalizeHost(e),i=String(t||"");return i?`${o}${i.startsWith("/")?"":"/"}${i}`:o}async safeReadText(e){try{return await e.text()}catch{return""}}}const P=p({enabled:!0,prefix:"MinuteMapsSDK jacs"});function T(e){return null!=e&&"object"==typeof e?e.id:e}class L{config;jacs;floors=[];buildingId=null;destinationsByMapId=new Map;amenitiesByMapId=new Map;venueLike=null;async init(e){this.config=e;const t=e.jacs;if(!t?.mode)throw new Error("config.jacs.mode is required");if("proxy"!==t.mode){if(!t.host)throw new Error("config.jacs.host is required (direct mode)");if(!t.auth?.clientId)throw new Error("config.jacs.auth.clientId is required (direct mode)");if(!t.auth?.username)throw new Error("config.jacs.auth.username is required (direct mode)");if(!t.auth?.password)throw new Error("config.jacs.auth.password is required (direct mode)");this.jacs=new j({mode:"direct",host:t.host,clientId:t.auth.clientId,username:t.auth.username,password:t.auth.password})}else this.jacs=new j({mode:"proxy",proxyBaseUrl:t.proxyBaseUrl||"/api/jacs"})}async loadVenue(){const e=this.config.jmap.customerId,t=this.config.jmap.venueId;if(null==e)throw new Error("config.jmap.customerId is required");if(null==t)throw new Error("config.jmap.venueId is required");const o=await this.jacs.getVenueAll({customerId:e,venueId:t}),i=Array.isArray(o?.buildings)?o.buildings:[],n=i[0],r=n?.id??n?.buildingId;if(!n||!r)throw new Error("No buildings found for this venue in /all response");this.buildingId=r;const s=Array.isArray(o?.waypoints)?o.waypoints:[],a=Array.isArray(o?.destinations)?o.destinations:[],l=Array.isArray(o?.amenities)?o.amenities:[],u=new Map;for(const e of s){const t=e?.mapId;if(null==t)continue;const o=u.get(t)??[];o.push(e),u.set(t,o)}const c=Array.isArray(n?.floors)?n.floors:[],d=n?.defaultFloorId,p=c.map(e=>{const t=e.map?.id??e.mapId;return{id:e.id,mapId:t,name:e.name??e.shortName??String(e.id),sequence:e.level??e.preference,isDefault:e.id===d,geojson:void 0,mapTemplate3d:[],_waypoints:null!=t?u.get(t)??[]:[]}});this.floors=p;const f=new Map;for(const e of p)null!=e.mapId&&f.set(e.mapId,e.id);const g=o?.venue?.coordinates,h=new Map;for(const e of c){const t=e?.map?.id??e?.mapId,o="string"==typeof e?.map?.svg?e.map.svg:"";if(null==t||!o)continue;const i=/viewBox\s*=\s*["']([^"']+)["']/i.exec(o);if(!i)continue;const n=i[1].trim().split(/\s+/).map(Number);if(4!==n.length||n.some(e=>!Number.isFinite(e)))continue;const[,,r,s]=n;r>0&&s>0&&h.set(t,{width:r,height:s})}const y=(e,t,o)=>{if(!g)return null;const i=h.get(e);if(!i)return null;return[g.topLng+t/i.width*(g.bottomLng-g.topLng),g.topLat+o/i.height*(g.bottomLat-g.topLat)]},m=new Map;for(const e of s){const t=e?.id;if(null!=t){if(!Array.isArray(e.coordinates)&&null!=e.x&&null!=e.y&&null!=e.mapId){const t=y(e.mapId,Number(e.x),Number(e.y));t&&(e.coordinates=t)}m.set(t,e)}}const w=e=>Array.isArray(e)?e.map(e=>e&&"object"==typeof e?e:m.get(e)).filter(Boolean):[];for(const e of l)e.waypoints=w(e?.waypoints);for(const e of a)e.waypoints=w(e?.waypoints);this.amenitiesByMapId.clear();for(const e of l)for(const t of e?.waypoints??[]){const o=t?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.amenitiesByMapId.get(i)??[];n.push(e),this.amenitiesByMapId.set(i,n)}this.destinationsByMapId.clear();for(const e of a)for(const t of e?.waypoints??[]){const o=t?.mapId;if(null==o)continue;const i=f.get(o)??o,n=this.destinationsByMapId.get(i)??[];n.push(e),this.destinationsByMapId.set(i,n)}const b=o?.venue??{};return this.venueLike={...b,floors:p,polygonLayers:[],destinations:{items:[...a],getByMap:e=>this.destinationsByMapId.get(T(e))??[]},amenities:{items:[...l],getByMap:e=>this.amenitiesByMapId.get(T(e))??[]},buildings:{items:[...i],getAllFloors:()=>this.floors},styleSheet:null},this.venueLike}async ensureFloorGeojson(e){if(e.geojson)return;const t=this.config.jmap.customerId,o=this.config.jmap.venueId;try{const i=await this.jacs.getFloorMapGeojson({customerId:t,venueId:o,buildingId:this.buildingId,floorId:e.id});e.geojson=function(e){return(e?.type?e:e?.data)??null}(i)}catch(t){P.warn("floor geojson fetch failed",{floorId:e.id,e:t})}}async preloadRemainingFloors(){const e=this.floors.filter(e=>!e.geojson);0!==e.length&&(await Promise.all(e.map(e=>this.ensureFloorGeojson(e))),P.debug("preloaded geojson for remaining floors",{count:e.length}))}async getFloors(){return this.floors}async getAmenities(e){return this.amenitiesByMapId.get(e)??[]}async getDestinations(e){return this.destinationsByMapId.get(e)??[]}}class D{handlers=new Map;on(e,t){this.handlers.has(e)||this.handlers.set(e,new Set),this.handlers.get(e).add(t)}off(e,t){t?this.handlers.get(e)?.delete(t):this.handlers.delete(e)}emit(e,t){this.handlers.get(e)?.forEach(e=>{try{e(t)}catch{}})}}var U={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:{protomaps:{type:"vector",url:"pmtiles://https://jacsdevtiles-gjgbejbpdzbgcge8.z01.azurefd.net/pmtiles/base/usa.pmtiles",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:"basemap-earth",type:"fill",source:"protomaps","source-layer":"earth",paint:{"fill-color":"#EFEAE0"}},{id:"basemap-landuse-park",type:"fill",source:"protomaps","source-layer":"landuse",filter:["in",["get","kind"],["literal",["park","forest","wood","nature_reserve","grass","garden","playground","cemetery","golf_course"]]],paint:{"fill-color":"#D1E8C9","fill-opacity":["interpolate",["linear"],["zoom"],14,.9,18,.5]}},{id:"basemap-water",type:"fill",source:"protomaps","source-layer":"water",paint:{"fill-color":"#A8D0E6"}},{id:"basemap-roads-minor",type:"line",source:"protomaps","source-layer":"roads",minzoom:13,filter:["in",["get","kind"],["literal",["minor_road","path","service","other"]]],paint:{"line-color":"#FFFFFF","line-width":["interpolate",["linear"],["zoom"],13,.5,16,1.5,19,4],"line-opacity":["interpolate",["linear"],["zoom"],14,.9,18,.5]}},{id:"basemap-roads-major",type:"line",source:"protomaps","source-layer":"roads",minzoom:10,filter:["in",["get","kind"],["literal",["highway","major_road","medium_road"]]],paint:{"line-color":"#FFD480","line-width":["interpolate",["linear"],["zoom"],10,.5,14,1.5,18,6],"line-opacity":["interpolate",["linear"],["zoom"],14,.9,18,.5]}},{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":"#162e51","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":"#162e51","line-opacity":.9,"line-width":["interpolate",["linear"],["zoom"],16,.8,18,1.4,20,2.2]}},{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":"#face00","line-width":["interpolate",["linear"],["zoom"],15,1.6,18,2.4,20,3.2],"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":"#162e51","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 R(e,t,o={}){e.sources||={},e.sources[t]||(e.sources[t]={type:"geojson",data:{type:"FeatureCollection",features:[]},...o})}function $(e){let t=structuredClone(e.style);if(t.sprite=e.customSprite||t.sprite||e.defaultSpriteUrl,R(t,s),R(t,l),R(t,a),R(t,u,{lineMetrics:!0}),R(t,"route-endpoints"),e.floorLayers)for(const o of Object.keys(e.floorLayers))R(t,`amenity_${o}`),R(t,`destination_${o}`),R(t,`pathTypes_${o}`);return t}const O="https://demotiles.maplibre.org/styles/osm-bright-gl-style/sprite";class V{config;map=null;data=new L;wayfindingProvider={wayfindBetweenWaypoints:async()=>{throw new Error("Wayfinding is not yet implemented in the SDK")}};events=new D;floorsApi;venue=null;spriteKeys=null;debug;logger;defaultCamera=null;viewModes;amenityManager;wayfinding;constructor(e){this.config=e,this.debug=Boolean(e.debug??e.options?.debug),this.logger=p({enabled:this.debug,prefix:"MinuteMapsSDK"}),this.viewModes=new v(()=>this.map),this.floorsApi=new h({getMap:()=>this.map,getConfig:()=>this.config,updatePoiSource:async e=>{const t=this.map;if(!t)return;const o=this.getAllPOIs(e),i=C.toFeatureCollection(o);r.setData(t,a,i)},log:(...e)=>this.logger.debug(...e)}),this.amenityManager=new B({getVenue:()=>this.venue,getFloors:()=>this.floorsApi.getFloors(),getFloorById:e=>this.floorsApi.getFloors().find(t=>t.id===e)??null,log:(...e)=>this.logger.debug(...e)}),this.wayfinding=new z({getMap:()=>this.map,getVenue:()=>this.venue,getYouAreHerePOI:e=>this.getYouAreHerePOI(e),getYouAreHereCoordinates:e=>this.getYouAreHereCoordinates(e),getBoundsPadding:()=>this.getBoundsPadding(),computeRoute:async(e,t)=>{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:e,to:t})},log:(...e)=>this.logger.debug(...e),warn:(...e)=>this.logger.warn(...e),debug:this.debug})}async init(){const{venueId:e,customerId:t}=this.config?.jmap;if(null==e||null==t)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:t});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=$({style:U,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:O});this.ensureFloorLayersFromStyle(e),this.map=n(this.config.container,e),await new Promise(e=>this.map.once("load",()=>e())),this.map.on("error",e=>{const t=e?.error?.message||e?.message||e;this.logger.error("map :: error",{msg:t,sourceId:e?.sourceId,tile:e?.tile})}),this.map.on("styledata",()=>{try{this.viewModes.onStyleData()}catch{}}),this.map.on("move",()=>{if(!this.map)return;const e=A(this.map);e&&this.events.emit("cameraChange",{camera:e})}),this.ensureCoreSources(),this.spriteKeys=await w.getSpriteKeys(this.map);try{await F.register(this.map,this.venue?.amenities?.items)}catch(e){this.logger.warn("amenity icon registration failed",e)}const t=this.floorsApi.getInitialFloor();Boolean(t?.geojson?.features?.length)||this.applyInitialViewFromVenue(),t&&await this.setCurrentFloor(t),this.defaultCamera=A(this.map),this.events.emit("ready",{venue:this.venue}),this.events.emit("floorsLoaded",{})}catch(e){throw this.logger.error("init :: failed (JACS)",e),this.events.emit("error",{error:e}),e}}on(e,t){this.events.on(e,t)}off(e,t){this.events.off(e,t)}addControl(e,t){this.map?.addControl(e,t)}setView(e){!function(e,t){if(!e)return;const{center:o,zoom:i,pitch:n,bearing:r,animate:s,duration:a}=t;if(s){const t=e.getCenter(),s=o||[t.lng,t.lat],l=i??e.getZoom(),u=n??e.getPitch(),c=r??e.getBearing(),d="number"==typeof a?a:900;return void e.flyTo({center:s,zoom:l,pitch:u,bearing:c,duration:d,essential:!0})}o&&e.setCenter(o),void 0!==i&&e.setZoom(i),void 0!==n&&e.setPitch(n),void 0!==r&&e.setBearing(r)}(this.map,e)}get amenities(){return this.amenityManager}resetView(e){!function(e,t,o){if(!e||!t)return;const{center:i,zoom:n,pitch:r,bearing:s}=t,a=Boolean(o?.animate),l="number"==typeof o?.duration?o.duration:800;a?e.easeTo({center:i,zoom:n,pitch:r,bearing:s,duration:l}):e.jumpTo({center:i,zoom:n,pitch:r,bearing:s})}(this.map,this.defaultCamera,e)}set3dEnabled(e){this.viewModes.set3dEnabled(e)}toggle3d(){this.viewModes.toggle3d()}getIs3dEnabled(){return this.viewModes.getIs3dEnabled()}setUnits2dEnabled(e){this.viewModes.setUnits2dEnabled(e)}toggleUnits2d(){this.viewModes.toggleUnits2d()}getIsUnits2dEnabled(){return this.viewModes.getIsUnits2dEnabled()}setFlatMode(e){this.viewModes.setFlatMode(e)}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(e){const t=e||this.getCurrentFloor();return function(e,t){if(!e||!t)return[];try{const o=e.destinations?.getByMap?.({id:t.id})||[];return Array.isArray(o)?o:[]}catch{return[]}}(this.venue,t)}getPolygonLayers(){return this.venue?.polygonLayers??[]}getFloorMapTemplate3d(e){return this.venue?.mapTemplates3d?.[String(e)]??[]}getAllPOIs(e){const t=e||this.getCurrentFloor();if(!t)return[];return function(e,t,o,i){return C.buildPOIs(e,t,o,i)}(t,this.amenityManager.getByFloorId(t.id),this.getDestinations(t),this.spriteKeys)}getYouAreHerePOI(e){return S(this.getAllPOIs(e))}getYouAreHereCoordinates(e){return function(e){const t=S(e);return t?.coordinates??null}(this.getAllPOIs(e))}searchPOIs(e,t){return function(e,t){const o=t.trim().toLowerCase();return o?e.filter(e=>{const t=e.name?.toLowerCase().includes(o),i=(e.keywords||[]).some(e=>e.toLowerCase().includes(o));return t||i}):[]}(this.getAllPOIs(t),e)}async wayfindBetweenWaypoints(e,t,o){return this.wayfinding.wayfindBetweenWaypoints(e,t,o)}async navigateFromKioskToDestination(e){return this.wayfinding.navigateFromKioskToDestination(e)}clearRoute(){this.wayfinding.clearRoute()}getCameraPosition(){return A(this.map)}getMap(){return this.map}destroy(){this.map?.remove(),this.map=null,this.floorsApi.setFloors([]),this.defaultCamera=null,this.viewModes=new v(()=>this.map)}async setCurrentFloor(e){await this.data.ensureFloorGeojson(e),await this.floorsApi.setCurrentFloor(e),this.setFloorLayerVisibility(e.id),this.events.emit("floorChanged",{floor:e})}isReady(){return!!this.map}setFloorLayerVisibility(e){const t=this.map;if(!t)return;const o=this.venue?.styleSheet?.floorLayers;if(o)for(const[i,n]of Object.entries(o)){const o=String(i)===String(e);for(const e of n)t.getLayer(e.id)&&t.setLayoutProperty(e.id,"visibility",o?"visible":"none")}}getBoundsPadding(){return this.config.options?.boundsPadding??50}getVenueBounds(){const e=this.venue?.coordinates;if(!e)return null;const{bottomLng:t,bottomLat:o,topLng:i,topLat:n}=e;if(null==t||null==o||null==i||null==n)return null;const r=Math.min(t,i),s=Math.max(t,i);return[[r,Math.min(o,n)],[s,Math.max(o,n)]]}applyInitialViewFromVenue(){const e=this.map;if(!e)return;const t=this.getVenueBounds();if(t)try{e.resize(),e.fitBounds(t,{padding:this.getBoundsPadding(),animate:!1,duration:0,maxZoom:21})}catch(e){this.logger.warn("applyInitialViewFromVenue :: fitBounds failed",e)}}async loadAndPatchVenueStyle(){const e=this.venue?.styleSheet?.styleUrl,t=this.venue?.styleSheet?.floorLayers,o=U;if("sdkTemplate"===this.config.options?.styleMode)return this.logger.debug("style :: styleMode=sdkTemplate, ignoring venue styleUrl"),$({style:o,floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:O});if(!e)return this.logger.warn("style :: venue.styleSheet.styleUrl missing, using baseStyle"),$({style:o,floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:O});try{const o=await fetch(e);if(!o.ok)throw new Error(`HTTP ${o.status} ${o.statusText}`);return $({style:await o.json(),floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:O})}catch(e){return this.logger.warn("style :: failed to fetch venue styleUrl, using baseStyle",e),$({style:o,floorLayers:t,customSprite:this.config.options?.customSprite||null,defaultSpriteUrl:O})}}ensureFloorLayersFromStyle(e){const t=this.venue?.styleSheet?.floorLayers;if(t&&Object.keys(t).length)return;const o={};for(const t of e.layers||[]){const e=t.id||"",i=/_(\d+)$/.exec(e);if(!i)continue;const n=i[1];o[n]||=[],o[n].push({id:e})}this.venue||={},this.venue.styleSheet||={},this.venue.styleSheet.floorLayers=o}ensureCoreSources(){const e=this.map;if(!e)return;const t={type:"FeatureCollection",features:[]};r.ensureGeoJson(e,s),r.ensureGeoJson(e,l),r.ensureGeoJson(e,a),e.getSource(u)||e.addSource(u,{type:"geojson",data:t,lineMetrics:!0}),e.getSource("route-endpoints")||e.addSource("route-endpoints",{type:"geojson",data:t})}}function J(e){return new V(e)}export{V as MinuteMaps,J as createMinuteMapsSDK};
2
2
  //# sourceMappingURL=index.js.map