atriusmaps-node-sdk
Version:
This project provides an API to Atrius Personal Wayfinder maps within a Node environment. See the README.md for more information
2 lines (1 loc) • 2.9 kB
JavaScript
import{b64DecodeUnicode as e,filterOb as i}from"../../../src/utils/funcs.js";import{setDeepLinksForParms as n}from"../../../src/configs/postproc-mol-url-parms.js";import{setStateFromStateString as o}from"../../../src/configs/postproc-stateTracking.js";const t=(e,i)=>{if(void 0===e)return;const n=e.toString();return n.length>i?n.substring(0,i):n},s=(e,i)=>void 0!==i?{[e]:i}:{},a=e=>{if(!e||"object"!=typeof e)return;const i={};return Object.keys(e).slice(0,10).forEach(n=>{let o=t(n.toString().replaceAll(/[^a-zA-Z0-9_]/g,""),128)??"X";o.match(/^[a-zA-Z]+/)||(o=`X${o}`);let s=e[n];null==s&&(s=""),i[o]=t(String(s),128)??""}),i};function r(e,i,n){Object.keys(e).filter(e=>e.startsWith(`${i}-`)).forEach(i=>{n[i]=e[i]})}function l(l){const{name:c,debug:p,headless:u,theme:d,defaultSearchTerms:g,venueId:h,accountId:m,poiCategories:f,preserveStateInURL:S,supportURLDeepLinks:v,initState:k,deepLinkParms:L,uiHide:P,renderDiv:w,parentConfig:A,desktopViewMinWidth:y,forceDesktop:V,hostAppId:b,hostAppVersion:j,hostAppProperties:D,logFilter:I,searchPlaceholder:Z,dataFetch:F,engineName:C,dynamicPoisUrlBaseV1:O,plugins:R,analytics2ActiveFlag:T,enablePoiSelection:U,showSurround:x,minZoom:M,maxZoom:W,noLangOptions:z,pinnedLocation:B,pinnedLocationZoom:H,pinnedLocationFocusAtStart:E,pinnedLocationBearing:N,pinnedLocationPitch:X}=l,$=A?[A]:u?["sdkHeadless"]:["sdkVisual"],_={name:c,engineName:C,extends:$,debug:p,logFilter:I,theme:d,uiHide:P,renderDiv:w,configPostProc:[],plugins:{venueDataLoader:{dataFetch:F,venueId:h,accountId:m},sdkServer:{headless:u},analytics2:{hostAppId:b?t(b,128):void 0,hostAppVersion:j?t(j,128):void 0,hostAppProperties:a(D)}},uuid:"undefined"!=typeof document&&document.location?document.location.host:"unknown"};if(void 0!==T&&(_.plugins.analytics2={..._.plugins.analytics2,active:T}),u||(_.plugins["online/headerOnline"]={searchPlaceholder:Z},_.plugins.mapRenderer={...s("enablePoiSelection",U),surroundConfig:x?{}:null,viewLimits:{...s("maxZoom",W),...s("minZoom",M)}},_.plugins.userMenu={noLangOptions:z},B&&(_.plugins["online/pinnedLocation"]={location:B,zoom:H,focusAtStart:E,bearing:N,pitch:X})),_.plugins.searchService=g?{defaultSearchTerms:g}:{},r(l,"defaultSearchTerms",_.plugins.searchService),$.includes("sdkVisual")&&(_.plugins["online/homeView"]=f?{poiCategories:f}:{},r(l,"poiCategories",_.plugins["online/homeView"])),R&&"object"==typeof R){const e=R;e.draw&&(_.plugins.draw=e.draw),e.flightStatus&&(_.plugins.flightStatus=e.flightStatus,_.plugins["online/flightDetails"]={},_.plugins["online/flightDetailsSearch"]={})}return S&&((_.configPostProc??[]).push("stateTracking"),_.plugins.deepLinking={trackURL:!0}),v&&(_.configPostProc??[]).push("mol-url-parms"),k&&o(_,e(k),!0),L&&n(_,new URLSearchParams(L),!0),void 0!==y&&(_.desktopViewMinWidth=y),V&&(_.desktopViewMinWidth=0),O&&(_.plugins.dynamicPois={urlBaseV1:O}),i((e,i)=>void 0!==i,_)}export{l as default};