/******/ (() => { // webpackBootstrap
/******/ 	var __webpack_modules__ = ({

/***/ "./config.js":
/*!*******************!*\
  !*** ./config.js ***!
  \*******************/
/***/ ((module) => {

var config = {
  development: {
    API_GATEWAY_DOMAIN: 'fslgh4rcu1nys.apexguard.com',
    API_GATEWAY_DOMAIN_DEF: 'api-gateway.apexguard.com',
    PLATFORM_BACKEND_DOMAIN: 'platform-backend.apexguard.com',
    WEBSOCKET_URL: 'wss://user-socket.apexguard.com/ws',
    DEBUG_LOGGING: true,
    PING_TIMEOUT: 300 * 1000,
    MAX_GATEWAYS_TO_CHECK: 3,
    ENABLED_LOCATION_SPOOFING: true,
    EXECUTE_SPOOFING_SCRIPT: true
  },
  production: {
    API_GATEWAY_DOMAIN: 'fslgh4rcu1nys.apexguard.com',
    API_GATEWAY_DOMAIN_DEF: 'api-gateway.apexguard.com',
    PLATFORM_BACKEND_DOMAIN: 'platform-backend.apexguard.com',
    WEBSOCKET_URL: 'wss://user-socket.apexguard.com/ws',
    DEBUG_LOGGING: false,
    PING_TIMEOUT: 300 * 1000,
    MAX_GATEWAYS_TO_CHECK: 3,
    ENABLED_LOCATION_SPOOFING: true,
    EXECUTE_SPOOFING_SCRIPT: true
  },
  staging: {
    API_GATEWAY_DOMAIN: 'api-gateway-staging.apexguard.com',
    API_GATEWAY_DOMAIN_DEF: 'api-gateway.apexguard.com',
    PLATFORM_BACKEND_DOMAIN: 'platform-backend-staging.apexguard.com',
    WEBSOCKET_URL: 'wss://user-socket.apexguard.com/ws',
    DEBUG_LOGGING: true,
    PING_TIMEOUT: 300 * 1000,
    MAX_GATEWAYS_TO_CHECK: 3,
    ENABLED_LOCATION_SPOOFING: true,
    EXECUTE_SPOOFING_SCRIPT: true
  }
};
var env = "development" || 0;
module.exports = config[env];

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	(() => {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = (module) => {
/******/ 			var getter = module && module.__esModule ?
/******/ 				() => (module['default']) :
/******/ 				() => (module);
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(() => {
"use strict";
/*!***********************************!*\
  !*** ./src/sw/content/preload.js ***!
  \***********************************/
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../config.js */ "./config.js");
/* harmony import */ var _config_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_config_js__WEBPACK_IMPORTED_MODULE_0__);
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }

(function () {
  if ((_config_js__WEBPACK_IMPORTED_MODULE_0___default().EXECUTE_SPOOFING_SCRIPT)) return;
  if (!navigator.geolocation) return;
  var spoofedData = null;
  overrideGeolocationAndTimezone();
  window.addEventListener('message', function handler(e) {
    var _e$data;
    if (e.source !== window) return;
    if (((_e$data = e.data) === null || _e$data === void 0 ? void 0 : _e$data.type) !== '__APEXGUARD_SPOOF_DATA__') return;
    spoofedData = e.data.payload;
    window.removeEventListener('message', handler);
  }, false);
  function overrideGeolocationAndTimezone() {
    var originalGetCurrentPosition = navigator.geolocation.getCurrentPosition;
    navigator.geolocation.getCurrentPosition = function (successCallback, errorCallback, options) {
      var _spoofedData;
      if ((_spoofedData = spoofedData) !== null && _spoofedData !== void 0 && _spoofedData.enabled && spoofedData.lat != null && spoofedData.lon != null) {
        successCallback({
          coords: {
            latitude: spoofedData.lat,
            longitude: spoofedData.lon,
            accuracy: 100,
            altitude: null,
            altitudeAccuracy: null,
            heading: null,
            speed: null
          },
          timestamp: Date.now()
        });
      } else if (typeof errorCallback === 'function') {
        originalGetCurrentPosition.call(navigator.geolocation, successCallback, errorCallback, options);
      } else {
        originalGetCurrentPosition.call(navigator.geolocation, successCallback, errorCallback, options);
      }
    };
    navigator.geolocation.watchPosition = function (successCallback, errorCallback, options) {
      navigator.geolocation.getCurrentPosition(successCallback, errorCallback, options);
      return setTimeout(function () {}, options !== null && options !== void 0 && options.timeout ? Math.min(options.timeout, 1000) : 1000);
    };
    var originalResolvedOptions = Intl.DateTimeFormat.prototype.resolvedOptions;
    Intl.DateTimeFormat.prototype.resolvedOptions = function () {
      var _spoofedData$timeZone, _spoofedData2;
      var options = originalResolvedOptions.call(this);
      return _objectSpread(_objectSpread({}, options), {}, {
        timeZone: (_spoofedData$timeZone = (_spoofedData2 = spoofedData) === null || _spoofedData2 === void 0 ? void 0 : _spoofedData2.timeZone) !== null && _spoofedData$timeZone !== void 0 ? _spoofedData$timeZone : options.timeZone
      });
    };
    navigator.permissions.query({
      name: 'geolocation'
    }).then(function (p) {
      p.onchange = function () {
        location.reload(true);
      };
    });
  }
  if (window.__APEXGUARD_SPOOFED_DATA__) {
    spoofedData = window.__APEXGUARD_SPOOFED_DATA__;
    overrideGeolocationAndTimezone();
  }
})();
})();

/******/ })()
;
//# sourceMappingURL=preload.js.map