{"version":3,"file":"default/js/experience/layouts/googleMap.js","mappings":";;;;;;;;;;;;;;;;;;;;AAAyB;AACD;AACxB;;;;;;;;;;;;;;;ACFO;AACP,2CAA2C;AAC3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,wBAAwB,qBAAqB;AAC7C;AACA;AACA,mCAAmC,YAAY;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmC,KAAK,GAAG,MAAM;AACjD;AACA;AACA,0DAA0D,qBAAqB;AAC/E;AACA;AACA;AACA;;;;;;;;;;AC7DA;AACA;;;;;;UCDA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;WCtBA;WACA;WACA;WACA,eAAe,4BAA4B;WAC3C,eAAe;WACf,iCAAiC,WAAW;WAC5C;WACA;;;;;WCPA;WACA;WACA;WACA;WACA,yCAAyC,wCAAwC;WACjF;WACA;WACA;;;;;WCPA,8CAA8C;;;;;WCA9C;WACA;WACA;WACA,uDAAuD,iBAAiB;WACxE;WACA,gDAAgD,aAAa;WAC7D;;;;;;;;;;;ACNA;;AAEa;;AAEb,QAAQ,SAAS,EAAE,mBAAO,CAAC,gEAAa;;AAExC;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,+BAA+B,uBAAuB;AACtD,sBAAsB,wDAAwD,EAAE;AAChF;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;;AAEA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,aAAa;AACb;AACA,SAAS;AACT,KAAK;;AAEL;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,KAAK;AACL,CAAC","sources":["webpack://sfra-startup-kit/./node_modules/google-maps/lib/esm/index.js","webpack://sfra-startup-kit/./node_modules/google-maps/lib/esm/loader.js","webpack://sfra-startup-kit/./node_modules/google-maps/lib/esm/types.js","webpack://sfra-startup-kit/webpack/bootstrap","webpack://sfra-startup-kit/webpack/runtime/compat get default export","webpack://sfra-startup-kit/webpack/runtime/define property getters","webpack://sfra-startup-kit/webpack/runtime/hasOwnProperty shorthand","webpack://sfra-startup-kit/webpack/runtime/make namespace object","webpack://sfra-startup-kit/./cartridges/app_core_page_designer/cartridge/client/default/js/experience/layouts/googleMap.js"],"sourcesContent":["export * from './loader';\nexport * from './types';\n//# sourceMappingURL=index.js.map","export class Loader {\n constructor(apiKey = null, options = {}) {\n this.apiKey = apiKey;\n this.options = options;\n if (typeof window === 'undefined') {\n throw new Error('google-maps is supported only in browser environment');\n }\n }\n load() {\n if (typeof this.api !== 'undefined') {\n return Promise.resolve(this.api);\n }\n if (typeof this.loader !== 'undefined') {\n return this.loader;\n }\n window[Loader.CALLBACK_NAME] = () => {\n this.api = window['google'];\n if (typeof this.resolve === 'undefined') {\n throw new Error('Should not happen');\n }\n this.resolve(this.api);\n };\n window['gm_authFailure'] = () => {\n if (typeof this.reject === 'undefined') {\n throw new Error('Should not happen');\n }\n this.reject(new Error('google-maps: authentication error'));\n };\n return this.loader = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n const script = document.createElement('script');\n script.src = this.createUrl();\n script.async = true;\n script.onerror = (e) => reject(e);\n document.head.appendChild(script);\n });\n }\n createUrl() {\n const parameters = [\n `callback=${Loader.CALLBACK_NAME}`,\n ];\n if (this.apiKey) {\n parameters.push(`key=${this.apiKey}`);\n }\n for (let name in this.options) {\n if (this.options.hasOwnProperty(name)) {\n let value = this.options[name];\n if (name === 'version') {\n name = 'v';\n }\n if (name === 'libraries') {\n value = value.join(',');\n }\n parameters.push(`${name}=${value}`);\n }\n }\n return `https://maps.googleapis.com/maps/api/js?${parameters.join('&')}`;\n }\n}\nLoader.CALLBACK_NAME = '_dk_google_maps_loader_cb';\n//# sourceMappingURL=loader.js.map","/// \n//# sourceMappingURL=types.js.map","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* eslint-env jquery */\n\n\"use strict\";\n\nconst { Loader } = require(\"google-maps\");\n\nfunction getMarkerOverlayMarkup(markerData) {\n return `\n
\n

\n ${markerData.name ? markerData.name : \"\"}\n

\n

\n \n ${markerData.phoneText ? markerData.phoneText + \":\" : \"\"} ${markerData.phoneNumber ? markerData.phoneNumber : \"\"}\n \n

\n

\n ${markerData.content ? markerData.content : \"\"}\n

\n
\n `;\n}\n\nfunction initModuleInstance($root, markerImgConfig, googleLibInstance) {\n \n\n const mapBounds = new googleLibInstance.maps.LatLngBounds();\n const markersDataList = $root\n .find(\".google-map-marker-data\")\n .map(function () {\n const data = $(this).val();\n return JSON.parse(decodeURI(data));\n })\n .get();\n\n const gMap = new googleLibInstance.maps.Map($root.find(\".google-map\").get(0));\n\n markersDataList.forEach(markerData => {\n let marker;\n\n const infoWindow = new googleLibInstance.maps.InfoWindow();\n\n const markerCoords = new googleLibInstance.maps.LatLng(Number(markerData.lat), Number(markerData.lng));\n\n marker = new googleLibInstance.maps.Marker({\n position: markerCoords,\n map: gMap,\n title: markerData.name ? markerData.name : null,\n icon: markerImgConfig,\n label: {\n text: markerData.name ? markerData.name : null,\n color: textColor,\n fontSize: \"20px\"\n }\n });\n mapBounds.extend(marker.position);\n marker.addListener(\"click\", function () {\n infoWindow.setOptions({\n content: getMarkerOverlayMarkup(markerData)\n });\n infoWindow.open(gMap, marker);\n });\n });\n\n googleLibInstance.maps.event.addListenerOnce(gMap, \"idle\", function () {\n gMap.fitBounds(mapBounds);\n gMap.setZoom(5);\n });\n}\n\n// api key is ensured to be present, ptherwise this js file(asset) is not included in\n// cartridges/app_theme_1/cartridge/templates/default/experience/components/layouts/googleMap.isml\nconst gmapApiKey = $(\".google-map-api-key\").val();\nconst fillColor = getComputedStyle(document.documentElement)\n .getPropertyValue(\"--background-secondary\");\nconst textColor = getComputedStyle(document.documentElement)\n .getPropertyValue(\"--text-secondary\");\n\nconst googleApiLoader = new Loader(gmapApiKey);\n\n(async function () {\n const googleLibInstance = window.google || await googleApiLoader.load();\n // TODO: marker config is hard-coded\n const markerImgConfig = {\n path: \"M9.64387 0C7.97426 0.000194842 6.3333 0.433796 4.88153 1.25838C3.42975 2.08297 2.2169 3.27029 1.36161 4.7042C0.50633 6.1381 0.0379201 7.76947 0.0022072 9.43869C-0.0335057 11.1079 0.364698 12.7578 1.15787 14.227L9.11687 28.621C9.16836 28.716 9.24456 28.7953 9.3374 28.8506C9.43025 28.9059 9.53631 28.9351 9.64437 28.9351C9.75243 28.9351 9.85849 28.9059 9.95133 28.8506C10.0442 28.7953 10.1204 28.716 10.1719 28.621L18.1339 14.221C18.9255 12.7517 19.3223 11.1021 19.2855 9.43353C19.2487 7.76495 18.7797 6.13446 17.9241 4.70143C17.0686 3.2684 15.8559 2.08186 14.4046 1.2578C12.9532 0.43374 11.3129 0.000352414 9.64387 0V0ZM9.64387 14.466C8.69021 14.4658 7.75802 14.1828 6.96518 13.6529C6.17234 13.1229 5.55445 12.3697 5.18964 11.4886C4.82483 10.6075 4.72947 9.63797 4.91564 8.70266C5.10182 7.76735 5.56115 6.90825 6.23556 6.23398C6.90997 5.55971 7.76917 5.10056 8.70452 4.91458C9.63986 4.7286 10.6094 4.82415 11.4904 5.18915C12.3715 5.55414 13.1245 6.17219 13.6543 6.96514C14.1841 7.7581 14.4669 8.69034 14.4669 9.644C14.4653 10.9226 13.9566 12.1483 13.0524 13.0523C12.1483 13.9563 10.9224 14.4647 9.64387 14.466Z\",\n fillColor: fillColor,\n fillOpacity: 1,\n scale: 1.1,\n strokeColor: textColor,\n strokeWeight: 1,\n anchor: new googleLibInstance.maps.Point(13, 30),\n labelOrigin: new googleLibInstance.maps.Point(12, 40)\n };\n\n const $mapsList = $(\".google-map-wrapper\");\n\n $mapsList.each(function () {\n initModuleInstance($(this), markerImgConfig, googleLibInstance);\n });\n})();\n"],"names":[],"sourceRoot":""}