{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./Scripts/locations-worker.js","webpack:///./../SharedSiteCode/Scripts/locations-worker.js"],"names":["pageNum","displayCount","locationsObject","startPos","pageHtml","f","i","name","nameMobile","pageType","stateCodes","titleHtml","pictureInnerHtml","variants","urlSplits","extension","getImageMimeType","Math","radlat1","radlat2","dist","unit","onmessage","msg","console","JSON","phoneNumber","contactUrl","this","postMessage","operation","htmlResp","getLocationPageHtml","hasMore","googleMapsReady","distance","pos","a","b","sortLocationsByDistance"],"mappings":"aAIA,cAGA,QACA,oBAGA,YACA,IACA,KACA,YAUA,OANC,EAAD,iCAGA,OAGA,UAvBA,SA4BC,EAAD,IAGA,MAGA,oBACA,UACA,2BAA0C,uBAK1C,gBACA,gDACA,4CAAwD,iBAExD,sCAAiD,YAQjD,kBAEA,GADA,cACA,aACA,qDACA,0BAGA,GAFA,OACA,mCAAyC,wBACzC,2DAAgH,aAAqB,UAArI,IACA,UAIA,gBACA,sBACA,WAA2B,kBAC3B,WAAiC,UAEjC,OADC,EAAD,WACA,GAIA,kBAAsD,kDAGtD,YAIA,U,kCClFA,O,2BC0DA,SAAS,EAAT,GACI,IAAI,EAAJ,GAEA,GAAIA,GACAC,EAAeC,EAAfD,OACAE,KAGAA,GAAYH,EAAZG,IADAF,KAKJ,QADIG,EAAJ,GACAC,EAAA,EAAuBC,EAAvB,OACQA,GAAKJ,EAAT,QADJG,IAIQD,QAGR,MAAO,CAAC,SAAD,EAEH,SAAWJ,MAAwBE,SAAyBF,KAIpE,SAAS,EAAT,GAAuC,IAEnC,EACIO,EAAOL,KAAX,KACIM,EAAaN,KAAjB,WAIA,gBAAIO,EAAyB,CACzB,IAAIC,EAAaR,KAAjB,YACA,GAAIK,UAAaG,EAAbH,MACAA,GAAQ,KAAOG,OAAfH,OACJ,GAAIC,UAAmBE,EAAnBF,MACAA,GAAc,KAAOE,OAArBF,MAGR,SAAIC,IACAF,EAAOL,KAAPK,SACAC,EAAaN,KAAbM,YAlB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AjB,cAKA,IAAIC,EAAWC,EAAoBvB,cAAnC,GACAmB,KAAKC,YAAY,CAAEC,UAAF,cAA4B1B,SAAU2B,EAAtC,SAAyDE,QAASF,EAAnF,UACA,MAEJ,IAAI,iBACIA,EAAWC,EAAoBT,OAAnC,SACAK,KAAKC,YAAY,CAAEC,UAAF,cAA4B1B,SAAU2B,EAAtC,0BAA+EE,QAASF,EAAzG,UACA,MAEJ,IAAI,mBACAG,EAGA,MAEJ,IAAI,iBAyJZ,YAGI,IAAI,EACJ,IAAK,IAAL,OACId,EAAOe,EAASC,EAATD,IAAkBC,EAAlBD,aAAPf,UACAlB,YAKJA,EAAkB,QAAqB,cACnC,OAAOmC,OAASC,EAAhB,QApKIC,CAAwBhB,OAAxBgB,UAEIR,EAAWC,EAAoBvB,cAAnC,GACAmB,KAAKC,YAAY,CAAEC,UAAF,cAA4B1B,SAAU2B,EAAtC,0BAA8EE,QAASF,EAAxG,UACA,MAEJ,QACIP,QAAQA,IAAI,gDAAkDD,OAA9DC,WACAA,QAAQA,IAAID,EAAZC","file":"js/locations-worker.min.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/css/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 57);\n","import \"../../SharedSiteCode/Scripts/locations-worker\";\r\n\r\n// right now we don't need anything that's not in the shared locations-worker script","var locationsObject = null;\r\nvar phoneNumber;\r\nvar pageType; // should be 'state', 'locations', or 'single' ('single' not used at this time)\r\nvar contactUrl;\r\nvar mapInfoWindow;\r\nvar minNumMarkersToShow = 9;\r\nvar markersToShow = [];\r\nvar googleMapsReady = false;\r\n\r\nonmessage = function(msg) {\r\n if (!msg.isTrusted) {\r\n console.log('Locations worker received message from untrusted source.');\r\n console.log(msg);\r\n return;\r\n }\r\n\r\n //console.log(msg);\r\n switch (msg.data.operation) {\r\n case 'init':\r\n locationsObject = JSON.parse(msg.data.locStr);\r\n phoneNumber = msg.data.phone;\r\n pageType = msg.data.pageType;\r\n contactUrl = msg.data.contactUrl;\r\n\r\n this.postMessage({ operation: 'locParsed', locations: locationsObject });\r\n if (googleMapsReady)\r\n initMap();\r\n\r\n // send first page of location html\r\n var htmlResp = getLocationPageHtml(pageType == 'state' ? -1 : 1);\r\n this.postMessage({ operation: 'locPageHtml', pageHtml: htmlResp.pageHtml, hasMore: htmlResp.hasMore });\r\n break;\r\n\r\n case 'getLocPageHtml':\r\n var htmlResp = getLocationPageHtml(msg.data.pageNum);\r\n this.postMessage({ operation: 'locPageHtml', pageHtml: htmlResp.pageHtml, clearPrevious: false, hasMore: htmlResp.hasMore });\r\n break;\r\n\r\n case 'googleMapsReady':\r\n googleMapsReady = true;\r\n if (locationsObject != null)\r\n initMap();\r\n break;\r\n\r\n case 'sortLocations':\r\n sortLocationsByDistance(msg.data.centerOn);\r\n\r\n var htmlResp = getLocationPageHtml(pageType == 'state' ? -1 : 1);\r\n this.postMessage({ operation: 'locPageHtml', pageHtml: htmlResp.pageHtml, clearPrevious: true, hasMore: htmlResp.hasMore });\r\n break;\r\n\r\n default:\r\n console.log('Locations worker received unknown operation: ' + msg.data.operation);\r\n console.log(msg.data);\r\n\t}\r\n};\r\n\r\n\r\nfunction getLocationPageHtml(pageNum) {\r\n var displayCount, startPos;\r\n\r\n if (pageNum == -1) { // do all locations\r\n displayCount = locationsObject.length;\r\n startPos = 0;\r\n } else { // do selected page, 9 locations per page\r\n displayCount = 9;\r\n startPos = (pageNum - 1) * displayCount;\r\n\t}\r\n\r\n var pageHtml = '';\r\n for (var i = startPos; i < startPos + displayCount; i++) {\r\n if (i >= locationsObject.length)\r\n break;\r\n else\r\n pageHtml += getLocationBlockHtml(i);\r\n }\r\n\r\n return {\r\n 'pageHtml': pageHtml,\r\n 'hasMore': pageNum == -1 ? false : locationsObject.length > pageNum * displayCount\r\n }\r\n}\r\n\r\nfunction getLocationBlockHtml(locKey) {\r\n\r\n var titleHtml;\r\n var name = locationsObject[locKey].name;\r\n var nameMobile = locationsObject[locKey].nameMobile;\r\n\r\n // if main locations page (not state page), and state code not already included\r\n // attach normalized state code\r\n if (pageType == 'locations') {\r\n var stateCodes = locationsObject[locKey].stateCodes;\r\n if (name.indexOf(stateCodes[0]) == -1)\r\n name += ', ' + stateCodes.join('/');\r\n if (nameMobile.indexOf(stateCodes[0]) == -1)\r\n nameMobile += ', ' + stateCodes.join('/');\r\n }\r\n\r\n if (pageType == 'state') {\r\n name = locationsObject[locKey].nameBare;\r\n nameMobile = locationsObject[locKey].nameMobile;\r\n\t}\r\n\r\n if (nameMobile == name)\r\n titleHtml = '

' + name + '

';\r\n else\r\n titleHtml = '

' + nameMobile + '

' + name + '

';\r\n\r\n\r\n var pictureInnerHtml = '';\r\n\r\n // put image variants (if any) on page as elements inside the \r\n var variants = locationsObject[locKey].photo.Variants;\r\n if (variants.hasOwnProperty(\"MarketImageWebP\"))\r\n pictureInnerHtml += '';\r\n if (variants.hasOwnProperty(\"MarketImage\")) {\r\n var urlSplits = locationsObject[locKey].photo.Url.split('.');\r\n var mimeType = getImageMimeType(urlSplits[urlSplits.length - 1]); // get mime type from extension of the uploaded image\r\n pictureInnerHtml += '';\r\n }\r\n\r\n // there will always be a fallback image\r\n pictureInnerHtml += '\"'';\r\n\r\n \r\n return `\r\n
\r\n \r\n ${pictureInnerHtml}\r\n ${titleHtml}\r\n
\r\n
\r\n
\r\n ${phoneNumber}\r\n
\r\n ${locationsObject[locKey].desc}\r\n
\r\n
\r\n View Location\r\n |\r\n Contact Us\r\n
\r\n
\r\n\r\n
\r\n
\r\n \r\n \r\n \r\n
${locationsObject[locKey].desc}
\r\n \r\n
\r\n
\r\n\r\n
`;\r\n}\r\n\r\nfunction getImageMimeType(extension) {\r\n switch (extension.toLowerCase()) {\r\n case 'bmp':\r\n return 'image/bmp';\r\n case 'gif':\r\n return 'image/gif';\r\n case 'jpeg':\r\n case 'jpg':\r\n return 'image/jpeg';\r\n case 'png':\r\n return 'image/png';\r\n case 'svg':\r\n return 'image/svg+xml';\r\n case 'tif':\r\n case 'tiff':\r\n return 'image/tiff';\r\n case 'webp':\r\n return 'image/webp';\r\n default:\r\n return null;\r\n\t}\r\n}\r\n\r\n// sorts a global named locationsObject by proximity to provided lan/long position\r\nfunction sortLocationsByDistance(pos) {\r\n\r\n //ASSIGN DISTANCE RELATIVE TO GEOLOCATED POSITION\r\n var dist;\r\n for (var key in locationsObject) {\r\n dist = distance(pos.lat, pos.lng, locationsObject[key]['lat'], locationsObject[key]['lng']);\r\n locationsObject[key]['dist'] = dist;\r\n //console.log('location ' + key + ': name - ' + locationsObject[key]['name'] + '; dist - ' + locationsObject[key]['dist']);\r\n }\r\n\r\n //SORT THE OBJECT BY NEW DISTANCES\r\n locationsObject = locationsObject.sort(function (a, b) {\r\n return a.dist - b.dist;\r\n });\r\n}\r\n\r\nfunction distance(lat1, lon1, lat2, lon2, unit) {\r\n var radlat1 = Math.PI * lat1 / 180\r\n var radlat2 = Math.PI * lat2 / 180\r\n var theta = lon1 - lon2\r\n var radtheta = Math.PI * theta / 180\r\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\r\n dist = Math.acos(dist)\r\n dist = dist * 180 / Math.PI\r\n dist = dist * 60 * 1.1515\r\n if (unit == \"K\") { dist = dist * 1.609344 }\r\n if (unit == \"N\") { dist = dist * 0.8684 }\r\n return dist\r\n}\r\n\r\nfunction initMap() {\r\n\r\n}\r\n"],"sourceRoot":""}