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O,GAEtB,GACHvQ,GAAAwQ,EAAAA,EAAAA,GAAA/Q,EAAAgR,UAAA,QA/gBI7P,EAAAA,QAAO,CAAA8P,cAAA,EAAAC,YAAA,EAAAC,UAAA,EAAAC,YAAA,OAAA5Q,GAAAuQ,EAAAA,EAAAA,GAAA/Q,EAAAgR,UAAA,uBACP7P,EAAAA,QAAO,CAAA8P,cAAA,EAAAC,YAAA,EAAAC,UAAA,EAAAC,YAAA,OAAA3Q,GAAAsQ,EAAAA,EAAAA,GAAA/Q,EAAAgR,UAAA,sBAAAlR,GAAA,CAAAmR,cAAA,EAAAC,YAAA,EAAAC,UAAA,EAAAC,YAAA,QAAAL,EAAAA,EAAAA,GAAA/Q,EAAAgR,UAAA,cA4EPK,EAAAA,QAAMvB,OAAAwB,yBAAAtR,EAAAgR,UAAA,cAAAhR,EAAAgR,YAAAD,EAAAA,EAAAA,GAAA/Q,EAAAgR,UAAA,aAgCNK,EAAAA,QAAMvB,OAAAwB,yBAAAtR,EAAAgR,UAAA,aAAAhR,EAAAgR,YAAAD,EAAAA,EAAAA,GAAA/Q,EAAAgR,UAAA,aAmBNK,EAAAA,QAAMvB,OAAAwB,yBAAAtR,EAAAgR,UAAA,aAAAhR,EAAAgR,YAAAD,EAAAA,EAAAA,GAAA/Q,EAAAgR,UAAA,kBAYNK,EAAAA,QAAMvB,OAAAwB,yBAAAtR,EAAAgR,UAAA,kBAAAhR,EAAAgR,WAAAhR,E","sources":["./components/map/base-map/index.ts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { ENTER_CODE } from '@adc/ember-utils/utils/a11y';\nimport { action } from '@ember/object';\nimport { alias } from '@ember/object/computed';\nimport { later } from '@ember/runloop';\nimport { inject as service } from '@ember/service';\nimport { isPresent } from '@ember/utils';\nimport { task } from 'ember-concurrency';\nimport { escapeHtml } from 'customer-site/utils/strings';\n\nimport './_style.scss';\nimport type ADCIntlService from '@adc/i18n/services/adc-intl';\nimport type NotificationManager from '@adc/ui-components/services/notification-manager';\n\n// #region Constants\n\nconst HEADING_OFFSET = 45; // Degree offset to point the top left corner to 0 degrees.\nconst HEADING_CLASS_NAME = 'base-map-heading';\nconst DEFAULT_PERCENTAGE_MARGIN = 40;\nconst SINGLE_MARKER_ZOOM = 14;\n\n// #endregion\n\n// #region Interfaces\n\n/**\n * Arguments provided to the Base Map Component.\n */\nexport interface BaseMapComponentArgs {\n /**\n * Gets info pertaining to the marker used to represent each item on the map.\n */\n getIconClassAndId: (item: GeographicDatum) => { iconClass: string; id: string; style: string | null };\n\n /**\n * Which property of the geographic item should be used as the label for the marker.\n */\n markerLabelKey?: keyof GeographicDatum;\n\n /**\n * Ember models to be displayed on the map.\n */\n geographicData: GeographicDatum[];\n\n /**\n * Handler for when a marker is clicked.\n */\n onTapEvent?: (e: H.mapevents.Event, geographicDatum: GeographicDatum, ui: H.ui.UI) => void;\n\n /**\n * Handler for whenever an area on the map is clicked\n */\n onBackgroundTapEvent?: (e: H.mapevents.Event, ui: H.ui.UI) => void;\n\n /**\n * Whether the geographic data should be clustered when zooming out.\n */\n shouldCluster?: boolean;\n\n /**\n * Whether the units should be metric or imperial.\n */\n isMetric: boolean;\n\n /**\n * Whether the markers should have bubble labels (defaults to true).\n */\n shouldAttachLabel?: boolean;\n\n /**\n * Whether the current user has permission to view the location of cars on a customer account, which are displayed on the map.\n */\n canViewCarLocation?: boolean;\n}\n\nexport type IconColors = 'blue';\n\n/**\n * Represents an object to be placed on a map.\n */\nexport interface GeographicDatum {\n latitude: number;\n longitude: number;\n id: string;\n details?: GeographicDatumDetails;\n heading?: number;\n}\n\nexport interface GeographicDatumDetails {\n name?: string;\n icon?: string;\n iconColor?: IconColors;\n date?: string;\n isEngineOn?: boolean;\n customType?: string;\n deviceId?: number;\n}\n\n// #endregion\n\nexport interface BaseMapComponentSignature {\n Element: HTMLElement;\n Args: BaseMapComponentArgs;\n}\n\n/**\n * @classdesc\n * Component to house all functionality for initializing and displaying map of geographic data.\n */\nexport default abstract class BaseMapComponent<\n T extends BaseMapComponentSignature = BaseMapComponentSignature\n> extends Component {\n @service declare intl: ADCIntlService;\n @service declare notificationManager: NotificationManager;\n\n /** @override */\n constructor(owner: unknown, args: BaseMapComponentSignature['Args']) {\n super(owner, args);\n\n this.loadHereApiStylesheet();\n\n if (!isPresent(window.H)) {\n const scripts = [\n 'https://js.api.here.com/v3/3.1/mapsjs-core.js',\n 'https://js.api.here.com/v3/3.1/mapsjs-service.js',\n 'https://js.api.here.com/v3/3.1/mapsjs-ui.js',\n 'https://js.api.here.com/v3/3.1/mapsjs-mapevents.js',\n args.shouldCluster ? 'https://js.api.here.com/v3/3.1/mapsjs-clustering.js' : undefined\n ];\n\n this.herePromise = Promise.all(scripts.compact().map(this.loadScriptWithoutAsync));\n }\n }\n\n /**\n * Whether the markers should have name labels (defaults to true).\n */\n get shouldAttachLabel() {\n return this.args.shouldAttachLabel ?? true;\n }\n\n /**\n * Whether the current user has permission to view the location of cars on a customer account, which are displayed on the map.\n */\n @alias('args.canViewCarLocation')\n declare canViewCarLocation: boolean;\n\n herePromise: string[] | Promise = [];\n\n clusteredDataProvider: H.clustering.Provider | null = null;\n\n markerList: H.map.DomMarker[] = [];\n\n headingList: H.map.DomMarker[] = [];\n\n routeLine?: H.map.Polyline;\n\n // #region Map Elements\n\n hPlatform?: H.service.Platform;\n\n hMap?: H.Map;\n\n hMapEvents?: H.mapevents.MapEvents;\n\n hMapBehavior?: H.mapevents.Behavior;\n\n hUi?: H.ui.UI;\n\n // #endregion\n\n /**\n * Initializes the map on the page.\n */\n initMapTask = task(async (el) => {\n await this.herePromise;\n try {\n this.hPlatform = new H.service.Platform({\n apikey: 'O68SRN2kbvWqzFZSt5ANAlgWxHMRZYWSWZdd_WlzpqM'\n });\n this.addMap(el, this.hPlatform);\n } catch (ex) {\n this.notificationManager.addError(ex);\n }\n });\n\n /**\n * Disposes map components during cleanup.\n */\n @action\n destroyMap(): void {\n (async () => {\n await this.herePromise;\n if (!this.hMap) {\n return;\n }\n\n // Calls built in dispose functions to destroy map and it's elements\n this.clusteredDataProvider?.dispose();\n this.markerList.forEach((marker) => {\n marker.dispose();\n });\n this.headingList.forEach((heading) => heading.dispose());\n const bubbles = this.hUi?.getBubbles();\n if (bubbles && bubbles.length > 0) {\n bubbles?.forEach((b) => b.dispose());\n }\n this.routeLine?.dispose();\n this.hMapBehavior?.dispose();\n this.hMapEvents?.dispose();\n this.hUi?.dispose();\n\n // Do not copy this deprecated usage. If you see this, please fix\n // eslint-disable-next-line ember/no-runloop\n later(() => this.hMap?.dispose(), 1000);\n })();\n }\n\n /**\n * Handles resizing the map.\n */\n @action\n resizeMap(): void {\n (async () => {\n await this.herePromise;\n try {\n if (!this.hMap) {\n return;\n }\n\n this.hMap?.getViewPort().resize();\n } catch (ex) {\n this.notificationManager.addError(ex);\n }\n })();\n }\n\n /**\n * Creates new markers on the map when the geographic data is updated.\n */\n @action\n updateMap(_: Element, updatedGeographicData: GeographicDatum[][]): void {\n if (!this.hMap || !this.hPlatform) {\n return;\n }\n\n // Only add markers for car locations if the user is permitted to see them\n if (this.canViewCarLocation) {\n this.clearAndUpdateMarkers(updatedGeographicData[0]);\n }\n }\n\n @action\n setDefaultZoom(geographicData: GeographicDatum[], includeTransition: boolean = false): void {\n if (!this.hMap) {\n return;\n }\n if (geographicData.length == 1) {\n this.hMap.getViewModel().setLookAtData(\n {\n position: { lat: geographicData[0].latitude, lng: geographicData[0].longitude },\n zoom: SINGLE_MARKER_ZOOM\n },\n includeTransition\n );\n } else if (geographicData.length > 1) {\n this.setViewPortPlusMargin(geographicData, this.hMap, includeTransition);\n }\n }\n\n /**\n * Creates the map, disables the option for selecting different map layers,\n * sets the map zoom using the geographic data, and adds the data to the map.\n */\n addMap(element: Element, hPlatform: H.service.Platform): void {\n // Get an object containing the default map layers:\n const defaultLayers = hPlatform.createDefaultLayers();\n\n // Instantiate the map using the vecor map with the default style as the base layer\n this.hMap = new H.Map(element, defaultLayers.vector.normal.map, {\n center: { lat: 0.0, lng: 0.0 },\n zoom: 1.5,\n pixelRatio: window.devicePixelRatio || 1\n });\n\n this.hMap.getBaseLayer().setMin(3).setMax(18);\n\n // Initialize map controls and set terrain/route settings to off\n const hUi = (this.hUi = H.ui.UI.createDefault(this.hMap, defaultLayers));\n this.hUi.setUnitSystem(this.args.isMetric ? H.ui.UnitSystem.METRIC : H.ui.UnitSystem.IMPERIAL);\n this.hMapEvents = new H.mapevents.MapEvents(this.hMap);\n this.hMapBehavior = new H.mapevents.Behavior(this.hMapEvents);\n\n const mapSettings = hUi.getControl('mapsettings');\n // Hide Settings/Choose View button\n mapSettings.setVisibility(false);\n const menuEntries = (mapSettings.getChildren()[1] as H.ui.base.Container).getChildren();\n menuEntries[0].getElement().style.borderBottom = 'none';\n menuEntries.slice(1).invoke('setVisibility', false);\n\n this.setZoomControlsAccessibility(hUi, this.hMap);\n\n // Only add markers for car locations if the user is permitted to see them\n if (this.canViewCarLocation) {\n this.clearAndUpdateMarkers(this.args.geographicData);\n }\n\n // Clear any popups if no marker was selected (i.e. the background was clicked)\n const { onBackgroundTapEvent } = this.args;\n if (onBackgroundTapEvent) {\n this.hMap.addEventListener('tap', (e) => onBackgroundTapEvent(e as unknown as H.mapevents.Event, hUi));\n }\n }\n\n /**\n * Replaces or updates any existing markers with new markers or info based on the provided geographic data.\n *\n * @param updatedGeographicData\n */\n abstract clearAndUpdateMarkers(updatedGeographicData: GeographicDatum[]): void;\n\n /**\n * Helper for determing the map zoom given a list of geographic data.\n */\n setViewPortPlusMargin(\n geographicData: GeographicDatum[],\n hMap: H.Map,\n includeTransition: boolean = false,\n percentageMargin = DEFAULT_PERCENTAGE_MARGIN\n ): void {\n let bottomLeftLat = 0,\n bottomLeftLng = 0,\n topRightLat = 0,\n topRightLng = 0;\n\n // Used for calculating the margin for the bounding box with the given percentageMargin.\n // We use 200 instead of 100 so each side receives half of the computed margin value.\n const mapResizeBase = 200,\n [firstMarker] = geographicData;\n\n if (firstMarker) {\n const { latitude: lat, longitude: lng } = geographicData[0];\n (bottomLeftLat = topRightLat = lat), (bottomLeftLng = topRightLng = lng);\n }\n\n geographicData.slice(1).forEach((m) => {\n const { latitude: lat, longitude: lng } = m;\n bottomLeftLat = Math.min(bottomLeftLat, lat);\n topRightLat = Math.max(topRightLat, lat);\n bottomLeftLng = Math.min(bottomLeftLng, lng);\n topRightLng = Math.max(topRightLng, lng);\n });\n\n const LatDifference = topRightLat - bottomLeftLat,\n LngDifference = topRightLng - bottomLeftLng;\n topRightLat += (LatDifference * percentageMargin) / mapResizeBase;\n bottomLeftLat -= (LatDifference * percentageMargin) / mapResizeBase;\n topRightLng += (LngDifference * percentageMargin) / mapResizeBase;\n bottomLeftLng -= (LngDifference * percentageMargin) / mapResizeBase;\n\n const bottomLeftMarker = new H.map.Marker({ lat: bottomLeftLat, lng: bottomLeftLng }),\n topRightMarker = new H.map.Marker({ lat: topRightLat, lng: topRightLng }),\n viewPortGroup = new H.map.Group();\n viewPortGroup.addObjects([bottomLeftMarker, topRightMarker]);\n hMap.getViewModel().setLookAtData(\n {\n bounds: viewPortGroup.getBoundingBox()\n },\n includeTransition\n );\n }\n\n /**\n * Loads the heremaps style sheet.\n */\n private loadHereApiStylesheet(): void {\n if (document.getElementById('here-js-api-stylesheet') === null) {\n const ss = document.createElement('link');\n ss.type = 'text/css';\n ss.rel = 'stylesheet';\n ss.href = 'https://js.api.here.com/v3/3.1/mapsjs-ui.css';\n ss.id = 'here-js-api-stylesheet';\n document.head.appendChild(ss);\n }\n }\n\n /**\n * Loads the heremaps scripts.\n */\n private loadScriptWithoutAsync(url: string): Promise {\n return new Promise(function (resolve, reject) {\n const script = document.createElement('script');\n script.src = url;\n script.async = false;\n script.onload = () => resolve(url);\n script.onerror = () => reject(url);\n document.head.appendChild(script);\n });\n }\n\n /**\n * Sets up the clustering provider for the map.\n */\n startClustering(map: H.Map, data: GeographicDatum[]): void {\n const dataPoints = data.map(\n (item) => new H.clustering.DataPoint(item.latitude, item.longitude, undefined, item)\n );\n\n this.clusteredDataProvider = new H.clustering.Provider(dataPoints, {\n clusteringOptions: {\n eps: 64,\n minWeight: 2\n },\n theme: this.CUSTOM_THEME\n });\n\n this.clusteredDataProvider?.addEventListener(...this.getEventListenerArgs(null));\n\n const clusteringLayer = new H.map.layer.ObjectLayer(this.clusteredDataProvider);\n\n map.addLayer(clusteringLayer);\n }\n\n /**\n * Defines how to get the cluster / individual item markers.\n */\n CUSTOM_THEME = {\n getClusterPresentation: (cluster: H.clustering.ICluster): H.map.DomMarker => {\n const randomDataPoint = this.getRandomDataPoint(cluster),\n data = randomDataPoint.getData(),\n clusterMarker = new H.map.DomMarker(cluster.getPosition(), {\n icon: this.getDomIcon(data),\n min: cluster.getMinZoom(),\n max: cluster.getMaxZoom()\n });\n\n clusterMarker.setData(data);\n\n return clusterMarker;\n },\n getNoisePresentation: (noisePoint: H.clustering.INoisePoint): H.map.DomMarker => {\n const data = noisePoint.getData(),\n noiseMarker = new H.map.DomMarker(noisePoint.getPosition(), {\n min: noisePoint.getMinZoom(),\n icon: this.getDomIcon(data)\n });\n\n noiseMarker.setData(data);\n\n return noiseMarker;\n }\n };\n\n /**\n * Gets a random data point to use for the cluster symbol.\n */\n private getRandomDataPoint(cluster: H.clustering.ICluster): H.clustering.INoisePoint {\n const dataPoints: H.clustering.INoisePoint[] = [];\n\n cluster.forEachDataPoint(dataPoints.push.bind(dataPoints));\n\n return dataPoints[(Math.random() * dataPoints.length) | 0];\n }\n\n /**\n * Make map zoom buttons accessible using keyboard.\n */\n private setZoomControlsAccessibility(hUi?: H.ui.UI, hMap?: H.Map) {\n if (!hUi || !hMap) return;\n\n const zoomControls = hUi.getControl('zoom').getChildren();\n\n zoomControls?.forEach((zoomControl, zoomIndex) => {\n const zoomElement = zoomControl?.getElement();\n\n if (!zoomElement) return;\n\n zoomElement.tabIndex = 0;\n zoomElement.addEventListener('keypress', (event: KeyboardEvent) => {\n if (event.key === ENTER_CODE) hMap.setZoom(hMap.getZoom() + (zoomIndex ? -1 : 1));\n });\n });\n }\n\n /**\n * Creates the icon for the DomMarker for the given geographicDatum.\n */\n getDomIcon(geographicDatum: GeographicDatum): H.map.DomIcon {\n const { iconClass, id, style } = this.args.getIconClassAndId(geographicDatum),\n iconText = geographicDatum[this.args.markerLabelKey!],\n escapedIconText = escapeHtml(typeof iconText === 'string' ? iconText : '');\n\n return new H.map.DomIcon(`\n \n \n ${escapedIconText}\n `);\n }\n\n getHeadingIcon(geographicDatum: GeographicDatum): H.map.DomIcon {\n const domIconElement = document.createElement('div');\n\n if (geographicDatum.details?.isEngineOn && geographicDatum.heading != null) {\n const adjustedHeading = HEADING_OFFSET + geographicDatum.heading;\n\n domIconElement.className = 'heading-container';\n domIconElement.innerHTML = `
`;\n\n return new H.map.DomIcon(domIconElement, {\n onAttach: function (clonedElement) {\n const clonedContent = clonedElement.getElementsByClassName(HEADING_CLASS_NAME)[0];\n (clonedContent as HTMLElement).style.transform = `rotate(${adjustedHeading}deg)`;\n }\n });\n }\n return new H.map.DomIcon(domIconElement);\n }\n\n /**\n * Default way of adding dom markers to the map when clustering is disabled.\n */\n addDomMarkers(geographicData: GeographicDatum[]): void {\n const newMarkers = geographicData.map((geographicDatum) => {\n const { latitude, longitude } = geographicDatum,\n domMarker = new H.map.DomMarker(\n {\n lat: latitude,\n lng: longitude\n },\n {\n icon: this.getDomIcon(geographicDatum)\n }\n );\n\n domMarker.addEventListener(...this.getEventListenerArgs(geographicDatum));\n\n !!this.shouldAttachLabel && this.attachLabelToMarker(domMarker, geographicDatum);\n\n return domMarker;\n });\n\n this.markerList = [...this.markerList, ...newMarkers];\n // Add markers to map\n this.hMap?.addObjects(this.markerList);\n }\n\n clearMap(): void {\n if (!this.hMap) {\n return;\n }\n\n // Remove all objects from the map\n this.hMap.removeObjects(this.hMap.getObjects());\n this.markerList = [];\n }\n\n /**\n * Gets the args for the event listener.\n */\n getEventListenerArgs(geographicDatum: GeographicDatum | null): [string, EventListenerOrEventListenerObject] {\n return [\n 'tap',\n (e) => {\n const mapEvent = e as unknown as H.mapevents.Event;\n this.args.onTapEvent?.(\n mapEvent,\n geographicDatum ?? (mapEvent.target as H.map.DomMarker).getData(),\n this.hUi as H.ui.UI\n );\n }\n ];\n }\n\n /**\n * Get HTML that renders a text on InfoBubble.\n */\n private getTextHTML(text?: string, css?: string) {\n if (!text) {\n return '';\n }\n return `${escapeHtml(text)}`;\n }\n\n /**\n * Get HTML that renders an icon on InfoBubble.\n */\n private getIconHTML(icon?: string) {\n if (!icon) {\n return ``;\n }\n\n const escapedIcon = escapeHtml(icon);\n\n return `
\n \n
`;\n }\n\n /**\n * Get complete HTML that renders on Map's InfoBubble.\n */\n getInfoBubbleContent(details?: GeographicDatumDetails) {\n const timeString = details?.date;\n\n return `
${this.getIconHTML(details?.icon)}\n ${this.getTextHTML(details?.name, 'name')}${this.getTextHTML(timeString, 'time')}
`;\n }\n\n /**\n * Attach bubble name label to marker point.\n */\n attachLabelToMarker(domMarker: H.map.DomMarker, geographicDatum: GeographicDatum): void {\n const { latitude, longitude, details } = geographicDatum;\n const hasDefinedDetails = details && Object.values(details).some((value) => !!value);\n if (!hasDefinedDetails || !this.hMap || !this.hUi) return;\n\n const infoBubbleContent = this.getInfoBubbleContent(details);\n\n const bubble = new H.ui.InfoBubble(\n { lat: latitude, lng: longitude },\n {\n content: infoBubbleContent\n }\n );\n bubble.addClass('marker-label');\n bubble.setState(H.ui.InfoBubble.State.CLOSED);\n\n this.hUi?.addBubble(bubble);\n\n domMarker.addEventListener('pointerenter', () => {\n bubble.getState() !== H.ui.InfoBubble.State.OPEN && bubble.open();\n });\n domMarker.addEventListener('pointerleave', () => {\n bubble.close();\n });\n }\n}\n"],"names":["HEADING_CLASS_NAME","BaseMapComponent","_dec","alias","_class","Component","constructor","owner","args","super","_initializerDefineProperty","_descriptor","_descriptor2","_descriptor3","_defineProperty","_buildTask","context","generator","el","this","herePromise","hPlatform","H","service","Platform","apikey","addMap","ex","notificationManager","addError","getClusterPresentation","cluster","data","getRandomDataPoint","getData","clusterMarker","map","DomMarker","getPosition","icon","getDomIcon","min","getMinZoom","max","getMaxZoom","setData","getNoisePresentation","noisePoint","noiseMarker","loadHereApiStylesheet","isPresent","window","scripts","shouldCluster","undefined","Promise","all","compact","loadScriptWithoutAsync","shouldAttachLabel","_this$args$shouldAtta","destroyMap","_this$clusteredDataPr","_this$hUi","_this$routeLine","_this$hMapBehavior","_this$hMapEvents","_this$hUi2","hMap","clusteredDataProvider","dispose","markerList","forEach","marker","headingList","heading","bubbles","hUi","getBubbles","length","b","routeLine","hMapBehavior","hMapEvents","later","_this$hMap","resizeMap","_this$hMap2","getViewPort","resize","updateMap","_","updatedGeographicData","canViewCarLocation","clearAndUpdateMarkers","setDefaultZoom","geographicData","includeTransition","arguments","getViewModel","setLookAtData","position","lat","latitude","lng","longitude","zoom","setViewPortPlusMargin","element","defaultLayers","createDefaultLayers","Map","vector","normal","center","pixelRatio","devicePixelRatio","getBaseLayer","setMin","setMax","ui","UI","createDefault","setUnitSystem","isMetric","UnitSystem","METRIC","IMPERIAL","mapevents","MapEvents","Behavior","mapSettings","getControl","setVisibility","menuEntries","getChildren","getElement","style","borderBottom","slice","invoke","setZoomControlsAccessibility","onBackgroundTapEvent","addEventListener","e","percentageMargin","bottomLeftLat","bottomLeftLng","topRightLat","topRightLng","mapResizeBase","firstMarker","m","Math","LatDifference","LngDifference","bottomLeftMarker","Marker","topRightMarker","viewPortGroup","Group","addObjects","bounds","getBoundingBox","document","getElementById","ss","createElement","type","rel","href","id","head","appendChild","url","resolve","reject","script","src","async","onload","onerror","startClustering","_this$clusteredDataPr2","dataPoints","item","clustering","DataPoint","Provider","clusteringOptions","eps","minWeight","theme","CUSTOM_THEME","getEventListenerArgs","clusteringLayer","layer","ObjectLayer","addLayer","forEachDataPoint","push","bind","random","zoomControls","zoomControl","zoomIndex","zoomElement","tabIndex","event","key","ENTER_CODE","setZoom","getZoom","geographicDatum","iconClass","getIconClassAndId","iconText","markerLabelKey","escapedIconText","escapeHtml","DomIcon","concat","getHeadingIcon","_geographicDatum$deta","domIconElement","details","isEngineOn","adjustedHeading","className","innerHTML","onAttach","clonedElement","getElementsByClassName","transform","addDomMarkers","_this$hMap3","newMarkers","domMarker","attachLabelToMarker","clearMap","removeObjects","getObjects","_this$args$onTapEvent","_this$args","mapEvent","onTapEvent","call","target","getTextHTML","text","css","getIconHTML","escapedIcon","getInfoBubbleContent","timeString","date","name","_this$hUi3","Object","values","some","value","infoBubbleContent","bubble","InfoBubble","content","addClass","setState","State","CLOSED","addBubble","getState","OPEN","open","close","_applyDecoratedDescriptor","prototype","configurable","enumerable","writable","initializer","action","getOwnPropertyDescriptor"],"sourceRoot":""}