/******/ (() => { // 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];

/***/ }),

/***/ "./node_modules/react/cjs/react.development.js":
/*!*****************************************************!*\
  !*** ./node_modules/react/cjs/react.development.js ***!
  \*****************************************************/
/***/ ((module, exports, __webpack_require__) => {

"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
/**
 * @license React
 * react.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


 true &&
  (function () {
    function defineDeprecationWarning(methodName, info) {
      Object.defineProperty(Component.prototype, methodName, {
        get: function () {
          console.warn(
            "%s(...) is deprecated in plain JavaScript React classes. %s",
            info[0],
            info[1]
          );
        }
      });
    }
    function getIteratorFn(maybeIterable) {
      if (null === maybeIterable || "object" !== typeof maybeIterable)
        return null;
      maybeIterable =
        (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
        maybeIterable["@@iterator"];
      return "function" === typeof maybeIterable ? maybeIterable : null;
    }
    function warnNoop(publicInstance, callerName) {
      publicInstance =
        ((publicInstance = publicInstance.constructor) &&
          (publicInstance.displayName || publicInstance.name)) ||
        "ReactClass";
      var warningKey = publicInstance + "." + callerName;
      didWarnStateUpdateForUnmountedComponent[warningKey] ||
        (console.error(
          "Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
          callerName,
          publicInstance
        ),
        (didWarnStateUpdateForUnmountedComponent[warningKey] = !0));
    }
    function Component(props, context, updater) {
      this.props = props;
      this.context = context;
      this.refs = emptyObject;
      this.updater = updater || ReactNoopUpdateQueue;
    }
    function ComponentDummy() {}
    function PureComponent(props, context, updater) {
      this.props = props;
      this.context = context;
      this.refs = emptyObject;
      this.updater = updater || ReactNoopUpdateQueue;
    }
    function noop() {}
    function testStringCoercion(value) {
      return "" + value;
    }
    function checkKeyStringCoercion(value) {
      try {
        testStringCoercion(value);
        var JSCompiler_inline_result = !1;
      } catch (e) {
        JSCompiler_inline_result = !0;
      }
      if (JSCompiler_inline_result) {
        JSCompiler_inline_result = console;
        var JSCompiler_temp_const = JSCompiler_inline_result.error;
        var JSCompiler_inline_result$jscomp$0 =
          ("function" === typeof Symbol &&
            Symbol.toStringTag &&
            value[Symbol.toStringTag]) ||
          value.constructor.name ||
          "Object";
        JSCompiler_temp_const.call(
          JSCompiler_inline_result,
          "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
          JSCompiler_inline_result$jscomp$0
        );
        return testStringCoercion(value);
      }
    }
    function getComponentNameFromType(type) {
      if (null == type) return null;
      if ("function" === typeof type)
        return type.$$typeof === REACT_CLIENT_REFERENCE
          ? null
          : type.displayName || type.name || null;
      if ("string" === typeof type) return type;
      switch (type) {
        case REACT_FRAGMENT_TYPE:
          return "Fragment";
        case REACT_PROFILER_TYPE:
          return "Profiler";
        case REACT_STRICT_MODE_TYPE:
          return "StrictMode";
        case REACT_SUSPENSE_TYPE:
          return "Suspense";
        case REACT_SUSPENSE_LIST_TYPE:
          return "SuspenseList";
        case REACT_ACTIVITY_TYPE:
          return "Activity";
      }
      if ("object" === typeof type)
        switch (
          ("number" === typeof type.tag &&
            console.error(
              "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
            ),
          type.$$typeof)
        ) {
          case REACT_PORTAL_TYPE:
            return "Portal";
          case REACT_CONTEXT_TYPE:
            return type.displayName || "Context";
          case REACT_CONSUMER_TYPE:
            return (type._context.displayName || "Context") + ".Consumer";
          case REACT_FORWARD_REF_TYPE:
            var innerType = type.render;
            type = type.displayName;
            type ||
              ((type = innerType.displayName || innerType.name || ""),
              (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef"));
            return type;
          case REACT_MEMO_TYPE:
            return (
              (innerType = type.displayName || null),
              null !== innerType
                ? innerType
                : getComponentNameFromType(type.type) || "Memo"
            );
          case REACT_LAZY_TYPE:
            innerType = type._payload;
            type = type._init;
            try {
              return getComponentNameFromType(type(innerType));
            } catch (x) {}
        }
      return null;
    }
    function getTaskName(type) {
      if (type === REACT_FRAGMENT_TYPE) return "<>";
      if (
        "object" === typeof type &&
        null !== type &&
        type.$$typeof === REACT_LAZY_TYPE
      )
        return "<...>";
      try {
        var name = getComponentNameFromType(type);
        return name ? "<" + name + ">" : "<...>";
      } catch (x) {
        return "<...>";
      }
    }
    function getOwner() {
      var dispatcher = ReactSharedInternals.A;
      return null === dispatcher ? null : dispatcher.getOwner();
    }
    function UnknownOwner() {
      return Error("react-stack-top-frame");
    }
    function hasValidKey(config) {
      if (hasOwnProperty.call(config, "key")) {
        var getter = Object.getOwnPropertyDescriptor(config, "key").get;
        if (getter && getter.isReactWarning) return !1;
      }
      return void 0 !== config.key;
    }
    function defineKeyPropWarningGetter(props, displayName) {
      function warnAboutAccessingKey() {
        specialPropKeyWarningShown ||
          ((specialPropKeyWarningShown = !0),
          console.error(
            "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
            displayName
          ));
      }
      warnAboutAccessingKey.isReactWarning = !0;
      Object.defineProperty(props, "key", {
        get: warnAboutAccessingKey,
        configurable: !0
      });
    }
    function elementRefGetterWithDeprecationWarning() {
      var componentName = getComponentNameFromType(this.type);
      didWarnAboutElementRef[componentName] ||
        ((didWarnAboutElementRef[componentName] = !0),
        console.error(
          "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
        ));
      componentName = this.props.ref;
      return void 0 !== componentName ? componentName : null;
    }
    function ReactElement(type, key, props, owner, debugStack, debugTask) {
      var refProp = props.ref;
      type = {
        $$typeof: REACT_ELEMENT_TYPE,
        type: type,
        key: key,
        props: props,
        _owner: owner
      };
      null !== (void 0 !== refProp ? refProp : null)
        ? Object.defineProperty(type, "ref", {
            enumerable: !1,
            get: elementRefGetterWithDeprecationWarning
          })
        : Object.defineProperty(type, "ref", { enumerable: !1, value: null });
      type._store = {};
      Object.defineProperty(type._store, "validated", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: 0
      });
      Object.defineProperty(type, "_debugInfo", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: null
      });
      Object.defineProperty(type, "_debugStack", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: debugStack
      });
      Object.defineProperty(type, "_debugTask", {
        configurable: !1,
        enumerable: !1,
        writable: !0,
        value: debugTask
      });
      Object.freeze && (Object.freeze(type.props), Object.freeze(type));
      return type;
    }
    function cloneAndReplaceKey(oldElement, newKey) {
      newKey = ReactElement(
        oldElement.type,
        newKey,
        oldElement.props,
        oldElement._owner,
        oldElement._debugStack,
        oldElement._debugTask
      );
      oldElement._store &&
        (newKey._store.validated = oldElement._store.validated);
      return newKey;
    }
    function validateChildKeys(node) {
      isValidElement(node)
        ? node._store && (node._store.validated = 1)
        : "object" === typeof node &&
          null !== node &&
          node.$$typeof === REACT_LAZY_TYPE &&
          ("fulfilled" === node._payload.status
            ? isValidElement(node._payload.value) &&
              node._payload.value._store &&
              (node._payload.value._store.validated = 1)
            : node._store && (node._store.validated = 1));
    }
    function isValidElement(object) {
      return (
        "object" === typeof object &&
        null !== object &&
        object.$$typeof === REACT_ELEMENT_TYPE
      );
    }
    function escape(key) {
      var escaperLookup = { "=": "=0", ":": "=2" };
      return (
        "$" +
        key.replace(/[=:]/g, function (match) {
          return escaperLookup[match];
        })
      );
    }
    function getElementKey(element, index) {
      return "object" === typeof element &&
        null !== element &&
        null != element.key
        ? (checkKeyStringCoercion(element.key), escape("" + element.key))
        : index.toString(36);
    }
    function resolveThenable(thenable) {
      switch (thenable.status) {
        case "fulfilled":
          return thenable.value;
        case "rejected":
          throw thenable.reason;
        default:
          switch (
            ("string" === typeof thenable.status
              ? thenable.then(noop, noop)
              : ((thenable.status = "pending"),
                thenable.then(
                  function (fulfilledValue) {
                    "pending" === thenable.status &&
                      ((thenable.status = "fulfilled"),
                      (thenable.value = fulfilledValue));
                  },
                  function (error) {
                    "pending" === thenable.status &&
                      ((thenable.status = "rejected"),
                      (thenable.reason = error));
                  }
                )),
            thenable.status)
          ) {
            case "fulfilled":
              return thenable.value;
            case "rejected":
              throw thenable.reason;
          }
      }
      throw thenable;
    }
    function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
      var type = typeof children;
      if ("undefined" === type || "boolean" === type) children = null;
      var invokeCallback = !1;
      if (null === children) invokeCallback = !0;
      else
        switch (type) {
          case "bigint":
          case "string":
          case "number":
            invokeCallback = !0;
            break;
          case "object":
            switch (children.$$typeof) {
              case REACT_ELEMENT_TYPE:
              case REACT_PORTAL_TYPE:
                invokeCallback = !0;
                break;
              case REACT_LAZY_TYPE:
                return (
                  (invokeCallback = children._init),
                  mapIntoArray(
                    invokeCallback(children._payload),
                    array,
                    escapedPrefix,
                    nameSoFar,
                    callback
                  )
                );
            }
        }
      if (invokeCallback) {
        invokeCallback = children;
        callback = callback(invokeCallback);
        var childKey =
          "" === nameSoFar ? "." + getElementKey(invokeCallback, 0) : nameSoFar;
        isArrayImpl(callback)
          ? ((escapedPrefix = ""),
            null != childKey &&
              (escapedPrefix =
                childKey.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
            mapIntoArray(callback, array, escapedPrefix, "", function (c) {
              return c;
            }))
          : null != callback &&
            (isValidElement(callback) &&
              (null != callback.key &&
                ((invokeCallback && invokeCallback.key === callback.key) ||
                  checkKeyStringCoercion(callback.key)),
              (escapedPrefix = cloneAndReplaceKey(
                callback,
                escapedPrefix +
                  (null == callback.key ||
                  (invokeCallback && invokeCallback.key === callback.key)
                    ? ""
                    : ("" + callback.key).replace(
                        userProvidedKeyEscapeRegex,
                        "$&/"
                      ) + "/") +
                  childKey
              )),
              "" !== nameSoFar &&
                null != invokeCallback &&
                isValidElement(invokeCallback) &&
                null == invokeCallback.key &&
                invokeCallback._store &&
                !invokeCallback._store.validated &&
                (escapedPrefix._store.validated = 2),
              (callback = escapedPrefix)),
            array.push(callback));
        return 1;
      }
      invokeCallback = 0;
      childKey = "" === nameSoFar ? "." : nameSoFar + ":";
      if (isArrayImpl(children))
        for (var i = 0; i < children.length; i++)
          (nameSoFar = children[i]),
            (type = childKey + getElementKey(nameSoFar, i)),
            (invokeCallback += mapIntoArray(
              nameSoFar,
              array,
              escapedPrefix,
              type,
              callback
            ));
      else if (((i = getIteratorFn(children)), "function" === typeof i))
        for (
          i === children.entries &&
            (didWarnAboutMaps ||
              console.warn(
                "Using Maps as children is not supported. Use an array of keyed ReactElements instead."
              ),
            (didWarnAboutMaps = !0)),
            children = i.call(children),
            i = 0;
          !(nameSoFar = children.next()).done;

        )
          (nameSoFar = nameSoFar.value),
            (type = childKey + getElementKey(nameSoFar, i++)),
            (invokeCallback += mapIntoArray(
              nameSoFar,
              array,
              escapedPrefix,
              type,
              callback
            ));
      else if ("object" === type) {
        if ("function" === typeof children.then)
          return mapIntoArray(
            resolveThenable(children),
            array,
            escapedPrefix,
            nameSoFar,
            callback
          );
        array = String(children);
        throw Error(
          "Objects are not valid as a React child (found: " +
            ("[object Object]" === array
              ? "object with keys {" + Object.keys(children).join(", ") + "}"
              : array) +
            "). If you meant to render a collection of children, use an array instead."
        );
      }
      return invokeCallback;
    }
    function mapChildren(children, func, context) {
      if (null == children) return children;
      var result = [],
        count = 0;
      mapIntoArray(children, result, "", "", function (child) {
        return func.call(context, child, count++);
      });
      return result;
    }
    function lazyInitializer(payload) {
      if (-1 === payload._status) {
        var ioInfo = payload._ioInfo;
        null != ioInfo && (ioInfo.start = ioInfo.end = performance.now());
        ioInfo = payload._result;
        var thenable = ioInfo();
        thenable.then(
          function (moduleObject) {
            if (0 === payload._status || -1 === payload._status) {
              payload._status = 1;
              payload._result = moduleObject;
              var _ioInfo = payload._ioInfo;
              null != _ioInfo && (_ioInfo.end = performance.now());
              void 0 === thenable.status &&
                ((thenable.status = "fulfilled"),
                (thenable.value = moduleObject));
            }
          },
          function (error) {
            if (0 === payload._status || -1 === payload._status) {
              payload._status = 2;
              payload._result = error;
              var _ioInfo2 = payload._ioInfo;
              null != _ioInfo2 && (_ioInfo2.end = performance.now());
              void 0 === thenable.status &&
                ((thenable.status = "rejected"), (thenable.reason = error));
            }
          }
        );
        ioInfo = payload._ioInfo;
        if (null != ioInfo) {
          ioInfo.value = thenable;
          var displayName = thenable.displayName;
          "string" === typeof displayName && (ioInfo.name = displayName);
        }
        -1 === payload._status &&
          ((payload._status = 0), (payload._result = thenable));
      }
      if (1 === payload._status)
        return (
          (ioInfo = payload._result),
          void 0 === ioInfo &&
            console.error(
              "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n  const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?",
              ioInfo
            ),
          "default" in ioInfo ||
            console.error(
              "lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n  const MyComponent = lazy(() => import('./MyComponent'))",
              ioInfo
            ),
          ioInfo.default
        );
      throw payload._result;
    }
    function resolveDispatcher() {
      var dispatcher = ReactSharedInternals.H;
      null === dispatcher &&
        console.error(
          "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem."
        );
      return dispatcher;
    }
    function releaseAsyncTransition() {
      ReactSharedInternals.asyncTransitions--;
    }
    function enqueueTask(task) {
      if (null === enqueueTaskImpl)
        try {
          var requireString = ("require" + Math.random()).slice(0, 7);
          enqueueTaskImpl = (module && module[requireString]).call(
            module,
            "timers"
          ).setImmediate;
        } catch (_err) {
          enqueueTaskImpl = function (callback) {
            !1 === didWarnAboutMessageChannel &&
              ((didWarnAboutMessageChannel = !0),
              "undefined" === typeof MessageChannel &&
                console.error(
                  "This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
                ));
            var channel = new MessageChannel();
            channel.port1.onmessage = callback;
            channel.port2.postMessage(void 0);
          };
        }
      return enqueueTaskImpl(task);
    }
    function aggregateErrors(errors) {
      return 1 < errors.length && "function" === typeof AggregateError
        ? new AggregateError(errors)
        : errors[0];
    }
    function popActScope(prevActQueue, prevActScopeDepth) {
      prevActScopeDepth !== actScopeDepth - 1 &&
        console.error(
          "You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
        );
      actScopeDepth = prevActScopeDepth;
    }
    function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
      var queue = ReactSharedInternals.actQueue;
      if (null !== queue)
        if (0 !== queue.length)
          try {
            flushActQueue(queue);
            enqueueTask(function () {
              return recursivelyFlushAsyncActWork(returnValue, resolve, reject);
            });
            return;
          } catch (error) {
            ReactSharedInternals.thrownErrors.push(error);
          }
        else ReactSharedInternals.actQueue = null;
      0 < ReactSharedInternals.thrownErrors.length
        ? ((queue = aggregateErrors(ReactSharedInternals.thrownErrors)),
          (ReactSharedInternals.thrownErrors.length = 0),
          reject(queue))
        : resolve(returnValue);
    }
    function flushActQueue(queue) {
      if (!isFlushing) {
        isFlushing = !0;
        var i = 0;
        try {
          for (; i < queue.length; i++) {
            var callback = queue[i];
            do {
              ReactSharedInternals.didUsePromise = !1;
              var continuation = callback(!1);
              if (null !== continuation) {
                if (ReactSharedInternals.didUsePromise) {
                  queue[i] = callback;
                  queue.splice(0, i);
                  return;
                }
                callback = continuation;
              } else break;
            } while (1);
          }
          queue.length = 0;
        } catch (error) {
          queue.splice(0, i + 1), ReactSharedInternals.thrownErrors.push(error);
        } finally {
          isFlushing = !1;
        }
      }
    }
    "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
      "function" ===
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&
      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
    var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
      REACT_PORTAL_TYPE = Symbol.for("react.portal"),
      REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
      REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
      REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
      REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
      REACT_CONTEXT_TYPE = Symbol.for("react.context"),
      REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
      REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
      REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
      REACT_MEMO_TYPE = Symbol.for("react.memo"),
      REACT_LAZY_TYPE = Symbol.for("react.lazy"),
      REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
      MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
      didWarnStateUpdateForUnmountedComponent = {},
      ReactNoopUpdateQueue = {
        isMounted: function () {
          return !1;
        },
        enqueueForceUpdate: function (publicInstance) {
          warnNoop(publicInstance, "forceUpdate");
        },
        enqueueReplaceState: function (publicInstance) {
          warnNoop(publicInstance, "replaceState");
        },
        enqueueSetState: function (publicInstance) {
          warnNoop(publicInstance, "setState");
        }
      },
      assign = Object.assign,
      emptyObject = {};
    Object.freeze(emptyObject);
    Component.prototype.isReactComponent = {};
    Component.prototype.setState = function (partialState, callback) {
      if (
        "object" !== typeof partialState &&
        "function" !== typeof partialState &&
        null != partialState
      )
        throw Error(
          "takes an object of state variables to update or a function which returns an object of state variables."
        );
      this.updater.enqueueSetState(this, partialState, callback, "setState");
    };
    Component.prototype.forceUpdate = function (callback) {
      this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
    };
    var deprecatedAPIs = {
      isMounted: [
        "isMounted",
        "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
      ],
      replaceState: [
        "replaceState",
        "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
      ]
    };
    for (fnName in deprecatedAPIs)
      deprecatedAPIs.hasOwnProperty(fnName) &&
        defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
    ComponentDummy.prototype = Component.prototype;
    deprecatedAPIs = PureComponent.prototype = new ComponentDummy();
    deprecatedAPIs.constructor = PureComponent;
    assign(deprecatedAPIs, Component.prototype);
    deprecatedAPIs.isPureReactComponent = !0;
    var isArrayImpl = Array.isArray,
      REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
      ReactSharedInternals = {
        H: null,
        A: null,
        T: null,
        S: null,
        actQueue: null,
        asyncTransitions: 0,
        isBatchingLegacy: !1,
        didScheduleLegacyUpdate: !1,
        didUsePromise: !1,
        thrownErrors: [],
        getCurrentStack: null,
        recentlyCreatedOwnerStacks: 0
      },
      hasOwnProperty = Object.prototype.hasOwnProperty,
      createTask = console.createTask
        ? console.createTask
        : function () {
            return null;
          };
    deprecatedAPIs = {
      react_stack_bottom_frame: function (callStackForError) {
        return callStackForError();
      }
    };
    var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
    var didWarnAboutElementRef = {};
    var unknownOwnerDebugStack = deprecatedAPIs.react_stack_bottom_frame.bind(
      deprecatedAPIs,
      UnknownOwner
    )();
    var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
    var didWarnAboutMaps = !1,
      userProvidedKeyEscapeRegex = /\/+/g,
      reportGlobalError =
        "function" === typeof reportError
          ? reportError
          : function (error) {
              if (
                "object" === typeof window &&
                "function" === typeof window.ErrorEvent
              ) {
                var event = new window.ErrorEvent("error", {
                  bubbles: !0,
                  cancelable: !0,
                  message:
                    "object" === typeof error &&
                    null !== error &&
                    "string" === typeof error.message
                      ? String(error.message)
                      : String(error),
                  error: error
                });
                if (!window.dispatchEvent(event)) return;
              } else if (
                "object" === typeof process &&
                "function" === typeof process.emit
              ) {
                process.emit("uncaughtException", error);
                return;
              }
              console.error(error);
            },
      didWarnAboutMessageChannel = !1,
      enqueueTaskImpl = null,
      actScopeDepth = 0,
      didWarnNoAwaitAct = !1,
      isFlushing = !1,
      queueSeveralMicrotasks =
        "function" === typeof queueMicrotask
          ? function (callback) {
              queueMicrotask(function () {
                return queueMicrotask(callback);
              });
            }
          : enqueueTask;
    deprecatedAPIs = Object.freeze({
      __proto__: null,
      c: function (size) {
        return resolveDispatcher().useMemoCache(size);
      }
    });
    var fnName = {
      map: mapChildren,
      forEach: function (children, forEachFunc, forEachContext) {
        mapChildren(
          children,
          function () {
            forEachFunc.apply(this, arguments);
          },
          forEachContext
        );
      },
      count: function (children) {
        var n = 0;
        mapChildren(children, function () {
          n++;
        });
        return n;
      },
      toArray: function (children) {
        return (
          mapChildren(children, function (child) {
            return child;
          }) || []
        );
      },
      only: function (children) {
        if (!isValidElement(children))
          throw Error(
            "React.Children.only expected to receive a single React element child."
          );
        return children;
      }
    };
    exports.Activity = REACT_ACTIVITY_TYPE;
    exports.Children = fnName;
    exports.Component = Component;
    exports.Fragment = REACT_FRAGMENT_TYPE;
    exports.Profiler = REACT_PROFILER_TYPE;
    exports.PureComponent = PureComponent;
    exports.StrictMode = REACT_STRICT_MODE_TYPE;
    exports.Suspense = REACT_SUSPENSE_TYPE;
    exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
      ReactSharedInternals;
    exports.__COMPILER_RUNTIME = deprecatedAPIs;
    exports.act = function (callback) {
      var prevActQueue = ReactSharedInternals.actQueue,
        prevActScopeDepth = actScopeDepth;
      actScopeDepth++;
      var queue = (ReactSharedInternals.actQueue =
          null !== prevActQueue ? prevActQueue : []),
        didAwaitActCall = !1;
      try {
        var result = callback();
      } catch (error) {
        ReactSharedInternals.thrownErrors.push(error);
      }
      if (0 < ReactSharedInternals.thrownErrors.length)
        throw (
          (popActScope(prevActQueue, prevActScopeDepth),
          (callback = aggregateErrors(ReactSharedInternals.thrownErrors)),
          (ReactSharedInternals.thrownErrors.length = 0),
          callback)
        );
      if (
        null !== result &&
        "object" === typeof result &&
        "function" === typeof result.then
      ) {
        var thenable = result;
        queueSeveralMicrotasks(function () {
          didAwaitActCall ||
            didWarnNoAwaitAct ||
            ((didWarnNoAwaitAct = !0),
            console.error(
              "You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
            ));
        });
        return {
          then: function (resolve, reject) {
            didAwaitActCall = !0;
            thenable.then(
              function (returnValue) {
                popActScope(prevActQueue, prevActScopeDepth);
                if (0 === prevActScopeDepth) {
                  try {
                    flushActQueue(queue),
                      enqueueTask(function () {
                        return recursivelyFlushAsyncActWork(
                          returnValue,
                          resolve,
                          reject
                        );
                      });
                  } catch (error$0) {
                    ReactSharedInternals.thrownErrors.push(error$0);
                  }
                  if (0 < ReactSharedInternals.thrownErrors.length) {
                    var _thrownError = aggregateErrors(
                      ReactSharedInternals.thrownErrors
                    );
                    ReactSharedInternals.thrownErrors.length = 0;
                    reject(_thrownError);
                  }
                } else resolve(returnValue);
              },
              function (error) {
                popActScope(prevActQueue, prevActScopeDepth);
                0 < ReactSharedInternals.thrownErrors.length
                  ? ((error = aggregateErrors(
                      ReactSharedInternals.thrownErrors
                    )),
                    (ReactSharedInternals.thrownErrors.length = 0),
                    reject(error))
                  : reject(error);
              }
            );
          }
        };
      }
      var returnValue$jscomp$0 = result;
      popActScope(prevActQueue, prevActScopeDepth);
      0 === prevActScopeDepth &&
        (flushActQueue(queue),
        0 !== queue.length &&
          queueSeveralMicrotasks(function () {
            didAwaitActCall ||
              didWarnNoAwaitAct ||
              ((didWarnNoAwaitAct = !0),
              console.error(
                "A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
              ));
          }),
        (ReactSharedInternals.actQueue = null));
      if (0 < ReactSharedInternals.thrownErrors.length)
        throw (
          ((callback = aggregateErrors(ReactSharedInternals.thrownErrors)),
          (ReactSharedInternals.thrownErrors.length = 0),
          callback)
        );
      return {
        then: function (resolve, reject) {
          didAwaitActCall = !0;
          0 === prevActScopeDepth
            ? ((ReactSharedInternals.actQueue = queue),
              enqueueTask(function () {
                return recursivelyFlushAsyncActWork(
                  returnValue$jscomp$0,
                  resolve,
                  reject
                );
              }))
            : resolve(returnValue$jscomp$0);
        }
      };
    };
    exports.cache = function (fn) {
      return function () {
        return fn.apply(null, arguments);
      };
    };
    exports.cacheSignal = function () {
      return null;
    };
    exports.captureOwnerStack = function () {
      var getCurrentStack = ReactSharedInternals.getCurrentStack;
      return null === getCurrentStack ? null : getCurrentStack();
    };
    exports.cloneElement = function (element, config, children) {
      if (null === element || void 0 === element)
        throw Error(
          "The argument must be a React element, but you passed " +
            element +
            "."
        );
      var props = assign({}, element.props),
        key = element.key,
        owner = element._owner;
      if (null != config) {
        var JSCompiler_inline_result;
        a: {
          if (
            hasOwnProperty.call(config, "ref") &&
            (JSCompiler_inline_result = Object.getOwnPropertyDescriptor(
              config,
              "ref"
            ).get) &&
            JSCompiler_inline_result.isReactWarning
          ) {
            JSCompiler_inline_result = !1;
            break a;
          }
          JSCompiler_inline_result = void 0 !== config.ref;
        }
        JSCompiler_inline_result && (owner = getOwner());
        hasValidKey(config) &&
          (checkKeyStringCoercion(config.key), (key = "" + config.key));
        for (propName in config)
          !hasOwnProperty.call(config, propName) ||
            "key" === propName ||
            "__self" === propName ||
            "__source" === propName ||
            ("ref" === propName && void 0 === config.ref) ||
            (props[propName] = config[propName]);
      }
      var propName = arguments.length - 2;
      if (1 === propName) props.children = children;
      else if (1 < propName) {
        JSCompiler_inline_result = Array(propName);
        for (var i = 0; i < propName; i++)
          JSCompiler_inline_result[i] = arguments[i + 2];
        props.children = JSCompiler_inline_result;
      }
      props = ReactElement(
        element.type,
        key,
        props,
        owner,
        element._debugStack,
        element._debugTask
      );
      for (key = 2; key < arguments.length; key++)
        validateChildKeys(arguments[key]);
      return props;
    };
    exports.createContext = function (defaultValue) {
      defaultValue = {
        $$typeof: REACT_CONTEXT_TYPE,
        _currentValue: defaultValue,
        _currentValue2: defaultValue,
        _threadCount: 0,
        Provider: null,
        Consumer: null
      };
      defaultValue.Provider = defaultValue;
      defaultValue.Consumer = {
        $$typeof: REACT_CONSUMER_TYPE,
        _context: defaultValue
      };
      defaultValue._currentRenderer = null;
      defaultValue._currentRenderer2 = null;
      return defaultValue;
    };
    exports.createElement = function (type, config, children) {
      for (var i = 2; i < arguments.length; i++)
        validateChildKeys(arguments[i]);
      i = {};
      var key = null;
      if (null != config)
        for (propName in (didWarnAboutOldJSXRuntime ||
          !("__self" in config) ||
          "key" in config ||
          ((didWarnAboutOldJSXRuntime = !0),
          console.warn(
            "Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
          )),
        hasValidKey(config) &&
          (checkKeyStringCoercion(config.key), (key = "" + config.key)),
        config))
          hasOwnProperty.call(config, propName) &&
            "key" !== propName &&
            "__self" !== propName &&
            "__source" !== propName &&
            (i[propName] = config[propName]);
      var childrenLength = arguments.length - 2;
      if (1 === childrenLength) i.children = children;
      else if (1 < childrenLength) {
        for (
          var childArray = Array(childrenLength), _i = 0;
          _i < childrenLength;
          _i++
        )
          childArray[_i] = arguments[_i + 2];
        Object.freeze && Object.freeze(childArray);
        i.children = childArray;
      }
      if (type && type.defaultProps)
        for (propName in ((childrenLength = type.defaultProps), childrenLength))
          void 0 === i[propName] && (i[propName] = childrenLength[propName]);
      key &&
        defineKeyPropWarningGetter(
          i,
          "function" === typeof type
            ? type.displayName || type.name || "Unknown"
            : type
        );
      var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
      return ReactElement(
        type,
        key,
        i,
        getOwner(),
        propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
        propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
      );
    };
    exports.createRef = function () {
      var refObject = { current: null };
      Object.seal(refObject);
      return refObject;
    };
    exports.forwardRef = function (render) {
      null != render && render.$$typeof === REACT_MEMO_TYPE
        ? console.error(
            "forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
          )
        : "function" !== typeof render
          ? console.error(
              "forwardRef requires a render function but was given %s.",
              null === render ? "null" : typeof render
            )
          : 0 !== render.length &&
            2 !== render.length &&
            console.error(
              "forwardRef render functions accept exactly two parameters: props and ref. %s",
              1 === render.length
                ? "Did you forget to use the ref parameter?"
                : "Any additional parameter will be undefined."
            );
      null != render &&
        null != render.defaultProps &&
        console.error(
          "forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
        );
      var elementType = { $$typeof: REACT_FORWARD_REF_TYPE, render: render },
        ownName;
      Object.defineProperty(elementType, "displayName", {
        enumerable: !1,
        configurable: !0,
        get: function () {
          return ownName;
        },
        set: function (name) {
          ownName = name;
          render.name ||
            render.displayName ||
            (Object.defineProperty(render, "name", { value: name }),
            (render.displayName = name));
        }
      });
      return elementType;
    };
    exports.isValidElement = isValidElement;
    exports.lazy = function (ctor) {
      ctor = { _status: -1, _result: ctor };
      var lazyType = {
          $$typeof: REACT_LAZY_TYPE,
          _payload: ctor,
          _init: lazyInitializer
        },
        ioInfo = {
          name: "lazy",
          start: -1,
          end: -1,
          value: null,
          owner: null,
          debugStack: Error("react-stack-top-frame"),
          debugTask: console.createTask ? console.createTask("lazy()") : null
        };
      ctor._ioInfo = ioInfo;
      lazyType._debugInfo = [{ awaited: ioInfo }];
      return lazyType;
    };
    exports.memo = function (type, compare) {
      null == type &&
        console.error(
          "memo: The first argument must be a component. Instead received: %s",
          null === type ? "null" : typeof type
        );
      compare = {
        $$typeof: REACT_MEMO_TYPE,
        type: type,
        compare: void 0 === compare ? null : compare
      };
      var ownName;
      Object.defineProperty(compare, "displayName", {
        enumerable: !1,
        configurable: !0,
        get: function () {
          return ownName;
        },
        set: function (name) {
          ownName = name;
          type.name ||
            type.displayName ||
            (Object.defineProperty(type, "name", { value: name }),
            (type.displayName = name));
        }
      });
      return compare;
    };
    exports.startTransition = function (scope) {
      var prevTransition = ReactSharedInternals.T,
        currentTransition = {};
      currentTransition._updatedFibers = new Set();
      ReactSharedInternals.T = currentTransition;
      try {
        var returnValue = scope(),
          onStartTransitionFinish = ReactSharedInternals.S;
        null !== onStartTransitionFinish &&
          onStartTransitionFinish(currentTransition, returnValue);
        "object" === typeof returnValue &&
          null !== returnValue &&
          "function" === typeof returnValue.then &&
          (ReactSharedInternals.asyncTransitions++,
          returnValue.then(releaseAsyncTransition, releaseAsyncTransition),
          returnValue.then(noop, reportGlobalError));
      } catch (error) {
        reportGlobalError(error);
      } finally {
        null === prevTransition &&
          currentTransition._updatedFibers &&
          ((scope = currentTransition._updatedFibers.size),
          currentTransition._updatedFibers.clear(),
          10 < scope &&
            console.warn(
              "Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
            )),
          null !== prevTransition &&
            null !== currentTransition.types &&
            (null !== prevTransition.types &&
              prevTransition.types !== currentTransition.types &&
              console.error(
                "We expected inner Transitions to have transferred the outer types set and that you cannot add to the outer Transition while inside the inner.This is a bug in React."
              ),
            (prevTransition.types = currentTransition.types)),
          (ReactSharedInternals.T = prevTransition);
      }
    };
    exports.unstable_useCacheRefresh = function () {
      return resolveDispatcher().useCacheRefresh();
    };
    exports.use = function (usable) {
      return resolveDispatcher().use(usable);
    };
    exports.useActionState = function (action, initialState, permalink) {
      return resolveDispatcher().useActionState(
        action,
        initialState,
        permalink
      );
    };
    exports.useCallback = function (callback, deps) {
      return resolveDispatcher().useCallback(callback, deps);
    };
    exports.useContext = function (Context) {
      var dispatcher = resolveDispatcher();
      Context.$$typeof === REACT_CONSUMER_TYPE &&
        console.error(
          "Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
        );
      return dispatcher.useContext(Context);
    };
    exports.useDebugValue = function (value, formatterFn) {
      return resolveDispatcher().useDebugValue(value, formatterFn);
    };
    exports.useDeferredValue = function (value, initialValue) {
      return resolveDispatcher().useDeferredValue(value, initialValue);
    };
    exports.useEffect = function (create, deps) {
      null == create &&
        console.warn(
          "React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
        );
      return resolveDispatcher().useEffect(create, deps);
    };
    exports.useEffectEvent = function (callback) {
      return resolveDispatcher().useEffectEvent(callback);
    };
    exports.useId = function () {
      return resolveDispatcher().useId();
    };
    exports.useImperativeHandle = function (ref, create, deps) {
      return resolveDispatcher().useImperativeHandle(ref, create, deps);
    };
    exports.useInsertionEffect = function (create, deps) {
      null == create &&
        console.warn(
          "React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
        );
      return resolveDispatcher().useInsertionEffect(create, deps);
    };
    exports.useLayoutEffect = function (create, deps) {
      null == create &&
        console.warn(
          "React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
        );
      return resolveDispatcher().useLayoutEffect(create, deps);
    };
    exports.useMemo = function (create, deps) {
      return resolveDispatcher().useMemo(create, deps);
    };
    exports.useOptimistic = function (passthrough, reducer) {
      return resolveDispatcher().useOptimistic(passthrough, reducer);
    };
    exports.useReducer = function (reducer, initialArg, init) {
      return resolveDispatcher().useReducer(reducer, initialArg, init);
    };
    exports.useRef = function (initialValue) {
      return resolveDispatcher().useRef(initialValue);
    };
    exports.useState = function (initialState) {
      return resolveDispatcher().useState(initialState);
    };
    exports.useSyncExternalStore = function (
      subscribe,
      getSnapshot,
      getServerSnapshot
    ) {
      return resolveDispatcher().useSyncExternalStore(
        subscribe,
        getSnapshot,
        getServerSnapshot
      );
    };
    exports.useTransition = function () {
      return resolveDispatcher().useTransition();
    };
    exports.version = "19.2.0";
    "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
      "function" ===
        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
  })();


/***/ }),

/***/ "./node_modules/react/index.js":
/*!*************************************!*\
  !*** ./node_modules/react/index.js ***!
  \*************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

"use strict";


if (false) // removed by dead control flow
{} else {
  module.exports = __webpack_require__(/*! ./cjs/react.development.js */ "./node_modules/react/cjs/react.development.js");
}


/***/ }),

/***/ "./src/common/browserApi.js":
/*!**********************************!*\
  !*** ./src/common/browserApi.js ***!
  \**********************************/
/***/ ((module) => {

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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var BrowserApi = /*#__PURE__*/function () {
  function BrowserApi() {
    var _this = this;
    _classCallCheck(this, BrowserApi);
    _defineProperty(this, "isFireFoxBrowser", function () {
      return _this.isFirefox;
    });
    var api = null;
    if (typeof browser !== 'undefined' && browser.runtime && browser.runtime.sendMessage) {
      api = browser;
    } else if (typeof chrome !== 'undefined' && chrome.runtime && chrome.runtime.sendMessage) {
      api = chrome;
    } else {
      throw new Error('Browser API is not available');
    }
    if (!api || !api.runtime) {
      throw new Error('Browser API not available');
    }
    this._api = api;
    this.isFirefox = typeof browser !== 'undefined' && browser.runtime && typeof browser.runtime.getBrowserInfo === 'function';
    this.runtime = this._api.runtime;
    this.storage = this._api.storage;
    this.proxy = this._api.proxy || undefined;
    this.webRequest = this._api.webRequest || undefined;
    this.webNavigation = this._api.webNavigation || undefined;
    this.notifications = this._api.notifications || undefined;
    this.tabs = this._api.tabs || undefined;
    this.windows = this._api.windows || undefined;
    this.privacy = this._api.privacy || undefined;
    this.action = typeof browser !== 'undefined' ? browser.action || browser.browserAction : chrome.action || chrome.browserAction;
    this.alarms = this._api.alarms || undefined;
    this.scripting = this._api.scripting || undefined;
    this.declarativeNetRequest = this._api.declarativeNetRequest || undefined;
    this.i18n = this._api.i18n || undefined;
    this.management = this._api.management || undefined;
    this.contextMenus = this._api.contextMenus || undefined;
    this.browsingData = this._api.browsingData || undefined;
    this.permissions = this._api.permissions || undefined;
  }
  return _createClass(BrowserApi, [{
    key: "getBrowser",
    value: function getBrowser() {
      if (this.isFirefox) return 'firefox';
      if (navigator.userAgent.includes('Edg')) return 'edge';
      return 'chrome';
    }
  }, {
    key: "registerProxyErrorListener",
    value: function registerProxyErrorListener(callback) {
      if (this.getBrowser() === 'chrome') {
        if (this.proxy && typeof this.proxy.onProxyError === 'function') {
          this.proxy.onProxyError.addListener(callback);
        }
      } else {
        if (this.webRequest && typeof this.webRequest.onErrorOccurred === 'function') {
          this.webRequest.onErrorOccurred.addListener(function (details) {
            if (details.error && (details.error.includes('NS_ERROR_PROXY') || details.error.includes('proxy'))) {
              callback({
                fatal: true,
                error: details.error
              });
            }
          }, {
            urls: ['<all_urls>']
          });
        }
      }
    }
  }]);
}();
var browserApi;
try {
  browserApi = new BrowserApi();
} catch (error) {
  throw error;
}
module.exports = browserApi;

/***/ }),

/***/ "./src/common/browser_storages/browser_storage.js":
/*!********************************************************!*\
  !*** ./src/common/browser_storages/browser_storage.js ***!
  \********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");

/**
 * Promisified browserApi.storage.local.get
 * @param {string | string[]} keys
 * @returns {Promise<Object>}
 */
var getStorageAsync = function getStorageAsync(keys) {
  return new Promise(function (resolve) {
    return browserApi.storage.local.get(keys, resolve);
  });
};

/**
 * Promisified browserApi.storage.local.set
 * @param {Object} data
 * @returns {Promise<void>}
 */
var setStorageAsync = function setStorageAsync(data) {
  return new Promise(function (resolve) {
    return browserApi.storage.local.set(data, resolve);
  });
};

/**
 * Promisified browserApi.storage.local.remove
 * @param {string | string[]} keys
 * @returns {Promise<void>}
 */
var removeStorageAsync = function removeStorageAsync(keys) {
  return new Promise(function (resolve) {
    return browserApi.storage.local.remove(keys, resolve);
  });
};

/**
 * Promisified browserApi.storage.local.get
 * @param {string | string[]} keys
 * @param {callback} callback
 * @returns {Promise<Object>}
 */
var getStorage = function getStorage(keys) {
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
  return browserApi.storage.local.get(keys, callback);
};

/**
 * Promisified browserApi.storage.local.set
 * @param {Object} data
 * @param {callback} callback
 * @returns {Promise<void>}
 */
var setStorage = function setStorage(data) {
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
  return browserApi.storage.local.set(data, callback);
};

/**
 * Non-promisified browserApi.storage.local.remove
 * @param {string | string[]} keys
 * @param {Function} callback
 */
var removeStorage = function removeStorage(keys) {
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
  return browserApi.storage.local.remove(keys, callback);
};
module.exports = {
  getStorage: getStorage,
  getStorageAsync: getStorageAsync,
  setStorage: setStorage,
  setStorageAsync: setStorageAsync,
  removeStorage: removeStorage,
  removeStorageAsync: removeStorageAsync
};

/***/ }),

/***/ "./src/common/functions/apiGatewaysForCity.js":
/*!****************************************************!*\
  !*** ./src/common/functions/apiGatewaysForCity.js ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   checkApiGatewayMain: () => (/* binding */ checkApiGatewayMain),
/* harmony export */   getApiGatewaysForCity: () => (/* binding */ getApiGatewaysForCity)
/* harmony export */ });
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
function getApiGatewaysForCity(_x, _x2) {
  return _getApiGatewaysForCity.apply(this, arguments);
}
function _getApiGatewaysForCity() {
  _getApiGatewaysForCity = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(cityInfo, isReconnect) {
    var apiGateways, sortedCityGateways, apiGatewayMain, apiGatewayForCity;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return StorageService.getApiGateways();
        case 1:
          apiGateways = _context.v;
          if (!(!cityInfo || !cityInfo.api_gateways)) {
            _context.n = 3;
            break;
          }
          if (isReconnect) {
            _context.n = 2;
            break;
          }
          _context.n = 2;
          return checkApiGatewayMain();
        case 2:
          return _context.a(2, apiGateways);
        case 3:
          sortedCityGateways = cityInfo.api_gateways.sort(function (a, b) {
            var indexA = apiGateways.indexOf(a);
            var indexB = apiGateways.indexOf(b);
            if (indexA !== -1 && indexB !== -1) {
              return indexA - indexB;
            }
            if (indexA !== -1) return -1;
            if (indexB !== -1) return 1;
            return 0;
          });
          if (isReconnect) {
            _context.n = 6;
            break;
          }
          _context.n = 4;
          return StorageService.getApiGatewayMain();
        case 4:
          apiGatewayMain = _context.v;
          if (!(sortedCityGateways[0] && apiGatewayMain === sortedCityGateways[0])) {
            _context.n = 5;
            break;
          }
          return _context.a(2, sortedCityGateways);
        case 5:
          apiGatewayForCity = sortedCityGateways[0];
          _context.n = 6;
          return StorageService.saveApiGatewayMain(apiGatewayForCity);
        case 6:
          return _context.a(2, sortedCityGateways);
      }
    }, _callee);
  }));
  return _getApiGatewaysForCity.apply(this, arguments);
}
function checkApiGatewayMain() {
  return _checkApiGatewayMain.apply(this, arguments);
}
function _checkApiGatewayMain() {
  _checkApiGatewayMain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var apiGateways, apiGatewayMain, settings;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          _context2.n = 1;
          return StorageService.getApiGateways();
        case 1:
          apiGateways = _context2.v;
          _context2.n = 2;
          return StorageService.getApiGatewayMain();
        case 2:
          apiGatewayMain = _context2.v;
          _context2.n = 3;
          return StorageService.getSettings();
        case 3:
          settings = _context2.v;
          if (!(settings && settings.changeApiGateway && settings.selectedApiGateway)) {
            _context2.n = 5;
            break;
          }
          _context2.n = 4;
          return StorageService.saveApiGatewayMain(settings.selectedApiGateway);
        case 4:
          return _context2.a(2);
        case 5:
          if (!(apiGateways[0] && apiGatewayMain !== apiGateways[0])) {
            _context2.n = 6;
            break;
          }
          _context2.n = 6;
          return StorageService.saveApiGatewayMain(apiGateways[0]);
        case 6:
          return _context2.a(2);
      }
    }, _callee2);
  }));
  return _checkApiGatewayMain.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/functions/checkApiGatewaysReconnect.js":
/*!***********************************************************!*\
  !*** ./src/common/functions/checkApiGatewaysReconnect.js ***!
  \***********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var config = __webpack_require__(/*! ../../../config */ "./config.js");
function selectNextApiGatewayMain() {
  return _selectNextApiGatewayMain.apply(this, arguments);
}
function _selectNextApiGatewayMain() {
  _selectNextApiGatewayMain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var apiGatewaysForCity,
      apiGatewayMain,
      isExistApiGatewaysForCity,
      apiGateways,
      index,
      apiGatewayMainNew,
      _args = arguments,
      _t,
      _t2;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          apiGatewaysForCity = _args.length > 0 && _args[0] !== undefined ? _args[0] : [];
          apiGatewayMain = _args.length > 1 && _args[1] !== undefined ? _args[1] : '';
          _context.n = 1;
          return StorageService.getIsApiGatewayMainAfterCheck();
        case 1:
          if (!_context.v) {
            _context.n = 2;
            break;
          }
          return _context.a(2, false);
        case 2:
          isExistApiGatewaysForCity = apiGatewaysForCity && apiGatewaysForCity.length;
          if (!apiGatewayMain) {
            _context.n = 3;
            break;
          }
          _t = apiGatewayMain;
          _context.n = 5;
          break;
        case 3:
          _context.n = 4;
          return StorageService.getApiGatewayMain();
        case 4:
          _t = _context.v;
        case 5:
          apiGatewayMain = _t;
          if (!isExistApiGatewaysForCity) {
            _context.n = 6;
            break;
          }
          _t2 = apiGatewaysForCity;
          _context.n = 8;
          break;
        case 6:
          _context.n = 7;
          return StorageService.getApiGateways();
        case 7:
          _t2 = _context.v;
        case 8:
          apiGateways = _t2;
          _context.n = 9;
          return checkApiGatewaysReconnect(apiGateways, apiGatewayMain);
        case 9:
          if (_context.v) {
            _context.n = 10;
            break;
          }
          return _context.a(2, false);
        case 10:
          _context.n = 11;
          return StorageService.getIsApiGatewayMainAfterCheck();
        case 11:
          if (!_context.v) {
            _context.n = 12;
            break;
          }
          return _context.a(2, true);
        case 12:
          if (!(apiGateways && apiGateways.length)) {
            _context.n = 15;
            break;
          }
          index = apiGateways.indexOf(apiGatewayMain) + 1;
          if (!(apiGateways.length <= apiGateways.indexOf(apiGatewayMain) + 1)) {
            _context.n = 13;
            break;
          }
          return _context.a(2, false);
        case 13:
          apiGatewayMainNew = apiGateways[index];
          if (!apiGatewayMainNew) {
            _context.n = 15;
            break;
          }
          _context.n = 14;
          return StorageService.saveApiGatewayMain(apiGatewayMainNew);
        case 14:
          return _context.a(2, true);
        case 15:
          return _context.a(2, false);
      }
    }, _callee);
  }));
  return _selectNextApiGatewayMain.apply(this, arguments);
}
function checkApiGatewaysReconnect(_x, _x2) {
  return _checkApiGatewaysReconnect.apply(this, arguments);
}
function _checkApiGatewaysReconnect() {
  _checkApiGatewaysReconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(apiGateways, apiGatewayMain) {
    var startIndex, endIndex, apiGatewayMainNew;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          startIndex = apiGateways.indexOf(apiGatewayMain) >= 0 ? apiGateways.indexOf(apiGatewayMain) + 1 : 0;
          endIndex = config.MAX_GATEWAYS_TO_CHECK;
          if (!(startIndex >= endIndex)) {
            _context2.n = 6;
            break;
          }
          _context2.n = 1;
          return StorageService.getApiGateways();
        case 1:
          apiGateways = _context2.v;
          if (apiGateways) {
            _context2.n = 2;
            break;
          }
          return _context2.a(2, false);
        case 2:
          apiGatewayMainNew = apiGateways[0];
          if (!apiGatewayMainNew) {
            _context2.n = 5;
            break;
          }
          _context2.n = 3;
          return StorageService.saveIsApiGatewayMainAfterCheck(true);
        case 3:
          _context2.n = 4;
          return StorageService.saveApiGatewayMain(apiGatewayMainNew);
        case 4:
          return _context2.a(2, true);
        case 5:
          return _context2.a(2, false);
        case 6:
          return _context2.a(2, true);
      }
    }, _callee2);
  }));
  return _checkApiGatewaysReconnect.apply(this, arguments);
}
module.exports = {
  selectNextApiGatewayMain: selectNextApiGatewayMain
};

/***/ }),

/***/ "./src/common/functions/checkDomains.js":
/*!**********************************************!*\
  !*** ./src/common/functions/checkDomains.js ***!
  \**********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   checkDomains: () => (/* binding */ checkDomains)
/* harmony export */ });
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_services_ApiClient__WEBPACK_IMPORTED_MODULE_1__);
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }


function checkDomains() {
  return _checkDomains.apply(this, arguments);
}
function _checkDomains() {
  _checkDomains = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var domain;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getApiGatewayMain();
        case 1:
          domain = _context.v;
          if (domain) {
            _context.n = 2;
            break;
          }
          _context.n = 2;
          return _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default().getApiGateways();
        case 2:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _checkDomains.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/functions/checkSubscriptions.js":
/*!****************************************************!*\
  !*** ./src/common/functions/checkSubscriptions.js ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   checkSubscriptionStatus: () => (/* binding */ checkSubscriptionStatus),
/* harmony export */   getSubscriptionStatus: () => (/* binding */ getSubscriptionStatus),
/* harmony export */   initSubscriptionChecker: () => (/* binding */ initSubscriptionChecker),
/* harmony export */   updateSubscriptionData: () => (/* binding */ updateSubscriptionData),
/* harmony export */   updateSubscriptionOnce: () => (/* binding */ updateSubscriptionOnce)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _context_LanguageContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @context/LanguageContext */ "./src/context/LanguageContext.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_services_ApiClient__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _services_LogsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js");
/* harmony import */ var _sw_constants_statuses_constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js");
/* harmony import */ var _sw_tools_proxy_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js");
/* harmony import */ var _sw_tools_proxy_utils__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_sw_tools_proxy_utils__WEBPACK_IMPORTED_MODULE_6__);
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }







var subscriptionTimeout = null;
var subscriptionRetryInterval = null;
var MAX_TIMEOUT_MS = 2147483647;
function getSubscriptionStatus(subscriptionDate) {
  var isRecurring = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  var isTrial = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  var _useContext = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context_LanguageContext__WEBPACK_IMPORTED_MODULE_1__["default"]),
    t = _useContext.t;
  if (isTrial && !subscriptionDate) {
    return '';
  }
  if (!subscriptionDate) {
    return t('subscription_expired');
  }
  var date = new Date();
  var subscription = new Date(subscriptionDate);
  var currentDate = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
  if (subscription <= currentDate) {
    return t('subscription_expired');
  }
  var timeDiff = subscription - currentDate;
  var daysDiff = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
  if (!isRecurring && daysDiff <= 3) {
    if (daysDiff === 0) {
      return t('expires_today');
    }
    if (daysDiff === 1) {
      return t('expires_tomorrow');
    }
    return t('expires_in_days').replace('{day}', daysDiff);
  }
  return '';
}
function checkSubscriptionStatus(subscriptionDate) {
  if (!subscriptionDate) {
    return false;
  }
  var currentDate = new Date();
  var subscription = new Date(subscriptionDate);
  return subscription > currentDate;
}
function initSubscriptionChecker() {
  return _initSubscriptionChecker.apply(this, arguments);
}
function _initSubscriptionChecker() {
  _initSubscriptionChecker = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
    var _userData$subscriptio, userData, subscriptionExpDate, now, exp, diffMs, _t;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.p = _context4.n) {
        case 0:
          _context4.p = 0;
          _context4.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getUserData();
        case 1:
          userData = _context4.v;
          subscriptionExpDate = userData === null || userData === void 0 || (_userData$subscriptio = userData.subscription_info) === null || _userData$subscriptio === void 0 ? void 0 : _userData$subscriptio.subscription_exp_date;
          now = new Date();
          exp = subscriptionExpDate ? new Date(subscriptionExpDate) : new Date();
          diffMs = exp - now;
          if (!(diffMs <= 0)) {
            _context4.n = 2;
            break;
          }
          if (subscriptionTimeout) clearTimeout(subscriptionTimeout);
          if (subscriptionRetryInterval) clearInterval(subscriptionRetryInterval);
          return _context4.a(2);
        case 2:
          if (subscriptionTimeout) clearTimeout(subscriptionTimeout);
          if (!(diffMs > MAX_TIMEOUT_MS)) {
            _context4.n = 3;
            break;
          }
          subscriptionTimeout = setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
            return _regenerator().w(function (_context) {
              while (1) switch (_context.n) {
                case 0:
                  _context.n = 1;
                  return initSubscriptionChecker();
                case 1:
                  return _context.a(2);
              }
            }, _callee);
          })), MAX_TIMEOUT_MS);
          return _context4.a(2);
        case 3:
          if (subscriptionTimeout) clearTimeout(subscriptionTimeout);
          subscriptionTimeout = setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
            var isUpdated;
            return _regenerator().w(function (_context3) {
              while (1) switch (_context3.n) {
                case 0:
                  _context3.n = 1;
                  return updateSubscriptionOnce();
                case 1:
                  isUpdated = _context3.v;
                  if (isUpdated) {
                    _context3.n = 2;
                    break;
                  }
                  if (subscriptionRetryInterval) clearInterval(subscriptionRetryInterval);
                  subscriptionRetryInterval = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
                    var retryUpdated;
                    return _regenerator().w(function (_context2) {
                      while (1) switch (_context2.n) {
                        case 0:
                          _context2.n = 1;
                          return updateSubscriptionOnce();
                        case 1:
                          retryUpdated = _context2.v;
                          if (retryUpdated) {
                            clearInterval(subscriptionRetryInterval);
                            subscriptionRetryInterval = null;
                          }
                        case 2:
                          return _context2.a(2);
                      }
                    }, _callee2);
                  })), 60 * 1000);
                  _context3.n = 3;
                  break;
                case 2:
                  _context3.n = 3;
                  return initSubscriptionChecker();
                case 3:
                  return _context3.a(2);
              }
            }, _callee3);
          })), diffMs);
          _context4.n = 5;
          break;
        case 4:
          _context4.p = 4;
          _t = _context4.v;
          _context4.n = 5;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addEvents('action.error_init_subscription_checker', _t);
        case 5:
          return _context4.a(2);
      }
    }, _callee4, null, [[0, 4]]);
  }));
  return _initSubscriptionChecker.apply(this, arguments);
}
function updateSubscriptionOnce() {
  return _updateSubscriptionOnce.apply(this, arguments);
}
function _updateSubscriptionOnce() {
  _updateSubscriptionOnce = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
    var _response$data, _newUserData$subscrip, token, response, newUserData, updatedExpDate, updatedHasActive, stillActive, proxyStatus, _t2;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.p = _context5.n) {
        case 0:
          _context5.p = 0;
          _context5.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getToken();
        case 1:
          token = _context5.v;
          _context5.n = 2;
          return _services_ApiClient__WEBPACK_IMPORTED_MODULE_3___default().validateTokenWithData(token);
        case 2:
          response = _context5.v;
          newUserData = response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.data;
          if (newUserData) {
            _context5.n = 3;
            break;
          }
          return _context5.a(2, false);
        case 3:
          _context5.n = 4;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveUserData(newUserData);
        case 4:
          updatedExpDate = newUserData === null || newUserData === void 0 || (_newUserData$subscrip = newUserData.subscription_info) === null || _newUserData$subscrip === void 0 ? void 0 : _newUserData$subscrip.subscription_exp_date;
          updatedHasActive = newUserData === null || newUserData === void 0 ? void 0 : newUserData.has_active_subscription;
          stillActive = checkSubscriptionStatus(updatedExpDate);
          if (!(!updatedHasActive || !stillActive)) {
            _context5.n = 7;
            break;
          }
          _context5.n = 5;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getProxyStatus();
        case 5:
          proxyStatus = _context5.v;
          if (!(proxyStatus === _sw_constants_statuses_constants__WEBPACK_IMPORTED_MODULE_5__.PROXY_STATUSES.CONNECT)) {
            _context5.n = 7;
            break;
          }
          _context5.n = 6;
          return (0,_sw_tools_proxy_utils__WEBPACK_IMPORTED_MODULE_6__.handleDisconnect)(function () {});
        case 6:
          _context5.n = 7;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addEvents('action.disconnect_by_subscription_expired');
        case 7:
          return _context5.a(2, true);
        case 8:
          _context5.p = 8;
          _t2 = _context5.v;
          _context5.n = 9;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addEvents('action.error_updating_subscription', _t2);
        case 9:
          return _context5.a(2, false);
      }
    }, _callee5, null, [[0, 8]]);
  }));
  return _updateSubscriptionOnce.apply(this, arguments);
}
function updateSubscriptionData() {
  return _updateSubscriptionData.apply(this, arguments);
}
function _updateSubscriptionData() {
  _updateSubscriptionData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
    var subscriptionExpDate,
      userData,
      subscription_info,
      subscriptionInfo,
      newSubscriptionInfo,
      _args6 = arguments;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.n) {
        case 0:
          subscriptionExpDate = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : '';
          _context6.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getUserData();
        case 1:
          userData = _context6.v;
          if (checkSubscriptionStatus(subscriptionExpDate)) {
            _context6.n = 3;
            break;
          }
          subscription_info = {
            is_recurring: false,
            max_connection: 0,
            subscription_exp_date: ""
          };
          _context6.n = 2;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveUserData(_objectSpread(_objectSpread({}, userData), {}, {
            has_active_subscription: false,
            subscription_info: subscription_info
          }));
        case 2:
          return _context6.a(2);
        case 3:
          subscriptionInfo = userData === null || userData === void 0 ? void 0 : userData.subscription_info;
          newSubscriptionInfo = _objectSpread(_objectSpread({}, subscriptionInfo), {}, {
            subscription_exp_date: subscriptionExpDate
          });
          _context6.n = 4;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveUserData(_objectSpread(_objectSpread({}, userData), {}, {
            has_active_subscription: true,
            subscription_info: newSubscriptionInfo
          }));
        case 4:
          return _context6.a(2);
      }
    }, _callee6);
  }));
  return _updateSubscriptionData.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/functions/checkUpdateExtension.js":
/*!******************************************************!*\
  !*** ./src/common/functions/checkUpdateExtension.js ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   checkUpdateExtension: () => (/* binding */ checkUpdateExtension)
/* harmony export */ });
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
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 asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! @sw/main/auth */ "./src/sw/main/auth.js"),
  handleTokenReceived = _require.handleTokenReceived;
var _require2 = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js"),
  checkManualCancelConnectAndDisconnectWithForce = _require2.checkManualCancelConnectAndDisconnectWithForce,
  disconnectProxyWithUpdateState = _require2.disconnectProxyWithUpdateState;
var _require3 = __webpack_require__(/*! @sw/settings_services/pause_service */ "./src/sw/settings_services/pause_service.js"),
  handleDeletePause = _require3.handleDeletePause;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
function checkUpdateExtension() {
  browserApi.runtime.onInstalled.addListener(/*#__PURE__*/function () {
    var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(details) {
      var authData, currentVersion, statusResult, settings, pauseSettings, loadConnect, currentProxy;
      return _regenerator().w(function (_context) {
        while (1) switch (_context.n) {
          case 0:
            if (!(details.reason === 'update')) {
              _context.n = 20;
              break;
            }
            _context.n = 1;
            return StorageService.getAuthData();
          case 1:
            authData = _context.v;
            if (authData.loggedIn) {
              _context.n = 2;
              break;
            }
            return _context.a(2);
          case 2:
            currentVersion = browserApi.runtime.getManifest().version;
            _context.n = 3;
            return LogsService.addEvents("action.check_extension_after_update", {
              previousVersion: details.previousVersion,
              currentVersion: currentVersion
            });
          case 3:
            _context.n = 4;
            return handleTokenReceived(authData.jwt, authData.refresh_token, function () {});
          case 4:
            statusResult = _context.v;
            _context.n = 5;
            return LogsService.addEvents("action.check_state_extension_after_update", {
              previousVersion: details.previousVersion,
              currentVersion: currentVersion,
              statusResult: statusResult
            });
          case 5:
            if (statusResult) {
              _context.n = 20;
              break;
            }
            _context.n = 6;
            return StorageService.getSettings();
          case 6:
            settings = _context.v;
            _context.n = 7;
            return StorageService.getPauseSetting();
          case 7:
            pauseSettings = _context.v;
            _context.n = 8;
            return StorageService.getLoadConnectStatus();
          case 8:
            loadConnect = _context.v;
            _context.n = 9;
            return StorageService.getCurrentProxy();
          case 9:
            currentProxy = _context.v;
            if (!loadConnect) {
              _context.n = 12;
              break;
            }
            _context.n = 10;
            return StorageService.saveCancelConnect(true);
          case 10:
            _context.n = 11;
            return checkManualCancelConnectAndDisconnectWithForce();
          case 11:
            _context.n = 13;
            break;
          case 12:
            if (!currentProxy) {
              _context.n = 13;
              break;
            }
            _context.n = 13;
            return disconnectProxyWithUpdateState();
          case 13:
            _context.n = 14;
            return LogsService.addEvents("action.disconnect_after_state_extension_after_update", {
              previousVersion: details.previousVersion,
              currentVersion: currentVersion,
              statusResult: statusResult
            });
          case 14:
            if (!(settings !== null && settings !== void 0 && settings.autoConnect)) {
              _context.n = 16;
              break;
            }
            _context.n = 15;
            return StorageService.saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
              autoConnect: false
            }));
          case 15:
            _context.n = 16;
            return LogsService.addEvents("action.disable_autoconnect_after_state_extension_after_update", {
              previousVersion: details.previousVersion,
              currentVersion: currentVersion,
              statusResult: statusResult
            });
          case 16:
            if (!(pauseSettings !== null && pauseSettings !== void 0 && pauseSettings.pause)) {
              _context.n = 18;
              break;
            }
            _context.n = 17;
            return handleDeletePause(function () {});
          case 17:
            _context.n = 18;
            return LogsService.addEvents("action.delete_pause_after_state_extension_after_update", {
              previousVersion: details.previousVersion,
              currentVersion: currentVersion,
              statusResult: statusResult
            });
          case 18:
            _context.n = 19;
            return handleTokenReceived(authData.jwt, authData.refresh_token, function () {});
          case 19:
            statusResult = _context.v;
            _context.n = 20;
            return LogsService.addEvents("action.check_state_after_disconnect_extension_after_update", {
              previousVersion: details.previousVersion,
              currentVersion: currentVersion,
              statusResult: statusResult
            });
          case 20:
            return _context.a(2);
        }
      }, _callee);
    }));
    return function (_x) {
      return _ref.apply(this, arguments);
    };
  }());
}

/***/ }),

/***/ "./src/common/functions/connectWithChangeApiGateway.js":
/*!*************************************************************!*\
  !*** ./src/common/functions/connectWithChangeApiGateway.js ***!
  \*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   connectWithChangeApiGateway: () => (/* binding */ connectWithChangeApiGateway)
/* harmony export */ });
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _services_ConnectService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/ConnectService */ "./src/common/services/ConnectService.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_services_ApiClient__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _services_TranslateService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @services/TranslateService */ "./src/common/services/TranslateService.js");
/* harmony import */ var _services_TranslateService__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_services_TranslateService__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _services_LogsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js");
/* harmony import */ var _common_functions_checkApiGatewaysReconnect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @common/functions/checkApiGatewaysReconnect */ "./src/common/functions/checkApiGatewaysReconnect.js");
/* harmony import */ var _common_functions_checkApiGatewaysReconnect__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_common_functions_checkApiGatewaysReconnect__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_common_browserApi__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _common_functions_updateFirefoxProxyListener__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @common/functions/updateFirefoxProxyListener */ "./src/common/functions/updateFirefoxProxyListener.js");
/* harmony import */ var _common_functions_updateFirefoxProxyListener__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_common_functions_updateFirefoxProxyListener__WEBPACK_IMPORTED_MODULE_7__);
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }








function connectWithChangeApiGateway(_x, _x2) {
  return _connectWithChangeApiGateway.apply(this, arguments);
}
function _connectWithChangeApiGateway() {
  _connectWithChangeApiGateway = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(apiGatewaysForCity, currentProxy) {
    var apiGatewayMain,
      pauseSettings,
      result,
      _args = arguments;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          apiGatewayMain = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
          _context.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getPauseSetting();
        case 1:
          pauseSettings = _context.v;
          if (apiGatewayMain) {
            _context.n = 3;
            break;
          }
          _context.n = 2;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getApiGatewayMain();
        case 2:
          apiGatewayMain = _context.v;
        case 3:
          _context.n = 4;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().isExistApiGateways();
        case 4:
          if (!_context.v) {
            _context.n = 16;
            break;
          }
          _context.n = 5;
          return (0,_common_functions_checkApiGatewaysReconnect__WEBPACK_IMPORTED_MODULE_5__.selectNextApiGatewayMain)(apiGatewaysForCity, apiGatewayMain);
        case 5:
          result = _context.v;
          if (!result) {
            _context.n = 8;
            break;
          }
          _context.n = 6;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addEvents('action.reconnect_with_change_api_gateway');
        case 6:
          _context.n = 7;
          return (0,_services_ConnectService__WEBPACK_IMPORTED_MODULE_1__.connect)(function () {}, currentProxy.country, pauseSettings.pause, true);
        case 7:
          return _context.a(2, _context.v);
        case 8:
          if (!_common_browserApi__WEBPACK_IMPORTED_MODULE_6___default().isFireFoxBrowser()) {
            _context.n = 10;
            break;
          }
          _context.n = 9;
          return (0,_common_functions_updateFirefoxProxyListener__WEBPACK_IMPORTED_MODULE_7__.clearFirefoxProxyListener)();
        case 9:
          _context.n = 11;
          break;
        case 10:
          _common_browserApi__WEBPACK_IMPORTED_MODULE_6___default().proxy.settings.clear({
            scope: 'regular'
          });
        case 11:
          _context.n = 12;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addEvents('action.disconnect_with_change_api_gateway', {
            apiGatewaysForCity: apiGatewaysForCity,
            apiGatewayMain: apiGatewayMain
          }, 'api gateways list has ended');
        case 12:
          _context.n = 13;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().saveLoadConnectStatus(false);
        case 13:
          _context.n = 14;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().saveSelectedCountry('');
        case 14:
          _context.n = 15;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().saveProxySettings({
            proxyStatus: 'Error',
            proxyError: _services_TranslateService__WEBPACK_IMPORTED_MODULE_3___default().t('invalid_connect'),
            currentProxy: null
          });
        case 15:
          _context.n = 20;
          break;
        case 16:
          _context.n = 17;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addEvents('action.reconnect_with_change_api_gateway');
        case 17:
          _context.n = 18;
          return _services_ApiClient__WEBPACK_IMPORTED_MODULE_2___default().getApiGateways();
        case 18:
          _context.n = 19;
          return (0,_services_ConnectService__WEBPACK_IMPORTED_MODULE_1__.connect)(function () {}, currentProxy.country, pauseSettings.pause, true);
        case 19:
          return _context.a(2, _context.v);
        case 20:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _connectWithChangeApiGateway.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/functions/executeScriptCompat.js":
/*!*****************************************************!*\
  !*** ./src/common/functions/executeScriptCompat.js ***!
  \*****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
function executeScriptCompat(_ref, callback) {
  var tabId = _ref.tabId,
    _ref$func = _ref.func,
    func = _ref$func === void 0 ? null : _ref$func,
    _ref$code = _ref.code,
    code = _ref$code === void 0 ? null : _ref$code,
    _ref$args = _ref.args,
    args = _ref$args === void 0 ? [] : _ref$args,
    _ref$world = _ref.world,
    world = _ref$world === void 0 ? 'ISOLATED' : _ref$world;
  var maxRetries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3;
  var retryDelay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
  var isFirefox = browserApi.isFireFoxBrowser();
  var checkFrameStatus = function checkFrameStatus() {
    return new Promise(function (resolve, reject) {
      browserApi.webNavigation.getAllFrames({
        tabId: tabId
      }, function (frames) {
        if (browserApi.runtime.lastError) {
          reject(new Error("Failed to get frames for tab ".concat(tabId, ": ").concat(browserApi.runtime.lastError.message)));
          return;
        }
        var mainFrame = frames.find(function (frame) {
          return frame.frameId === 0;
        });
        if (!mainFrame) {
          reject(new Error("Main frame (ID 0) not found for tab ".concat(tabId)));
          return;
        }
        if (mainFrame.errorOccurred) {
          reject(new Error("Main frame (ID 0) has an error: ".concat(mainFrame.url)));
          return;
        }
        resolve();
      });
    });
  };
  var _attemptExecution = function attemptExecution() {
    var retryCount = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    if (isFirefox) {
      var execCode = func ? "(".concat(func.toString(), ")(...").concat(JSON.stringify(args), ")") : code;
      browserApi.tabs.executeScript(tabId, {
        code: execCode
      }, function (result) {
        if (browserApi.runtime.lastError) {
          if (callback) callback(new Error(browserApi.runtime.lastError.message));
        } else {
          if (callback) callback(null, result);
        }
      });
    } else {
      browserApi.tabs.get(tabId, function (tab) {
        if (!tab || !tab.url) {
          var error = new Error("Tab with ID ".concat(tabId, " does not exist or has no URL"));
          if (callback) callback(error);
          return;
        }
        if (isSystemPage(tab.url)) {
          var _error = new Error("Scripting not allowed on system page: ".concat(tab.url));
          if (callback) callback(_error);
          return;
        }
        if (tab.status !== 'complete') {
          if (retryCount < maxRetries) {
            setTimeout(function () {
              return _attemptExecution(retryCount + 1);
            }, retryDelay);
          } else {
            var _error2 = new Error("Tab with ID ".concat(tabId, " is not fully loaded after ").concat(maxRetries, " retries (status: ").concat(tab.status, ")"));
            if (callback) callback(_error2);
          }
          return;
        }
        checkFrameStatus().then(function () {
          browserApi.scripting.executeScript({
            target: {
              tabId: tabId
            },
            func: func,
            args: args,
            world: world
          }).then(function (result) {
            if (callback) callback(null, result);
          })["catch"](function (err) {
            if (callback) callback(err);
          });
        })["catch"](function (err) {
          if (retryCount < maxRetries) {
            setTimeout(function () {
              return _attemptExecution(retryCount + 1);
            }, retryDelay);
          } else {
            if (callback) callback(err);
          }
        });
      });
    }
  };
  _attemptExecution();
}
function isSystemPage(url) {
  var systemPages = ['chrome://', 'edge://', 'about:', 'chrome.google.com/webstore', 'microsoftedge.microsoft.com/addons'];
  return systemPages.some(function (page) {
    return url.startsWith(page);
  });
}
module.exports = {
  executeScriptCompat: executeScriptCompat
};

/***/ }),

/***/ "./src/common/functions/generateDeviceId.js":
/*!**************************************************!*\
  !*** ./src/common/functions/generateDeviceId.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   generateDeviceIdForProxyServer: () => (/* binding */ generateDeviceIdForProxyServer),
/* harmony export */   getUniqueAppId: () => (/* binding */ getUniqueAppId)
/* harmony export */ });
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_0__);
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }

var APP_ID = null;
var generateDeviceIdForProxyServer = /*#__PURE__*/function () {
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var _t, _t2;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _t = btoa;
          _t2 = encodeURIComponent;
          _context.n = 1;
          return getUniqueAppId();
        case 1:
          return _context.a(2, _t(_t2(_context.v)));
      }
    }, _callee);
  }));
  return function generateDeviceIdForProxyServer() {
    return _ref.apply(this, arguments);
  };
}();
var getUniqueAppId = /*#__PURE__*/function () {
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var uniqueAppId;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          _context2.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getUniqueAppId();
        case 1:
          uniqueAppId = _context2.v;
          if (uniqueAppId) {
            _context2.n = 2;
            break;
          }
          uniqueAppId = APP_ID ? APP_ID : crypto.randomUUID();
          if (!APP_ID) {
            APP_ID = uniqueAppId;
          }
          _context2.n = 2;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().saveUniqueAppId(uniqueAppId);
        case 2:
          APP_ID = uniqueAppId;
          return _context2.a(2, uniqueAppId);
      }
    }, _callee2);
  }));
  return function getUniqueAppId() {
    return _ref2.apply(this, arguments);
  };
}();

/***/ }),

/***/ "./src/common/functions/getSpoofedData.js":
/*!************************************************!*\
  !*** ./src/common/functions/getSpoofedData.js ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   getSpoofedData: () => (/* binding */ getSpoofedData),
/* harmony export */   getSpoofedDataMessage: () => (/* binding */ getSpoofedDataMessage)
/* harmony export */ });
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_0__);
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }

function getSpoofedDataMessage(sendResponse) {
  _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var spoofedData;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return getSpoofedData();
        case 1:
          spoofedData = _context.v;
          sendResponse(spoofedData);
        case 2:
          return _context.a(2);
      }
    }, _callee);
  }))();
}
function getSpoofedData() {
  return _getSpoofedData.apply(this, arguments);
}
function _getSpoofedData() {
  _getSpoofedData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var _settings$locationSpo, _data$lat, _data$lon, _data$timeZone;
    var data, settings, _t, _t2;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          _context2.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getCurrentProxy();
        case 1:
          _t = _context2.v;
          if (_t) {
            _context2.n = 2;
            break;
          }
          _t = null;
        case 2:
          data = _t;
          _context2.n = 3;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getSettings();
        case 3:
          _t2 = _context2.v;
          if (_t2) {
            _context2.n = 4;
            break;
          }
          _t2 = null;
        case 4:
          settings = _t2;
          return _context2.a(2, {
            enabled: (_settings$locationSpo = settings === null || settings === void 0 ? void 0 : settings.locationSpoofing) !== null && _settings$locationSpo !== void 0 ? _settings$locationSpo : false,
            lat: (_data$lat = data === null || data === void 0 ? void 0 : data.lat) !== null && _data$lat !== void 0 ? _data$lat : null,
            lon: (_data$lon = data === null || data === void 0 ? void 0 : data.lon) !== null && _data$lon !== void 0 ? _data$lon : null,
            timeZone: (_data$timeZone = data === null || data === void 0 ? void 0 : data.timeZone) !== null && _data$timeZone !== void 0 ? _data$timeZone : null
          });
      }
    }, _callee2);
  }));
  return _getSpoofedData.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/functions/pause.js":
/*!***************************************!*\
  !*** ./src/common/functions/pause.js ***!
  \***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   pause: () => (/* binding */ pause)
/* harmony export */ });
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function pause() {
  return _pause.apply(this, arguments);
}
function _pause() {
  _pause = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var time,
      _args = arguments;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          time = _args.length > 0 && _args[0] !== undefined ? _args[0] : 0;
          _context.n = 1;
          return new Promise(function (resolve) {
            return setTimeout(resolve, time);
          });
        case 1:
          return _context.a(2, _context.v);
      }
    }, _callee);
  }));
  return _pause.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/functions/updateFirefoxProxyListener.js":
/*!************************************************************!*\
  !*** ./src/common/functions/updateFirefoxProxyListener.js ***!
  \************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require.log,
  LOG_LEVELS = _require.LOG_LEVELS;
var _require2 = __webpack_require__(/*! @sw/tools/common */ "./src/sw/tools/common.js"),
  createBypassMatchers = _require2.createBypassMatchers;
var firefoxProxyListener = null;

/**
 *  Firefox proxy listener
 * @param {Object} options
 * @param {string} options.scheme
 * @param {string} options.host
 * @param {number|string} options.port
 * @param {Array<string>} [options.bypassList=[]]
 * @param {boolean} [options.killSwitch=false]
 */
function updateFirefoxProxyListener(_x) {
  return _updateFirefoxProxyListener.apply(this, arguments);
}
function _updateFirefoxProxyListener() {
  _updateFirefoxProxyListener = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
    var _ref, scheme, host, port, _ref$bypassList, bypassList, _ref$killSwitch, killSwitch, bypassMatchers;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _ref = options || {}, scheme = _ref.scheme, host = _ref.host, port = _ref.port, _ref$bypassList = _ref.bypassList, bypassList = _ref$bypassList === void 0 ? [] : _ref$bypassList, _ref$killSwitch = _ref.killSwitch, killSwitch = _ref$killSwitch === void 0 ? false : _ref$killSwitch;
          if (firefoxProxyListener && browserApi.proxy.onRequest.hasListener(firefoxProxyListener)) {
            browserApi.proxy.onRequest.removeListener(firefoxProxyListener);
            firefoxProxyListener = null;
          }
          bypassMatchers = createBypassMatchers(bypassList);
          firefoxProxyListener = function firefoxProxyListener(requestInfo) {
            try {
              var url = new URL(requestInfo.url);
              var hostname = url.hostname.toLowerCase();
              var _iterator = _createForOfIteratorHelper(bypassMatchers),
                _step;
              try {
                for (_iterator.s(); !(_step = _iterator.n()).done;) {
                  var match = _step.value;
                  if (match(hostname)) return {
                    type: "direct"
                  };
                }
              } catch (err) {
                _iterator.e(err);
              } finally {
                _iterator.f();
              }
              if (killSwitch) {
                return {
                  type: "http",
                  host: "127.0.0.1",
                  port: 1
                };
              }
              return {
                type: scheme,
                host: host,
                port: parseInt(port, 10)
              };
            } catch (e) {
              return {
                type: "direct"
              };
            }
          };
          browserApi.proxy.onRequest.addListener(firefoxProxyListener, {
            urls: ["<all_urls>"]
          });
          log(LOG_LEVELS.INFO, "Firefox proxy listener updated:", options);
        case 1:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _updateFirefoxProxyListener.apply(this, arguments);
}
function clearFirefoxProxyListener() {
  return _clearFirefoxProxyListener.apply(this, arguments);
}
function _clearFirefoxProxyListener() {
  _clearFirefoxProxyListener = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          if (firefoxProxyListener && browserApi.proxy.onRequest.hasListener(firefoxProxyListener)) {
            browserApi.proxy.onRequest.removeListener(firefoxProxyListener);
            firefoxProxyListener = null;
            log(LOG_LEVELS.INFO, "Firefox proxy listener cleared");
          }
        case 1:
          return _context2.a(2);
      }
    }, _callee2);
  }));
  return _clearFirefoxProxyListener.apply(this, arguments);
}
module.exports = {
  updateFirefoxProxyListener: updateFirefoxProxyListener,
  clearFirefoxProxyListener: clearFirefoxProxyListener
};

/***/ }),

/***/ "./src/common/services/ApiClient.js":
/*!******************************************!*\
  !*** ./src/common/services/ApiClient.js ***!
  \******************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
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 asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var _require = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js"),
  API_URLS = _require.API_URLS,
  DEFAULT_HEADERS = _require.DEFAULT_HEADERS,
  getRefreshApiUrl = _require.getRefreshApiUrl,
  getTokenApiUrl = _require.getTokenApiUrl,
  getCitiesApiUrl = _require.getCitiesApiUrl,
  getAuthLinksApiUrl = _require.getAuthLinksApiUrl,
  getConnectApiUrl = _require.getConnectApiUrl,
  getMyIpApiUrl = _require.getMyIpApiUrl,
  getStateApiUrl = _require.getStateApiUrl,
  getPrivateLinksApiUrl = _require.getPrivateLinksApiUrl,
  getThreatProtectionApiUrl = _require.getThreatProtectionApiUrl,
  getIssueReportsApiUrl = _require.getIssueReportsApiUrl,
  getFeatureSuggestionsApiUrl = _require.getFeatureSuggestionsApiUrl;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require2 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require2.log,
  LOG_LEVELS = _require2.LOG_LEVELS;
var _require3 = __webpack_require__(/*! @sw/constants/mapping_by_cotinent */ "./src/sw/constants/mapping_by_cotinent.js"),
  getFullUrl = _require3.getFullUrl,
  getAlphaCountryCode = _require3.getAlphaCountryCode,
  getContinentByCountry = _require3.getContinentByCountry;
var _require4 = __webpack_require__(/*! @common/functions/generateDeviceId */ "./src/common/functions/generateDeviceId.js"),
  getUniqueAppId = _require4.getUniqueAppId;
var _require5 = __webpack_require__(/*! @common/functions/pause */ "./src/common/functions/pause.js"),
  pause = _require5.pause;
var _require6 = __webpack_require__(/*! @sw/tools/common */ "./src/sw/tools/common.js"),
  getCountryCodeByCountry = _require6.getCountryCodeByCountry,
  getUserAgentForApi = _require6.getUserAgentForApi;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var ApiClient = /*#__PURE__*/function () {
  function ApiClient() {
    _classCallCheck(this, ApiClient);
  }
  return _createClass(ApiClient, null, [{
    key: "request",
    value: (
    /**
     * Makes an HTTP request
     * @param {string} url
     * @param {Object} options
     * @param parentMethod
     * @returns {Promise<Object>}
     */
    function () {
      var _request = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url) {
        var _ref,
          _ref$method,
          method,
          _ref$headers,
          headers,
          _ref$body,
          body,
          _ref$timeWaiting,
          timeWaiting,
          _ref$abortController,
          abortController,
          parentMethod,
          blockRequest,
          startPing,
          controller,
          timeoutId,
          params,
          response,
          lastPing,
          data,
          processData,
          _lastPing,
          _data$data,
          _data$data2,
          _lastPing2,
          _args = arguments,
          _t,
          _t2,
          _t3,
          _t4,
          _t5,
          _t6,
          _t7,
          _t8,
          _t9,
          _t0;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              _ref = _args.length > 1 && _args[1] !== undefined ? _args[1] : {}, _ref$method = _ref.method, method = _ref$method === void 0 ? 'GET' : _ref$method, _ref$headers = _ref.headers, headers = _ref$headers === void 0 ? {} : _ref$headers, _ref$body = _ref.body, body = _ref$body === void 0 ? null : _ref$body, _ref$timeWaiting = _ref.timeWaiting, timeWaiting = _ref$timeWaiting === void 0 ? null : _ref$timeWaiting, _ref$abortController = _ref.abortController, abortController = _ref$abortController === void 0 ? null : _ref$abortController;
              parentMethod = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
              _context.n = 1;
              return StorageService.getBlockRequest();
            case 1:
              blockRequest = _context.v;
              if (!blockRequest) {
                _context.n = 3;
                break;
              }
              _context.n = 2;
              return pause(2000);
            case 2:
              _context.n = 3;
              return StorageService.saveBlockRequest(false);
            case 3:
              startPing = performance.now();
              controller = null;
              timeoutId = null;
              if (abortController) {
                controller = abortController;
              }
              if (timeWaiting) {
                if (!controller) {
                  controller = new AbortController();
                }
                timeoutId = setTimeout(function () {
                  return controller.abort();
                }, timeWaiting);
              }
              _t = method;
              _t2 = _objectSpread;
              _t3 = _objectSpread({}, DEFAULT_HEADERS);
              _t4 = {};
              _context.n = 4;
              return getUniqueAppId();
            case 4:
              _t5 = _context.v;
              _t6 = getUserAgentForApi();
              _t7 = _t2(_t3, _t4, {
                'Device-ID': _t5,
                'User-Agent': _t6
              }, headers);
              _t8 = body ? JSON.stringify(body) : null;
              params = {
                method: _t,
                headers: _t7,
                body: _t8
              };
              if (controller) {
                params.signal = controller.signal;
              }
              _context.p = 5;
              _context.n = 6;
              return fetch(url, params);
            case 6:
              response = _context.v;
              _context.p = 7;
              lastPing = Math.round(performance.now() - startPing);
              if (!(lastPing > 0)) {
                _context.n = 8;
                break;
              }
              _context.n = 8;
              return StorageService.savePing(lastPing);
            case 8:
              _context.n = 10;
              break;
            case 9:
              _context.p = 9;
              _t9 = _context.v;
              log(LOG_LEVELS.ERROR, "Calculation ping failed:  ".concat(_t9.message));
              _context.n = 10;
              return LogsService.addEvents('service.error_ping_failed', {}, _t9.message);
            case 10:
              _context.p = 10;
              if (timeoutId) {
                clearTimeout(timeoutId);
              }
              return _context.f(10);
            case 11:
              _context.n = 12;
              return response.json();
            case 12:
              data = _context.v;
              if (!parentMethod) {
                _context.n = 13;
                break;
              }
              processData = {};
              _lastPing = Math.round(performance.now() - startPing);
              if ('getCities' === parentMethod) {
                if (data.data) {
                  processData = 'import cities:' + data.data.length;
                } else {
                  processData = data;
                }
              } else if ('refreshToken' === parentMethod) {
                processData = {
                  'access_token': !!(data !== null && data !== void 0 && (_data$data = data.data) !== null && _data$data !== void 0 && _data$data.access_token),
                  'refresh_token': !!(data !== null && data !== void 0 && (_data$data2 = data.data) !== null && _data$data2 !== void 0 && _data$data2.refresh_token)
                };
              } else if (['getAuthLinks', 'getAuthToken'].includes(parentMethod)) {
                processData = {};
              } else {
                processData = data;
              }
              _context.n = 13;
              return LogsService.addConnectedEvents("fetch_end.".concat(parentMethod), {
                success: response.ok,
                status: response.status,
                processData: processData,
                ping: _lastPing
              });
            case 13:
              return _context.a(2, {
                success: response.ok,
                status: response.status,
                data: data
              });
            case 14:
              _context.p = 14;
              _t0 = _context.v;
              log(LOG_LEVELS.ERROR, "API request failed ".concat(url, ":  ").concat(_t0.message));
              if (!parentMethod) {
                _context.n = 15;
                break;
              }
              _lastPing2 = Math.round(performance.now() - startPing);
              _context.n = 15;
              return LogsService.addConnectedEvents("fetch_error.".concat(parentMethod), {
                success: false,
                error: _t0.message,
                code: (_t0 === null || _t0 === void 0 ? void 0 : _t0.code) || 'NO_ERROR_CODE',
                ping: _lastPing2
              });
            case 15:
              _context.n = 16;
              return LogsService.addEvents('service.error_request_failed', {
                url: url,
                error: _t0.message
              });
            case 16:
              return _context.a(2, {
                success: false,
                error: _t0.message
              });
          }
        }, _callee, null, [[7, 9, 10, 11], [5, 14]]);
      }));
      function request(_x) {
        return _request.apply(this, arguments);
      }
      return request;
    }()
    /**
     * Refreshes a token
     * @param {string} refresh_token
     * @returns {Promise<Object>}
     */
    )
  }, {
    key: "refreshToken",
    value: (function () {
      var _refreshToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(refresh_token) {
        var url;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.n) {
            case 0:
              _context2.n = 1;
              return getRefreshApiUrl();
            case 1:
              url = _context2.v;
              _context2.n = 2;
              return LogsService.addConnectedEvents("fetch_start.refreshToken", {
                url: url
              });
            case 2:
              _context2.n = 3;
              return this.request(url, {
                method: 'POST',
                body: {
                  refresh_token: refresh_token
                }
              }, 'refreshToken');
            case 3:
              return _context2.a(2, _context2.v);
          }
        }, _callee2, this);
      }));
      function refreshToken(_x2) {
        return _refreshToken.apply(this, arguments);
      }
      return refreshToken;
    }())
  }, {
    key: "getAuthToken",
    value: function () {
      var _getAuthToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(token) {
        var url;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              _context3.n = 1;
              return getTokenApiUrl();
            case 1:
              url = _context3.v;
              _context3.n = 2;
              return LogsService.addConnectedEvents("fetch_start.getAuthToken", {
                url: url
              });
            case 2:
              _context3.n = 3;
              return this.request(url, {
                method: 'POST',
                body: {
                  auth_code: token
                }
              }, 'getAuthToken');
            case 3:
              return _context3.a(2, _context3.v);
          }
        }, _callee3, this);
      }));
      function getAuthToken(_x3) {
        return _getAuthToken.apply(this, arguments);
      }
      return getAuthToken;
    }()
  }, {
    key: "validateTokenWithData",
    value: function () {
      var _validateTokenWithData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(token) {
        var abortController,
          response,
          _args4 = arguments,
          _t1;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              abortController = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : null;
              _t1 = ApiClient;
              _context4.n = 1;
              return getStateApiUrl();
            case 1:
              _context4.n = 2;
              return _t1.request.call(_t1, _context4.v, {
                method: 'GET',
                headers: {
                  Authorization: "Bearer ".concat(token),
                  'Content-Type': 'application/json'
                },
                abortController: abortController
              });
            case 2:
              response = _context4.v;
              if (!(response && response.success && response.status === 200)) {
                _context4.n = 3;
                break;
              }
              return _context4.a(2, {
                success: true,
                data: response.data
              });
            case 3:
              return _context4.a(2, {
                success: false,
                error: "Error get token",
                status_code: response.status
              });
            case 4:
              return _context4.a(2);
          }
        }, _callee4);
      }));
      function validateTokenWithData(_x4) {
        return _validateTokenWithData.apply(this, arguments);
      }
      return validateTokenWithData;
    }()
  }, {
    key: "getThreatProtectionData",
    value: function () {
      var _getThreatProtectionData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(token) {
        var response, _response$data, _t10;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.n) {
            case 0:
              _t10 = ApiClient;
              _context5.n = 1;
              return getThreatProtectionApiUrl();
            case 1:
              _context5.n = 2;
              return _t10.request.call(_t10, _context5.v, {
                method: 'GET',
                headers: {
                  Authorization: "Bearer ".concat(token),
                  'Content-Type': 'application/json'
                }
              });
            case 2:
              response = _context5.v;
              if (!(response.success && response.status === 200)) {
                _context5.n = 3;
                break;
              }
              return _context5.a(2, {
                success: true,
                data: (response === null || response === void 0 || (_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.data) || []
              });
            case 3:
              return _context5.a(2, {
                success: false,
                error: "Invalid token (status: ".concat(response.status, ")"),
                status_code: response.status
              });
            case 4:
              return _context5.a(2);
          }
        }, _callee5);
      }));
      function getThreatProtectionData(_x5) {
        return _getThreatProtectionData.apply(this, arguments);
      }
      return getThreatProtectionData;
    }()
  }, {
    key: "getConnect",
    value: function () {
      var _getConnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(token) {
        var cityCode,
          abortController,
          body,
          _args6 = arguments,
          _t11;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              cityCode = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;
              abortController = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : null;
              body = {
                type: 'proxy'
              };
              if (cityCode) {
                body.city_code = cityCode;
              } else {
                body.is_fastest = true;
              }
              _t11 = ApiClient;
              _context6.n = 1;
              return getConnectApiUrl();
            case 1:
              _context6.n = 2;
              return _t11.request.call(_t11, _context6.v, {
                method: 'POST',
                headers: {
                  'Authorization': "Bearer ".concat(token)
                },
                body: body,
                abortController: abortController
              });
            case 2:
              return _context6.a(2, _context6.v);
          }
        }, _callee6);
      }));
      function getConnect(_x6) {
        return _getConnect.apply(this, arguments);
      }
      return getConnect;
    }()
  }, {
    key: "getCities",
    value: function () {
      var _getCities = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
        var url, response, cities, apiCities, _apiCities;
        return _regenerator().w(function (_context7) {
          while (1) switch (_context7.n) {
            case 0:
              _context7.n = 1;
              return getCitiesApiUrl();
            case 1:
              url = _context7.v;
              _context7.n = 2;
              return LogsService.addConnectedEvents("fetch_start.getCities", {
                url: url
              });
            case 2:
              _context7.n = 3;
              return this.request(url, {
                method: 'GET'
              }, 'getCities');
            case 3:
              response = _context7.v;
              if (!response.success) {
                _context7.n = 9;
                break;
              }
              cities = response.data.data || [];
              cities = cities.filter(function (c) {
                return !c["private"];
              });
              if (!(cities && cities.length > 0)) {
                _context7.n = 5;
                break;
              }
              _context7.n = 4;
              return StorageService.saveCitiesList(cities);
            case 4:
              return _context7.a(2, cities);
            case 5:
              _context7.n = 6;
              return StorageService.getCitiesList();
            case 6:
              apiCities = _context7.v;
              if (!(apiCities && apiCities.length > 0)) {
                _context7.n = 7;
                break;
              }
              return _context7.a(2, apiCities);
            case 7:
              return _context7.a(2, []);
            case 8:
              _context7.n = 13;
              break;
            case 9:
              _context7.n = 10;
              return StorageService.getCitiesList();
            case 10:
              _apiCities = _context7.v;
              if (!(_apiCities && _apiCities.length > 0)) {
                _context7.n = 11;
                break;
              }
              return _context7.a(2, []);
            case 11:
              _context7.n = 12;
              return StorageService.saveCitiesList([]);
            case 12:
              return _context7.a(2, []);
            case 13:
              return _context7.a(2);
          }
        }, _callee7, this);
      }));
      function getCities() {
        return _getCities.apply(this, arguments);
      }
      return getCities;
    }()
  }, {
    key: "getAuthLinks",
    value: function () {
      var _getAuthLinks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
        var url, response, authLinks, authDomains;
        return _regenerator().w(function (_context8) {
          while (1) switch (_context8.n) {
            case 0:
              _context8.n = 1;
              return getAuthLinksApiUrl();
            case 1:
              url = _context8.v;
              _context8.n = 2;
              return LogsService.addConnectedEvents("fetch_start.getAuthLinks", {
                url: url
              });
            case 2:
              _context8.n = 3;
              return this.request(url, {
                method: 'GET'
              }, 'getAuthLinks');
            case 3:
              response = _context8.v;
              if (!response.success) {
                _context8.n = 6;
                break;
              }
              authLinks = response.data.data || {};
              authDomains = ApiClient.extractUniqueDomains(authLinks);
              _context8.n = 4;
              return StorageService.saveAuthLinks(authLinks);
            case 4:
              _context8.n = 5;
              return StorageService.saveAuthDomains(authDomains);
            case 5:
              return _context8.a(2, authLinks);
            case 6:
              return _context8.a(2, []);
            case 7:
              return _context8.a(2);
          }
        }, _callee8, this);
      }));
      function getAuthLinks() {
        return _getAuthLinks.apply(this, arguments);
      }
      return getAuthLinks;
    }()
  }, {
    key: "getApiGateways",
    value: function () {
      var _getApiGateways = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
        var isReconnect,
          abortController,
          controller,
          response,
          apiGateways,
          apiGatewayMain,
          settings,
          _args9 = arguments;
        return _regenerator().w(function (_context9) {
          while (1) switch (_context9.n) {
            case 0:
              isReconnect = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
              abortController = _args9.length > 1 && _args9[1] !== undefined ? _args9[1] : null;
              _context9.n = 1;
              return LogsService.addConnectedEvents("fetch_start.getApiGateways", {
                url: API_URLS.API_GATEWAYS
              });
            case 1:
              controller = abortController ? abortController : new AbortController();
              _context9.n = 2;
              return this.request(API_URLS.API_GATEWAYS, {
                method: 'GET',
                timeWaiting: 10000,
                abortController: controller
              }, 'getApiGateways');
            case 2:
              response = _context9.v;
              if (!response.success) {
                _context9.n = 6;
                break;
              }
              apiGateways = response.data.data || [];
              apiGatewayMain = apiGateways[0];
              _context9.n = 3;
              return StorageService.getSettings();
            case 3:
              settings = _context9.v;
              if (settings && settings.changeApiGateway && settings.selectedApiGateway) {
                apiGatewayMain = settings.selectedApiGateway;
              }
              _context9.n = 4;
              return StorageService.saveApiGateways(apiGateways);
            case 4:
              if (isReconnect) {
                _context9.n = 5;
                break;
              }
              _context9.n = 5;
              return StorageService.saveApiGatewayMain(apiGatewayMain);
            case 5:
              return _context9.a(2, apiGatewayMain);
            case 6:
              _context9.n = 7;
              return LogsService.addConnectedEvents("fetch_error.getApiGateways", {
                url: API_URLS.API_GATEWAYS
              });
            case 7:
              return _context9.a(2, []);
            case 8:
              return _context9.a(2);
          }
        }, _callee9, this);
      }));
      function getApiGateways() {
        return _getApiGateways.apply(this, arguments);
      }
      return getApiGateways;
    }()
  }, {
    key: "getPingPong",
    value: function () {
      var _getPingPong = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
        var response;
        return _regenerator().w(function (_context0) {
          while (1) switch (_context0.n) {
            case 0:
              _context0.n = 1;
              return this.request(API_URLS.PING_PONG, {
                method: 'GET'
              });
            case 1:
              response = _context0.v;
              return _context0.a(2, !!response.success);
          }
        }, _callee0, this);
      }));
      function getPingPong() {
        return _getPingPong.apply(this, arguments);
      }
      return getPingPong;
    }()
  }, {
    key: "extractUniqueDomains",
    value: function extractUniqueDomains(urlObject) {
      var domains = new Set();
      var getDomainFromUrl = function getDomainFromUrl(url) {
        try {
          var urlObj = new URL(url);
          return urlObj.hostname;
        } catch (_unused) {
          return null;
        }
      };
      for (var key in urlObject) {
        if (urlObject[key]) {
          var url = urlObject[key];
          var mainDomain = getDomainFromUrl(url);
          if (mainDomain) {
            domains.add(mainDomain);
          }
        }
      }
      return Array.from(domains);
    }
  }, {
    key: "getDomainForUpdate",
    value: function () {
      var _getDomainForUpdate = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(key, country) {
        var abortController,
          startPing,
          controller,
          timeoutId,
          continent,
          countryCode,
          alphaCountryCode,
          url,
          lastPing,
          _lastPing3,
          _args1 = arguments,
          _t12;
        return _regenerator().w(function (_context1) {
          while (1) switch (_context1.p = _context1.n) {
            case 0:
              abortController = _args1.length > 2 && _args1[2] !== undefined ? _args1[2] : null;
              startPing = performance.now();
              _context1.p = 1;
              controller = abortController ? abortController : new AbortController();
              timeoutId = setTimeout(function () {
                controller && controller.abort();
              }, 10000);
              continent = getContinentByCountry(country);
              _context1.n = 2;
              return getCountryCodeByCountry(country);
            case 2:
              countryCode = _context1.v;
              alphaCountryCode = getAlphaCountryCode(countryCode);
              url = getFullUrl(continent);
              _context1.n = 3;
              return LogsService.addConnectedEvents('fetch_start.getDomainForUpdate', {
                url: url,
                alphaCountryCode: alphaCountryCode,
                continent: continent
              });
            case 3:
              _context1.n = 4;
              return fetch(url, {
                method: 'GET',
                headers: {
                  'Content-Type': 'application/html',
                  'User-Agent': getUserAgentForApi(),
                  'X-Country-Code': alphaCountryCode
                },
                signal: controller.signal
              });
            case 4:
              lastPing = Math.round(performance.now() - startPing);
              _context1.n = 5;
              return LogsService.addConnectedEvents('fetch_end.getDomainForUpdate', {
                ping: lastPing
              });
            case 5:
              clearTimeout(timeoutId);
              return _context1.a(2, true);
            case 6:
              _context1.p = 6;
              _t12 = _context1.v;
              _lastPing3 = Math.round(performance.now() - startPing);
              _context1.n = 7;
              return LogsService.addConnectedEvents('fetch_error.getDomainForUpdate', {
                error: _t12.message,
                code: (_t12 === null || _t12 === void 0 ? void 0 : _t12.code) || 'NO_ERROR_CODE',
                ping: _lastPing3
              });
            case 7:
              return _context1.a(2, false);
          }
        }, _callee1, null, [[1, 6]]);
      }));
      function getDomainForUpdate(_x7, _x8) {
        return _getDomainForUpdate.apply(this, arguments);
      }
      return getDomainForUpdate;
    }()
  }, {
    key: "getMyIP",
    value: function () {
      var _getMyIP = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(token, abortController) {
        var _data$data3;
        var data, ip, userData, tempUserData, _t13;
        return _regenerator().w(function (_context10) {
          while (1) switch (_context10.n) {
            case 0:
              _t13 = ApiClient;
              _context10.n = 1;
              return getMyIpApiUrl();
            case 1:
              _context10.n = 2;
              return _t13.request.call(_t13, _context10.v, {
                method: 'GET',
                headers: {
                  Authorization: "Bearer ".concat(token),
                  'Content-Type': 'application/json'
                },
                timeWaiting: 10000,
                abortController: abortController
              });
            case 2:
              data = _context10.v;
              ip = data === null || data === void 0 || (_data$data3 = data.data) === null || _data$data3 === void 0 || (_data$data3 = _data$data3.data) === null || _data$data3 === void 0 ? void 0 : _data$data3.ip;
              if (!ip) {
                _context10.n = 4;
                break;
              }
              _context10.n = 3;
              return StorageService.getUserData();
            case 3:
              userData = _context10.v;
              tempUserData = Object.assign({}, userData);
              tempUserData.ip = ip;
              _context10.n = 4;
              return StorageService.saveUserData(tempUserData);
            case 4:
              return _context10.a(2, ip);
          }
        }, _callee10);
      }));
      function getMyIP(_x9, _x0) {
        return _getMyIP.apply(this, arguments);
      }
      return getMyIP;
    }()
  }, {
    key: "getPrivateLink",
    value: function () {
      var _getPrivateLink = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(type) {
        var token, url, response, privateLink;
        return _regenerator().w(function (_context11) {
          while (1) switch (_context11.n) {
            case 0:
              _context11.n = 1;
              return LogsService.addEvents('service.private_link', type);
            case 1:
              _context11.n = 2;
              return StorageService.getToken();
            case 2:
              token = _context11.v;
              if (token) {
                _context11.n = 3;
                break;
              }
              return _context11.a(2, null);
            case 3:
              _context11.n = 4;
              return getPrivateLinksApiUrl(type);
            case 4:
              url = _context11.v;
              _context11.n = 5;
              return LogsService.addConnectedEvents("fetch_start.getPrivateLink", {
                url: url
              });
            case 5:
              _context11.n = 6;
              return this.request(url, {
                method: 'GET',
                headers: {
                  'Authorization': "Bearer ".concat(token)
                }
              }, 'getPrivateLink');
            case 6:
              response = _context11.v;
              if (!response.success) {
                _context11.n = 8;
                break;
              }
              privateLink = response.data.data.link || null;
              _context11.n = 7;
              return StorageService.savePrivateLink(type, privateLink);
            case 7:
              return _context11.a(2, privateLink);
            case 8:
              return _context11.a(2, null);
            case 9:
              return _context11.a(2);
          }
        }, _callee11, this);
      }));
      function getPrivateLink(_x1) {
        return _getPrivateLink.apply(this, arguments);
      }
      return getPrivateLink;
    }()
    /**
     * @param {Object} reportData
     * @returns {Promise<{success: boolean, data?: any, error?: string}>}
     */
  }, {
    key: "sendReport",
    value: (function () {
      var _sendReport = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(reportData) {
        var url, formData, startTime, response, pingTime, data, _pingTime, _t14;
        return _regenerator().w(function (_context12) {
          while (1) switch (_context12.p = _context12.n) {
            case 0:
              _context12.n = 1;
              return getIssueReportsApiUrl();
            case 1:
              url = _context12.v;
              formData = new FormData();
              Object.entries(reportData).forEach(function (_ref2) {
                var _ref3 = _slicedToArray(_ref2, 2),
                  key = _ref3[0],
                  value = _ref3[1];
                if (value !== null && value !== undefined) {
                  if (value instanceof Blob) {
                    formData.append(key, value, value.name || 'file.json');
                  } else {
                    formData.append(key, typeof value === 'boolean' ? value.toString() : value);
                  }
                }
              });
              startTime = performance.now();
              _context12.p = 2;
              _context12.n = 3;
              return LogsService.addEvents('service.send_report', formData);
            case 3:
              _context12.n = 4;
              return LogsService.addConnectedEvents('fetch_start.sendReport', {
                url: url
              });
            case 4:
              _context12.n = 5;
              return fetch(url, {
                method: 'POST',
                headers: {
                  'User-Agent': getUserAgentForApi()
                },
                body: formData
              });
            case 5:
              response = _context12.v;
              pingTime = Math.round(performance.now() - startTime);
              if (!(pingTime > 0)) {
                _context12.n = 6;
                break;
              }
              _context12.n = 6;
              return StorageService.savePing(pingTime);
            case 6:
              if (!(response.status === 204 || response.headers.get('Content-Length') === '0')) {
                _context12.n = 8;
                break;
              }
              _context12.n = 7;
              return LogsService.addConnectedEvents('fetch_end.sendReport', {
                response_status: response.status,
                response_ok: response.ok,
                ping: pingTime
              });
            case 7:
              return _context12.a(2, {
                success: true,
                status: response.status
              });
            case 8:
              _context12.n = 9;
              return response.json()["catch"](function () {
                return null;
              });
            case 9:
              data = _context12.v;
              _context12.n = 10;
              return LogsService.addConnectedEvents('fetch_end.sendReport', {
                data: data,
                response_status: response.status,
                response_ok: response.ok,
                ping: pingTime
              });
            case 10:
              return _context12.a(2, {
                success: response.ok,
                status: response.status,
                data: data || undefined,
                error: response.ok ? undefined : (data === null || data === void 0 ? void 0 : data.message) || 'Unknown error'
              });
            case 11:
              _context12.p = 11;
              _t14 = _context12.v;
              log(LOG_LEVELS.ERROR, "Report submission failed: ".concat(_t14.message));
              _pingTime = Math.round(performance.now() - startTime);
              _context12.n = 12;
              return LogsService.addConnectedEvents('fetch_error.sendReport', {
                success: false,
                status: 0,
                error: _t14.message,
                ping: _pingTime,
                code: (_t14 === null || _t14 === void 0 ? void 0 : _t14.code) || 'NO_ERROR_CODE'
              });
            case 12:
              _context12.n = 13;
              return LogsService.addEvents('service.error_submission_failed', _t14);
            case 13:
              return _context12.a(2, {
                success: false,
                status: 0,
                error: _t14.message
              });
          }
        }, _callee12, null, [[2, 11]]);
      }));
      function sendReport(_x10) {
        return _sendReport.apply(this, arguments);
      }
      return sendReport;
    }())
  }, {
    key: "sendSuggestions",
    value: function () {
      var _sendSuggestions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(reportData) {
        var url, formData, startTime, response, pingTime, data, _pingTime2, _t15;
        return _regenerator().w(function (_context13) {
          while (1) switch (_context13.p = _context13.n) {
            case 0:
              _context13.n = 1;
              return getFeatureSuggestionsApiUrl();
            case 1:
              url = _context13.v;
              formData = new FormData();
              Object.entries(reportData).forEach(function (_ref4) {
                var _ref5 = _slicedToArray(_ref4, 2),
                  key = _ref5[0],
                  value = _ref5[1];
                if (value !== null && value !== undefined) {
                  formData.append(key, typeof value === 'boolean' ? value.toString() : value);
                }
              });
              startTime = performance.now();
              _context13.p = 2;
              _context13.n = 3;
              return LogsService.addConnectedEvents('fetch_start.sendSuggestions', {
                url: url
              });
            case 3:
              _context13.n = 4;
              return fetch(url, {
                method: 'POST',
                headers: {
                  'User-Agent': getUserAgentForApi()
                },
                body: formData
              });
            case 4:
              response = _context13.v;
              pingTime = Math.round(performance.now() - startTime);
              if (!(pingTime > 0)) {
                _context13.n = 5;
                break;
              }
              _context13.n = 5;
              return StorageService.savePing(pingTime);
            case 5:
              if (!(response.status === 204 || response.headers.get('Content-Length') === '0')) {
                _context13.n = 7;
                break;
              }
              _context13.n = 6;
              return LogsService.addConnectedEvents('fetch_end.sendSuggestions', {
                success: true,
                status: response.status,
                ping: pingTime
              });
            case 6:
              return _context13.a(2, {
                success: true,
                status: response.status
              });
            case 7:
              _context13.n = 8;
              return response.json()["catch"](function () {
                return null;
              });
            case 8:
              data = _context13.v;
              _context13.n = 9;
              return LogsService.addConnectedEvents('fetch_end.sendSuggestions', {
                success: response.ok,
                status: response.status,
                data: data || undefined,
                error: response.ok ? undefined : (data === null || data === void 0 ? void 0 : data.message) || 'Unknown error',
                ping: pingTime
              });
            case 9:
              return _context13.a(2, {
                success: response.ok,
                status: response.status,
                data: data || undefined,
                error: response.ok ? undefined : (data === null || data === void 0 ? void 0 : data.message) || 'Unknown error'
              });
            case 10:
              _context13.p = 10;
              _t15 = _context13.v;
              log(LOG_LEVELS.ERROR, "Send suggestions failed: ".concat(_t15.message));
              _pingTime2 = Math.round(performance.now() - startTime);
              _context13.n = 11;
              return LogsService.addConnectedEvents('fetch_error.sendSuggestions', {
                success: false,
                status: 0,
                error: _t15.message,
                code: (_t15 === null || _t15 === void 0 ? void 0 : _t15.code) || 'NO_ERROR_CODE',
                ping: _pingTime2
              });
            case 11:
              _context13.n = 12;
              return LogsService.addEvents('service.error_suggestions_failed', _t15);
            case 12:
              return _context13.a(2, {
                success: false,
                status: 0,
                error: _t15.message
              });
          }
        }, _callee13, null, [[2, 10]]);
      }));
      function sendSuggestions(_x11) {
        return _sendSuggestions.apply(this, arguments);
      }
      return sendSuggestions;
    }()
  }]);
}();
module.exports = ApiClient;

/***/ }),

/***/ "./src/common/services/ConnectService.js":
/*!***********************************************!*\
  !*** ./src/common/services/ConnectService.js ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   connect: () => (/* binding */ connect),
/* harmony export */   connectBySelectedServer: () => (/* binding */ connectBySelectedServer)
/* harmony export */ });
/* harmony import */ var _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/CountrySelectorService */ "./src/common/services/CountrySelectorService.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_services_ApiClient__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js");
/* harmony import */ var _sw_main_proxy__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _sw_constants_country_code_mapping__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @sw/constants/country_code_mapping */ "./src/sw/constants/country_code_mapping.js");
/* harmony import */ var _services_VpnService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @services/VpnService */ "./src/common/services/VpnService.js");
/* harmony import */ var _sw_main_websocket__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @sw/main/websocket */ "./src/sw/main/websocket.js");
/* harmony import */ var _sw_main_websocket__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_sw_main_websocket__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @sw/settings_services/pause_service */ "./src/sw/settings_services/pause_service.js");
/* harmony import */ var _sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _sw_tools_log__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js");
/* harmony import */ var _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @services/HttpRequestApi */ "./src/common/services/HttpRequestApi.js");
/* harmony import */ var _sw_constants_server_proxy_constants__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @sw/constants/server_proxy_constants */ "./src/sw/constants/server_proxy_constants.js");
/* harmony import */ var _services_TranslateService__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @services/TranslateService */ "./src/common/services/TranslateService.js");
/* harmony import */ var _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_services_TranslateService__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_common_browserApi__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var _sw_main_auth__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @sw/main/auth */ "./src/sw/main/auth.js");
/* harmony import */ var _sw_main_auth__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_sw_main_auth__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var _services_LogsService__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js");
/* harmony import */ var _common_functions_checkSubscriptions__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @common/functions/checkSubscriptions */ "./src/common/functions/checkSubscriptions.js");
/* harmony import */ var _common_functions_connectWithChangeApiGateway__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! @common/functions/connectWithChangeApiGateway */ "./src/common/functions/connectWithChangeApiGateway.js");
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }

















var _require = __webpack_require__(/*! @common/functions/pause */ "./src/common/functions/pause.js"),
  pause = _require.pause;
var _require2 = __webpack_require__(/*! @common/functions/apiGatewaysForCity */ "./src/common/functions/apiGatewaysForCity.js"),
  getApiGatewaysForCity = _require2.getApiGatewaysForCity;
function connect(_x) {
  return _connect.apply(this, arguments);
}
function _connect() {
  _connect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(sendResponse) {
    var countryNameTemp,
      isPause,
      isReconnect,
      _response,
      abortController,
      cityCode,
      cityInfo,
      apiGateways,
      apiGatewayMain,
      apiGatewaysForCity,
      countryName,
      token,
      response,
      serverDomain,
      currentProxy,
      isNewProxyDomain,
      _newResponseAfterRefr,
      _yield$StorageService,
      jwt,
      newResponseAfterRefresh,
      tempSendResponse,
      response_token,
      updatedAuthData,
      _response2,
      _response3,
      _response4,
      _response5,
      _response$data,
      _response$data2,
      settings,
      changeApiGateway,
      _response$data3,
      _response6,
      _args3 = arguments,
      _t;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.p = _context3.n) {
        case 0:
          countryNameTemp = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : null;
          isPause = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : false;
          isReconnect = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : false;
          _context3.p = 1;
          if (isReconnect) {
            _context3.n = 2;
            break;
          }
          _context3.n = 2;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveIsApiGatewayMainAfterCheck(false);
        case 2:
          abortController = new AbortController();
          _common_browserApi__WEBPACK_IMPORTED_MODULE_12___default().storage.onChanged.addListener(/*#__PURE__*/function () {
            var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(details) {
              var _details$cancelConnec;
              return _regenerator().w(function (_context) {
                while (1) switch (_context.n) {
                  case 0:
                    if ((_details$cancelConnec = details.cancelConnect) !== null && _details$cancelConnec !== void 0 && _details$cancelConnec.newValue) {
                      abortController.abort('manual disconnect');
                    }
                  case 1:
                    return _context.a(2);
                }
              }, _callee);
            }));
            return function (_x14) {
              return _ref2.apply(this, arguments);
            };
          }());
          _context3.n = 3;
          return _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_0__.CountrySelectorService.getCityCodeForCountry(countryNameTemp);
        case 3:
          cityCode = _context3.v;
          _context3.n = 4;
          return _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_0__.CountrySelectorService.getInfoByCityCode(cityCode);
        case 4:
          cityInfo = _context3.v;
          _context3.n = 5;
          return _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default().getApiGateways(isReconnect, abortController);
        case 5:
          _context3.n = 6;
          return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__.checkManualCancelConnectAndDisconnect)(sendResponse);
        case 6:
          if (!_context3.v) {
            _context3.n = 7;
            break;
          }
          return _context3.a(2);
        case 7:
          _context3.n = 8;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getApiGateways();
        case 8:
          apiGateways = _context3.v;
          _context3.n = 9;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getApiGatewayMain();
        case 9:
          apiGatewayMain = _context3.v;
          if (apiGateways !== null && apiGateways !== void 0 && apiGateways.length) {
            _context3.n = 12;
            break;
          }
          _context3.n = 10;
          return handleConnectError({
            sendResponse: sendResponse,
            message: _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default().t('invalid_connect'),
            should_disconnect: true,
            disable_auto_connect: true,
            disable_kill_switch: true
          });
        case 10:
          _context3.n = 11;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_14__["default"].addEvents('service.error_connect', {}, 'Empty apiGateways');
        case 11:
          return _context3.a(2);
        case 12:
          _context3.n = 13;
          return getApiGatewaysForCity(cityInfo, isReconnect);
        case 13:
          apiGatewaysForCity = _context3.v;
          if (!isPause) {
            _context3.n = 14;
            break;
          }
          _context3.n = 14;
          return (0,_sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_7__.handleDeletePause)(function () {});
        case 14:
          countryName = countryNameTemp;
          _context3.n = 15;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getToken();
        case 15:
          token = _context3.v;
          _context3.n = 16;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveForceCancelConnect(false);
        case 16:
          _context3.n = 17;
          return _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default().getConnect(token, cityCode, abortController);
        case 17:
          response = _context3.v;
          serverDomain = (_response = response) === null || _response === void 0 || (_response = _response.data) === null || _response === void 0 || (_response = _response.data) === null || _response === void 0 ? void 0 : _response.server_domain;
          _context3.n = 18;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getCurrentProxy();
        case 18:
          currentProxy = _context3.v;
          isNewProxyDomain = !_services_VpnService__WEBPACK_IMPORTED_MODULE_5__.VpnService.checkIsSameServerDomain(serverDomain, currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.host);
          _context3.n = 19;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveIsNewProxyDomain(isNewProxyDomain);
        case 19:
          _context3.n = 20;
          return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__.checkManualCancelConnectAndDisconnect)(sendResponse);
        case 20:
          if (!_context3.v) {
            _context3.n = 21;
            break;
          }
          return _context3.a(2);
        case 21:
          if (!(!response || !response.success)) {
            _context3.n = 49;
            break;
          }
          if (!(response.status === 401)) {
            _context3.n = 39;
            break;
          }
          _context3.n = 22;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getAuthData();
        case 22:
          _yield$StorageService = _context3.v;
          jwt = _yield$StorageService.jwt;
          newResponseAfterRefresh = null;
          tempSendResponse = /*#__PURE__*/function () {
            var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(result) {
              return _regenerator().w(function (_context2) {
                while (1) switch (_context2.n) {
                  case 0:
                    if (!result.success) {
                      sendResponse(result);
                    }
                  case 1:
                    return _context2.a(2);
                }
              }, _callee2);
            }));
            return function tempSendResponse(_x15) {
              return _ref3.apply(this, arguments);
            };
          }();
          _context3.n = 23;
          return (0,_sw_main_auth__WEBPACK_IMPORTED_MODULE_13__.refreshTokenByToken)(tempSendResponse);
        case 23:
          response_token = _context3.v;
          _context3.n = 24;
          return getUpdatedJwt(jwt);
        case 24:
          updatedAuthData = _context3.v;
          if (!(updatedAuthData && updatedAuthData.jwt)) {
            _context3.n = 36;
            break;
          }
          _sw_main_websocket__WEBPACK_IMPORTED_MODULE_6___default().updateWebSocketToken(updatedAuthData.jwt);
          if (!response_token) {
            _context3.n = 33;
            break;
          }
          _context3.n = 25;
          return _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default().getConnect(updatedAuthData.jwt, cityCode, abortController);
        case 25:
          newResponseAfterRefresh = _context3.v;
          response = newResponseAfterRefresh;
          _context3.n = 26;
          return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__.checkManualCancelConnectAndDisconnect)(sendResponse);
        case 26:
          if (!_context3.v) {
            _context3.n = 27;
            break;
          }
          return _context3.a(2);
        case 27:
          if (!response.success) {
            _context3.n = 32;
            break;
          }
          if (countryName) {
            _context3.n = 29;
            break;
          }
          cityCode = (_response2 = response) === null || _response2 === void 0 || (_response2 = _response2.data) === null || _response2 === void 0 || (_response2 = _response2.data) === null || _response2 === void 0 ? void 0 : _response2.city_code;
          _context3.n = 28;
          return _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_0__.CountrySelectorService.getCountryByCity(cityCode);
        case 28:
          countryName = _context3.v;
        case 29:
          _context3.n = 30;
          return pause(500);
        case 30:
          _context3.n = 31;
          return connectWithCityCodeLogic(response, countryName, cityCode, sendResponse);
        case 31:
          return _context3.a(2);
        case 32:
          _context3.n = 35;
          break;
        case 33:
          _context3.n = 34;
          return handleConnectError({
            sendResponse: sendResponse,
            message: _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default().t('invalid_connect'),
            should_disconnect: true,
            disable_auto_connect: true,
            disable_kill_switch: true
          });
        case 34:
          return _context3.a(2);
        case 35:
          _context3.n = 38;
          break;
        case 36:
          _context3.n = 37;
          return handleConnectError({
            sendResponse: sendResponse,
            message: _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default().t('invalid_connect'),
            should_disconnect: true,
            disable_auto_connect: true,
            disable_kill_switch: true
          });
        case 37:
          return _context3.a(2);
        case 38:
          if (!((_newResponseAfterRefr = newResponseAfterRefresh) !== null && _newResponseAfterRefr !== void 0 && _newResponseAfterRefr.success)) {
            _context3.n = 39;
            break;
          }
          return _context3.a(2);
        case 39:
          if (![400, 403, 422, 500].includes(response.status)) {
            _context3.n = 47;
            break;
          }
          if (!(response.status === 400 && (((_response3 = response) === null || _response3 === void 0 || (_response3 = _response3.data) === null || _response3 === void 0 ? void 0 : _response3.code) === 'server_not_available' || ((_response4 = response) === null || _response4 === void 0 || (_response4 = _response4.data) === null || _response4 === void 0 ? void 0 : _response4.code) === 'invalid_server'))) {
            _context3.n = 44;
            break;
          }
          _context3.n = 40;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getSettings();
        case 40:
          settings = _context3.v;
          changeApiGateway = !apiGatewaysForCity ? settings.changeApiGateway : false;
          if (changeApiGateway) {
            _context3.n = 44;
            break;
          }
          _context3.n = 41;
          return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__.checkManualCancelConnectAndDisconnect)(sendResponse);
        case 41:
          if (!_context3.v) {
            _context3.n = 42;
            break;
          }
          return _context3.a(2);
        case 42:
          _context3.n = 43;
          return (0,_common_functions_connectWithChangeApiGateway__WEBPACK_IMPORTED_MODULE_16__.connectWithChangeApiGateway)(apiGatewaysForCity, currentProxy, apiGatewayMain);
        case 43:
          return _context3.a(2, _context3.v);
        case 44:
          if (!((_response5 = response) !== null && _response5 !== void 0 && (_response5 = _response5.data) !== null && _response5 !== void 0 && _response5.code && response.data.code === 'no_subscription')) {
            _context3.n = 45;
            break;
          }
          _context3.n = 45;
          return (0,_common_functions_checkSubscriptions__WEBPACK_IMPORTED_MODULE_15__.updateSubscriptionData)();
        case 45:
          _context3.n = 46;
          return handleConnectError({
            sendResponse: sendResponse,
            message: ((_response$data = response.data) === null || _response$data === void 0 ? void 0 : _response$data.message) || _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default().t('invalid_connect'),
            should_disconnect: true,
            code: (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.code,
            disable_kill_switch: true
          });
        case 46:
          return _context3.a(2);
        case 47:
          _context3.n = 48;
          return handleConnectError({
            sendResponse: sendResponse,
            message: ((_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : _response$data3.message) || _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default().t('invalid_connect'),
            should_disconnect: true
          });
        case 48:
          return _context3.a(2);
        case 49:
          if (countryName) {
            _context3.n = 51;
            break;
          }
          cityCode = (_response6 = response) === null || _response6 === void 0 || (_response6 = _response6.data) === null || _response6 === void 0 || (_response6 = _response6.data) === null || _response6 === void 0 ? void 0 : _response6.city_code;
          _context3.n = 50;
          return _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_0__.CountrySelectorService.getCountryByCity(cityCode);
        case 50:
          countryName = _context3.v;
        case 51:
          if (cityCode) {
            _context3.n = 53;
            break;
          }
          _context3.n = 52;
          return handleConnectError({
            sendResponse: sendResponse,
            message: "No city found for ".concat(countryName)
          });
        case 52:
          return _context3.a(2);
        case 53:
          _context3.n = 54;
          return pause(1000);
        case 54:
          _context3.n = 55;
          return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__.checkManualCancelConnectAndDisconnect)(sendResponse);
        case 55:
          if (!_context3.v) {
            _context3.n = 56;
            break;
          }
          return _context3.a(2);
        case 56:
          _context3.n = 57;
          return connectWithCityCodeLogic(response, countryName, cityCode, sendResponse, isPause);
        case 57:
          _context3.n = 60;
          break;
        case 58:
          _context3.p = 58;
          _t = _context3.v;
          _context3.n = 59;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_14__["default"].addEvents('service.error_connect_info', {}, _t.message);
        case 59:
          _context3.n = 60;
          return handleConnectError({
            sendResponse: sendResponse,
            message: "Failed to connect to ".concat(countryNameTemp, ": ").concat(_t.message),
            should_disconnect: true
          });
        case 60:
          return _context3.a(2);
      }
    }, _callee3, null, [[1, 58]]);
  }));
  return _connect.apply(this, arguments);
}
function connectBySelectedServer(_x2, _x3) {
  return _connectBySelectedServer.apply(this, arguments);
}
function _connectBySelectedServer() {
  _connectBySelectedServer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(server, sendResponse) {
    var locationSpoofing,
      isPause,
      _args4 = arguments,
      _t2;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.p = _context4.n) {
        case 0:
          locationSpoofing = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : true;
          isPause = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : false;
          _context4.p = 1;
          _context4.n = 2;
          return _services_VpnService__WEBPACK_IMPORTED_MODULE_5__.VpnService.connectSelectIp(server, sendResponse, locationSpoofing, isPause);
        case 2:
          return _context4.a(2, _context4.v);
        case 3:
          _context4.p = 3;
          _t2 = _context4.v;
          sendResponse({
            success: false,
            error: _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default().t('invalid_connect')
          });
          return _context4.a(2, false);
      }
    }, _callee4, null, [[1, 3]]);
  }));
  return _connectBySelectedServer.apply(this, arguments);
}
function sendStartRequest(_x4, _x5) {
  return _sendStartRequest.apply(this, arguments);
}
function _sendStartRequest() {
  _sendStartRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(username, password) {
    var serverDomain, request;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.n) {
        case 0:
          _context5.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getServerDomain();
        case 1:
          serverDomain = _context5.v;
          request = new _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_9__.HttpRequestApi(serverDomain);
          _context5.n = 2;
          return request.sendStartConnectRequest(username, password);
        case 2:
          return _context5.a(2);
      }
    }, _callee5);
  }));
  return _sendStartRequest.apply(this, arguments);
}
function connectWithCityCodeLogic(_x6, _x7, _x8, _x9, _x0) {
  return _connectWithCityCodeLogic.apply(this, arguments);
}
function _connectWithCityCodeLogic() {
  _connectWithCityCodeLogic = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(response, countryName, cityCode, sendResponse, isPause) {
    var proxyServer;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.n) {
        case 0:
          if (!(!response || !response.data)) {
            _context6.n = 2;
            break;
          }
          _context6.n = 1;
          return handleConnectError({
            sendResponse: sendResponse,
            message: _services_TranslateService__WEBPACK_IMPORTED_MODULE_11___default().t('invalid_connect')
          });
        case 1:
          return _context6.a(2);
        case 2:
          _context6.n = 3;
          return getProxyServerOptionsFromParams(response, cityCode, countryName);
        case 3:
          proxyServer = _context6.v;
          _context6.n = 4;
          return _services_VpnService__WEBPACK_IMPORTED_MODULE_5__.VpnService.connectSelectIp(proxyServer, sendResponse, true, isPause);
        case 4:
          return _context6.a(2);
      }
    }, _callee6);
  }));
  return _connectWithCityCodeLogic.apply(this, arguments);
}
function getProxyServerOptionsFromParams(_x1, _x10, _x11) {
  return _getProxyServerOptionsFromParams.apply(this, arguments);
}
function _getProxyServerOptionsFromParams() {
  _getProxyServerOptionsFromParams = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(response, cityCode, countryName) {
    var _response$data4;
    var _ref4, city_code, username, password, server_domain, domain, cityInfo, _ref5, _ref5$lon, lon, _ref5$lat, lat, _ref6, _ref6$timeZone, timeZone, _ref6$offset, offset;
    return _regenerator().w(function (_context7) {
      while (1) switch (_context7.n) {
        case 0:
          _ref4 = (response === null || response === void 0 || (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.data) || {}, city_code = _ref4.city_code, username = _ref4.username, password = _ref4.password, server_domain = _ref4.server_domain;
          domain = server_domain || _sw_constants_server_proxy_constants__WEBPACK_IMPORTED_MODULE_10__.SERVER_PROXY;
          (0,_sw_tools_log__WEBPACK_IMPORTED_MODULE_8__.log)(_sw_tools_log__WEBPACK_IMPORTED_MODULE_8__.LOG_LEVELS.INFO, 'SERVER_PROXY', domain);
          _context7.n = 1;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_14__["default"].addEvents('service.proxy_server_options_from_params', {}, domain);
        case 1:
          _context7.n = 2;
          return _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_0__.CountrySelectorService.getInfoByCityCode(cityCode);
        case 2:
          cityInfo = _context7.v;
          _ref5 = (cityInfo === null || cityInfo === void 0 ? void 0 : cityInfo.coordinates) || {}, _ref5$lon = _ref5.lon, lon = _ref5$lon === void 0 ? 0 : _ref5$lon, _ref5$lat = _ref5.lat, lat = _ref5$lat === void 0 ? 0 : _ref5$lat;
          _ref6 = _sw_constants_country_code_mapping__WEBPACK_IMPORTED_MODULE_4__.CITY_TIMEZONE_MAPPING[city_code] || {}, _ref6$timeZone = _ref6.timeZone, timeZone = _ref6$timeZone === void 0 ? '' : _ref6$timeZone, _ref6$offset = _ref6.offset, offset = _ref6$offset === void 0 ? 0 : _ref6$offset;
          return _context7.a(2, _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_0__.CountrySelectorService.getApiCountryProxy(countryName, domain, username, password, lat, lon, timeZone, offset));
      }
    }, _callee7);
  }));
  return _getProxyServerOptionsFromParams.apply(this, arguments);
}
function getUpdatedJwt(_x12) {
  return _getUpdatedJwt.apply(this, arguments);
}
function _getUpdatedJwt() {
  _getUpdatedJwt = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(previousJwt) {
    var newAuthData;
    return _regenerator().w(function (_context8) {
      while (1) switch (_context8.n) {
        case 0:
          _context8.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getAuthData();
        case 1:
          newAuthData = _context8.v;
          if (!(newAuthData.jwt && newAuthData.jwt !== previousJwt)) {
            _context8.n = 2;
            break;
          }
          return _context8.a(2, newAuthData);
        case 2:
          return _context8.a(2);
      }
    }, _callee8);
  }));
  return _getUpdatedJwt.apply(this, arguments);
}
function handleConnectError(_x13) {
  return _handleConnectError.apply(this, arguments);
}
function _handleConnectError() {
  _handleConnectError = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref) {
    var sendResponse, message, _ref$should_disconnec, should_disconnect, code, _ref$disable_auto_con, disable_auto_connect, _ref$disable_kill_swi, disable_kill_switch, settings, userData;
    return _regenerator().w(function (_context9) {
      while (1) switch (_context9.n) {
        case 0:
          sendResponse = _ref.sendResponse, message = _ref.message, _ref$should_disconnec = _ref.should_disconnect, should_disconnect = _ref$should_disconnec === void 0 ? false : _ref$should_disconnec, code = _ref.code, _ref$disable_auto_con = _ref.disable_auto_connect, disable_auto_connect = _ref$disable_auto_con === void 0 ? false : _ref$disable_auto_con, _ref$disable_kill_swi = _ref.disable_kill_switch, disable_kill_switch = _ref$disable_kill_swi === void 0 ? false : _ref$disable_kill_swi;
          if (!should_disconnect) {
            _context9.n = 6;
            break;
          }
          _context9.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getSettings();
        case 1:
          settings = _context9.v;
          _context9.n = 2;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().getUserData();
        case 2:
          userData = _context9.v;
          if (userData && userData.has_active_subscription === false) {
            code = 'no_subscription';
          }
          if (!(disable_auto_connect || code === 'no_subscription')) {
            _context9.n = 3;
            break;
          }
          _context9.n = 3;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
            autoConnect: false
          }));
        case 3:
          if (!disable_kill_switch) {
            _context9.n = 5;
            break;
          }
          _context9.n = 4;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_2___default().saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
            killSwitch: false
          }));
        case 4:
          _context9.n = 5;
          return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__.clearKillSwitch)(function () {});
        case 5:
          _context9.n = 6;
          return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_3__.disconnectProxyWithUpdateState)(function () {}, true);
        case 6:
          sendResponse({
            success: false,
            error: message,
            code: code
          });
        case 7:
          return _context9.a(2);
      }
    }, _callee9);
  }));
  return _handleConnectError.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/services/CountrySelectorService.js":
/*!*******************************************************!*\
  !*** ./src/common/services/CountrySelectorService.js ***!
  \*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CountrySelectorService: () => (/* binding */ CountrySelectorService)
/* harmony export */ });
/* harmony import */ var _entities_proxyserver__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @entities/proxyserver */ "./src/entities/proxyserver.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
/* harmony import */ var _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_services_ApiClient__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _sw_constants_country_code_mapping__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @sw/constants/country_code_mapping */ "./src/sw/constants/country_code_mapping.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js");
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_4__);
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }





var _require = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js"),
  FLAG_DOMAIN = _require.FLAG_DOMAIN;
var timeUpdate = null;
var CountrySelectorService = /*#__PURE__*/function () {
  function CountrySelectorService() {
    _classCallCheck(this, CountrySelectorService);
  }
  return _createClass(CountrySelectorService, null, [{
    key: "getApiCities",
    value: function () {
      var _getApiCities = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
        var apiCities;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.n) {
            case 0:
              _context.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_3___default().getCitiesList();
            case 1:
              apiCities = _context.v;
              if (!(apiCities && apiCities.length > 0)) {
                _context.n = 2;
                break;
              }
              return _context.a(2, apiCities);
            case 2:
              _context.n = 3;
              return CountrySelectorService.updateCities();
            case 3:
              return _context.a(2, _context.v);
          }
        }, _callee);
      }));
      function getApiCities() {
        return _getApiCities.apply(this, arguments);
      }
      return getApiCities;
    }()
  }, {
    key: "initUpdateCities",
    value: function initUpdateCities() {
      if (timeUpdate) {
        clearTimeout(timeUpdate);
        timeUpdate = null;
      }
      timeUpdate = setTimeout(function () {
        return CountrySelectorService.updateCitiesByTimeout();
      }, 60000);
    }
  }, {
    key: "updateCitiesByTimeout",
    value: function updateCitiesByTimeout() {
      CountrySelectorService.updateCities();
      if (timeUpdate) {
        clearTimeout(timeUpdate);
        timeUpdate = null;
      }
      timeUpdate = setTimeout(function () {
        return CountrySelectorService.updateCitiesByTimeout();
      }, 1200000);
    }
  }, {
    key: "updateCities",
    value: function () {
      var _updateCities = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
        var _t;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.p = _context2.n) {
            case 0:
              _context2.p = 0;
              _context2.n = 1;
              return _services_ApiClient__WEBPACK_IMPORTED_MODULE_1___default().getCities();
            case 1:
              return _context2.a(2, _context2.v);
            case 2:
              _context2.p = 2;
              _t = _context2.v;
              return _context2.a(2, []);
          }
        }, _callee2, null, [[0, 2]]);
      }));
      function updateCities() {
        return _updateCities.apply(this, arguments);
      }
      return updateCities;
    }()
  }, {
    key: "getApiCountryList",
    value: function () {
      var _getApiCountryList = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
        var cities, countryMap;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              _context3.n = 1;
              return this.getApiCities();
            case 1:
              cities = _context3.v;
              countryMap = new Map();
              cities.forEach(function (city) {
                var existing = countryMap.get(city.country) || {
                  cities: [],
                  cityCount: 0
                };
                existing.cities.push(city);
                existing.cityCount += 1;
                countryMap.set(city.country, existing);
              });
              return _context3.a(2, Array.from(countryMap.entries()).map(function (_ref) {
                var _COUNTRY_CODE_MAPPING;
                var _ref2 = _slicedToArray(_ref, 2),
                  name = _ref2[0],
                  data = _ref2[1];
                return {
                  name: name,
                  flag: "".concat(FLAG_DOMAIN).concat(((_COUNTRY_CODE_MAPPING = _sw_constants_country_code_mapping__WEBPACK_IMPORTED_MODULE_2__.COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2[data.cities[0].country_code]) === null || _COUNTRY_CODE_MAPPING === void 0 ? void 0 : _COUNTRY_CODE_MAPPING.toLowerCase()) || 'xx', ".png"),
                  city: data.cities[0].city,
                  code: data.cities[0].code,
                  cities: data.cities,
                  coordinates: data.cities[0].coordinates,
                  api_gateways: data.cities[0].api_gateways,
                  cityCount: data.cityCount
                };
              }));
          }
        }, _callee3, this);
      }));
      function getApiCountryList() {
        return _getApiCountryList.apply(this, arguments);
      }
      return getApiCountryList;
    }()
  }, {
    key: "getCityCodeForCountry",
    value: function () {
      var _getCityCodeForCountry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(countryName) {
        var cityCode, cities, city, _city, _city2;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              _context4.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_3___default().getSelectedCity();
            case 1:
              cityCode = _context4.v;
              _context4.n = 2;
              return this.getApiCities();
            case 2:
              cities = _context4.v;
              if (!cityCode) {
                _context4.n = 6;
                break;
              }
              city = cities.find(function (c) {
                return c.country === countryName && c.code === cityCode;
              });
              if (!city) {
                _context4.n = 3;
                break;
              }
              return _context4.a(2, cityCode);
            case 3:
              _context4.n = 4;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_3___default().clearSelectedCity();
            case 4:
              _city = cities.find(function (c) {
                return c.country === countryName;
              });
              return _context4.a(2, _city ? _city.code : null);
            case 5:
              _context4.n = 7;
              break;
            case 6:
              _city2 = cities.find(function (c) {
                return c.country === countryName;
              });
              return _context4.a(2, _city2 ? _city2.code : null);
            case 7:
              return _context4.a(2);
          }
        }, _callee4, this);
      }));
      function getCityCodeForCountry(_x) {
        return _getCityCodeForCountry.apply(this, arguments);
      }
      return getCityCodeForCountry;
    }()
  }, {
    key: "getCountryByCity",
    value: function () {
      var _getCountryByCity = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(cityCode) {
        var cities, city;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.n) {
            case 0:
              _context5.n = 1;
              return this.getApiCities();
            case 1:
              cities = _context5.v;
              city = cities.find(function (c) {
                return c.code === cityCode;
              });
              return _context5.a(2, city === null || city === void 0 ? void 0 : city.country);
          }
        }, _callee5, this);
      }));
      function getCountryByCity(_x2) {
        return _getCountryByCity.apply(this, arguments);
      }
      return getCountryByCity;
    }()
  }, {
    key: "getInfoByCityCode",
    value: function () {
      var _getInfoByCityCode = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(code) {
        var cities, city;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              _context6.n = 1;
              return this.getApiCities();
            case 1:
              cities = _context6.v;
              city = cities.find(function (c) {
                return c.code === code;
              });
              return _context6.a(2, city ? city : null);
          }
        }, _callee6, this);
      }));
      function getInfoByCityCode(_x3) {
        return _getInfoByCityCode.apply(this, arguments);
      }
      return getInfoByCityCode;
    }()
  }, {
    key: "getApiCountryProxy",
    value: function getApiCountryProxy(countryName, serverDomain, username, password) {
      var lat = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
      var lon = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
      var timeZone = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : "";
      var offset = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 0;
      return new _entities_proxyserver__WEBPACK_IMPORTED_MODULE_0__.ProxyServer(serverDomain, _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_4__.SERVER_DEF_PORT, countryName, username, password, lat, lon, timeZone, offset);
    }
  }, {
    key: "getRandomCountry",
    value: function () {
      var _getRandomCountry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
        var countries, countryNames;
        return _regenerator().w(function (_context7) {
          while (1) switch (_context7.n) {
            case 0:
              _context7.n = 1;
              return this.getApiCountryList();
            case 1:
              countries = _context7.v;
              countryNames = countries.map(function (country) {
                return country.name;
              });
              if (!(countryNames.length === 0)) {
                _context7.n = 2;
                break;
              }
              return _context7.a(2, "");
            case 2:
              return _context7.a(2, countryNames[Math.floor(Math.random() * countryNames.length)]);
          }
        }, _callee7, this);
      }));
      function getRandomCountry() {
        return _getRandomCountry.apply(this, arguments);
      }
      return getRandomCountry;
    }()
  }]);
}();

/***/ }),

/***/ "./src/common/services/HttpRequestApi.js":
/*!***********************************************!*\
  !*** ./src/common/services/HttpRequestApi.js ***!
  \***********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   HttpRequestApi: () => (/* binding */ HttpRequestApi),
/* harmony export */   sendEndConnectRequestByServer: () => (/* binding */ sendEndConnectRequestByServer)
/* harmony export */ });
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _sw_tools_log__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js");
/* harmony import */ var _common_functions_generateDeviceId__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @common/functions/generateDeviceId */ "./src/common/functions/generateDeviceId.js");
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js");
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _services_LogsService__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_common_browserApi__WEBPACK_IMPORTED_MODULE_5__);
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }






var START_STATUS = 'start';
var END_STATUS = 'end';
var PING_STATUS = 'ping';
var SWITCH_STATUS = 'switch';
var buildHeaders = function buildHeaders(auth, status) {
  return {
    'X-Auth': "Basic ".concat(auth),
    'Authorization': "Basic ".concat(auth),
    'Connection': 'keep-alive',
    'Accept-Encoding': 'identity',
    'Apexguard-Session-Action': status
  };
};
var HttpRequestApi = /*#__PURE__*/function () {
  function HttpRequestApi(serverProxy) {
    _classCallCheck(this, HttpRequestApi);
    this.serverProxy = serverProxy;
  }
  return _createClass(HttpRequestApi, [{
    key: "sendStartConnectRequest",
    value: function () {
      var _sendStartConnectRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
        var username,
          password,
          abortByTimer,
          without_double,
          _args = arguments;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.n) {
            case 0:
              username = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
              password = _args.length > 1 && _args[1] !== undefined ? _args[1] : null;
              abortByTimer = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
              without_double = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
              _context.n = 1;
              return this.sendConnectCheckUser(username, password, START_STATUS, abortByTimer, without_double);
            case 1:
              return _context.a(2, _context.v);
          }
        }, _callee, this);
      }));
      function sendStartConnectRequest() {
        return _sendStartConnectRequest.apply(this, arguments);
      }
      return sendStartConnectRequest;
    }()
  }, {
    key: "sendEndConnectRequest",
    value: function () {
      var _sendEndConnectRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
        var username,
          password,
          abortByTimer,
          without_double,
          _args2 = arguments;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.n) {
            case 0:
              username = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : null;
              password = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : null;
              abortByTimer = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
              without_double = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : false;
              _context2.n = 1;
              return this.sendConnectCheckUser(username, password, END_STATUS, abortByTimer, without_double);
            case 1:
              return _context2.a(2, _context2.v);
          }
        }, _callee2, this);
      }));
      function sendEndConnectRequest() {
        return _sendEndConnectRequest.apply(this, arguments);
      }
      return sendEndConnectRequest;
    }()
  }, {
    key: "sendSwitchConnectRequest",
    value: function () {
      var _sendSwitchConnectRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
        var username,
          password,
          abortByTimer,
          _args3 = arguments;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              username = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : null;
              password = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : null;
              abortByTimer = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : false;
              _context3.n = 1;
              return this.sendConnectCheckUser(username, password, SWITCH_STATUS, abortByTimer);
            case 1:
              return _context3.a(2, _context3.v);
          }
        }, _callee3, this);
      }));
      function sendSwitchConnectRequest() {
        return _sendSwitchConnectRequest.apply(this, arguments);
      }
      return sendSwitchConnectRequest;
    }()
  }, {
    key: "sendPingConnectRequest",
    value: function () {
      var _sendPingConnectRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
        var username,
          password,
          _args4 = arguments;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              username = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
              password = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : null;
              _context4.n = 1;
              return this.sendConnectCheckUser(username, password, PING_STATUS);
            case 1:
              return _context4.a(2, _context4.v);
          }
        }, _callee4, this);
      }));
      function sendPingConnectRequest() {
        return _sendPingConnectRequest.apply(this, arguments);
      }
      return sendPingConnectRequest;
    }()
  }, {
    key: "sendConnectCheckUser",
    value: function () {
      var _sendConnectCheckUser = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
        var usernameTemp,
          passwordTemp,
          status,
          abortByTimer,
          without_double,
          data,
          username,
          password,
          pauseSettings,
          _args5 = arguments;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.n) {
            case 0:
              usernameTemp = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : null;
              passwordTemp = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : null;
              status = _args5.length > 2 ? _args5[2] : undefined;
              abortByTimer = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : false;
              without_double = _args5.length > 4 && _args5[4] !== undefined ? _args5[4] : false;
              _context5.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getPauseSetting();
            case 1:
              pauseSettings = _context5.v;
              if ((!usernameTemp || !passwordTemp) && pauseSettings !== null && pauseSettings !== void 0 && pauseSettings.pauseProxy) {
                data = pauseSettings.pauseProxy;
                if (data) {
                  username = data.username;
                  password = data.password;
                }
              } else {
                username = usernameTemp;
                password = passwordTemp;
              }
              if (!((!username || !password) && status !== START_STATUS)) {
                _context5.n = 2;
                break;
              }
              return _context5.a(2, null);
            case 2:
              _context5.n = 3;
              return this.sendConnectStatusRequest(username, password, status, abortByTimer, without_double);
            case 3:
              return _context5.a(2, _context5.v);
          }
        }, _callee5, this);
      }));
      function sendConnectCheckUser() {
        return _sendConnectCheckUser.apply(this, arguments);
      }
      return sendConnectCheckUser;
    }()
  }, {
    key: "sendConnectStatusRequest",
    value: function () {
      var _sendConnectStatusRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(username, password, status) {
        var abortByTimer,
          without_double,
          controller,
          startPing,
          timeout,
          onStorageChanged,
          deviceId,
          auth,
          signal,
          logStatus,
          response,
          lastPing,
          _lastPing,
          _args6 = arguments,
          _t;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.p = _context6.n) {
            case 0:
              abortByTimer = _args6.length > 3 && _args6[3] !== undefined ? _args6[3] : false;
              without_double = _args6.length > 4 && _args6[4] !== undefined ? _args6[4] : false;
              if (abortByTimer) {
                controller = new AbortController();
              }
              startPing = performance.now();
              _context6.p = 1;
              if (abortByTimer) {
                onStorageChanged = function onStorageChanged(details) {
                  var _details$cancelDiscon;
                  if ((_details$cancelDiscon = details.cancelDisconnect) !== null && _details$cancelDiscon !== void 0 && _details$cancelDiscon.newValue) {
                    controller.abort();
                  }
                };
                _common_browserApi__WEBPACK_IMPORTED_MODULE_5___default().storage.onChanged.addListener(onStorageChanged);
              }
              _context6.n = 2;
              return (0,_common_functions_generateDeviceId__WEBPACK_IMPORTED_MODULE_2__.generateDeviceIdForProxyServer)();
            case 2:
              deviceId = _context6.v;
              auth = btoa("".concat(deviceId, "|").concat(username, "|").concat(this.serverProxy, ":").concat(password));
              signal = controller ? controller.signal : undefined;
              if (abortByTimer) {
                timeout = setTimeout(function () {
                  controller.abort();
                  (0,_sw_tools_log__WEBPACK_IMPORTED_MODULE_1__.log)(_sw_tools_log__WEBPACK_IMPORTED_MODULE_1__.LOG_LEVELS.WARN, "[HttpRequest] ".concat(status, " aborted after 20s, retrying..."));
                }, 20000);
              }
              logStatus = status === END_STATUS ? 'closeserversession' : status;
              _context6.n = 3;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addConnectedEvents('fetch_start.sendConnectStatusRequest', {
                serverProxy: this.serverProxy,
                status: logStatus
              });
            case 3:
              _context6.n = 4;
              return fetch("https://".concat(this.serverProxy, ":").concat(_sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_3__.SERVER_DEF_PORT), {
                method: 'POST',
                headers: buildHeaders(auth, status),
                signal: signal
              });
            case 4:
              response = _context6.v;
              if (timeout) clearTimeout(timeout);
              if (onStorageChanged) _common_browserApi__WEBPACK_IMPORTED_MODULE_5___default().storage.onChanged.removeListener(onStorageChanged);
              lastPing = Math.round(performance.now() - startPing);
              _context6.n = 5;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addConnectedEvents('fetch_end.sendConnectStatusRequest', {
                status: status,
                ping: lastPing,
                response: response
              });
            case 5:
              if (response.ok) {
                _context6.n = 7;
                break;
              }
              _context6.n = 6;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addConnectedEvents('fetch_error.sendConnectStatusRequest', {
                status: status,
                ping: lastPing,
                code: response.status || 'NO_STATUS'
              });
            case 6:
              return _context6.a(2, false);
            case 7:
              return _context6.a(2, status === PING_STATUS ? response : true);
            case 8:
              _context6.p = 8;
              _t = _context6.v;
              if (timeout) clearTimeout(timeout);
              if (onStorageChanged) _common_browserApi__WEBPACK_IMPORTED_MODULE_5___default().storage.onChanged.removeListener(onStorageChanged);
              if (abortByTimer && _t.name === 'AbortError' && !without_double) {
                this.backgroundSendConnectStatusRequestQuiet(username, password, END_STATUS);
              }
              _lastPing = Math.round(performance.now() - startPing);
              _context6.n = 9;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addConnectedEvents('fetch_error.sendConnectStatusRequest', {
                error: _t.message,
                ping: _lastPing,
                code: (_t === null || _t === void 0 ? void 0 : _t.code) || 'NO_ERROR_CODE'
              });
            case 9:
              _context6.n = 10;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addEvents('init.error_send_connect_status_request', {}, '[HttpRequest] ' + status + " request error:".concat(_t));
            case 10:
              return _context6.a(2, false);
          }
        }, _callee6, this, [[1, 8]]);
      }));
      function sendConnectStatusRequest(_x, _x2, _x3) {
        return _sendConnectStatusRequest.apply(this, arguments);
      }
      return sendConnectStatusRequest;
    }()
  }, {
    key: "backgroundSendConnectStatusRequestQuiet",
    value: function () {
      var _backgroundSendConnectStatusRequestQuiet = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(username, password, status) {
        var serverProxy,
          url,
          deviceId,
          auth,
          result,
          notClosedSession,
          updatedSessions,
          _args7 = arguments,
          _t2;
        return _regenerator().w(function (_context7) {
          while (1) switch (_context7.p = _context7.n) {
            case 0:
              serverProxy = _args7.length > 3 && _args7[3] !== undefined ? _args7[3] : null;
              url = serverProxy ? serverProxy : this.serverProxy;
              _context7.p = 1;
              _context7.n = 2;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().addNotClosedSession({
                host: url,
                username: username,
                password: password
              });
            case 2:
              _context7.n = 3;
              return (0,_common_functions_generateDeviceId__WEBPACK_IMPORTED_MODULE_2__.generateDeviceIdForProxyServer)();
            case 3:
              deviceId = _context7.v;
              auth = btoa("".concat(deviceId, "|").concat(username, "|").concat(this.serverProxy, ":").concat(password));
              _context7.n = 4;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addConnectedEvents('fetch_start.duplicateSendConnectStatusRequest', {
                serverProxy: this.serverProxy,
                username: username,
                status: status
              });
            case 4:
              _context7.n = 5;
              return fetch("https://".concat(url, ":").concat(_sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_3__.SERVER_DEF_PORT), {
                method: 'POST',
                headers: buildHeaders(auth, status)
              });
            case 5:
              result = _context7.v;
              if (!(result && result.status === 202)) {
                _context7.n = 7;
                break;
              }
              _context7.n = 6;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getNotClosedSession();
            case 6:
              notClosedSession = _context7.v;
              updatedSessions = notClosedSession.filter(function (session) {
                return session.host !== url;
              });
              _context7.n = 7;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().saveNotClosedSession(updatedSessions);
            case 7:
              _context7.n = 8;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addConnectedEvents('fetch_end.duplicateSendConnectStatusRequest', {
                serverProxy: this.serverProxy,
                username: username,
                status: status
              });
            case 8:
              return _context7.a(2, true);
            case 9:
              _context7.p = 9;
              _t2 = _context7.v;
              _context7.n = 10;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().addNotClosedSession({
                host: url,
                username: username,
                password: password
              });
            case 10:
              _context7.n = 11;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_4__["default"].addConnectedEvents('fetch_error.duplicateSendConnectStatusRequest', {
                serverProxy: this.serverProxy,
                username: username,
                status: status,
                message: _t2.message,
                code: (_t2 === null || _t2 === void 0 ? void 0 : _t2.code) || 'NO_ERROR_CODE'
              });
            case 11:
              return _context7.a(2, false);
          }
        }, _callee7, this, [[1, 9]]);
      }));
      function backgroundSendConnectStatusRequestQuiet(_x4, _x5, _x6) {
        return _backgroundSendConnectStatusRequestQuiet.apply(this, arguments);
      }
      return backgroundSendConnectStatusRequestQuiet;
    }()
  }]);
}();
function sendEndConnectRequestByServer() {
  return _sendEndConnectRequestByServer.apply(this, arguments);
}
function _sendEndConnectRequestByServer() {
  _sendEndConnectRequestByServer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
    var username,
      password,
      abortByTimer,
      serverDomain,
      request,
      _args8 = arguments;
    return _regenerator().w(function (_context8) {
      while (1) switch (_context8.n) {
        case 0:
          username = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : null;
          password = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : null;
          abortByTimer = _args8.length > 2 && _args8[2] !== undefined ? _args8[2] : false;
          _context8.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getServerDomain();
        case 1:
          serverDomain = _context8.v;
          request = new HttpRequestApi(serverDomain);
          _context8.n = 2;
          return request.sendEndConnectRequest(username, password, abortByTimer);
        case 2:
          return _context8.a(2);
      }
    }, _callee8);
  }));
  return _sendEndConnectRequestByServer.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/services/ImportSettingsService.js":
/*!******************************************************!*\
  !*** ./src/common/services/ImportSettingsService.js ***!
  \******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
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 asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var translateService = __webpack_require__(/*! @common/services/TranslateService */ "./src/common/services/TranslateService.js");
var LISTEN_CONSTANTS = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js");
var utils = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js");
var _require = __webpack_require__(/*! @common/functions/pause */ "./src/common/functions/pause.js"),
  pause = _require.pause;
var _require2 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  enableForceKillSwitch = _require2.enableForceKillSwitch;
var _require3 = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js"),
  clearKillSwitch = _require3.clearKillSwitch;
var _require4 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require4.log,
  LOG_LEVELS = _require4.LOG_LEVELS;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var ImportSettingsService = /*#__PURE__*/function () {
  function ImportSettingsService() {
    _classCallCheck(this, ImportSettingsService);
  }
  return _createClass(ImportSettingsService, [{
    key: "openImportSettings",
    value: function openImportSettings(sendResponse) {
      browserApi.tabs.create({
        url: 'import.html'
      }, function () {
        if (browserApi.runtime.lastError) {
          LogsService.addEvents('import_setting.error_open_import_settings', {}, browserApi.runtime.lastError);
          sendResponse({
            success: false,
            error: 'Failed to open import page'
          });
        } else {
          sendResponse({
            success: true
          });
        }
      });
    }
  }, {
    key: "importSettings",
    value: function () {
      var _importSettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(message, sendResponse, handleInternalMessage) {
        var importedData, expectedFields, allFieldsEmpty, invalidFields, settingsWithSplitTunneling, dataToSave, settings, securitySettings, _t;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              _context.p = 0;
              importedData = JSON.parse(message.data);
              if (importedData) {
                _context.n = 2;
                break;
              }
              sendResponse({
                success: false,
                error: translateService.t('empty_importing_settings')
              });
              _context.n = 1;
              return LogsService.addEvents('import_setting.error_import_settings', {}, 'Error importing settings: empty file');
            case 1:
              return _context.a(2);
            case 2:
              expectedFields = ['settings', 'generalSettings', 'securitySettings'];
              allFieldsEmpty = expectedFields.every(function (field) {
                return !importedData[field] || Object.keys(importedData[field] || {}).length === 0;
              });
              if (!allFieldsEmpty) {
                _context.n = 4;
                break;
              }
              sendResponse({
                success: false,
                error: translateService.t('empty_importing_settings')
              });
              _context.n = 3;
              return LogsService.addEvents('import_setting.error_import_settings', {}, 'Error importing settings: all fields are empty');
            case 3:
              return _context.a(2);
            case 4:
              invalidFields = Object.keys(importedData).filter(function (field) {
                return !expectedFields.includes(field);
              });
              if (!(invalidFields.length > 0)) {
                _context.n = 6;
                break;
              }
              sendResponse({
                success: false,
                error: translateService.t('invalid_fields')
              });
              _context.n = 5;
              return LogsService.addEvents('import_setting.error_import_settings', {
                invalidFields: invalidFields.join(', ')
              }, 'Invalid fields');
            case 5:
              return _context.a(2);
            case 6:
              settingsWithSplitTunneling = _objectSpread(_objectSpread({}, importedData.settings || {}), {}, {
                splitTunneling: true
              });
              dataToSave = {
                settings: settingsWithSplitTunneling,
                generalSettings: importedData.generalSettings || {},
                securitySettings: importedData.securitySettings || {}
              };
              _context.n = 7;
              return StorageService.getSettings();
            case 7:
              settings = _context.v;
              _context.n = 8;
              return StorageService.importSettings(dataToSave);
            case 8:
              _context.n = 9;
              return StorageService.getSecuritySettings();
            case 9:
              securitySettings = _context.v;
              _context.n = 10;
              return Promise.all([utils.enableWebRTCProtection(securitySettings.stopWebRTC !== undefined ? securitySettings.stopWebRTC : true), utils.enableThreatProtection(securitySettings.threatProtection || false)]);
            case 10:
              if (!dataToSave.settings.killSwitch) {
                _context.n = 12;
                break;
              }
              _context.n = 11;
              return enableForceKillSwitch();
            case 11:
              _context.n = 13;
              break;
            case 12:
              _context.n = 13;
              return clearKillSwitch(function () {});
            case 13:
              if (!dataToSave.settings.splitTunneling) {
                _context.n = 14;
                break;
              }
              _context.n = 14;
              return this.importSplitTunneling(dataToSave.settings.splitTunnelingList, settings.splitTunnelingList, handleInternalMessage);
            case 14:
              _context.n = 15;
              return LogsService.addEvents('import_setting.import_settings', dataToSave);
            case 15:
              sendResponse({
                success: true,
                dataToSave: dataToSave,
                message: translateService.t('settings_imported_successfully')
              });
              _context.n = 17;
              break;
            case 16:
              _context.p = 16;
              _t = _context.v;
              sendResponse({
                success: false,
                error: 'Error importing settings: invalid file format'
              });
              _context.n = 17;
              return LogsService.addEvents('import_setting.error_import_settings', {}, _t.message);
            case 17:
              return _context.a(2);
          }
        }, _callee, this, [[0, 16]]);
      }));
      function importSettings(_x, _x2, _x3) {
        return _importSettings.apply(this, arguments);
      }
      return importSettings;
    }()
  }, {
    key: "importSplitTunneling",
    value: function () {
      var _importSplitTunneling = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
        var list,
          oldSplitTunneling,
          handleInternalMessage,
          action,
          missingDomains,
          _iterator,
          _step,
          domain,
          _args2 = arguments;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.n) {
            case 0:
              list = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : [];
              oldSplitTunneling = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : [];
              handleInternalMessage = _args2.length > 2 ? _args2[2] : undefined;
              action = LISTEN_CONSTANTS.UPDATE_SPLIT_TUNNELING_LIST;
              _context2.n = 1;
              return LogsService.addEvents("action.send.".concat(LISTEN_CONSTANTS.UPDATE_SPLIT_TUNNELING_LIST), {
                method_send: 'importSplitTunneling'
              });
            case 1:
              missingDomains = list.filter(function (domain) {
                return !oldSplitTunneling.includes(domain);
              });
              _context2.n = 2;
              return handleInternalMessage(list ? {
                action: action,
                list: list
              } : {
                action: action
              });
            case 2:
              _context2.n = 3;
              return pause(500);
            case 3:
              _iterator = _createForOfIteratorHelper(missingDomains);
              try {
                for (_iterator.s(); !(_step = _iterator.n()).done;) {
                  domain = _step.value;
                  this.reloadTabs(domain);
                }
              } catch (err) {
                _iterator.e(err);
              } finally {
                _iterator.f();
              }
            case 4:
              return _context2.a(2);
          }
        }, _callee2, this);
      }));
      function importSplitTunneling() {
        return _importSplitTunneling.apply(this, arguments);
      }
      return importSplitTunneling;
    }()
  }, {
    key: "reloadTabs",
    value: function reloadTabs(domain) {
      var that = this;
      browserApi.tabs.query({}, function (tabs) {
        var _iterator2 = _createForOfIteratorHelper(tabs),
          _step2;
        try {
          for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
            var tab = _step2.value;
            if (!tab.url) continue;
            try {
              var url = new URL(tab.url);
              var hostname = url.hostname;
              if (hostname === "" || hostname.startsWith("chrome://")) {
                continue;
              }
              if (that.matchesDomainPattern(hostname, domain)) {
                browserApi.tabs.reload(tab.id);
              }
            } catch (e) {
              log(LOG_LEVELS.WARN, "Invalid URL in tab:", tab.url);
            }
          }
        } catch (err) {
          _iterator2.e(err);
        } finally {
          _iterator2.f();
        }
      });
    }
  }, {
    key: "matchesDomainPattern",
    value: function matchesDomainPattern(hostname, domainPattern) {
      domainPattern = domainPattern.trim();
      if (domainPattern.startsWith("*.")) {
        var baseDomain = domainPattern.slice(2);
        return hostname === baseDomain || hostname.endsWith(".".concat(baseDomain));
      } else if (domainPattern.startsWith("*")) {
        var _baseDomain = domainPattern.slice(1);
        return hostname === _baseDomain || hostname.endsWith(".".concat(_baseDomain));
      } else {
        return hostname === domainPattern;
      }
    }
  }]);
}();
var importSettingsService = new ImportSettingsService();
module.exports = importSettingsService;

/***/ }),

/***/ "./src/common/services/IndexedDBService.js":
/*!*************************************************!*\
  !*** ./src/common/services/IndexedDBService.js ***!
  \*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   IndexedDBService: () => (/* binding */ IndexedDBService)
/* harmony export */ });
/* harmony import */ var _services_LogsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js");
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
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 asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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 _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }

var _dbName = /*#__PURE__*/new WeakMap();
var _storeName = /*#__PURE__*/new WeakMap();
var _stores = /*#__PURE__*/new WeakMap();
var _version = /*#__PURE__*/new WeakMap();
var _db = /*#__PURE__*/new WeakMap();
var _dbPromise = /*#__PURE__*/new WeakMap();
var _maxLogs = /*#__PURE__*/new WeakMap();
var _IndexedDBService_brand = /*#__PURE__*/new WeakSet();
var IndexedDBService = /*#__PURE__*/function () {
  function IndexedDBService() {
    var maxLogs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var storeName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
    var version = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
    _classCallCheck(this, IndexedDBService);
    _classPrivateMethodInitSpec(this, _IndexedDBService_brand);
    _classPrivateFieldInitSpec(this, _dbName, 'apex_guard_store');
    _classPrivateFieldInitSpec(this, _storeName, 'events');
    _classPrivateFieldInitSpec(this, _stores, ['events', 'connected']);
    _classPrivateFieldInitSpec(this, _version, 2);
    _classPrivateFieldInitSpec(this, _db, null);
    _classPrivateFieldInitSpec(this, _dbPromise, null);
    _classPrivateFieldInitSpec(this, _maxLogs, 0);
    if (storeName) {
      _classPrivateFieldSet(_storeName, this, storeName);
    }
    if (version) {
      _classPrivateFieldSet(_version, this, version);
    }
    _classPrivateFieldSet(_maxLogs, this, maxLogs);
  }
  return _createClass(IndexedDBService, [{
    key: "add",
    value: function () {
      var _add = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(type) {
        var _this = this;
        var message,
          data,
          db,
          newData,
          _args3 = arguments,
          _t;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.p = _context3.n) {
            case 0:
              message = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : '';
              data = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : null;
              _context3.p = 1;
              _context3.n = 2;
              return _assertClassBrand(_IndexedDBService_brand, this, _openDB).call(this);
            case 2:
              db = _context3.v;
              if (db) {
                _context3.n = 3;
                break;
              }
              return _context3.a(2);
            case 3:
              newData = {
                type: type
              };
              if (message && typeof message === 'string') {
                newData.message = message;
              }
              if (data && (Array.isArray(data) || typeof data === 'string' || _typeof(data) === 'object')) {
                newData.data = JSON.parse(JSON.stringify(data));
              }
              newData._timestamp = Date.now();
              newData._time = new Date().toISOString();
              return _context3.a(2, new Promise(function (resolve) {
                var transaction = db.transaction([_classPrivateFieldGet(_storeName, _this)], 'readwrite');
                var store = transaction.objectStore(_classPrivateFieldGet(_storeName, _this));
                var addRequest = store.add(newData);
                addRequest.onsuccess = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
                  var countRequest;
                  return _regenerator().w(function (_context2) {
                    while (1) switch (_context2.n) {
                      case 0:
                        if (_classPrivateFieldGet(_maxLogs, _this) > 0) {
                          countRequest = store.count();
                          countRequest.onsuccess = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
                            var count, cursorRequest;
                            return _regenerator().w(function (_context) {
                              while (1) switch (_context.n) {
                                case 0:
                                  count = countRequest.result;
                                  if (count > _classPrivateFieldGet(_maxLogs, _this)) {
                                    cursorRequest = store.openCursor(null, 'next');
                                    cursorRequest.onsuccess = function () {
                                      var cursor = cursorRequest.result;
                                      if (cursor) {
                                        cursor["delete"]();
                                      }
                                    };
                                    cursorRequest.onerror = function () {
                                      _services_LogsService__WEBPACK_IMPORTED_MODULE_0__["default"].addEvents('service.indexDB.error.failed_to_open');
                                    };
                                  }
                                  resolve();
                                case 1:
                                  return _context.a(2);
                              }
                            }, _callee);
                          }));
                          countRequest.onerror = function () {
                            resolve();
                          };
                        } else {
                          resolve();
                        }
                      case 1:
                        return _context2.a(2);
                    }
                  }, _callee2);
                }));
                addRequest.onerror = function () {
                  _services_LogsService__WEBPACK_IMPORTED_MODULE_0__["default"].addEvents('service.indexDB.error.failed_to_add');
                  resolve();
                };
              }));
            case 4:
              _context3.p = 4;
              _t = _context3.v;
              _services_LogsService__WEBPACK_IMPORTED_MODULE_0__["default"].addEvents('service.indexDB.error.failed_to_adding');
              return _context3.a(2);
          }
        }, _callee3, this, [[1, 4]]);
      }));
      function add(_x) {
        return _add.apply(this, arguments);
      }
      return add;
    }()
  }, {
    key: "get",
    value: function () {
      var _get = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
        var db, store, _t2;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.p = _context4.n) {
            case 0:
              _context4.p = 0;
              _context4.n = 1;
              return _assertClassBrand(_IndexedDBService_brand, this, _openDB).call(this);
            case 1:
              db = _context4.v;
              if (db) {
                _context4.n = 2;
                break;
              }
              return _context4.a(2, []);
            case 2:
              store = db.transaction(_classPrivateFieldGet(_storeName, this), 'readonly').objectStore(_classPrivateFieldGet(_storeName, this));
              _context4.n = 3;
              return new Promise(function (resolve) {
                var request = store.getAll();
                request.onsuccess = function () {
                  return resolve(request.result);
                };
                request.onerror = function () {
                  resolve([]);
                };
              });
            case 3:
              return _context4.a(2, _context4.v);
            case 4:
              _context4.p = 4;
              _t2 = _context4.v;
              _services_LogsService__WEBPACK_IMPORTED_MODULE_0__["default"].addEvents('service.indexDB.error.unexpected');
              return _context4.a(2, []);
          }
        }, _callee4, this, [[0, 4]]);
      }));
      function get() {
        return _get.apply(this, arguments);
      }
      return get;
    }()
  }, {
    key: "getAllStores",
    value: function () {
      var _getAllStores = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
        var storeNames,
          db,
          results,
          merged,
          _args5 = arguments,
          _t3;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.p = _context5.n) {
            case 0:
              storeNames = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : _classPrivateFieldGet(_stores, this);
              _context5.p = 1;
              _context5.n = 2;
              return _assertClassBrand(_IndexedDBService_brand, this, _openDB).call(this);
            case 2:
              db = _context5.v;
              if (db) {
                _context5.n = 3;
                break;
              }
              return _context5.a(2, []);
            case 3:
              _context5.n = 4;
              return Promise.all(storeNames.map(function (storeName) {
                return new Promise(function (resolve) {
                  var transaction = db.transaction(storeName, 'readonly');
                  var store = transaction.objectStore(storeName);
                  var request = store.getAll();
                  request.onsuccess = function () {
                    return resolve(request.result);
                  };
                  request.onerror = function () {
                    return resolve([]);
                  };
                });
              }));
            case 4:
              results = _context5.v;
              merged = results.flat();
              merged.sort(function (a, b) {
                return a._timestamp - b._timestamp;
              });
              return _context5.a(2, merged);
            case 5:
              _context5.p = 5;
              _t3 = _context5.v;
              _services_LogsService__WEBPACK_IMPORTED_MODULE_0__["default"].addEvents('service.indexDB.error.unexpected_get_all');
              return _context5.a(2, []);
          }
        }, _callee5, this, [[1, 5]]);
      }));
      function getAllStores() {
        return _getAllStores.apply(this, arguments);
      }
      return getAllStores;
    }()
  }, {
    key: "clearData",
    value: function () {
      var _clearData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
        var _this2 = this;
        var db, _t4;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.p = _context6.n) {
            case 0:
              _context6.p = 0;
              _context6.n = 1;
              return _assertClassBrand(_IndexedDBService_brand, this, _openDB).call(this);
            case 1:
              db = _context6.v;
              if (db) {
                _context6.n = 2;
                break;
              }
              return _context6.a(2);
            case 2:
              return _context6.a(2, new Promise(function (resolve) {
                var transaction = db.transaction([_classPrivateFieldGet(_storeName, _this2)], 'readwrite');
                var store = transaction.objectStore(_classPrivateFieldGet(_storeName, _this2));
                var request = store.clear();
                request.onsuccess = function () {
                  resolve();
                };
                request.onerror = function () {
                  resolve();
                };
              }));
            case 3:
              _context6.p = 3;
              _t4 = _context6.v;
              return _context6.a(2);
          }
        }, _callee6, this, [[0, 3]]);
      }));
      function clearData() {
        return _clearData.apply(this, arguments);
      }
      return clearData;
    }()
  }, {
    key: "close",
    value: function close() {
      if (_classPrivateFieldGet(_db, this)) {
        _classPrivateFieldGet(_db, this).close();
        _classPrivateFieldSet(_db, this, null);
        _classPrivateFieldSet(_dbPromise, this, null);
      }
    }
  }]);
}();
function _openDB() {
  return _openDB2.apply(this, arguments);
}
function _openDB2() {
  _openDB2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
    var _this3 = this;
    return _regenerator().w(function (_context7) {
      while (1) switch (_context7.n) {
        case 0:
          if (!_classPrivateFieldGet(_db, this)) {
            _context7.n = 1;
            break;
          }
          return _context7.a(2, _classPrivateFieldGet(_db, this));
        case 1:
          if (!_classPrivateFieldGet(_dbPromise, this)) {
            _classPrivateFieldSet(_dbPromise, this, new Promise(function (resolve) {
              var request = indexedDB.open(_classPrivateFieldGet(_dbName, _this3), _classPrivateFieldGet(_version, _this3));
              request.onerror = function () {
                _classPrivateFieldSet(_dbPromise, _this3, null);
                _services_LogsService__WEBPACK_IMPORTED_MODULE_0__["default"].addEvents('service.indexDB.error.open_database');
                resolve(null);
              };
              request.onsuccess = function (event) {
                _classPrivateFieldSet(_db, _this3, event.target.result);
                _classPrivateFieldGet(_db, _this3).onclose = function () {
                  _services_LogsService__WEBPACK_IMPORTED_MODULE_0__["default"].addEvents('service.indexDB.database_closed');
                  _classPrivateFieldSet(_db, _this3, null);
                  _classPrivateFieldSet(_dbPromise, _this3, null);
                };
                resolve(_classPrivateFieldGet(_db, _this3));
              };
              request.onupgradeneeded = function (event) {
                var db = event.target.result;
                var _iterator = _createForOfIteratorHelper(_classPrivateFieldGet(_stores, _this3)),
                  _step;
                try {
                  for (_iterator.s(); !(_step = _iterator.n()).done;) {
                    var store = _step.value;
                    if (!db.objectStoreNames.contains(store)) {
                      db.createObjectStore(store, {
                        autoIncrement: true
                      });
                    }
                  }
                } catch (err) {
                  _iterator.e(err);
                } finally {
                  _iterator.f();
                }
              };
            }));
          }
          return _context7.a(2, _classPrivateFieldGet(_dbPromise, this));
      }
    }, _callee7, this);
  }));
  return _openDB2.apply(this, arguments);
}

/***/ }),

/***/ "./src/common/services/LogsService.js":
/*!********************************************!*\
  !*** ./src/common/services/LogsService.js ***!
  \********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _services_IndexedDBService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/IndexedDBService */ "./src/common/services/IndexedDBService.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_common_browserApi__WEBPACK_IMPORTED_MODULE_2__);
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }



var LogsService = /*#__PURE__*/function () {
  function LogsService() {
    _classCallCheck(this, LogsService);
  }
  return _createClass(LogsService, null, [{
    key: "getLogs",
    value: function () {
      var _getLogs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
        var logs;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.n) {
            case 0:
              logs = {};
              _context.n = 1;
              return this.getSlicesLogs();
            case 1:
              logs.slices = _context.v;
              _context.n = 2;
              return this.getEvents();
            case 2:
              logs.events = _context.v;
              return _context.a(2, logs);
          }
        }, _callee, this);
      }));
      function getLogs() {
        return _getLogs.apply(this, arguments);
      }
      return getLogs;
    }()
  }, {
    key: "getSlicesLogs",
    value: function () {
      var _getSlicesLogs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
        var slices, nonProxiedUserData, generalSettings, connectionSettings, securitySettings, currentProxy, storageLogs;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.n) {
            case 0:
              slices = {};
              nonProxiedUserData = {};
              _context2.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getGeneralSettings();
            case 1:
              generalSettings = _context2.v;
              _context2.n = 2;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getSettings();
            case 2:
              connectionSettings = _context2.v;
              _context2.n = 3;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getSecuritySettings();
            case 3:
              securitySettings = _context2.v;
              _context2.n = 4;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getCurrentProxy();
            case 4:
              currentProxy = _context2.v;
              _context2.n = 5;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_0___default().getLogs();
            case 5:
              storageLogs = _context2.v;
              if (storageLogs) {
                nonProxiedUserData = storageLogs.nonProxiedUserData || {};
              }
              if (currentProxy) {
                delete currentProxy.username;
                delete currentProxy.password;
              }
              slices.version = _common_browserApi__WEBPACK_IMPORTED_MODULE_2___default().runtime.getManifest().version;
              slices.settings = {
                generalSettings: generalSettings,
                connectionSettings: connectionSettings,
                securitySettings: securitySettings
              };
              slices.nonProxiedInsights = nonProxiedUserData;
              slices.proxySlice = currentProxy || null;
              slices.browserInfo = this.getBrowserInfo() || null;
              slices.deviceInfo = this.getDeviceInfo() || null;
              return _context2.a(2, slices);
          }
        }, _callee2, this);
      }));
      function getSlicesLogs() {
        return _getSlicesLogs.apply(this, arguments);
      }
      return getSlicesLogs;
    }()
  }, {
    key: "getBrowserInfo",
    value: function getBrowserInfo() {
      var userAgent = navigator.userAgent;
      var name = 'Unknown';
      var major = 0;
      var isOutdated = false;
      var isNotOfficiallySupported = false;
      var browsers = [{
        name: 'Edge',
        regex: /Edg\/(\d+)/
      }, {
        name: 'Chrome',
        regex: /Chrome\/(\d+)/
      }, {
        name: 'Firefox',
        regex: /Firefox\/(\d+)/
      }];
      for (var _i = 0, _browsers = browsers; _i < _browsers.length; _i++) {
        var browser = _browsers[_i];
        var match = userAgent.match(browser.regex);
        if (match) {
          name = browser.name;
          major = parseInt(match[1], 10);
          break;
        }
      }
      if (major < 200) {
        isOutdated = true;
      }
      var supportedBrowsers = ['Chrome', 'Firefox', 'Edge'];
      if (!supportedBrowsers.includes(name)) {
        isNotOfficiallySupported = true;
      }
      return {
        isOutdated: isOutdated,
        isNotOfficiallySupported: isNotOfficiallySupported,
        major: major,
        name: name
      };
    }
  }, {
    key: "getDeviceInfo",
    value: function getDeviceInfo() {
      var userAgent = navigator.userAgent;
      var browserInfo = this.getBrowserInfo();
      var osName = 'Unknown';
      if (userAgent.includes('Windows')) {
        osName = 'Windows';
      } else if (userAgent.includes('Mac')) {
        osName = 'MacOS';
      } else if (userAgent.includes('Linux')) {
        osName = 'Linux';
      }
      return {
        browserVersion: "".concat(browserInfo.name, "/").concat(browserInfo.major, ".0.0.0"),
        osName: osName
      };
    }
  }, {
    key: "getEvents",
    value: function () {
      var _getEvents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
        var dbService, logs;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              dbService = new _services_IndexedDBService__WEBPACK_IMPORTED_MODULE_1__.IndexedDBService();
              _context3.n = 1;
              return dbService.getAllStores();
            case 1:
              logs = _context3.v;
              if (!(logs.length === 0)) {
                _context3.n = 2;
                break;
              }
              return _context3.a(2, {});
            case 2:
              return _context3.a(2, logs);
          }
        }, _callee3);
      }));
      function getEvents() {
        return _getEvents.apply(this, arguments);
      }
      return getEvents;
    }()
  }, {
    key: "addEvents",
    value: function () {
      var _addEvents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(type) {
        var data,
          message,
          indexedDBService,
          _args4 = arguments;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              data = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : null;
              message = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : '';
              indexedDBService = new _services_IndexedDBService__WEBPACK_IMPORTED_MODULE_1__.IndexedDBService(200, 'events');
              _context4.n = 1;
              return indexedDBService.add(type, message, data);
            case 1:
              return _context4.a(2);
          }
        }, _callee4);
      }));
      function addEvents(_x) {
        return _addEvents.apply(this, arguments);
      }
      return addEvents;
    }()
  }, {
    key: "addConnectedEvents",
    value: function () {
      var _addConnectedEvents = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(type) {
        var data,
          indexedDBService,
          _args5 = arguments;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.n) {
            case 0:
              data = _args5.length > 1 && _args5[1] !== undefined ? _args5[1] : null;
              indexedDBService = new _services_IndexedDBService__WEBPACK_IMPORTED_MODULE_1__.IndexedDBService(200, 'connected');
              _context5.n = 1;
              return indexedDBService.add(type, null, data);
            case 1:
              return _context5.a(2);
          }
        }, _callee5);
      }));
      function addConnectedEvents(_x2) {
        return _addConnectedEvents.apply(this, arguments);
      }
      return addConnectedEvents;
    }()
  }, {
    key: "clearLogs",
    value: function () {
      var _clearLogs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
        var indexedDBService;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              if (false) // removed by dead control flow
{}
              return _context6.a(2);
            case 1:
              indexedDBService = new _services_IndexedDBService__WEBPACK_IMPORTED_MODULE_1__.IndexedDBService();
              _context6.n = 2;
              return indexedDBService.clearData();
            case 2:
              return _context6.a(2);
          }
        }, _callee6);
      }));
      function clearLogs() {
        return _clearLogs.apply(this, arguments);
      }
      return clearLogs;
    }()
  }]);
}();
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LogsService);

/***/ }),

/***/ "./src/common/services/StorageService.js":
/*!***********************************************!*\
  !*** ./src/common/services/StorageService.js ***!
  \***********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var _require = __webpack_require__(/*! ../../sw/constants/storage_keys_constants */ "./src/sw/constants/storage_keys_constants.js"),
  STORAGE_KEYS = _require.STORAGE_KEYS;
var _require2 = __webpack_require__(/*! ../browser_storages/browser_storage */ "./src/common/browser_storages/browser_storage.js"),
  getStorageAsync = _require2.getStorageAsync,
  setStorageAsync = _require2.setStorageAsync,
  removeStorageAsync = _require2.removeStorageAsync;
var _require3 = __webpack_require__(/*! @sw/constants/server_proxy_constants */ "./src/sw/constants/server_proxy_constants.js"),
  SERVER_PROXY = _require3.SERVER_PROXY;
var _require4 = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  PROXY_STATUS_UPDATED = _require4.PROXY_STATUS_UPDATED,
  PROCESS_DISCONNECT_UPDATED = _require4.PROCESS_DISCONNECT_UPDATED,
  UPDATE_LAST_COUNTRIES = _require4.UPDATE_LAST_COUNTRIES;
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require5 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require5.PROXY_STATUSES;
var StorageService = /*#__PURE__*/function () {
  function StorageService() {
    _classCallCheck(this, StorageService);
  }
  return _createClass(StorageService, null, [{
    key: "getAuthData",
    value: (
    /**
     * Retrieves auth-related data from storage
     * @returns {Promise<Object>}
     */
    function () {
      var _getAuthData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
        return _regenerator().w(function (_context) {
          while (1) switch (_context.n) {
            case 0:
              return _context.a(2, getStorageAsync([STORAGE_KEYS.JWT, STORAGE_KEYS.REFRESH_TOKEN, STORAGE_KEYS.LOGGED_IN, STORAGE_KEYS.USER_DATA, STORAGE_KEYS.PROXY_STATUS, STORAGE_KEYS.PROXY_ERROR]));
          }
        }, _callee);
      }));
      function getAuthData() {
        return _getAuthData.apply(this, arguments);
      }
      return getAuthData;
    }()
    /**
     * Saves auth data to storage
     * @param {Object} data
     * @returns {Promise<void>}
     */
    )
  }, {
    key: "saveAuthData",
    value: (function () {
      var _saveAuthData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
        var jwt, refresh_token, loggedIn, userData;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.n) {
            case 0:
              jwt = _ref.jwt, refresh_token = _ref.refresh_token, loggedIn = _ref.loggedIn, userData = _ref.userData;
              _context2.n = 1;
              return setStorageAsync(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STORAGE_KEYS.JWT, jwt), STORAGE_KEYS.REFRESH_TOKEN, refresh_token), STORAGE_KEYS.LOGGED_IN, loggedIn), STORAGE_KEYS.USER_DATA, userData));
            case 1:
              return _context2.a(2);
          }
        }, _callee2);
      }));
      function saveAuthData(_x) {
        return _saveAuthData.apply(this, arguments);
      }
      return saveAuthData;
    }())
  }, {
    key: "saveUserData",
    value: function () {
      var _saveUserData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(userData) {
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              _context3.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.USER_DATA, userData));
            case 1:
              return _context3.a(2);
          }
        }, _callee3);
      }));
      function saveUserData(_x2) {
        return _saveUserData.apply(this, arguments);
      }
      return saveUserData;
    }()
  }, {
    key: "getUserData",
    value: function () {
      var _getUserData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
        var _yield$getStorageAsyn, userData;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              _context4.n = 1;
              return getStorageAsync([STORAGE_KEYS.USER_DATA]);
            case 1:
              _yield$getStorageAsyn = _context4.v;
              userData = _yield$getStorageAsyn.userData;
              return _context4.a(2, userData || {});
          }
        }, _callee4);
      }));
      function getUserData() {
        return _getUserData.apply(this, arguments);
      }
      return getUserData;
    }()
    /**
     * Clears auth-related data
     * @param {boolean} [clearSettings=false]
     * @returns {Promise<void>}
     */
  }, {
    key: "clearAuthData",
    value: (function () {
      var _clearAuthData = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
        var clearSettings,
          keys,
          _yield$getStorageAsyn2,
          generalSettings,
          _args5 = arguments;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.n) {
            case 0:
              clearSettings = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : false;
              keys = [STORAGE_KEYS.JWT, STORAGE_KEYS.REFRESH_TOKEN, STORAGE_KEYS.LOGGED_IN, STORAGE_KEYS.USER_DATA, STORAGE_KEYS.PROXY_STATUS, STORAGE_KEYS.PROXY_ERROR, STORAGE_KEYS.PAUSE_SETTING];
              if (!clearSettings) {
                _context5.n = 2;
                break;
              }
              _context5.n = 1;
              return getStorageAsync([STORAGE_KEYS.GENERAL_SETTINGS]);
            case 1:
              _yield$getStorageAsyn2 = _context5.v;
              generalSettings = _yield$getStorageAsyn2.generalSettings;
              if (!(generalSettings !== null && generalSettings !== void 0 && generalSettings.saveSettings)) {
                keys.push(STORAGE_KEYS.GENERAL_SETTINGS, STORAGE_KEYS.SETTINGS, STORAGE_KEYS.SECURITY_SETTINGS);
              }
            case 2:
              _context5.n = 3;
              return removeStorageAsync(keys);
            case 3:
              return _context5.a(2);
          }
        }, _callee5);
      }));
      function clearAuthData() {
        return _clearAuthData.apply(this, arguments);
      }
      return clearAuthData;
    }()
    /**
     * Retrieves specific storage key
     * @param {string} key
     * @returns {Promise<Object>}
     */
    )
  }, {
    key: "getItem",
    value: (function () {
      var _getItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(key) {
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              return _context6.a(2, getStorageAsync(key));
          }
        }, _callee6);
      }));
      function getItem(_x3) {
        return _getItem.apply(this, arguments);
      }
      return getItem;
    }()
    /**
     * Retrieves general settings from storage
     * @returns {Promise<Object>}
     */
    )
  }, {
    key: "getGeneralSettings",
    value: (function () {
      var _getGeneralSettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
        var _yield$getStorageAsyn3, generalSettings;
        return _regenerator().w(function (_context7) {
          while (1) switch (_context7.n) {
            case 0:
              _context7.n = 1;
              return getStorageAsync([STORAGE_KEYS.GENERAL_SETTINGS]);
            case 1:
              _yield$getStorageAsyn3 = _context7.v;
              generalSettings = _yield$getStorageAsyn3.generalSettings;
              return _context7.a(2, generalSettings || {});
          }
        }, _callee7);
      }));
      function getGeneralSettings() {
        return _getGeneralSettings.apply(this, arguments);
      }
      return getGeneralSettings;
    }())
  }, {
    key: "getToken",
    value: function () {
      var _getToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
        var _yield$getStorageAsyn4, jwt;
        return _regenerator().w(function (_context8) {
          while (1) switch (_context8.n) {
            case 0:
              _context8.n = 1;
              return getStorageAsync([STORAGE_KEYS.JWT]);
            case 1:
              _yield$getStorageAsyn4 = _context8.v;
              jwt = _yield$getStorageAsyn4.jwt;
              return _context8.a(2, jwt || "");
          }
        }, _callee8);
      }));
      function getToken() {
        return _getToken.apply(this, arguments);
      }
      return getToken;
    }()
  }, {
    key: "existToken",
    value: function () {
      var _existToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
        var _yield$getStorageAsyn5, jwt;
        return _regenerator().w(function (_context9) {
          while (1) switch (_context9.n) {
            case 0:
              _context9.n = 1;
              return getStorageAsync([STORAGE_KEYS.JWT]);
            case 1:
              _yield$getStorageAsyn5 = _context9.v;
              jwt = _yield$getStorageAsyn5.jwt;
              return _context9.a(2, !!jwt);
          }
        }, _callee9);
      }));
      function existToken() {
        return _existToken.apply(this, arguments);
      }
      return existToken;
    }()
  }, {
    key: "getRefreshToken",
    value: function () {
      var _getRefreshToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
        var _yield$getStorageAsyn6, refresh_token;
        return _regenerator().w(function (_context0) {
          while (1) switch (_context0.n) {
            case 0:
              _context0.n = 1;
              return getStorageAsync([STORAGE_KEYS.REFRESH_TOKEN]);
            case 1:
              _yield$getStorageAsyn6 = _context0.v;
              refresh_token = _yield$getStorageAsyn6.refresh_token;
              return _context0.a(2, refresh_token || "");
          }
        }, _callee0);
      }));
      function getRefreshToken() {
        return _getRefreshToken.apply(this, arguments);
      }
      return getRefreshToken;
    }()
  }, {
    key: "getProxyStatus",
    value: function () {
      var _getProxyStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
        var _yield$getStorageAsyn7, proxyStatus;
        return _regenerator().w(function (_context1) {
          while (1) switch (_context1.n) {
            case 0:
              _context1.n = 1;
              return getStorageAsync([STORAGE_KEYS.PROXY_STATUS]);
            case 1:
              _yield$getStorageAsyn7 = _context1.v;
              proxyStatus = _yield$getStorageAsyn7.proxyStatus;
              return _context1.a(2, proxyStatus || PROXY_STATUSES.DISCONNECT);
          }
        }, _callee1);
      }));
      function getProxyStatus() {
        return _getProxyStatus.apply(this, arguments);
      }
      return getProxyStatus;
    }()
  }, {
    key: "getPreviousProxyStatus",
    value: function () {
      var _getPreviousProxyStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
        var _yield$getStorageAsyn8, previousProxyStatus;
        return _regenerator().w(function (_context10) {
          while (1) switch (_context10.n) {
            case 0:
              _context10.n = 1;
              return getStorageAsync([STORAGE_KEYS.PREVIOUS_PROXY_STATUS]);
            case 1:
              _yield$getStorageAsyn8 = _context10.v;
              previousProxyStatus = _yield$getStorageAsyn8.previousProxyStatus;
              return _context10.a(2, previousProxyStatus || PROXY_STATUSES.DISCONNECT);
          }
        }, _callee10);
      }));
      function getPreviousProxyStatus() {
        return _getPreviousProxyStatus.apply(this, arguments);
      }
      return getPreviousProxyStatus;
    }()
  }, {
    key: "saveAuthLinks",
    value: function () {
      var _saveAuthLinks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(authLinks) {
        return _regenerator().w(function (_context11) {
          while (1) switch (_context11.n) {
            case 0:
              _context11.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.AUTH_LINKS, authLinks));
            case 1:
              return _context11.a(2);
          }
        }, _callee11);
      }));
      function saveAuthLinks(_x4) {
        return _saveAuthLinks.apply(this, arguments);
      }
      return saveAuthLinks;
    }()
  }, {
    key: "saveApiGateways",
    value: function () {
      var _saveApiGateways = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(apiGateways) {
        return _regenerator().w(function (_context12) {
          while (1) switch (_context12.n) {
            case 0:
              _context12.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.API_GATEWAYS, apiGateways));
            case 1:
              return _context12.a(2);
          }
        }, _callee12);
      }));
      function saveApiGateways(_x5) {
        return _saveApiGateways.apply(this, arguments);
      }
      return saveApiGateways;
    }()
  }, {
    key: "saveApiGatewayMain",
    value: function () {
      var _saveApiGatewayMain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(apiGatewayMain) {
        return _regenerator().w(function (_context13) {
          while (1) switch (_context13.n) {
            case 0:
              _context13.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.API_GATEWAY_MAIN, apiGatewayMain));
            case 1:
              return _context13.a(2);
          }
        }, _callee13);
      }));
      function saveApiGatewayMain(_x6) {
        return _saveApiGatewayMain.apply(this, arguments);
      }
      return saveApiGatewayMain;
    }()
  }, {
    key: "isExistApiGateways",
    value: function () {
      var _isExistApiGateways = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
        var apiGateways;
        return _regenerator().w(function (_context14) {
          while (1) switch (_context14.n) {
            case 0:
              _context14.n = 1;
              return this.getApiGateways();
            case 1:
              apiGateways = _context14.v;
              return _context14.a(2, apiGateways && apiGateways.length);
          }
        }, _callee14, this);
      }));
      function isExistApiGateways() {
        return _isExistApiGateways.apply(this, arguments);
      }
      return isExistApiGateways;
    }()
  }, {
    key: "getApiGatewayMain",
    value: function () {
      var _getApiGatewayMain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15() {
        var _yield$getStorageAsyn9, apiGatewayMain;
        return _regenerator().w(function (_context15) {
          while (1) switch (_context15.n) {
            case 0:
              _context15.n = 1;
              return getStorageAsync([STORAGE_KEYS.API_GATEWAY_MAIN]);
            case 1:
              _yield$getStorageAsyn9 = _context15.v;
              apiGatewayMain = _yield$getStorageAsyn9.apiGatewayMain;
              return _context15.a(2, apiGatewayMain || null);
          }
        }, _callee15);
      }));
      function getApiGatewayMain() {
        return _getApiGatewayMain.apply(this, arguments);
      }
      return getApiGatewayMain;
    }()
  }, {
    key: "getApiGateways",
    value: function () {
      var _getApiGateways = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
        var _yield$getStorageAsyn0, apiGateways;
        return _regenerator().w(function (_context16) {
          while (1) switch (_context16.n) {
            case 0:
              _context16.n = 1;
              return getStorageAsync([STORAGE_KEYS.API_GATEWAYS]);
            case 1:
              _yield$getStorageAsyn0 = _context16.v;
              apiGateways = _yield$getStorageAsyn0.apiGateways;
              return _context16.a(2, apiGateways || []);
          }
        }, _callee16);
      }));
      function getApiGateways() {
        return _getApiGateways.apply(this, arguments);
      }
      return getApiGateways;
    }()
  }, {
    key: "saveAuthDomains",
    value: function () {
      var _saveAuthDomains = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17(authDomains) {
        return _regenerator().w(function (_context17) {
          while (1) switch (_context17.n) {
            case 0:
              _context17.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.AUTH_DOMAINS, authDomains));
            case 1:
              return _context17.a(2);
          }
        }, _callee17);
      }));
      function saveAuthDomains(_x7) {
        return _saveAuthDomains.apply(this, arguments);
      }
      return saveAuthDomains;
    }()
  }, {
    key: "getAuthDomains",
    value: function () {
      var _getAuthDomains = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
        var _yield$getStorageAsyn1, authDomains;
        return _regenerator().w(function (_context18) {
          while (1) switch (_context18.n) {
            case 0:
              _context18.n = 1;
              return getStorageAsync([STORAGE_KEYS.AUTH_DOMAINS]);
            case 1:
              _yield$getStorageAsyn1 = _context18.v;
              authDomains = _yield$getStorageAsyn1.authDomains;
              return _context18.a(2, authDomains || []);
          }
        }, _callee18);
      }));
      function getAuthDomains() {
        return _getAuthDomains.apply(this, arguments);
      }
      return getAuthDomains;
    }()
  }, {
    key: "getLoginLink",
    value: function () {
      var _getLoginLink = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19() {
        var _yield$getStorageAsyn10, authLinks;
        return _regenerator().w(function (_context19) {
          while (1) switch (_context19.n) {
            case 0:
              _context19.n = 1;
              return getStorageAsync([STORAGE_KEYS.AUTH_LINKS]);
            case 1:
              _yield$getStorageAsyn10 = _context19.v;
              authLinks = _yield$getStorageAsyn10.authLinks;
              return _context19.a(2, (authLinks === null || authLinks === void 0 ? void 0 : authLinks.auth) || '');
          }
        }, _callee19);
      }));
      function getLoginLink() {
        return _getLoginLink.apply(this, arguments);
      }
      return getLoginLink;
    }()
  }, {
    key: "getRegisterLink",
    value: function () {
      var _getRegisterLink = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
        var _yield$getStorageAsyn11, authLinks;
        return _regenerator().w(function (_context20) {
          while (1) switch (_context20.n) {
            case 0:
              _context20.n = 1;
              return getStorageAsync([STORAGE_KEYS.AUTH_LINKS]);
            case 1:
              _yield$getStorageAsyn11 = _context20.v;
              authLinks = _yield$getStorageAsyn11.authLinks;
              return _context20.a(2, (authLinks === null || authLinks === void 0 ? void 0 : authLinks.register) || '');
          }
        }, _callee20);
      }));
      function getRegisterLink() {
        return _getRegisterLink.apply(this, arguments);
      }
      return getRegisterLink;
    }()
  }, {
    key: "getServerDomain",
    value: function () {
      var _getServerDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee21() {
        var _yield$getStorageAsyn12, currentProxy;
        return _regenerator().w(function (_context21) {
          while (1) switch (_context21.n) {
            case 0:
              _context21.n = 1;
              return getStorageAsync([STORAGE_KEYS.CURRENT_PROXY]);
            case 1:
              _yield$getStorageAsyn12 = _context21.v;
              currentProxy = _yield$getStorageAsyn12.currentProxy;
              return _context21.a(2, currentProxy !== null && currentProxy !== void 0 && currentProxy.host ? currentProxy.host : SERVER_PROXY);
          }
        }, _callee21);
      }));
      function getServerDomain() {
        return _getServerDomain.apply(this, arguments);
      }
      return getServerDomain;
    }()
  }, {
    key: "getLastServerDomain",
    value: function () {
      var _getLastServerDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee22() {
        var _yield$getStorageAsyn13, lastServerDomain;
        return _regenerator().w(function (_context22) {
          while (1) switch (_context22.n) {
            case 0:
              _context22.n = 1;
              return getStorageAsync([STORAGE_KEYS.LAST_SERVER_DOMAIN]);
            case 1:
              _yield$getStorageAsyn13 = _context22.v;
              lastServerDomain = _yield$getStorageAsyn13.lastServerDomain;
              return _context22.a(2, lastServerDomain ? lastServerDomain : "");
          }
        }, _callee22);
      }));
      function getLastServerDomain() {
        return _getLastServerDomain.apply(this, arguments);
      }
      return getLastServerDomain;
    }()
  }, {
    key: "saveLastServerDomain",
    value: function () {
      var _saveLastServerDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee23(lastServerDomain) {
        return _regenerator().w(function (_context23) {
          while (1) switch (_context23.n) {
            case 0:
              _context23.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.LAST_SERVER_DOMAIN, lastServerDomain));
            case 1:
              return _context23.a(2);
          }
        }, _callee23);
      }));
      function saveLastServerDomain(_x8) {
        return _saveLastServerDomain.apply(this, arguments);
      }
      return saveLastServerDomain;
    }()
  }, {
    key: "getPrivateLink",
    value: function () {
      var _getPrivateLink = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee24(type) {
        var _yield$getStorageAsyn14, privateLinks;
        return _regenerator().w(function (_context24) {
          while (1) switch (_context24.n) {
            case 0:
              _context24.n = 1;
              return getStorageAsync([STORAGE_KEYS.PRIVATE_LINKS]);
            case 1:
              _yield$getStorageAsyn14 = _context24.v;
              privateLinks = _yield$getStorageAsyn14.privateLinks;
              return _context24.a(2, (privateLinks === null || privateLinks === void 0 ? void 0 : privateLinks[type]) || '');
          }
        }, _callee24);
      }));
      function getPrivateLink(_x9) {
        return _getPrivateLink.apply(this, arguments);
      }
      return getPrivateLink;
    }()
    /**
     * Saves general settings to storage
     * @param {Object} settings
     * @returns {Promise<void>}
     */
  }, {
    key: "saveGeneralSettings",
    value: (function () {
      var _saveGeneralSettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee25(settings) {
        return _regenerator().w(function (_context25) {
          while (1) switch (_context25.n) {
            case 0:
              _context25.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.GENERAL_SETTINGS, settings));
            case 1:
              return _context25.a(2);
          }
        }, _callee25);
      }));
      function saveGeneralSettings(_x0) {
        return _saveGeneralSettings.apply(this, arguments);
      }
      return saveGeneralSettings;
    }()
    /**
     * Retrieves all settings (generalSettings and settings and securitySettings) for export
     * @returns {Promise<Object>}
     */
    )
  }, {
    key: "getAllSettings",
    value: (function () {
      var _getAllSettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee26() {
        return _regenerator().w(function (_context26) {
          while (1) switch (_context26.n) {
            case 0:
              return _context26.a(2, getStorageAsync([STORAGE_KEYS.SETTINGS, STORAGE_KEYS.GENERAL_SETTINGS, STORAGE_KEYS.SECURITY_SETTINGS]));
          }
        }, _callee26);
      }));
      function getAllSettings() {
        return _getAllSettings.apply(this, arguments);
      }
      return getAllSettings;
    }()
    /**
     * Imports settings (generalSettings and settings)
     * @param {Object} data
     * @returns {Promise<void>}
     */
    )
  }, {
    key: "importSettings",
    value: (function () {
      var _importSettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee27(_ref2) {
        var settings, generalSettings, securitySettings;
        return _regenerator().w(function (_context27) {
          while (1) switch (_context27.n) {
            case 0:
              settings = _ref2.settings, generalSettings = _ref2.generalSettings, securitySettings = _ref2.securitySettings;
              _context27.n = 1;
              return setStorageAsync(_defineProperty(_defineProperty(_defineProperty({}, STORAGE_KEYS.SETTINGS, settings || {}), STORAGE_KEYS.GENERAL_SETTINGS, generalSettings || {}), STORAGE_KEYS.SECURITY_SETTINGS, securitySettings || {}));
            case 1:
              return _context27.a(2);
          }
        }, _callee27);
      }));
      function importSettings(_x1) {
        return _importSettings.apply(this, arguments);
      }
      return importSettings;
    }())
  }, {
    key: "setStorageAsyncPromise",
    value: function () {
      var _setStorageAsyncPromise = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee28(data) {
        return _regenerator().w(function (_context28) {
          while (1) switch (_context28.n) {
            case 0:
              return _context28.a(2, setStorageAsync.apply(void 0, _toConsumableArray(data)));
          }
        }, _callee28);
      }));
      function setStorageAsyncPromise(_x10) {
        return _setStorageAsyncPromise.apply(this, arguments);
      }
      return setStorageAsyncPromise;
    }()
    /**
     * Retrieves connection settings from storage
     * @returns {Promise<Object>}
     */
  }, {
    key: "getSettings",
    value: (function () {
      var _getSettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee29() {
        var _yield$getStorageAsyn15, settings;
        return _regenerator().w(function (_context29) {
          while (1) switch (_context29.n) {
            case 0:
              _context29.n = 1;
              return getStorageAsync([STORAGE_KEYS.SETTINGS]);
            case 1:
              _yield$getStorageAsyn15 = _context29.v;
              settings = _yield$getStorageAsyn15.settings;
              return _context29.a(2, settings || {});
          }
        }, _callee29);
      }));
      function getSettings() {
        return _getSettings.apply(this, arguments);
      }
      return getSettings;
    }())
  }, {
    key: "getSettingsKillSwitch",
    value: function () {
      var _getSettingsKillSwitch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee30() {
        var _yield$getStorageAsyn16, settings;
        return _regenerator().w(function (_context30) {
          while (1) switch (_context30.n) {
            case 0:
              _context30.n = 1;
              return getStorageAsync([STORAGE_KEYS.SETTINGS]);
            case 1:
              _yield$getStorageAsyn16 = _context30.v;
              settings = _yield$getStorageAsyn16.settings;
              return _context30.a(2, (settings === null || settings === void 0 ? void 0 : settings.killSwitch) || false);
          }
        }, _callee30);
      }));
      function getSettingsKillSwitch() {
        return _getSettingsKillSwitch.apply(this, arguments);
      }
      return getSettingsKillSwitch;
    }()
    /**
     * Saves connection settings to storage
     * @param {Object} settings
     * @returns {Promise<void>}
     */
  }, {
    key: "saveSettings",
    value: (function () {
      var _saveSettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee31(settings) {
        return _regenerator().w(function (_context31) {
          while (1) switch (_context31.n) {
            case 0:
              _context31.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.SETTINGS, settings));
            case 1:
              return _context31.a(2);
          }
        }, _callee31);
      }));
      function saveSettings(_x11) {
        return _saveSettings.apply(this, arguments);
      }
      return saveSettings;
    }()
    /**
     * Retrieves security settings from storage
     * @returns {Promise<Object>}
     */
    )
  }, {
    key: "getSecuritySettings",
    value: (function () {
      var _getSecuritySettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee32() {
        var _yield$getStorageAsyn17, securitySettings;
        return _regenerator().w(function (_context32) {
          while (1) switch (_context32.n) {
            case 0:
              _context32.n = 1;
              return getStorageAsync([STORAGE_KEYS.SECURITY_SETTINGS]);
            case 1:
              _yield$getStorageAsyn17 = _context32.v;
              securitySettings = _yield$getStorageAsyn17.securitySettings;
              return _context32.a(2, securitySettings || {});
          }
        }, _callee32);
      }));
      function getSecuritySettings() {
        return _getSecuritySettings.apply(this, arguments);
      }
      return getSecuritySettings;
    }())
  }, {
    key: "getCurrentProxy",
    value: function () {
      var _getCurrentProxy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee33() {
        var _yield$getStorageAsyn18, currentProxy;
        return _regenerator().w(function (_context33) {
          while (1) switch (_context33.n) {
            case 0:
              _context33.n = 1;
              return getStorageAsync([STORAGE_KEYS.CURRENT_PROXY]);
            case 1:
              _yield$getStorageAsyn18 = _context33.v;
              currentProxy = _yield$getStorageAsyn18.currentProxy;
              return _context33.a(2, currentProxy || {});
          }
        }, _callee33);
      }));
      function getCurrentProxy() {
        return _getCurrentProxy.apply(this, arguments);
      }
      return getCurrentProxy;
    }()
  }, {
    key: "getPauseSetting",
    value: function () {
      var _getPauseSetting = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee34() {
        var _yield$getStorageAsyn19, pauseSetting;
        return _regenerator().w(function (_context34) {
          while (1) switch (_context34.n) {
            case 0:
              _context34.n = 1;
              return getStorageAsync([STORAGE_KEYS.PAUSE_SETTING]);
            case 1:
              _yield$getStorageAsyn19 = _context34.v;
              pauseSetting = _yield$getStorageAsyn19.pauseSetting;
              return _context34.a(2, pauseSetting || {});
          }
        }, _callee34);
      }));
      function getPauseSetting() {
        return _getPauseSetting.apply(this, arguments);
      }
      return getPauseSetting;
    }()
  }, {
    key: "getCitiesList",
    value: function () {
      var _getCitiesList = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee35() {
        var _yield$getStorageAsyn20, apiCities;
        return _regenerator().w(function (_context35) {
          while (1) switch (_context35.n) {
            case 0:
              _context35.n = 1;
              return getStorageAsync([STORAGE_KEYS.CITIES_LIST]);
            case 1:
              _yield$getStorageAsyn20 = _context35.v;
              apiCities = _yield$getStorageAsyn20.apiCities;
              return _context35.a(2, apiCities || []);
          }
        }, _callee35);
      }));
      function getCitiesList() {
        return _getCitiesList.apply(this, arguments);
      }
      return getCitiesList;
    }()
  }, {
    key: "saveCitiesList",
    value: function () {
      var _saveCitiesList = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee36(cities) {
        return _regenerator().w(function (_context36) {
          while (1) switch (_context36.n) {
            case 0:
              _context36.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.CITIES_LIST, cities));
            case 1:
              return _context36.a(2);
          }
        }, _callee36);
      }));
      function saveCitiesList(_x12) {
        return _saveCitiesList.apply(this, arguments);
      }
      return saveCitiesList;
    }()
  }, {
    key: "savePauseSetting",
    value: function () {
      var _savePauseSetting = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee37(settings) {
        return _regenerator().w(function (_context37) {
          while (1) switch (_context37.n) {
            case 0:
              _context37.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.PAUSE_SETTING, settings));
            case 1:
              return _context37.a(2);
          }
        }, _callee37);
      }));
      function savePauseSetting(_x13) {
        return _savePauseSetting.apply(this, arguments);
      }
      return savePauseSetting;
    }()
    /**
     * Saves security settings to storage
     * @param {Object} settings
     * @returns {Promise<void>}
     */
  }, {
    key: "saveSecuritySettings",
    value: (function () {
      var _saveSecuritySettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee38(settings) {
        return _regenerator().w(function (_context38) {
          while (1) switch (_context38.n) {
            case 0:
              _context38.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.SECURITY_SETTINGS, settings));
            case 1:
              return _context38.a(2);
          }
        }, _callee38);
      }));
      function saveSecuritySettings(_x14) {
        return _saveSecuritySettings.apply(this, arguments);
      }
      return saveSecuritySettings;
    }()
    /**
     * Saves current proxy to storage
     * @param {Object} proxy
     * @returns {Promise<void>}
     */
    )
  }, {
    key: "saveCurrentProxy",
    value: (function () {
      var _saveCurrentProxy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee39(proxy) {
        return _regenerator().w(function (_context39) {
          while (1) switch (_context39.n) {
            case 0:
              _context39.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.CURRENT_PROXY, proxy));
            case 1:
              return _context39.a(2);
          }
        }, _callee39);
      }));
      function saveCurrentProxy(_x15) {
        return _saveCurrentProxy.apply(this, arguments);
      }
      return saveCurrentProxy;
    }()
    /**
     * Saves proxy-related data to storage
     * @param {Object} data
     * @returns {Promise<void>}
     */
    )
  }, {
    key: "saveProxySettings",
    value: (function () {
      var _saveProxySettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee40(_ref3) {
        var proxyStatus, proxyError, currentProxy;
        return _regenerator().w(function (_context40) {
          while (1) switch (_context40.n) {
            case 0:
              proxyStatus = _ref3.proxyStatus, proxyError = _ref3.proxyError, currentProxy = _ref3.currentProxy;
              _context40.n = 1;
              return setStorageAsync(_defineProperty(_defineProperty(_defineProperty({}, STORAGE_KEYS.PROXY_STATUS, proxyStatus), STORAGE_KEYS.PROXY_ERROR, proxyError), STORAGE_KEYS.CURRENT_PROXY, currentProxy));
            case 1:
              if (browserApi.isFireFoxBrowser()) {
                void browserApi.runtime.sendMessage({
                  type: PROXY_STATUS_UPDATED,
                  proxyStatus: proxyStatus
                })["catch"](function () {});
              }
            case 2:
              return _context40.a(2);
          }
        }, _callee40);
      }));
      function saveProxySettings(_x16) {
        return _saveProxySettings.apply(this, arguments);
      }
      return saveProxySettings;
    }())
  }, {
    key: "saveProxyStatus",
    value: function () {
      var _saveProxyStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee41(proxyStatus) {
        return _regenerator().w(function (_context41) {
          while (1) switch (_context41.n) {
            case 0:
              _context41.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.PROXY_STATUS, proxyStatus));
            case 1:
              if (browserApi.isFireFoxBrowser()) {
                void browserApi.runtime.sendMessage({
                  type: PROXY_STATUS_UPDATED,
                  proxyStatus: proxyStatus
                })["catch"](function () {});
              }
            case 2:
              return _context41.a(2);
          }
        }, _callee41);
      }));
      function saveProxyStatus(_x17) {
        return _saveProxyStatus.apply(this, arguments);
      }
      return saveProxyStatus;
    }()
  }, {
    key: "savePreviousProxyStatus",
    value: function () {
      var _savePreviousProxyStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee42(previousProxyStatus) {
        return _regenerator().w(function (_context42) {
          while (1) switch (_context42.n) {
            case 0:
              _context42.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.PREVIOUS_PROXY_STATUS, previousProxyStatus));
            case 1:
              return _context42.a(2);
          }
        }, _callee42);
      }));
      function savePreviousProxyStatus(_x18) {
        return _savePreviousProxyStatus.apply(this, arguments);
      }
      return savePreviousProxyStatus;
    }()
  }, {
    key: "saveProxyError",
    value: function () {
      var _saveProxyError = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee43(proxyError) {
        return _regenerator().w(function (_context43) {
          while (1) switch (_context43.n) {
            case 0:
              _context43.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.PROXY_ERROR, proxyError));
            case 1:
              return _context43.a(2);
          }
        }, _callee43);
      }));
      function saveProxyError(_x19) {
        return _saveProxyError.apply(this, arguments);
      }
      return saveProxyError;
    }()
    /**
     * Retrieves proxy-related data from storage
     * @returns {Promise<Object>}
     */
  }, {
    key: "getProxySettings",
    value: (function () {
      var _getProxySettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee44() {
        var _yield$getStorageAsyn21, proxyStatus, proxyError, currentProxy;
        return _regenerator().w(function (_context44) {
          while (1) switch (_context44.n) {
            case 0:
              _context44.n = 1;
              return getStorageAsync([STORAGE_KEYS.PROXY_STATUS, STORAGE_KEYS.PROXY_ERROR, STORAGE_KEYS.CURRENT_PROXY]);
            case 1:
              _yield$getStorageAsyn21 = _context44.v;
              proxyStatus = _yield$getStorageAsyn21.proxyStatus;
              proxyError = _yield$getStorageAsyn21.proxyError;
              currentProxy = _yield$getStorageAsyn21.currentProxy;
              return _context44.a(2, {
                proxyStatus: proxyStatus || PROXY_STATUSES.DISCONNECT,
                proxyError: proxyError || null,
                currentProxy: currentProxy || null
              });
          }
        }, _callee44);
      }));
      function getProxySettings() {
        return _getProxySettings.apply(this, arguments);
      }
      return getProxySettings;
    }())
  }, {
    key: "clearProxySettings",
    value: function () {
      var _clearProxySettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee45() {
        return _regenerator().w(function (_context45) {
          while (1) switch (_context45.n) {
            case 0:
              _context45.n = 1;
              return setStorageAsync(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, STORAGE_KEYS.PROXY_STATUS, PROXY_STATUSES.DISCONNECT), STORAGE_KEYS.PROXY_ERROR, null), STORAGE_KEYS.CURRENT_PROXY, null), STORAGE_KEYS.SELECTED_COUNTRY, ''));
            case 1:
              if (browserApi.isFireFoxBrowser()) {
                void browserApi.runtime.sendMessage({
                  type: PROXY_STATUS_UPDATED,
                  proxyStatus: PROXY_STATUSES.DISCONNECT
                })["catch"](function () {});
              }
            case 2:
              return _context45.a(2);
          }
        }, _callee45);
      }));
      function clearProxySettings() {
        return _clearProxySettings.apply(this, arguments);
      }
      return clearProxySettings;
    }()
  }, {
    key: "saveSelectedCountry",
    value: function () {
      var _saveSelectedCountry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee46(country) {
        return _regenerator().w(function (_context46) {
          while (1) switch (_context46.n) {
            case 0:
              _context46.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.SELECTED_COUNTRY, country));
            case 1:
              return _context46.a(2);
          }
        }, _callee46);
      }));
      function saveSelectedCountry(_x20) {
        return _saveSelectedCountry.apply(this, arguments);
      }
      return saveSelectedCountry;
    }()
  }, {
    key: "saveSelectedAutoConnectCountry",
    value: function () {
      var _saveSelectedAutoConnectCountry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee47(country) {
        var settings;
        return _regenerator().w(function (_context47) {
          while (1) switch (_context47.n) {
            case 0:
              _context47.n = 1;
              return StorageService.getSettings();
            case 1:
              settings = _context47.v;
              settings.selectedAutoConnectCountry = country;
              _context47.n = 2;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.SETTINGS, settings));
            case 2:
              return _context47.a(2);
          }
        }, _callee47);
      }));
      function saveSelectedAutoConnectCountry(_x21) {
        return _saveSelectedAutoConnectCountry.apply(this, arguments);
      }
      return saveSelectedAutoConnectCountry;
    }()
  }, {
    key: "saveSelectedCity",
    value: function () {
      var _saveSelectedCity = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee48(city) {
        return _regenerator().w(function (_context48) {
          while (1) switch (_context48.n) {
            case 0:
              _context48.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.SELECTED_CITY, city));
            case 1:
              return _context48.a(2);
          }
        }, _callee48);
      }));
      function saveSelectedCity(_x22) {
        return _saveSelectedCity.apply(this, arguments);
      }
      return saveSelectedCity;
    }()
  }, {
    key: "clearSelectedCity",
    value: function () {
      var _clearSelectedCity = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee49() {
        return _regenerator().w(function (_context49) {
          while (1) switch (_context49.n) {
            case 0:
              _context49.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.SELECTED_CITY, ""));
            case 1:
              return _context49.a(2);
          }
        }, _callee49);
      }));
      function clearSelectedCity() {
        return _clearSelectedCity.apply(this, arguments);
      }
      return clearSelectedCity;
    }()
  }, {
    key: "getSelectedCity",
    value: function () {
      var _getSelectedCity = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee50() {
        var _yield$getStorageAsyn22, selectedCity;
        return _regenerator().w(function (_context50) {
          while (1) switch (_context50.n) {
            case 0:
              _context50.n = 1;
              return getStorageAsync([STORAGE_KEYS.SELECTED_CITY]);
            case 1:
              _yield$getStorageAsyn22 = _context50.v;
              selectedCity = _yield$getStorageAsyn22.selectedCity;
              return _context50.a(2, selectedCity || '');
          }
        }, _callee50);
      }));
      function getSelectedCity() {
        return _getSelectedCity.apply(this, arguments);
      }
      return getSelectedCity;
    }()
  }, {
    key: "getSelectedCountry",
    value: function () {
      var _getSelectedCountry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee51() {
        var _yield$getStorageAsyn23, selectedCountry;
        return _regenerator().w(function (_context51) {
          while (1) switch (_context51.n) {
            case 0:
              _context51.n = 1;
              return getStorageAsync([STORAGE_KEYS.SELECTED_COUNTRY]);
            case 1:
              _yield$getStorageAsyn23 = _context51.v;
              selectedCountry = _yield$getStorageAsyn23.selectedCountry;
              return _context51.a(2, selectedCountry || '');
          }
        }, _callee51);
      }));
      function getSelectedCountry() {
        return _getSelectedCountry.apply(this, arguments);
      }
      return getSelectedCountry;
    }()
  }, {
    key: "getUniqueAppId",
    value: function () {
      var _getUniqueAppId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee52() {
        var _yield$getStorageAsyn24, appId;
        return _regenerator().w(function (_context52) {
          while (1) switch (_context52.n) {
            case 0:
              _context52.n = 1;
              return getStorageAsync([STORAGE_KEYS.APP_ID]);
            case 1:
              _yield$getStorageAsyn24 = _context52.v;
              appId = _yield$getStorageAsyn24.appId;
              return _context52.a(2, appId || '');
          }
        }, _callee52);
      }));
      function getUniqueAppId() {
        return _getUniqueAppId.apply(this, arguments);
      }
      return getUniqueAppId;
    }()
  }, {
    key: "saveUniqueAppId",
    value: function () {
      var _saveUniqueAppId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee53(appId) {
        return _regenerator().w(function (_context53) {
          while (1) switch (_context53.n) {
            case 0:
              _context53.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.APP_ID, appId));
            case 1:
              return _context53.a(2);
          }
        }, _callee53);
      }));
      function saveUniqueAppId(_x23) {
        return _saveUniqueAppId.apply(this, arguments);
      }
      return saveUniqueAppId;
    }()
  }, {
    key: "getDebugLog",
    value: function () {
      var _getDebugLog = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee54() {
        var _yield$getStorageAsyn25, debugLog;
        return _regenerator().w(function (_context54) {
          while (1) switch (_context54.n) {
            case 0:
              _context54.n = 1;
              return getStorageAsync([STORAGE_KEYS.DEBUG_LOG]);
            case 1:
              _yield$getStorageAsyn25 = _context54.v;
              debugLog = _yield$getStorageAsyn25.debugLog;
              return _context54.a(2, debugLog || false);
          }
        }, _callee54);
      }));
      function getDebugLog() {
        return _getDebugLog.apply(this, arguments);
      }
      return getDebugLog;
    }()
  }, {
    key: "getBlockRequest",
    value: function () {
      var _getBlockRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee55() {
        var _yield$getStorageAsyn26, blockRequest;
        return _regenerator().w(function (_context55) {
          while (1) switch (_context55.n) {
            case 0:
              _context55.n = 1;
              return getStorageAsync([STORAGE_KEYS.BLOCK_REQUEST]);
            case 1:
              _yield$getStorageAsyn26 = _context55.v;
              blockRequest = _yield$getStorageAsyn26.blockRequest;
              return _context55.a(2, blockRequest || false);
          }
        }, _callee55);
      }));
      function getBlockRequest() {
        return _getBlockRequest.apply(this, arguments);
      }
      return getBlockRequest;
    }()
  }, {
    key: "saveBlockRequest",
    value: function () {
      var _saveBlockRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee56(blockRequest) {
        return _regenerator().w(function (_context56) {
          while (1) switch (_context56.n) {
            case 0:
              _context56.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.BLOCK_REQUEST, blockRequest));
            case 1:
              return _context56.a(2);
          }
        }, _callee56);
      }));
      function saveBlockRequest(_x24) {
        return _saveBlockRequest.apply(this, arguments);
      }
      return saveBlockRequest;
    }()
  }, {
    key: "savePing",
    value: function () {
      var _savePing = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee57(ping) {
        return _regenerator().w(function (_context57) {
          while (1) switch (_context57.n) {
            case 0:
              _context57.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.PING, ping));
            case 1:
              return _context57.a(2);
          }
        }, _callee57);
      }));
      function savePing(_x25) {
        return _savePing.apply(this, arguments);
      }
      return savePing;
    }()
  }, {
    key: "getPing",
    value: function () {
      var _getPing = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee58() {
        var _yield$getStorageAsyn27, ping;
        return _regenerator().w(function (_context58) {
          while (1) switch (_context58.n) {
            case 0:
              _context58.n = 1;
              return getStorageAsync([STORAGE_KEYS.PING]);
            case 1:
              _yield$getStorageAsyn27 = _context58.v;
              ping = _yield$getStorageAsyn27.ping;
              return _context58.a(2, ping || false);
          }
        }, _callee58);
      }));
      function getPing() {
        return _getPing.apply(this, arguments);
      }
      return getPing;
    }()
  }, {
    key: "saveLoadConnectStatus",
    value: function () {
      var _saveLoadConnectStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee59(loadConnectStatus) {
        return _regenerator().w(function (_context59) {
          while (1) switch (_context59.n) {
            case 0:
              _context59.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.LOAD_CONNECT_STATUS, loadConnectStatus));
            case 1:
              return _context59.a(2);
          }
        }, _callee59);
      }));
      function saveLoadConnectStatus(_x26) {
        return _saveLoadConnectStatus.apply(this, arguments);
      }
      return saveLoadConnectStatus;
    }()
  }, {
    key: "getLoadConnectStatus",
    value: function () {
      var _getLoadConnectStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee60() {
        var _yield$getStorageAsyn28, loadConnectStatus;
        return _regenerator().w(function (_context60) {
          while (1) switch (_context60.n) {
            case 0:
              _context60.n = 1;
              return getStorageAsync([STORAGE_KEYS.LOAD_CONNECT_STATUS]);
            case 1:
              _yield$getStorageAsyn28 = _context60.v;
              loadConnectStatus = _yield$getStorageAsyn28.loadConnectStatus;
              return _context60.a(2, loadConnectStatus || false);
          }
        }, _callee60);
      }));
      function getLoadConnectStatus() {
        return _getLoadConnectStatus.apply(this, arguments);
      }
      return getLoadConnectStatus;
    }()
  }, {
    key: "saveCancelConnect",
    value: function () {
      var _saveCancelConnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee61(cancelConnect) {
        return _regenerator().w(function (_context61) {
          while (1) switch (_context61.n) {
            case 0:
              _context61.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.CANCEL_CONNECT, cancelConnect));
            case 1:
              return _context61.a(2);
          }
        }, _callee61);
      }));
      function saveCancelConnect(_x27) {
        return _saveCancelConnect.apply(this, arguments);
      }
      return saveCancelConnect;
    }()
  }, {
    key: "getCancelConnect",
    value: function () {
      var _getCancelConnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee62() {
        var _yield$getStorageAsyn29, cancelConnect;
        return _regenerator().w(function (_context62) {
          while (1) switch (_context62.n) {
            case 0:
              _context62.n = 1;
              return getStorageAsync([STORAGE_KEYS.CANCEL_CONNECT]);
            case 1:
              _yield$getStorageAsyn29 = _context62.v;
              cancelConnect = _yield$getStorageAsyn29.cancelConnect;
              return _context62.a(2, cancelConnect || false);
          }
        }, _callee62);
      }));
      function getCancelConnect() {
        return _getCancelConnect.apply(this, arguments);
      }
      return getCancelConnect;
    }()
  }, {
    key: "saveForceCancelConnect",
    value: function () {
      var _saveForceCancelConnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee63(forceCancelConnect) {
        return _regenerator().w(function (_context63) {
          while (1) switch (_context63.n) {
            case 0:
              _context63.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.FORCE_CANCEL_CONNECT, forceCancelConnect));
            case 1:
              return _context63.a(2);
          }
        }, _callee63);
      }));
      function saveForceCancelConnect(_x28) {
        return _saveForceCancelConnect.apply(this, arguments);
      }
      return saveForceCancelConnect;
    }()
  }, {
    key: "getForceCancelConnect",
    value: function () {
      var _getForceCancelConnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee64() {
        var _yield$getStorageAsyn30, forceCancelConnect;
        return _regenerator().w(function (_context64) {
          while (1) switch (_context64.n) {
            case 0:
              _context64.n = 1;
              return getStorageAsync([STORAGE_KEYS.FORCE_CANCEL_CONNECT]);
            case 1:
              _yield$getStorageAsyn30 = _context64.v;
              forceCancelConnect = _yield$getStorageAsyn30.forceCancelConnect;
              return _context64.a(2, forceCancelConnect || false);
          }
        }, _callee64);
      }));
      function getForceCancelConnect() {
        return _getForceCancelConnect.apply(this, arguments);
      }
      return getForceCancelConnect;
    }()
  }, {
    key: "savePrivateLink",
    value: function () {
      var _savePrivateLink = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee65(type, link) {
        return _regenerator().w(function (_context65) {
          while (1) switch (_context65.n) {
            case 0:
              _context65.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.PRIVATE_LINKS, _defineProperty({}, type, link)));
            case 1:
              return _context65.a(2);
          }
        }, _callee65);
      }));
      function savePrivateLink(_x29, _x30) {
        return _savePrivateLink.apply(this, arguments);
      }
      return savePrivateLink;
    }()
  }, {
    key: "getLastCountries",
    value: function () {
      var _getLastCountries = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee66() {
        var _yield$getStorageAsyn31, lastCountries;
        return _regenerator().w(function (_context66) {
          while (1) switch (_context66.n) {
            case 0:
              _context66.n = 1;
              return getStorageAsync([STORAGE_KEYS.LAST_COUNTRIES]);
            case 1:
              _yield$getStorageAsyn31 = _context66.v;
              lastCountries = _yield$getStorageAsyn31.lastCountries;
              return _context66.a(2, lastCountries || []);
          }
        }, _callee66);
      }));
      function getLastCountries() {
        return _getLastCountries.apply(this, arguments);
      }
      return getLastCountries;
    }()
  }, {
    key: "addToLastCountries",
    value: function () {
      var _addToLastCountries = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee67(country) {
        var _yield$getStorageAsyn32, lastCountries;
        return _regenerator().w(function (_context67) {
          while (1) switch (_context67.n) {
            case 0:
              _context67.n = 1;
              return getStorageAsync([STORAGE_KEYS.LAST_COUNTRIES]);
            case 1:
              _yield$getStorageAsyn32 = _context67.v;
              lastCountries = _yield$getStorageAsyn32.lastCountries;
              lastCountries = Array.isArray(lastCountries) ? lastCountries : [];
              if (lastCountries.includes(country)) {
                lastCountries = lastCountries.filter(function (item) {
                  return item !== country;
                });
              }
              lastCountries.unshift(country);
              _context67.n = 2;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.LAST_COUNTRIES, lastCountries));
            case 2:
              if (browserApi.isFireFoxBrowser()) {
                void browserApi.runtime.sendMessage({
                  type: UPDATE_LAST_COUNTRIES,
                  lastCountries: lastCountries
                })["catch"](function () {});
              }
            case 3:
              return _context67.a(2);
          }
        }, _callee67);
      }));
      function addToLastCountries(_x31) {
        return _addToLastCountries.apply(this, arguments);
      }
      return addToLastCountries;
    }()
  }, {
    key: "saveLogs",
    value: function () {
      var _saveLogs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee68(type, logs) {
        var currentLogs, updatedLogs, _t;
        return _regenerator().w(function (_context68) {
          while (1) switch (_context68.n) {
            case 0:
              _context68.n = 1;
              return this.getLogs();
            case 1:
              _t = _context68.v;
              if (_t) {
                _context68.n = 2;
                break;
              }
              _t = {};
            case 2:
              currentLogs = _t;
              updatedLogs = _objectSpread(_objectSpread({}, currentLogs), {}, _defineProperty({}, type, logs));
              _context68.n = 3;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.LOGS, updatedLogs));
            case 3:
              return _context68.a(2);
          }
        }, _callee68, this);
      }));
      function saveLogs(_x32, _x33) {
        return _saveLogs.apply(this, arguments);
      }
      return saveLogs;
    }()
  }, {
    key: "getLogs",
    value: function () {
      var _getLogs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee69() {
        var _yield$getStorageAsyn33, logs;
        return _regenerator().w(function (_context69) {
          while (1) switch (_context69.n) {
            case 0:
              _context69.n = 1;
              return getStorageAsync([STORAGE_KEYS.LOGS]);
            case 1:
              _yield$getStorageAsyn33 = _context69.v;
              logs = _yield$getStorageAsyn33.logs;
              return _context69.a(2, logs || false);
          }
        }, _callee69);
      }));
      function getLogs() {
        return _getLogs.apply(this, arguments);
      }
      return getLogs;
    }()
  }, {
    key: "saveAnotherExtension",
    value: function () {
      var _saveAnotherExtension = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee70(anotherExtension) {
        return _regenerator().w(function (_context70) {
          while (1) switch (_context70.n) {
            case 0:
              _context70.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.ANOTHER_EXTENSION_ACTIVE, anotherExtension));
            case 1:
              return _context70.a(2);
          }
        }, _callee70);
      }));
      function saveAnotherExtension(_x34) {
        return _saveAnotherExtension.apply(this, arguments);
      }
      return saveAnotherExtension;
    }()
  }, {
    key: "getAnotherExtension",
    value: function () {
      var _getAnotherExtension = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee71() {
        var _yield$getStorageAsyn34, anotherExtensionActive;
        return _regenerator().w(function (_context71) {
          while (1) switch (_context71.n) {
            case 0:
              _context71.n = 1;
              return getStorageAsync([STORAGE_KEYS.ANOTHER_EXTENSION_ACTIVE]);
            case 1:
              _yield$getStorageAsyn34 = _context71.v;
              anotherExtensionActive = _yield$getStorageAsyn34.anotherExtensionActive;
              return _context71.a(2, anotherExtensionActive || false);
          }
        }, _callee71);
      }));
      function getAnotherExtension() {
        return _getAnotherExtension.apply(this, arguments);
      }
      return getAnotherExtension;
    }()
  }, {
    key: "saveDisabledPermissionsExtension",
    value: function () {
      var _saveDisabledPermissionsExtension = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee72(disabledPermissionsExtension) {
        return _regenerator().w(function (_context72) {
          while (1) switch (_context72.n) {
            case 0:
              _context72.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.DISABLED_PERMISSIONS_EXTENSION, disabledPermissionsExtension));
            case 1:
              return _context72.a(2);
          }
        }, _callee72);
      }));
      function saveDisabledPermissionsExtension(_x35) {
        return _saveDisabledPermissionsExtension.apply(this, arguments);
      }
      return saveDisabledPermissionsExtension;
    }()
  }, {
    key: "getDisabledPermissionsExtension",
    value: function () {
      var _getDisabledPermissionsExtension = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee73() {
        var _yield$getStorageAsyn35, disabledPermissionsExtension;
        return _regenerator().w(function (_context73) {
          while (1) switch (_context73.n) {
            case 0:
              _context73.n = 1;
              return getStorageAsync([STORAGE_KEYS.DISABLED_PERMISSIONS_EXTENSION]);
            case 1:
              _yield$getStorageAsyn35 = _context73.v;
              disabledPermissionsExtension = _yield$getStorageAsyn35.disabledPermissionsExtension;
              return _context73.a(2, disabledPermissionsExtension || false);
          }
        }, _callee73);
      }));
      function getDisabledPermissionsExtension() {
        return _getDisabledPermissionsExtension.apply(this, arguments);
      }
      return getDisabledPermissionsExtension;
    }()
  }, {
    key: "getUserUid",
    value: function () {
      var _getUserUid = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee74() {
        var _yield$getStorageAsyn36, uid;
        return _regenerator().w(function (_context74) {
          while (1) switch (_context74.n) {
            case 0:
              _context74.n = 1;
              return getStorageAsync([STORAGE_KEYS.UID]);
            case 1:
              _yield$getStorageAsyn36 = _context74.v;
              uid = _yield$getStorageAsyn36.uid;
              return _context74.a(2, uid || '');
          }
        }, _callee74);
      }));
      function getUserUid() {
        return _getUserUid.apply(this, arguments);
      }
      return getUserUid;
    }()
  }, {
    key: "saveUserUid",
    value: function () {
      var _saveUserUid = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee75(userUid) {
        return _regenerator().w(function (_context75) {
          while (1) switch (_context75.n) {
            case 0:
              _context75.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.UID, userUid));
            case 1:
              return _context75.a(2);
          }
        }, _callee75);
      }));
      function saveUserUid(_x36) {
        return _saveUserUid.apply(this, arguments);
      }
      return saveUserUid;
    }()
  }, {
    key: "clearProxyStorage",
    value: function () {
      var _clearProxyStorage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee76() {
        return _regenerator().w(function (_context76) {
          while (1) switch (_context76.n) {
            case 0:
              _context76.n = 1;
              return setStorageAsync(_defineProperty(_defineProperty(_defineProperty({}, STORAGE_KEYS.PROXY_STATUS, PROXY_STATUSES.DISCONNECT), STORAGE_KEYS.PROXY_ERROR, null), STORAGE_KEYS.CURRENT_PROXY, null));
            case 1:
              if (browserApi.isFireFoxBrowser()) {
                void browserApi.runtime.sendMessage({
                  type: PROXY_STATUS_UPDATED,
                  proxyStatus: PROXY_STATUSES.DISCONNECT
                })["catch"](function () {});
              }
            case 2:
              return _context76.a(2);
          }
        }, _callee76);
      }));
      function clearProxyStorage() {
        return _clearProxyStorage.apply(this, arguments);
      }
      return clearProxyStorage;
    }()
  }, {
    key: "saveCancelDisconnect",
    value: function () {
      var _saveCancelDisconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee77(cancelDisconnect) {
        return _regenerator().w(function (_context77) {
          while (1) switch (_context77.n) {
            case 0:
              _context77.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.CANCEL_DISCONNECT, cancelDisconnect));
            case 1:
              return _context77.a(2);
          }
        }, _callee77);
      }));
      function saveCancelDisconnect(_x37) {
        return _saveCancelDisconnect.apply(this, arguments);
      }
      return saveCancelDisconnect;
    }()
  }, {
    key: "getCancelDisconnect",
    value: function () {
      var _getCancelDisconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee78() {
        var _yield$getStorageAsyn37, cancelDisconnect;
        return _regenerator().w(function (_context78) {
          while (1) switch (_context78.n) {
            case 0:
              _context78.n = 1;
              return getStorageAsync([STORAGE_KEYS.CANCEL_DISCONNECT]);
            case 1:
              _yield$getStorageAsyn37 = _context78.v;
              cancelDisconnect = _yield$getStorageAsyn37.cancelDisconnect;
              return _context78.a(2, cancelDisconnect || false);
          }
        }, _callee78);
      }));
      function getCancelDisconnect() {
        return _getCancelDisconnect.apply(this, arguments);
      }
      return getCancelDisconnect;
    }()
  }, {
    key: "getProcessDisconnect",
    value: function () {
      var _getProcessDisconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee79() {
        var _yield$getStorageAsyn38, processDisconnect;
        return _regenerator().w(function (_context79) {
          while (1) switch (_context79.n) {
            case 0:
              _context79.n = 1;
              return getStorageAsync([STORAGE_KEYS.PROCESS_DISCONNECT]);
            case 1:
              _yield$getStorageAsyn38 = _context79.v;
              processDisconnect = _yield$getStorageAsyn38.processDisconnect;
              return _context79.a(2, processDisconnect || false);
          }
        }, _callee79);
      }));
      function getProcessDisconnect() {
        return _getProcessDisconnect.apply(this, arguments);
      }
      return getProcessDisconnect;
    }()
  }, {
    key: "saveProcessDisconnect",
    value: function () {
      var _saveProcessDisconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee80(processDisconnect) {
        return _regenerator().w(function (_context80) {
          while (1) switch (_context80.n) {
            case 0:
              _context80.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.PROCESS_DISCONNECT, processDisconnect));
            case 1:
              if (browserApi.isFireFoxBrowser()) {
                void browserApi.runtime.sendMessage({
                  type: PROCESS_DISCONNECT_UPDATED,
                  processDisconnect: processDisconnect
                })["catch"](function () {});
              }
            case 2:
              return _context80.a(2);
          }
        }, _callee80);
      }));
      function saveProcessDisconnect(_x38) {
        return _saveProcessDisconnect.apply(this, arguments);
      }
      return saveProcessDisconnect;
    }()
  }, {
    key: "getNotClosedSession",
    value: function () {
      var _getNotClosedSession = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee81() {
        var _yield$getStorageAsyn39, notClosedSessions;
        return _regenerator().w(function (_context81) {
          while (1) switch (_context81.n) {
            case 0:
              _context81.n = 1;
              return getStorageAsync([STORAGE_KEYS.NOT_CLOSED_SESSIONS]);
            case 1:
              _yield$getStorageAsyn39 = _context81.v;
              notClosedSessions = _yield$getStorageAsyn39.notClosedSessions;
              return _context81.a(2, notClosedSessions || []);
          }
        }, _callee81);
      }));
      function getNotClosedSession() {
        return _getNotClosedSession.apply(this, arguments);
      }
      return getNotClosedSession;
    }()
  }, {
    key: "saveNotClosedSession",
    value: function () {
      var _saveNotClosedSession = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee82(closedSessions) {
        return _regenerator().w(function (_context82) {
          while (1) switch (_context82.n) {
            case 0:
              _context82.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.NOT_CLOSED_SESSIONS, closedSessions));
            case 1:
              return _context82.a(2);
          }
        }, _callee82);
      }));
      function saveNotClosedSession(_x39) {
        return _saveNotClosedSession.apply(this, arguments);
      }
      return saveNotClosedSession;
    }()
  }, {
    key: "addNotClosedSession",
    value: function () {
      var _addNotClosedSession = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee83(closedSession) {
        var _yield$getStorageAsyn40, notClosedSessions, indexFindSession;
        return _regenerator().w(function (_context83) {
          while (1) switch (_context83.n) {
            case 0:
              _context83.n = 1;
              return getStorageAsync([STORAGE_KEYS.NOT_CLOSED_SESSIONS]);
            case 1:
              _yield$getStorageAsyn40 = _context83.v;
              notClosedSessions = _yield$getStorageAsyn40.notClosedSessions;
              if (!notClosedSessions) {
                notClosedSessions = [];
              }
              indexFindSession = notClosedSessions.map(function (e) {
                return e.host;
              }).indexOf(closedSession.host);
              if (~indexFindSession) {
                notClosedSessions[indexFindSession] = {
                  host: closedSession.host,
                  username: null,
                  password: null
                };
              } else {
                notClosedSessions.push(closedSession);
              }
              _context83.n = 2;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.NOT_CLOSED_SESSIONS, notClosedSessions));
            case 2:
              return _context83.a(2);
          }
        }, _callee83);
      }));
      function addNotClosedSession(_x40) {
        return _addNotClosedSession.apply(this, arguments);
      }
      return addNotClosedSession;
    }()
  }, {
    key: "saveIsNewProxyDomain",
    value: function () {
      var _saveIsNewProxyDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee84(isNewProxyDomain) {
        return _regenerator().w(function (_context84) {
          while (1) switch (_context84.n) {
            case 0:
              _context84.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.IS_NEW_PROXY_DOMAIN, isNewProxyDomain));
            case 1:
              return _context84.a(2);
          }
        }, _callee84);
      }));
      function saveIsNewProxyDomain(_x41) {
        return _saveIsNewProxyDomain.apply(this, arguments);
      }
      return saveIsNewProxyDomain;
    }()
  }, {
    key: "getIsNewProxyDomain",
    value: function () {
      var _getIsNewProxyDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee85() {
        var _yield$getStorageAsyn41, isNewProxyDomain;
        return _regenerator().w(function (_context85) {
          while (1) switch (_context85.n) {
            case 0:
              _context85.n = 1;
              return getStorageAsync([STORAGE_KEYS.IS_NEW_PROXY_DOMAIN]);
            case 1:
              _yield$getStorageAsyn41 = _context85.v;
              isNewProxyDomain = _yield$getStorageAsyn41.isNewProxyDomain;
              return _context85.a(2, isNewProxyDomain || false);
          }
        }, _callee85);
      }));
      function getIsNewProxyDomain() {
        return _getIsNewProxyDomain.apply(this, arguments);
      }
      return getIsNewProxyDomain;
    }()
  }, {
    key: "saveSessionExpiredNotified",
    value: function () {
      var _saveSessionExpiredNotified = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee86(sessionExpiredNotified) {
        return _regenerator().w(function (_context86) {
          while (1) switch (_context86.n) {
            case 0:
              _context86.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.SESSION_EXPIRED_NOTIFIED, sessionExpiredNotified));
            case 1:
              return _context86.a(2);
          }
        }, _callee86);
      }));
      function saveSessionExpiredNotified(_x42) {
        return _saveSessionExpiredNotified.apply(this, arguments);
      }
      return saveSessionExpiredNotified;
    }()
  }, {
    key: "getSessionExpiredNotified",
    value: function () {
      var _getSessionExpiredNotified = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee87() {
        var _yield$getStorageAsyn42, sessionExpiredNotified;
        return _regenerator().w(function (_context87) {
          while (1) switch (_context87.n) {
            case 0:
              _context87.n = 1;
              return getStorageAsync([STORAGE_KEYS.SESSION_EXPIRED_NOTIFIED]);
            case 1:
              _yield$getStorageAsyn42 = _context87.v;
              sessionExpiredNotified = _yield$getStorageAsyn42.sessionExpiredNotified;
              return _context87.a(2, sessionExpiredNotified || false);
          }
        }, _callee87);
      }));
      function getSessionExpiredNotified() {
        return _getSessionExpiredNotified.apply(this, arguments);
      }
      return getSessionExpiredNotified;
    }()
  }, {
    key: "saveIsNeedUpdateApiDomain",
    value: function () {
      var _saveIsNeedUpdateApiDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee88(isNeedUpdateApiDomain) {
        return _regenerator().w(function (_context88) {
          while (1) switch (_context88.n) {
            case 0:
              _context88.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.IS_NEED_UPDATE_API_DOMAIN, isNeedUpdateApiDomain));
            case 1:
              return _context88.a(2);
          }
        }, _callee88);
      }));
      function saveIsNeedUpdateApiDomain(_x43) {
        return _saveIsNeedUpdateApiDomain.apply(this, arguments);
      }
      return saveIsNeedUpdateApiDomain;
    }()
  }, {
    key: "getIsNeedUpdateApiDomain",
    value: function () {
      var _getIsNeedUpdateApiDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee89() {
        var _yield$getStorageAsyn43, isNeedUpdateApiDomain;
        return _regenerator().w(function (_context89) {
          while (1) switch (_context89.n) {
            case 0:
              _context89.n = 1;
              return getStorageAsync([STORAGE_KEYS.IS_NEED_UPDATE_API_DOMAIN]);
            case 1:
              _yield$getStorageAsyn43 = _context89.v;
              isNeedUpdateApiDomain = _yield$getStorageAsyn43.isNeedUpdateApiDomain;
              return _context89.a(2, isNeedUpdateApiDomain || false);
          }
        }, _callee89);
      }));
      function getIsNeedUpdateApiDomain() {
        return _getIsNeedUpdateApiDomain.apply(this, arguments);
      }
      return getIsNeedUpdateApiDomain;
    }()
  }, {
    key: "saveIsApiGatewayMainAfterCheck",
    value: function () {
      var _saveIsApiGatewayMainAfterCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee90(isApiGatewayMainAfterCheck) {
        return _regenerator().w(function (_context90) {
          while (1) switch (_context90.n) {
            case 0:
              _context90.n = 1;
              return setStorageAsync(_defineProperty({}, STORAGE_KEYS.IS_API_GATEWAY_MAIN_AFTER_CHECK, isApiGatewayMainAfterCheck));
            case 1:
              return _context90.a(2);
          }
        }, _callee90);
      }));
      function saveIsApiGatewayMainAfterCheck(_x44) {
        return _saveIsApiGatewayMainAfterCheck.apply(this, arguments);
      }
      return saveIsApiGatewayMainAfterCheck;
    }()
  }, {
    key: "getIsApiGatewayMainAfterCheck",
    value: function () {
      var _getIsApiGatewayMainAfterCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee91() {
        var _yield$getStorageAsyn44, isApiGatewayMainAfterCheck;
        return _regenerator().w(function (_context91) {
          while (1) switch (_context91.n) {
            case 0:
              _context91.n = 1;
              return getStorageAsync([STORAGE_KEYS.IS_API_GATEWAY_MAIN_AFTER_CHECK]);
            case 1:
              _yield$getStorageAsyn44 = _context91.v;
              isApiGatewayMainAfterCheck = _yield$getStorageAsyn44.isApiGatewayMainAfterCheck;
              return _context91.a(2, isApiGatewayMainAfterCheck || false);
          }
        }, _callee91);
      }));
      function getIsApiGatewayMainAfterCheck() {
        return _getIsApiGatewayMainAfterCheck.apply(this, arguments);
      }
      return getIsApiGatewayMainAfterCheck;
    }()
  }]);
}();
module.exports = StorageService;

/***/ }),

/***/ "./src/common/services/TranslateService.js":
/*!*************************************************!*\
  !*** ./src/common/services/TranslateService.js ***!
  \*************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
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 asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require.log,
  LOG_LEVELS = _require.LOG_LEVELS;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var TranslateService = /*#__PURE__*/function () {
  function TranslateService() {
    _classCallCheck(this, TranslateService);
    this.language = "en";
    this.translations = {};
    this.loading = true;
    this.error = null;
    this.initialized = false;
    this.initPromise = this.initialize();
  }
  return _createClass(TranslateService, [{
    key: "loadTranslations",
    value: function () {
      var _loadTranslations = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(lang) {
        var response, langTranslations, enResponse, enTranslations, _t;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              _context.p = 0;
              this.loading = true;
              this.error = null;
              response = __webpack_require__("./src/locale sync recursive ^\\.\\/.*\\/translation\\.json$")("./".concat(lang, "/translation.json"));
              langTranslations = response || {};
              if (lang !== "en") {
                enResponse = __webpack_require__(/*! @src/locale/en/translation.json */ "./src/locale/en/translation.json");
                enTranslations = enResponse || {};
                langTranslations = _objectSpread(_objectSpread({}, enTranslations), langTranslations);
              }
              this.translations = langTranslations || {};
              _context.n = 2;
              break;
            case 1:
              _context.p = 1;
              _t = _context.v;
              this.error = "Failed to load translations";
              this.translations = {};
              throw _t;
            case 2:
              _context.p = 2;
              this.loading = false;
              return _context.f(2);
            case 3:
              return _context.a(2);
          }
        }, _callee, this, [[0, 1, 2, 3]]);
      }));
      function loadTranslations(_x) {
        return _loadTranslations.apply(this, arguments);
      }
      return loadTranslations;
    }()
  }, {
    key: "refreshTranslations",
    value: function () {
      var _refreshTranslations = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.n) {
            case 0:
              this.initialized = false;
              this.initPromise = null;
              return _context2.a(2, this.initialize());
          }
        }, _callee2, this);
      }));
      function refreshTranslations() {
        return _refreshTranslations.apply(this, arguments);
      }
      return refreshTranslations;
    }()
  }, {
    key: "initialize",
    value: function () {
      var _initialize = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
        var _this = this;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              if (!this.initialized) {
                _context4.n = 1;
                break;
              }
              return _context4.a(2);
            case 1:
              if (!this.initPromise) {
                this.initPromise = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
                  var generalSettings, _t2;
                  return _regenerator().w(function (_context3) {
                    while (1) switch (_context3.p = _context3.n) {
                      case 0:
                        _context3.p = 0;
                        _context3.n = 1;
                        return StorageService.getGeneralSettings();
                      case 1:
                        generalSettings = _context3.v;
                        _this.language = generalSettings.language || "en";
                        _context3.n = 2;
                        return _this.loadTranslations(_this.language);
                      case 2:
                        _this.initialized = true;
                        _context3.n = 6;
                        break;
                      case 3:
                        _context3.p = 3;
                        _t2 = _context3.v;
                        log(LOG_LEVELS.ERROR, "Initialize error, fallback to EN:", _t2);
                        _context3.n = 4;
                        return LogsService.addEvents('service.error_initialize', {}, _t2.message);
                      case 4:
                        _context3.n = 5;
                        return _this.loadTranslations("en");
                      case 5:
                        _this.initialized = true;
                      case 6:
                        return _context3.a(2);
                    }
                  }, _callee3, null, [[0, 3]]);
                }))();
              }
              return _context4.a(2, this.initPromise["catch"](function () {}));
          }
        }, _callee4, this);
      }));
      function initialize() {
        return _initialize.apply(this, arguments);
      }
      return initialize;
    }()
  }, {
    key: "changeLanguage",
    value: function () {
      var _changeLanguage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(newLanguage) {
        var generalSettings, updatedSettings, _t3;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.p = _context5.n) {
            case 0:
              _context5.p = 0;
              this.language = newLanguage;
              _context5.n = 1;
              return this.loadTranslations(newLanguage);
            case 1:
              _context5.n = 2;
              return StorageService.getGeneralSettings();
            case 2:
              generalSettings = _context5.v;
              updatedSettings = _objectSpread(_objectSpread({}, generalSettings), {}, {
                language: newLanguage
              });
              _context5.n = 3;
              return StorageService.saveGeneralSettings(updatedSettings);
            case 3:
              _context5.n = 4;
              return this.refreshTranslations();
            case 4:
              _context5.n = 6;
              break;
            case 5:
              _context5.p = 5;
              _t3 = _context5.v;
              this.error = "Failed to change language";
              throw _t3;
            case 6:
              return _context5.a(2);
          }
        }, _callee5, this, [[0, 5]]);
      }));
      function changeLanguage(_x2) {
        return _changeLanguage.apply(this, arguments);
      }
      return changeLanguage;
    }()
  }, {
    key: "changeLanguageByMessage",
    value: function () {
      var _changeLanguageByMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(message, sendResponse) {
        var _t4;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.p = _context6.n) {
            case 0:
              _context6.p = 0;
              _context6.n = 1;
              return this.changeLanguage(message.language);
            case 1:
              sendResponse({
                status: true
              });
              _context6.n = 4;
              break;
            case 2:
              _context6.p = 2;
              _t4 = _context6.v;
              log(LOG_LEVELS.ERROR, "Error changing language:", _t4);
              _context6.n = 3;
              return LogsService.addEvents('service.error_change_language_by_message', {}, _t4.message);
            case 3:
              sendResponse({
                status: false
              });
            case 4:
              return _context6.a(2);
          }
        }, _callee6, this, [[0, 2]]);
      }));
      function changeLanguageByMessage(_x3, _x4) {
        return _changeLanguageByMessage.apply(this, arguments);
      }
      return changeLanguageByMessage;
    }()
  }, {
    key: "t",
    value: function t(key) {
      var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
      var defMessage = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
      return this.translations && this.translations[key] ? this.translations[key] : defMessage ? defMessage : key;
    }
  }]);
}();
var translateService = new TranslateService();
module.exports = translateService;

/***/ }),

/***/ "./src/common/services/VpnDetector.js":
/*!********************************************!*\
  !*** ./src/common/services/VpnDetector.js ***!
  \********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require.log,
  LOG_LEVELS = _require.LOG_LEVELS;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require2 = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js"),
  clearKillSwitch = _require2.clearKillSwitch,
  disconnectProxyWithUpdateState = _require2.disconnectProxyWithUpdateState;
var _require3 = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js"),
  updateIcon = _require3.updateIcon;
var _require4 = __webpack_require__(/*! @sw/settings_services/pause_service */ "./src/sw/settings_services/pause_service.js"),
  handleDeletePause = _require4.handleDeletePause;
var _require5 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require5.PROXY_STATUSES;
var _require6 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  enableForceKillSwitch = _require6.enableForceKillSwitch;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var VpnDetector = /*#__PURE__*/function () {
  function VpnDetector() {
    _classCallCheck(this, VpnDetector);
    this.handleProxyChange = this.handleProxyChange.bind(this);
    this.checkProxyStatus = this.checkProxyStatus.bind(this);
    this.handleProxyStatus = this.handleProxyStatus.bind(this);
    this.cleanupFunctions = [];
    this.vpnKeywords = ['vpn', 'proxy', 'tunnel', 'privacy', 'secure', 'anonymous', 'nord', 'express', 'surfshark', 'proton', 'windscribe', 'hotspot', 'shield', 'unblock', 'bypass', 'geo'];
  }
  return _createClass(VpnDetector, [{
    key: "initialize",
    value: function initialize() {
      this.processAnotherExtension();
    }
  }, {
    key: "processAnotherExtension",
    value: function () {
      var _processAnotherExtension = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
        var _this = this;
        var browserName, intervalId, listener, _t;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              _context.p = 0;
              _context.n = 1;
              return this.handleProxyChange();
            case 1:
              browserName = browserApi.getBrowser();
              if (browserName === "firefox") {
                intervalId = setInterval(this.handleProxyChange, 2000);
                this.cleanupFunctions.push(function () {
                  return clearInterval(intervalId);
                });
              } else {
                listener = this.handleProxyChange;
                browserApi.proxy.settings.onChange.addListener(listener);
                this.cleanupFunctions.push(function () {
                  browserApi.proxy.settings.onChange.removeListener(listener);
                });
              }
              return _context.a(2, function () {
                return _this.cleanup();
              });
            case 2:
              _context.p = 2;
              _t = _context.v;
              log(LOG_LEVELS.WARN, '[VpnService] Error Another proxy/VPN', _t);
              _context.n = 3;
              return LogsService.addEvents('vpn_service.error_vpn_service', {}, _t.message);
            case 3:
              return _context.a(2, false);
          }
        }, _callee, this, [[0, 2]]);
      }));
      function processAnotherExtension() {
        return _processAnotherExtension.apply(this, arguments);
      }
      return processAnotherExtension;
    }()
  }, {
    key: "cleanup",
    value: function cleanup() {
      this.cleanupFunctions.forEach(function (cleanup) {
        return cleanup();
      });
      this.cleanupFunctions = [];
    }
  }, {
    key: "handleProxyChange",
    value: function () {
      var _handleProxyChange = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
        var proxyStatus;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.n) {
            case 0:
              _context2.n = 1;
              return this.checkProxyStatus();
            case 1:
              proxyStatus = _context2.v;
              _context2.n = 2;
              return this.handleProxyStatus(proxyStatus);
            case 2:
              return _context2.a(2);
          }
        }, _callee2, this);
      }));
      function handleProxyChange() {
        return _handleProxyChange.apply(this, arguments);
      }
      return handleProxyChange;
    }()
  }, {
    key: "checkProxyStatus",
    value: function () {
      var _checkProxyStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
        var browserName;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              browserName = browserApi.getBrowser();
              if (!(browserName === "firefox")) {
                _context3.n = 2;
                break;
              }
              _context3.n = 1;
              return this.checkProxyStatusFirefox();
            case 1:
              return _context3.a(2, _context3.v);
            case 2:
              _context3.n = 3;
              return this.checkProxyStatusDefault();
            case 3:
              return _context3.a(2, _context3.v);
            case 4:
              return _context3.a(2);
          }
        }, _callee3, this);
      }));
      function checkProxyStatus() {
        return _checkProxyStatus.apply(this, arguments);
      }
      return checkProxyStatus;
    }()
  }, {
    key: "checkProxyStatusDefault",
    value: function () {
      var _checkProxyStatusDefault = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              return _context4.a(2, new Promise(function (resolve) {
                browserApi.proxy.settings.get({
                  incognito: false
                }, function (details) {
                  if (browserApi.runtime.lastError) {
                    resolve(false);
                    return;
                  }
                  var levelOfControl = details.levelOfControl,
                    value = details.value;
                  if (["controllable_by_other_extensions", "controlled_by_other_extensions"].includes(levelOfControl)) {
                    resolve(true);
                    return;
                  }
                  if (levelOfControl === "controllable_by_this_extension") {
                    var isStandardProxyMode = ['system', 'none', 'direct'].includes(value === null || value === void 0 ? void 0 : value.mode);
                    if (!isStandardProxyMode) {
                      resolve(true);
                      return;
                    } else {
                      var allow_server = ['fixed_servers'].includes(value === null || value === void 0 ? void 0 : value.mode);
                      if (allow_server) {
                        var bypassList = ['bypassList'].includes(value === null || value === void 0 ? void 0 : value.rules);
                        if (!bypassList) {
                          resolve(true);
                          return;
                        }
                      }
                    }
                  }
                  resolve(false);
                });
              }));
          }
        }, _callee4);
      }));
      function checkProxyStatusDefault() {
        return _checkProxyStatusDefault.apply(this, arguments);
      }
      return checkProxyStatusDefault;
    }()
  }, {
    key: "checkProxyStatusFirefox",
    value: function () {
      var _checkProxyStatusFirefox = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
        var _this2 = this;
        var allExtensions, selfId, _t2;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.p = _context5.n) {
            case 0:
              _context5.p = 0;
              _context5.n = 1;
              return this.getAllExtensions();
            case 1:
              allExtensions = _context5.v;
              selfId = browserApi.runtime.id;
              return _context5.a(2, allExtensions.some(function (ext) {
                return ext.enabled && ext.id !== selfId && _this2.isVPNExtensionFirefox(ext);
              }));
            case 2:
              _context5.p = 2;
              _t2 = _context5.v;
              log(LOG_LEVELS.WARN, 'Error detecting VPN extensions:', _t2);
              return _context5.a(2, []);
          }
        }, _callee5, this, [[0, 2]]);
      }));
      function checkProxyStatusFirefox() {
        return _checkProxyStatusFirefox.apply(this, arguments);
      }
      return checkProxyStatusFirefox;
    }()
  }, {
    key: "getAllExtensions",
    value: function () {
      var _getAllExtensions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              return _context6.a(2, new Promise(function (resolve) {
                if (browserApi.management && browserApi.management.getAll) {
                  browserApi.management.getAll(function (extensions) {
                    resolve(extensions || []);
                  });
                } else {
                  resolve([]);
                }
              }));
          }
        }, _callee6);
      }));
      function getAllExtensions() {
        return _getAllExtensions.apply(this, arguments);
      }
      return getAllExtensions;
    }()
  }, {
    key: "isVPNExtensionFirefox",
    value: function isVPNExtensionFirefox(extension) {
      var _extension$descriptio;
      var name = extension.name.toLowerCase();
      var description = ((_extension$descriptio = extension.description) === null || _extension$descriptio === void 0 ? void 0 : _extension$descriptio.toLowerCase()) || '';
      return this.vpnKeywords.some(function (keyword) {
        return name.includes(keyword) || description.includes(keyword);
      });
    }
  }, {
    key: "handleProxyStatus",
    value: function () {
      var _handleProxyStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(isVpnActive) {
        var previousVpnState, currentStatus, _yield$StorageService, _t3, _t4, _t5, _t6, _t7, _t8;
        return _regenerator().w(function (_context7) {
          while (1) switch (_context7.n) {
            case 0:
              _context7.n = 1;
              return StorageService.getAnotherExtension();
            case 1:
              previousVpnState = _context7.v;
              if (!(isVpnActive === previousVpnState)) {
                _context7.n = 2;
                break;
              }
              return _context7.a(2);
            case 2:
              _context7.n = 3;
              return StorageService.getProxyStatus();
            case 3:
              _t3 = _context7.v;
              if (_t3) {
                _context7.n = 4;
                break;
              }
              _t3 = PROXY_STATUSES.DISCONNECT;
            case 4:
              currentStatus = _t3;
              if (!(currentStatus === PROXY_STATUSES.BLOCK_CONNECT && isVpnActive)) {
                _context7.n = 6;
                break;
              }
              _context7.n = 5;
              return StorageService.saveAnotherExtension(false);
            case 5:
              return _context7.a(2);
            case 6:
              _context7.n = 7;
              return StorageService.saveAnotherExtension(isVpnActive);
            case 7:
              if (!isVpnActive) {
                _context7.n = 17;
                break;
              }
              if (!(currentStatus === PROXY_STATUSES.CONNECT)) {
                _context7.n = 8;
                break;
              }
              _context7.n = 8;
              return disconnectProxyWithUpdateState();
            case 8:
              _t4 = currentStatus === PROXY_STATUSES.DISCONNECT || currentStatus === PROXY_STATUSES.KILL_SWITCH;
              if (!_t4) {
                _context7.n = 12;
                break;
              }
              _context7.n = 9;
              return StorageService.getPauseSetting();
            case 9:
              _t7 = _yield$StorageService = _context7.v;
              _t6 = _t7 !== null;
              if (!_t6) {
                _context7.n = 10;
                break;
              }
              _t6 = _yield$StorageService !== void 0;
            case 10:
              _t5 = _t6;
              if (!_t5) {
                _context7.n = 11;
                break;
              }
              _t5 = _yield$StorageService.pause;
            case 11:
              _t4 = _t5;
            case 12:
              if (!_t4) {
                _context7.n = 13;
                break;
              }
              _context7.n = 13;
              return handleDeletePause(function () {});
            case 13:
              _context7.n = 14;
              return updateIcon(false);
            case 14:
              _context7.n = 15;
              return StorageService.getSettingsKillSwitch();
            case 15:
              if (!_context7.v) {
                _context7.n = 16;
                break;
              }
              _context7.n = 16;
              return clearKillSwitch();
            case 16:
              _context7.n = 21;
              break;
            case 17:
              _context7.n = 18;
              return updateIcon(currentStatus === PROXY_STATUSES.CONNECT);
            case 18:
              _context7.n = 19;
              return StorageService.getSettingsKillSwitch();
            case 19:
              _t8 = _context7.v;
              if (!_t8) {
                _context7.n = 20;
                break;
              }
              _t8 = currentStatus !== PROXY_STATUSES.CONNECT;
            case 20:
              if (!_t8) {
                _context7.n = 21;
                break;
              }
              _context7.n = 21;
              return enableForceKillSwitch();
            case 21:
              return _context7.a(2);
          }
        }, _callee7);
      }));
      function handleProxyStatus(_x) {
        return _handleProxyStatus.apply(this, arguments);
      }
      return handleProxyStatus;
    }()
  }]);
}();
var VpnDetectorService = new VpnDetector();
module.exports = VpnDetectorService;

/***/ }),

/***/ "./src/common/services/VpnService.js":
/*!*******************************************!*\
  !*** ./src/common/services/VpnService.js ***!
  \*******************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   VpnService: () => (/* binding */ VpnService)
/* harmony export */ });
/* harmony import */ var _entities_proxyserver__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @entities/proxyserver */ "./src/entities/proxyserver.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @services/HttpRequestApi */ "./src/common/services/HttpRequestApi.js");
/* harmony import */ var _sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @sw/settings_services/pause_service */ "./src/sw/settings_services/pause_service.js");
/* harmony import */ var _sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _sw_main_proxy__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js");
/* harmony import */ var _sw_main_proxy__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_sw_main_proxy__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _services_LogsService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js");
/* harmony import */ var _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @services/CountrySelectorService */ "./src/common/services/CountrySelectorService.js");
/* harmony import */ var _common_functions_apiGatewaysForCity__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @common/functions/apiGatewaysForCity */ "./src/common/functions/apiGatewaysForCity.js");
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }








var VpnService = /*#__PURE__*/function () {
  function VpnService() {
    _classCallCheck(this, VpnService);
  }
  return _createClass(VpnService, null, [{
    key: "connectSelectIp",
    value: (
    /**
     * Connects to a specific proxy server
     * @param {ProxyServer} server
     * @param {boolean} locationSpoofing
     * @param sendResponse
     * @param isPause
     * @returns {Promise<{status: string, userData: Object}>}
     */
    function () {
      var _connectSelectIp = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(server, sendResponse) {
        var locationSpoofing,
          isPause,
          nonClosedSessions,
          endResult,
          message,
          cityCode,
          cityInfo,
          _args = arguments,
          _t;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              locationSpoofing = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
              isPause = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
              _context.p = 1;
              _context.n = 2;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().saveLoadConnectStatus(true);
            case 2:
              _context.n = 3;
              return VpnService.closeNonClosedSessions();
            case 3:
              nonClosedSessions = _context.v;
              _context.n = 4;
              return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_4__.checkManualCancelConnectAndDisconnect)(sendResponse);
            case 4:
              if (!_context.v) {
                _context.n = 5;
                break;
              }
              return _context.a(2, null);
            case 5:
              _context.n = 6;
              return VpnService.closeOldSession(server._username);
            case 6:
              endResult = _context.v;
              _context.n = 7;
              return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_4__.checkManualCancelConnectAndDisconnect)(sendResponse, !endResult);
            case 7:
              if (!_context.v) {
                _context.n = 8;
                break;
              }
              return _context.a(2, null);
            case 8:
              message = VpnService.generateMessageDataFromServerInfo(server);
              _context.n = 9;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().saveLastServerDomain(message.host);
            case 9:
              if (!isPause) {
                _context.n = 13;
                break;
              }
              _context.n = 10;
              return _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_6__.CountrySelectorService.getCityCodeForCountry(message.country);
            case 10:
              cityCode = _context.v;
              _context.n = 11;
              return _services_CountrySelectorService__WEBPACK_IMPORTED_MODULE_6__.CountrySelectorService.getInfoByCityCode(cityCode);
            case 11:
              cityInfo = _context.v;
              _context.n = 12;
              return (0,_common_functions_apiGatewaysForCity__WEBPACK_IMPORTED_MODULE_7__.getApiGatewaysForCity)(cityInfo, false);
            case 12:
              (0,_sw_settings_services_pause_service__WEBPACK_IMPORTED_MODULE_3__.handleDeletePause)(function () {});
            case 13:
              _context.n = 14;
              return (0,_sw_main_proxy__WEBPACK_IMPORTED_MODULE_4__.connectProxyByParams)(sendResponse, message);
            case 14:
              _context.n = 15;
              return _services_LogsService__WEBPACK_IMPORTED_MODULE_5__["default"].addEvents('service.connect_select_ip', {
                host: message.host,
                country: message.country,
                port: message.port,
                timeZone: message.timeZone,
                offset: message.offset,
                locationSpoofing: locationSpoofing,
                isPause: isPause
              });
            case 15:
              _context.n = 18;
              break;
            case 16:
              _context.p = 16;
              _t = _context.v;
              _context.n = 17;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().saveLoadConnectStatus(false);
            case 17:
              throw _t;
            case 18:
              return _context.a(2);
          }
        }, _callee, null, [[1, 16]]);
      }));
      function connectSelectIp(_x, _x2) {
        return _connectSelectIp.apply(this, arguments);
      }
      return connectSelectIp;
    }())
  }, {
    key: "generateMessageDataFromServerInfo",
    value: function generateMessageDataFromServerInfo(server) {
      var newServer = {};
      if (server !== null && server !== void 0 && server.getData) {
        newServer = server;
      } else {
        newServer = new _entities_proxyserver__WEBPACK_IMPORTED_MODULE_0__.ProxyServer(server._host, server._port, server._country, server._username, server._password, server._lat, server._lon, server._timeZone, server._offset);
      }
      return _objectSpread({}, newServer.getData());
    }
  }, {
    key: "closeNonClosedSessions",
    value: function () {
      var _closeNonClosedSessions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
        var notClosedSessions, serverDomain, result, curProxy;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              _context3.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getNotClosedSession();
            case 1:
              notClosedSessions = _context3.v;
              _context3.n = 2;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getServerDomain();
            case 2:
              serverDomain = _context3.v;
              if (!(notClosedSessions && notClosedSessions.length)) {
                _context3.n = 5;
                break;
              }
              _context3.n = 3;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getCurrentProxy();
            case 3:
              curProxy = _context3.v;
              _context3.n = 4;
              return Promise.all(notClosedSessions.map(/*#__PURE__*/function () {
                var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(notClosedSession) {
                  var request;
                  return _regenerator().w(function (_context2) {
                    while (1) switch (_context2.n) {
                      case 0:
                        if (!(serverDomain === notClosedSession.host && curProxy !== null && curProxy !== void 0 && curProxy.username && curProxy !== null && curProxy !== void 0 && curProxy.password)) {
                          _context2.n = 1;
                          break;
                        }
                        return _context2.a(2, true);
                      case 1:
                        request = new _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_2__.HttpRequestApi(notClosedSession.host);
                        if (!notClosedSession.username) {
                          _context2.n = 3;
                          break;
                        }
                        _context2.n = 2;
                        return request.sendEndConnectRequest(notClosedSession.username, notClosedSession.password, true, true);
                      case 2:
                        return _context2.a(2, _context2.v);
                      case 3:
                        _context2.n = 4;
                        return request.sendStartConnectRequest(null, null, true, true);
                      case 4:
                        return _context2.a(2, _context2.v);
                      case 5:
                        return _context2.a(2);
                    }
                  }, _callee2);
                }));
                return function (_x3) {
                  return _ref.apply(this, arguments);
                };
              }()));
            case 4:
              result = _context3.v;
              _context3.n = 5;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().saveNotClosedSession([]);
            case 5:
              return _context3.a(2, result);
          }
        }, _callee3);
      }));
      function closeNonClosedSessions() {
        return _closeNonClosedSessions.apply(this, arguments);
      }
      return closeNonClosedSessions;
    }()
  }, {
    key: "closeOldSession",
    value: function () {
      var _closeOldSession = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
        var newUsername,
          curProxy,
          _args4 = arguments;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              newUsername = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "";
              _context4.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getCurrentProxy();
            case 1:
              curProxy = _context4.v;
              if (!(curProxy !== null && curProxy !== void 0 && curProxy.username && curProxy !== null && curProxy !== void 0 && curProxy.password)) {
                _context4.n = 3;
                break;
              }
              _context4.n = 2;
              return this.sendDisconnectRequest(curProxy.username, curProxy.password, newUsername);
            case 2:
              return _context4.a(2, _context4.v);
            case 3:
              return _context4.a(2, true);
          }
        }, _callee4, this);
      }));
      function closeOldSession() {
        return _closeOldSession.apply(this, arguments);
      }
      return closeOldSession;
    }()
  }, {
    key: "sendDisconnectRequest",
    value: function () {
      var _sendDisconnectRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(username, password) {
        var newUsername,
          lastServerDomain,
          serverDomain,
          request_old,
          _args5 = arguments;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.n) {
            case 0:
              newUsername = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : "";
              if (!(!username || !password)) {
                _context5.n = 1;
                break;
              }
              return _context5.a(2);
            case 1:
              _context5.n = 2;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getLastServerDomain();
            case 2:
              lastServerDomain = _context5.v;
              _context5.n = 3;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getServerDomain();
            case 3:
              serverDomain = _context5.v;
              if (!(lastServerDomain && lastServerDomain !== serverDomain)) {
                _context5.n = 4;
                break;
              }
              request_old = new _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_2__.HttpRequestApi(lastServerDomain);
              _context5.n = 4;
              return request_old.sendEndConnectRequest(username, password, true);
            case 4:
              return _context5.a(2, true);
          }
        }, _callee5);
      }));
      function sendDisconnectRequest(_x4, _x5) {
        return _sendDisconnectRequest.apply(this, arguments);
      }
      return sendDisconnectRequest;
    }()
  }, {
    key: "sendStartRequest",
    value: function () {
      var _sendStartRequest = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(username, password) {
        var serverDomain, request;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              _context6.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getLastServerDomain();
            case 1:
              serverDomain = _context6.v;
              if (!serverDomain) {
                _context6.n = 2;
                break;
              }
              request = new _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_2__.HttpRequestApi(serverDomain);
              _context6.n = 2;
              return request.sendStartConnectRequest(username, password);
            case 2:
              return _context6.a(2);
          }
        }, _callee6);
      }));
      function sendStartRequest(_x6, _x7) {
        return _sendStartRequest.apply(this, arguments);
      }
      return sendStartRequest;
    }()
  }, {
    key: "checkIsSameServerDomain",
    value: function checkIsSameServerDomain(serverDomain, currentProxyDomain) {
      if (!serverDomain || !currentProxyDomain) return false;
      var serverMatch = serverDomain.match(/(?:https?:\/\/)?((?:[^-]+-[^-]+))/);
      if (!serverMatch) return false;
      var gatewayWarPart = serverMatch[1].split('-').slice(0, 2).join('-');
      return currentProxyDomain.includes(gatewayWarPart);
    }
  }]);
}();


/***/ }),

/***/ "./src/context/LanguageContext.js":
/*!****************************************!*\
  !*** ./src/context/LanguageContext.js ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   LanguageProvider: () => (/* binding */ LanguageProvider),
/* harmony export */   "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_common_browserApi__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _sw_constants_listen_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js");
/* harmony import */ var _sw_constants_listen_constants__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_sw_constants_listen_constants__WEBPACK_IMPORTED_MODULE_3__);
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
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 asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }




var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var LanguageContext = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(undefined, undefined);
var LanguageProvider = function LanguageProvider(_ref) {
  var children = _ref.children;
  var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)("en"),
    _useState2 = _slicedToArray(_useState, 2),
    language = _useState2[0],
    setLanguage = _useState2[1];
  var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)({}),
    _useState4 = _slicedToArray(_useState3, 2),
    translations = _useState4[0],
    setTranslations = _useState4[1];
  var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(true),
    _useState6 = _slicedToArray(_useState5, 2),
    loading = _useState6[0],
    setLoading = _useState6[1];
  var _useState7 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
    _useState8 = _slicedToArray(_useState7, 2),
    error = _useState8[0],
    setError = _useState8[1];
  var loadTranslations = /*#__PURE__*/function () {
    var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(lang) {
      var response, langTranslations, enResponse, enTranslations, _t;
      return _regenerator().w(function (_context) {
        while (1) switch (_context.p = _context.n) {
          case 0:
            _context.p = 0;
            setLoading(true);
            setError(null);
            _context.n = 1;
            return __webpack_require__("./src/locale lazy recursive ^\\.\\/.*\\/translation\\.json$")("./".concat(lang, "/translation.json"));
          case 1:
            response = _context.v;
            langTranslations = response["default"] || {};
            if (!(lang !== "en")) {
              _context.n = 3;
              break;
            }
            _context.n = 2;
            return Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(__webpack_require__, /*! ../locale/en/translation.json */ "./src/locale/en/translation.json", 19));
          case 2:
            enResponse = _context.v;
            enTranslations = enResponse["default"] || {};
            langTranslations = _objectSpread(_objectSpread({}, enTranslations), langTranslations);
          case 3:
            setTranslations(langTranslations || {});
            _context.n = 5;
            break;
          case 4:
            _context.p = 4;
            _t = _context.v;
            setError("Failed to load translations");
            setTranslations({});
          case 5:
            _context.p = 5;
            setLoading(false);
            return _context.f(5);
          case 6:
            return _context.a(2);
        }
      }, _callee, null, [[0, 4, 5, 6]]);
    }));
    return function loadTranslations(_x) {
      return _ref2.apply(this, arguments);
    };
  }();
  (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
    var initializeLanguage = /*#__PURE__*/function () {
      var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
        var generalSettings, lang, _t2;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.p = _context2.n) {
            case 0:
              _context2.p = 0;
              _context2.n = 1;
              return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getGeneralSettings();
            case 1:
              generalSettings = _context2.v;
              lang = generalSettings.language || "en";
              setLanguage(lang);
              _context2.n = 2;
              return loadTranslations(lang);
            case 2:
              _context2.n = 4;
              break;
            case 3:
              _context2.p = 3;
              _t2 = _context2.v;
              setError("Failed to initialize language");
              setLanguage("en");
              _context2.n = 4;
              return loadTranslations("en");
            case 4:
              return _context2.a(2);
          }
        }, _callee2, null, [[0, 3]]);
      }));
      return function initializeLanguage() {
        return _ref3.apply(this, arguments);
      };
    }();
    initializeLanguage();
  }, []);
  var changeLanguage = /*#__PURE__*/function () {
    var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(newLanguage) {
      var generalSettings, updatedSettings, _t3;
      return _regenerator().w(function (_context3) {
        while (1) switch (_context3.p = _context3.n) {
          case 0:
            _context3.p = 0;
            setLanguage(newLanguage);
            _context3.n = 1;
            return loadTranslations(newLanguage);
          case 1:
            _context3.n = 2;
            return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getGeneralSettings();
          case 2:
            generalSettings = _context3.v;
            updatedSettings = _objectSpread(_objectSpread({}, generalSettings), {}, {
              language: newLanguage
            });
            _context3.n = 3;
            return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().saveGeneralSettings(updatedSettings);
          case 3:
            _context3.n = 4;
            return LogsService.addEvents("action.send.".concat(_sw_constants_listen_constants__WEBPACK_IMPORTED_MODULE_3__.LANGUAGE_CHANGED), {
              method_send: 'changeLanguage'
            });
          case 4:
            _context3.n = 5;
            return _common_browserApi__WEBPACK_IMPORTED_MODULE_2___default().runtime.sendMessage({
              action: _sw_constants_listen_constants__WEBPACK_IMPORTED_MODULE_3__.LANGUAGE_CHANGED,
              language: newLanguage
            });
          case 5:
            _context3.n = 7;
            break;
          case 6:
            _context3.p = 6;
            _t3 = _context3.v;
            setError("Failed to change language");
          case 7:
            return _context3.a(2);
        }
      }, _callee3, null, [[0, 6]]);
    }));
    return function changeLanguage(_x2) {
      return _ref4.apply(this, arguments);
    };
  }();
  var t = function t(key) {
    if (translations[key]) {
      return translations[key];
    }
    return key;
  };
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(LanguageContext.Provider, {
    value: {
      language: language,
      changeLanguage: changeLanguage,
      t: t,
      loading: loading,
      error: error
    }
  }, children);
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (LanguageContext);

/***/ }),

/***/ "./src/entities/proxyserver.js":
/*!*************************************!*\
  !*** ./src/entities/proxyserver.js ***!
  \*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   ProxyServer: () => (/* binding */ ProxyServer)
/* harmony export */ });
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 _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var config = __webpack_require__(/*! ../../config */ "./config.js");
var ProxyServer = /*#__PURE__*/function () {
  function ProxyServer(host, port, country, username, password, lat, lon, timeZone, offset) {
    _classCallCheck(this, ProxyServer);
    _defineProperty(this, "_host", '');
    _defineProperty(this, "_port", 0);
    _defineProperty(this, "_country", '');
    _defineProperty(this, "_username", undefined);
    _defineProperty(this, "_password", undefined);
    _defineProperty(this, "_lat", null);
    _defineProperty(this, "_lon", null);
    _defineProperty(this, "_timeZone", null);
    _defineProperty(this, "_offset", null);
    this.setHost(host);
    this.setPort(port);
    this.setCountry(country);
    this.setUsername(username);
    this.setPassword(password);
    this.setLat(lat);
    this.setLon(lon);
    this.setTimeZone(timeZone);
    this.setOffset(offset);
  }
  return _createClass(ProxyServer, [{
    key: "getHost",
    value: function getHost() {
      return this._host;
    }
  }, {
    key: "getPort",
    value: function getPort() {
      return this._port;
    }
  }, {
    key: "getCountry",
    value: function getCountry() {
      return this._country;
    }
  }, {
    key: "getUsername",
    value: function getUsername() {
      return this._username;
    }
  }, {
    key: "getPassword",
    value: function getPassword() {
      return this._password;
    }
  }, {
    key: "getLat",
    value: function getLat() {
      return this._lat;
    }
  }, {
    key: "getLon",
    value: function getLon() {
      return this._lon;
    }
  }, {
    key: "getTimeZone",
    value: function getTimeZone() {
      return this._timeZone;
    }
  }, {
    key: "getOffset",
    value: function getOffset() {
      return this._offset;
    }
  }, {
    key: "setHost",
    value: function setHost(host) {
      this._host = host;
    }
  }, {
    key: "setPort",
    value: function setPort(port) {
      if (Number.isInteger(port) && port > 0 && port <= 65535) {
        this._port = port;
      } else {
        throw new Error('Port must be between 1 and 65535');
      }
    }
  }, {
    key: "setCountry",
    value: function setCountry(country) {
      this._country = country;
    }
  }, {
    key: "setUsername",
    value: function setUsername(username) {
      this._username = username;
    }
  }, {
    key: "setPassword",
    value: function setPassword(password) {
      this._password = password;
    }
  }, {
    key: "setLat",
    value: function setLat(lat) {
      this._lat = lat;
    }
  }, {
    key: "setLon",
    value: function setLon(lon) {
      this._lon = lon;
    }
  }, {
    key: "setTimeZone",
    value: function setTimeZone(timeZone) {
      this._timeZone = timeZone;
    }
  }, {
    key: "setOffset",
    value: function setOffset(offset) {
      this._offset = offset;
    }
  }, {
    key: "getData",
    value: function getData() {
      var data = {
        host: this.getHost(),
        port: this.getPort(),
        country: this.getCountry(),
        username: this.getUsername(),
        password: this.getPassword()
      };
      if (config.ENABLED_LOCATION_SPOOFING) {
        data.lat = this.getLat();
        data.lon = this.getLon();
        data.timeZone = this.getTimeZone();
        data.offset = this.getOffset();
      }
      return data;
    }
  }]);
}();

/***/ }),

/***/ "./src/locale lazy recursive ^\\.\\/.*\\/translation\\.json$":
/*!***********************************************************************!*\
  !*** ./src/locale/ lazy ^\.\/.*\/translation\.json$ namespace object ***!
  \***********************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var map = {
	"./de/translation.json": "./src/locale/de/translation.json",
	"./en/translation.json": "./src/locale/en/translation.json"
};

function webpackAsyncContext(req) {
	return Promise.resolve().then(() => {
		if(!__webpack_require__.o(map, req)) {
			var e = new Error("Cannot find module '" + req + "'");
			e.code = 'MODULE_NOT_FOUND';
			throw e;
		}

		var id = map[req];
		return __webpack_require__.t(id, 3 | 16);
	});
}
webpackAsyncContext.keys = () => (Object.keys(map));
webpackAsyncContext.id = "./src/locale lazy recursive ^\\.\\/.*\\/translation\\.json$";
module.exports = webpackAsyncContext;

/***/ }),

/***/ "./src/locale sync recursive ^\\.\\/.*\\/translation\\.json$":
/*!******************************************************!*\
  !*** ./src/locale/ sync ^\.\/.*\/translation\.json$ ***!
  \******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var map = {
	"./de/translation.json": "./src/locale/de/translation.json",
	"./en/translation.json": "./src/locale/en/translation.json"
};


function webpackContext(req) {
	var id = webpackContextResolve(req);
	return __webpack_require__(id);
}
function webpackContextResolve(req) {
	if(!__webpack_require__.o(map, req)) {
		var e = new Error("Cannot find module '" + req + "'");
		e.code = 'MODULE_NOT_FOUND';
		throw e;
	}
	return map[req];
}
webpackContext.keys = function webpackContextKeys() {
	return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = "./src/locale sync recursive ^\\.\\/.*\\/translation\\.json$";

/***/ }),

/***/ "./src/locale/de/translation.json":
/*!****************************************!*\
  !*** ./src/locale/de/translation.json ***!
  \****************************************/
/***/ ((module) => {

"use strict";
module.exports = /*#__PURE__*/JSON.parse('{"setting":"Einstellungen","setting_general":"Allgemein","setting_general_description":"Wählen Sie Erweiterungseinstellungen oder melden Sie sich ab.","setting_connection":"Verbindung","setting_connection_description":"Verwalten Sie Ihre VPN-Verbindung.","setting_security":"Sicherheit und Datenschutz","setting_security_description":"Richten Sie sichere Browsing-Funktionen ein.","setting_refer-a-friend":"Freund werben","setting_refer-a-friend_description":"Erhalten Sie sofort 3 Monate, indem Sie einen Freund werben.","setting_general_save_browser":"Einstellungen lokal im Browser speichern","setting_general_save_browser_description":"Alle Einstellungen bleiben auf diesem Gerät.","setting_general_backup":"Einstellungen sichern","setting_general_backup_description":"Exportieren Sie Ihre Einstellungen in eine JSON-Datei zur Sicherung.","setting_general_backup_button":"Einstellungen exportieren","setting_referral_hub":"Werbezentrum","setting_referral_hub_section_1_title":"Erhalten Sie 3 Monate gratis, wenn Ihr Freund beitritt!","setting_referral_hub_section_1_button":"Kopie","copied":"Kopiert","setting_referral_hub_section_1_text":"Erhalten Sie 3 kostenlose Monate, wenn Sie einen Freund werben. Sie erhalten ebenfalls bis zu 3 Monate, je nach ihrem Plan. Ihr Bonuszeitraum wird sofort hinzugefügt.","setting_referral_hub_section_2_title":"Freund einladen","setting_referral_hub_section_2_text":"Kennen Sie jemanden, der Apexguard noch nicht nutzt? Teilen Sie Ihren persönlichen Werbelink und laden Sie ihn ein, beizutreten.","setting_referral_hub_section_3_title":"Warten Sie, bis sie sich anmelden","setting_referral_hub_section_3_text":"Stellen Sie sicher, dass Ihr Freund sein Apexguard-Abonnement mit Ihrem Werbelink abschließt.","setting_referral_hub_section_4_title":"Genießen Sie Ihre Belohnungen","setting_referral_hub_section_4_text":"Verdienen Sie 3 Bonusmonate. Ihr Freund erhält 3 Monate bei Langzeitplänen oder 1 Monat bei einem monatlichen Abonnement.","setting_network_and_privacy":"Netzwerk & Datenschutz","setting_network_and_privacy_section_1_title":"Automatische Verbindung","setting_network_and_privacy_section_1_text":"Automatisch mit VPN verbinden, wenn der Browser gestartet wird.","setting_network_and_privacy_section_2_title":"Kill Switch","setting_network_and_privacy_section_2_text":"Verhindern Sie den Internetzugriff des Browsers, wenn die VPN-Verbindung getrennt ist.","setting_network_and_privacy_section_3_title":"Split Tunneling","setting_network_and_privacy_section_3_text":"Bestimmte Domains oder IP-Adressen von der VPN-Verbindung ausschließen.","setting_network_and_privacy_dropdown_title":"Schnellster Server","setting_network_and_privacy_fastest_server":"Schnellster Server","setting_general_restore":"Einstellungen wiederherstellen","setting_general_restore_description":"Importieren Sie Ihre Einstellungen aus einer JSON-Datei, um sie wiederherzustellen.","setting_general_restore_button":"Einstellungen importieren","setting_general_share_data":"Nutzungsdaten teilen","setting_general_share_data_description":"Helfen Sie uns, unser Produkt zu verbessern und die Qualität zu steigern, indem Sie anonyme Interaktionsdaten senden.","setting_general_language":"Sprache","setting_general_appearance":"Erscheinungsbild","setting_general_user_info":"Benutzerinformationen","setting_general_subscription_active":"Abonnement aktiv bis","setting_general_logout":"Abmelden","setting_security_stop_webrtc":"WebRTC-Lecks stoppen","setting_security_stop_webrtc_description":"Schützen Sie Ihre IP-Adresse vor der Offenlegung durch das WebRTC-Protokoll.","setting_security_threat_protection":"Bedrohungsschutz","setting_security_threat_protection_description":"Blockieren Sie Werbung und schädliche Websites, wenn Sie mit dem VPN verbunden sind.","setting_security_warnings":"Warnungen","setting_security_warnings_description":"Erfahren Sie, ob eine besuchte Website unsicher ist. Verwenden Sie VPN auf diesen Websites, um Ihre Verbindung zu verschlüsseln.","setting_security_location_spoofing":"Standort-Spoofing","setting_security_location_spoofing_description":"Stellen Sie Ihren Browser so ein, dass er den Standort und die Zeitzone des VPN-Servers verwendet, mit dem Sie verbunden sind.","setting_connection_auto_connect_description":"Verbinden Sie sich bei jedem Browserstart mit dem VPN.","setting_connection_split_tunneling":"Split Tunneling","setting_connection_split_tunneling_description":"Fügen Sie Domains oder IP-Adressen hinzu, um sie vom VPN-Tunnel auszuschließen.","setting_connection_kill_switch":"Kill Switch","setting_connection_kill_switch_description":"Blockieren Sie den Internetzugriff des Browsers, wenn keine Verbindung zum VPN besteht.","setting_add_button":"Hinzufügen","setting_connection_input_placeholder":"Domain oder IP eingeben (z.B. example.com oder 192.168.1.1)","setting_connection_no_entries":"Noch keine Domains oder IPs ausgeschlossen.","setting_refer_description":"Verdienen Sie sofort 3 kostenlose Monate ApexVPN für jeden geworbenen Freund! Ihr Freund erhält sofort bis zu 3 kostenlose Monate, je nach gewähltem Plan.","setting_refer_copy_button":"Link kopieren","settings_refer_see_invited_friends":"Eingeladene Freunde ansehen","settings_refer_learn_more":"Mehr über das Werbeprogramm erfahren","login_title":"Sicher surfen, jederzeit und überall mit Apex VPN","loading":"Laden...","sign_up":"Registrieren","log_in":"Anmelden","log_out":"Abmelden","app_title":"ApexGuard","status_connected":"VERBUNDEN","status_not_connected":"Sie sind ungeschützt","ip_address":"IP-Adresse","unknown_location":"Unbekannter Standort","button_pause":"Pausieren","button_connect":"Intelligente Verbindung","button_disconnect":"Trennen","error_prefix":"Fehler","countries":"Länder","pause_5_min":"5 Min","pause_10_sec":"10 Sek","pause_30_min":"30 Min","pause_1_hour":"1 Stunde","resume_in":"Fortsetzen in","resume_now":"Jetzt fortsetzen","button_auto_disconnect":"Automatische Verbindung deaktivieren","pre_connected":"Verbinden...","pre_disconnected":"Trennen...","pre_cancel":"Absagen...","invalid_connect":"Die VPN-Verbindung konnte nicht hergestellt werden. Bitte versuchen Sie es später erneut.","something_wrong":"Etwas stimmt nicht","search_for_countries":"Suchen","invalid_jwt":"Ungültiges JWT: Token muss eine Zeichenfolge mit drei durch Punkte getrennten Teilen sein","miss_jwt":"Ungültiges JWT: Ein oder mehrere Teile fehlen","browser_api_underestimation":"Browser-API-Unterschätzung","popup_api_underestimation":"Popup-API-Unterschätzung","connect_failed":"Verbindung fehlgeschlagen","failed_to_logout":"Abmeldung fehlgeschlagen","successfully_logged":"Sie haben sich erfolgreich angemeldet!","successful_login":"ApexGuard: Erfolgreiche Anmeldung","validation_failed":"Validierung unerwartet fehlgeschlagen","validation_already":"Validierung bereits im Gange","apexguard_connected":"ApexGuard: verbunden","apexguard_successfully_connected":"Sie haben das VPN erfolgreich verbunden!","insecure_website_detected":"Unsichere Website erkannt","http_warning_message":"Diese Website verwendet eine unverschlüsselte Verbindung (HTTP). Verbinden Sie sich mit dem VPN, um Ihre Daten zu sichern.","connect_to_vpn":"Mit VPN verbinden","error_not_logged_in":"Fehler: Nicht angemeldet","error_token_validation_failed":"Token-Validierung unerwartet fehlgeschlagen","tab_close":"Fehler beim Schließen des Anmelde-Tabs","setting_security_auto_reload_tabs":"Alle Tabs automatisch neu laden","setting_security_auto_reload_tabs_description":"Alle geöffneten Tabs nach dem Verbinden mit einem VPN oder dem Ändern des VPN-Standorts immer neu laden, um Standort-Spoofing zu aktivieren.","clear_error":"Fehler löschen","This domain, IP, or mask is already in the list":"Diese Domain, IP oder Maske ist bereits in der Liste","Enter domain or IP (e.g., google.com)":"Domain oder IP eingeben (z.B. google.com)","Failed to load settings or countries":"Einstellungen oder Länder konnten nicht geladen werden","Failed to update settings":"Einstellungen konnten nicht aktualisiert werden","selective_proxy":"Selektiver Proxy","Use proxy only for specified domains":"Proxy nur für angegebene Domains verwenden","service_interruption":"Dienstunterbrechung","vpn_conflict_error":"Wir können nicht auf Proxy-Einstellungen zugreifen. Eine andere Erweiterung könnte sie steuern. Versuchen Sie, diese Erweiterung zu deaktivieren, damit ApexGuard funktioniert.","manage_extensions":"Erweiterungen verwalten","settings_imported":"Einstellungen importiert","settings_imported_successfully":"Einstellungen erfolgreich importiert","ping":"Ping","":"Problem melden","get_help":"Hilfe erhalten","report_a_problem":"Problem melden","contact_us":"Kontaktieren Sie uns","need_help":"Brauchen Sie Hilfe?","go_to_help_center":"Zum Hilfe-Center","download_logs":"Logs herunterladen","download_logs_text":"Laden Sie Ihre Diagnose-Logs herunter, um die Problemlösung zu beschleunigen.","download":"Herunterladen","describe_problem":"Beschreiben Sie Ihr Problem","cant_connect":"Kann nicht verbinden","unstable_vpn":"Instabiles VPN","slow_vpn":"Langsames VPN","no_internet":"Kein Internet","streaming":"Streaming","cant_login":"Kann nicht anmelden","other_tech":"Andere technische Probleme","issue_type":"Problemtyp","contact_information":"Kontaktinformationen","your_plans_active_until":"Ihr Plan ist aktiv bis","view_full_info":"Vollständige Informationen anzeigen","send_app_logs":"App-Logs senden","submit":"Absenden","well_reply_to":"Wir antworten an","select_a_topic":"Thema auswählen","type_your_message":"Nachricht eingeben","please_enter_message":"Bitte Nachricht eingeben","question_error_message":"Haben Sie eine Fehlermeldung erhalten?","yes":"Ja","no":"Nein","errorMessage":"Welche Fehlermeldungen waren das?","country":"Geben Sie das Land ein, in dem Sie sich gerade befinden","internetProvider":"Wer ist Ihr Internetanbieter?","please_issue_type_select":"Bitte wählen Sie den Problemtyp","status_not_connected_desc":"Verbinden Sie sich mit dem VPN für Online-Sicherheit","status_connecting_desc":"Den optimalen Server für Sie finden","paused":"Pausiert","status_disconnecting_desc":"Disconnect wird verarbeitet...","ms":"ms","bypassed_by_the_vpn_tunnel":"Vom VPN-Tunnel umgangen","proxy_connection_failed":"Proxy-Verbindung fehlgeschlagen","need_subscription":"Abonnement erforderlich","need_subscription_desc_1":"Es sieht so aus, als wäre Ihr Abonnement nicht aktiv.","need_subscription_desc_2":"Aktivieren Sie es, um diese Funktion freizuschalten!","subscribe_now":"Jetzt abonnieren","System":"System","Light":"Hell","Dark":"Dunkel","English":"Englisch","Russian":"Russisch","Deutsch":"Deutsch","disable_vpn_domain_and_subdomains":"VPN für diese Domäne und ihre Subdomänen deaktivieren","disable_vpn_domain":"VPN für diese Domäne deaktivieren","remove_from_list_vpn_domain":"Entfernen Sie diese Domäne aus der Split-Tunneling-Liste","not_active_subscription":"Nicht aktives Abonnement","connection_lost":"Verbindung verloren...","cancel":"Stornieren","cant_add_a_file":"Sie können keine Datei hinzufügen? Versuchen Sie, die Erweiterung in einem","new_tab":"Neuer Tab","back_to_settings":"Zurück zu den Einstellungen","report_problem_feedback_title":"Vielen Dank für Ihr Feedback!","report_problem_feedback_text":"Wir schätzen Ihre Zeit und Mühe, die Sie uns bei der Verbesserung Ihrer Arbeit widmen.","contact_us_title":"Danke, dass Sie uns kontaktiert haben!","contact_us_text":"Wir schätzen Ihre Zeit und Mühe, uns zu verbessern.","unable_to_access_proxy_settings":"Zugriff auf Proxy-Einstellungen nicht möglich","another_extension_controlling_line1":"Möglicherweise werden diese Einstellungen von einer anderen Erweiterung gesteuert. ","another_extension_controlling_line2":"Deaktivieren Sie diese Erweiterung, damit ApexGuard ordnungsgemäß funktioniert","setting_choosing_api_gateway":"Proxy-Server ändern","setting_choosing_api_gateway_description":"Wählen Sie einen Proxyserverstandort aus, um die Verbindung zu optimieren.","search_proxy_server":"Proxy-Server suchen","cities":"Städte","timeout_request":"Zeitüberschreitung der Anfrage. Bitte versuchen Sie es erneut.","session_expired_title":"Sitzung abgelaufen","session_expired_message":"Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an, um den Dienst fortzusetzen.","empty_importing_settings":"Fehler beim Importieren von Einstellungen: leere Datei","invalid_fields":"Ungültige Felder","import_failed":"Import fehlgeschlagen","limited_access_error":"Eingeschränkter Zugriff erkannt","limited_access_line1":"ApexGuard benötigt vollen Zugriff auf alle Websites, um einwandfrei zu funktionieren.","limited_access_line2":"Ihre aktuelle Einstellung ist eingeschränkt (z. B. \'Bei Klick\' oder \'Auf bestimmten Websites\').","limited_access_action":"Bitte ändern Sie den Zugriff auf \'Auf allen Websites\' in den Erweiterungseinstellungen.","subscription_expired":"Abonnement abgelaufen","expires_in_days":"Abonnement läuft {day} Tage ab","expires_tomorrow":"Abonnement läuft morgen ab","expires_today":"Abonnement läuft heute ab","expires_in_day":"Läuft am {day} Tag ab","activate_your_vpn":"Lassen Sie uns Ihr VPN aktivieren","choose_plan":"Wählen Sie einen Plan, um fortzufahren","get_subscription":"Abonnement erhalten","no_valid_connections":"Keine gültigen Verbindungen verfügbar","renew_now":"Jetzt verlängern"}');

/***/ }),

/***/ "./src/locale/en/translation.json":
/*!****************************************!*\
  !*** ./src/locale/en/translation.json ***!
  \****************************************/
/***/ ((module) => {

"use strict";
module.exports = /*#__PURE__*/JSON.parse('{"setting":"Settings","setting_general":"General","setting_general_description":"Choose extension preferences or log out.","setting_connection":"Connection","setting_connection_description":"Manage your VPN connection.","setting_security":"Security and privacy","setting_security_description":"Set up secure browsing features.","setting_refer-a-friend":"Refer a friend","setting_refer-a-friend_description":"Get 3 months instantly by referring a friend.","setting_general_save_browser":"Store settings locally in browser","setting_general_save_browser_description":"All preferences will remain on this device.","setting_general_backup":"Backup your settings","setting_general_backup_description":"Export your settings to a JSON file for backup.","setting_general_backup_button":"Export settings","setting_referral_hub":"Referral Hub","setting_referral_hub_section_1_title":"Get 3 months free when your friend joins!","setting_referral_hub_section_1_button":"Copy","copied":"Copied","setting_referral_hub_section_1_text":"Get 3 free months when you refer a friend. They’ll get up to 3 months too, based on their plan. Your bonus time is added instantly","setting_referral_hub_section_2_title":"Invite a friend","setting_referral_hub_section_2_text":"Know someone not using Apexguard yet? Share your personal referral link and invite them to join.","setting_referral_hub_section_3_title":"Wait for them to subscribe","setting_referral_hub_section_3_text":"Make sure your friend completes their Apexguard subscription using your referral link.","setting_referral_hub_section_4_title":"Enjoy your rewards","setting_referral_hub_section_4_text":"Earn 3 bonus months. Your friend gets 3 months on long-term plans, or 1 month with a monthly subscription.","setting_network_and_privacy":"Network & Privacy","setting_network_and_privacy_section_1_title":"Auto-connect","setting_network_and_privacy_section_1_text":"Automatically connect to VPN on browser launch","setting_network_and_privacy_section_2_title":"Kill Switch","setting_network_and_privacy_section_2_text":"Prevent your browser from accessing the internet if the VPN disconnects.","setting_network_and_privacy_section_3_title":"Split Tunneling","setting_network_and_privacy_section_3_text":"Exclude specific domains or IP addresses from the VPN connection.","setting_network_and_privacy_dropdown_title":"Fastest server","setting_network_and_privacy_fastest_server":"Fastest server","setting_general_restore":"Restore your settings","setting_general_restore_description":"Import your settings from a JSON file to restore them.","setting_general_restore_button":"Import settings","setting_general_share_data":"Share user interaction data","setting_general_share_data_description":"Help us improve our product and elevate its quality by sending anonymous interaction data.","setting_general_language":"Language","setting_general_appearance":"Appearance","setting_general_user_info":"User info","setting_general_subscription_active":"Subscription active until","setting_general_logout":"Logout","setting_security_stop_webrtc":"Stop WebRTC leaks","setting_security_stop_webrtc_description":"Protect your IP address from getting exposed through the WebRTC protocol.","setting_security_threat_protection":"Threat Protection","setting_security_threat_protection_description":"Block ads and malicious websites when connected to VPN.","setting_security_warnings":"Warnings","setting_security_warnings_description":"Know if a website you\'re visiting is not secure. Use VPN on these websites to encrypt your connection.","setting_security_location_spoofing":"Location Spoofing","setting_security_location_spoofing_description":"Set your browser to use the location and time zone of the VPN server you\'re connected to.","setting_connection_auto_connect_description":"Connect to VPN every time you launch the browser.","setting_connection_split_tunneling":"Split tunneling","setting_connection_split_tunneling_description":"Add domains or IP addresses to exclude them from the VPN tunnel.","setting_connection_kill_switch":"Kill switch","setting_connection_kill_switch_description":"Block the browser from accessing the internet when not connected to a VPN.","setting_add_button":"Add","setting_connection_input_placeholder":"Enter domain or IP (e.g., example.com or 192.168.1.1)","setting_connection_no_entries":"No domains or IPs excluded yet.","setting_refer_description":"Instantly earn 3 free months of ApexVPN for every friend you refer! Your friend instantly gets up to 3 free months depending on the plan they choose.","setting_refer_copy_button":"Copy link","settings_refer_see_invited_friends":"See Invited Friends","settings_refer_learn_more":"Learn more about referrer program","login_title":"Browse Securely Anytime, Anywhere with Apex VPN","loading":"Loading...","sign_up":"Sign up","log_in":"Log In","log_out":"Log out","app_title":"ApexGuard","status_connected":"CONNECTED","status_not_connected":"You are unprotected","ip_address":"IP address","unknown_location":"Unknown location","button_pause":"Pause","button_connect":"Smart Connection","button_disconnect":"Disconnect","error_prefix":"Error","countries":"Countries","pause_5_min":"5 min","pause_10_sec":"10 sec","pause_30_min":"30 min","pause_1_hour":"1 hour","resume_in":"Resumes in","resume_now":"Resume Now","button_auto_disconnect":"Disable Auto-connect","pre_connected":"Connecting...","pre_disconnected":"Disconnecting...","pre_cancel":"Cancelling...","invalid_connect":"Unable to establish the VPN connection, please try again later","something_wrong":"Something wrong","search_for_countries":"Search","invalid_jwt":"Invalid JWT: Token must be a string with three parts separated by dots","miss_jwt":"Invalid JWT: Missing one or more parts","browser_api_underestimation":"Browser API underestimation","popup_api_underestimation":"Popup API underestimation","connect_failed":"Connect failed","failed_to_logout":"Failed to logout","successfully_logged":"You have successfully logged in!","successful_login":"ApexGuard: Successful login","validation_failed":"Validation failed unexpectedly","validation_already":"Validation already in progress","apexguard_connected":"ApexGuard: connected","apexguard_successfully_connected":"You have successfully connected VPN!","insecure_website_detected":"Insecure Website Detected","http_warning_message":"This site uses an unencrypted connection (HTTP). Connect to VPN to secure your data.","connect_to_vpn":"Connect to VPN","error_not_logged_in":"Error: Not logged in","error_token_validation_failed":"Token validation failed unexpectedly","tab_close":"Failed to close login tab","setting_security_auto_reload_tabs":"Auto-reload all tabs","setting_security_auto_reload_tabs_description":"Always reload all opened tabs after connecting to a VPN or changing VPN location to activate location spoofing.","clear_error":"Clear","This domain, IP, or mask is already in the list":"This domain, IP, or mask is already in the list","Enter domain or IP (e.g., google.com)":"Enter domain or IP (e.g., google.com)","Failed to load settings or countries":"Failed to load settings or countries","Failed to update settings":"Failed to update settings","selective_proxy":"Selective Proxy","Use proxy only for specified domains":"Use proxy only for specified domains","service_interruption":"Service Interruption","vpn_conflict_error":"We can\'t access proxy settings. Another extension might be controlling them. Try disabling that extension for ApexGuard to run.","manage_extensions":"Manage Extensions","settings_imported":"Settings Imported","settings_imported_successfully":"Settings imported successfully","ping":"Ping","":"Report a Problem","get_help":"Get Help","report_a_problem":"Report a Problem","contact_us":"Contact Us","need_help":"Need Help?","go_to_help_center":"Go to Help Center","download_logs":"Download Logs","download_logs_text":"Download your diagnostic logs to speed up issue resolution.","download":"Download","describe_problem":"Describe your problem","cant_connect":"Can\'t connect","unstable_vpn":"Unstable vpn","slow_vpn":"Slow vpn","no_internet":"No internet","streaming":"Streaming","cant_login":"Can\'t login","other_tech":"Other tech","issue_type":"Issue Type","contact_information":"Contact information","your_plans_active_until":"Your plan\'s active until","view_full_info":"View Full Info","send_app_logs":"Send App Logs","submit":"Submit","well_reply_to":"We\'ll reply to","select_a_topic":"Select a topic","type_your_message":"Type your message","please_enter_message":"Please enter message","question_error_message":"Did you receive an error message?","yes":"Yes","no":"No","errorMessage":"What were the error messages?","country":"Type the country you’re currently in","internetProvider":"Who is your internet provider?","please_issue_type_select":"Please issue type select","status_not_connected_desc":"Connect to VPN for online security","status_connecting_desc":"Finding the optimal server for you","status_disconnecting_desc":"Disconnect is processing...","paused":"Paused","ms":"ms","bypassed_by_the_vpn_tunnel":"Bypassed by the VPN tunnel","proxy_connection_failed":"Proxy connection failed","need_subscription":"Subscription Required","need_subscription_desc_1":"It looks like your subscription isn’t active.","need_subscription_desc_2":"Turn it on to unlock this feature!","subscribe_now":"Subscribe now","System":"System","Light":"Light","Dark":"Dark","English":"English","Russian":"Russian","Deutsch":"Deutsch","disable_vpn_domain_and_subdomains":"Disable VPN for this domain and its subdomains","disable_vpn_domain":"Disable VPN for this domain","remove_from_list_vpn_domain":"Remove this domain from split tunneling list","not_active_subscription":"Not active subscription","connection_lost":"Connection lost...","cancel":"Cancel","cant_add_a_file":"Can’t add a file? Try opening the extension in a","new_tab":"new tab","back_to_settings":"Back to Settings","report_problem_feedback_title":"Thank you for your feedback!","unable_to_access_proxy_settings":"Unable to access proxy settings","another_extension_controlling_line1":"Another extension may be controlling these settings. ","another_extension_controlling_line2":"Disable that extension to allow ApexGuard to work properly","report_problem_feedback_text":"We appreciate your time and effort in helping us improve.","contact_us_title":"Thank you for contacting us!","contact_us_text":"We appreciate your time and effort in helping us improve.","setting_choosing_api_gateway":"Change proxy server","setting_choosing_api_gateway_description":"Select a proxy server location to optimize connection.","search_proxy_server":"Search proxy server","cities":"Cities","timeout_request":"Request timed out. Please try again.","session_expired_title":"Session Expired.","session_expired_message":"Your session has expired. Please log in again to continue using the service.","empty_importing_settings":"Error importing settings: empty file.","invalid_fields":"Invalid fields","import_failed":"Import failed","limited_access_error":"Limited access detected","limited_access_line1":"ApexGuard requires full access to all sites to function properly.","limited_access_line2":"Your current setting is restricted (e.g., \'On click\' or \'On specific sites\').","limited_access_action":"Please change the access to \'On all sites\' in the extension settings","subscription_expired":"Subscription Expired","expires_in_days":"Subscription expires {day} days","expires_tomorrow":"Subscription expires tomorrow","expires_today":"Subscription expires today","expires_in_day":"Expires in {day} day","activate_your_vpn":"Let\'s activate your VPN","choose_plan":"Choose a plan to continue","get_subscription":"Get subscription","no_valid_connections":"No valid connections available","renew_now":"Renew now"}');

/***/ }),

/***/ "./src/sw/constants/api_urls.js":
/*!**************************************!*\
  !*** ./src/sw/constants/api_urls.js ***!
  \**************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var config = __webpack_require__(/*! ../../../config */ "./config.js");
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var API_URLS = {
  API_GATEWAYS: "https://".concat(config.API_GATEWAY_DOMAIN_DEF, "/api-gateways"),
  PING_PONG: "https://".concat(config.API_GATEWAY_DOMAIN_DEF, "/ping/1"),
  DOMAIN_FOR_UPDATE: "https://www.amazon.de/404?no-cache=",
  QUICK_PING_IP: 'dns.google'
};
function getCurrentApiGateWayDomain() {
  return _getCurrentApiGateWayDomain.apply(this, arguments);
}
function _getCurrentApiGateWayDomain() {
  _getCurrentApiGateWayDomain = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var domain;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return StorageService.getApiGatewayMain();
        case 1:
          domain = _context.v;
          return _context.a(2, domain || config.API_GATEWAY_DOMAIN);
      }
    }, _callee);
  }));
  return _getCurrentApiGateWayDomain.apply(this, arguments);
}
function getRefreshApiUrl() {
  return _getRefreshApiUrl.apply(this, arguments);
}
function _getRefreshApiUrl() {
  _getRefreshApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var domain;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          _context2.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context2.v;
          return _context2.a(2, "https://".concat(domain, "/refresh"));
      }
    }, _callee2);
  }));
  return _getRefreshApiUrl.apply(this, arguments);
}
function getTokenApiUrl() {
  return _getTokenApiUrl.apply(this, arguments);
}
function _getTokenApiUrl() {
  _getTokenApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
    var domain;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.n) {
        case 0:
          _context3.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context3.v;
          return _context3.a(2, "https://".concat(domain, "/token"));
      }
    }, _callee3);
  }));
  return _getTokenApiUrl.apply(this, arguments);
}
function getCitiesApiUrl() {
  return _getCitiesApiUrl.apply(this, arguments);
}
function _getCitiesApiUrl() {
  _getCitiesApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
    var domain;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.n) {
        case 0:
          _context4.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context4.v;
          return _context4.a(2, "https://".concat(domain, "/cities"));
      }
    }, _callee4);
  }));
  return _getCitiesApiUrl.apply(this, arguments);
}
function getAuthLinksApiUrl() {
  return _getAuthLinksApiUrl.apply(this, arguments);
}
function _getAuthLinksApiUrl() {
  _getAuthLinksApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
    var domain;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.n) {
        case 0:
          _context5.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context5.v;
          return _context5.a(2, "https://".concat(domain, "/auth-links"));
      }
    }, _callee5);
  }));
  return _getAuthLinksApiUrl.apply(this, arguments);
}
function getConnectApiUrl() {
  return _getConnectApiUrl.apply(this, arguments);
}
function _getConnectApiUrl() {
  _getConnectApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
    var domain;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.n) {
        case 0:
          _context6.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context6.v;
          return _context6.a(2, "https://".concat(domain, "/connect"));
      }
    }, _callee6);
  }));
  return _getConnectApiUrl.apply(this, arguments);
}
function getMyIpApiUrl() {
  return _getMyIpApiUrl.apply(this, arguments);
}
function _getMyIpApiUrl() {
  _getMyIpApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
    var domain;
    return _regenerator().w(function (_context7) {
      while (1) switch (_context7.n) {
        case 0:
          _context7.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context7.v;
          return _context7.a(2, "https://".concat(domain, "/my-ip"));
      }
    }, _callee7);
  }));
  return _getMyIpApiUrl.apply(this, arguments);
}
function getStateApiUrl() {
  return _getStateApiUrl.apply(this, arguments);
}
function _getStateApiUrl() {
  _getStateApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
    var domain;
    return _regenerator().w(function (_context8) {
      while (1) switch (_context8.n) {
        case 0:
          _context8.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context8.v;
          return _context8.a(2, "https://".concat(domain, "/state"));
      }
    }, _callee8);
  }));
  return _getStateApiUrl.apply(this, arguments);
}
function getPrivateLinksApiUrl(_x) {
  return _getPrivateLinksApiUrl.apply(this, arguments);
}
function _getPrivateLinksApiUrl() {
  _getPrivateLinksApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(type) {
    var domain;
    return _regenerator().w(function (_context9) {
      while (1) switch (_context9.n) {
        case 0:
          _context9.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context9.v;
          return _context9.a(2, "https://".concat(domain, "/private-links/").concat(type));
      }
    }, _callee9);
  }));
  return _getPrivateLinksApiUrl.apply(this, arguments);
}
function getThreatProtectionApiUrl() {
  return _getThreatProtectionApiUrl.apply(this, arguments);
}
function _getThreatProtectionApiUrl() {
  _getThreatProtectionApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
    var domain;
    return _regenerator().w(function (_context0) {
      while (1) switch (_context0.n) {
        case 0:
          _context0.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context0.v;
          return _context0.a(2, "https://".concat(domain, "/threat-protection/blocked-domains/extension"));
      }
    }, _callee0);
  }));
  return _getThreatProtectionApiUrl.apply(this, arguments);
}
function getDomainForUpdateApiUrl() {
  return _getDomainForUpdateApiUrl.apply(this, arguments);
}
function _getDomainForUpdateApiUrl() {
  _getDomainForUpdateApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
    var domain;
    return _regenerator().w(function (_context1) {
      while (1) switch (_context1.n) {
        case 0:
          _context1.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context1.v;
          return _context1.a(2, "https://".concat(domain, "/404?no-cache="));
      }
    }, _callee1);
  }));
  return _getDomainForUpdateApiUrl.apply(this, arguments);
}
function getIssueReportsApiUrl() {
  return _getIssueReportsApiUrl.apply(this, arguments);
}
function _getIssueReportsApiUrl() {
  _getIssueReportsApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
    var domain;
    return _regenerator().w(function (_context10) {
      while (1) switch (_context10.n) {
        case 0:
          _context10.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context10.v;
          return _context10.a(2, "https://".concat(domain, "/issue-reports"));
      }
    }, _callee10);
  }));
  return _getIssueReportsApiUrl.apply(this, arguments);
}
function getFeatureSuggestionsApiUrl() {
  return _getFeatureSuggestionsApiUrl.apply(this, arguments);
}
function _getFeatureSuggestionsApiUrl() {
  _getFeatureSuggestionsApiUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
    var domain;
    return _regenerator().w(function (_context11) {
      while (1) switch (_context11.n) {
        case 0:
          _context11.n = 1;
          return getCurrentApiGateWayDomain();
        case 1:
          domain = _context11.v;
          return _context11.a(2, "https://".concat(domain, "/feature-suggestions"));
      }
    }, _callee11);
  }));
  return _getFeatureSuggestionsApiUrl.apply(this, arguments);
}
var PRIVATE_LINKS_TYPES = {
  TWO_FACTOR_AUTH_SETUP: 'two_factor_auth_setup',
  PRICING: 'pricing',
  DASHBOARD: 'dashboard'
};
var SERVER_DEF_PORT = 443;
var FLAG_DOMAIN = 'icons/flags/';
var deviceId = null;
// const deviceId = generateDeviceId();

var DEFAULT_HEADERS = {
  'Content-Type': 'application/json',
  'Device-ID': deviceId
};
module.exports = {
  API_URLS: API_URLS,
  DEFAULT_HEADERS: DEFAULT_HEADERS,
  FLAG_DOMAIN: FLAG_DOMAIN,
  PRIVATE_LINKS_TYPES: PRIVATE_LINKS_TYPES,
  SERVER_DEF_PORT: SERVER_DEF_PORT,
  getRefreshApiUrl: getRefreshApiUrl,
  getTokenApiUrl: getTokenApiUrl,
  getCitiesApiUrl: getCitiesApiUrl,
  getAuthLinksApiUrl: getAuthLinksApiUrl,
  getConnectApiUrl: getConnectApiUrl,
  getMyIpApiUrl: getMyIpApiUrl,
  getStateApiUrl: getStateApiUrl,
  getPrivateLinksApiUrl: getPrivateLinksApiUrl,
  getThreatProtectionApiUrl: getThreatProtectionApiUrl,
  getIssueReportsApiUrl: getIssueReportsApiUrl,
  getFeatureSuggestionsApiUrl: getFeatureSuggestionsApiUrl
};

/***/ }),

/***/ "./src/sw/constants/country_by_continent.js":
/*!**************************************************!*\
  !*** ./src/sw/constants/country_by_continent.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   COUNTRY_TO_CONTINENT: () => (/* binding */ COUNTRY_TO_CONTINENT)
/* harmony export */ });
var COUNTRY_TO_CONTINENT = {
  "Bosnia and Herzegovina": "EUROPE",
  "Bangladesh": "ASIA",
  "Georgia": "ASIA",
  "Switzerland": "EUROPE",
  "Finland": "EUROPE",
  "Taiwan": "ASIA",
  "Luxembourg": "EUROPE",
  "Lebanon": "ASIA",
  "Laos": "ASIA",
  "Belgium": "EUROPE",
  "Mexico": "AMERICAS",
  "Philippines": "ASIA",
  "Brunei": "ASIA",
  "Pakistan": "ASIA",
  "Poland": "EUROPE",
  "France": "EUROPE",
  "El Salvador": "AMERICAS",
  "Indonesia": "ASIA",
  "Seychelles": "AFRICA",
  "Uzbekistan": "ASIA",
  "Turkey": "ASIA",
  "Puerto Rico": "AMERICAS",
  "Myanmar": "ASIA",
  "Italy": "EUROPE",
  "Qatar": "ASIA",
  "Thailand": "ASIA",
  "Germany": "EUROPE",
  "Croatia": "EUROPE",
  "Argentina": "AMERICAS",
  "Costa Rica": "AMERICAS",
  "Peru": "AMERICAS",
  "Bahrain": "ASIA",
  "Greenland": "AMERICAS",
  "Canada": "AMERICAS",
  "Jersey": "EUROPE",
  "Latvia": "EUROPE",
  "Curacao": "AMERICAS",
  "Curaçao": "AMERICAS",
  "Slovenia": "EUROPE",
  "Nepal": "ASIA",
  "Dominican Republic": "AMERICAS",
  "Portugal": "EUROPE",
  "Malta": "EUROPE",
  "Albania": "EUROPE",
  "South Korea": "ASIA",
  "Norway": "EUROPE",
  "Slovakia": "EUROPE",
  "Isle of Man": "EUROPE",
  "Ghana": "AFRICA",
  "Estonia": "EUROPE",
  "Paraguay": "AMERICAS",
  "USA": "AMERICAS",
  "United States": "AMERICAS",
  "Denmark": "EUROPE",
  "Liechtenstein": "EUROPE",
  "Brazil": "AMERICAS",
  "Malaysia": "ASIA",
  "Panama": "AMERICAS",
  "Turkmenistan": "ASIA",
  "Monaco": "EUROPE",
  "Cyprus": "ASIA",
  "Tunisia": "AFRICA",
  "Ecuador": "AMERICAS",
  "Cambodia": "ASIA",
  "Ethiopia": "AFRICA",
  "Kenya": "AFRICA",
  "Bulgaria": "EUROPE",
  "Algeria": "AFRICA",
  "Kazakhstan": "ASIA",
  "Sri Lanka": "ASIA",
  "Morocco": "AFRICA",
  "Chile": "AMERICAS",
  "Guatemala": "AMERICAS",
  "Belize": "AMERICAS",
  "Vietnam": "ASIA",
  "Ireland": "EUROPE",
  "Ukraine": "EUROPE",
  "Japan": "ASIA",
  "Senegal": "AFRICA",
  "South Africa": "AFRICA",
  "Maldives": "ASIA",
  "Colombia": "AMERICAS",
  "Australia": "AUSTRALIA",
  "Tanzania": "AFRICA",
  "North Macedonia": "EUROPE",
  "Sweden": "EUROPE",
  "Netherlands": "EUROPE",
  "Bolivia": "AMERICAS",
  "Uruguay": "AMERICAS",
  "Czech Republic": "EUROPE",
  "Nigeria": "AFRICA",
  "Hungary": "EUROPE",
  "Saudi Arabia": "ASIA",
  "Honduras": "AMERICAS",
  "Kuwait": "ASIA",
  "United Arab Emirates": "ASIA",
  "Greece": "EUROPE",
  "Angola": "AFRICA",
  "Israel": "ASIA",
  "Lithuania": "EUROPE",
  "New Zealand": "AUSTRALIA",
  "Austria": "EUROPE",
  "Spain": "EUROPE",
  "Armenia": "ASIA",
  "Mongolia": "ASIA",
  "Egypt": "AFRICA",
  "Bahamas": "AMERICAS",
  "Serbia": "EUROPE",
  "Bhutan": "ASIA",
  "India": "ASIA",
  "Montenegro": "EUROPE",
  "Iceland": "EUROPE",
  "Singapore": "ASIA",
  "Azerbaijan": "ASIA",
  "Bermuda": "AMERICAS",
  "Romania": "EUROPE",
  "Oman": "ASIA",
  "Andorra": "EUROPE",
  "Venezuela": "AMERICAS",
  "Jamaica": "AMERICAS",
  "Moldova": "EUROPE"
};

/***/ }),

/***/ "./src/sw/constants/country_code_mapping.js":
/*!**************************************************!*\
  !*** ./src/sw/constants/country_code_mapping.js ***!
  \**************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   CITY_TIMEZONE_MAPPING: () => (/* binding */ CITY_TIMEZONE_MAPPING),
/* harmony export */   COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2: () => (/* binding */ COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2)
/* harmony export */ });
var COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2 = {
  "BIH": "BA",
  // Bosnia and Herzegovina
  "BGD": "BD",
  // Bangladesh
  "GEO": "GE",
  // Georgia
  "CHE": "CH",
  // Switzerland
  "FIN": "FI",
  // Finland
  "TWN": "TW",
  // Taiwan
  "LUX": "LU",
  // Luxembourg
  "LBN": "LB",
  // Lebanon
  "LAO": "LA",
  // Laos
  "BEL": "BE",
  // Belgium
  "MEX": "MX",
  // Mexico
  "PHL": "PH",
  // Philippines
  "BRN": "BN",
  // Brunei
  "PAK": "PK",
  // Pakistan
  "POL": "PL",
  // Poland
  "FRA": "FR",
  // France
  "SLV": "SV",
  // El Salvador
  "IDN": "ID",
  // Indonesia
  "SYC": "SC",
  // Seychelles
  "UZB": "UZ",
  // Uzbekistan
  "TUR": "TR",
  // Turkey
  "PRI": "PR",
  // Puerto Rico
  "MMR": "MM",
  // Myanmar
  "ITA": "IT",
  // Italy
  "QAT": "QA",
  // Qatar
  "THA": "TH",
  // Thailand
  "DEU": "DE",
  // Germany
  "HRV": "HR",
  // Croatia
  "ARG": "AR",
  // Argentina
  "CRI": "CR",
  // Costa Rica
  "PER": "PE",
  // Peru
  "BHR": "BH",
  // Bahrain
  "GRL": "GL",
  // Greenland
  "CAN": "CA",
  // Canada
  "JEY": "JE",
  // Jersey
  "LVA": "LV",
  // Latvia
  "CUW": "CW",
  // Curaçao
  "SVN": "SI",
  // Slovenia
  "NPL": "NP",
  // Nepal
  "DOM": "DO",
  // Dominican Republic
  "PRT": "PT",
  // Portugal
  "MLT": "MT",
  // Malta
  "ALB": "AL",
  // Albania
  "KOR": "KR",
  // South Korea
  "NOR": "NO",
  // Norway
  "SVK": "SK",
  // Slovakia
  "IMN": "IM",
  // Isle of Man
  "GHA": "GH",
  // Ghana
  "EST": "EE",
  // Estonia
  "PRY": "PY",
  // Paraguay
  "USA": "US",
  // USA
  "DNK": "DK",
  // Denmark
  "LIE": "LI",
  // Liechtenstein
  "BRA": "BR",
  // Brazil
  "MYS": "MY",
  // Malaysia
  "PAN": "PA",
  // Panama
  "TKM": "TM",
  // Turkmenistan
  "MCO": "MC",
  // Monaco
  "CYP": "CY",
  // Cyprus
  "TUN": "TN",
  // Tunisia
  "ECU": "EC",
  // Ecuador
  "KHM": "KH",
  // Cambodia
  "ETH": "ET",
  // Ethiopia
  "KEN": "KE",
  // Kenya
  "BGR": "BG",
  // Bulgaria
  "DZA": "DZ",
  // Algeria
  "KAZ": "KZ",
  // Kazakhstan
  "LKA": "LK",
  // Sri Lanka
  "MAR": "MA",
  // Morocco
  "CHL": "CL",
  // Chile
  "GTM": "GT",
  // Guatemala
  "BLZ": "BZ",
  // Belize
  "VNM": "VN",
  // Vietnam
  "IRL": "IE",
  // Ireland
  "UKR": "UA",
  // Ukraine
  "JPN": "JP",
  // Japan
  "SEN": "SN",
  // Senegal
  "ZAF": "ZA",
  // South Africa
  "MDV": "MV",
  // Maldives
  "COL": "CO",
  // Colombia
  "AUS": "AU",
  // Australia
  "TZA": "TZ",
  // Tanzania
  "MKD": "MK",
  // North Macedonia
  "SWE": "SE",
  // Sweden
  "NLD": "NL",
  // Netherlands
  "BOL": "BO",
  // Bolivia
  "URY": "UY",
  // Uruguay
  "CZE": "CZ",
  // Czech Republic
  "NGA": "NG",
  // Nigeria
  "HUN": "HU",
  // Hungary
  "SAU": "SA",
  // Saudi Arabia
  "HND": "HN",
  // Honduras
  "KWT": "KW",
  // Kuwait
  "ARE": "AE",
  // United Arab Emirates
  "GRC": "GR",
  // Greece
  "AGO": "AO",
  // Angola
  "ISR": "IL",
  // Israel
  "LTU": "LT",
  // Lithuania
  "NZL": "NZ",
  // New Zealand
  "AUT": "AT",
  // Austria
  "ESP": "ES",
  // Spain
  "ARM": "AM",
  // Armenia
  "MNG": "MN",
  // Mongolia
  "EGY": "EG",
  // Egypt
  "BHS": "BS",
  // Bahamas
  "SRB": "RS",
  // Serbia
  "BTN": "BT",
  // Bhutan
  "IND": "IN",
  // India
  "MNE": "ME",
  // Montenegro
  "ISL": "IS",
  // Iceland
  "SGP": "SG",
  // Singapore
  "AZE": "AZ",
  // Azerbaijan
  "BMU": "BM",
  // Bermuda
  "ROU": "RO",
  // Romania
  "OMN": "OM",
  // Oman
  "AND": "AD",
  // Andorra
  "VEN": "VE",
  // Venezuela
  "JAM": "JM",
  // Jamaica
  "MDA": "MD",
  // Moldova
  "LON": "GB",
  // London
  "GBR": "GB",
  // London
  "HKG": "HK" // Hong Kong
};
var CITY_TIMEZONE_MAPPING = {
  "SJO": {
    timeZone: "America/Costa_Rica",
    offset: -6
  },
  // San José, Costa Rica
  "BAK": {
    timeZone: "Asia/Baku",
    offset: 4
  },
  // Baku, Azerbaijan
  "CUR": {
    timeZone: "America/Curacao",
    offset: -4
  },
  // Willemstad, Curaçao
  "ADD": {
    timeZone: "Africa/Addis_Ababa",
    offset: 3
  },
  // Addis Ababa, Ethiopia
  "NYC": {
    timeZone: "America/New_York",
    offset: -5
  },
  // New York, USA
  "LJU": {
    timeZone: "Europe/Ljubljana",
    offset: 1
  },
  // Ljubljana, Slovenia
  "ROM": {
    timeZone: "Europe/Rome",
    offset: 1
  },
  // Rome, Italy
  "STO": {
    timeZone: "Europe/Stockholm",
    offset: 1
  },
  // Stockholm, Sweden
  "LAD": {
    timeZone: "Africa/Luanda",
    offset: 1
  },
  // Luanda, Angola
  "JER": {
    timeZone: "Europe/Jersey",
    offset: 0
  },
  // Saint Helier, Jersey
  "LUX": {
    timeZone: "Europe/Luxembourg",
    offset: 1
  },
  // Luxembourg, Luxembourg
  "ASU": {
    timeZone: "America/Asuncion",
    offset: -4
  },
  // Asunción, Paraguay
  "VTE": {
    timeZone: "Asia/Vientiane",
    offset: 7
  },
  // Vientiane, Laos
  "BOM": {
    timeZone: "Asia/Kolkata",
    offset: 5.5
  },
  // Mumbai, India
  "VLT": {
    timeZone: "Europe/Malta",
    offset: 1
  },
  // Valletta, Malta
  "HAN": {
    timeZone: "Asia/Ho_Chi_Minh",
    offset: 7
  },
  // Hanoi, Vietnam
  "BEL": {
    timeZone: "America/Belize",
    offset: -6
  },
  // Belmopan, Belize
  "BEG": {
    timeZone: "Europe/Belgrade",
    offset: 1
  },
  // Belgrade, Serbia
  "ABV": {
    timeZone: "Africa/Lagos",
    offset: 1
  },
  // Abuja, Nigeria
  "CMN": {
    timeZone: "Africa/Casablanca",
    offset: 1
  },
  // Casablanca, Morocco
  "IST": {
    timeZone: "Europe/Istanbul",
    offset: 3
  },
  // Istanbul, Turkey
  "ALV": {
    timeZone: "Europe/Andorra",
    offset: 1
  },
  // Andorra la Vella, Andorra
  "BOG": {
    timeZone: "America/Bogota",
    offset: -5
  },
  // Bogota, Colombia
  "PNH": {
    timeZone: "Asia/Phnom_Penh",
    offset: 7
  },
  // Phnom Penh, Cambodia
  "KBP": {
    timeZone: "Europe/Kyiv",
    offset: 2
  },
  // Kyiv, Ukraine
  "BEY": {
    timeZone: "Asia/Beirut",
    offset: 2
  },
  // Beirut, Lebanon
  "MAD": {
    timeZone: "Europe/Madrid",
    offset: 1
  },
  // Madrid, Spain
  "KIV": {
    timeZone: "Europe/Chisinau",
    offset: 2
  },
  // Chisinau, Moldova
  "CMB": {
    timeZone: "Asia/Colombo",
    offset: 5.5
  },
  // Colombo, Sri Lanka
  "BUH": {
    timeZone: "Europe/Bucharest",
    offset: 2
  },
  // Bucharest, Romania
  "ULN": {
    timeZone: "Asia/Ulaanbaatar",
    offset: 8
  },
  // Ulaanbaatar, Mongolia
  "ASB": {
    timeZone: "Asia/Ashgabat",
    offset: 5
  },
  // Ashgabat, Turkmenistan
  "VAD": {
    timeZone: "Europe/Vaduz",
    offset: 1
  },
  // Vaduz, Liechtenstein
  "SJJ": {
    timeZone: "Europe/Sarajevo",
    offset: 1
  },
  // Sarajevo, Bosnia and Herzegovina
  "DAC": {
    timeZone: "Asia/Dhaka",
    offset: 6
  },
  // Dhaka, Bangladesh
  "KWI": {
    timeZone: "Asia/Kuwait",
    offset: 3
  },
  // Kuwait City, Kuwait
  "BTS": {
    timeZone: "Europe/Bratislava",
    offset: 1
  },
  // Bratislava, Slovakia
  "HEL": {
    timeZone: "Europe/Helsinki",
    offset: 2
  },
  // Helsinki, Finland
  "GRU": {
    timeZone: "America/Sao_Paulo",
    offset: -3
  },
  // San Paolo, Brazil
  "RUH": {
    timeZone: "Asia/Riyadh",
    offset: 3
  },
  // Riyadh, Saudi Arabia
  "DOH": {
    timeZone: "Asia/Qatar",
    offset: 3
  },
  // Doha, Qatar
  "JNB": {
    timeZone: "Africa/Johannesburg",
    offset: 2
  },
  // Johannesburg, South Africa
  "MCO": {
    timeZone: "Europe/Monaco",
    offset: 1
  },
  // Monaco, Monaco
  "TPE": {
    timeZone: "Asia/Taipei",
    offset: 8
  },
  // Taipei, Taiwan
  "TIA": {
    timeZone: "Europe/Tirane",
    offset: 1
  },
  // Tirana, Albania
  "PTY": {
    timeZone: "America/Panama",
    offset: -5
  },
  // Panama City, Panama
  "MCT": {
    timeZone: "Asia/Muscat",
    offset: 4
  },
  // Muscat, Oman
  "MVD": {
    timeZone: "America/Montevideo",
    offset: -3
  },
  // Montevideo, Uruguay
  "VNO": {
    timeZone: "Europe/Vilnius",
    offset: 2
  },
  // Vilnius, Lithuania
  "TYO": {
    timeZone: "Asia/Tokyo",
    offset: 9
  },
  // Tokyo, Japan
  "ZUR": {
    timeZone: "Europe/Zurich",
    offset: 1
  },
  // Zurich, Switzerland
  "DGS": {
    timeZone: "Europe/Isle_of_Man",
    offset: 0
  },
  // Douglas, Isle of Man
  "MNL": {
    timeZone: "Asia/Manila",
    offset: 8
  },
  // Manila, Philippines
  "DUS": {
    timeZone: "Europe/Berlin",
    offset: 1
  },
  // Dusseldorf, Germany
  "SEZ": {
    timeZone: "Indian/Mahe",
    offset: 4
  },
  // Victoria, Seychelles
  "NBO": {
    timeZone: "Africa/Nairobi",
    offset: 3
  },
  // Nairobi, Kenya
  "JKT": {
    timeZone: "Asia/Jakarta",
    offset: 7
  },
  // Jakarta, Indonesia
  "PAR": {
    timeZone: "Europe/Paris",
    offset: 1
  },
  // Paris, France
  "ACC": {
    timeZone: "Africa/Accra",
    offset: 0
  },
  // Accra, Ghana
  "LPB": {
    timeZone: "America/La_Paz",
    offset: -4
  },
  // La Paz, Bolivia
  "TLL": {
    timeZone: "Europe/Tallinn",
    offset: 2
  },
  // Tallinn, Estonia
  "NUU": {
    timeZone: "America/Nuuk",
    offset: -2
  },
  // Nuuk, Greenland
  "SDQ": {
    timeZone: "America/Santo_Domingo",
    offset: -4
  },
  // Santo Domingo, Dominican Republic
  "DKR": {
    timeZone: "Africa/Dakar",
    offset: 0
  },
  // Dakar, Senegal
  "HAM": {
    timeZone: "Atlantic/Bermuda",
    offset: -4
  },
  // Hamilton, Bermuda
  "KIN": {
    timeZone: "America/Jamaica",
    offset: -5
  },
  // Kingston, Jamaica
  "BUE": {
    timeZone: "America/Argentina/Buenos_Aires",
    offset: -3
  },
  // Buenos Aires, Argentina
  "BKK": {
    timeZone: "Asia/Bangkok",
    offset: 7
  },
  // Bangkok, Thailand
  "TUN": {
    timeZone: "Africa/Tunis",
    offset: 1
  },
  // Tunis, Tunisia
  "VIE": {
    timeZone: "Europe/Vienna",
    offset: 1
  },
  // Vienna, Austria
  "CAI": {
    timeZone: "Africa/Cairo",
    offset: 2
  },
  // Cairo, Egypt
  "LIM": {
    timeZone: "America/Lima",
    offset: -5
  },
  // Lima, Peru
  "BAH": {
    timeZone: "Asia/Bahrain",
    offset: 3
  },
  // Manama, Bahrain
  "LIS": {
    timeZone: "Europe/Lisbon",
    offset: 0
  },
  // Lisbon, Portugal
  "SAL": {
    timeZone: "America/El_Salvador",
    offset: -6
  },
  // San Salvador, El Salvador
  "CCS": {
    timeZone: "America/Caracas",
    offset: -4
  },
  // Caracas, Venezuela
  "BWN": {
    timeZone: "Asia/Brunei",
    offset: 8
  },
  // Bandar Seri Begawan, Brunei
  "ATH": {
    timeZone: "Europe/Athens",
    offset: 2
  },
  // Athens, Greece
  "TLV": {
    timeZone: "Asia/Jerusalem",
    offset: 2
  },
  // Tel Aviv, Israel
  "SCL": {
    timeZone: "America/Santiago",
    offset: -4
  },
  // Santiago, Chile
  "EVN": {
    timeZone: "Asia/Yerevan",
    offset: 4
  },
  // Yerevan, Armenia
  "BRU": {
    timeZone: "Europe/Brussels",
    offset: 1
  },
  // Brussels, Belgium
  "NYT": {
    timeZone: "Asia/Yangon",
    offset: 6.5
  },
  // Naypyidaw, Myanmar
  "REK": {
    timeZone: "Atlantic/Reykjavik",
    offset: 0
  },
  // Reykjavik, Iceland
  "AMS": {
    timeZone: "Europe/Amsterdam",
    offset: 1
  },
  // Amsterdam, Netherlands
  "MEX": {
    timeZone: "America/Mexico_City",
    offset: -6
  },
  // Mexico City, Mexico
  "MLE": {
    timeZone: "Indian/Maldives",
    offset: 5
  },
  // Male, Maldives
  "KUL": {
    timeZone: "Asia/Kuala_Lumpur",
    offset: 8
  },
  // Kuala Lumpur, Malaysia
  "SEL": {
    timeZone: "Asia/Seoul",
    offset: 9
  },
  // Seoul, South Korea
  "THI": {
    timeZone: "Asia/Thimphu",
    offset: 6
  },
  // Thimphu, Bhutan
  "LMS": {
    timeZone: "Asia/Nicosia",
    offset: 2
  },
  // Limassol, Cyprus
  "WLG": {
    timeZone: "Pacific/Auckland",
    offset: 12
  },
  // Wellington, New Zealand
  "ALG": {
    timeZone: "Africa/Algiers",
    offset: 1
  },
  // Algiers, Algeria
  "TBS": {
    timeZone: "Asia/Tbilisi",
    offset: 4
  },
  // Tbilisi, Georgia
  "DOD": {
    timeZone: "Africa/Dar_es_Salaam",
    offset: 3
  },
  // Dodoma, Tanzania
  "SJU": {
    timeZone: "America/Puerto_Rico",
    offset: -4
  },
  // San Juan, Puerto Rico
  "ISB": {
    timeZone: "Asia/Karachi",
    offset: 5
  },
  // Islamabad, Pakistan
  "TEG": {
    timeZone: "America/Tegucigalpa",
    offset: -6
  },
  // Tegucigalpa, Honduras
  "NAS": {
    timeZone: "America/Nassau",
    offset: -5
  },
  // Nassau, Bahamas
  "SIN": {
    timeZone: "Asia/Singapore",
    offset: 8
  },
  // Singapore, Singapore
  "OSL": {
    timeZone: "Europe/Oslo",
    offset: 1
  },
  // Oslo, Norway
  "GUA": {
    timeZone: "America/Guatemala",
    offset: -6
  },
  // Guatemala City, Guatemala
  "CHI": {
    timeZone: "America/Chicago",
    offset: -6
  },
  // Chicago, USA
  "UIO": {
    timeZone: "America/Guayaquil",
    offset: -5
  },
  // Quito, Ecuador
  "CPH": {
    timeZone: "Europe/Copenhagen",
    offset: 1
  },
  // Copenhagen, Denmark
  "TAS": {
    timeZone: "Asia/Tashkent",
    offset: 5
  },
  // Tashkent, Uzbekistan
  "AST": {
    timeZone: "Asia/Almaty",
    offset: 5
  },
  // Astana, Kazakhstan
  "WAW": {
    timeZone: "Europe/Warsaw",
    offset: 1
  },
  // Warsaw, Poland
  "SYD": {
    timeZone: "Australia/Sydney",
    offset: 10
  },
  // Sydney, Australia
  "BUD": {
    timeZone: "Europe/Budapest",
    offset: 1
  },
  // Budapest, Hungary
  "SOF": {
    timeZone: "Europe/Sofia",
    offset: 2
  },
  // Sofia, Bulgaria
  "TRT": {
    timeZone: "America/Toronto",
    offset: -5
  },
  // Toronto, Canada
  "POD": {
    timeZone: "Europe/Podgorica",
    offset: 1
  },
  // Podgorica, Montenegro
  "SKP": {
    timeZone: "Europe/Skopje",
    offset: 1
  },
  // Skopje, North Macedonia
  "DUB": {
    timeZone: "Europe/Dublin",
    offset: 0
  },
  // Dublin, Ireland
  "KTM": {
    timeZone: "Asia/Kathmandu",
    offset: 5.75
  },
  // Kathmandu, Nepal
  "RIX": {
    timeZone: "Europe/Riga",
    offset: 2
  },
  // Riga, Latvia
  "PRG": {
    timeZone: "Europe/Prague",
    offset: 1
  },
  // Prague, Czech Republic
  "ZAG": {
    timeZone: "Europe/Zagreb",
    offset: 1
  },
  // Zagreb, Croatia
  "AUH": {
    timeZone: "Asia/Dubai",
    offset: 4
  },
  // Abu Dhabi, United Arab Emirates
  "LON": {
    timeZone: "Europe/London",
    offset: 0
  },
  "GBR": {
    timeZone: "Europe/London",
    offset: 0
  },
  "HKG": {
    timeZone: "Asia/Hong_Kong",
    offset: 8
  }
};

/***/ }),

/***/ "./src/sw/constants/default_urls_constants.js":
/*!****************************************************!*\
  !*** ./src/sw/constants/default_urls_constants.js ***!
  \****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var config = __webpack_require__(/*! ../../../config */ "./config.js");
var _require = __webpack_require__(/*! @sw/constants/server_proxy_constants */ "./src/sw/constants/server_proxy_constants.js"),
  SERVER_PROXY = _require.SERVER_PROXY;
var DEF_PAST_URL_LIST = ['<local>', 'localhost', '127.0.0.1', config.API_GATEWAY_DOMAIN_DEF];
var CURRENT_PASS_URL_DOMAINS = [config.API_GATEWAY_DOMAIN_DEF, 'my.apexguard.com', config.PLATFORM_BACKEND_DOMAIN, config.API_GATEWAY_DOMAIN, SERVER_PROXY, 'user-socket.apexguard.com'];
var getDefaultPasses = function getDefaultPasses() {
  return [].concat(DEF_PAST_URL_LIST, CURRENT_PASS_URL_DOMAINS);
};
module.exports = {
  DEF_PAST_URL_LIST: DEF_PAST_URL_LIST,
  CURRENT_PASS_URL_DOMAINS: CURRENT_PASS_URL_DOMAINS,
  getDefaultPasses: getDefaultPasses
};

/***/ }),

/***/ "./src/sw/constants/listen_constants.js":
/*!**********************************************!*\
  !*** ./src/sw/constants/listen_constants.js ***!
  \**********************************************/
/***/ ((module) => {

module.exports = {
  OPEN_LOGIN: 'openLogin',
  OPEN_REGISTRATION: 'openRegistration',
  LOGIN_SUCCESS: 'loginSuccess',
  DISCONNECT: 'disconnect',
  LOGOUT: 'logout',
  ENABLE_KILL_SWITCH: 'enableKillSwitch',
  ENABLE_FIRST_LOAD_KILL_SWITCH: 'enableFirstLoadKillSwitch',
  DISABLE_KILL_SWITCH: 'disableKillSwitch',
  SET_WEBRTC_LEAK_PROTECTION: 'setWebRTCLeakProtection',
  SET_THREAT_PROTECTION: 'setThreatProtection',
  SET_WARNINGS: 'setWarnings',
  ENABLE_SPLIT_TUNNELING: 'enableSplitTunneling',
  DISABLE_SPLIT_TUNNELING: 'disableSplitTunneling',
  UPDATE_SPLIT_TUNNELING_LIST: 'updateSplitTunnelingList',
  ENABLE_SELECTIVE_PROXY: 'enableSelectiveProxy',
  DISABLE_SELECTIVE_PROXY: 'disableSelectiveProxy',
  UPDATE_SELECTIVE_PROXY_LIST: 'updateSelectiveProxyList',
  SET_PAUSE: 'setPause',
  DELETE_PAUSE: 'deletePause',
  LANGUAGE_CHANGED: 'languageChanged',
  CONNECT: 'connect',
  CONNECT_BY_SELECTED_SERVER: 'connectBySelectedServer',
  REFRESH_TOKEN: 'refreshToken',
  USER_DATA_UPDATED: 'userDataUpdated',
  OPEN_IMPORT_SETTINGS: 'openImportSettings',
  IMPORT_SETTINGS: 'importSettings',
  GET_SPOOFED_DATA: 'getSpoofedData',
  OPEN_DASHBOARD: 'openDashboard',
  OPEN_PRICING: 'openPricing',
  PROXY_STATUS_UPDATED: 'proxyStatusUpdated',
  PROCESS_DISCONNECT_UPDATED: 'processDisconnectUpdated',
  UPDATE_SUBSCRIPTION_ONCE: 'updateSubscriptionOnce',
  UPDATE_LAST_COUNTRIES: 'updateLastCountries'
};

/***/ }),

/***/ "./src/sw/constants/mapping_by_cotinent.js":
/*!*************************************************!*\
  !*** ./src/sw/constants/mapping_by_cotinent.js ***!
  \*************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   DOMAIN_MAPPING: () => (/* binding */ DOMAIN_MAPPING),
/* harmony export */   getAlphaCountryCode: () => (/* binding */ getAlphaCountryCode),
/* harmony export */   getContinentByCountry: () => (/* binding */ getContinentByCountry),
/* harmony export */   getFullUrl: () => (/* binding */ getFullUrl)
/* harmony export */ });
/* harmony import */ var _sw_constants_country_code_mapping__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @sw/constants/country_code_mapping */ "./src/sw/constants/country_code_mapping.js");
/* harmony import */ var _sw_constants_country_by_continent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @sw/constants/country_by_continent */ "./src/sw/constants/country_by_continent.js");
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js");
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_2__);
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }



var DOMAIN_MAPPING = {
  google: {
    name: "google",
    prefix: "www.google",
    tlds: [{
      tld: ".be",
      continent: "EUROPE"
    }, {
      tld: ".de",
      continent: "EUROPE"
    }, {
      tld: ".es",
      continent: "EUROPE"
    }, {
      tld: ".at",
      continent: "EUROPE"
    }, {
      tld: ".fr",
      continent: "EUROPE"
    }, {
      tld: ".it",
      continent: "EUROPE"
    }, {
      tld: ".ie",
      continent: "EUROPE"
    }, {
      tld: ".nl",
      continent: "EUROPE"
    }, {
      tld: ".pt",
      continent: "EUROPE"
    }, {
      tld: ".co.uk",
      continent: "EUROPE"
    }, {
      tld: ".sk",
      continent: "EUROPE"
    }, {
      tld: ".pl",
      continent: "EUROPE"
    }, {
      tld: ".lt",
      continent: "EUROPE"
    }, {
      tld: ".cz",
      continent: "EUROPE"
    }, {
      tld: ".ca",
      continent: "AMERICAS"
    }, {
      tld: ".us",
      continent: "AMERICAS"
    }, {
      tld: ".com.ar",
      continent: "AMERICAS"
    }, {
      tld: ".com.mx",
      continent: "AMERICAS"
    }, {
      tld: ".com.br",
      continent: "AMERICAS"
    }, {
      tld: ".cl",
      continent: "AMERICAS"
    }, {
      tld: ".co.nz",
      continent: "AUSTRALIA"
    }, {
      tld: ".com.au",
      continent: "AUSTRALIA"
    }, {
      tld: ".com.fj",
      continent: "AUSTRALIA"
    }, {
      tld: ".com.nu",
      continent: "AUSTRALIA"
    }, {
      tld: ".pn",
      continent: "AUSTRALIA"
    }, {
      tld: ".co.jp",
      continent: "ASIA"
    }, {
      tld: ".co.th",
      continent: "ASIA"
    }, {
      tld: ".co.kr",
      continent: "ASIA"
    }, {
      tld: ".in",
      continent: "ASIA"
    }, {
      tld: ".jp",
      continent: "ASIA"
    }, {
      tld: ".io",
      continent: "ASIA"
    }, {
      tld: ".sg",
      continent: "ASIA"
    }, {
      tld: ".com.sg",
      continent: "ASIA"
    }, {
      tld: ".com.vn",
      continent: "ASIA"
    }, {
      tld: ".co.za",
      continent: "AFRICA"
    }, {
      tld: ".com.sa",
      continent: "AFRICA"
    }, {
      tld: ".sh",
      continent: "AFRICA"
    }, {
      tld: ".com.eg",
      continent: "AFRICA"
    }, {
      tld: ".ae",
      continent: "AFRICA"
    }, {
      tld: ".com.et",
      continent: "AFRICA"
    }, {
      tld: ".com.gh",
      continent: "AFRICA"
    }, {
      tld: ".sc",
      continent: "AFRICA"
    }, {
      tld: ".co.tz",
      continent: "AFRICA"
    }]
  },
  amazon: {
    name: "amazon",
    prefix: "www.amazon",
    tlds: [{
      tld: ".it",
      continent: "EUROPE"
    }, {
      tld: ".de",
      continent: "EUROPE"
    }, {
      tld: ".fr",
      continent: "EUROPE"
    }, {
      tld: ".es",
      continent: "EUROPE"
    }, {
      tld: ".at",
      continent: "EUROPE"
    }, {
      tld: ".co.uk",
      continent: "EUROPE"
    }, {
      tld: ".nl",
      continent: "EUROPE"
    }, {
      tld: ".se",
      continent: "EUROPE"
    }, {
      tld: ".com.be",
      continent: "EUROPE"
    }, {
      tld: ".us",
      continent: "AMERICAS"
    }, {
      tld: ".ca",
      continent: "AMERICAS"
    }, {
      tld: ".com.mx",
      continent: "AMERICAS"
    }, {
      tld: ".com.br",
      continent: "AMERICAS"
    }, {
      tld: ".com.ar",
      continent: "AMERICAS"
    }, {
      tld: ".cl",
      continent: "AMERICAS"
    }, {
      tld: ".au",
      continent: "AUSTRALIA"
    }, {
      tld: ".net.au",
      continent: "AUSTRALIA"
    }, {
      tld: ".net.nz",
      continent: "AUSTRALIA"
    }, {
      tld: ".co.nz",
      continent: "AUSTRALIA"
    }, {
      tld: ".com.au",
      continent: "AUSTRALIA"
    }, {
      tld: ".in",
      continent: "ASIA"
    }, {
      tld: ".co.jp",
      continent: "ASIA"
    }, {
      tld: ".jp",
      continent: "ASIA"
    }, {
      tld: ".io",
      continent: "ASIA"
    }, {
      tld: ".sg",
      continent: "ASIA"
    }, {
      tld: ".com.sg",
      continent: "ASIA"
    }, {
      tld: ".ac",
      continent: "AFRICA"
    }, {
      tld: ".co.za",
      continent: "AFRICA"
    }, {
      tld: ".sh",
      continent: "AFRICA"
    }, {
      tld: ".eg",
      continent: "AFRICA"
    }, {
      tld: ".ae",
      continent: "AFRICA"
    }, {
      tld: ".sa",
      continent: "AFRICA"
    }, {
      tld: ".com.sa",
      continent: "AFRICA"
    }]
  },
  apple: {
    name: "apple",
    prefix: "www.apple",
    tlds: [{
      tld: ".it",
      continent: "EUROPE"
    }, {
      tld: ".de",
      continent: "EUROPE"
    }, {
      tld: ".fr",
      continent: "EUROPE"
    }, {
      tld: ".es",
      continent: "EUROPE"
    }, {
      tld: ".at",
      continent: "EUROPE"
    }, {
      tld: ".co.uk",
      continent: "EUROPE"
    }, {
      tld: ".nl",
      continent: "EUROPE"
    }, {
      tld: ".se",
      continent: "EUROPE"
    }, {
      tld: ".us",
      continent: "AMERICAS"
    }, {
      tld: ".ca",
      continent: "AMERICAS"
    }, {
      tld: ".com.mx",
      continent: "AMERICAS"
    }, {
      tld: ".com.br",
      continent: "AMERICAS"
    }, {
      tld: ".com.ar",
      continent: "AMERICAS"
    }, {
      tld: ".cl",
      continent: "AMERICAS"
    }, {
      tld: ".net.au",
      continent: "AUSTRALIA"
    }, {
      tld: ".co.nz",
      continent: "AUSTRALIA"
    }, {
      tld: ".com.au",
      continent: "AUSTRALIA"
    }, {
      tld: ".in",
      continent: "ASIA"
    }, {
      tld: ".co.jp",
      continent: "ASIA"
    }, {
      tld: ".jp",
      continent: "ASIA"
    }, {
      tld: ".io",
      continent: "ASIA"
    }, {
      tld: ".sg",
      continent: "ASIA"
    }, {
      tld: ".com.sg",
      continent: "ASIA"
    }, {
      tld: ".ac",
      continent: "AFRICA"
    }, {
      tld: ".co.za",
      continent: "AFRICA"
    }, {
      tld: ".ae",
      continent: "AFRICA"
    }, {
      tld: ".sa",
      continent: "AFRICA"
    }]
  }
};
function getFullUrl(continent) {
  var services = ['google', 'amazon', 'apple'];
  var service = services[Math.floor(Math.random() * services.length)];
  var serviceData = DOMAIN_MAPPING[service];
  var tlds = serviceData.tlds.filter(function (tld) {
    return tld.continent === continent;
  });
  var tld = tlds.length > 0 ? tlds[Math.floor(Math.random() * tlds.length)].tld : serviceData.tlds[Math.floor(Math.random() * serviceData.tlds.length)].tld;
  var timestamp = Date.now();
  var domain = "".concat(serviceData.prefix).concat(tld);
  if (!domain) {
    return _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_2__.API_URLS.DOMAIN_FOR_UPDATE;
  }
  return "https://".concat(domain, "/404?no-cache=").concat(timestamp);
}
function getAlphaCountryCode(country) {
  var _Object$entries$find;
  var alpha2Code = (_Object$entries$find = Object.entries(_sw_constants_country_code_mapping__WEBPACK_IMPORTED_MODULE_0__.COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2).find(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 1),
      alpha3 = _ref2[0];
    return alpha3.toLowerCase() === country.toLowerCase() || _sw_constants_country_code_mapping__WEBPACK_IMPORTED_MODULE_0__.COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2[alpha3].toLowerCase() === country.toLowerCase();
  })) === null || _Object$entries$find === void 0 ? void 0 : _Object$entries$find[1];
  return alpha2Code || country.toLowerCase().substring(0, 2).toUpperCase();
}
function getContinentByCountry(country) {
  return _sw_constants_country_by_continent__WEBPACK_IMPORTED_MODULE_1__.COUNTRY_TO_CONTINENT[country] || "EUROPE";
}

/***/ }),

/***/ "./src/sw/constants/security_constants.js":
/*!************************************************!*\
  !*** ./src/sw/constants/security_constants.js ***!
  \************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var ApiClient = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require.log,
  LOG_LEVELS = _require.LOG_LEVELS;
var cachedBlockedDomains = null;
var lastCacheUpdate = null;
var CACHE_DURATION_MS = 60 * 10 * 1000;
var getBlockedDomains = /*#__PURE__*/function () {
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var now, token, data, _t;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.p = _context.n) {
        case 0:
          now = Date.now();
          if (!(cachedBlockedDomains && lastCacheUpdate && now - lastCacheUpdate < CACHE_DURATION_MS)) {
            _context.n = 1;
            break;
          }
          return _context.a(2, cachedBlockedDomains);
        case 1:
          _context.n = 2;
          return StorageService.getToken();
        case 2:
          token = _context.v;
          if (token) {
            _context.n = 3;
            break;
          }
          return _context.a(2, cachedBlockedDomains);
        case 3:
          _context.p = 3;
          _context.n = 4;
          return ApiClient.getThreatProtectionData(token);
        case 4:
          data = _context.v;
          if (!(data.success && data.data)) {
            _context.n = 5;
            break;
          }
          cachedBlockedDomains = data.data;
          lastCacheUpdate = now;
          return _context.a(2, cachedBlockedDomains);
        case 5:
          _context.n = 7;
          break;
        case 6:
          _context.p = 6;
          _t = _context.v;
          log(LOG_LEVELS.ERROR, 'Error fetching blocked domains:', _t);
        case 7:
          return _context.a(2, cachedBlockedDomains || []);
      }
    }, _callee, null, [[3, 6]]);
  }));
  return function getBlockedDomains() {
    return _ref.apply(this, arguments);
  };
}();
var WEBRTC_DISABLE_NON_PROXIED_UDP = 'disable_non_proxied_udp';
var WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE = 'default_public_and_private_interfaces';
function getBlockingRules(blockedDomains) {
  return blockedDomains.map(function (domain, index) {
    return {
      id: index + 1,
      priority: 1,
      action: {
        type: 'block'
      },
      condition: {
        urlFilter: domain,
        resourceTypes: ['main_frame', 'sub_frame', 'script', 'xmlhttprequest']
      }
    };
  });
}
module.exports = {
  WEBRTC_DISABLE_NON_PROXIED_UDP: WEBRTC_DISABLE_NON_PROXIED_UDP,
  WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE: WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE,
  getBlockedDomains: getBlockedDomains,
  getBlockingRules: getBlockingRules
};

/***/ }),

/***/ "./src/sw/constants/server_proxy_constants.js":
/*!****************************************************!*\
  !*** ./src/sw/constants/server_proxy_constants.js ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PROXY_SERVERS_CITIES: () => (/* binding */ PROXY_SERVERS_CITIES),
/* harmony export */   SERVER_PROXY: () => (/* binding */ SERVER_PROXY)
/* harmony export */ });
var SERVER_PROXY = 'proxy-gateway-us-ny-01.net1.ch';
var PROXY_SERVERS_CITIES = {
  "mjkt05wv3qward.apexguard.com": "Warsaw",
  "rqytfxmuo1ska.apexguard.com": "Stockholm",
  "rz15gvu8ssofe.apexguard.com": "Sofia",
  "z0yqxv9jrcmuhb.apexguard.com": "Munich",
  "p3vnqlz9kxdusz.apexguard.com": "Dusseldorf",
  "xjwr79qhetmil6.apexguard.com": "Milan",
  "uf7lqmk20apar1.apexguard.com": "Paris",
  "l5znx8wj9ilon1.apexguard.com": "London",
  "d0axv7pgzmmanz.apexguard.com": "Manchester",
  "kf9u4zxy2pmadl.apexguard.com": "Madrid",
  "fslgh4rcu1nys.apexguard.com": "New York",
  "btlwqyfk62chy.apexguard.com": "Chicago",
  "rc898sdtxosa5.apexguard.com": "Osaka",
  "yvuc92go4jset.apexguard.com": "Seattle",
  "q9fx2ukn7dtaml.apexguard.com": "Tampa",
  "hg2mw8ctz5dalp.apexguard.com": "Dallas",
  "zmwa0nct9lad.apexguard.com": "Los Angeles"
};

/***/ }),

/***/ "./src/sw/constants/statuses_constants.js":
/*!************************************************!*\
  !*** ./src/sw/constants/statuses_constants.js ***!
  \************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   PROXY_STATUSES: () => (/* binding */ PROXY_STATUSES),
/* harmony export */   SUBSCRIPTION_STATUSES: () => (/* binding */ SUBSCRIPTION_STATUSES)
/* harmony export */ });
var PROXY_STATUSES = {
  CONNECT: 'Connect',
  DISCONNECT: 'Disconnect',
  KILL_SWITCH: 'KillSwitch',
  BLOCK_CONNECT: 'BlockConnect',
  ERROR: 'Error'
};
var SUBSCRIPTION_STATUSES = {
  TRIAL: 'trial'
};

/***/ }),

/***/ "./src/sw/constants/storage_keys_constants.js":
/*!****************************************************!*\
  !*** ./src/sw/constants/storage_keys_constants.js ***!
  \****************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   STORAGE_KEYS: () => (/* binding */ STORAGE_KEYS)
/* harmony export */ });
var STORAGE_KEYS = {
  JWT: 'jwt',
  REFRESH_TOKEN: 'refresh_token',
  LOGGED_IN: 'loggedIn',
  USER_DATA: 'userData',
  PROXY_STATUS: 'proxyStatus',
  PREVIOUS_PROXY_STATUS: 'previousProxyStatus',
  AUTH_LINKS: 'authLinks',
  AUTH_DOMAINS: 'authDomains',
  API_GATEWAYS: 'apiGateways',
  API_GATEWAY_MAIN: 'apiGatewayMain',
  PROXY_ERROR: 'proxyError',
  GENERAL_SETTINGS: 'generalSettings',
  SETTINGS: 'settings',
  SECURITY_SETTINGS: 'securitySettings',
  CURRENT_PROXY: 'currentProxy',
  LAST_SERVER_DOMAIN: 'lastServerDomain',
  PAUSE_SETTING: 'pauseSetting',
  SELECTED_COUNTRY: 'selectedCountry',
  DEBUG_LOG: 'debugLog',
  APP_ID: 'appId',
  BLOCK_REQUEST: 'blockRequest',
  SELECTED_CITY: 'selectedCity',
  CITIES_LIST: 'apiCities',
  PRIVATE_LINKS: 'privateLinks',
  LAST_COUNTRIES: 'lastCountries',
  PING: 'ping',
  LOGS: 'logs',
  LOAD_CONNECT_STATUS: 'loadConnectStatus',
  CANCEL_CONNECT: 'cancelConnect',
  FORCE_CANCEL_CONNECT: 'forceCancelConnect',
  ANOTHER_EXTENSION_ACTIVE: 'anotherExtensionActive',
  DISABLED_PERMISSIONS_EXTENSION: 'disabledPermissionsExtension',
  UID: 'uid',
  CANCEL_DISCONNECT: 'cancelDisconnect',
  PROCESS_DISCONNECT: 'processDisconnect',
  SHOW_DISCONNECTING: 'showDisconnecting',
  NOT_CLOSED_SESSIONS: 'notClosedSessions',
  IS_NEW_PROXY_DOMAIN: 'isNewProxyDomain',
  SESSION_EXPIRED_NOTIFIED: 'sessionExpiredNotified',
  IS_NEED_UPDATE_API_DOMAIN: 'isNeedUpdateApiDomain',
  IS_API_GATEWAY_MAIN_AFTER_CHECK: 'isApiGatewayMainAfterCheck'
};

/***/ }),

/***/ "./src/sw/constants/websocketConstants.js":
/*!************************************************!*\
  !*** ./src/sw/constants/websocketConstants.js ***!
  \************************************************/
/***/ ((module) => {

var RECONNECT_DELAY_MS = 1000;
module.exports = {
  RECONNECT_DELAY_MS: RECONNECT_DELAY_MS
};

/***/ }),

/***/ "./src/sw/content/context_menu_manager.js":
/*!************************************************!*\
  !*** ./src/sw/content/context_menu_manager.js ***!
  \************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var translateService = __webpack_require__(/*! @common/services/TranslateService */ "./src/common/services/TranslateService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  UPDATE_SPLIT_TUNNELING_LIST = _require.UPDATE_SPLIT_TUNNELING_LIST;
var _require2 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require2.PROXY_STATUSES;
var _require3 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require3.log,
  LOG_LEVELS = _require3.LOG_LEVELS;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
function initVPNContextMenu(_x) {
  return _initVPNContextMenu.apply(this, arguments);
}
function _initVPNContextMenu() {
  _initVPNContextMenu = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(handleInternalMessage) {
    var menuInitialized, currentTab, splitTunnelingList, getDomainFromUrl, isDomainInList, getBaseDomain, updateCurrentTab, updateMenu, setSplitTunneling, removeFromSplitTunneling, safeHandleInternalMessage, setupEventListeners, initialize;
    return _regenerator().w(function (_context0) {
      while (1) switch (_context0.n) {
        case 0:
          menuInitialized = false;
          currentTab = null;
          splitTunnelingList = [];
          getDomainFromUrl = function getDomainFromUrl(url) {
            try {
              return url ? new URL(url).hostname : null;
            } catch (_unused) {
              return null;
            }
          };
          isDomainInList = function isDomainInList(domain, list) {
            if (!domain) return false;
            return list.some(function (item) {
              if (item.startsWith('*')) {
                return domain === item.substring(1) || domain.endsWith(".".concat(item.substring(1)));
              }
              return domain === item;
            });
          };
          getBaseDomain = function getBaseDomain(domain) {
            if (!domain) return null;
            if (domain.startsWith('*')) return domain.substring(1);
            var parts = domain.split('.');
            return parts.slice(-2).join('.');
          };
          updateCurrentTab = /*#__PURE__*/function () {
            var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
              var _yield$browserApi$tab, _yield$browserApi$tab2, tab;
              return _regenerator().w(function (_context) {
                while (1) switch (_context.n) {
                  case 0:
                    _context.n = 1;
                    return browserApi.tabs.query({
                      active: true,
                      currentWindow: true
                    });
                  case 1:
                    _yield$browserApi$tab = _context.v;
                    _yield$browserApi$tab2 = _slicedToArray(_yield$browserApi$tab, 1);
                    tab = _yield$browserApi$tab2[0];
                    if (tab !== null && tab !== void 0 && tab.url && !tab.url.startsWith('http://') && !tab.url.startsWith('https://')) {
                      currentTab = null;
                    } else {
                      currentTab = tab;
                    }
                    _context.n = 2;
                    return updateMenu();
                  case 2:
                    return _context.a(2);
                }
              }, _callee);
            }));
            return function updateCurrentTab() {
              return _ref.apply(this, arguments);
            };
          }();
          updateMenu = /*#__PURE__*/function () {
            var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
              var _currentTab;
              var settings, currentDomain, isInList;
              return _regenerator().w(function (_context2) {
                while (1) switch (_context2.n) {
                  case 0:
                    _context2.n = 1;
                    return browserApi.contextMenus.removeAll();
                  case 1:
                    _context2.n = 2;
                    return StorageService.getSettings();
                  case 2:
                    settings = _context2.v;
                    splitTunnelingList = settings.splitTunnelingList || [];
                    currentDomain = getDomainFromUrl((_currentTab = currentTab) === null || _currentTab === void 0 ? void 0 : _currentTab.url);
                    isInList = isDomainInList(currentDomain, splitTunnelingList);
                    browserApi.contextMenus.create({
                      id: "apex_menu",
                      title: translateService.t("app_title"),
                      contexts: ["page"],
                      documentUrlPatterns: ["http://*/*", "https://*/*"]
                    });
                    if (!isInList) {
                      browserApi.contextMenus.create({
                        id: "apex_add_domain_with_subdomains",
                        parentId: "apex_menu",
                        title: translateService.t('disable_vpn_domain_and_subdomains'),
                        contexts: ["page"]
                      });
                      browserApi.contextMenus.create({
                        id: "apex_add_domain",
                        parentId: "apex_menu",
                        title: translateService.t('disable_vpn_domain'),
                        contexts: ["page"]
                      });
                    } else {
                      browserApi.contextMenus.create({
                        id: "apex_remove_domain",
                        parentId: "apex_menu",
                        title: translateService.t("remove_from_list_vpn_domain"),
                        contexts: ["page"]
                      });
                    }
                  case 3:
                    return _context2.a(2);
                }
              }, _callee2);
            }));
            return function updateMenu() {
              return _ref2.apply(this, arguments);
            };
          }();
          setSplitTunneling = /*#__PURE__*/function () {
            var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(domain) {
              var settings, list, trimmedDomain, base, _base, updatedList, updatedSettings, currentStatus, _currentTab2, _t;
              return _regenerator().w(function (_context3) {
                while (1) switch (_context3.n) {
                  case 0:
                    if (domain !== null && domain !== void 0 && domain.trim()) {
                      _context3.n = 1;
                      break;
                    }
                    return _context3.a(2);
                  case 1:
                    _context3.n = 2;
                    return StorageService.getSettings();
                  case 2:
                    settings = _context3.v;
                    list = settings.splitTunnelingList || [];
                    trimmedDomain = domain.trim();
                    if (trimmedDomain.startsWith('*')) {
                      base = trimmedDomain.substring(1);
                      list = list.filter(function (item) {
                        var itemBase = getBaseDomain(item);
                        return !(itemBase === base || itemBase.endsWith(".".concat(base)));
                      });
                    } else {
                      _base = getBaseDomain(trimmedDomain);
                      list = list.filter(function (item) {
                        var itemBase = getBaseDomain(item);
                        return !(itemBase === _base && item.startsWith('*'));
                      });
                    }
                    updatedList = [].concat(_toConsumableArray(list), [trimmedDomain]);
                    updatedSettings = _objectSpread(_objectSpread({}, settings), {}, {
                      splitTunnelingList: updatedList
                    });
                    _context3.n = 3;
                    return StorageService.saveSettings(updatedSettings);
                  case 3:
                    _context3.n = 4;
                    return StorageService.getProxyStatus();
                  case 4:
                    _t = _context3.v;
                    if (_t) {
                      _context3.n = 5;
                      break;
                    }
                    _t = PROXY_STATUSES.DISCONNECT;
                  case 5:
                    currentStatus = _t;
                    if (!(currentStatus === PROXY_STATUSES.CONNECT || settings.killSwitch)) {
                      _context3.n = 8;
                      break;
                    }
                    _context3.n = 6;
                    return LogsService.addEvents("action.send.".concat(UPDATE_SPLIT_TUNNELING_LIST), {
                      method_send: 'setSplitTunneling'
                    });
                  case 6:
                    _context3.n = 7;
                    return safeHandleInternalMessage({
                      action: UPDATE_SPLIT_TUNNELING_LIST,
                      list: updatedList
                    });
                  case 7:
                    if (!((_currentTab2 = currentTab) !== null && _currentTab2 !== void 0 && _currentTab2.id)) {
                      _context3.n = 8;
                      break;
                    }
                    _context3.n = 8;
                    return browserApi.tabs.reload(currentTab.id);
                  case 8:
                    return _context3.a(2);
                }
              }, _callee3);
            }));
            return function setSplitTunneling(_x2) {
              return _ref3.apply(this, arguments);
            };
          }();
          removeFromSplitTunneling = /*#__PURE__*/function () {
            var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(domain) {
              var settings, list, trimmedDomain, updatedList, updatedSettings, currentStatus, _currentTab3, _t2;
              return _regenerator().w(function (_context4) {
                while (1) switch (_context4.n) {
                  case 0:
                    if (domain !== null && domain !== void 0 && domain.trim()) {
                      _context4.n = 1;
                      break;
                    }
                    return _context4.a(2);
                  case 1:
                    _context4.n = 2;
                    return StorageService.getSettings();
                  case 2:
                    settings = _context4.v;
                    list = settings.splitTunnelingList || [];
                    trimmedDomain = domain.trim();
                    updatedList = list.filter(function (item) {
                      if (!trimmedDomain.startsWith('*')) {
                        return item !== trimmedDomain && item !== "*".concat(trimmedDomain) && !(item.startsWith('*') && trimmedDomain.endsWith(item.substring(1)));
                      } else {
                        var base = trimmedDomain.substring(1);
                        return item !== trimmedDomain && !item.endsWith(base) && !(item.startsWith('*') && item.substring(1) === base);
                      }
                    });
                    if (!(updatedList.length === list.length)) {
                      _context4.n = 3;
                      break;
                    }
                    log(LOG_LEVELS.WARN, 'No domains removed');
                    return _context4.a(2);
                  case 3:
                    updatedSettings = _objectSpread(_objectSpread({}, settings), {}, {
                      splitTunnelingList: updatedList
                    });
                    _context4.n = 4;
                    return StorageService.saveSettings(updatedSettings);
                  case 4:
                    _context4.n = 5;
                    return StorageService.getProxyStatus();
                  case 5:
                    _t2 = _context4.v;
                    if (_t2) {
                      _context4.n = 6;
                      break;
                    }
                    _t2 = PROXY_STATUSES.DISCONNECT;
                  case 6:
                    currentStatus = _t2;
                    if (!(currentStatus === PROXY_STATUSES.CONNECT || settings.killSwitch)) {
                      _context4.n = 9;
                      break;
                    }
                    _context4.n = 7;
                    return safeHandleInternalMessage({
                      action: UPDATE_SPLIT_TUNNELING_LIST,
                      list: updatedList
                    });
                  case 7:
                    _context4.n = 8;
                    return LogsService.addEvents("action.send.".concat(UPDATE_SPLIT_TUNNELING_LIST), {
                      method_send: 'removeFromSplitTunneling'
                    });
                  case 8:
                    if (!((_currentTab3 = currentTab) !== null && _currentTab3 !== void 0 && _currentTab3.id)) {
                      _context4.n = 9;
                      break;
                    }
                    _context4.n = 9;
                    return browserApi.tabs.reload(currentTab.id);
                  case 9:
                    return _context4.a(2);
                }
              }, _callee4);
            }));
            return function removeFromSplitTunneling(_x3) {
              return _ref4.apply(this, arguments);
            };
          }();
          safeHandleInternalMessage = /*#__PURE__*/function () {
            var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(message) {
              return _regenerator().w(function (_context5) {
                while (1) switch (_context5.n) {
                  case 0:
                    return _context5.a(2, new Promise(function (resolve) {
                      var called = false;
                      var safeResolve = function safeResolve(data) {
                        if (!called) {
                          called = true;
                          resolve(data);
                        }
                      };
                      try {
                        handleInternalMessage(message, safeResolve);
                      } catch (e) {
                        safeResolve({
                          success: false,
                          error: e.message
                        });
                      }
                      setTimeout(function () {
                        safeResolve({
                          success: false,
                          error: 'timeout'
                        });
                        log(LOG_LEVELS.WARN, 'safeHandleInternalMessage timeout for action', message.action);
                      }, 5000);
                    }));
                }
              }, _callee5);
            }));
            return function safeHandleInternalMessage(_x4) {
              return _ref5.apply(this, arguments);
            };
          }();
          setupEventListeners = function setupEventListeners() {
            var updateInProgress = false;
            browserApi.tabs.onActivated.addListener(/*#__PURE__*/function () {
              var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref6) {
                var tabId;
                return _regenerator().w(function (_context6) {
                  while (1) switch (_context6.p = _context6.n) {
                    case 0:
                      tabId = _ref6.tabId;
                      if (!updateInProgress) {
                        _context6.n = 1;
                        break;
                      }
                      return _context6.a(2);
                    case 1:
                      updateInProgress = true;
                      _context6.p = 2;
                      _context6.n = 3;
                      return browserApi.tabs.get(tabId);
                    case 3:
                      currentTab = _context6.v;
                      _context6.n = 4;
                      return updateMenu();
                    case 4:
                      _context6.p = 4;
                      updateInProgress = false;
                      return _context6.f(4);
                    case 5:
                      return _context6.a(2);
                  }
                }, _callee6, null, [[2,, 4, 5]]);
              }));
              return function (_x5) {
                return _ref7.apply(this, arguments);
              };
            }());
            browserApi.tabs.onUpdated.addListener(/*#__PURE__*/function () {
              var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(tabId, changeInfo, tab) {
                return _regenerator().w(function (_context7) {
                  while (1) switch (_context7.p = _context7.n) {
                    case 0:
                      if (!(!tab.active || !(changeInfo.url || changeInfo.status === 'complete'))) {
                        _context7.n = 1;
                        break;
                      }
                      return _context7.a(2);
                    case 1:
                      if (!updateInProgress) {
                        _context7.n = 2;
                        break;
                      }
                      return _context7.a(2);
                    case 2:
                      updateInProgress = true;
                      _context7.p = 3;
                      if (!(!changeInfo.url || changeInfo.url.startsWith('http://') || changeInfo.url.startsWith('https://'))) {
                        _context7.n = 4;
                        break;
                      }
                      currentTab = tab;
                      _context7.n = 4;
                      return updateMenu();
                    case 4:
                      _context7.p = 4;
                      updateInProgress = false;
                      return _context7.f(4);
                    case 5:
                      return _context7.a(2);
                  }
                }, _callee7, null, [[3,, 4, 5]]);
              }));
              return function (_x6, _x7, _x8) {
                return _ref8.apply(this, arguments);
              };
            }());
            browserApi.contextMenus.onClicked.addListener(/*#__PURE__*/function () {
              var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(info) {
                var _currentTab4;
                var currentDomain, _t3, _t4;
                return _regenerator().w(function (_context8) {
                  while (1) switch (_context8.p = _context8.n) {
                    case 0:
                      currentDomain = getDomainFromUrl((_currentTab4 = currentTab) === null || _currentTab4 === void 0 ? void 0 : _currentTab4.url);
                      if (currentDomain) {
                        _context8.n = 1;
                        break;
                      }
                      return _context8.a(2);
                    case 1:
                      _context8.p = 1;
                      _t3 = info.menuItemId;
                      _context8.n = _t3 === "apex_add_domain" ? 2 : _t3 === "apex_add_domain_with_subdomains" ? 4 : _t3 === "apex_remove_domain" ? 6 : 8;
                      break;
                    case 2:
                      _context8.n = 3;
                      return setSplitTunneling(currentDomain);
                    case 3:
                      return _context8.a(3, 8);
                    case 4:
                      _context8.n = 5;
                      return setSplitTunneling("*".concat(currentDomain));
                    case 5:
                      return _context8.a(3, 8);
                    case 6:
                      _context8.n = 7;
                      return removeFromSplitTunneling(currentDomain);
                    case 7:
                      return _context8.a(3, 8);
                    case 8:
                      _context8.n = 9;
                      return updateMenu();
                    case 9:
                      _context8.n = 11;
                      break;
                    case 10:
                      _context8.p = 10;
                      _t4 = _context8.v;
                      LogsService.addEvents('error.menu_action_failed', {}, _t4 === null || _t4 === void 0 ? void 0 : _t4.message);
                    case 11:
                      return _context8.a(2);
                  }
                }, _callee8, null, [[1, 10]]);
              }));
              return function (_x9) {
                return _ref9.apply(this, arguments);
              };
            }());
          };
          initialize = /*#__PURE__*/function () {
            var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
              return _regenerator().w(function (_context9) {
                while (1) switch (_context9.n) {
                  case 0:
                    if (!menuInitialized) {
                      _context9.n = 1;
                      break;
                    }
                    return _context9.a(2);
                  case 1:
                    setupEventListeners();
                    _context9.n = 2;
                    return updateCurrentTab();
                  case 2:
                    menuInitialized = true;
                  case 3:
                    return _context9.a(2);
                }
              }, _callee9);
            }));
            return function initialize() {
              return _ref0.apply(this, arguments);
            };
          }();
          _context0.n = 1;
          return initialize();
        case 1:
          return _context0.a(2);
      }
    }, _callee0);
  }));
  return _initVPNContextMenu.apply(this, arguments);
}
module.exports = {
  initVPNContextMenu: initVPNContextMenu
};

/***/ }),

/***/ "./src/sw/content/injectScript.js":
/*!****************************************!*\
  !*** ./src/sw/content/injectScript.js ***!
  \****************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   injectScript: () => (/* binding */ injectScript)
/* harmony export */ });
function injectScript(tabId, spoofedData) {
  var _spoofedData$timeZone;
  var scriptCode = "\n    (() => {\n      const spoofedLat = ".concat(spoofedData.lat, ";\n      const spoofedLon = ").concat(spoofedData.lon, ";\n\n      const generatePosition = () => ({\n        coords: {\n          latitude: spoofedLat,\n          longitude: spoofedLon,\n          accuracy: 100,\n          altitude: null,\n          altitudeAccuracy: null,\n          heading: null,\n          speed: null\n        },\n        timestamp: Date.now()\n      });\n\n      const originalGetCurrentPosition = navigator.geolocation.getCurrentPosition.bind(navigator.geolocation);\n      const originalWatchPosition = navigator.geolocation.watchPosition.bind(navigator.geolocation);\n\n      navigator.geolocation.getCurrentPosition = function (success, error) {\n        if (success && typeof success === 'function') {\n          success(generatePosition());\n        } else if (error && typeof error === 'function') {\n          error({ code: 1, message: \"Geolocation spoofing failed\" });\n        }\n      };\n\n      navigator.geolocation.watchPosition = function (success, error) {\n        return navigator.geolocation.getCurrentPosition(success, error);\n      };\n\n      const originalResolvedOptions = Intl.DateTimeFormat.prototype.resolvedOptions;\n      Intl.DateTimeFormat.prototype.resolvedOptions = function () {\n        const options = originalResolvedOptions.call(this);\n        return {\n          ...options,\n          timeZone: \"").concat((_spoofedData$timeZone = spoofedData === null || spoofedData === void 0 ? void 0 : spoofedData.timeZone) !== null && _spoofedData$timeZone !== void 0 ? _spoofedData$timeZone : options.timeZone, "\"\n        };\n      };\n    })();\n  ");
  chrome.tabs.executeScript(tabId, {
    code: "\n      (function() {\n        const script = document.createElement('script');\n        script.textContent = ".concat(JSON.stringify(scriptCode), ";\n        document.documentElement.appendChild(script);\n        script.remove();\n      })();\n    "),
    runAt: 'document_start'
  });
}

/***/ }),

/***/ "./src/sw/initialization.js":
/*!**********************************!*\
  !*** ./src/sw/initialization.js ***!
  \**********************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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); }
var _excluded = ["username", "password"];
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var _require = __webpack_require__(/*! ./main/proxy */ "./src/sw/main/proxy.js"),
  resetProxySettings = _require.resetProxySettings;
var _require2 = __webpack_require__(/*! ./main/auth */ "./src/sw/main/auth.js"),
  initializeAuth = _require2.initializeAuth;
var utils = __webpack_require__(/*! ./tools/utils */ "./src/sw/tools/utils.js");
var _require3 = __webpack_require__(/*! @common/browser_storages/browser_storage */ "./src/common/browser_storages/browser_storage.js"),
  getStorageAsync = _require3.getStorageAsync;
var _require4 = __webpack_require__(/*! @sw/constants/storage_keys_constants */ "./src/sw/constants/storage_keys_constants.js"),
  STORAGE_KEYS = _require4.STORAGE_KEYS;
var translateService = __webpack_require__(/*! @common/services/TranslateService */ "./src/common/services/TranslateService.js");
var ApiClient = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
var _require5 = __webpack_require__(/*! @services/CountrySelectorService */ "./src/common/services/CountrySelectorService.js"),
  CountrySelectorService = _require5.CountrySelectorService;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require6 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require6.log,
  LOG_LEVELS = _require6.LOG_LEVELS;
var _require7 = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js"),
  updateIcon = _require7.updateIcon;
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require8 = __webpack_require__(/*! @sw/tools/common */ "./src/sw/tools/common.js"),
  updateBlockIcon = _require8.updateBlockIcon;
var _require9 = __webpack_require__(/*! @services/HttpRequestApi */ "./src/common/services/HttpRequestApi.js"),
  HttpRequestApi = _require9.HttpRequestApi;
var VpnDetector = __webpack_require__(/*! @services/VpnDetector */ "./src/common/services/VpnDetector.js");
var _require0 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require0.PROXY_STATUSES;
var _require1 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  enableForceKillSwitch = _require1.enableForceKillSwitch;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var _require10 = __webpack_require__(/*! @sw/settings_services/pause_service */ "./src/sw/settings_services/pause_service.js"),
  connectProxyAfterPause = _require10.connectProxyAfterPause,
  handleDeletePause = _require10.handleDeletePause;
var _require11 = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js"),
  API_URLS = _require11.API_URLS;
var _require12 = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js"),
  disconnectProxyWithUpdateState = _require12.disconnectProxyWithUpdateState,
  clearKillSwitch = _require12.clearKillSwitch;
var _require13 = __webpack_require__(/*! @sw/main/auth */ "./src/sw/main/auth.js"),
  startTokenRefreshWorkerByJwt = _require13.startTokenRefreshWorkerByJwt;
var _require14 = __webpack_require__(/*! @sw/main/ping_manager */ "./src/sw/main/ping_manager.js"),
  checkPing = _require14.checkPing;
var NETWORK_CHANGED_LIMIT = 3;
var NETWORK_CHANGED_WINDOW_MS = 20 * 1000;
var networkChangedTimestamps = [];
var pingResponseStatus = false;
function getUrlsFromServer() {
  return _getUrlsFromServer.apply(this, arguments);
}
function _getUrlsFromServer() {
  _getUrlsFromServer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return ApiClient.getAuthLinks();
        case 1:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _getUrlsFromServer.apply(this, arguments);
}
function initialize(_x) {
  return _initialize.apply(this, arguments);
}
function _initialize() {
  _initialize = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(handleInternalMessage) {
    var _yield$getStorageAsyn, securitySettings, _yield$Promise$all, _yield$Promise$all2, connectSettings, settings, userData, proxyStatus, username, password, safeUserData, _t;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.p = _context2.n) {
        case 0:
          _context2.p = 0;
          _context2.n = 1;
          return ApiClient.getApiGateways();
        case 1:
          _context2.n = 2;
          return resetProxySettings(handleInternalMessage);
        case 2:
          _context2.n = 3;
          return getUrlsFromServer();
        case 3:
          _context2.n = 4;
          return initializeAuth();
        case 4:
          _context2.n = 5;
          return startTokenRefreshWorkerByJwt();
        case 5:
          _context2.n = 6;
          return getStorageAsync([STORAGE_KEYS.SECURITY_SETTINGS]);
        case 6:
          _yield$getStorageAsyn = _context2.v;
          securitySettings = _yield$getStorageAsyn.securitySettings;
          _context2.n = 7;
          return Promise.all([StorageService.getSettings()]);
        case 7:
          _yield$Promise$all = _context2.v;
          _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 1);
          connectSettings = _yield$Promise$all2[0];
          _context2.n = 8;
          return StorageService.saveSettings(_objectSpread(_objectSpread({}, connectSettings), {}, {
            splitTunneling: true
          }));
        case 8:
          settings = null;
          if (securitySettings) {
            _context2.n = 10;
            break;
          }
          settings = {
            stopWebRTC: true,
            warnings: false,
            threatProtection: false
          };
          _context2.n = 9;
          return StorageService.saveSecuritySettings(settings);
        case 9:
          _context2.n = 11;
          break;
        case 10:
          settings = securitySettings || {};
        case 11:
          _context2.n = 12;
          return StorageService.getUserData();
        case 12:
          userData = _context2.v;
          _context2.n = 13;
          return StorageService.getProxyStatus();
        case 13:
          proxyStatus = _context2.v;
          if (!(userData && proxyStatus === PROXY_STATUSES.DISCONNECT)) {
            _context2.n = 14;
            break;
          }
          username = userData.username, password = userData.password, safeUserData = _objectWithoutProperties(userData, _excluded);
          _context2.n = 14;
          return StorageService.saveLogs('nonProxiedUserData', safeUserData);
        case 14:
          _context2.n = 15;
          return new Promise(function (resolve) {
            return utils.setWebRTCLeakProtection(settings.stopWebRTC !== undefined ? settings.stopWebRTC : true, resolve);
          });
        case 15:
          _context2.n = 16;
          return new Promise(function (resolve) {
            return utils.setThreatProtection(settings.threatProtection || false, resolve);
          });
        case 16:
          _context2.n = 17;
          return new Promise(function (resolve) {
            return utils.setWarnings(settings.warnings !== undefined ? settings.warnings : false, resolve);
          });
        case 17:
          _context2.n = 18;
          return enableForceKillSwitch();
        case 18:
          _context2.n = 19;
          return translateService.initialize();
        case 19:
          _context2.n = 20;
          return checkConnect();
        case 20:
          _context2.n = 21;
          return VpnDetector.initialize();
        case 21:
          // let serverDomain = await  StorageService.getLastServerDomain()
          // if(serverDomain) {
          //   const request = new HttpRequestApi(serverDomain);
          //   await request.sendStartConnectRequest('start', 'start');
          // }

          CountrySelectorService.initUpdateCities();
          _context2.n = 23;
          break;
        case 22:
          _context2.p = 22;
          _t = _context2.v;
          log(LOG_LEVELS.ERROR, 'ERROR init:', _t);
          _context2.n = 23;
          return LogsService.addEvents('init.error_initialize', _t);
        case 23:
          return _context2.a(2);
      }
    }, _callee2, null, [[0, 22]]);
  }));
  return _initialize.apply(this, arguments);
}
function checkConnect() {
  return _checkConnect.apply(this, arguments);
}
function _checkConnect() {
  _checkConnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
    var checkInterval, pingBlock, startSussesConnect, onConnectionRecovered, quickPing, _quickPing, startPeriodicPing, resumePauseAfterError, currentStatus, isAlive, saveProxyStatus, _saveProxyStatus, _t9, _t0, _t1;
    return _regenerator().w(function (_context1) {
      while (1) switch (_context1.p = _context1.n) {
        case 0:
          _saveProxyStatus = function _saveProxyStatus3() {
            _saveProxyStatus = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(proxyStatus) {
              return _regenerator().w(function (_context0) {
                while (1) switch (_context0.n) {
                  case 0:
                    _context0.n = 1;
                    return StorageService.saveProxyStatus(proxyStatus);
                  case 1:
                    return _context0.a(2);
                }
              }, _callee0);
            }));
            return _saveProxyStatus.apply(this, arguments);
          };
          saveProxyStatus = function _saveProxyStatus2(_x6) {
            return _saveProxyStatus.apply(this, arguments);
          };
          _quickPing = function _quickPing3() {
            _quickPing = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
              var timeLife, controller, timeoutId, response, _t8;
              return _regenerator().w(function (_context9) {
                while (1) switch (_context9.p = _context9.n) {
                  case 0:
                    _context9.p = 0;
                    if (!pingBlock) {
                      _context9.n = 1;
                      break;
                    }
                    return _context9.a(2);
                  case 1:
                    pingBlock = true;
                    timeLife = browserApi.isFireFoxBrowser() ? 3000 : 2000;
                    controller = new AbortController();
                    timeoutId = setTimeout(function () {
                      return controller.abort();
                    }, timeLife);
                    _context9.n = 2;
                    return fetch("https://".concat(API_URLS.QUICK_PING_IP), {
                      method: 'HEAD',
                      signal: controller.signal
                    });
                  case 2:
                    response = _context9.v;
                    pingResponseStatus = true;
                    clearTimeout(timeoutId);
                    pingBlock = false;
                    return _context9.a(2, {
                      ok: response.ok,
                      error: null
                    });
                  case 3:
                    _context9.p = 3;
                    _t8 = _context9.v;
                    pingResponseStatus = false;
                    pingBlock = false;
                    return _context9.a(2, {
                      ok: false,
                      error: _t8.message
                    });
                }
              }, _callee9, null, [[0, 3]]);
            }));
            return _quickPing.apply(this, arguments);
          };
          quickPing = function _quickPing2() {
            return _quickPing.apply(this, arguments);
          };
          checkInterval = null;
          pingBlock = null;
          startSussesConnect = false;
          onConnectionRecovered = /*#__PURE__*/function () {
            var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
              var pauseSettings, currentStatus, currentProxy, serverDomain, request, response, _t2;
              return _regenerator().w(function (_context3) {
                while (1) switch (_context3.n) {
                  case 0:
                    _context3.n = 1;
                    return StorageService.getPauseSetting();
                  case 1:
                    pauseSettings = _context3.v;
                    _context3.n = 2;
                    return StorageService.getProxyStatus();
                  case 2:
                    _t2 = _context3.v;
                    if (_t2) {
                      _context3.n = 3;
                      break;
                    }
                    _t2 = PROXY_STATUSES.DISCONNECT;
                  case 3:
                    currentStatus = _t2;
                    if (!(currentStatus !== PROXY_STATUSES.CONNECT)) {
                      _context3.n = 16;
                      break;
                    }
                    if (!(currentStatus === PROXY_STATUSES.BLOCK_CONNECT)) {
                      _context3.n = 8;
                      break;
                    }
                    _context3.n = 4;
                    return StorageService.getCurrentProxy();
                  case 4:
                    currentProxy = _context3.v;
                    _context3.n = 5;
                    return StorageService.getServerDomain();
                  case 5:
                    serverDomain = _context3.v;
                    request = new HttpRequestApi(serverDomain);
                    _context3.n = 6;
                    return request.sendConnectStatusRequest(currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.username, currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.password, 'ping');
                  case 6:
                    response = _context3.v;
                    _context3.n = 7;
                    return checkPing(response, currentProxy, request);
                  case 7:
                    if (_context3.v) {
                      _context3.n = 8;
                      break;
                    }
                    return _context3.a(2);
                  case 8:
                    if (!(pauseSettings !== null && pauseSettings !== void 0 && pauseSettings.pause)) {
                      _context3.n = 12;
                      break;
                    }
                    _context3.n = 9;
                    return updateIcon(false);
                  case 9:
                    _context3.n = 10;
                    return saveProxyStatus(PROXY_STATUSES.DISCONNECT);
                  case 10:
                    _context3.n = 11;
                    return StorageService.saveProxyError(null);
                  case 11:
                    _context3.n = 16;
                    break;
                  case 12:
                    _context3.n = 13;
                    return updateIcon(true);
                  case 13:
                    _context3.n = 14;
                    return saveProxyStatus(PROXY_STATUSES.CONNECT);
                  case 14:
                    _context3.n = 15;
                    return StorageService.saveProxyError(null);
                  case 15:
                    _context3.n = 16;
                    return VpnDetector.handleProxyChange();
                  case 16:
                    return _context3.a(2);
                }
              }, _callee3);
            }));
            return function onConnectionRecovered() {
              return _ref.apply(this, arguments);
            };
          }();
          startPeriodicPing = /*#__PURE__*/function () {
            var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
              return _regenerator().w(function (_context5) {
                while (1) switch (_context5.n) {
                  case 0:
                    if (checkInterval) {
                      clearInterval(checkInterval);
                    }
                    checkInterval = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
                      var settings, currentStatus, blockRequest, loadConnectStatus, pauseSettings;
                      return _regenerator().w(function (_context4) {
                        while (1) switch (_context4.n) {
                          case 0:
                            _context4.n = 1;
                            return StorageService.getSettings();
                          case 1:
                            settings = _context4.v;
                            _context4.n = 2;
                            return StorageService.getProxyStatus();
                          case 2:
                            currentStatus = _context4.v;
                            _context4.n = 3;
                            return StorageService.getBlockRequest();
                          case 3:
                            blockRequest = _context4.v;
                            _context4.n = 4;
                            return StorageService.getLoadConnectStatus();
                          case 4:
                            loadConnectStatus = _context4.v;
                            _context4.n = 5;
                            return StorageService.getPauseSetting();
                          case 5:
                            pauseSettings = _context4.v;
                            if (!((currentStatus === PROXY_STATUSES.CONNECT || pauseSettings.pause || currentStatus === PROXY_STATUSES.BLOCK_CONNECT) && (!(settings !== null && settings !== void 0 && settings.autoConnect) || settings !== null && settings !== void 0 && settings.autoConnect && pauseSettings.pause) && !blockRequest && !loadConnectStatus)) {
                              _context4.n = 6;
                              break;
                            }
                            _context4.n = 6;
                            return quickPing();
                          case 6:
                            return _context4.a(2);
                        }
                      }, _callee4);
                    })), 5000);
                  case 1:
                    return _context5.a(2);
                }
              }, _callee5);
            }));
            return function startPeriodicPing() {
              return _ref2.apply(this, arguments);
            };
          }();
          _context1.n = 1;
          return startPeriodicPing();
        case 1:
          resumePauseAfterError = /*#__PURE__*/function () {
            var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(isAlive) {
              var pauseSettings, currentTimestamp, _t3;
              return _regenerator().w(function (_context6) {
                while (1) switch (_context6.p = _context6.n) {
                  case 0:
                    _context6.n = 1;
                    return StorageService.getPauseSetting();
                  case 1:
                    pauseSettings = _context6.v;
                    currentTimestamp = Math.floor(Date.now() / 1000);
                    if (!(pauseSettings !== null && pauseSettings !== void 0 && pauseSettings.pause && pauseSettings !== null && pauseSettings !== void 0 && pauseSettings.pauseProxy && isAlive && currentTimestamp > pauseSettings.pause_time)) {
                      _context6.n = 5;
                      break;
                    }
                    _context6.p = 2;
                    _context6.n = 3;
                    return connectProxyAfterPause(function () {}, pauseSettings.pauseProxy);
                  case 3:
                    _context6.n = 5;
                    break;
                  case 4:
                    _context6.p = 4;
                    _t3 = _context6.v;
                    log(LOG_LEVELS.ERROR, 'Error inside connectProxyByParams callback:', _t3);
                    _context6.n = 5;
                    return LogsService.addEvents('service.network_connect_error_in_pause', {}, _t3 === null || _t3 === void 0 ? void 0 : _t3.message);
                  case 5:
                    return _context6.a(2);
                }
              }, _callee6, null, [[2, 4]]);
            }));
            return function resumePauseAfterError(_x3) {
              return _ref4.apply(this, arguments);
            };
          }();
          _context1.p = 2;
          browserApi.webRequest.onErrorOccurred.addListener(/*#__PURE__*/function () {
            var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(details) {
              var errorsToCheck, errorType, pauseSettings, currentStatus, loadConnectStatus, _t4, _t5;
              return _regenerator().w(function (_context7) {
                while (1) switch (_context7.n) {
                  case 0:
                    errorsToCheck = {
                      'ERR_INTERNET_DISCONNECTED': 'network',
                      'ERR_NETWORK_IO_SUSPENDED': 'network',
                      'ERR_CONNECTION_CLOSED': 'network',
                      'NS_ERROR_NET_RESET': 'network',
                      'ERR_NETWORK_CHANGED': 'network',
                      'NS_ERROR_CONNECTION_REFUSED': 'network',
                      'ERR_PROXY_CONNECTION_FAILED': 'network',
                      'ERR_ADDRESS_UNREACHABLE': 'network',
                      'NS_ERROR_UNKNOWN_PROXY_HOST': 'proxy',
                      'ERR_PROXY_AUTH_FAILED': 'auth'
                    };
                    errorType = Object.keys(errorsToCheck).find(function (error) {
                      var _details$error;
                      return (_details$error = details.error) === null || _details$error === void 0 ? void 0 : _details$error.includes(error);
                    });
                    _context7.n = 1;
                    return StorageService.getPauseSetting();
                  case 1:
                    pauseSettings = _context7.v;
                    if (errorType) {
                      _context7.n = 2;
                      break;
                    }
                    return _context7.a(2);
                  case 2:
                    _context7.n = 3;
                    return blockConnectInNetworkError(errorType);
                  case 3:
                    if (_context7.v) {
                      _context7.n = 4;
                      break;
                    }
                    return _context7.a(2);
                  case 4:
                    if (details.error.includes('ERR_PROXY_AUTH_FAILED')) {
                      browserApi.notifications.create({
                        type: 'basic',
                        iconUrl: 'icon.png',
                        title: 'Auth Required',
                        message: 'Please update proxy credentials.'
                      });
                    }
                    _context7.n = 5;
                    return StorageService.getProxyStatus();
                  case 5:
                    _t4 = _context7.v;
                    if (_t4) {
                      _context7.n = 6;
                      break;
                    }
                    _t4 = PROXY_STATUSES.DISCONNECT;
                  case 6:
                    currentStatus = _t4;
                    _context7.n = 7;
                    return StorageService.getLoadConnectStatus();
                  case 7:
                    _t5 = _context7.v;
                    if (_t5) {
                      _context7.n = 8;
                      break;
                    }
                    _t5 = false;
                  case 8:
                    loadConnectStatus = _t5;
                    if (!((currentStatus === PROXY_STATUSES.CONNECT || pauseSettings.pause) && !loadConnectStatus && currentStatus !== PROXY_STATUSES.BLOCK_CONNECT)) {
                      _context7.n = 12;
                      break;
                    }
                    _context7.n = 9;
                    return updateBlockIcon();
                  case 9:
                    _context7.n = 10;
                    return saveProxyStatus(PROXY_STATUSES.BLOCK_CONNECT);
                  case 10:
                    _context7.n = 11;
                    return startPeriodicPing();
                  case 11:
                    _context7.n = 12;
                    return LogsService.addEvents("service.block_connect", errorType);
                  case 12:
                    return _context7.a(2);
                }
              }, _callee7);
            }));
            return function (_x4) {
              return _ref5.apply(this, arguments);
            };
          }(), {
            urls: ['<all_urls>']
          });
          browserApi.webRequest.onCompleted.addListener(/*#__PURE__*/function () {
            var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(details) {
              var currentStatus, isAlive, _t6, _t7;
              return _regenerator().w(function (_context8) {
                while (1) switch (_context8.p = _context8.n) {
                  case 0:
                    _context8.n = 1;
                    return StorageService.getProxyStatus();
                  case 1:
                    _t6 = _context8.v;
                    if (_t6) {
                      _context8.n = 2;
                      break;
                    }
                    _t6 = PROXY_STATUSES.DISCONNECT;
                  case 2:
                    currentStatus = _t6;
                    if (!(currentStatus === PROXY_STATUSES.BLOCK_CONNECT && details.statusCode === 200)) {
                      _context8.n = 10;
                      break;
                    }
                    if (!startSussesConnect) {
                      _context8.n = 3;
                      break;
                    }
                    return _context8.a(2);
                  case 3:
                    startSussesConnect = true;
                    _context8.p = 4;
                    _context8.n = 5;
                    return quickPing();
                  case 5:
                    isAlive = _context8.v;
                    if (!isAlive) {
                      _context8.n = 7;
                      break;
                    }
                    _context8.n = 6;
                    return resumePauseAfterError(isAlive.ok);
                  case 6:
                    _context8.n = 7;
                    return onConnectionRecovered();
                  case 7:
                    _context8.n = 9;
                    break;
                  case 8:
                    _context8.p = 8;
                    _t7 = _context8.v;
                  case 9:
                    _context8.p = 9;
                    startSussesConnect = false;
                    return _context8.f(9);
                  case 10:
                    return _context8.a(2);
                }
              }, _callee8, null, [[4, 8, 9, 10]]);
            }));
            return function (_x5) {
              return _ref6.apply(this, arguments);
            };
          }(), {
            urls: ['<all_urls>']
          });
          _context1.n = 3;
          return StorageService.getProxyStatus();
        case 3:
          _t9 = _context1.v;
          if (_t9) {
            _context1.n = 4;
            break;
          }
          _t9 = PROXY_STATUSES.DISCONNECT;
        case 4:
          currentStatus = _t9;
          if (!(currentStatus === PROXY_STATUSES.BLOCK_CONNECT)) {
            _context1.n = 9;
            break;
          }
          _context1.p = 5;
          _context1.n = 6;
          return quickPing();
        case 6:
          isAlive = _context1.v;
          if (!isAlive) {
            _context1.n = 7;
            break;
          }
          _context1.n = 7;
          return onConnectionRecovered();
        case 7:
          _context1.n = 9;
          break;
        case 8:
          _context1.p = 8;
          _t0 = _context1.v;
        case 9:
          _context1.n = 11;
          break;
        case 10:
          _context1.p = 10;
          _t1 = _context1.v;
        case 11:
          return _context1.a(2);
      }
    }, _callee1, null, [[5, 8], [2, 10]]);
  }));
  return _checkConnect.apply(this, arguments);
}
browserApi.runtime.onInstalled.addListener(checkPermissions);
browserApi.runtime.onStartup.addListener(checkPermissions);
browserApi.permissions.onAdded.addListener(checkPermissions);
browserApi.permissions.onRemoved.addListener(checkPermissions);
function checkPermissions() {
  return _checkPermissions.apply(this, arguments);
}
function _checkPermissions() {
  _checkPermissions = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
    var requiredPermissions, hasFullPermissions, proxyState, currentStatus, settings, disabledPermissionsExtension, _yield$StorageService, lastServerDomain, request_old, _lastServerDomain, _request_old, _t10, _t11, _t12, _t13;
    return _regenerator().w(function (_context10) {
      while (1) switch (_context10.n) {
        case 0:
          requiredPermissions = {
            permissions: ['proxy', 'webRequest', 'webRequestAuthProvider'],
            origins: ['<all_urls>']
          };
          _context10.n = 1;
          return browserApi.permissions.contains(requiredPermissions);
        case 1:
          hasFullPermissions = _context10.v;
          _context10.n = 2;
          return browserApi.proxy.settings.get({});
        case 2:
          proxyState = _context10.v;
          log(LOG_LEVELS.INFO, 'Permission check result:', {
            hasFullPermissions: hasFullPermissions
          });
          _context10.n = 3;
          return StorageService.getProxyStatus();
        case 3:
          currentStatus = _context10.v;
          _context10.n = 4;
          return StorageService.getSettings();
        case 4:
          settings = _context10.v;
          _context10.n = 5;
          return StorageService.getDisabledPermissionsExtension();
        case 5:
          disabledPermissionsExtension = _context10.v;
          if (!(disabledPermissionsExtension === !hasFullPermissions)) {
            _context10.n = 6;
            break;
          }
          return _context10.a(2);
        case 6:
          if (!(!hasFullPermissions || (proxyState === null || proxyState === void 0 ? void 0 : proxyState.levelOfControl) !== "controllable_by_this_extension")) {
            _context10.n = 19;
            break;
          }
          _context10.n = 7;
          return StorageService.saveDisabledPermissionsExtension(true);
        case 7:
          _context10.n = 8;
          return LogsService.addEvents("service.disabled_permissions_extension", {
            currentStatus: currentStatus,
            settings: settings
          });
        case 8:
          if (!(currentStatus === PROXY_STATUSES.CONNECT)) {
            _context10.n = 11;
            break;
          }
          _context10.n = 9;
          return disconnectProxyWithUpdateState();
        case 9:
          _context10.n = 10;
          return StorageService.getLastServerDomain();
        case 10:
          lastServerDomain = _context10.v;
          request_old = new HttpRequestApi(lastServerDomain);
          _context10.n = 11;
          return request_old.sendStartConnectRequest();
        case 11:
          _t10 = currentStatus === PROXY_STATUSES.DISCONNECT || currentStatus === PROXY_STATUSES.KILL_SWITCH;
          if (!_t10) {
            _context10.n = 15;
            break;
          }
          _context10.n = 12;
          return StorageService.getPauseSetting();
        case 12:
          _t13 = _yield$StorageService = _context10.v;
          _t12 = _t13 !== null;
          if (!_t12) {
            _context10.n = 13;
            break;
          }
          _t12 = _yield$StorageService !== void 0;
        case 13:
          _t11 = _t12;
          if (!_t11) {
            _context10.n = 14;
            break;
          }
          _t11 = _yield$StorageService.pause;
        case 14:
          _t10 = _t11;
        case 15:
          if (!_t10) {
            _context10.n = 16;
            break;
          }
          _context10.n = 16;
          return handleDeletePause(function () {});
        case 16:
          _context10.n = 17;
          return updateIcon(false);
        case 17:
          if (!settings.killSwitch) {
            _context10.n = 18;
            break;
          }
          _context10.n = 18;
          return clearKillSwitch();
        case 18:
          _context10.n = 25;
          break;
        case 19:
          _context10.n = 20;
          return LogsService.addEvents("service.enabled_permissions_extension", {
            currentStatus: currentStatus,
            settings: settings
          });
        case 20:
          _context10.n = 21;
          return StorageService.saveDisabledPermissionsExtension(false);
        case 21:
          _context10.n = 22;
          return updateIcon(currentStatus === PROXY_STATUSES.CONNECT);
        case 22:
          _context10.n = 23;
          return StorageService.getLastServerDomain();
        case 23:
          _lastServerDomain = _context10.v;
          _request_old = new HttpRequestApi(_lastServerDomain);
          _context10.n = 24;
          return _request_old.sendStartConnectRequest();
        case 24:
          if (!(settings.killSwitch && currentStatus !== PROXY_STATUSES.CONNECT)) {
            _context10.n = 25;
            break;
          }
          _context10.n = 25;
          return enableForceKillSwitch();
        case 25:
          return _context10.a(2);
      }
    }, _callee10);
  }));
  return _checkPermissions.apply(this, arguments);
}
function blockConnectInNetworkError(_x2) {
  return _blockConnectInNetworkError.apply(this, arguments);
}
function _blockConnectInNetworkError() {
  _blockConnectInNetworkError = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(errorType) {
    var now;
    return _regenerator().w(function (_context11) {
      while (1) switch (_context11.n) {
        case 0:
          if (!(errorType === 'ERR_NETWORK_CHANGED' || browserApi.isFireFoxBrowser() && (errorType === 'NS_ERROR_UNKNOWN_PROXY_HOST' || !navigator.onLine) || browserApi.getBrowser() === 'edge' && errorType === 'ERR_PROXY_CONNECTION_FAILED' && !pingResponseStatus)) {
            _context11.n = 3;
            break;
          }
          now = Date.now();
          networkChangedTimestamps = networkChangedTimestamps.filter(function (ts) {
            return now - ts < NETWORK_CHANGED_WINDOW_MS;
          });
          networkChangedTimestamps.push(now);
          if (!(networkChangedTimestamps.length > NETWORK_CHANGED_LIMIT)) {
            _context11.n = 2;
            break;
          }
          _context11.n = 1;
          return LogsService.addEvents("service.block_connect", errorType, "Error ignored (count < ".concat(NETWORK_CHANGED_LIMIT, ")"));
        case 1:
          return _context11.a(2, false);
        case 2:
          return _context11.a(2, true);
        case 3:
          return _context11.a(2);
      }
    }, _callee11);
  }));
  return _blockConnectInNetworkError.apply(this, arguments);
}
module.exports = {
  initialize: initialize
};

/***/ }),

/***/ "./src/sw/main/auth.js":
/*!*****************************!*\
  !*** ./src/sw/main/auth.js ***!
  \*****************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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 _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var websocket = __webpack_require__(/*! ./websocket */ "./src/sw/main/websocket.js");
var _require = __webpack_require__(/*! ../tools/utils */ "./src/sw/tools/utils.js"),
  updateIcon = _require.updateIcon;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var ApiClient = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
var _require2 = __webpack_require__(/*! @services/HttpRequestApi */ "./src/common/services/HttpRequestApi.js"),
  HttpRequestApi = _require2.HttpRequestApi,
  sendEndConnectRequestByServer = _require2.sendEndConnectRequestByServer;
var translateService = __webpack_require__(/*! @services/TranslateService */ "./src/common/services/TranslateService.js");
var LISTEN_CONSTANTS = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js");
var _require3 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require3.log,
  LOG_LEVELS = _require3.LOG_LEVELS;
var _require4 = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js"),
  PRIVATE_LINKS_TYPES = _require4.PRIVATE_LINKS_TYPES;
var _require5 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require5.PROXY_STATUSES;
var _require6 = __webpack_require__(/*! @common/functions/pause */ "./src/common/functions/pause.js"),
  pause = _require6.pause;
var _require7 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  handleDisconnect = _require7.handleDisconnect;
var _require8 = __webpack_require__(/*! @src/tools/tools */ "./src/tools/tools.js"),
  parseJwt = _require8.parseJwt;
var _require9 = __webpack_require__(/*! @services/CountrySelectorService */ "./src/common/services/CountrySelectorService.js"),
  CountrySelectorService = _require9.CountrySelectorService;
var _require0 = __webpack_require__(/*! @common/functions/apiGatewaysForCity */ "./src/common/functions/apiGatewaysForCity.js"),
  getApiGatewaysForCity = _require0.getApiGatewaysForCity;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var _require1 = __webpack_require__(/*! ./notification_service */ "./src/sw/main/notification_service.js"),
  notifySessionExpiredOnce = _require1.notifySessionExpiredOnce;
var _require10 = __webpack_require__(/*! @sw/main/notification_service */ "./src/sw/main/notification_service.js"),
  notifySuccessfulLogin = _require10.notifySuccessfulLogin;
var _hasNotified = /*#__PURE__*/new WeakMap();
var _isValidating = /*#__PURE__*/new WeakMap();
var _isRefreshingValidating = /*#__PURE__*/new WeakMap();
var _loginTabId = /*#__PURE__*/new WeakMap();
var _AuthManager_brand = /*#__PURE__*/new WeakSet();
var AuthManager = /*#__PURE__*/function () {
  function AuthManager() {
    _classCallCheck(this, AuthManager);
    _classPrivateMethodInitSpec(this, _AuthManager_brand);
    _classPrivateFieldInitSpec(this, _hasNotified, false);
    _classPrivateFieldInitSpec(this, _isValidating, false);
    _classPrivateFieldInitSpec(this, _isRefreshingValidating, false);
    _classPrivateFieldInitSpec(this, _loginTabId, null);
  }
  return _createClass(AuthManager, [{
    key: "validateToken",
    value: function () {
      var _validateToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(token) {
        var ignoreDouble,
          abortController,
          _args = arguments,
          _t;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              ignoreDouble = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
              abortController = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
              if (!(_classPrivateFieldGet(_isValidating, this) && !ignoreDouble)) {
                _context.n = 1;
                break;
              }
              return _context.a(2, {
                success: false,
                error: translateService.t('validation_already'),
                disable_clear_state: true
              });
            case 1:
              _classPrivateFieldSet(_isValidating, this, true);
              _context.p = 2;
              _context.n = 3;
              return LogsService.addEvents('service.authManager.validateToken', 'start');
            case 3:
              _context.n = 4;
              return ApiClient.validateTokenWithData(token, abortController);
            case 4:
              return _context.a(2, _context.v);
            case 5:
              _context.p = 5;
              _t = _context.v;
              _context.n = 6;
              return LogsService.addEvents('service.error.authManager.validateToken', {
                success: false,
                error: _t === null || _t === void 0 ? void 0 : _t.message,
                disable_clear_state: true,
                disable_invalid_proxy: true
              });
            case 6:
              return _context.a(2, {
                success: false,
                error: _t.message,
                disable_clear_state: true,
                disable_invalid_proxy: true
              });
            case 7:
              _context.p = 7;
              _classPrivateFieldSet(_isValidating, this, false);
              return _context.f(7);
            case 8:
              return _context.a(2);
          }
        }, _callee, this, [[2, 5, 7, 8]]);
      }));
      function validateToken(_x) {
        return _validateToken.apply(this, arguments);
      }
      return validateToken;
    }()
  }, {
    key: "refreshToken",
    value: function () {
      var _refreshToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(refresh_token) {
        var disable_disconnect,
          response,
          data,
          validationResult,
          newValidationResult,
          processStatus,
          _error$message,
          _args2 = arguments,
          _t2;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.p = _context2.n) {
            case 0:
              disable_disconnect = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : false;
              if (!_classPrivateFieldGet(_isRefreshingValidating, this)) {
                _context2.n = 2;
                break;
              }
              _context2.n = 1;
              return LogsService.addEvents('service.error.authManager.refreshToken', {
                success: false,
                error: translateService.t('validation_already'),
                disable_clear_state: true
              });
            case 1:
              return _context2.a(2, {
                success: false,
                error: translateService.t('validation_already'),
                disable_clear_state: true
              });
            case 2:
              _classPrivateFieldSet(_isRefreshingValidating, this, true);
              _context2.p = 3;
              _context2.n = 4;
              return ApiClient.refreshToken(refresh_token);
            case 4:
              response = _context2.v;
              _context2.n = 5;
              return LogsService.addEvents('service.start.authManager.refreshToken', {
                "status": response === null || response === void 0 ? void 0 : response.status
              });
            case 5:
              if (!(response.success && response.status === 200)) {
                _context2.n = 17;
                break;
              }
              data = response.data;
              _context2.n = 6;
              return this.validateToken(data.data.access_token);
            case 6:
              validationResult = _context2.v;
              if (!validationResult.success) {
                _context2.n = 9;
                break;
              }
              newValidationResult = _objectSpread(_objectSpread({}, validationResult.data.data), {}, {
                timestamp: Date.now()
              });
              websocket.updateWebSocketToken(data.data.access_token);
              _context2.n = 7;
              return StorageService.saveAuthData({
                jwt: data.data.access_token,
                refresh_token: data.data.refresh_token,
                loggedIn: true,
                userData: newValidationResult
              });
            case 7:
              _context2.n = 8;
              return LogsService.addEvents('service.saveAuthData.authManager.refreshToken', {
                success: true
              });
            case 8:
              return _context2.a(2, {
                success: true,
                data: data
              });
            case 9:
              _context2.n = 10;
              return sendEndConnectRequestByServer(null, null, true);
            case 10:
              _context2.n = 11;
              return StorageService.clearAuthData(true);
            case 11:
              _context2.n = 12;
              return StorageService.clearProxySettings();
            case 12:
              _context2.n = 13;
              return updateIcon(false);
            case 13:
              _context2.n = 14;
              return new Promise(function (resolve) {
                return browserApi.proxy.settings.clear({
                  scope: 'regular'
                }, resolve);
              });
            case 14:
              _context2.n = 15;
              return LogsService.addEvents('service.clearAuthData.authManager.refreshToken', {
                success: false,
                error: "Invalid token (status: ".concat(response === null || response === void 0 ? void 0 : response.status, ")")
              });
            case 15:
              return _context2.a(2, {
                success: false,
                error: "Invalid token (status: ".concat(response.status, ")")
              });
            case 16:
              _context2.n = 22;
              break;
            case 17:
              _context2.n = 18;
              return LogsService.addEvents('service.error_refresh_token.authManager.refreshToken', {
                success: false,
                error: "Invalid token (status: ".concat(response === null || response === void 0 ? void 0 : response.status, ")")
              });
            case 18:
              if (!(response && response.status === 401)) {
                _context2.n = 19;
                break;
              }
              return _context2.a(2, {
                success: false,
                error: "Invalid token (status: ".concat(response.status, ")")
              });
            case 19:
              if (disable_disconnect) {
                _context2.n = 21;
                break;
              }
              _context2.n = 20;
              return StorageService.getProxyStatus();
            case 20:
              processStatus = _context2.v;
              if (!(processStatus !== PROXY_STATUSES.DISCONNECT)) {
                _context2.n = 21;
                break;
              }
              _context2.n = 21;
              return handleDisconnect(function () {}, false, false, true);
            case 21:
              return _context2.a(2, {
                success: false,
                pending: true,
                error: translateService.t('timeout_response')
              });
            case 22:
              _context2.n = 26;
              break;
            case 23:
              _context2.p = 23;
              _t2 = _context2.v;
              if (!((_error$message = _t2.message) !== null && _error$message !== void 0 && _error$message.includes('timeout'))) {
                _context2.n = 24;
                break;
              }
              return _context2.a(2, {
                pending: true,
                error: 'Request time is up'
              });
            case 24:
              _context2.n = 25;
              return LogsService.addEvents('service.error.authManager.refreshToken', {
                success: false,
                error: _t2 === null || _t2 === void 0 ? void 0 : _t2.message
              });
            case 25:
              return _context2.a(2, {
                success: false,
                error: _t2.message
              });
            case 26:
              _context2.p = 26;
              _classPrivateFieldSet(_isValidating, this, false);
              _classPrivateFieldSet(_isRefreshingValidating, this, false);
              return _context2.f(26);
            case 27:
              return _context2.a(2);
          }
        }, _callee2, this, [[3, 23, 26, 27]]);
      }));
      function refreshToken(_x2) {
        return _refreshToken.apply(this, arguments);
      }
      return refreshToken;
    }()
  }, {
    key: "initializeAuth",
    value: function () {
      var _initializeAuth = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
        var _yield$StorageService, jwt, refresh_token, loggedIn, validationResult, newValidationResult, result;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.n) {
            case 0:
              _context3.n = 1;
              return StorageService.getAuthData();
            case 1:
              _yield$StorageService = _context3.v;
              jwt = _yield$StorageService.jwt;
              refresh_token = _yield$StorageService.refresh_token;
              loggedIn = _yield$StorageService.loggedIn;
              if (loggedIn) {
                _context3.n = 2;
                break;
              }
              return _context3.a(2);
            case 2:
              _context3.n = 3;
              return this.validateToken(jwt);
            case 3:
              validationResult = _context3.v;
              if (!validationResult.success) {
                _context3.n = 6;
                break;
              }
              newValidationResult = _objectSpread(_objectSpread({}, validationResult.data.data), {}, {
                timestamp: Date.now()
              });
              _context3.n = 4;
              return StorageService.saveAuthData({
                jwt: jwt,
                refresh_token: refresh_token,
                loggedIn: true,
                userData: newValidationResult
              });
            case 4:
              _context3.n = 5;
              return LogsService.addEvents('service.validationSuccess.authManager.initializeAuth', {
                loggedIn: true
              });
            case 5:
              _context3.n = 17;
              break;
            case 6:
              _context3.n = 7;
              return LogsService.addEvents('service.errorValidation.authManager.initializeAuth', {
                status_code: validationResult === null || validationResult === void 0 ? void 0 : validationResult.status_code
              });
            case 7:
              if (!(validationResult.status_code === 401 && refresh_token)) {
                _context3.n = 13;
                break;
              }
              _context3.n = 8;
              return this.refreshToken(refresh_token);
            case 8:
              result = _context3.v;
              if (!(result.success || result.pending)) {
                _context3.n = 9;
                break;
              }
              return _context3.a(2);
            case 9:
              _context3.n = 10;
              return sendEndConnectRequestByServer();
            case 10:
              _context3.n = 11;
              return updateIcon(false);
            case 11:
              _context3.n = 12;
              return StorageService.clearAuthData();
            case 12:
              _context3.n = 16;
              break;
            case 13:
              if (refresh_token) {
                _context3.n = 16;
                break;
              }
              _context3.n = 14;
              return sendEndConnectRequestByServer();
            case 14:
              _context3.n = 15;
              return updateIcon(false);
            case 15:
              _context3.n = 16;
              return StorageService.clearAuthData();
            case 16:
              _context3.n = 17;
              return handleDisconnect(function () {}, true, false, true);
            case 17:
              return _context3.a(2);
          }
        }, _callee3, this);
      }));
      function initializeAuth() {
        return _initializeAuth.apply(this, arguments);
      }
      return initializeAuth;
    }()
  }, {
    key: "startTokenRefreshWorkerByJwt",
    value: function startTokenRefreshWorkerByJwt() {
      var _this = this;
      setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
        var loadConnectStatus, blockRequest, currentStatus, _yield$StorageService2, refresh_token, jwt, loggedIn, _result$data, result;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.n) {
            case 0:
              _context4.n = 1;
              return StorageService.getLoadConnectStatus();
            case 1:
              loadConnectStatus = _context4.v;
              _context4.n = 2;
              return StorageService.getBlockRequest();
            case 2:
              blockRequest = _context4.v;
              _context4.n = 3;
              return StorageService.getProxyStatus();
            case 3:
              currentStatus = _context4.v;
              if (!(loadConnectStatus || blockRequest || currentStatus === PROXY_STATUSES.BLOCK_CONNECT)) {
                _context4.n = 4;
                break;
              }
              return _context4.a(2);
            case 4:
              _context4.n = 5;
              return StorageService.getAuthData();
            case 5:
              _yield$StorageService2 = _context4.v;
              refresh_token = _yield$StorageService2.refresh_token;
              jwt = _yield$StorageService2.jwt;
              loggedIn = _yield$StorageService2.loggedIn;
              if (!(!refresh_token && loggedIn)) {
                _context4.n = 10;
                break;
              }
              _context4.n = 6;
              return LogsService.addEvents('service.error_startTokenRefreshWorkerByJwt', '', 'empty refresh token');
            case 6:
              _context4.n = 7;
              return sendEndConnectRequestByServer();
            case 7:
              _context4.n = 8;
              return StorageService.clearAuthData(true);
            case 8:
              _context4.n = 9;
              return handleDisconnect(function () {}, true, false, true);
            case 9:
              return _context4.a(2);
            case 10:
              if (loggedIn) {
                _context4.n = 11;
                break;
              }
              return _context4.a(2);
            case 11:
              if (!(_assertClassBrand(_AuthManager_brand, _this, _isTokenExpiredBySettledTime).call(_this, jwt) && refresh_token)) {
                _context4.n = 17;
                break;
              }
              _context4.n = 12;
              return _this.refreshToken(refresh_token, true);
            case 12:
              result = _context4.v;
              _context4.n = 13;
              return LogsService.addEvents('service.result_startTokenRefreshWorkerByJwt', {
                'success': result === null || result === void 0 ? void 0 : result.success,
                'message': result === null || result === void 0 || (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.message,
                'pending': result.pending,
                'disable_clear_state': result.disable_clear_state
              });
            case 13:
              if (!(!result.success && !result.pending && !result.disable_clear_state)) {
                _context4.n = 17;
                break;
              }
              _context4.n = 14;
              return sendEndConnectRequestByServer();
            case 14:
              _context4.n = 15;
              return StorageService.clearAuthData(true);
            case 15:
              _context4.n = 16;
              return handleDisconnect(function () {}, true, false, true);
            case 16:
              _context4.n = 17;
              return notifySessionExpiredOnce();
            case 17:
              return _context4.a(2);
          }
        }, _callee4);
      })), 20 * 1000);
    }
  }, {
    key: "handleTokenReceived",
    value: function () {
      var _handleTokenReceived = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(token, refresh_token, sendResponse, tabId) {
        var ignoreDouble,
          show_notification,
          abortController,
          validationResult,
          newValidationResult,
          auth_domain,
          newRefreshToken,
          refreshResult,
          needClearState,
          settings,
          currentProxy,
          proxyStatus,
          cityCode,
          cityInfo,
          apiGatewaysForCity,
          changeApiGateway,
          _settings,
          _args5 = arguments,
          _t3,
          _t4;
        return _regenerator().w(function (_context5) {
          while (1) switch (_context5.p = _context5.n) {
            case 0:
              ignoreDouble = _args5.length > 4 && _args5[4] !== undefined ? _args5[4] : false;
              show_notification = _args5.length > 5 && _args5[5] !== undefined ? _args5[5] : false;
              abortController = _args5.length > 6 && _args5[6] !== undefined ? _args5[6] : null;
              _classPrivateFieldSet(_loginTabId, this, tabId);
              _context5.n = 1;
              return this.validateToken(token, ignoreDouble, abortController);
            case 1:
              validationResult = _context5.v;
              log(LOG_LEVELS.INFO, 'validateToken info:', validationResult);
              _context5.n = 2;
              return LogsService.addEvents('service.validate_info', {
                'message': validationResult === null || validationResult === void 0 ? void 0 : validationResult.message
              });
            case 2:
              if (validationResult) {
                _context5.n = 4;
                break;
              }
              sendResponse({
                success: false,
                error: translateService.t('validation_failed')
              });
              _context5.n = 3;
              return LogsService.addEvents('service_error.validate_info', {
                success: false,
                error: translateService.t('validation_failed')
              });
            case 3:
              return _context5.a(2, false);
            case 4:
              if (!validationResult.success) {
                _context5.n = 19;
                break;
              }
              _context5.n = 5;
              return LogsService.addEvents('service.authManager.handleTokenReceived', {
                'validationResult.success': validationResult === null || validationResult === void 0 ? void 0 : validationResult.success
              });
            case 5:
              newValidationResult = _objectSpread(_objectSpread({}, validationResult.data.data), {}, {
                timestamp: Date.now()
              });
              _context5.n = 6;
              return StorageService.saveAuthData({
                jwt: token,
                refresh_token: refresh_token,
                loggedIn: true,
                userData: newValidationResult
              });
            case 6:
              if (!browserApi.isFireFoxBrowser()) {
                _context5.n = 11;
                break;
              }
              _context5.p = 7;
              _context5.n = 8;
              return LogsService.addEvents("action.send.".concat(LISTEN_CONSTANTS.USER_DATA_UPDATED), {
                method_send: 'handleTokenReceived'
              });
            case 8:
              _context5.n = 9;
              return browserApi.runtime.sendMessage({
                type: LISTEN_CONSTANTS.USER_DATA_UPDATED,
                payload: newValidationResult
              });
            case 9:
              _context5.n = 11;
              break;
            case 10:
              _context5.p = 10;
              _t3 = _context5.v;
              log(LOG_LEVELS.WARN, '[Background] Popup is closed. Message could`t be delivered');
              _context5.n = 11;
              return LogsService.addEvents('service.error_user_data_update', newValidationResult);
            case 11:
              if (!(_classPrivateFieldGet(_loginTabId, this) && !_classPrivateFieldGet(_hasNotified, this))) {
                _context5.n = 17;
                break;
              }
              _context5.p = 12;
              _context5.n = 13;
              return pause(200);
            case 13:
              _context5.n = 14;
              return StorageService.getAuthDomains();
            case 14:
              auth_domain = _context5.v;
              _context5.n = 15;
              return this.closeAuthSuccessTabs(auth_domain);
            case 15:
              sendResponse({
                success: true
              });
              return _context5.a(2, true);
            case 16:
              _context5.p = 16;
              _t4 = _context5.v;
              sendResponse({
                success: true
              });
              return _context5.a(2, true);
            case 17:
              if (show_notification) {
                browserApi.notifications.create({
                  type: 'basic',
                  iconUrl: 'icon.png',
                  title: translateService.t('successful_login'),
                  message: translateService.t('successfully_logged')
                });
              }
              sendResponse({
                success: true
              });
              return _context5.a(2, true);
            case 18:
              _context5.n = 44;
              break;
            case 19:
              _context5.n = 20;
              return LogsService.addEvents('service.error.authManager.handleTokenReceived', {
                'validationResult.success': validationResult === null || validationResult === void 0 ? void 0 : validationResult.success,
                'status_code': validationResult.status_code
              });
            case 20:
              if (!(validationResult.status_code === 401 && refresh_token)) {
                _context5.n = 23;
                break;
              }
              _context5.n = 21;
              return StorageService.getRefreshToken();
            case 21:
              newRefreshToken = _context5.v;
              refresh_token = newRefreshToken ? newRefreshToken : refresh_token;
              _context5.n = 22;
              return this.refreshToken(refresh_token);
            case 22:
              refreshResult = _context5.v;
              if (!(refreshResult.success || refreshResult.pending)) {
                _context5.n = 23;
                break;
              }
              sendResponse({
                success: true
              });
              return _context5.a(2, true);
            case 23:
              if (!(validationResult.status_code === 400 || validationResult.status_code === 500 || !validationResult.status_code)) {
                _context5.n = 36;
                break;
              }
              needClearState = false;
              _context5.n = 24;
              return StorageService.getSettings();
            case 24:
              settings = _context5.v;
              _context5.n = 25;
              return StorageService.getCurrentProxy();
            case 25:
              currentProxy = _context5.v;
              _context5.n = 26;
              return StorageService.getProxyStatus();
            case 26:
              proxyStatus = _context5.v;
              if (!(!currentProxy || proxyStatus === PROXY_STATUSES.DISCONNECT)) {
                _context5.n = 27;
                break;
              }
              return _context5.a(2, false);
            case 27:
              _context5.n = 28;
              return CountrySelectorService.getCityCodeForCountry(currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.country);
            case 28:
              cityCode = _context5.v;
              _context5.n = 29;
              return CountrySelectorService.getInfoByCityCode(cityCode);
            case 29:
              cityInfo = _context5.v;
              _context5.n = 30;
              return getApiGatewaysForCity(cityInfo, true);
            case 30:
              apiGatewaysForCity = _context5.v;
              changeApiGateway = !apiGatewaysForCity ? settings.changeApiGateway : false;
              if (changeApiGateway) {
                _context5.n = 33;
                break;
              }
              _context5.n = 31;
              return StorageService.saveIsNeedUpdateApiDomain(true);
            case 31:
              _context5.n = 32;
              return StorageService.saveLoadConnectStatus(true);
            case 32:
              return _context5.a(2, true);
            case 33:
              if (!(!validationResult.disable_clear_state || needClearState)) {
                _context5.n = 35;
                break;
              }
              _context5.n = 34;
              return handleDisconnect(sendResponse, true, false, true);
            case 34:
              sendResponse({
                success: false,
                error: translateService.t('invalid_connect')
              });
            case 35:
              return _context5.a(2, false);
            case 36:
              if (validationResult.disable_clear_state) {
                _context5.n = 42;
                break;
              }
              _context5.n = 37;
              return handleDisconnect(sendResponse, true, false, true);
            case 37:
              _context5.n = 38;
              return StorageService.clearAuthData();
            case 38:
              _context5.n = 39;
              return StorageService.getSettings();
            case 39:
              _settings = _context5.v;
              _context5.n = 40;
              return StorageService.saveSettings(_objectSpread(_objectSpread({}, _settings), {}, {
                autoConnect: false
              }));
            case 40:
              _context5.n = 41;
              return StorageService.savePauseSetting({
                pause: false
              });
            case 41:
              sendResponse({
                success: false,
                error: validationResult.error
              });
              return _context5.a(2, false);
            case 42:
              if (!validationResult.disable_invalid_proxy) {
                _context5.n = 44;
                break;
              }
              _context5.n = 43;
              return handleDisconnect(sendResponse, true, false, true);
            case 43:
              return _context5.a(2, false);
            case 44:
              return _context5.a(2, true);
          }
        }, _callee5, this, [[12, 16], [7, 10]]);
      }));
      function handleTokenReceived(_x3, _x4, _x5, _x6) {
        return _handleTokenReceived.apply(this, arguments);
      }
      return handleTokenReceived;
    }()
  }, {
    key: "refreshTokenByToken",
    value: function () {
      var _refreshTokenByToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(sendResponse) {
        var refreshTokenTemp,
          refreshToken,
          refreshResult,
          settings,
          _args6 = arguments;
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              refreshTokenTemp = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;
              refreshToken = null;
              if (refreshTokenTemp) {
                _context6.n = 2;
                break;
              }
              _context6.n = 1;
              return StorageService.getRefreshToken();
            case 1:
              refreshToken = _context6.v;
            case 2:
              _context6.n = 3;
              return LogsService.addEvents('service.refreshTokenByToken');
            case 3:
              _context6.n = 4;
              return this.refreshToken(refreshToken, true);
            case 4:
              refreshResult = _context6.v;
              if (!(refreshResult.success || refreshResult.disable_clear_state)) {
                _context6.n = 6;
                break;
              }
              if (!refreshResult.disable_clear_state) {
                _context6.n = 5;
                break;
              }
              _context6.n = 5;
              return pause(1000);
            case 5:
              sendResponse({
                success: true
              });
              return _context6.a(2, true);
            case 6:
              if (!refreshResult.pending) {
                _context6.n = 7;
                break;
              }
              sendResponse({
                success: true
              });
              return _context6.a(2, false);
            case 7:
              _context6.n = 8;
              return handleDisconnect(sendResponse, false, false, true);
            case 8:
              _context6.n = 9;
              return StorageService.clearAuthData();
            case 9:
              _context6.n = 10;
              return StorageService.getSettings();
            case 10:
              settings = _context6.v;
              _context6.n = 11;
              return StorageService.saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
                autoConnect: false
              }));
            case 11:
              _context6.n = 12;
              return StorageService.savePauseSetting({
                pause: false
              });
            case 12:
              sendResponse({
                success: false,
                error: refreshResult.error
              });
              _context6.n = 13;
              return LogsService.addEvents('service.error.refreshTokenByToken', {
                error: refreshResult === null || refreshResult === void 0 ? void 0 : refreshResult.error
              });
            case 13:
              return _context6.a(2, false);
            case 14:
              return _context6.a(2);
          }
        }, _callee6, this);
      }));
      function refreshTokenByToken(_x7) {
        return _refreshTokenByToken.apply(this, arguments);
      }
      return refreshTokenByToken;
    }()
  }, {
    key: "closeAuthSuccessTabs",
    value: function () {
      var _closeAuthSuccessTabs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(authDomains) {
        var _this2 = this;
        return _regenerator().w(function (_context7) {
          while (1) switch (_context7.n) {
            case 0:
              return _context7.a(2, new Promise(function (resolve, reject) {
                browserApi.tabs.query({}, function (tabs) {
                  if (browserApi.runtime.lastError) {
                    reject(browserApi.runtime.lastError);
                    return;
                  }
                  var tabsToRemove = [];
                  var atLeastOneRemoved = false;
                  if (_classPrivateFieldGet(_loginTabId, _this2)) {
                    var loginTab = tabs.find(function (tab) {
                      return tab.id === _classPrivateFieldGet(_loginTabId, _this2);
                    });
                    if (loginTab) {
                      tabsToRemove.push(loginTab);
                    }
                  }
                  var authTabs = tabs.filter(function (tab) {
                    return tab.url && authDomains.some(function (domain) {
                      return tab.url.startsWith("https://".concat(domain, "/auth/success"));
                    }) && (!_classPrivateFieldGet(_loginTabId, _this2) || tab.id !== _classPrivateFieldGet(_loginTabId, _this2));
                  });
                  tabsToRemove.push.apply(tabsToRemove, _toConsumableArray(authTabs));
                  if (tabsToRemove.length === 0) {
                    _classPrivateFieldSet(_loginTabId, _this2, null);
                    resolve();
                    return;
                  }
                  var pendingRemovals = tabsToRemove.length;
                  tabsToRemove.forEach(function (tab) {
                    browserApi.tabs.remove(tab.id, function () {
                      if (browserApi.runtime.lastError) {} else {
                        atLeastOneRemoved = true;
                        if (tab.id === _classPrivateFieldGet(_loginTabId, _this2)) {
                          _classPrivateFieldSet(_loginTabId, _this2, null);
                        }
                      }
                      pendingRemovals--;
                      if (pendingRemovals === 0) {
                        if (atLeastOneRemoved && !_classPrivateFieldGet(_hasNotified, _this2)) {
                          notifySuccessfulLogin();
                          _classPrivateFieldSet(_hasNotified, _this2, true);
                        }
                        resolve();
                      }
                    });
                  });
                });
              }));
          }
        }, _callee7);
      }));
      function closeAuthSuccessTabs(_x8) {
        return _closeAuthSuccessTabs.apply(this, arguments);
      }
      return closeAuthSuccessTabs;
    }()
  }, {
    key: "logout",
    value: function () {
      var _logout = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(sendResponse) {
        var data, username, password, serverDomain, request, generalSettings, settings;
        return _regenerator().w(function (_context8) {
          while (1) switch (_context8.n) {
            case 0:
              _context8.n = 1;
              return StorageService.getCurrentProxy();
            case 1:
              data = _context8.v;
              username = data.username;
              password = data.password;
              _context8.n = 2;
              return LogsService.addEvents('service.auth.logout');
            case 2:
              _context8.n = 3;
              return StorageService.getServerDomain();
            case 3:
              serverDomain = _context8.v;
              request = new HttpRequestApi(serverDomain);
              request.sendEndConnectRequest();
              _context8.n = 4;
              return StorageService.clearAuthData(true);
            case 4:
              _context8.n = 5;
              return StorageService.clearProxySettings();
            case 5:
              _classPrivateFieldSet(_loginTabId, this, null);
              _classPrivateFieldSet(_hasNotified, this, false);
              _classPrivateFieldSet(_isValidating, this, false);
              if (browserApi.isFireFoxBrowser()) {
                _context8.n = 7;
                break;
              }
              _context8.n = 6;
              return new Promise(function (resolve) {
                return browserApi.proxy.settings.clear({
                  scope: 'regular'
                }, resolve);
              });
            case 6:
              request.sendEndConnectRequest(username, password);
            case 7:
              _context8.n = 8;
              return StorageService.getGeneralSettings();
            case 8:
              generalSettings = _context8.v;
              if (generalSettings !== null && generalSettings !== void 0 && generalSettings.saveSettings) {
                _context8.n = 12;
                break;
              }
              _context8.n = 9;
              return StorageService.saveGeneralSettings({});
            case 9:
              _context8.n = 10;
              return StorageService.saveSettings({
                splitTunneling: true
              });
            case 10:
              _context8.n = 11;
              return StorageService.saveSecuritySettings({});
            case 11:
              _context8.n = 15;
              break;
            case 12:
              _context8.n = 13;
              return StorageService.getSettings();
            case 13:
              settings = _context8.v;
              _context8.n = 14;
              return StorageService.saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
                autoConnect: false
              }));
            case 14:
              _context8.n = 15;
              return StorageService.savePauseSetting({
                pause: false
              });
            case 15:
              sendResponse({
                success: true
              });
            case 16:
              return _context8.a(2);
          }
        }, _callee8, this);
      }));
      function logout(_x9) {
        return _logout.apply(this, arguments);
      }
      return logout;
    }()
  }, {
    key: "handleOpenLogin",
    value: function () {
      var _handleOpenLogin = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sendResponse) {
        var loginLink, _loginLink, _t5;
        return _regenerator().w(function (_context9) {
          while (1) switch (_context9.p = _context9.n) {
            case 0:
              _context9.p = 0;
              _context9.n = 1;
              return ApiClient.getAuthLinks();
            case 1:
              _context9.n = 2;
              return StorageService.getLoginLink();
            case 2:
              loginLink = _context9.v;
              if (loginLink) {
                _context9.n = 4;
                break;
              }
              _context9.n = 3;
              return StorageService.getLoginLink();
            case 3:
              loginLink = _context9.v;
            case 4:
              _assertClassBrand(_AuthManager_brand, this, _openLoginRegisterTab).call(this, loginLink, sendResponse);
              _context9.n = 7;
              break;
            case 5:
              _context9.p = 5;
              _t5 = _context9.v;
              _context9.n = 6;
              return StorageService.getLoginLink();
            case 6:
              _loginLink = _context9.v;
              _assertClassBrand(_AuthManager_brand, this, _openLoginRegisterTab).call(this, _loginLink, sendResponse);
            case 7:
              return _context9.a(2);
          }
        }, _callee9, this, [[0, 5]]);
      }));
      function handleOpenLogin(_x0) {
        return _handleOpenLogin.apply(this, arguments);
      }
      return handleOpenLogin;
    }()
  }, {
    key: "handleOpenRegistration",
    value: function () {
      var _handleOpenRegistration = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(sendResponse) {
        var registerLink, _registerLink, _t6;
        return _regenerator().w(function (_context0) {
          while (1) switch (_context0.p = _context0.n) {
            case 0:
              _context0.p = 0;
              _context0.n = 1;
              return LogsService.addEvents('service.handleOpenRegistration');
            case 1:
              _context0.n = 2;
              return ApiClient.getAuthLinks();
            case 2:
              _context0.n = 3;
              return StorageService.getRegisterLink();
            case 3:
              registerLink = _context0.v;
              if (registerLink) {
                _context0.n = 5;
                break;
              }
              _context0.n = 4;
              return StorageService.getRegisterLink();
            case 4:
              registerLink = _context0.v;
            case 5:
              _assertClassBrand(_AuthManager_brand, this, _openLoginRegisterTab).call(this, registerLink, sendResponse);
              _context0.n = 9;
              break;
            case 6:
              _context0.p = 6;
              _t6 = _context0.v;
              _context0.n = 7;
              return StorageService.getRegisterLink();
            case 7:
              _registerLink = _context0.v;
              _context0.n = 8;
              return LogsService.addEvents('service.error.handleOpenRegistration', _t6.message);
            case 8:
              _assertClassBrand(_AuthManager_brand, this, _openLoginRegisterTab).call(this, _registerLink, sendResponse);
            case 9:
              return _context0.a(2);
          }
        }, _callee0, this, [[0, 6]]);
      }));
      function handleOpenRegistration(_x1) {
        return _handleOpenRegistration.apply(this, arguments);
      }
      return handleOpenRegistration;
    }()
  }, {
    key: "handleTokenReceivedMessage",
    value: function () {
      var _handleTokenReceivedMessage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(message, sendResponse) {
        return _regenerator().w(function (_context1) {
          while (1) switch (_context1.n) {
            case 0:
              _context1.n = 1;
              return this.handleTokenReceived(message.token, message.refresh_token, sendResponse, _classPrivateFieldGet(_loginTabId, this), false, message.show_notification);
            case 1:
              websocket.updateWebSocketToken(message.token);
            case 2:
              return _context1.a(2);
          }
        }, _callee1, this);
      }));
      function handleTokenReceivedMessage(_x10, _x11) {
        return _handleTokenReceivedMessage.apply(this, arguments);
      }
      return handleTokenReceivedMessage;
    }()
  }, {
    key: "handleLogout",
    value: function () {
      var _handleLogout = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(sendResponse) {
        return _regenerator().w(function (_context10) {
          while (1) switch (_context10.n) {
            case 0:
              _context10.n = 1;
              return this.logout(sendResponse);
            case 1:
              _context10.n = 2;
              return updateIcon(false);
            case 2:
              websocket.closeWebSocket(false);
            case 3:
              return _context10.a(2);
          }
        }, _callee10, this);
      }));
      function handleLogout(_x12) {
        return _handleLogout.apply(this, arguments);
      }
      return handleLogout;
    }()
  }, {
    key: "isLoginTab",
    value: function isLoginTab(tabId) {
      return _classPrivateFieldGet(_loginTabId, this) === tabId;
    }
  }, {
    key: "clearLoginTab",
    value: function clearLoginTab() {
      _classPrivateFieldSet(_loginTabId, this, null);
    }
  }, {
    key: "handlePrivateLink",
    value: function () {
      var _handlePrivateLink = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(type, sendResponse) {
        var privateLink;
        return _regenerator().w(function (_context11) {
          while (1) switch (_context11.n) {
            case 0:
              privateLink = "";
              if (privateLink) {
                _context11.n = 3;
                break;
              }
              _context11.n = 1;
              return ApiClient.getPrivateLink(type);
            case 1:
              _context11.n = 2;
              return StorageService.getPrivateLink(type);
            case 2:
              privateLink = _context11.v;
              if (!privateLink) {
                privateLink = _assertClassBrand(_AuthManager_brand, this, _getFallbackLink).call(this, type);
              }
            case 3:
              browserApi.tabs.create({
                url: privateLink + "&fallback=1"
              }, function () {
                sendResponse({
                  success: true
                });
              });
            case 4:
              return _context11.a(2);
          }
        }, _callee11, this);
      }));
      function handlePrivateLink(_x13, _x14) {
        return _handlePrivateLink.apply(this, arguments);
      }
      return handlePrivateLink;
    }()
  }]);
}();
function _isTokenExpiredBySettledTime(jwt) {
  var parseToken = parseJwt(jwt);
  if (!parseToken || !parseToken.payload || !parseToken.payload.refresh_at) {
    return true;
  }
  return parseToken.payload.refresh_at * 1000 <= Date.now();
}
function _openLoginRegisterTab(link, sendResponse) {
  var _this3 = this;
  if (link) {
    var url = "".concat(link, "&fallback=1");
    browserApi.tabs.create({
      url: url
    }, function (tab) {
      _classPrivateFieldSet(_loginTabId, _this3, tab.id);
      sendResponse({
        success: true
      });
    });
  }
}
function _getFallbackLink(type) {
  var FALLBACK_LINKS = _defineProperty(_defineProperty({}, PRIVATE_LINKS_TYPES.DASHBOARD, "https://my.apexguard.com/account/dashboard"), PRIVATE_LINKS_TYPES.PRICING, "https://my.apexguard.com/pricing");
  return FALLBACK_LINKS[type];
}
var authManager = new AuthManager();
module.exports = {
  validateToken: authManager.validateToken.bind(authManager),
  refreshToken: authManager.refreshToken.bind(authManager),
  initializeAuth: authManager.initializeAuth.bind(authManager),
  startTokenRefreshWorkerByJwt: authManager.startTokenRefreshWorkerByJwt.bind(authManager),
  handleTokenReceived: authManager.handleTokenReceived.bind(authManager),
  logout: authManager.logout.bind(authManager),
  handleOpenLogin: authManager.handleOpenLogin.bind(authManager),
  handleOpenRegistration: authManager.handleOpenRegistration.bind(authManager),
  handlePrivateLink: authManager.handlePrivateLink.bind(authManager),
  handleTokenReceivedMessage: authManager.handleTokenReceivedMessage.bind(authManager),
  handleLogout: authManager.handleLogout.bind(authManager),
  isLoginTab: authManager.isLoginTab.bind(authManager),
  clearLoginTab: authManager.clearLoginTab.bind(authManager),
  refreshTokenByToken: authManager.refreshTokenByToken.bind(authManager)
};

/***/ }),

/***/ "./src/sw/main/auto_connect_with_retry.js":
/*!************************************************!*\
  !*** ./src/sw/main/auto_connect_with_retry.js ***!
  \************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var MAX_ATTEMPTS = 15;
var RETRY_INTERVAL = 1000;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  CONNECT = _require.CONNECT;
var utils = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js");
var _require2 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require2.PROXY_STATUSES;
var _require3 = __webpack_require__(/*! @common/functions/pause */ "./src/common/functions/pause.js"),
  pause = _require3.pause;
var _require4 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require4.log,
  LOG_LEVELS = _require4.LOG_LEVELS;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var isAutoConnectRunning = false;
function startAutoConnectWithRetryFromState(_x) {
  return _startAutoConnectWithRetryFromState.apply(this, arguments);
}
function _startAutoConnectWithRetryFromState() {
  _startAutoConnectWithRetryFromState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(handleInternalMessage) {
    var proxyStatus, pauseSetting, blockRequest, isConnected;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return StorageService.getProxyStatus();
        case 1:
          proxyStatus = _context.v;
          _context.n = 2;
          return StorageService.getPauseSetting();
        case 2:
          pauseSetting = _context.v;
          _context.n = 3;
          return StorageService.getBlockRequest();
        case 3:
          blockRequest = _context.v;
          if (!(pauseSetting.pause || blockRequest)) {
            _context.n = 4;
            break;
          }
          return _context.a(2);
        case 4:
          isConnected = proxyStatus === PROXY_STATUSES.CONNECT;
          if (isConnected) {
            _context.n = 5;
            break;
          }
          _context.n = 5;
          return startAutoConnectWithRetry(handleInternalMessage);
        case 5:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _startAutoConnectWithRetryFromState.apply(this, arguments);
}
function startAutoConnectWithRetry(_x2) {
  return _startAutoConnectWithRetry.apply(this, arguments);
}
function _startAutoConnectWithRetry() {
  _startAutoConnectWithRetry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(handleInternalMessage) {
    var _yield$Promise$all, _yield$Promise$all2, authData, settings, proxyStatus, anotherExtensionActive, disabledPermissionsExtension, pauseSettings, isConnected, blockConnect, attempts, _yield$Promise$all3, _yield$Promise$all4, authData1, settings1, proxyStatus1, securitySettings, success, _t;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.p = _context2.n) {
        case 0:
          _context2.n = 1;
          return Promise.all([StorageService.getAuthData(), StorageService.getSettings(), StorageService.getProxyStatus(), StorageService.getAnotherExtension(), StorageService.getDisabledPermissionsExtension(), StorageService.getPauseSetting()]);
        case 1:
          _yield$Promise$all = _context2.v;
          _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 6);
          authData = _yield$Promise$all2[0];
          settings = _yield$Promise$all2[1];
          proxyStatus = _yield$Promise$all2[2];
          anotherExtensionActive = _yield$Promise$all2[3];
          disabledPermissionsExtension = _yield$Promise$all2[4];
          pauseSettings = _yield$Promise$all2[5];
          isConnected = proxyStatus === PROXY_STATUSES.CONNECT;
          blockConnect = proxyStatus === PROXY_STATUSES.BLOCK_CONNECT;
          if (!(!shouldAutoConnect(settings, authData) || isConnected || blockConnect || anotherExtensionActive || pauseSettings !== null && pauseSettings !== void 0 && pauseSettings.pause || disabledPermissionsExtension)) {
            _context2.n = 2;
            break;
          }
          return _context2.a(2, false);
        case 2:
          if (!isAutoConnectRunning) {
            _context2.n = 4;
            break;
          }
          _context2.n = 3;
          return LogsService.addEvents('service.startAutoConnectWithRetry', 'Started auto connect');
        case 3:
          log(LOG_LEVELS.INFO, '⚠️ Started auto connect');
          return _context2.a(2);
        case 4:
          isAutoConnectRunning = true;
          attempts = 0;
          log(LOG_LEVELS.INFO, '▶️ Start autoconnect');
          _context2.p = 5;
        case 6:
          if (!(attempts < MAX_ATTEMPTS)) {
            _context2.n = 18;
            break;
          }
          attempts++;
          log(LOG_LEVELS.INFO, "try autoconnect ".concat(attempts, "/").concat(MAX_ATTEMPTS));
          _context2.n = 7;
          return LogsService.addEvents('service.startAutoConnectWithRetry', "try autoconnect ".concat(attempts, "/").concat(MAX_ATTEMPTS));
        case 7:
          _context2.n = 8;
          return Promise.all([StorageService.getAuthData(), StorageService.getSettings(), StorageService.getProxyStatus(), StorageService.getSecuritySettings()]);
        case 8:
          _yield$Promise$all3 = _context2.v;
          _yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 4);
          authData1 = _yield$Promise$all4[0];
          settings1 = _yield$Promise$all4[1];
          proxyStatus1 = _yield$Promise$all4[2];
          securitySettings = _yield$Promise$all4[3];
          if (shouldAutoConnect(settings1, authData1)) {
            _context2.n = 11;
            break;
          }
          _context2.n = 9;
          return StorageService.saveLoadConnectStatus(false);
        case 9:
          _context2.n = 10;
          return disableAutoConnect();
        case 10:
          return _context2.a(3, 18);
        case 11:
          if (!(proxyStatus1 === PROXY_STATUSES.CONNECT)) {
            _context2.n = 13;
            break;
          }
          _context2.n = 12;
          return StorageService.saveLoadConnectStatus(false);
        case 12:
          return _context2.a(3, 18);
        case 13:
          _context2.n = 14;
          return tryAutoConnectOnce(handleInternalMessage, settings, authData);
        case 14:
          success = _context2.v;
          if (!success) {
            _context2.n = 16;
            break;
          }
          _context2.n = 15;
          return utils.setThreatProtection(securitySettings.threatProtection || false, function () {});
        case 15:
          log(LOG_LEVELS.INFO, '✅ autoconnect!');
          return _context2.a(3, 18);
        case 16:
          _context2.n = 17;
          return pause(RETRY_INTERVAL);
        case 17:
          _context2.n = 6;
          break;
        case 18:
          if (!(attempts >= MAX_ATTEMPTS)) {
            _context2.n = 19;
            break;
          }
          _context2.n = 19;
          return disableAutoConnect();
        case 19:
          _context2.n = 21;
          break;
        case 20:
          _context2.p = 20;
          _t = _context2.v;
          _context2.n = 21;
          return LogsService.addEvents('service.error.startAutoConnectWithRetry', _t.message);
        case 21:
          _context2.p = 21;
          isAutoConnectRunning = false;
          log(LOG_LEVELS.INFO, '🏁 end autoconnect');
          return _context2.f(21);
        case 22:
          return _context2.a(2);
      }
    }, _callee2, null, [[5, 20, 21, 22]]);
  }));
  return _startAutoConnectWithRetry.apply(this, arguments);
}
function shouldAutoConnect(settings, authData) {
  return settings && settings.autoConnect && authData.jwt;
}
function tryAutoConnectOnce(_x3, _x4, _x5) {
  return _tryAutoConnectOnce.apply(this, arguments);
}
function _tryAutoConnectOnce() {
  _tryAutoConnectOnce = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(handleInternalMessage, settings, authData) {
    var countryName, result, _t2;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.p = _context3.n) {
        case 0:
          _context3.p = 0;
          if (shouldAutoConnect(settings, authData)) {
            _context3.n = 1;
            break;
          }
          return _context3.a(2, false);
        case 1:
          _context3.n = 2;
          return LogsService.addEvents('service.tryAutoConnectOnce');
        case 2:
          countryName = settings.selectedAutoConnectCountry;
          _context3.n = 3;
          return StorageService.saveLoadConnectStatus(true);
        case 3:
          _context3.n = 4;
          return new Promise(function (resolve) {
            LogsService.addEvents("action.send.".concat(CONNECT), {
              method_send: 'tryAutoConnectOnce'
            });
            handleInternalMessage({
              action: CONNECT,
              country: countryName,
              loggedIn: authData.loggedIn,
              token: authData.jwt
            }, function (res) {
              return resolve(res);
            });
          });
        case 4:
          result = _context3.v;
          if (!((result === null || result === void 0 ? void 0 : result.status) === PROXY_STATUSES.CONNECT || result !== null && result !== void 0 && result.success)) {
            _context3.n = 7;
            break;
          }
          if (settings.autoConnect) {
            _context3.n = 6;
            break;
          }
          _context3.n = 5;
          return StorageService.saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
            autoConnect: true
          }));
        case 5:
          _context3.n = 6;
          return StorageService.saveLoadConnectStatus(false);
        case 6:
          return _context3.a(2, true);
        case 7:
          _context3.n = 9;
          break;
        case 8:
          _context3.p = 8;
          _t2 = _context3.v;
          _context3.n = 9;
          return LogsService.addEvents('service.error.tryAutoConnectOnce', _t2.message);
        case 9:
          _context3.n = 10;
          return StorageService.saveLoadConnectStatus(false);
        case 10:
          return _context3.a(2, false);
      }
    }, _callee3, null, [[0, 8]]);
  }));
  return _tryAutoConnectOnce.apply(this, arguments);
}
function disableAutoConnect() {
  return _disableAutoConnect.apply(this, arguments);
}
function _disableAutoConnect() {
  _disableAutoConnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
    var settings;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.n) {
        case 0:
          _context4.n = 1;
          return StorageService.saveLoadConnectStatus(false);
        case 1:
          _context4.n = 2;
          return StorageService.getSettings();
        case 2:
          settings = _context4.v;
          _context4.n = 3;
          return StorageService.saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
            autoConnect: false
          }));
        case 3:
          return _context4.a(2);
      }
    }, _callee4);
  }));
  return _disableAutoConnect.apply(this, arguments);
}
module.exports = {
  startAutoConnectWithRetry: startAutoConnectWithRetry,
  startAutoConnectWithRetryFromState: startAutoConnectWithRetryFromState
};

/***/ }),

/***/ "./src/sw/main/error_handling_service.js":
/*!***********************************************!*\
  !*** ./src/sw/main/error_handling_service.js ***!
  \***********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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); }
var _require = __webpack_require__(/*! ./proxy */ "./src/sw/main/proxy.js"),
  proxyAuthHandler = _require.proxyAuthHandler,
  proxyErrorHandler = _require.proxyErrorHandler;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require2 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require2.log,
  LOG_LEVELS = _require2.LOG_LEVELS;
var _require3 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require3.PROXY_STATUSES;
var translateService = __webpack_require__(/*! @services/TranslateService */ "./src/common/services/TranslateService.js");
var _require4 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  enableForceKillSwitch = _require4.enableForceKillSwitch;
var _require5 = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js"),
  disconnectProxyWithUpdateState = _require5.disconnectProxyWithUpdateState;
var _require6 = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js"),
  updateIcon = _require6.updateIcon;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var ProxyListenerManager = /*#__PURE__*/function () {
  function ProxyListenerManager() {
    _classCallCheck(this, ProxyListenerManager);
    this.proxyAuthFailures = [];
    this.handleProxyAuthRequired = this.handleProxyAuthRequired.bind(this);
  }
  return _createClass(ProxyListenerManager, [{
    key: "handleProxyAuthRequired",
    value: function () {
      var _handleProxyAuthRequired = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(details, callback) {
        var url, isSystemUrl, _yield$Promise$all, _yield$Promise$all2, authData, currentProxy, proxyStatus, currentProxyData, now, filterTime, totalFailures, failuresForUrl, _this$proxyAuthFailur, _t;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              _context.p = 0;
              url = (details === null || details === void 0 ? void 0 : details.url) || '';
              isSystemUrl = false;
              try {
                isSystemUrl = url.startsWith('chrome://') || url.startsWith('edge://') || url.startsWith('about:') || url === 'about:blank';
              } catch (e) {
                log(LOG_LEVELS.WARN, '[Proxy Auth] URL check failed:', e);
                isSystemUrl = true;
              }
              if (!isSystemUrl) {
                _context.n = 2;
                break;
              }
              log(LOG_LEVELS.INFO, '[Proxy Auth] Skipping system URL:', url);
              _context.n = 1;
              return LogsService.addEvents('service.handle_proxy_auth_required', {
                url: url
              });
            case 1:
              callback({
                cancel: true
              });
              return _context.a(2);
            case 2:
              if (!(details.tabId === -1)) {
                _context.n = 3;
                break;
              }
              log(LOG_LEVELS.WARN, '[Proxy Auth] Background request (tabId: -1):', url);
              _context.n = 3;
              return LogsService.addEvents('service.background_proxy_auth_required', {
                url: url
              });
            case 3:
              _context.n = 4;
              return Promise.all([StorageService.getAuthData(), StorageService.getCurrentProxy()]);
            case 4:
              _yield$Promise$all = _context.v;
              _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
              authData = _yield$Promise$all2[0];
              currentProxy = _yield$Promise$all2[1];
              proxyStatus = (authData === null || authData === void 0 ? void 0 : authData.proxyStatus) || PROXY_STATUSES.DISCONNECT;
              currentProxyData = currentProxy || null;
              if (!((details === null || details === void 0 ? void 0 : details.statusCode) === 407)) {
                _context.n = 10;
                break;
              }
              now = Date.now();
              filterTime = 60000;
              this.proxyAuthFailures.push(now);
              this.proxyAuthFailures = this.proxyAuthFailures.filter(function (ts) {
                return now - ts <= filterTime;
              });
              if (!this.proxyAuthFailuresByUrl) this.proxyAuthFailuresByUrl = {};
              if (!this.proxyAuthFailuresByUrl[url]) this.proxyAuthFailuresByUrl[url] = [];
              this.proxyAuthFailuresByUrl[url].push(now);
              this.proxyAuthFailuresByUrl[url] = this.proxyAuthFailuresByUrl[url].filter(function (ts) {
                return now - ts <= filterTime;
              });
              totalFailures = this.proxyAuthFailures.length;
              failuresForUrl = this.proxyAuthFailuresByUrl[url].length;
              if (!(totalFailures > 30 || failuresForUrl > 10)) {
                _context.n = 10;
                break;
              }
              _context.n = 5;
              return LogsService.addEvents('service.too_many_proxy_auth_failures', {
                count: this === null || this === void 0 || (_this$proxyAuthFailur = this.proxyAuthFailures) === null || _this$proxyAuthFailur === void 0 ? void 0 : _this$proxyAuthFailur.length
              });
            case 5:
              this.proxyAuthFailures = [];
              _context.n = 6;
              return disconnectProxyWithUpdateState();
            case 6:
              _context.n = 7;
              return StorageService.saveProxyStatus('Error');
            case 7:
              _context.n = 8;
              return StorageService.saveProxyError(translateService.t('invalid_connect'));
            case 8:
              _context.n = 9;
              return updateIcon(false);
            case 9:
              callback({
                cancel: true
              });
              return _context.a(2);
            case 10:
              _context.n = 11;
              return proxyAuthHandler(details, callback, proxyStatus, currentProxyData);
            case 11:
              _context.n = 14;
              break;
            case 12:
              _context.p = 12;
              _t = _context.v;
              log(LOG_LEVELS.ERROR, '[Proxy Auth] Error fetching auth data:', _t, details);
              _context.n = 13;
              return LogsService.addEvents('service.error_fetching_auth_data', {}, _t === null || _t === void 0 ? void 0 : _t.message);
            case 13:
              callback({
                cancel: true
              });
            case 14:
              return _context.a(2);
          }
        }, _callee, this, [[0, 12]]);
      }));
      function handleProxyAuthRequired(_x, _x2) {
        return _handleProxyAuthRequired.apply(this, arguments);
      }
      return handleProxyAuthRequired;
    }()
  }, {
    key: "handleProxyError",
    value: function () {
      var _handleProxyError = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(details) {
        var authData, proxyStatus, _t2;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.p = _context2.n) {
            case 0:
              _context2.p = 0;
              _context2.n = 1;
              return StorageService.getAuthData();
            case 1:
              authData = _context2.v;
              proxyStatus = (authData === null || authData === void 0 ? void 0 : authData.proxyStatus) || PROXY_STATUSES.DISCONNECT;
              _context2.n = 2;
              return proxyErrorHandler(details, proxyStatus, enableForceKillSwitch);
            case 2:
              _context2.n = 5;
              break;
            case 3:
              _context2.p = 3;
              _t2 = _context2.v;
              log(LOG_LEVELS.ERROR, 'Error fetching data for proxy error handling:', _t2);
              _context2.n = 4;
              return LogsService.addEvents('service.error_fetching_proxy_data', {}, _t2 === null || _t2 === void 0 ? void 0 : _t2.message);
            case 4:
              _context2.n = 5;
              return proxyErrorHandler(details, PROXY_STATUSES.DISCONNECT, enableForceKillSwitch);
            case 5:
              return _context2.a(2);
          }
        }, _callee2, null, [[0, 3]]);
      }));
      function handleProxyError(_x3) {
        return _handleProxyError.apply(this, arguments);
      }
      return handleProxyError;
    }()
  }, {
    key: "initializeErrorListeners",
    value: function initializeErrorListeners() {
      if (browserApi.webRequest.onAuthRequired.hasListener(this.handleProxyAuthRequired)) {
        browserApi.webRequest.onAuthRequired.removeListener(this.handleProxyAuthRequired);
      }
      browserApi.webRequest.onAuthRequired.addListener(this.handleProxyAuthRequired, {
        urls: ["<all_urls>"]
      }, ["asyncBlocking"]);
      browserApi.registerProxyErrorListener(this.handleProxyError.bind(this));
    }
  }]);
}();
var proxyListenerManager = new ProxyListenerManager();
module.exports = {
  initializeErrorListeners: proxyListenerManager.initializeErrorListeners.bind(proxyListenerManager)
};

/***/ }),

/***/ "./src/sw/main/notification_service.js":
/*!*********************************************!*\
  !*** ./src/sw/main/notification_service.js ***!
  \*********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
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); }
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var translateService = __webpack_require__(/*! @services/TranslateService */ "./src/common/services/TranslateService.js");
var _require = __webpack_require__(/*! @services/CountrySelectorService */ "./src/common/services/CountrySelectorService.js"),
  CountrySelectorService = _require.CountrySelectorService;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require2 = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  CONNECT = _require2.CONNECT;
var _require3 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require3.log,
  LOG_LEVELS = _require3.LOG_LEVELS;
var _require4 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require4.PROXY_STATUSES;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
function createNotification(options, notificationId) {
  var defaultOptions = {
    type: 'basic',
    iconUrl: 'icon.png',
    priority: 0
  };
  var isFirefox = typeof browser !== 'undefined' && !!browser.runtime;
  var notificationOptions = _objectSpread(_objectSpread({}, defaultOptions), options);
  if (isFirefox) {
    delete notificationOptions.buttons;
  }
  var create = browserApi.notifications.create;
  try {
    if (isFirefox) {
      create(notificationId, notificationOptions)["catch"](function (err) {
        LogsService.addEvents('service.error_creating_notification', {}, err === null || err === void 0 ? void 0 : err.message);
      });
    } else {
      create(notificationId, notificationOptions, function (id) {
        if (chrome.runtime.lastError) {
          var _chrome;
          LogsService.addEvents('service.error_creating_notification', {}, (_chrome = chrome) === null || _chrome === void 0 || (_chrome = _chrome.runtime) === null || _chrome === void 0 ? void 0 : _chrome.lastError);
        }
      });
    }
  } catch (err) {
    LogsService.addEvents('service.error_creating_notification', {}, err === null || err === void 0 ? void 0 : err.message);
  }
}
function handleNotificationButtonClick(notificationId, buttonIndex, callback) {
  browserApi.notifications.onButtonClicked.addListener(function (id, btnIdx) {
    if (id === notificationId && btnIdx === buttonIndex) {
      callback();
      browserApi.notifications.clear(notificationId, function () {
        if (browserApi.runtime.lastError) {
          var _browserApi$runtime;
          log(LOG_LEVELS.ERROR, 'Error clearing notification:', browserApi.runtime.lastError);
          LogsService.addEvents('service.error_clearing_notification', {}, browserApi === null || browserApi === void 0 || (_browserApi$runtime = browserApi.runtime) === null || _browserApi$runtime === void 0 ? void 0 : _browserApi$runtime.lastError);
        } else {
          log(LOG_LEVELS.INFO, "Notification ".concat(notificationId, " cleared"));
        }
      });
    }
  });
}
function generateNotificationId(prefix) {
  return "".concat(prefix, "-").concat(Date.now());
}
function notifyVpnConnected() {
  createNotification({
    title: translateService.t('apexguard_connected'),
    message: translateService.t('apexguard_successfully_connected')
  }, generateNotificationId('vpn-connected'));
}
function notifyInsecureWebsite(handleInternalMessage) {
  var notificationId = generateNotificationId('insecure-website');
  createNotification({
    title: translateService.t('insecure_website_detected'),
    message: translateService.t('http_warning_message'),
    buttons: [{
      title: translateService.t('connect_to_vpn')
    }],
    priority: 2
  }, notificationId);
  handleNotificationButtonClick(notificationId, 0, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var authData, country, _t;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.p = _context.n) {
        case 0:
          _context.n = 1;
          return StorageService.getAuthData();
        case 1:
          authData = _context.v;
          if (authData.jwt) {
            _context.n = 2;
            break;
          }
          createNotification({
            title: translateService.t('connection_failed'),
            message: translateService.t('please_login_to_connect')
          }, generateNotificationId('no-token-error'));
          return _context.a(2);
        case 2:
          _context.n = 3;
          return CountrySelectorService.getRandomCountry();
        case 3:
          country = _context.v;
          _context.p = 4;
          _context.n = 5;
          return LogsService.addEvents("action.send.".concat(CONNECT), {
            method_send: 'handleNotificationButtonClick'
          });
        case 5:
          _context.n = 6;
          return handleInternalMessage({
            action: CONNECT,
            country: country,
            loggedIn: authData.loggedIn,
            token: authData.jwt
          }, function (res) {
            if ((res === null || res === void 0 ? void 0 : res.status) === PROXY_STATUSES.CONNECT) {
              notifyVpnConnected();
            }
          });
        case 6:
          _context.n = 8;
          break;
        case 7:
          _context.p = 7;
          _t = _context.v;
          createNotification({
            title: translateService.t('connection_failed'),
            message: translateService.t('failed_to_connect_vpn')
          }, generateNotificationId('vpn-error'));
        case 8:
          return _context.a(2);
      }
    }, _callee, null, [[4, 7]]);
  })));
}
function notifySessionExpiredOnce() {
  return _notifySessionExpiredOnce.apply(this, arguments);
}
function _notifySessionExpiredOnce() {
  _notifySessionExpiredOnce = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var alreadyShown;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          _context2.n = 1;
          return StorageService.getSessionExpiredNotified();
        case 1:
          alreadyShown = _context2.v;
          if (!alreadyShown) {
            _context2.n = 2;
            break;
          }
          return _context2.a(2);
        case 2:
          _context2.n = 3;
          return StorageService.saveSessionExpiredNotified(true);
        case 3:
          browserApi.notifications.create('session_expired', {
            type: 'basic',
            iconUrl: 'icon.png',
            title: translateService.t('session_expired_title', null, "Session Expired."),
            message: translateService.t('session_expired_message', null, "Your session has expired. Please log in again to continue using the service.")
          });
        case 4:
          return _context2.a(2);
      }
    }, _callee2);
  }));
  return _notifySessionExpiredOnce.apply(this, arguments);
}
function notifySuccessfulLogin() {
  browserApi.notifications.create({
    type: 'basic',
    iconUrl: 'icon.png',
    title: translateService.t('successful_login'),
    message: translateService.t('successfully_logged')
  });
}
module.exports = {
  notifyVpnConnected: notifyVpnConnected,
  notifyInsecureWebsite: notifyInsecureWebsite,
  notifySessionExpiredOnce: notifySessionExpiredOnce,
  notifySuccessfulLogin: notifySuccessfulLogin
};

/***/ }),

/***/ "./src/sw/main/ping_manager.js":
/*!*************************************!*\
  !*** ./src/sw/main/ping_manager.js ***!
  \*************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   checkPing: () => (/* binding */ checkPing),
/* harmony export */   initializePingAction: () => (/* binding */ initializePingAction),
/* harmony export */   sendPing: () => (/* binding */ sendPing)
/* harmony export */ });
/* harmony import */ var _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @services/HttpRequestApi */ "./src/common/services/HttpRequestApi.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
/* harmony import */ var _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_services_StorageService__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _sw_tools_log__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js");
/* harmony import */ var _sw_constants_statuses_constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js");
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../config */ "./config.js");
/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_config__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _services_LogsService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js");
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js");
/* harmony import */ var _sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_common_browserApi__WEBPACK_IMPORTED_MODULE_7__);
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }








var startPingInterval = function startPingInterval() {
  var isStopped = false;
  var _checkAndPing = /*#__PURE__*/function () {
    var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
      return _regenerator().w(function (_context) {
        while (1) switch (_context.n) {
          case 0:
            if (!isStopped) {
              _context.n = 1;
              break;
            }
            return _context.a(2);
          case 1:
            _context.n = 2;
            return sendPing();
          case 2:
            if (!isStopped) {
              setTimeout(_checkAndPing, (_config__WEBPACK_IMPORTED_MODULE_4___default().PING_TIMEOUT));
            }
          case 3:
            return _context.a(2);
        }
      }, _callee);
    }));
    return function checkAndPing() {
      return _ref.apply(this, arguments);
    };
  }();
  var initialTimeout = setTimeout(_checkAndPing, 5000);
  return function () {
    isStopped = true;
    clearTimeout(initialTimeout);
  };
};
function initializePingAction() {
  try {
    return startPingInterval();
  } catch (error) {
    _services_LogsService__WEBPACK_IMPORTED_MODULE_5__["default"].addEvents('error.failed_to_initialize_auto-connect', error === null || error === void 0 ? void 0 : error.message);
    return null;
  }
}
function sendPing() {
  return _sendPing.apply(this, arguments);
}
function _sendPing() {
  _sendPing = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var authData, isLoggedIn, isConnected, blockRequest, currentProxy, serverDomain, httpRequestApi, result, _t;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.p = _context2.n) {
        case 0:
          _context2.p = 0;
          _context2.n = 1;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getAuthData();
        case 1:
          authData = _context2.v;
          isLoggedIn = !!(authData !== null && authData !== void 0 && authData.jwt);
          isConnected = (authData === null || authData === void 0 ? void 0 : authData.proxyStatus) === _sw_constants_statuses_constants__WEBPACK_IMPORTED_MODULE_3__.PROXY_STATUSES.CONNECT;
          _context2.n = 2;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getBlockRequest();
        case 2:
          blockRequest = _context2.v;
          if (!(isLoggedIn && isConnected && !blockRequest)) {
            _context2.n = 8;
            break;
          }
          _context2.n = 3;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getCurrentProxy();
        case 3:
          currentProxy = _context2.v;
          _context2.n = 4;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().getServerDomain();
        case 4:
          serverDomain = _context2.v;
          httpRequestApi = new _services_HttpRequestApi__WEBPACK_IMPORTED_MODULE_0__.HttpRequestApi(serverDomain);
          _context2.n = 5;
          return httpRequestApi.sendPingConnectRequest(currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.username, currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.password);
        case 5:
          result = _context2.v;
          _context2.n = 6;
          return checkPing(result, currentProxy, httpRequestApi);
        case 6:
          if (!_context2.v) {
            _context2.n = 7;
            break;
          }
          (0,_sw_tools_log__WEBPACK_IMPORTED_MODULE_2__.log)(_sw_tools_log__WEBPACK_IMPORTED_MODULE_2__.LOG_LEVELS.INFO, 'Ping sent successfully');
          _context2.n = 7;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_5__["default"].addEvents('action.success.checkAndPing');
        case 7:
          _context2.n = 9;
          break;
        case 8:
          (0,_sw_tools_log__WEBPACK_IMPORTED_MODULE_2__.log)(_sw_tools_log__WEBPACK_IMPORTED_MODULE_2__.LOG_LEVELS.INFO, 'Ping skipped: conditions not met', {
            isLoggedIn: isLoggedIn,
            isConnected: isConnected
          });
        case 9:
          _context2.n = 11;
          break;
        case 10:
          _context2.p = 10;
          _t = _context2.v;
          (0,_sw_tools_log__WEBPACK_IMPORTED_MODULE_2__.log)(_sw_tools_log__WEBPACK_IMPORTED_MODULE_2__.LOG_LEVELS.ERROR, 'Ping or auth check failed:', _t);
        case 11:
          return _context2.a(2);
      }
    }, _callee2, null, [[0, 10]]);
  }));
  return _sendPing.apply(this, arguments);
}
function checkPing(_x, _x2, _x3) {
  return _checkPing.apply(this, arguments);
}
function _checkPing() {
  _checkPing = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(response, currentProxy, httpRequestApi) {
    var isOnline, newResult, pingResponse, _t2, _t3;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.n) {
        case 0:
          isOnline = _common_browserApi__WEBPACK_IMPORTED_MODULE_7___default().isFireFoxBrowser() ? navigator.onLine : true;
          if (isOnline) {
            _context3.n = 1;
            break;
          }
          return _context3.a(2, false);
        case 1:
          _t2 = !response;
          if (_t2) {
            _context3.n = 4;
            break;
          }
          _t3 = (response === null || response === void 0 ? void 0 : response.status) === 502;
          if (!_t3) {
            _context3.n = 3;
            break;
          }
          _context3.n = 2;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().isExistApiGateways();
        case 2:
          _t3 = _context3.v;
        case 3:
          _t2 = _t3;
        case 4:
          if (!_t2) {
            _context3.n = 11;
            break;
          }
          _context3.n = 5;
          return httpRequestApi.sendPingConnectRequest(currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.username, currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.password);
        case 5:
          newResult = _context3.v;
          _context3.n = 6;
          return fetch("https://".concat(_sw_constants_api_urls__WEBPACK_IMPORTED_MODULE_6__.API_URLS.QUICK_PING_IP));
        case 6:
          pingResponse = _context3.v;
          if (!((!newResult || (response === null || response === void 0 ? void 0 : response.status) === 502) && pingResponse.ok)) {
            _context3.n = 9;
            break;
          }
          _context3.n = 7;
          return _services_StorageService__WEBPACK_IMPORTED_MODULE_1___default().saveIsNeedUpdateApiDomain(true);
        case 7:
          _context3.n = 8;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_5__["default"].addEvents('action.error.checkAndPing', {
            newResult: newResult,
            pingResponse: pingResponse
          }, 'Error in ping. Changed apiGateway');
        case 8:
          return _context3.a(2, false);
        case 9:
          if (pingResponse.ok) {
            _context3.n = 11;
            break;
          }
          _context3.n = 10;
          return _services_LogsService__WEBPACK_IMPORTED_MODULE_5__["default"].addEvents('action.error.checkAndPing', {
            newResult: newResult,
            pingResponse: pingResponse
          }, 'Error in ping. Network is not connected');
        case 10:
          return _context3.a(2, false);
        case 11:
          return _context3.a(2, true);
      }
    }, _callee3);
  }));
  return _checkPing.apply(this, arguments);
}

/***/ }),

/***/ "./src/sw/main/proxy.js":
/*!******************************!*\
  !*** ./src/sw/main/proxy.js ***!
  \******************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! ../tools/utils */ "./src/sw/tools/utils.js"),
  updateIcon = _require.updateIcon;
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require2 = __webpack_require__(/*! @sw/main/auth */ "./src/sw/main/auth.js"),
  handleTokenReceived = _require2.handleTokenReceived;
var ApiClient = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
var _require3 = __webpack_require__(/*! @services/HttpRequestApi */ "./src/common/services/HttpRequestApi.js"),
  sendEndConnectRequestByServer = _require3.sendEndConnectRequestByServer,
  HttpRequestApi = _require3.HttpRequestApi;
var translateService = __webpack_require__(/*! @services/TranslateService */ "./src/common/services/TranslateService.js");
var _require4 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require4.log,
  LOG_LEVELS = _require4.LOG_LEVELS;
var _require5 = __webpack_require__(/*! @common/functions/generateDeviceId */ "./src/common/functions/generateDeviceId.js"),
  generateDeviceIdForProxyServer = _require5.generateDeviceIdForProxyServer;
var _require6 = __webpack_require__(/*! @sw/constants/default_urls_constants */ "./src/sw/constants/default_urls_constants.js"),
  DEF_PAST_URL_LIST = _require6.DEF_PAST_URL_LIST,
  CURRENT_PASS_URL_DOMAINS = _require6.CURRENT_PASS_URL_DOMAINS;
var _require7 = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  CONNECT = _require7.CONNECT;
var _require8 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require8.PROXY_STATUSES;
var _require9 = __webpack_require__(/*! @common/functions/pause */ "./src/common/functions/pause.js"),
  pause = _require9.pause;
var _require0 = __webpack_require__(/*! @common/functions/updateFirefoxProxyListener */ "./src/common/functions/updateFirefoxProxyListener.js"),
  updateFirefoxProxyListener = _require0.updateFirefoxProxyListener,
  clearFirefoxProxyListener = _require0.clearFirefoxProxyListener;
var _require1 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  handleDisconnect = _require1.handleDisconnect;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var PROXY_CURRENT_PASS_URL_DOMAINS = CURRENT_PASS_URL_DOMAINS;
var BAD_PROXY_ERRORS = ['net::ERR_TUNNEL_CONNECTION_FAILED', 'net::ERR_PROXY_CONNECTION_FAILED', 'net::ERR_PROXY_AUTH_UNSUPPORTED', 'net::ERR_EMPTY_RESPONSE'];
var excludedPrefixes = ['chrome://', 'about:', 'moz-extension://', 'edge://'];
function initializeDomains() {
  return _initializeDomains.apply(this, arguments);
}
function _initializeDomains() {
  _initializeDomains = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var auth_domain, array_domains;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return StorageService.getAuthDomains();
        case 1:
          auth_domain = _context.v;
          array_domains = [].concat(_toConsumableArray(PROXY_CURRENT_PASS_URL_DOMAINS), _toConsumableArray(auth_domain));
          PROXY_CURRENT_PASS_URL_DOMAINS = _toConsumableArray(new Set(array_domains));
        case 2:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _initializeDomains.apply(this, arguments);
}
initializeDomains()["catch"](function (err) {
  log(LOG_LEVELS.ERROR, 'Failed to initialize domains:', err);
  LogsService.addEvents('service.initializeDomainsProxy', err === null || err === void 0 ? void 0 : err.message);
});
function reloadAllTabs() {
  return _reloadAllTabs.apply(this, arguments);
}
function _reloadAllTabs() {
  _reloadAllTabs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var tabs, _t;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.p = _context2.n) {
        case 0:
          _context2.p = 0;
          _context2.n = 1;
          return browserApi.tabs.query({});
        case 1:
          tabs = _context2.v;
          _context2.n = 2;
          return Promise.all(tabs.filter(function (tab) {
            return tab.url && !excludedPrefixes.some(function (prefix) {
              return tab.url.startsWith(prefix);
            });
          }).map(function (tab) {
            return browserApi.tabs.reload(tab.id, {
              bypassCache: true
            });
          }));
        case 2:
          log(LOG_LEVELS.INFO, '[Proxy] All tabs reloaded successfully');
          _context2.n = 3;
          return LogsService.addEvents('service.reloadAllTabsProxy');
        case 3:
          _context2.n = 5;
          break;
        case 4:
          _context2.p = 4;
          _t = _context2.v;
          log(LOG_LEVELS.ERROR, '[Proxy] Error reloading tabs:', _t);
          _context2.n = 5;
          return LogsService.addEvents('service.error.reloadAllTabsProxy', _t === null || _t === void 0 ? void 0 : _t.message);
        case 5:
          return _context2.a(2);
      }
    }, _callee2, null, [[0, 4]]);
  }));
  return _reloadAllTabs.apply(this, arguments);
}
function resetProxySettings(_x) {
  return _resetProxySettings.apply(this, arguments);
}
function _resetProxySettings() {
  _resetProxySettings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(handleInternalMessage) {
    var proxyStatus, isConnected, authData, lastSelectedCountry, result, _t2;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.p = _context3.n) {
        case 0:
          _context3.p = 0;
          _context3.n = 1;
          return LogsService.addEvents('service.resetProxySettings');
        case 1:
          _context3.n = 2;
          return StorageService.getProxyStatus();
        case 2:
          proxyStatus = _context3.v;
          isConnected = proxyStatus === PROXY_STATUSES.CONNECT;
          if (!isConnected) {
            _context3.n = 12;
            break;
          }
          if (!browserApi.isFireFoxBrowser()) {
            _context3.n = 9;
            break;
          }
          _context3.n = 3;
          return StorageService.getAuthData();
        case 3:
          authData = _context3.v;
          if (!handleInternalMessage) {
            _context3.n = 8;
            break;
          }
          _context3.n = 4;
          return StorageService.getSelectedCountry();
        case 4:
          lastSelectedCountry = _context3.v;
          _context3.n = 5;
          return StorageService.saveLoadConnectStatus(true);
        case 5:
          _context3.n = 6;
          return new Promise(function (resolve) {
            LogsService.addEvents("action.send.".concat(CONNECT), {
              method_send: 'resetProxySettings'
            });
            handleInternalMessage({
              action: CONNECT,
              country: lastSelectedCountry,
              loggedIn: authData.loggedIn,
              token: authData.jwt
            }, function (res) {
              return resolve(res);
            });
          });
        case 6:
          result = _context3.v;
          if (!((result === null || result === void 0 ? void 0 : result.status) === PROXY_STATUSES.CONNECT || result !== null && result !== void 0 && result.success)) {
            _context3.n = 7;
            break;
          }
          updateIcon(true);
          _context3.n = 8;
          break;
        case 7:
          _context3.n = 8;
          return disconnectedAfterReset();
        case 8:
          _context3.n = 11;
          break;
        case 9:
          _context3.n = 10;
          return pause(500);
        case 10:
          updateIcon(true);
        case 11:
          _context3.n = 13;
          break;
        case 12:
          _context3.n = 13;
          return disconnectedAfterReset();
        case 13:
          _context3.n = 14;
          return StorageService.saveLoadConnectStatus(false);
        case 14:
          _context3.n = 15;
          return StorageService.saveBlockRequest(false);
        case 15:
          _context3.n = 16;
          return StorageService.saveCancelConnect(false);
        case 16:
          _context3.n = 17;
          return StorageService.saveProcessDisconnect(false);
        case 17:
          _context3.n = 18;
          return StorageService.saveNotClosedSession(false);
        case 18:
          _context3.n = 19;
          return StorageService.saveIsNewProxyDomain(false);
        case 19:
          _context3.n = 20;
          return StorageService.saveIsNeedUpdateApiDomain(false);
        case 20:
          _context3.n = 21;
          return StorageService.saveIsApiGatewayMainAfterCheck(false);
        case 21:
          _context3.n = 23;
          break;
        case 22:
          _context3.p = 22;
          _t2 = _context3.v;
          _context3.n = 23;
          return LogsService.addEvents('service.error.resetProxySettings', _t2 === null || _t2 === void 0 ? void 0 : _t2.message);
        case 23:
          return _context3.a(2);
      }
    }, _callee3, null, [[0, 22]]);
  }));
  return _resetProxySettings.apply(this, arguments);
}
function disconnectedAfterReset() {
  return _disconnectedAfterReset.apply(this, arguments);
}
function _disconnectedAfterReset() {
  _disconnectedAfterReset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.n) {
        case 0:
          if (!browserApi.isFireFoxBrowser()) {
            _context4.n = 2;
            break;
          }
          _context4.n = 1;
          return clearFirefoxProxyListener();
        case 1:
          _context4.n = 3;
          break;
        case 2:
          _context4.n = 3;
          return browserApi.proxy.settings.clear({
            scope: 'regular'
          });
        case 3:
          _context4.n = 4;
          return sendEndConnectRequestByServer();
        case 4:
          _context4.n = 5;
          return updateIcon(false);
        case 5:
          _context4.n = 6;
          return StorageService.clearProxySettings();
        case 6:
          return _context4.a(2);
      }
    }, _callee4);
  }));
  return _disconnectedAfterReset.apply(this, arguments);
}
function getBypassList(settings) {
  var ignoreSettings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  return (ignoreSettings || settings.splitTunneling) && settings.splitTunnelingList && settings.splitTunnelingList.length ? [].concat(_toConsumableArray(DEF_PAST_URL_LIST), _toConsumableArray(settings.splitTunnelingList)) : DEF_PAST_URL_LIST;
}
function setProxyFirefox(_x2, _x3) {
  return _setProxyFirefox.apply(this, arguments);
}
function _setProxyFirefox() {
  _setProxyFirefox = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(callback, options) {
    var _options$host, host, _options$port, port, _options$country, country, _options$lat, lat, _options$lon, lon, _options$timeZone, timeZone, _options$offset, offset, _options$username, username, _options$password, password, scheme, settings, bypassList, abortController, changedProxyDomain, proxyForClose, currentProxy, result, authToken, refreshToken, statusResult, isNeedUpdateApiDomain, request, _settings, _t3, _t4, _t5, _t6;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.p = _context6.n) {
        case 0:
          _options$host = options.host, host = _options$host === void 0 ? null : _options$host, _options$port = options.port, port = _options$port === void 0 ? null : _options$port, _options$country = options.country, country = _options$country === void 0 ? null : _options$country, _options$lat = options.lat, lat = _options$lat === void 0 ? null : _options$lat, _options$lon = options.lon, lon = _options$lon === void 0 ? null : _options$lon, _options$timeZone = options.timeZone, timeZone = _options$timeZone === void 0 ? null : _options$timeZone, _options$offset = options.offset, offset = _options$offset === void 0 ? null : _options$offset, _options$username = options.username, username = _options$username === void 0 ? null : _options$username, _options$password = options.password, password = _options$password === void 0 ? null : _options$password;
          scheme = 'https';
          _context6.n = 1;
          return StorageService.getSettings();
        case 1:
          _t3 = _context6.v;
          if (_t3) {
            _context6.n = 2;
            break;
          }
          _t3 = {};
        case 2:
          settings = _t3;
          bypassList = getBypassList(settings);
          log(LOG_LEVELS.INFO, '[Proxy] Setting proxy with:', {
            host: host,
            port: port,
            username: username,
            password: password
          });
          _context6.n = 3;
          return LogsService.addEvents('service.setProxyFirefox', {
            host: host,
            port: port,
            country: country
          });
        case 3:
          abortController = new AbortController();
          browserApi.storage.onChanged.addListener(/*#__PURE__*/function () {
            var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(details) {
              var _details$cancelConnec;
              return _regenerator().w(function (_context5) {
                while (1) switch (_context5.n) {
                  case 0:
                    if ((_details$cancelConnec = details.cancelConnect) !== null && _details$cancelConnec !== void 0 && _details$cancelConnec.newValue) {
                      abortController.abort('manual disconnect');
                    }
                  case 1:
                    return _context5.a(2);
                }
              }, _callee5);
            }));
            return function (_x19) {
              return _ref.apply(this, arguments);
            };
          }());
          _context6.p = 4;
          _context6.n = 5;
          return StorageService.saveBlockRequest(true);
        case 5:
          _context6.n = 6;
          return updateFirefoxProxyListener({
            scheme: scheme,
            host: host,
            port: port,
            bypassList: bypassList
          });
        case 6:
          _context6.n = 7;
          return StorageService.getIsNewProxyDomain();
        case 7:
          changedProxyDomain = _context6.v;
          _context6.n = 8;
          return StorageService.getCurrentProxy();
        case 8:
          proxyForClose = _context6.v;
          currentProxy = {
            scheme: scheme,
            host: host,
            port: port,
            username: username || "",
            password: password || "",
            country: country,
            lat: lat,
            lon: lon,
            timeZone: timeZone,
            offset: offset
          };
          _context6.n = 9;
          return StorageService.saveProxySettings({
            proxyStatus: PROXY_STATUSES.CONNECT,
            proxyError: null,
            currentProxy: currentProxy
          });
        case 9:
          _context6.n = 10;
          return checkManualCancelConnectAndDisconnect(callback);
        case 10:
          if (!_context6.v) {
            _context6.n = 11;
            break;
          }
          return _context6.a(2);
        case 11:
          browserApi.proxy.onError.addListener(function (error) {
            log(LOG_LEVELS.ERROR, "Firefox Proxy Error:", error);
            LogsService.addEvents('service.error.setProxyFirefox', error === null || error === void 0 ? void 0 : error.message);
          });
          _context6.n = 12;
          return StorageService.saveLoadConnectStatus(true);
        case 12:
          _context6.n = 13;
          return StorageService.saveBlockRequest(false);
        case 13:
          _context6.n = 14;
          return pause(500);
        case 14:
          _context6.n = 15;
          return checkManualCancelConnectAndDisconnect(callback);
        case 15:
          if (!_context6.v) {
            _context6.n = 16;
            break;
          }
          return _context6.a(2);
        case 16:
          _context6.n = 17;
          return ApiClient.getDomainForUpdate(Date.now(), currentProxy.country, abortController);
        case 17:
          result = _context6.v;
          if (result) {
            _context6.n = 20;
            break;
          }
          _context6.n = 18;
          return StorageService.saveIsNeedUpdateApiDomain(true);
        case 18:
          _context6.n = 19;
          return updateIcon(false);
        case 19:
          return _context6.a(2);
        case 20:
          _context6.n = 21;
          return checkManualCancelConnectAndDisconnect(callback);
        case 21:
          if (!_context6.v) {
            _context6.n = 22;
            break;
          }
          return _context6.a(2);
        case 22:
          _context6.n = 23;
          return pause(1000);
        case 23:
          _context6.n = 24;
          return checkManualCancelConnectAndDisconnect(callback);
        case 24:
          if (!_context6.v) {
            _context6.n = 25;
            break;
          }
          return _context6.a(2);
        case 25:
          _context6.n = 26;
          return StorageService.getToken();
        case 26:
          _t4 = _context6.v;
          if (_t4) {
            _context6.n = 27;
            break;
          }
          _t4 = "";
        case 27:
          authToken = _t4;
          _context6.n = 28;
          return StorageService.getRefreshToken();
        case 28:
          _t5 = _context6.v;
          if (_t5) {
            _context6.n = 29;
            break;
          }
          _t5 = "";
        case 29:
          refreshToken = _t5;
          _context6.n = 30;
          return handleTokenReceived(authToken, refreshToken, callback, null, false, false, abortController);
        case 30:
          statusResult = _context6.v;
          _context6.n = 31;
          return checkManualCancelConnectAndDisconnect(callback);
        case 31:
          if (!_context6.v) {
            _context6.n = 32;
            break;
          }
          return _context6.a(2);
        case 32:
          if (!statusResult) {
            _context6.n = 39;
            break;
          }
          _context6.n = 33;
          return StorageService.getIsNeedUpdateApiDomain();
        case 33:
          isNeedUpdateApiDomain = _context6.v;
          if (!isNeedUpdateApiDomain) {
            _context6.n = 34;
            break;
          }
          return _context6.a(2);
        case 34:
          _context6.n = 35;
          return StorageService.saveSelectedCountry(country);
        case 35:
          _context6.n = 36;
          return StorageService.saveSelectedAutoConnectCountry(country);
        case 36:
          _context6.n = 37;
          return StorageService.addToLastCountries(country);
        case 37:
          _context6.n = 38;
          return updateIcon(true);
        case 38:
          _context6.n = 41;
          break;
        case 39:
          _context6.n = 40;
          return clearFirefoxProxyListener();
        case 40:
          _context6.n = 41;
          return handleTokenReceived(authToken, refreshToken, callback, null);
        case 41:
          if (!changedProxyDomain) {
            _context6.n = 43;
            break;
          }
          _context6.n = 42;
          return StorageService.saveIsNewProxyDomain(false);
        case 42:
          request = new HttpRequestApi(proxyForClose.host);
          request.sendEndConnectRequest(proxyForClose.username, proxyForClose.password, true);
        case 43:
          _context6.n = 44;
          return StorageService.getSettings();
        case 44:
          _settings = _context6.v;
          if (!(_settings.locationSpoofing && _settings.autoReloadTabs)) {
            _context6.n = 45;
            break;
          }
          _context6.n = 45;
          return reloadAllTabs();
        case 45:
          _context6.n = 46;
          return StorageService.saveLoadConnectStatus(false);
        case 46:
          _context6.n = 47;
          return StorageService.saveIsApiGatewayMainAfterCheck(false);
        case 47:
          _context6.n = 51;
          break;
        case 48:
          _context6.p = 48;
          _t6 = _context6.v;
          _context6.n = 49;
          return StorageService.saveLoadConnectStatus(false);
        case 49:
          _context6.n = 50;
          return clearDataForProxy(callback, translateService.t('invalid_connect'));
        case 50:
          _context6.n = 51;
          return LogsService.addEvents('service.error.setProxyFirefoxAll', _t6 === null || _t6 === void 0 ? void 0 : _t6.message);
        case 51:
          return _context6.a(2);
      }
    }, _callee6, null, [[4, 48]]);
  }));
  return _setProxyFirefox.apply(this, arguments);
}
function setProxy(_x4, _x5) {
  return _setProxy.apply(this, arguments);
}
function _setProxy() {
  _setProxy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(callback, options) {
    var currentProxy, authToken, refreshToken, abortController, configPac, changedProxyDomain, proxyForClose, _t0, _t1;
    return _regenerator().w(function (_context9) {
      while (1) switch (_context9.n) {
        case 0:
          currentProxy = _objectSpread(_objectSpread({}, options), {}, {
            scheme: 'https'
          });
          _context9.n = 1;
          return StorageService.saveIsNeedUpdateApiDomain(false);
        case 1:
          _context9.n = 2;
          return StorageService.getToken();
        case 2:
          _t0 = _context9.v;
          if (_t0) {
            _context9.n = 3;
            break;
          }
          _t0 = "";
        case 3:
          authToken = _t0;
          _context9.n = 4;
          return StorageService.getRefreshToken();
        case 4:
          _t1 = _context9.v;
          if (_t1) {
            _context9.n = 5;
            break;
          }
          _t1 = "";
        case 5:
          refreshToken = _t1;
          log(LOG_LEVELS.INFO, '[Proxy] Setting proxy with:', currentProxy);
          _context9.n = 6;
          return LogsService.addEvents('service.setProxy', {
            host: currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.host,
            port: currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.port
          });
        case 6:
          abortController = new AbortController();
          browserApi.storage.onChanged.addListener(/*#__PURE__*/function () {
            var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(details) {
              var _details$cancelConnec2;
              return _regenerator().w(function (_context7) {
                while (1) switch (_context7.n) {
                  case 0:
                    if ((_details$cancelConnec2 = details.cancelConnect) !== null && _details$cancelConnec2 !== void 0 && _details$cancelConnec2.newValue) {
                      abortController.abort('manual disconnect');
                    }
                  case 1:
                    return _context7.a(2);
                }
              }, _callee7);
            }));
            return function (_x20) {
              return _ref2.apply(this, arguments);
            };
          }());
          _context9.n = 7;
          return checkManualCancelConnectAndDisconnect(callback);
        case 7:
          if (!_context9.v) {
            _context9.n = 8;
            break;
          }
          return _context9.a(2);
        case 8:
          _context9.n = 9;
          return StorageService.saveBlockRequest(true);
        case 9:
          _context9.n = 10;
          return StorageService.saveLoadConnectStatus(true);
        case 10:
          _context9.n = 11;
          return buildPacScript(currentProxy);
        case 11:
          configPac = _context9.v;
          _context9.n = 12;
          return StorageService.getIsNewProxyDomain();
        case 12:
          changedProxyDomain = _context9.v;
          _context9.n = 13;
          return StorageService.getCurrentProxy();
        case 13:
          proxyForClose = _context9.v;
          _context9.n = 14;
          return StorageService.saveProxySettings({
            proxyStatus: PROXY_STATUSES.CONNECT,
            proxyError: null,
            currentProxy: currentProxy
          });
        case 14:
          browserApi.proxy.settings.set({
            value: configPac,
            scope: 'regular'
          }, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
            var result, authTokenNew, refreshTokenNew, statusResult, proxyStatus, isNeedUpdateApiDomain, request, settings, _t7, _t8, _t9;
            return _regenerator().w(function (_context8) {
              while (1) switch (_context8.p = _context8.n) {
                case 0:
                  _context8.n = 1;
                  return StorageService.saveBlockRequest(false);
                case 1:
                  if (!browserApi.runtime.lastError) {
                    _context8.n = 4;
                    break;
                  }
                  log(LOG_LEVELS.ERROR, 'Proxy setup error:', browserApi.runtime.lastError.message);
                  _context8.n = 2;
                  return StorageService.saveProxySettings({
                    proxyStatus: 'Error',
                    proxyError: browserApi.runtime.lastError.message,
                    currentProxy: null
                  });
                case 2:
                  callback({
                    success: false,
                    status: 'Error',
                    error: browserApi.runtime.lastError.message,
                    manualDisconnect: true
                  });
                  _context8.n = 3;
                  return StorageService.saveLoadConnectStatus(false);
                case 3:
                  _context8.n = 39;
                  break;
                case 4:
                  _context8.p = 4;
                  _context8.n = 5;
                  return checkManualCancelConnectAndDisconnect(callback);
                case 5:
                  if (!_context8.v) {
                    _context8.n = 6;
                    break;
                  }
                  return _context8.a(2);
                case 6:
                  _context8.n = 7;
                  return ApiClient.getDomainForUpdate(Date.now(), currentProxy.country, abortController);
                case 7:
                  result = _context8.v;
                  if (result) {
                    _context8.n = 10;
                    break;
                  }
                  _context8.n = 8;
                  return StorageService.saveIsNeedUpdateApiDomain(true);
                case 8:
                  _context8.n = 9;
                  return updateIcon(false);
                case 9:
                  return _context8.a(2);
                case 10:
                  _context8.n = 11;
                  return checkManualCancelConnectAndDisconnect(callback);
                case 11:
                  if (!_context8.v) {
                    _context8.n = 12;
                    break;
                  }
                  return _context8.a(2);
                case 12:
                  _context8.n = 13;
                  return pause(1000);
                case 13:
                  _context8.n = 14;
                  return checkManualCancelConnectAndDisconnect(callback);
                case 14:
                  if (!_context8.v) {
                    _context8.n = 15;
                    break;
                  }
                  return _context8.a(2);
                case 15:
                  _context8.n = 16;
                  return StorageService.getToken();
                case 16:
                  _t7 = _context8.v;
                  if (_t7) {
                    _context8.n = 17;
                    break;
                  }
                  _t7 = "";
                case 17:
                  authTokenNew = _t7;
                  _context8.n = 18;
                  return StorageService.getRefreshToken();
                case 18:
                  _t8 = _context8.v;
                  if (_t8) {
                    _context8.n = 19;
                    break;
                  }
                  _t8 = "";
                case 19:
                  refreshTokenNew = _t8;
                  _context8.n = 20;
                  return handleTokenReceived(authTokenNew, refreshTokenNew, callback, null, false, false, abortController);
                case 20:
                  statusResult = _context8.v;
                  if (!statusResult) {
                    _context8.n = 27;
                    break;
                  }
                  _context8.n = 21;
                  return StorageService.getProxyStatus();
                case 21:
                  proxyStatus = _context8.v;
                  if (!(proxyStatus === PROXY_STATUSES.ERROR)) {
                    _context8.n = 23;
                    break;
                  }
                  _context8.n = 22;
                  return StorageService.clearProxySettings();
                case 22:
                  updateIcon(false);
                  return _context8.a(2);
                case 23:
                  _context8.n = 24;
                  return StorageService.getIsNeedUpdateApiDomain();
                case 24:
                  isNeedUpdateApiDomain = _context8.v;
                  if (!isNeedUpdateApiDomain) {
                    _context8.n = 25;
                    break;
                  }
                  return _context8.a(2);
                case 25:
                  updateIcon(true);
                  _context8.n = 26;
                  return updateCountryInfo(currentProxy.country);
                case 26:
                  _context8.n = 30;
                  break;
                case 27:
                  _context8.n = 28;
                  return checkManualCancelConnectAndDisconnect(callback);
                case 28:
                  if (!_context8.v) {
                    _context8.n = 29;
                    break;
                  }
                  return _context8.a(2);
                case 29:
                  _context8.n = 30;
                  return handleTokenReceived(authToken, refreshToken, callback, null);
                case 30:
                  if (!changedProxyDomain) {
                    _context8.n = 32;
                    break;
                  }
                  request = new HttpRequestApi(proxyForClose.host);
                  _context8.n = 31;
                  return StorageService.saveIsNewProxyDomain(false);
                case 31:
                  request.sendEndConnectRequest(proxyForClose.username, proxyForClose.password, true);
                case 32:
                  _context8.n = 33;
                  return StorageService.getSettings();
                case 33:
                  settings = _context8.v;
                  if (!(settings.locationSpoofing && settings.autoReloadTabs)) {
                    _context8.n = 34;
                    break;
                  }
                  _context8.n = 34;
                  return reloadAllTabs();
                case 34:
                  _context8.n = 37;
                  break;
                case 35:
                  _context8.p = 35;
                  _t9 = _context8.v;
                  _context8.n = 36;
                  return clearDataForProxy(callback, translateService.t('invalid_connect'));
                case 36:
                  _context8.n = 37;
                  return LogsService.addEvents('service.error.setProxy', _t9 === null || _t9 === void 0 ? void 0 : _t9.message);
                case 37:
                  _context8.n = 38;
                  return StorageService.saveLoadConnectStatus(false);
                case 38:
                  _context8.n = 39;
                  return StorageService.saveIsApiGatewayMainAfterCheck(false);
                case 39:
                  return _context8.a(2);
              }
            }, _callee8, null, [[4, 35]]);
          })));
        case 15:
          return _context9.a(2);
      }
    }, _callee9);
  }));
  return _setProxy.apply(this, arguments);
}
function updateCountryInfo(_x6) {
  return _updateCountryInfo.apply(this, arguments);
}
function _updateCountryInfo() {
  _updateCountryInfo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(country) {
    return _regenerator().w(function (_context0) {
      while (1) switch (_context0.n) {
        case 0:
          _context0.n = 1;
          return Promise.all([StorageService.saveSelectedCountry(country), StorageService.saveSelectedAutoConnectCountry(country), StorageService.addToLastCountries(country)]);
        case 1:
          return _context0.a(2);
      }
    }, _callee0);
  }));
  return _updateCountryInfo.apply(this, arguments);
}
function clearDataForProxy(_x7, _x8) {
  return _clearDataForProxy.apply(this, arguments);
}
function _clearDataForProxy() {
  _clearDataForProxy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(callback, message) {
    return _regenerator().w(function (_context1) {
      while (1) switch (_context1.n) {
        case 0:
          _context1.n = 1;
          return StorageService.saveProxySettings({
            proxyStatus: 'Error',
            proxyError: message,
            currentProxy: null
          });
        case 1:
          callback({
            success: false,
            status: 'Error',
            error: message
          });
        case 2:
          return _context1.a(2);
      }
    }, _callee1);
  }));
  return _clearDataForProxy.apply(this, arguments);
}
function proxyAuthHandler(_x9, _x0, _x1, _x10) {
  return _proxyAuthHandler.apply(this, arguments);
}
function _proxyAuthHandler() {
  _proxyAuthHandler = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(details, callback, proxyStatus, currentProxy) {
    var isActualProxyRequest, deviceId, name, _t10;
    return _regenerator().w(function (_context10) {
      while (1) switch (_context10.p = _context10.n) {
        case 0:
          log(LOG_LEVELS.INFO, '[Proxy Auth] Proxy auth handler called:', {
            details: details,
            url: details.url,
            proxyStatus: proxyStatus,
            currentProxy: currentProxy ? {
              host: currentProxy.host,
              port: currentProxy.port,
              username: currentProxy.username,
              password: currentProxy.password,
              country: currentProxy.country
            } : null
          });
          _context10.n = 1;
          return LogsService.addEvents('service.proxyAuthHandler', {
            host: currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.host,
            port: currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.port
          });
        case 1:
          isActualProxyRequest = details.challenger && currentProxy && details.challenger.host === currentProxy.host && details.challenger.port === currentProxy.port;
          if (!(proxyStatus === PROXY_STATUSES.CONNECT && isActualProxyRequest && currentProxy.username && currentProxy.password)) {
            _context10.n = 7;
            break;
          }
          _context10.p = 2;
          _context10.n = 3;
          return generateDeviceIdForProxyServer();
        case 3:
          deviceId = _context10.v;
          name = deviceId + "|" + currentProxy.username + "|" + (currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.host);
          callback({
            authCredentials: {
              username: name,
              password: currentProxy.password
            }
          });
          _context10.n = 6;
          break;
        case 4:
          _context10.p = 4;
          _t10 = _context10.v;
          _context10.n = 5;
          return LogsService.addEvents('service.error.proxyAuthHandler', _t10.message);
        case 5:
          log(LOG_LEVELS.ERROR, '[Proxy Auth] Error generating deviceId:', _t10);
          callback({
            cancel: true
          });
        case 6:
          _context10.n = 8;
          break;
        case 7:
          if (details.statusCode === 401) {
            callback({
              authCredentials: null
            });
          } else {
            callback({
              cancel: true
            });
          }
        case 8:
          return _context10.a(2);
      }
    }, _callee10, null, [[2, 4]]);
  }));
  return _proxyAuthHandler.apply(this, arguments);
}
function proxyErrorHandler(_x11, _x12, _x13) {
  return _proxyErrorHandler.apply(this, arguments);
}
function _proxyErrorHandler() {
  _proxyErrorHandler = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(details, proxyStatus, enableKillSwitch) {
    return _regenerator().w(function (_context11) {
      while (1) switch (_context11.n) {
        case 0:
          _context11.n = 1;
          return LogsService.addEvents('service.proxyErrorHandler', {
            error: details.error,
            proxyStatus: proxyStatus
          });
        case 1:
          if (!(proxyStatus === PROXY_STATUSES.CONNECT)) {
            _context11.n = 4;
            break;
          }
          _context11.n = 2;
          return StorageService.saveProxyStatus('Error');
        case 2:
          _context11.n = 3;
          return StorageService.saveProxyError(details.error);
        case 3:
          if (BAD_PROXY_ERRORS.includes(details.error) || details.error.includes('NS_ERROR')) {
            browserApi.notifications.create({
              type: 'basic',
              iconUrl: 'icon.png',
              title: 'ApexGuard: Proxy Error',
              message: "Failed to connect to proxy: ".concat(details.error)
            });
            enableKillSwitch();
          }
        case 4:
          return _context11.a(2);
      }
    }, _callee11);
  }));
  return _proxyErrorHandler.apply(this, arguments);
}
function buildPacScript(_x14) {
  return _buildPacScript.apply(this, arguments);
}
function _buildPacScript() {
  _buildPacScript = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(currentProxy) {
    var settings, bypassList, _t11;
    return _regenerator().w(function (_context12) {
      while (1) switch (_context12.n) {
        case 0:
          _context12.n = 1;
          return StorageService.getSettings();
        case 1:
          _t11 = _context12.v;
          if (_t11) {
            _context12.n = 2;
            break;
          }
          _t11 = {};
        case 2:
          settings = _t11;
          bypassList = getBypassList(settings);
          return _context12.a(2, {
            mode: 'fixed_servers',
            rules: {
              singleProxy: {
                scheme: currentProxy.scheme,
                host: currentProxy.host,
                port: parseInt(currentProxy.port)
              },
              bypassList: bypassList
            }
          });
      }
    }, _callee12);
  }));
  return _buildPacScript.apply(this, arguments);
}
function updateBypassList(_x15) {
  return _updateBypassList.apply(this, arguments);
}
function _updateBypassList() {
  _updateBypassList = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14(callback) {
    var currentProxy, proxyStatus, settings, bypassList, _settings2, configPac, _t12, _t13;
    return _regenerator().w(function (_context14) {
      while (1) switch (_context14.p = _context14.n) {
        case 0:
          _context14.n = 1;
          return StorageService.getCurrentProxy();
        case 1:
          currentProxy = _context14.v;
          _context14.n = 2;
          return StorageService.getProxyStatus();
        case 2:
          proxyStatus = _context14.v;
          _context14.n = 3;
          return LogsService.addEvents('service.updateBypassListInit');
        case 3:
          if (!(proxyStatus !== PROXY_STATUSES.CONNECT || !currentProxy || !currentProxy.host)) {
            _context14.n = 5;
            break;
          }
          _context14.n = 4;
          return LogsService.addEvents('service.updateBypassList', {
            host: currentProxy.host,
            post: currentProxy.host,
            status: proxyStatus
          });
        case 4:
          log(LOG_LEVELS.INFO, 'Cannot update bypassList: Proxy is not connected');
          callback && callback({
            success: false,
            error: 'Cannot update bypassList: Proxy is not connected',
            status: proxyStatus
          });
          return _context14.a(2);
        case 5:
          _context14.n = 6;
          return StorageService.getSettings();
        case 6:
          _t12 = _context14.v;
          if (_t12) {
            _context14.n = 7;
            break;
          }
          _t12 = {};
        case 7:
          settings = _t12;
          bypassList = getBypassList(settings);
          if (!browserApi.isFireFoxBrowser()) {
            _context14.n = 17;
            break;
          }
          _context14.p = 8;
          _context14.n = 9;
          return LogsService.addEvents('service.updateBypassListFirefox', {
            host: currentProxy.host,
            post: currentProxy.host,
            status: proxyStatus
          });
        case 9:
          log(LOG_LEVELS.INFO, 'proxy.settings.setproxy.settings.setproxy.settings.setproxy.settings.setproxy.settings.set');
          _context14.n = 10;
          return StorageService.saveBlockRequest(true);
        case 10:
          _context14.n = 11;
          return updateFirefoxProxyListener({
            scheme: currentProxy.scheme,
            host: currentProxy.host,
            port: currentProxy.port,
            bypassList: bypassList
          });
        case 11:
          _context14.n = 12;
          return StorageService.saveBlockRequest(false);
        case 12:
          _context14.n = 13;
          return StorageService.getSettings();
        case 13:
          _settings2 = _context14.v;
          if (!(_settings2.locationSpoofing && _settings2.autoReloadTabs)) {
            _context14.n = 14;
            break;
          }
          _context14.n = 14;
          return reloadAllTabs();
        case 14:
          callback && callback({
            success: true,
            status: PROXY_STATUSES.CONNECT
          });
          _context14.n = 16;
          break;
        case 15:
          _context14.p = 15;
          _t13 = _context14.v;
          callback({
            success: false,
            status: 'Error',
            error: _t13.message
          });
          _context14.n = 16;
          return LogsService.addEvents('service.error.updateBypassListFirefox', {
            error: _t13.message
          });
        case 16:
          return _context14.a(2);
        case 17:
          _context14.n = 18;
          return buildPacScript(currentProxy);
        case 18:
          configPac = _context14.v;
          _context14.n = 19;
          return StorageService.saveBlockRequest(true);
        case 19:
          browserApi.proxy.settings.set({
            value: configPac,
            scope: 'regular'
          }, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13() {
            var _settings3;
            return _regenerator().w(function (_context13) {
              while (1) switch (_context13.n) {
                case 0:
                  _context13.n = 1;
                  return StorageService.saveBlockRequest(false);
                case 1:
                  if (!browserApi.runtime.lastError) {
                    _context13.n = 3;
                    break;
                  }
                  _context13.n = 2;
                  return LogsService.addEvents('service.error.updateBypassList', {
                    error: browserApi.runtime.lastError.message
                  });
                case 2:
                  callback && callback({
                    success: false,
                    status: proxyStatus,
                    error: browserApi.runtime.lastError.message
                  });
                  _context13.n = 6;
                  break;
                case 3:
                  _context13.n = 4;
                  return StorageService.getSettings();
                case 4:
                  _settings3 = _context13.v;
                  if (!(_settings3.locationSpoofing && _settings3.autoReloadTabs)) {
                    _context13.n = 5;
                    break;
                  }
                  _context13.n = 5;
                  return reloadAllTabs();
                case 5:
                  callback && callback({
                    success: true,
                    status: proxyStatus
                  });
                case 6:
                  return _context13.a(2);
              }
            }, _callee13);
          })));
        case 20:
          return _context14.a(2);
      }
    }, _callee14, null, [[8, 15]]);
  }));
  return _updateBypassList.apply(this, arguments);
}
function connectProxyByParams(_x16, _x17) {
  return _connectProxyByParams.apply(this, arguments);
}
function _connectProxyByParams() {
  _connectProxyByParams = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee15(sendResponse, proxy) {
    return _regenerator().w(function (_context15) {
      while (1) switch (_context15.n) {
        case 0:
          _context15.n = 1;
          return LogsService.addEvents('service.connectProxyByParams');
        case 1:
          _context15.n = 2;
          return StorageService.existToken();
        case 2:
          if (!_context15.v) {
            _context15.n = 7;
            break;
          }
          if (!browserApi.isFireFoxBrowser()) {
            _context15.n = 4;
            break;
          }
          _context15.n = 3;
          return setProxyFirefox(sendResponse, proxy);
        case 3:
          return _context15.a(2, _context15.v);
        case 4:
          _context15.n = 5;
          return setProxy(sendResponse, proxy);
        case 5:
          return _context15.a(2, _context15.v);
        case 6:
          _context15.n = 9;
          break;
        case 7:
          sendResponse({
            success: false,
            error: translateService.t('error_not_logged_in'),
            status: translateService.t('error_not_logged_in')
          });
          _context15.n = 8;
          return LogsService.addEvents('service.error.connectProxyByParams', {
            error: translateService.t('error_not_logged_in')
          });
        case 8:
          return _context15.a(2, null);
        case 9:
          return _context15.a(2);
      }
    }, _callee15);
  }));
  return _connectProxyByParams.apply(this, arguments);
}
function checkManualCancelConnectAndDisconnectWithForce() {
  return _checkManualCancelConnectAndDisconnectWithForce.apply(this, arguments);
}
function _checkManualCancelConnectAndDisconnectWithForce() {
  _checkManualCancelConnectAndDisconnectWithForce = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee16() {
    var _t14;
    return _regenerator().w(function (_context16) {
      while (1) switch (_context16.p = _context16.n) {
        case 0:
          _context16.p = 0;
          _context16.n = 1;
          return LogsService.addEvents('service.checkManualCancelConnectAndDisconnectWithForce');
        case 1:
          _context16.n = 2;
          return StorageService.getCancelConnect();
        case 2:
          if (!_context16.v) {
            _context16.n = 5;
            break;
          }
          _context16.n = 3;
          return StorageService.saveForceCancelConnect(true);
        case 3:
          _context16.n = 4;
          return disconnectProxyWithUpdateState();
        case 4:
          return _context16.a(2, true);
        case 5:
          _context16.n = 6;
          return StorageService.saveForceCancelConnect(false);
        case 6:
          _context16.n = 7;
          return StorageService.saveCancelConnect(false);
        case 7:
          _context16.n = 8;
          return StorageService.saveLoadConnectStatus(false);
        case 8:
          _context16.n = 9;
          return StorageService.saveProcessDisconnect(false);
        case 9:
          _context16.n = 10;
          return StorageService.saveNotClosedSession(false);
        case 10:
          _context16.n = 11;
          return StorageService.saveIsApiGatewayMainAfterCheck(false);
        case 11:
          return _context16.a(2, true);
        case 12:
          _context16.p = 12;
          _t14 = _context16.v;
          _context16.n = 13;
          return LogsService.addEvents('service.error.checkManualCancelConnectAndDisconnectWithForce', {
            error: _t14.message
          });
        case 13:
          return _context16.a(2, false);
      }
    }, _callee16, null, [[0, 12]]);
  }));
  return _checkManualCancelConnectAndDisconnectWithForce.apply(this, arguments);
}
function checkManualCancelConnectAndDisconnect() {
  return _checkManualCancelConnectAndDisconnect.apply(this, arguments);
}
function _checkManualCancelConnectAndDisconnect() {
  _checkManualCancelConnectAndDisconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
    var callback,
      forceDisconnect,
      forceCancel,
      _args17 = arguments,
      _t15,
      _t16;
    return _regenerator().w(function (_context17) {
      while (1) switch (_context17.n) {
        case 0:
          callback = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : function () {};
          forceDisconnect = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : false;
          _context17.n = 1;
          return StorageService.getForceCancelConnect();
        case 1:
          forceCancel = _context17.v;
          _context17.n = 2;
          return StorageService.getCancelConnect();
        case 2:
          _t16 = _context17.v;
          if (_t16) {
            _context17.n = 3;
            break;
          }
          _t16 = forceCancel;
        case 3:
          _t15 = _t16;
          if (_t15) {
            _context17.n = 4;
            break;
          }
          _t15 = forceDisconnect;
        case 4:
          if (!_t15) {
            _context17.n = 16;
            break;
          }
          _context17.n = 5;
          return StorageService.saveForceCancelConnect(false);
        case 5:
          if (forceCancel) {
            _context17.n = 10;
            break;
          }
          if (!forceDisconnect) {
            _context17.n = 7;
            break;
          }
          _context17.n = 6;
          return disconnectProxyWithUpdateState(function () {}, false, true, true, true);
        case 6:
          _context17.n = 8;
          break;
        case 7:
          _context17.n = 8;
          return disconnectProxyWithUpdateState(function () {}, false, true, true);
        case 8:
          _context17.n = 9;
          return StorageService.saveLoadConnectStatus(false);
        case 9:
          callback({
            success: false,
            status: PROXY_STATUSES.DISCONNECT,
            manualDisconnect: true
          });
        case 10:
          _context17.n = 11;
          return StorageService.saveCancelConnect(false);
        case 11:
          _context17.n = 12;
          return StorageService.saveForceCancelConnect(false);
        case 12:
          _context17.n = 13;
          return StorageService.saveProcessDisconnect(false);
        case 13:
          _context17.n = 14;
          return StorageService.saveNotClosedSession(false);
        case 14:
          _context17.n = 15;
          return StorageService.saveIsApiGatewayMainAfterCheck(false);
        case 15:
          return _context17.a(2, true);
        case 16:
          return _context17.a(2, false);
      }
    }, _callee17);
  }));
  return _checkManualCancelConnectAndDisconnect.apply(this, arguments);
}
function clearKillSwitch(_x18) {
  return _clearKillSwitch.apply(this, arguments);
}
function _clearKillSwitch() {
  _clearKillSwitch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee19(callback) {
    var authData, generalSettings, _t17, _t18, _t19, _t20;
    return _regenerator().w(function (_context19) {
      while (1) switch (_context19.p = _context19.n) {
        case 0:
          _context19.n = 1;
          return StorageService.getAuthData();
        case 1:
          authData = _context19.v;
          _context19.n = 2;
          return StorageService.getGeneralSettings();
        case 2:
          generalSettings = _context19.v;
          _context19.n = 3;
          return LogsService.addEvents('service.clearKillSwitch');
        case 3:
          _t17 = authData.proxyStatus === PROXY_STATUSES.KILL_SWITCH;
          if (_t17) {
            _context19.n = 7;
            break;
          }
          _t18 = !authData.loggedIn;
          if (!_t18) {
            _context19.n = 6;
            break;
          }
          _context19.n = 4;
          return StorageService.getSettingsKillSwitch();
        case 4:
          _t19 = _context19.v;
          if (_t19) {
            _context19.n = 5;
            break;
          }
          _t19 = browserApi.isFireFoxBrowser() && !generalSettings.saveSettings;
        case 5:
          _t18 = _t19;
        case 6:
          _t17 = _t18;
        case 7:
          if (!_t17) {
            _context19.n = 16;
            break;
          }
          if (!browserApi.isFireFoxBrowser()) {
            _context19.n = 15;
            break;
          }
          _context19.p = 8;
          _context19.n = 9;
          return clearFirefoxProxyListener();
        case 9:
          _context19.n = 10;
          return StorageService.clearProxyStorage();
        case 10:
          _context19.n = 11;
          return updateIcon(false);
        case 11:
          callback && callback({
            status: PROXY_STATUSES.DISCONNECT
          });
          _context19.n = 14;
          break;
        case 12:
          _context19.p = 12;
          _t20 = _context19.v;
          _context19.n = 13;
          return LogsService.addEvents('service.error.clearKillSwitch', _t20.message);
        case 13:
          log(LOG_LEVELS.ERROR, 'Firefox clearKillSwitch error:', _t20);
        case 14:
          _context19.n = 16;
          break;
        case 15:
          browserApi.proxy.settings.clear({
            scope: 'regular'
          }, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
            return _regenerator().w(function (_context18) {
              while (1) switch (_context18.n) {
                case 0:
                  _context18.n = 1;
                  return StorageService.clearProxyStorage();
                case 1:
                  _context18.n = 2;
                  return updateIcon(false);
                case 2:
                  callback && callback({
                    status: PROXY_STATUSES.DISCONNECT
                  });
                case 3:
                  return _context18.a(2);
              }
            }, _callee18);
          })));
        case 16:
          return _context19.a(2);
      }
    }, _callee19, null, [[8, 12]]);
  }));
  return _clearKillSwitch.apply(this, arguments);
}
function disconnectProxyWithUpdateState() {
  return _disconnectProxyWithUpdateState.apply(this, arguments);
}
function _disconnectProxyWithUpdateState() {
  _disconnectProxyWithUpdateState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee20() {
    var sendResponse,
      disconnect_with_error,
      ignore_status_killswitch,
      isCheckCancel,
      manual_disconnect,
      _args20 = arguments,
      _t21,
      _t22;
    return _regenerator().w(function (_context20) {
      while (1) switch (_context20.p = _context20.n) {
        case 0:
          sendResponse = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : function () {};
          disconnect_with_error = _args20.length > 1 && _args20[1] !== undefined ? _args20[1] : false;
          ignore_status_killswitch = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : true;
          isCheckCancel = _args20.length > 3 && _args20[3] !== undefined ? _args20[3] : false;
          manual_disconnect = _args20.length > 4 && _args20[4] !== undefined ? _args20[4] : false;
          _context20.p = 1;
          if (isCheckCancel) {
            _context20.n = 3;
            break;
          }
          _context20.n = 2;
          return StorageService.saveProcessDisconnect(Date.now());
        case 2:
          _context20.n = 4;
          break;
        case 3:
          '';
        case 4:
          _context20.n = 5;
          return handleDisconnect(sendResponse, disconnect_with_error, ignore_status_killswitch, isCheckCancel, manual_disconnect);
        case 5:
          _t21 = ApiClient;
          _context20.n = 6;
          return StorageService.getToken();
        case 6:
          _context20.n = 7;
          return _t21.getMyIP.call(_t21, _context20.v);
        case 7:
          _context20.n = 8;
          return LogsService.addEvents('service.disconnectProxyWithUpdateState');
        case 8:
          _context20.n = 10;
          break;
        case 9:
          _context20.p = 9;
          _t22 = _context20.v;
        case 10:
          _context20.p = 10;
          _context20.n = 11;
          return StorageService.saveProcessDisconnect(false);
        case 11:
          _context20.n = 12;
          return StorageService.saveCancelDisconnect(false);
        case 12:
          _context20.n = 13;
          return StorageService.saveLoadConnectStatus(false);
        case 13:
          _context20.n = 14;
          return StorageService.saveIsApiGatewayMainAfterCheck(false);
        case 14:
          return _context20.f(10);
        case 15:
          return _context20.a(2);
      }
    }, _callee20, null, [[1, 9, 10, 15]]);
  }));
  return _disconnectProxyWithUpdateState.apply(this, arguments);
}
module.exports = {
  resetProxySettings: resetProxySettings,
  proxyAuthHandler: proxyAuthHandler,
  proxyErrorHandler: proxyErrorHandler,
  connectProxyByParams: connectProxyByParams,
  updateBypassList: updateBypassList,
  checkManualCancelConnectAndDisconnect: checkManualCancelConnectAndDisconnect,
  checkManualCancelConnectAndDisconnectWithForce: checkManualCancelConnectAndDisconnectWithForce,
  clearKillSwitch: clearKillSwitch,
  disconnectProxyWithUpdateState: disconnectProxyWithUpdateState,
  reloadAllTabs: reloadAllTabs
};

/***/ }),

/***/ "./src/sw/main/tab_management_service.js":
/*!***********************************************!*\
  !*** ./src/sw/main/tab_management_service.js ***!
  \***********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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 _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var auth = __webpack_require__(/*! ./auth */ "./src/sw/main/auth.js");
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  DISCONNECT = _require.DISCONNECT,
  LOGIN_SUCCESS = _require.LOGIN_SUCCESS;
var _require2 = __webpack_require__(/*! @sw/content/injectScript */ "./src/sw/content/injectScript.js"),
  injectScript = _require2.injectScript;
var _require3 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require3.log,
  LOG_LEVELS = _require3.LOG_LEVELS;
var _require4 = __webpack_require__(/*! @sw/tools/common */ "./src/sw/tools/common.js"),
  checkUserUid = _require4.checkUserUid;
var ApiClient = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
var _require5 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require5.PROXY_STATUSES;
var _require6 = __webpack_require__(/*! @common/functions/pause */ "./src/common/functions/pause.js"),
  pause = _require6.pause;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var _authDomains = /*#__PURE__*/new WeakMap();
var _injectedTabs = /*#__PURE__*/new WeakMap();
var _injectedTabsByLogin = /*#__PURE__*/new WeakMap();
var _cachedSpoofedData = /*#__PURE__*/new WeakMap();
var _isInitializing = /*#__PURE__*/new WeakMap();
var _excludedPrefixes = /*#__PURE__*/new WeakMap();
var _handleInternalMessage = /*#__PURE__*/new WeakMap();
var _TabListenerManager_brand = /*#__PURE__*/new WeakSet();
var TabListenerManager = /*#__PURE__*/function () {
  function TabListenerManager() {
    _classCallCheck(this, TabListenerManager);
    _classPrivateMethodInitSpec(this, _TabListenerManager_brand);
    _classPrivateFieldInitSpec(this, _authDomains, []);
    _classPrivateFieldInitSpec(this, _injectedTabs, new Set());
    _classPrivateFieldInitSpec(this, _injectedTabsByLogin, new Set());
    _classPrivateFieldInitSpec(this, _cachedSpoofedData, null);
    _classPrivateFieldInitSpec(this, _isInitializing, false);
    _classPrivateFieldInitSpec(this, _excludedPrefixes, ['chrome://', 'about:', 'edge://', 'moz-extension://']);
    _classPrivateFieldInitSpec(this, _handleInternalMessage, function () {});
    _assertClassBrand(_TabListenerManager_brand, this, _initializeDomains).call(this);
    _assertClassBrand(_TabListenerManager_brand, this, _initializeSpoofedData).call(this);
  }
  return _createClass(TabListenerManager, [{
    key: "makeSpoofGeo",
    value: function () {
      var _makeSpoofGeo = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(tab) {
        return _regenerator().w(function (_context) {
          while (1) switch (_context.n) {
            case 0:
              if (!(tab !== null && tab !== void 0 && tab.url && !_classPrivateFieldGet(_excludedPrefixes, this).some(function (p) {
                return tab.url.startsWith(p);
              }))) {
                _context.n = 1;
                break;
              }
              _context.n = 1;
              return _assertClassBrand(_TabListenerManager_brand, this, _injectSpoofedData).call(this, tab.id);
            case 1:
              return _context.a(2);
          }
        }, _callee, this);
      }));
      function makeSpoofGeo(_x) {
        return _makeSpoofGeo.apply(this, arguments);
      }
      return makeSpoofGeo;
    }()
  }, {
    key: "handleTabCreated",
    value: function handleTabCreated(tab) {
      LogsService.addEvents('service.handleTabCreated');
      if (tab !== null && tab !== void 0 && tab.url && !_classPrivateFieldGet(_excludedPrefixes, this).some(function (p) {
        return tab.url.startsWith(p);
      })) {
        this.makeSpoofGeo(tab);
      }
      if (!_classPrivateFieldGet(_authDomains, this) || !_classPrivateFieldGet(_authDomains, this).length) {
        _assertClassBrand(_TabListenerManager_brand, this, _initializeDomains).call(this);
      }
      if (tab.url && _classPrivateFieldGet(_authDomains, this).some(function (domain) {
        return tab.url.includes("https://".concat(domain, "/auth/success"));
      }) && !_classPrivateFieldGet(_injectedTabsByLogin, this).has(tab.id)) {
        var token = this.extractExchangeToken(tab.url);
        if (token) {
          _classPrivateFieldGet(_injectedTabsByLogin, this).add(tab.id);
        }
        this.checkToken(token);
      }
    }
  }, {
    key: "checkToken",
    value: function () {
      var _checkToken = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(token) {
        var _exchangeData$data, exchangeData, data, storedHash, _t;
        return _regenerator().w(function (_context2) {
          while (1) switch (_context2.p = _context2.n) {
            case 0:
              _context2.p = 0;
              _context2.n = 1;
              return LogsService.addEvents('service.checkToken', {
                token: !!token
              });
            case 1:
              _context2.n = 2;
              return ApiClient.getAuthToken(token);
            case 2:
              exchangeData = _context2.v;
              data = exchangeData === null || exchangeData === void 0 || (_exchangeData$data = exchangeData.data) === null || _exchangeData$data === void 0 ? void 0 : _exchangeData$data.data;
              if (!(data !== null && data !== void 0 && data.access_token && data !== null && data !== void 0 && data.refresh_token)) {
                _context2.n = 4;
                break;
              }
              _context2.n = 3;
              return LogsService.addEvents("action.send.".concat(LOGIN_SUCCESS), {
                method_send: 'checkToken'
              });
            case 3:
              _classPrivateFieldGet(_handleInternalMessage, this).call(this, {
                action: LOGIN_SUCCESS,
                token: data.access_token,
                refresh_token: data.refresh_token,
                show_notification: true
              });
              _context2.n = 4;
              return StorageService.saveSessionExpiredNotified(false);
            case 4:
              if (!(data !== null && data !== void 0 && data.email)) {
                _context2.n = 6;
                break;
              }
              _context2.n = 5;
              return StorageService.getUserUid();
            case 5:
              storedHash = _context2.v;
              _context2.n = 6;
              return checkUserUid(data.email, storedHash);
            case 6:
              _context2.n = 9;
              break;
            case 7:
              _context2.p = 7;
              _t = _context2.v;
              _context2.n = 8;
              return LogsService.addEvents('service.error.checkToken', _t === null || _t === void 0 ? void 0 : _t.message);
            case 8:
              log(LOG_LEVELS.INFO, _t);
            case 9:
              return _context2.a(2);
          }
        }, _callee2, this, [[0, 7]]);
      }));
      function checkToken(_x2) {
        return _checkToken.apply(this, arguments);
      }
      return checkToken;
    }()
  }, {
    key: "extractExchangeToken",
    value: function extractExchangeToken(url) {
      var regex = /[?&]exchange_token=([^&]+)/;
      var match = url.match(regex);
      return match ? match[1] : null;
    }
  }, {
    key: "handleTabUpdated",
    value: function () {
      var _handleTabUpdated = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(tabId, changeInfo, tab) {
        var _this = this;
        var _t2, _t3;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.p = _context3.n) {
            case 0:
              if (changeInfo.status === 'loading' && tab !== null && tab !== void 0 && tab.url && !_classPrivateFieldGet(_excludedPrefixes, this).some(function (p) {
                return tab.url.startsWith(p);
              })) {
                this.makeSpoofGeo(tab);
              }
              if (!_classPrivateFieldGet(_authDomains, this) || !_classPrivateFieldGet(_authDomains, this).length) {
                _assertClassBrand(_TabListenerManager_brand, this, _initializeDomains).call(this);
              }
              if (tab.url && changeInfo.status === 'complete' && _classPrivateFieldGet(_authDomains, this).some(function (domain) {
                return tab.url.startsWith("https://".concat(domain, "/auth/success"));
              }) && !_classPrivateFieldGet(_injectedTabsByLogin, this).has(tab.id)) {
                LogsService.addEvents('service.handleTabUpdated', {
                  tabId: tabId,
                  changeInfo: changeInfo
                });
                browserApi.tabs.get(tab.id, function () {
                  if (browserApi.runtime.lastError) {
                    return;
                  }
                  var token = _this.extractExchangeToken(tab.url);
                  if (token) {
                    _classPrivateFieldGet(_injectedTabsByLogin, _this).add(tab.id);
                  }
                  _this.checkToken(token);
                });
              }
              _t2 = changeInfo.status === 'loading' && tab.url && tab.url.startsWith("edge://newtab");
              if (!_t2) {
                _context3.n = 2;
                break;
              }
              _context3.n = 1;
              return StorageService.getLoadConnectStatus();
            case 1:
              _t2 = _context3.v;
            case 2:
              if (!_t2) {
                _context3.n = 6;
                break;
              }
              _context3.p = 3;
              _context3.n = 4;
              return chrome.tabs.update(tabId, {
                url: "about:srcdoc"
              });
            case 4:
              _context3.n = 6;
              break;
            case 5:
              _context3.p = 5;
              _t3 = _context3.v;
            case 6:
              return _context3.a(2);
          }
        }, _callee3, this, [[3, 5]]);
      }));
      function handleTabUpdated(_x3, _x4, _x5) {
        return _handleTabUpdated.apply(this, arguments);
      }
      return handleTabUpdated;
    }()
  }, {
    key: "handleTabRemoved",
    value: function handleTabRemoved(tabId) {
      if (auth.isLoginTab && auth.isLoginTab(tabId)) {
        auth.clearLoginTab && auth.clearLoginTab();
      }
      _classPrivateFieldGet(_injectedTabs, this)["delete"](tabId);
    }
  }, {
    key: "initializeTabListeners",
    value: function initializeTabListeners(handleInternalMessage) {
      var _this2 = this;
      if (handleInternalMessage) {
        _classPrivateFieldSet(_handleInternalMessage, this, handleInternalMessage);
      }
      browserApi.tabs.onCreated.addListener(this.handleTabCreated.bind(this));
      browserApi.tabs.onUpdated.addListener(this.handleTabUpdated.bind(this));
      browserApi.tabs.onRemoved.addListener(this.handleTabRemoved.bind(this));
      browserApi.runtime.onMessage.addListener(function (message, sender, sendResponse) {
        LogsService.addEvents('service.initializeTabListeners');
        if (message.action === DISCONNECT) {
          LogsService.addEvents("action.send.".concat(DISCONNECT), {
            method_send: 'initializeTabListeners'
          });
          _classPrivateFieldSet(_cachedSpoofedData, _this2, null);
          _assertClassBrand(_TabListenerManager_brand, _this2, _initializeSpoofedData).call(_this2);
          sendResponse({
            success: true
          });
          return true;
        }
      });
      browserApi.storage.onChanged.addListener(function (changes, namespace) {
        LogsService.addEvents('service.initializeTabListeners');
        if (namespace === 'local' && (changes.currentProxy || changes.securitySettings || changes.authData)) {
          _assertClassBrand(_TabListenerManager_brand, _this2, _initializeSpoofedData).call(_this2);
        }
      });
    }
  }]);
}();
function _initializeDomains() {
  return _initializeDomains2.apply(this, arguments);
}
function _initializeDomains2() {
  _initializeDomains2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
    var _t4, _t5, _t6, _t7, _t8;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.p = _context4.n) {
        case 0:
          _context4.n = 1;
          return LogsService.addEvents('service.initializeDomains');
        case 1:
          _context4.p = 1;
          _t4 = _classPrivateFieldSet;
          _t5 = _authDomains;
          _t6 = this;
          _context4.n = 2;
          return StorageService.getAuthDomains();
        case 2:
          _t7 = _context4.v;
          if (_t7) {
            _context4.n = 3;
            break;
          }
          _t7 = [];
        case 3:
          _t4(_t5, _t6, _t7);
          _context4.n = 6;
          break;
        case 4:
          _context4.p = 4;
          _t8 = _context4.v;
          _context4.n = 5;
          return LogsService.addEvents('service.error.initializeDomains', _t8 === null || _t8 === void 0 ? void 0 : _t8.message);
        case 5:
          log(LOG_LEVELS.ERROR, '[TabListener] Failed to initialize auth domains:', _t8);
        case 6:
          return _context4.a(2);
      }
    }, _callee4, this, [[1, 4]]);
  }));
  return _initializeDomains2.apply(this, arguments);
}
function _initializeSpoofedData() {
  return _initializeSpoofedData2.apply(this, arguments);
}
function _initializeSpoofedData2() {
  _initializeSpoofedData2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
    var _yield$Promise$all, _yield$Promise$all2, currentProxyData, authData, settingsData, isLoggedIn, isConnected, isSpoofingEnabled, _t9;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.p = _context5.n) {
        case 0:
          if (!_classPrivateFieldGet(_isInitializing, this)) {
            _context5.n = 1;
            break;
          }
          return _context5.a(2);
        case 1:
          _classPrivateFieldSet(_isInitializing, this, true);
          _context5.p = 2;
          _context5.n = 3;
          return Promise.all([StorageService.getCurrentProxy(), StorageService.getAuthData(), StorageService.getSettings()]);
        case 3:
          _yield$Promise$all = _context5.v;
          _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
          currentProxyData = _yield$Promise$all2[0];
          authData = _yield$Promise$all2[1];
          settingsData = _yield$Promise$all2[2];
          isLoggedIn = !!(authData !== null && authData !== void 0 && authData.jwt);
          isConnected = (authData === null || authData === void 0 ? void 0 : authData.proxyStatus) === PROXY_STATUSES.CONNECT;
          isSpoofingEnabled = (settingsData === null || settingsData === void 0 ? void 0 : settingsData.locationSpoofing) !== false;
          if (!(!isLoggedIn || !isConnected || !isSpoofingEnabled)) {
            _context5.n = 4;
            break;
          }
          _classPrivateFieldSet(_cachedSpoofedData, this, null);
          _context5.n = 7;
          break;
        case 4:
          if (!(currentProxyData && currentProxyData.lat && currentProxyData.lon)) {
            _context5.n = 6;
            break;
          }
          _context5.n = 5;
          return LogsService.addEvents('service.initializeSpoofedData', {
            country: currentProxyData === null || currentProxyData === void 0 ? void 0 : currentProxyData.country,
            host: currentProxyData === null || currentProxyData === void 0 ? void 0 : currentProxyData.host,
            port: currentProxyData === null || currentProxyData === void 0 ? void 0 : currentProxyData.port,
            securitySettingsData: securitySettingsData
          });
        case 5:
          _classPrivateFieldSet(_cachedSpoofedData, this, {
            lat: currentProxyData.lat,
            lon: currentProxyData.lon,
            enabled: true,
            timeZone: currentProxyData.timeZone
          });
          _context5.n = 7;
          break;
        case 6:
          _classPrivateFieldSet(_cachedSpoofedData, this, null);
        case 7:
          _context5.n = 9;
          break;
        case 8:
          _context5.p = 8;
          _t9 = _context5.v;
          _classPrivateFieldSet(_cachedSpoofedData, this, null);
          _context5.n = 9;
          return LogsService.addEvents('service.error.initializeSpoofedData', _t9 === null || _t9 === void 0 ? void 0 : _t9.message);
        case 9:
          _context5.p = 9;
          _classPrivateFieldSet(_isInitializing, this, false);
          return _context5.f(9);
        case 10:
          return _context5.a(2);
      }
    }, _callee5, this, [[2, 8, 9, 10]]);
  }));
  return _initializeSpoofedData2.apply(this, arguments);
}
function _injectSpoofedData(_x6) {
  return _injectSpoofedData2.apply(this, arguments);
}
function _injectSpoofedData2() {
  _injectSpoofedData2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(tabId) {
    var attempts, maxAttempts, delay, retry, _t0;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.p = _context6.n) {
        case 0:
          attempts = 0;
          maxAttempts = 10;
          delay = 600;
          _context6.n = 1;
          return LogsService.addEvents('service.injectSpoofedData', tabId);
        case 1:
          if (!(!_classPrivateFieldGet(_cachedSpoofedData, this) && attempts < maxAttempts)) {
            _context6.n = 5;
            break;
          }
          _context6.n = 2;
          return _assertClassBrand(_TabListenerManager_brand, this, _initializeSpoofedData).call(this);
        case 2:
          if (_classPrivateFieldGet(_cachedSpoofedData, this)) {
            _context6.n = 4;
            break;
          }
          _context6.n = 3;
          return pause(delay);
        case 3:
          attempts++;
        case 4:
          _context6.n = 1;
          break;
        case 5:
          if (_classPrivateFieldGet(_cachedSpoofedData, this)) {
            _context6.n = 6;
            break;
          }
          return _context6.a(2);
        case 6:
          if (browserApi.isFireFoxBrowser()) {
            if (_classPrivateFieldGet(_cachedSpoofedData, this) && _classPrivateFieldGet(_cachedSpoofedData, this).enabled && _classPrivateFieldGet(_cachedSpoofedData, this).lat && _classPrivateFieldGet(_cachedSpoofedData, this).lon) {
              injectScript(tabId, _classPrivateFieldGet(_cachedSpoofedData, this));
            }
          }
          retry = 0;
        case 7:
          if (!(retry < 3)) {
            _context6.n = 13;
            break;
          }
          _context6.p = 8;
          _context6.n = 9;
          return browserApi.scripting.executeScript({
            target: {
              tabId: tabId
            },
            func: function func(data, tabId) {
              if (data) {
                window.__APEXGUARD_SPOOFED_DATA__ = data;
              }
            },
            args: [_classPrivateFieldGet(_cachedSpoofedData, this), tabId],
            world: 'MAIN',
            injectImmediately: true
          });
        case 9:
          return _context6.a(3, 13);
        case 10:
          _context6.p = 10;
          _t0 = _context6.v;
          if (!(retry < 2)) {
            _context6.n = 12;
            break;
          }
          _context6.n = 11;
          return LogsService.addEvents('service.error.injectSpoofedData', _t0 === null || _t0 === void 0 ? void 0 : _t0.message);
        case 11:
          _context6.n = 12;
          return pause(500);
        case 12:
          retry++;
          _context6.n = 7;
          break;
        case 13:
          return _context6.a(2);
      }
    }, _callee6, this, [[8, 10]]);
  }));
  return _injectSpoofedData2.apply(this, arguments);
}
var tabListenerManager = new TabListenerManager();
module.exports = {
  initializeTabListeners: tabListenerManager.initializeTabListeners.bind(tabListenerManager)
};

/***/ }),

/***/ "./src/sw/main/websocket.js":
/*!**********************************!*\
  !*** ./src/sw/main/websocket.js ***!
  \**********************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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 _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var _require = __webpack_require__(/*! ../constants/websocketConstants */ "./src/sw/constants/websocketConstants.js"),
  RECONNECT_DELAY_MS = _require.RECONNECT_DELAY_MS;
var _require2 = __webpack_require__(/*! @sw/constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  LOGOUT = _require2.LOGOUT,
  CONNECT = _require2.CONNECT,
  DISCONNECT = _require2.DISCONNECT,
  REFRESH_TOKEN = _require2.REFRESH_TOKEN;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var config = __webpack_require__(/*! ../../../config */ "./config.js");
var _require3 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require3.log,
  LOG_LEVELS = _require3.LOG_LEVELS;
var _require4 = __webpack_require__(/*! @common/browser_storages/browser_storage */ "./src/common/browser_storages/browser_storage.js"),
  removeStorageAsync = _require4.removeStorageAsync;
var _require5 = __webpack_require__(/*! @sw/constants/storage_keys_constants */ "./src/sw/constants/storage_keys_constants.js"),
  STORAGE_KEYS = _require5.STORAGE_KEYS;
var _require6 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require6.PROXY_STATUSES;
var _require7 = __webpack_require__(/*! @common/functions/checkSubscriptions */ "./src/common/functions/checkSubscriptions.js"),
  initSubscriptionChecker = _require7.initSubscriptionChecker;
var _require8 = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js"),
  updateIcon = _require8.updateIcon;
var _require9 = __webpack_require__(/*! @services/CountrySelectorService */ "./src/common/services/CountrySelectorService.js"),
  CountrySelectorService = _require9.CountrySelectorService;
var _require0 = __webpack_require__(/*! @common/functions/apiGatewaysForCity */ "./src/common/functions/apiGatewaysForCity.js"),
  getApiGatewaysForCity = _require0.getApiGatewaysForCity;
var ApiClient = __webpack_require__(/*! @services/ApiClient */ "./src/common/services/ApiClient.js");
var _require1 = __webpack_require__(/*! @sw/main/ping_manager */ "./src/sw/main/ping_manager.js"),
  sendPing = _require1.sendPing;
var _require10 = __webpack_require__(/*! @common/functions/checkApiGatewaysReconnect */ "./src/common/functions/checkApiGatewaysReconnect.js"),
  selectNextApiGatewayMain = _require10.selectNextApiGatewayMain;
var WEBSOCKET_URL = config.WEBSOCKET_URL;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var instance = null;
var WEBSOCKET_ERRORS = ['net::ERR_PROXY_CONNECTION_FAILED', 'net::ERR_NETWORK_CHANGED', 'net::ERR_NAME_NOT_RESOLVED'];
var _socket = /*#__PURE__*/new WeakMap();
var _reconnect = /*#__PURE__*/new WeakMap();
var _internalHandler = /*#__PURE__*/new WeakMap();
var _cur_token = /*#__PURE__*/new WeakMap();
var _timeoutReconnect = /*#__PURE__*/new WeakMap();
var _WebSocketManager_brand = /*#__PURE__*/new WeakSet();
var WebSocketManager = /*#__PURE__*/function () {
  function WebSocketManager() {
    _classCallCheck(this, WebSocketManager);
    _classPrivateMethodInitSpec(this, _WebSocketManager_brand);
    _classPrivateFieldInitSpec(this, _socket, null);
    _classPrivateFieldInitSpec(this, _reconnect, true);
    _classPrivateFieldInitSpec(this, _internalHandler, null);
    _classPrivateFieldInitSpec(this, _cur_token, '');
    _classPrivateFieldInitSpec(this, _timeoutReconnect, null);
    if (instance) {
      return instance;
    }
    instance = this;
    this.initializeWebSocket = this.initializeWebSocket.bind(this);
    this.updateWebSocketToken = this.updateWebSocketToken.bind(this);
    this.closeWebSocket = this.closeWebSocket.bind(this);
  }
  return _createClass(WebSocketManager, [{
    key: "initializeWebSocket",
    value: function () {
      var _initializeWebSocket = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(internalHandler) {
        var _classPrivateFieldGet2, _t;
        return _regenerator().w(function (_context) {
          while (1) switch (_context.p = _context.n) {
            case 0:
              _classPrivateFieldSet(_internalHandler, this, internalHandler);
              _context.p = 1;
              _context.n = 2;
              return LogsService.addEvents('service.initializeWebSocket');
            case 2:
              if (!(((_classPrivateFieldGet2 = _classPrivateFieldGet(_socket, this)) === null || _classPrivateFieldGet2 === void 0 ? void 0 : _classPrivateFieldGet2.readyState) === WebSocket.OPEN)) {
                _context.n = 3;
                break;
              }
              return _context.a(2);
            case 3:
              _classPrivateFieldSet(_socket, this, new WebSocket(WEBSOCKET_URL));
              _classPrivateFieldSet(_reconnect, this, true);
              _classPrivateFieldGet(_socket, this).onopen = _assertClassBrand(_WebSocketManager_brand, this, _handleOpen).bind(this);
              _classPrivateFieldGet(_socket, this).onmessage = _assertClassBrand(_WebSocketManager_brand, this, _handleMessage).bind(this);
              _classPrivateFieldGet(_socket, this).onerror = _assertClassBrand(_WebSocketManager_brand, this, _handleError).bind(this);
              _classPrivateFieldGet(_socket, this).onclose = _assertClassBrand(_WebSocketManager_brand, this, _handleClose).bind(this);
              _context.n = 5;
              break;
            case 4:
              _context.p = 4;
              _t = _context.v;
              log(LOG_LEVELS.ERROR, 'Error init WebSocket:', _t);
              _context.n = 5;
              return LogsService.addEvents('service.error.initializeWebSocket', _t === null || _t === void 0 ? void 0 : _t.message);
            case 5:
              return _context.a(2);
          }
        }, _callee, this, [[1, 4]]);
      }));
      function initializeWebSocket(_x) {
        return _initializeWebSocket.apply(this, arguments);
      }
      return initializeWebSocket;
    }()
  }, {
    key: "updateWebSocketToken",
    value: function updateWebSocketToken(token) {
      var _classPrivateFieldGet3, _classPrivateFieldGet4;
      LogsService.addEvents('service.websocketUpdate');
      if (!token) {
        LogsService.addEvents('service.websocketUpdateEmptyToken');
        return;
      }
      if (_classPrivateFieldGet(_cur_token, this) === token) {
        LogsService.addEvents('service.websocketUpdateCurToken');
        return;
      }
      if (((_classPrivateFieldGet3 = _classPrivateFieldGet(_socket, this)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.readyState) === WebSocket.CONNECTING) {
        return;
      }
      if (((_classPrivateFieldGet4 = _classPrivateFieldGet(_socket, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.readyState) === WebSocket.OPEN) {
        _classPrivateFieldSet(_cur_token, this, token);
        _assertClassBrand(_WebSocketManager_brand, this, _send).call(this, {
          access_token: token
        });
      } else {
        this.initializeWebSocket(_classPrivateFieldGet(_internalHandler, this));
      }
    }
  }, {
    key: "closeWebSocket",
    value: function closeWebSocket() {
      var reconnect = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      _classPrivateFieldSet(_reconnect, this, reconnect);
      if (_classPrivateFieldGet(_socket, this) && _classPrivateFieldGet(_socket, this).readyState !== WebSocket.CLOSED && _classPrivateFieldGet(_socket, this).readyState !== WebSocket.CLOSING) {
        _classPrivateFieldGet(_socket, this).close();
        LogsService.addEvents('service.closeWebSocket', '', 'Connection closed explicitly');
      } else {
        LogsService.addEvents('service.closeWebSocket', '', 'Already closed or closing');
      }
      _classPrivateFieldSet(_socket, this, null);
    }
  }]);
}();
function _handleOpen() {
  return _handleOpen2.apply(this, arguments);
}
function _handleOpen2() {
  _handleOpen2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
    var authData, token;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.n) {
        case 0:
          _context3.n = 1;
          return StorageService.getAuthData();
        case 1:
          authData = _context3.v;
          token = authData === null || authData === void 0 ? void 0 : authData.jwt;
          if (!(token && _classPrivateFieldGet(_cur_token, this) !== token)) {
            _context3.n = 2;
            break;
          }
          _classPrivateFieldSet(_cur_token, this, token);
          _assertClassBrand(_WebSocketManager_brand, this, _send).call(this, {
            access_token: token
          });
          _context3.n = 2;
          return LogsService.addEvents('service.handleOpen', 'Sent access_token to WebSocket');
        case 2:
          return _context3.a(2);
      }
    }, _callee3, this);
  }));
  return _handleOpen2.apply(this, arguments);
}
function _handleMessage(_x2) {
  return _handleMessage2.apply(this, arguments);
}
function _handleMessage2() {
  _handleMessage2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(event) {
    var message, _t2, _t3;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.p = _context4.n) {
        case 0:
          _context4.p = 0;
          message = JSON.parse(event.data);
          log(LOG_LEVELS.INFO, 'WebSocket message received:', message);
          _context4.n = 1;
          return LogsService.addEvents('service.websocket.handleMessage', message);
        case 1:
          _t2 = message.type;
          _context4.n = _t2 === 'access_token_expired' ? 2 : _t2 === 'subscription_payment' ? 4 : _t2 === 'subscription_expired' ? 6 : _t2 === 'subscription_expires_in_week' ? 8 : _t2 === 'subscription_expires_in_day' ? 10 : _t2 === 'logout' ? 12 : _t2 === 'proxy_disconnect' ? 14 : _t2 === 'maintenance_activated' ? 16 : 18;
          break;
        case 2:
          _context4.n = 3;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleTokenExpired).call(this, message);
        case 3:
          return _context4.a(3, 19);
        case 4:
          _context4.n = 5;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleSubscriptionPayment).call(this, message);
        case 5:
          return _context4.a(3, 19);
        case 6:
          _context4.n = 7;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleSubscriptionExpired).call(this, message);
        case 7:
          return _context4.a(3, 19);
        case 8:
          _context4.n = 9;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleLogSubscriptionMessageType).call(this, message.type);
        case 9:
          return _context4.a(3, 19);
        case 10:
          _context4.n = 11;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleLogSubscriptionMessageType).call(this, message.type);
        case 11:
          return _context4.a(3, 19);
        case 12:
          _context4.n = 13;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleLogout).call(this, message.payload);
        case 13:
          return _context4.a(3, 19);
        case 14:
          _context4.n = 15;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleProxyDisconnect).call(this, message.payload);
        case 15:
          return _context4.a(3, 19);
        case 16:
          _context4.n = 17;
          return _assertClassBrand(_WebSocketManager_brand, this, _handleChangeApiGateway).call(this, message.payload);
        case 17:
          return _context4.a(3, 19);
        case 18:
          _context4.n = 19;
          return LogsService.addEvents('service.handleMessage', '', 'Unknown WebSocket message type:' + (message === null || message === void 0 ? void 0 : message.type));
        case 19:
          _context4.n = 21;
          break;
        case 20:
          _context4.p = 20;
          _t3 = _context4.v;
          _context4.n = 21;
          return LogsService.addEvents('service.error.handleMessage', _t3 === null || _t3 === void 0 ? void 0 : _t3.message);
        case 21:
          return _context4.a(2);
      }
    }, _callee4, this, [[0, 20]]);
  }));
  return _handleMessage2.apply(this, arguments);
}
function _handleTokenExpired(_x3) {
  return _handleTokenExpired2.apply(this, arguments);
}
function _handleTokenExpired2() {
  _handleTokenExpired2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(message) {
    var loadConnectStatus, _t4;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.p = _context5.n) {
        case 0:
          _context5.p = 0;
          _context5.n = 1;
          return LogsService.addEvents('service.websocket.handleTokenExpired');
        case 1:
          _context5.n = 2;
          return StorageService.getLoadConnectStatus();
        case 2:
          loadConnectStatus = _context5.v;
          if (loadConnectStatus) {
            _context5.n = 3;
            break;
          }
          _context5.n = 3;
          return _assertClassBrand(_WebSocketManager_brand, this, _refreshBySocket).call(this, message);
        case 3:
          _context5.n = 5;
          break;
        case 4:
          _context5.p = 4;
          _t4 = _context5.v;
          _context5.n = 5;
          return LogsService.addEvents('service.error.handleTokenExpired', _t4 === null || _t4 === void 0 ? void 0 : _t4.message);
        case 5:
          return _context5.a(2);
      }
    }, _callee5, this, [[0, 4]]);
  }));
  return _handleTokenExpired2.apply(this, arguments);
}
function _refreshBySocket(_x4) {
  return _refreshBySocket2.apply(this, arguments);
}
function _refreshBySocket2() {
  _refreshBySocket2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(message) {
    var authData;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.n) {
        case 0:
          _context6.n = 1;
          return StorageService.getAuthData();
        case 1:
          authData = _context6.v;
          _context6.n = 2;
          return LogsService.addEvents('service.refreshBySocket');
        case 2:
          if (!(authData !== null && authData !== void 0 && authData.refresh_token)) {
            _context6.n = 4;
            break;
          }
          _context6.n = 3;
          return LogsService.addEvents("action.send.".concat(REFRESH_TOKEN), {
            method_send: 'refreshBySocket'
          });
        case 3:
          if (_classPrivateFieldGet(_internalHandler, this)) {
            _classPrivateFieldGet(_internalHandler, this).call(this, {
              action: REFRESH_TOKEN,
              refresh_token: authData.refresh_token
            }, function () {});
          } else {
            browserApi.runtime.sendMessage({
              action: REFRESH_TOKEN,
              refresh_token: authData.refresh_token
            });
          }
          _context6.n = 6;
          break;
        case 4:
          _context6.n = 5;
          return LogsService.addEvents("action.send.".concat(LOGOUT), {
            method_send: 'refreshBySocket'
          });
        case 5:
          if (_classPrivateFieldGet(_internalHandler, this)) {
            _classPrivateFieldGet(_internalHandler, this).call(this, {
              action: LOGOUT,
              data: message.payload
            }, function () {});
          } else {
            browserApi.runtime.sendMessage({
              action: LOGOUT,
              data: message.payload
            });
          }
          this.closeWebSocket();
        case 6:
          return _context6.a(2);
      }
    }, _callee6, this);
  }));
  return _refreshBySocket2.apply(this, arguments);
}
function _handleSubscriptionPayment(_x5) {
  return _handleSubscriptionPayment2.apply(this, arguments);
}
function _handleSubscriptionPayment2() {
  _handleSubscriptionPayment2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(message) {
    var _userData, subscription_info, userData, oldExp, newExp, _t5;
    return _regenerator().w(function (_context7) {
      while (1) switch (_context7.p = _context7.n) {
        case 0:
          _context7.n = 1;
          return LogsService.addEvents('service.handleSubscriptionPayment', message);
        case 1:
          _context7.p = 1;
          subscription_info = JSON.parse(message.payload);
          _context7.n = 2;
          return StorageService.getUserData();
        case 2:
          userData = _context7.v;
          if (!userData) {
            userData = {};
          }
          oldExp = (_userData = userData) !== null && _userData !== void 0 && (_userData = _userData.subscription_info) !== null && _userData !== void 0 && _userData.subscription_exp_date ? new Date(userData.subscription_info.subscription_exp_date).getTime() : 0;
          newExp = subscription_info !== null && subscription_info !== void 0 && subscription_info.end_date ? new Date(subscription_info.end_date).getTime() : 0;
          if (!(oldExp > newExp)) {
            _context7.n = 4;
            break;
          }
          _context7.n = 3;
          return LogsService.addEvents('service.handleSubscriptionPayment', '', 'UserData subscription_exp_date > handleSubscriptionPayment subscription_info.end_date');
        case 3:
          return _context7.a(2);
        case 4:
          if (subscription_info.end_date) {
            subscription_info.subscription_exp_date = subscription_info.end_date;
          }
          userData = _objectSpread(_objectSpread({}, userData), {}, {
            subscription_info: subscription_info
          });
          _context7.n = 5;
          return StorageService.saveUserData(userData);
        case 5:
          _context7.n = 6;
          return initSubscriptionChecker();
        case 6:
          _context7.n = 8;
          break;
        case 7:
          _context7.p = 7;
          _t5 = _context7.v;
          log(LOG_LEVELS.ERROR, "Error update subscription");
          _context7.n = 8;
          return LogsService.addEvents('service.error.handleSubscriptionPayment', _t5.message);
        case 8:
          return _context7.a(2);
      }
    }, _callee7, null, [[1, 7]]);
  }));
  return _handleSubscriptionPayment2.apply(this, arguments);
}
function _handleSubscriptionExpired(_x6) {
  return _handleSubscriptionExpired2.apply(this, arguments);
}
function _handleSubscriptionExpired2() {
  _handleSubscriptionExpired2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(message) {
    var subscription_info, userData, proxyStatus, _t6;
    return _regenerator().w(function (_context8) {
      while (1) switch (_context8.p = _context8.n) {
        case 0:
          _context8.n = 1;
          return LogsService.addEvents('service.handleSubscriptionExpired', message);
        case 1:
          _context8.p = 1;
          subscription_info = JSON.parse(message.payload);
          _context8.n = 2;
          return StorageService.getUserData();
        case 2:
          userData = _context8.v;
          if (!userData) {
            userData = {};
          }
          if (subscription_info.endDate) {
            subscription_info.subscription_exp_date = subscription_info.endDate;
          }
          userData = _objectSpread(_objectSpread({}, userData), {}, {
            subscription_info: subscription_info
          });
          _context8.n = 3;
          return StorageService.saveUserData(userData);
        case 3:
          _context8.n = 4;
          return StorageService.getProxyStatus();
        case 4:
          proxyStatus = _context8.v;
          if (!(proxyStatus !== PROXY_STATUSES.CONNECT)) {
            _context8.n = 5;
            break;
          }
          return _context8.a(2);
        case 5:
          if (!_classPrivateFieldGet(_internalHandler, this)) {
            _context8.n = 6;
            break;
          }
          _classPrivateFieldGet(_internalHandler, this).call(this, {
            action: DISCONNECT
          }, function () {});
          _context8.n = 7;
          break;
        case 6:
          _context8.n = 7;
          return browserApi.runtime.sendMessage({
            action: DISCONNECT
          });
        case 7:
          _context8.n = 8;
          return LogsService.addEvents("action.send.".concat(DISCONNECT), {
            method_send: 'handleProxyDisconnect'
          }, 'Discount due to subscription expiration');
        case 8:
          _context8.n = 9;
          return removeStorageAsync(STORAGE_KEYS.LOAD_CONNECT_STATUS);
        case 9:
          _context8.n = 10;
          return updateIcon(false);
        case 10:
          _context8.n = 12;
          break;
        case 11:
          _context8.p = 11;
          _t6 = _context8.v;
          log(LOG_LEVELS.ERROR, "Error update subscription");
          _context8.n = 12;
          return LogsService.addEvents('service.error.handleSubscriptionExpired', _t6.message);
        case 12:
          return _context8.a(2);
      }
    }, _callee8, this, [[1, 11]]);
  }));
  return _handleSubscriptionExpired2.apply(this, arguments);
}
function _handleLogSubscriptionMessageType(_x7) {
  return _handleLogSubscriptionMessageType2.apply(this, arguments);
}
function _handleLogSubscriptionMessageType2() {
  _handleLogSubscriptionMessageType2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(messageType) {
    return _regenerator().w(function (_context9) {
      while (1) switch (_context9.n) {
        case 0:
          if (messageType) {
            _context9.n = 1;
            break;
          }
          return _context9.a(2);
        case 1:
          _context9.n = 2;
          return LogsService.addEvents('service.handleMessage', '', 'WebSocket subscription message type:' + messageType);
        case 2:
          return _context9.a(2);
      }
    }, _callee9);
  }));
  return _handleLogSubscriptionMessageType2.apply(this, arguments);
}
function _handleLogout(_x8) {
  return _handleLogout2.apply(this, arguments);
}
function _handleLogout2() {
  _handleLogout2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(payload) {
    return _regenerator().w(function (_context0) {
      while (1) switch (_context0.n) {
        case 0:
          log(LOG_LEVELS.INFO, 'Logout via WebSocket:', payload);
          _context0.n = 1;
          return LogsService.addEvents('service.handleLogout');
        case 1:
          _context0.n = 2;
          return LogsService.addEvents("action.send.".concat(LOGOUT), {
            method_send: 'handleLogout'
          });
        case 2:
          if (_classPrivateFieldGet(_internalHandler, this)) {
            _classPrivateFieldGet(_internalHandler, this).call(this, {
              action: LOGOUT,
              data: payload
            }, function () {});
          } else {
            browserApi.runtime.sendMessage({
              action: LOGOUT,
              data: payload
            });
          }
          this.closeWebSocket();
        case 3:
          return _context0.a(2);
      }
    }, _callee0, this);
  }));
  return _handleLogout2.apply(this, arguments);
}
function _handleProxyDisconnect(_x9) {
  return _handleProxyDisconnect2.apply(this, arguments);
}
function _handleProxyDisconnect2() {
  _handleProxyDisconnect2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(payload) {
    var _settings$currentProx, data, settings, _t7;
    return _regenerator().w(function (_context1) {
      while (1) switch (_context1.p = _context1.n) {
        case 0:
          log(LOG_LEVELS.INFO, 'DISCONNECT:', payload);
          _context1.p = 1;
          _context1.n = 2;
          return LogsService.addEvents('service.handleProxyDisconnect', payload);
        case 2:
          data = JSON.parse(payload);
          if (data !== null && data !== void 0 && data.radcheck_username) {
            _context1.n = 3;
            break;
          }
          return _context1.a(2);
        case 3:
          _context1.n = 4;
          return StorageService.getProxySettings();
        case 4:
          settings = _context1.v;
          if (!(settings.proxyStatus !== PROXY_STATUSES.CONNECT || (settings === null || settings === void 0 || (_settings$currentProx = settings.currentProxy) === null || _settings$currentProx === void 0 ? void 0 : _settings$currentProx.username) !== data.radcheck_username)) {
            _context1.n = 5;
            break;
          }
          return _context1.a(2);
        case 5:
          _context1.n = 6;
          return LogsService.addEvents("action.send.".concat(DISCONNECT), {
            method_send: 'handleProxyDisconnect'
          });
        case 6:
          if (_classPrivateFieldGet(_internalHandler, this)) {
            _classPrivateFieldGet(_internalHandler, this).call(this, {
              action: DISCONNECT,
              data: data
            }, function () {});
          } else {
            browserApi.runtime.sendMessage({
              action: DISCONNECT,
              data: data
            });
          }
          _context1.n = 7;
          return removeStorageAsync(STORAGE_KEYS.LOAD_CONNECT_STATUS);
        case 7:
          _context1.n = 9;
          break;
        case 8:
          _context1.p = 8;
          _t7 = _context1.v;
          _context1.n = 9;
          return LogsService.addEvents('service.error.handleProxyDisconnect', _t7.message);
        case 9:
          return _context1.a(2);
      }
    }, _callee1, this, [[1, 8]]);
  }));
  return _handleProxyDisconnect2.apply(this, arguments);
}
function _handleChangeApiGateway(_x0) {
  return _handleChangeApiGateway2.apply(this, arguments);
}
function _handleChangeApiGateway2() {
  _handleChangeApiGateway2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(payload) {
    var data, apiGatewayMain, pauseSettings, currentProxy, authData, cityCode, cityInfo, apiGatewaysForCity, _apiGatewayMain, _t8;
    return _regenerator().w(function (_context10) {
      while (1) switch (_context10.n) {
        case 0:
          data = JSON.parse(payload);
          _context10.n = 1;
          return StorageService.getApiGatewayMain();
        case 1:
          apiGatewayMain = _context10.v;
          _context10.n = 2;
          return LogsService.addEvents('service.handleChangeApiGateway', {
            message: 'maintenance_activated',
            data: data,
            apiGatewayMain: apiGatewayMain
          });
        case 2:
          _t8 = (data === null || data === void 0 ? void 0 : data.domain) === apiGatewayMain;
          if (!_t8) {
            _context10.n = 4;
            break;
          }
          _context10.n = 3;
          return StorageService.isExistApiGateways();
        case 3:
          _t8 = _context10.v;
        case 4:
          if (!_t8) {
            _context10.n = 13;
            break;
          }
          _context10.n = 5;
          return StorageService.getPauseSetting();
        case 5:
          pauseSettings = _context10.v;
          _context10.n = 6;
          return StorageService.getCurrentProxy();
        case 6:
          currentProxy = _context10.v;
          _context10.n = 7;
          return StorageService.getAuthData();
        case 7:
          authData = _context10.v;
          _context10.n = 8;
          return CountrySelectorService.getCityCodeForCountry(currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.country);
        case 8:
          cityCode = _context10.v;
          _context10.n = 9;
          return CountrySelectorService.getInfoByCityCode(cityCode);
        case 9:
          cityInfo = _context10.v;
          _context10.n = 10;
          return getApiGatewaysForCity(cityInfo, true);
        case 10:
          apiGatewaysForCity = _context10.v;
          _context10.n = 11;
          return StorageService.getApiGatewayMain();
        case 11:
          _apiGatewayMain = _context10.v;
          _context10.n = 12;
          return selectNextApiGatewayMain(apiGatewaysForCity, _apiGatewayMain);
        case 12:
          if (_classPrivateFieldGet(_internalHandler, this)) {
            _classPrivateFieldGet(_internalHandler, this).call(this, {
              action: CONNECT,
              country: currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.country,
              loggedIn: authData === null || authData === void 0 ? void 0 : authData.loggedIn,
              isPause: pauseSettings === null || pauseSettings === void 0 ? void 0 : pauseSettings.pause
            });
          } else {
            browserApi.runtime.sendMessage({
              action: CONNECT,
              country: currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.country,
              loggedIn: authData === null || authData === void 0 ? void 0 : authData.loggedIn,
              isPause: pauseSettings === null || pauseSettings === void 0 ? void 0 : pauseSettings.pause
            });
          }
          return _context10.a(2);
        case 13:
          _context10.n = 14;
          return ApiClient.getApiGateways();
        case 14:
          return _context10.a(2);
      }
    }, _callee10, this);
  }));
  return _handleChangeApiGateway2.apply(this, arguments);
}
function _handleError(_x1) {
  return _handleError2.apply(this, arguments);
}
function _handleError2() {
  _handleError2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11(error) {
    var msg, match;
    return _regenerator().w(function (_context11) {
      while (1) switch (_context11.n) {
        case 0:
          msg = (error === null || error === void 0 ? void 0 : error.message) || '';
          match = WEBSOCKET_ERRORS.find(function (err) {
            return msg.includes(err);
          });
          _context11.n = 1;
          return sendPing();
        case 1:
          if (!match) {
            _context11.n = 2;
            break;
          }
          LogsService.addEvents("service.error.websocket.".concat(match.replace('net::', '').toLowerCase()), msg);
          return _context11.a(2);
        case 2:
          LogsService.addEvents('service.error.websocket', msg);
        case 3:
          return _context11.a(2);
      }
    }, _callee11);
  }));
  return _handleError2.apply(this, arguments);
}
function _handleClose() {
  var _this = this;
  LogsService.addEvents('service.websocketClose');
  if (_classPrivateFieldGet(_reconnect, this)) {
    if (_classPrivateFieldGet(_timeoutReconnect, this)) {
      clearTimeout(_classPrivateFieldGet(_timeoutReconnect, this));
      _classPrivateFieldSet(_timeoutReconnect, this, null);
    }
    var socket = _classPrivateFieldGet(_socket, this);
    _classPrivateFieldSet(_timeoutReconnect, this, setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
      return _regenerator().w(function (_context2) {
        while (1) switch (_context2.n) {
          case 0:
            if (!((socket === null || socket === void 0 ? void 0 : socket.readyState) !== WebSocket.OPEN)) {
              _context2.n = 1;
              break;
            }
            _classPrivateFieldSet(_cur_token, _this, null);
            _classPrivateFieldSet(_socket, _this, null);
            _context2.n = 1;
            return _this.initializeWebSocket(_classPrivateFieldGet(_internalHandler, _this));
          case 1:
            return _context2.a(2);
        }
      }, _callee2);
    })), RECONNECT_DELAY_MS));
  }
}
function _send(data) {
  var _classPrivateFieldGet5;
  if (((_classPrivateFieldGet5 = _classPrivateFieldGet(_socket, this)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.readyState) === WebSocket.OPEN) {
    LogsService.addEvents('service.websocketSend');
    _classPrivateFieldGet(_socket, this).send(JSON.stringify(data));
  }
}
module.exports = new WebSocketManager();

/***/ }),

/***/ "./src/sw/settings_services/pause_service.js":
/*!***************************************************!*\
  !*** ./src/sw/settings_services/pause_service.js ***!
  \***************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), 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 _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
var _require = __webpack_require__(/*! ../main/proxy */ "./src/sw/main/proxy.js"),
  connectProxyByParams = _require.connectProxyByParams;
var _require2 = __webpack_require__(/*! ../main/notification_service */ "./src/sw/main/notification_service.js"),
  notifyVpnConnected = _require2.notifyVpnConnected;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require3 = __webpack_require__(/*! ../constants/listen_constants */ "./src/sw/constants/listen_constants.js"),
  DELETE_PAUSE = _require3.DELETE_PAUSE;
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require4 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require4.log,
  LOG_LEVELS = _require4.LOG_LEVELS;
var _require5 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require5.PROXY_STATUSES;
var _require6 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  disconnectProxy = _require6.disconnectProxy,
  disconnectWithEnableKillSwitch = _require6.disconnectWithEnableKillSwitch;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var _idTimer = /*#__PURE__*/new WeakMap();
var PauseService = /*#__PURE__*/function () {
  function PauseService() {
    _classCallCheck(this, PauseService);
    _classPrivateFieldInitSpec(this, _idTimer, 0);
  }
  return _createClass(PauseService, [{
    key: "handleSetPause",
    value: function () {
      var _handleSetPause = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(message, sendResponse) {
        var _this = this;
        var pauseSetting, disconnectPromise, _t2;
        return _regenerator().w(function (_context3) {
          while (1) switch (_context3.p = _context3.n) {
            case 0:
              _context3.p = 0;
              pauseSetting = {
                pauseProxy: message.pauseProxy,
                pause_time: message.pause_time,
                pause: message.pause
              };
              _context3.n = 1;
              return LogsService.addEvents('service.handleSetPause', pauseSetting);
            case 1:
              _context3.n = 2;
              return StorageService.savePauseSetting(pauseSetting);
            case 2:
              disconnectPromise = message.killSwitch ? disconnectWithEnableKillSwitch : disconnectProxy;
              disconnectPromise(/*#__PURE__*/function () {
                var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(response) {
                  return _regenerator().w(function (_context2) {
                    while (1) switch (_context2.n) {
                      case 0:
                        if (!(response.status === PROXY_STATUSES.DISCONNECT || response.status === PROXY_STATUSES.KILL_SWITCH)) {
                          _context2.n = 2;
                          break;
                        }
                        if (_classPrivateFieldGet(_idTimer, _this)) {
                          clearTimeout(_classPrivateFieldGet(_idTimer, _this));
                        }
                        _classPrivateFieldSet(_idTimer, _this, setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
                          var pauseSettings, proxyStatus, pauseProxy, _t;
                          return _regenerator().w(function (_context) {
                            while (1) switch (_context.p = _context.n) {
                              case 0:
                                _context.p = 0;
                                _context.n = 1;
                                return StorageService.getPauseSetting();
                              case 1:
                                pauseSettings = _context.v;
                                if (!(!pauseSettings || !pauseSettings.pause)) {
                                  _context.n = 2;
                                  break;
                                }
                                sendResponse(false);
                                return _context.a(2);
                              case 2:
                                _context.n = 3;
                                return StorageService.getProxyStatus();
                              case 3:
                                proxyStatus = _context.v;
                                if (!(proxyStatus === PROXY_STATUSES.BLOCK_CONNECT)) {
                                  _context.n = 7;
                                  break;
                                }
                                pauseProxy = pauseSetting.pauseProxy;
                                _context.n = 4;
                                return StorageService.saveSelectedCountry(pauseProxy.country);
                              case 4:
                                _context.n = 5;
                                return StorageService.saveSelectedAutoConnectCountry(pauseProxy.country);
                              case 5:
                                _context.n = 6;
                                return StorageService.addToLastCountries(pauseProxy.country);
                              case 6:
                                _context.n = 8;
                                break;
                              case 7:
                                _context.n = 8;
                                return _this.connectProxyAfterPause(sendResponse, message.pauseProxy);
                              case 8:
                                _context.n = 11;
                                break;
                              case 9:
                                _context.p = 9;
                                _t = _context.v;
                                log(LOG_LEVELS.ERROR, 'Error resuming proxy connection:', _t);
                                _context.n = 10;
                                return LogsService.addEvents('service.error.handleSetPauseProxy', _t.message);
                              case 10:
                                sendResponse(false);
                              case 11:
                                return _context.a(2);
                            }
                          }, _callee, null, [[0, 9]]);
                        })), (message.pause_time - Math.floor(Date.now() / 1000)) * 1000));
                        log(LOG_LEVELS.INFO, 'Timer set:', _classPrivateFieldGet(_idTimer, _this));
                        _context2.n = 1;
                        return LogsService.addEvents('service.error.handleSetPauseTimer');
                      case 1:
                        sendResponse(true);
                        _context2.n = 4;
                        break;
                      case 2:
                        log(LOG_LEVELS.ERROR, 'Failed to disconnect proxy:', response);
                        _context2.n = 3;
                        return LogsService.addEvents('service.error.handleSetPauseDisconnect');
                      case 3:
                        sendResponse(false);
                      case 4:
                        return _context2.a(2);
                    }
                  }, _callee2);
                }));
                return function (_x3) {
                  return _ref.apply(this, arguments);
                };
              }(), false, true);
              _context3.n = 5;
              break;
            case 3:
              _context3.p = 3;
              _t2 = _context3.v;
              _context3.n = 4;
              return LogsService.addEvents('service.error.handleSetPause', {
                'error': _t2.message
              });
            case 4:
              log(LOG_LEVELS.ERROR, 'Error setting pause:', _t2);
              sendResponse(false);
            case 5:
              return _context3.a(2);
          }
        }, _callee3, null, [[0, 3]]);
      }));
      function handleSetPause(_x, _x2) {
        return _handleSetPause.apply(this, arguments);
      }
      return handleSetPause;
    }()
  }, {
    key: "handleDeletePause",
    value: function () {
      var _handleDeletePause = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(sendResponse) {
        var pauseSetting, _t3;
        return _regenerator().w(function (_context4) {
          while (1) switch (_context4.p = _context4.n) {
            case 0:
              _context4.p = 0;
              _context4.n = 1;
              return LogsService.addEvents('service.handleDeletePause');
            case 1:
              pauseSetting = {
                pause: false
              };
              if (_classPrivateFieldGet(_idTimer, this)) {
                clearTimeout(_classPrivateFieldGet(_idTimer, this));
                _classPrivateFieldSet(_idTimer, this, 0);
              }
              _context4.n = 2;
              return StorageService.savePauseSetting(pauseSetting);
            case 2:
              sendResponse({
                success: true
              });
              _context4.n = 5;
              break;
            case 3:
              _context4.p = 3;
              _t3 = _context4.v;
              _context4.n = 4;
              return LogsService.addEvents('service.error.handleDeletePause', _t3.message);
            case 4:
              log(LOG_LEVELS.ERROR, 'Error deleting pause:', _t3);
              sendResponse({
                success: false,
                error: 'Error deleting pause'
              });
            case 5:
              return _context4.a(2);
          }
        }, _callee4, this, [[0, 3]]);
      }));
      function handleDeletePause(_x4) {
        return _handleDeletePause.apply(this, arguments);
      }
      return handleDeletePause;
    }()
  }, {
    key: "connectProxyAfterPause",
    value: function () {
      var _connectProxyAfterPause = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(sendResponse, pauseProxy) {
        return _regenerator().w(function (_context6) {
          while (1) switch (_context6.n) {
            case 0:
              _context6.n = 1;
              return connectProxyByParams(/*#__PURE__*/function () {
                var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(connectResponse) {
                  var proxyStatus, _t4, _t5;
                  return _regenerator().w(function (_context5) {
                    while (1) switch (_context5.p = _context5.n) {
                      case 0:
                        _context5.p = 0;
                        _context5.n = 1;
                        return LogsService.addEvents('service.connectProxyAfterPause');
                      case 1:
                        if (!(!connectResponse || !connectResponse.success)) {
                          _context5.n = 2;
                          break;
                        }
                        sendResponse(false);
                        return _context5.a(2);
                      case 2:
                        _context5.n = 3;
                        return StorageService.savePauseSetting({
                          pause: false
                        });
                      case 3:
                        _context5.n = 4;
                        return StorageService.getProxyStatus();
                      case 4:
                        proxyStatus = _context5.v;
                        if (proxyStatus === PROXY_STATUSES.CONNECT) {
                          notifyVpnConnected();
                        }
                        _context5.p = 5;
                        _context5.n = 6;
                        return LogsService.addEvents("action.send.".concat(DELETE_PAUSE), {
                          method_send: 'connectProxyAfterPause'
                        });
                      case 6:
                        _context5.n = 7;
                        return browserApi.runtime.sendMessage({
                          action: DELETE_PAUSE
                        });
                      case 7:
                        _context5.n = 9;
                        break;
                      case 8:
                        _context5.p = 8;
                        _t4 = _context5.v;
                      case 9:
                        sendResponse(true);
                        _context5.n = 12;
                        break;
                      case 10:
                        _context5.p = 10;
                        _t5 = _context5.v;
                        _context5.n = 11;
                        return LogsService.addEvents('service.error.connectProxyAfterPause', _t5.message);
                      case 11:
                        log(LOG_LEVELS.ERROR, 'Error inside connectProxyByParams callback:', _t5);
                        sendResponse(false);
                      case 12:
                        return _context5.a(2);
                    }
                  }, _callee5, null, [[5, 8], [0, 10]]);
                }));
                return function (_x7) {
                  return _ref3.apply(this, arguments);
                };
              }(), pauseProxy);
            case 1:
              return _context6.a(2);
          }
        }, _callee6);
      }));
      function connectProxyAfterPause(_x5, _x6) {
        return _connectProxyAfterPause.apply(this, arguments);
      }
      return connectProxyAfterPause;
    }()
  }]);
}();
var pauseService = new PauseService();
module.exports = {
  handleSetPause: pauseService.handleSetPause.bind(pauseService),
  handleDeletePause: pauseService.handleDeletePause.bind(pauseService),
  connectProxyAfterPause: pauseService.connectProxyAfterPause.bind(pauseService)
};

/***/ }),

/***/ "./src/sw/settings_services/selective_proxy_service.js":
/*!*************************************************************!*\
  !*** ./src/sw/settings_services/selective_proxy_service.js ***!
  \*************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var _require = __webpack_require__(/*! ../main/proxy */ "./src/sw/main/proxy.js"),
  updateBypassList = _require.updateBypassList;
var _require2 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require2.log,
  LOG_LEVELS = _require2.LOG_LEVELS;
var _require3 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require3.PROXY_STATUSES;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
function handleSelectiveProxy(message, sendResponse) {
  LogsService.addEvents('service.handleSelectiveProxy');
  chrome.storage.local.get(['proxyStatus'], function (result) {
    var currentProxyStatus = result.proxyStatus || PROXY_STATUSES.DISCONNECT;
    log(LOG_LEVELS.INFO, 'Current proxyStatus:', currentProxyStatus);
    if (currentProxyStatus === PROXY_STATUSES.CONNECT) {
      updateBypassList(function (response) {
        return sendResponse(response);
      });
    } else {
      sendResponse({
        success: false,
        status: currentProxyStatus
      });
    }
  });
}
function handleUpdateSelectiveProxyList(message, sendResponse) {
  log(LOG_LEVELS.INFO, 'Selective proxy list updated:', message);
  LogsService.addEvents('service.handleUpdateSelectiveProxyList');
  chrome.storage.local.get(['proxyStatus'], function (result) {
    var currentProxyStatus = result.proxyStatus || PROXY_STATUSES.DISCONNECT;
    log(LOG_LEVELS.INFO, 'Current proxyStatus:', currentProxyStatus);
    if (currentProxyStatus === PROXY_STATUSES.CONNECT) {
      updateBypassList(function (response) {
        return sendResponse(response);
      });
    } else {
      sendResponse({
        success: false,
        status: currentProxyStatus
      });
    }
  });
}
module.exports = {
  handleSelectiveProxy: handleSelectiveProxy,
  handleUpdateSelectiveProxyList: handleUpdateSelectiveProxyList
};

/***/ }),

/***/ "./src/sw/settings_services/split_tunneling_service.js":
/*!*************************************************************!*\
  !*** ./src/sw/settings_services/split_tunneling_service.js ***!
  \*************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require.PROXY_STATUSES;
var _require2 = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js"),
  updateBypassList = _require2.updateBypassList;
var _require3 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  enableForceKillSwitch = _require3.enableForceKillSwitch;
function handleSplitTunneling(_x, _x2) {
  return _handleSplitTunneling.apply(this, arguments);
}
function _handleSplitTunneling() {
  _handleSplitTunneling = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(message, sendResponse) {
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          _context.n = 1;
          return splitTunneling(message, sendResponse);
        case 1:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _handleSplitTunneling.apply(this, arguments);
}
function handleUpdateSplitTunnelingList(_x3, _x4) {
  return _handleUpdateSplitTunnelingList.apply(this, arguments);
}
function _handleUpdateSplitTunnelingList() {
  _handleUpdateSplitTunnelingList = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(message, sendResponse) {
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          _context2.n = 1;
          return splitTunneling(message, sendResponse);
        case 1:
          return _context2.a(2);
      }
    }, _callee2);
  }));
  return _handleUpdateSplitTunnelingList.apply(this, arguments);
}
function splitTunneling(_x5, _x6) {
  return _splitTunneling.apply(this, arguments);
}
function _splitTunneling() {
  _splitTunneling = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(message, sendResponse) {
    var currentProxyStatus;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.n) {
        case 0:
          _context3.n = 1;
          return StorageService.getProxyStatus();
        case 1:
          currentProxyStatus = _context3.v;
          if (!(currentProxyStatus === PROXY_STATUSES.CONNECT)) {
            _context3.n = 3;
            break;
          }
          _context3.n = 2;
          return updateBypassList(function (response) {
            return sendResponse(response);
          });
        case 2:
          _context3.n = 5;
          break;
        case 3:
          _context3.n = 4;
          return enableForceKillSwitch();
        case 4:
          sendResponse({
            status: currentProxyStatus
          });
        case 5:
          return _context3.a(2);
      }
    }, _callee3);
  }));
  return _splitTunneling.apply(this, arguments);
}
module.exports = {
  handleSplitTunneling: handleSplitTunneling,
  handleUpdateSplitTunnelingList: handleUpdateSplitTunnelingList
};

/***/ }),

/***/ "./src/sw/tools/common.js":
/*!********************************!*\
  !*** ./src/sw/tools/common.js ***!
  \********************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! @sw/constants/country_code_mapping */ "./src/sw/constants/country_code_mapping.js"),
  COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2 = _require.COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
function updateBadge(_x) {
  return _updateBadge.apply(this, arguments);
}
function _updateBadge() {
  _updateBadge = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
    var connected, blocked, error, apiCities, countryName, found, codeAlpha3, codeAlpha2, badgeText, _t, _t2;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.p = _context.n) {
        case 0:
          connected = _ref.connected, blocked = _ref.blocked, error = _ref.error;
          _context.p = 1;
          if (!blocked) {
            _context.n = 6;
            break;
          }
          _context.n = 2;
          return browserApi.action.setBadgeText({
            text: "X"
          });
        case 2:
          _context.n = 3;
          return browserApi.action.setBadgeBackgroundColor({
            color: "#FF2D55"
          });
        case 3:
          if (!browserApi.action.setBadgeTextColor) {
            _context.n = 4;
            break;
          }
          _context.n = 4;
          return browserApi.action.setBadgeTextColor({
            color: "#FFFFFF"
          });
        case 4:
          _context.n = 5;
          return LogsService.addEvents('service.blocked.updateBadge');
        case 5:
          return _context.a(2);
        case 6:
          if (!error) {
            _context.n = 11;
            break;
          }
          _context.n = 7;
          return browserApi.action.setBadgeText({
            text: " ! "
          });
        case 7:
          _context.n = 8;
          return browserApi.action.setBadgeBackgroundColor({
            color: "#BFCAD8"
          });
        case 8:
          _context.n = 9;
          return LogsService.addEvents('service.error.updateBadge', error);
        case 9:
          if (!browserApi.action.setBadgeTextColor) {
            _context.n = 10;
            break;
          }
          _context.n = 10;
          return browserApi.action.setBadgeTextColor({
            color: "#FFFFFF"
          });
        case 10:
          return _context.a(2);
        case 11:
          if (connected) {
            _context.n = 14;
            break;
          }
          _context.n = 12;
          return browserApi.action.setBadgeText({
            text: ""
          });
        case 12:
          _context.n = 13;
          return LogsService.addEvents('service.connected.updateBadge', !connected);
        case 13:
          return _context.a(2);
        case 14:
          _context.n = 15;
          return StorageService.getCitiesList();
        case 15:
          apiCities = _context.v;
          _context.n = 16;
          return StorageService.getSelectedCountry();
        case 16:
          countryName = _context.v;
          if (!(!countryName || !Array.isArray(apiCities) || apiCities.length === 0)) {
            _context.n = 18;
            break;
          }
          _context.n = 17;
          return browserApi.action.setBadgeText({
            text: ""
          });
        case 17:
          return _context.a(2);
        case 18:
          found = apiCities.find(function (c) {
            return c.country === countryName;
          });
          codeAlpha3 = found === null || found === void 0 ? void 0 : found.country_code;
          codeAlpha2 = codeAlpha3 ? COUNTRY_CODE_MAPPING_ALPHA3_TO_ALPHA2[codeAlpha3] : undefined;
          badgeText = (codeAlpha2 || "").toUpperCase();
          if (badgeText) {
            _context.n = 20;
            break;
          }
          _context.n = 19;
          return browserApi.action.setBadgeText({
            text: ""
          });
        case 19:
          return _context.a(2);
        case 20:
          _context.n = 21;
          return browserApi.action.setBadgeText({
            text: badgeText
          });
        case 21:
          _context.n = 22;
          return browserApi.action.setBadgeBackgroundColor({
            color: "#34c759"
          });
        case 22:
          if (!browserApi.action.setBadgeTextColor) {
            _context.n = 23;
            break;
          }
          _context.n = 23;
          return browserApi.action.setBadgeTextColor({
            color: "#FFFFFF"
          });
        case 23:
          _context.n = 28;
          break;
        case 24:
          _context.p = 24;
          _t = _context.v;
          _context.n = 25;
          return LogsService.addEvents('service.error.updateBadge_er', _t.message);
        case 25:
          _context.p = 25;
          _context.n = 26;
          return browserApi.action.setBadgeText({
            text: ""
          });
        case 26:
          _context.n = 28;
          break;
        case 27:
          _context.p = 27;
          _t2 = _context.v;
        case 28:
          return _context.a(2);
      }
    }, _callee, null, [[25, 27], [1, 24]]);
  }));
  return _updateBadge.apply(this, arguments);
}
function updateIcon(_x2) {
  return _updateIcon.apply(this, arguments);
}
function _updateIcon() {
  _updateIcon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(connected) {
    var iconPath, _t3;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          iconPath = 'icons/icon.png';
          browserApi.action.setIcon({
            path: iconPath
          }, function () {});
          _context2.n = 1;
          return StorageService.getAnotherExtension();
        case 1:
          _t3 = !_context2.v;
          if (!_t3) {
            _context2.n = 3;
            break;
          }
          _context2.n = 2;
          return StorageService.getDisabledPermissionsExtension();
        case 2:
          _t3 = !_context2.v;
        case 3:
          if (!_t3) {
            _context2.n = 5;
            break;
          }
          _context2.n = 4;
          return updateBadge({
            connected: connected
          });
        case 4:
          _context2.n = 6;
          break;
        case 5:
          _context2.n = 6;
          return updateBadge({
            blocked: true
          });
        case 6:
          return _context2.a(2);
      }
    }, _callee2);
  }));
  return _updateIcon.apply(this, arguments);
}
function updateBlockIcon() {
  return _updateBlockIcon.apply(this, arguments);
}
function _updateBlockIcon() {
  _updateBlockIcon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.n) {
        case 0:
          _context3.n = 1;
          return updateBadge({
            error: true
          });
        case 1:
          return _context3.a(2);
      }
    }, _callee3);
  }));
  return _updateBlockIcon.apply(this, arguments);
}
function createBypassMatchers(list) {
  var matchers = [];
  var _iterator = _createForOfIteratorHelper(list),
    _step;
  try {
    var _loop = function _loop() {
        var raw = _step.value;
        var entry = raw.trim().toLowerCase();
        if (entry === '<loopback>') {
          matchers.push(function (host) {
            return host.startsWith('127.') || host === 'localhost';
          });
          return 0; // continue
        }
        if (entry === '<local>') {
          matchers.push(function (host) {
            return host.endsWith('.local') || host === 'localhost' || /^[^\.]+$/.test(host);
          });
          return 0; // continue
        }
        if (entry.startsWith('*.')) {
          var domain = entry.slice(2);
          matchers.push(function (host) {
            return host.endsWith('.' + domain);
          });
          return 0; // continue
        }
        if (entry.startsWith('*')) {
          var _domain = entry.slice(1);
          matchers.push(function (host) {
            return host.endsWith('.' + _domain);
          });
          matchers.push(function (host) {
            return host.endsWith(_domain);
          });
          return 0; // continue
        }
        matchers.push(function (host) {
          return host === entry;
        });
      },
      _ret;
    for (_iterator.s(); !(_step = _iterator.n()).done;) {
      _ret = _loop();
      if (_ret === 0) continue;
    }
  } catch (err) {
    _iterator.e(err);
  } finally {
    _iterator.f();
  }
  return matchers;
}
function checkUserUid(_x3, _x4) {
  return _checkUserUid.apply(this, arguments);
}
function _checkUserUid() {
  _checkUserUid = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(email, hash) {
    var hashedEmail;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.n) {
        case 0:
          _context4.n = 1;
          return hashEmail(email);
        case 1:
          hashedEmail = _context4.v;
          if (!(hash !== hashedEmail)) {
            _context4.n = 5;
            break;
          }
          if (true) {
            _context4.n = 4;
            break;
          }
          _context4.n = 2;
          return StorageService.saveGeneralSettings({});
        case 2:
          _context4.n = 3;
          return StorageService.saveSettings({
            splitTunneling: true
          });
        case 3:
          _context4.n = 4;
          return StorageService.saveSecuritySettings({
            stopWebRTC: true,
            warnings: false,
            threatProtection: false
          });
        case 4:
          _context4.n = 5;
          return StorageService.saveUserUid(hashedEmail);
        case 5:
          return _context4.a(2);
      }
    }, _callee4);
  }));
  return _checkUserUid.apply(this, arguments);
}
function hashEmail(_x5) {
  return _hashEmail.apply(this, arguments);
}
function _hashEmail() {
  _hashEmail = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(email) {
    var hashed;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.n) {
        case 0:
          _context5.n = 1;
          return crypto.subtle.digest("SHA-256", new TextEncoder().encode(email));
        case 1:
          hashed = _context5.v;
          return _context5.a(2, Array.from(new Uint8Array(hashed)).map(function (b) {
            return b.toString(16).padStart(2, "0");
          }).join(""));
      }
    }, _callee5);
  }));
  return _hashEmail.apply(this, arguments);
}
function getCountryCodeByCountry(_x6) {
  return _getCountryCodeByCountry.apply(this, arguments);
}
function _getCountryCodeByCountry() {
  _getCountryCodeByCountry = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(country) {
    var countries, foundCountry;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.n) {
        case 0:
          _context6.n = 1;
          return StorageService.getCitiesList();
        case 1:
          countries = _context6.v;
          foundCountry = Object.values(countries).find(function (countryData) {
            return countryData.country.toLowerCase() === country.toLowerCase();
          });
          return _context6.a(2, foundCountry ? foundCountry.country_code : null);
      }
    }, _callee6);
  }));
  return _getCountryCodeByCountry.apply(this, arguments);
}
function getOSFromUserAgent() {
  var ua = navigator.userAgent;
  var os = "Unknown";
  var version = "";
  if (/Windows NT/.test(ua)) {
    os = "Windows";
    var match = ua.match(/Windows NT ([0-9.]+)/);
    if (match) version = match[1];
  } else if (/Mac OS X/.test(ua)) {
    os = "macOS";
    var _match = ua.match(/Mac OS X ([0-9_]+)/);
    if (_match) version = _match[1].replace(/_/g, ".");
  } else if (/Linux/.test(ua)) {
    os = "Linux";
  }
  return {
    os: os,
    version: version
  };
}
function getBrowserInfo() {
  var ua = navigator.userAgent;
  var browser = "Unknown";
  var version = "0";
  if (ua.includes("Edg/")) {
    var _ua$match;
    browser = "Edge";
    version = (_ua$match = ua.match(/Edg\/([0-9.]+)/)) === null || _ua$match === void 0 ? void 0 : _ua$match[1];
  } else if (ua.includes("Chrome/")) {
    var _ua$match2;
    browser = "Chrome";
    version = (_ua$match2 = ua.match(/Chrome\/([0-9.]+)/)) === null || _ua$match2 === void 0 ? void 0 : _ua$match2[1];
  } else if (ua.includes("Firefox/")) {
    var _ua$match3;
    browser = "Firefox";
    version = (_ua$match3 = ua.match(/Firefox\/([0-9.]+)/)) === null || _ua$match3 === void 0 ? void 0 : _ua$match3[1];
  } else if (ua.includes("Safari/") && ua.includes("Version/")) {
    var _ua$match4;
    browser = "Safari";
    version = (_ua$match4 = ua.match(/Version\/([0-9.]+)/)) === null || _ua$match4 === void 0 ? void 0 : _ua$match4[1];
  }
  return {
    browser: browser,
    version: version
  };
}
function getUserAgentForApi() {
  var version = browserApi.runtime.getManifest().version;
  var browserInfo = getBrowserInfo();
  var osInfo = getOSFromUserAgent();
  return "ApexGuard/".concat(version, " (").concat(browserInfo.browser, " ").concat(browserInfo.version, "; ").concat(osInfo.os, ";)");
}
module.exports = {
  updateIcon: updateIcon,
  updateBlockIcon: updateBlockIcon,
  createBypassMatchers: createBypassMatchers,
  checkUserUid: checkUserUid,
  getCountryCodeByCountry: getCountryCodeByCountry,
  getUserAgentForApi: getUserAgentForApi
};

/***/ }),

/***/ "./src/sw/tools/log.js":
/*!*****************************!*\
  !*** ./src/sw/tools/log.js ***!
  \*****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   LOG_LEVELS: () => (/* binding */ LOG_LEVELS),
/* harmony export */   log: () => (/* binding */ log)
/* harmony export */ });
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
/* harmony import */ var _common_browserApi__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_common_browserApi__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); }

var LOG_LEVELS = {
  INFO: 'info',
  WARN: 'warn',
  ERROR: 'error',
  DEBUG: 'debug'
};
var isDebugEnabled = false;
var STORAGE_KEY_DEBUG = 'debugLog';
function startDebugStatusUpdater() {
  _common_browserApi__WEBPACK_IMPORTED_MODULE_0___default().storage.local.get([STORAGE_KEY_DEBUG], function (result) {
    isDebugEnabled = result[STORAGE_KEY_DEBUG] || false;
  });
  setInterval(function () {
    _common_browserApi__WEBPACK_IMPORTED_MODULE_0___default().storage.local.get([STORAGE_KEY_DEBUG], function (result) {
      isDebugEnabled = result[STORAGE_KEY_DEBUG] || false;
    });
  }, 60000);
}
startDebugStatusUpdater();
function log(level) {
  try {
    if (!isDebugEnabled) {
      return;
    }
    for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
      args[_key - 1] = arguments[_key];
    }
    var message = args.map(function (arg) {
      return _typeof(arg) === 'object' ? JSON.stringify(arg) : arg;
    }).join(' ');
    var prefix = "[Utils][".concat(new Date().toISOString(), "] [").concat(level.toUpperCase(), "]");
    var logMethod = console[level] || console.log;
    logMethod("".concat(prefix, " ").concat(message));
  } catch (e) {}
}


/***/ }),

/***/ "./src/sw/tools/proxy_utils.js":
/*!*************************************!*\
  !*** ./src/sw/tools/proxy_utils.js ***!
  \*************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require = __webpack_require__(/*! ./common */ "./src/sw/tools/common.js"),
  updateIcon = _require.updateIcon;
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require2 = __webpack_require__(/*! @services/HttpRequestApi */ "./src/common/services/HttpRequestApi.js"),
  HttpRequestApi = _require2.HttpRequestApi;
var _require3 = __webpack_require__(/*! @common/browser_storages/browser_storage */ "./src/common/browser_storages/browser_storage.js"),
  removeStorageAsync = _require3.removeStorageAsync;
var _require4 = __webpack_require__(/*! @sw/constants/storage_keys_constants */ "./src/sw/constants/storage_keys_constants.js"),
  STORAGE_KEYS = _require4.STORAGE_KEYS;
var _require5 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require5.log,
  LOG_LEVELS = _require5.LOG_LEVELS;
var _require6 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require6.PROXY_STATUSES;
var _require7 = __webpack_require__(/*! @common/functions/updateFirefoxProxyListener */ "./src/common/functions/updateFirefoxProxyListener.js"),
  clearFirefoxProxyListener = _require7.clearFirefoxProxyListener,
  updateFirefoxProxyListener = _require7.updateFirefoxProxyListener;
var _require8 = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js"),
  showKillSwitchWarning = _require8.showKillSwitchWarning;
var _require9 = __webpack_require__(/*! @common/functions/checkDomains */ "./src/common/functions/checkDomains.js"),
  checkDomains = _require9.checkDomains;
var _require0 = __webpack_require__(/*! @sw/constants/default_urls_constants */ "./src/sw/constants/default_urls_constants.js"),
  getDefaultPasses = _require0.getDefaultPasses;
var _require1 = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js"),
  API_URLS = _require1.API_URLS;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
function handleDisconnect() {
  return _handleDisconnect.apply(this, arguments);
}
function _handleDisconnect() {
  _handleDisconnect = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
    var sendResponse,
      disconnect_with_error,
      ignore_status_killswitch,
      isCheckCancel,
      manual_disconnect,
      _args = arguments;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          sendResponse = _args.length > 0 && _args[0] !== undefined ? _args[0] : function () {};
          disconnect_with_error = _args.length > 1 && _args[1] !== undefined ? _args[1] : false;
          ignore_status_killswitch = _args.length > 2 && _args[2] !== undefined ? _args[2] : false;
          isCheckCancel = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
          manual_disconnect = _args.length > 4 && _args[4] !== undefined ? _args[4] : false;
          _context.n = 1;
          return disconnectProxy(sendResponse, disconnect_with_error, ignore_status_killswitch, isCheckCancel, manual_disconnect);
        case 1:
          _context.n = 2;
          return removeStorageAsync(STORAGE_KEYS.SELECTED_COUNTRY);
        case 2:
          return _context.a(2);
      }
    }, _callee);
  }));
  return _handleDisconnect.apply(this, arguments);
}
function disconnectProxy() {
  return _disconnectProxy.apply(this, arguments);
}
function _disconnectProxy() {
  _disconnectProxy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
    var sendResponse,
      disconnect_with_error,
      ignore_status_killswitch,
      isCheckCancel,
      manual_disconnect,
      _args2 = arguments;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          sendResponse = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : function () {};
          disconnect_with_error = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : false;
          ignore_status_killswitch = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : false;
          isCheckCancel = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : false;
          manual_disconnect = _args2.length > 4 && _args2[4] !== undefined ? _args2[4] : false;
          _context2.n = 1;
          return clearProxy(sendResponse, isCheckCancel, manual_disconnect);
        case 1:
          _context2.n = 2;
          return StorageService.getSettingsKillSwitch();
        case 2:
          if (!_context2.v) {
            _context2.n = 3;
            break;
          }
          _context2.n = 3;
          return enableForceKillSwitch(!disconnect_with_error, ignore_status_killswitch);
        case 3:
          return _context2.a(2);
      }
    }, _callee2);
  }));
  return _disconnectProxy.apply(this, arguments);
}
function clearProxy(_x) {
  return _clearProxy.apply(this, arguments);
}
function _clearProxy() {
  _clearProxy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(callback) {
    var isCheckCancel,
      manual_disconnect,
      currentProxy,
      serverDomain,
      request,
      isCanceled,
      _args3 = arguments,
      _t;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.p = _context3.n) {
        case 0:
          isCheckCancel = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
          manual_disconnect = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : false;
          if (!browserApi.isFireFoxBrowser()) {
            _context3.n = 2;
            break;
          }
          _context3.n = 1;
          return clearFirefoxProxy(callback, manual_disconnect);
        case 1:
          return _context3.a(2);
        case 2:
          _context3.p = 2;
          _context3.n = 3;
          return LogsService.addEvents('service.clearProxy', isCheckCancel);
        case 3:
          _context3.n = 4;
          return new Promise(function (resolve, reject) {
            browserApi.proxy.settings.clear({
              scope: 'regular'
            }, function () {
              if (browserApi.runtime.lastError) {
                reject(browserApi.runtime.lastError);
              } else {
                resolve();
              }
            });
          });
        case 4:
          _context3.n = 5;
          return StorageService.getCurrentProxy();
        case 5:
          currentProxy = _context3.v;
          _context3.n = 6;
          return StorageService.getServerDomain();
        case 6:
          serverDomain = _context3.v;
          request = new HttpRequestApi(serverDomain);
          _context3.n = 7;
          return StorageService.clearProxySettings();
        case 7:
          _context3.n = 8;
          return request.sendEndConnectRequest(currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.username, currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.password, manual_disconnect);
        case 8:
          isCanceled = false;
          if (!isCheckCancel) {
            _context3.n = 10;
            break;
          }
          _context3.n = 9;
          return StorageService.getCancelConnect();
        case 9:
          isCanceled = _context3.v;
        case 10:
          _context3.n = 11;
          return updateIcon(false);
        case 11:
          callback({
            status: PROXY_STATUSES.DISCONNECT,
            isCanceled: isCanceled
          });
          _context3.n = 14;
          break;
        case 12:
          _context3.p = 12;
          _t = _context3.v;
          _context3.n = 13;
          return LogsService.addEvents('service.error.clearProxy', _t === null || _t === void 0 ? void 0 : _t.message);
        case 13:
          log(LOG_LEVELS.INFO, 'Error in clearProxy: ' + _t.message, 'error');
          callback({
            status: 'Error',
            error: _t.message
          });
        case 14:
          return _context3.a(2);
      }
    }, _callee3, null, [[2, 12]]);
  }));
  return _clearProxy.apply(this, arguments);
}
function clearFirefoxProxy(_x2, _x3) {
  return _clearFirefoxProxy.apply(this, arguments);
}
function _clearFirefoxProxy() {
  _clearFirefoxProxy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(callback, manual_disconnect) {
    var currentProxy, serverDomain, request, _t2, _t3;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.p = _context4.n) {
        case 0:
          _context4.p = 0;
          _context4.n = 1;
          return LogsService.addEvents('service.clearFirefoxProxy');
        case 1:
          _context4.n = 2;
          return clearFirefoxProxyListener();
        case 2:
          _context4.n = 3;
          return StorageService.getCurrentProxy();
        case 3:
          currentProxy = _context4.v;
          _context4.n = 4;
          return StorageService.getServerDomain();
        case 4:
          serverDomain = _context4.v;
          request = new HttpRequestApi(serverDomain);
          _context4.n = 5;
          return StorageService.clearProxySettings();
        case 5:
          _context4.n = 6;
          return request.sendEndConnectRequest(currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.username, currentProxy === null || currentProxy === void 0 ? void 0 : currentProxy.password, manual_disconnect);
        case 6:
          _context4.n = 7;
          return updateIcon(false);
        case 7:
          _t2 = callback;
          if (!_t2) {
            _context4.n = 8;
            break;
          }
          _context4.n = 8;
          return callback({
            status: PROXY_STATUSES.DISCONNECT
          });
        case 8:
          _context4.n = 11;
          break;
        case 9:
          _context4.p = 9;
          _t3 = _context4.v;
          _context4.n = 10;
          return LogsService.addEvents('service.error.clearFirefoxProxy', _t3 === null || _t3 === void 0 ? void 0 : _t3.message);
        case 10:
          log(LOG_LEVELS.ERROR, 'Error clearing Firefox proxy3333333:', _t3);
          callback && callback({
            status: 'Error',
            error: _t3.message
          });
        case 11:
          return _context4.a(2);
      }
    }, _callee4, null, [[0, 9]]);
  }));
  return _clearFirefoxProxy.apply(this, arguments);
}
function getNoKillSwitchDomains() {
  return _getNoKillSwitchDomains.apply(this, arguments);
}
function _getNoKillSwitchDomains() {
  _getNoKillSwitchDomains = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
    var array_domains, apiGateways, serverDomain, lastServerDomain, pauseSettings;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.n) {
        case 0:
          _context5.n = 1;
          return LogsService.addEvents('service.getNoKillSwitchDomains');
        case 1:
          array_domains = getDefaultPasses();
          _context5.n = 2;
          return checkDomains();
        case 2:
          _context5.n = 3;
          return StorageService.getApiGateways();
        case 3:
          apiGateways = _context5.v;
          if (apiGateways && apiGateways.length) {
            array_domains = [].concat(_toConsumableArray(array_domains), _toConsumableArray(apiGateways));
          }
          _context5.n = 4;
          return StorageService.getServerDomain();
        case 4:
          serverDomain = _context5.v;
          if (serverDomain) {
            array_domains.push(serverDomain);
          }
          _context5.n = 5;
          return StorageService.getLastServerDomain();
        case 5:
          lastServerDomain = _context5.v;
          if (lastServerDomain) {
            array_domains.push(lastServerDomain);
          }
          _context5.n = 6;
          return StorageService.getPauseSetting();
        case 6:
          pauseSettings = _context5.v;
          if (pauseSettings !== null && pauseSettings !== void 0 && pauseSettings.pause) {
            array_domains.push(API_URLS.QUICK_PING_IP);
          }
          return _context5.a(2, array_domains);
      }
    }, _callee5);
  }));
  return _getNoKillSwitchDomains.apply(this, arguments);
}
function enableForceKillSwitch() {
  return _enableForceKillSwitch.apply(this, arguments);
}
function _enableForceKillSwitch() {
  _enableForceKillSwitch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
    var _settings$splitTunnel;
    var show_window,
      ignore_status,
      authData,
      previousVpnState,
      disabledPermissionsExtension,
      settings,
      array_domains,
      splitTunneling,
      bypassList,
      _args7 = arguments,
      _t5;
    return _regenerator().w(function (_context7) {
      while (1) switch (_context7.n) {
        case 0:
          show_window = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
          ignore_status = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : false;
          _context7.n = 1;
          return StorageService.getAuthData();
        case 1:
          authData = _context7.v;
          _context7.n = 2;
          return StorageService.getAnotherExtension();
        case 2:
          previousVpnState = _context7.v;
          _context7.n = 3;
          return StorageService.getDisabledPermissionsExtension();
        case 3:
          disabledPermissionsExtension = _context7.v;
          _context7.n = 4;
          return StorageService.getSettings();
        case 4:
          _t5 = _context7.v;
          if (_t5) {
            _context7.n = 5;
            break;
          }
          _t5 = {};
        case 5:
          settings = _t5;
          if (!(!ignore_status && authData.proxyStatus === PROXY_STATUSES.CONNECT || !authData.loggedIn || !authData.userData || !authData.userData.has_active_subscription || !(settings !== null && settings !== void 0 && settings.killSwitch) || previousVpnState || disabledPermissionsExtension)) {
            _context7.n = 6;
            break;
          }
          return _context7.a(2);
        case 6:
          _context7.n = 7;
          return getNoKillSwitchDomains();
        case 7:
          array_domains = _context7.v;
          splitTunneling = settings.splitTunneling ? settings.splitTunneling : true;
          bypassList = splitTunneling && (_settings$splitTunnel = settings.splitTunnelingList) !== null && _settings$splitTunnel !== void 0 && _settings$splitTunnel.length ? [].concat(_toConsumableArray(array_domains), _toConsumableArray(settings.splitTunnelingList)) : array_domains;
          if (!browserApi.isFireFoxBrowser()) {
            _context7.n = 9;
            break;
          }
          _context7.n = 8;
          return firefoxKillSwitch(bypassList, show_window);
        case 8:
          return _context7.a(2);
        case 9:
          log(LOG_LEVELS.INFO, 'proxy.settings.setproxy.settings.setproxy.settings.setproxy.settings.setproxy.settings.set');
          browserApi.proxy.settings.set({
            value: {
              mode: 'fixed_servers',
              rules: {
                singleProxy: {
                  scheme: 'http',
                  host: '127.0.0.1',
                  port: 1
                },
                bypassList: bypassList
              }
            },
            scope: 'regular'
          }, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
            var serverDomain, request, _t4;
            return _regenerator().w(function (_context6) {
              while (1) switch (_context6.p = _context6.n) {
                case 0:
                  _context6.p = 0;
                  _context6.n = 1;
                  return LogsService.addEvents('service.enableForceKillSwitch');
                case 1:
                  _context6.n = 2;
                  return StorageService.getServerDomain();
                case 2:
                  serverDomain = _context6.v;
                  request = new HttpRequestApi(serverDomain);
                  _context6.n = 3;
                  return request.sendEndConnectRequest(null, null, true);
                case 3:
                  _context6.n = 4;
                  return StorageService.saveProxyStatus(PROXY_STATUSES.KILL_SWITCH);
                case 4:
                  _context6.n = 5;
                  return updateIcon(false);
                case 5:
                  if (show_window) showKillSwitchWarning();
                  _context6.n = 7;
                  break;
                case 6:
                  _context6.p = 6;
                  _t4 = _context6.v;
                  _context6.n = 7;
                  return LogsService.addEvents('service.error.showKillSwitchWarning', _t4.message);
                case 7:
                  return _context6.a(2);
              }
            }, _callee6, null, [[0, 6]]);
          })));
        case 10:
          return _context7.a(2);
      }
    }, _callee7);
  }));
  return _enableForceKillSwitch.apply(this, arguments);
}
function firefoxKillSwitch(_x4, _x5) {
  return _firefoxKillSwitch.apply(this, arguments);
}
function _firefoxKillSwitch() {
  _firefoxKillSwitch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(bypassList, show_window) {
    var proxyStatus, _t6;
    return _regenerator().w(function (_context8) {
      while (1) switch (_context8.p = _context8.n) {
        case 0:
          _context8.p = 0;
          _context8.n = 1;
          return LogsService.addEvents('service.firefoxKillSwitch');
        case 1:
          _context8.n = 2;
          return updateFirefoxProxyListener({
            scheme: "http",
            host: "127.0.0.1",
            port: 1,
            bypassList: bypassList,
            killSwitch: true
          });
        case 2:
          proxyStatus = PROXY_STATUSES.KILL_SWITCH;
          _context8.n = 3;
          return StorageService.saveProxyStatus(proxyStatus);
        case 3:
          _context8.n = 4;
          return updateIcon(false);
        case 4:
          if (show_window) showKillSwitchWarning();
          _context8.n = 7;
          break;
        case 5:
          _context8.p = 5;
          _t6 = _context8.v;
          _context8.n = 6;
          return LogsService.addEvents('service.error.firefoxKillSwitch', _t6.message);
        case 6:
          log(LOG_LEVELS.ERROR, 'Firefox Force KillSwitch error:', _t6);
        case 7:
          return _context8.a(2);
      }
    }, _callee8, null, [[0, 5]]);
  }));
  return _firefoxKillSwitch.apply(this, arguments);
}
function disconnectWithEnableKillSwitch(_x6) {
  return _disconnectWithEnableKillSwitch.apply(this, arguments);
}
function _disconnectWithEnableKillSwitch() {
  _disconnectWithEnableKillSwitch = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(sendResponse) {
    return _regenerator().w(function (_context9) {
      while (1) switch (_context9.n) {
        case 0:
          _context9.n = 1;
          return clearProxy(function (response) {
            sendResponse(response);
          });
        case 1:
          _context9.n = 2;
          return enableForceKillSwitch(true, true);
        case 2:
          _context9.n = 3;
          return removeStorageAsync(STORAGE_KEYS.SELECTED_COUNTRY);
        case 3:
          return _context9.a(2);
      }
    }, _callee9);
  }));
  return _disconnectWithEnableKillSwitch.apply(this, arguments);
}
module.exports = {
  handleDisconnect: handleDisconnect,
  enableForceKillSwitch: enableForceKillSwitch,
  disconnectProxy: disconnectProxy,
  disconnectWithEnableKillSwitch: disconnectWithEnableKillSwitch
};

/***/ }),

/***/ "./src/sw/tools/ui_utils.js":
/*!**********************************!*\
  !*** ./src/sw/tools/ui_utils.js ***!
  \**********************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require = __webpack_require__(/*! @common/functions/executeScriptCompat */ "./src/common/functions/executeScriptCompat.js"),
  executeScriptCompat = _require.executeScriptCompat;
var _require2 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require2.log,
  LOG_LEVELS = _require2.LOG_LEVELS;
function showKillSwitchWarning() {
  browserApi.tabs.query({
    active: true,
    currentWindow: true
  }, function (tabs) {
    if (tabs[0]) {
      var tab = tabs[0];
      if (tab.url && tab.url.startsWith('browserApi://')) {
        return;
      }
      executeScriptCompat({
        tabId: tab.id,
        func: function func() {
          var existingWarning = document.getElementById('killSwitchWarning');
          if (existingWarning) {
            existingWarning.remove();
          }
          var warning = document.createElement('div');
          warning.id = 'killSwitchWarning';
          warning.innerHTML = "\n            <div style=\"position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; display: flex; justify-content: center; align-items: center;\">\n              <div style=\"background: #f8d7da; color: #721c24; padding: 20px; border: 1px solid #f5c6cb; border-radius: 5px; text-align: center;\">\n                <h1 style=\"font-size: 18px; margin-bottom: 10px;\">Kill Switch Activated</h1>\n                <p style=\"font-size: 14px; margin-bottom: 20px;\">Your internet access is blocked until you reconnect to the VPN.</p>\n                <button id=\"killSwitchOkButton\" style=\"background: #721c24; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer;\">OK</button>\n              </div>\n            </div>\n          ";
          document.body.appendChild(warning);
          var okButton = document.getElementById('killSwitchOkButton');
          if (okButton) {
            okButton.addEventListener('click', function () {
              warning.remove();
            });
          }
        }
      }, function () {
        if (browserApi.runtime.lastError) {
          log(LOG_LEVELS.ERROR, 'Error injecting warning:', browserApi.runtime.lastError);
        } else {
          log(LOG_LEVELS.INFO, 'Warning injected into active tab');
        }
      });
    } else {
      log(LOG_LEVELS.INFO, 'Active tab not found');
    }
  });
}
module.exports = {
  showKillSwitchWarning: showKillSwitchWarning
};

/***/ }),

/***/ "./src/sw/tools/utils.js":
/*!*******************************!*\
  !*** ./src/sw/tools/utils.js ***!
  \*******************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {

function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
var _require = __webpack_require__(/*! ../main/notification_service */ "./src/sw/main/notification_service.js"),
  notifyInsecureWebsite = _require.notifyInsecureWebsite;
var _require2 = __webpack_require__(/*! ../constants/security_constants */ "./src/sw/constants/security_constants.js"),
  WEBRTC_DISABLE_NON_PROXIED_UDP = _require2.WEBRTC_DISABLE_NON_PROXIED_UDP,
  WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE = _require2.WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE,
  getBlockedDomains = _require2.getBlockedDomains,
  getBlockingRules = _require2.getBlockingRules;
var _require3 = __webpack_require__(/*! ./ui_utils */ "./src/sw/tools/ui_utils.js"),
  showKillSwitchWarning = _require3.showKillSwitchWarning;
var _require4 = __webpack_require__(/*! ./common */ "./src/sw/tools/common.js"),
  updateIcon = _require4.updateIcon,
  createBypassMatchers = _require4.createBypassMatchers;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require5 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require5.log,
  LOG_LEVELS = _require5.LOG_LEVELS;
var _require6 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require6.PROXY_STATUSES;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
function setWarnings(_x, _x2) {
  return _setWarnings.apply(this, arguments);
}
function _setWarnings() {
  _setWarnings = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(enabled, callback) {
    var settings, _t;
    return _regenerator().w(function (_context) {
      while (1) switch (_context.p = _context.n) {
        case 0:
          _context.p = 0;
          _context.n = 1;
          return LogsService.addEvents('service.error.utils.setWarnings');
        case 1:
          _context.n = 2;
          return StorageService.getSecuritySettings();
        case 2:
          settings = _context.v;
          settings.warnings = enabled;
          _context.n = 3;
          return StorageService.saveSecuritySettings(settings);
        case 3:
          callback({
            success: true
          });
          _context.n = 6;
          break;
        case 4:
          _context.p = 4;
          _t = _context.v;
          _context.n = 5;
          return LogsService.addEvents('service.error.utils.setWarnings', _t === null || _t === void 0 ? void 0 : _t.message);
        case 5:
          callback({
            success: false
          });
        case 6:
          return _context.a(2);
      }
    }, _callee, null, [[0, 4]]);
  }));
  return _setWarnings.apply(this, arguments);
}
function checkWebsiteSecurity(_x3, _x4) {
  return _checkWebsiteSecurity.apply(this, arguments);
}
function _checkWebsiteSecurity() {
  _checkWebsiteSecurity = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(details, handleInternalMessage) {
    var proxyStatus, settings, warningsEnabled, isConnected, url;
    return _regenerator().w(function (_context2) {
      while (1) switch (_context2.n) {
        case 0:
          _context2.n = 1;
          return StorageService.getProxyStatus();
        case 1:
          proxyStatus = _context2.v;
          _context2.n = 2;
          return StorageService.getSecuritySettings();
        case 2:
          settings = _context2.v;
          warningsEnabled = (settings === null || settings === void 0 ? void 0 : settings.warnings) || false;
          isConnected = proxyStatus === PROXY_STATUSES.CONNECT;
          _context2.n = 3;
          return LogsService.addEvents('service.checkWebsiteSecurity');
        case 3:
          if (!(!warningsEnabled || isConnected || !details.url || details.url.startsWith('chrome://') || details.url.startsWith('about:'))) {
            _context2.n = 4;
            break;
          }
          return _context2.a(2);
        case 4:
          url = details.url;
          if (url.startsWith('http://') && !url.startsWith('http://localhost')) {
            notifyInsecureWebsite(handleInternalMessage);
          }
        case 5:
          return _context2.a(2);
      }
    }, _callee2);
  }));
  return _checkWebsiteSecurity.apply(this, arguments);
}
function setThreatProtection(_x5, _x6) {
  return _setThreatProtection.apply(this, arguments);
}
function _setThreatProtection() {
  _setThreatProtection = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(enabled, callback) {
    var dontUpdateStorage,
      securitySettings,
      _args3 = arguments,
      _t2;
    return _regenerator().w(function (_context3) {
      while (1) switch (_context3.p = _context3.n) {
        case 0:
          dontUpdateStorage = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : false;
          _context3.p = 1;
          _context3.n = 2;
          return enableThreatProtection(enabled);
        case 2:
          if (dontUpdateStorage) {
            _context3.n = 4;
            break;
          }
          _context3.n = 3;
          return StorageService.getSecuritySettings();
        case 3:
          securitySettings = _context3.v;
          securitySettings.threatProtection = enabled;
          _context3.n = 4;
          return StorageService.saveSecuritySettings(securitySettings);
        case 4:
          callback({
            success: true
          });
          _context3.n = 7;
          break;
        case 5:
          _context3.p = 5;
          _t2 = _context3.v;
          _context3.n = 6;
          return LogsService.addEvents('service.error.setThreatProtection', _t2 === null || _t2 === void 0 ? void 0 : _t2.message);
        case 6:
          callback({
            success: false
          });
        case 7:
          return _context3.a(2);
      }
    }, _callee3, null, [[1, 5]]);
  }));
  return _setThreatProtection.apply(this, arguments);
}
function enableThreatProtection(_x7) {
  return _enableThreatProtection.apply(this, arguments);
}
function _enableThreatProtection() {
  _enableThreatProtection = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(enabled) {
    var proxyStatus, isConnected, blockedDomains, rules, removeRuleIds, _t3;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.p = _context4.n) {
        case 0:
          _context4.p = 0;
          _context4.n = 1;
          return LogsService.addEvents('service.setThreatProtection');
        case 1:
          _context4.n = 2;
          return StorageService.getProxyStatus();
        case 2:
          proxyStatus = _context4.v;
          isConnected = proxyStatus === PROXY_STATUSES.CONNECT;
          _context4.n = 3;
          return getBlockedDomains();
        case 3:
          blockedDomains = _context4.v;
          rules = enabled && isConnected ? getBlockingRules(blockedDomains) : [];
          removeRuleIds = blockedDomains && blockedDomains.length > 0 ? Array.from({
            length: blockedDomains.length
          }, function (_, index) {
            return index + 1;
          }) : [];
          _context4.n = 4;
          return browserApi.declarativeNetRequest.updateDynamicRules({
            removeRuleIds: removeRuleIds,
            addRules: rules
          });
        case 4:
          _context4.n = 6;
          break;
        case 5:
          _context4.p = 5;
          _t3 = _context4.v;
          _context4.n = 6;
          return LogsService.addEvents('service.error.setThreatProtection', _t3 === null || _t3 === void 0 ? void 0 : _t3.message);
        case 6:
          return _context4.a(2);
      }
    }, _callee4, null, [[0, 5]]);
  }));
  return _enableThreatProtection.apply(this, arguments);
}
function setWebRTCLeakProtection(_x8, _x9) {
  return _setWebRTCLeakProtection.apply(this, arguments);
}
function _setWebRTCLeakProtection() {
  _setWebRTCLeakProtection = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(enabled, callback) {
    var securitySettings, _t4;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.p = _context5.n) {
        case 0:
          _context5.p = 0;
          _context5.n = 1;
          return enableWebRTCProtection(enabled);
        case 1:
          _context5.n = 2;
          return StorageService.getSecuritySettings();
        case 2:
          securitySettings = _context5.v;
          securitySettings.stopWebRTC = enabled;
          _context5.n = 3;
          return StorageService.saveSecuritySettings(securitySettings);
        case 3:
          callback({
            success: true
          });
          _context5.n = 6;
          break;
        case 4:
          _context5.p = 4;
          _t4 = _context5.v;
          _context5.n = 5;
          return LogsService.addEvents('service.error.setWebRTCLeakProtection', _t4 === null || _t4 === void 0 ? void 0 : _t4.message);
        case 5:
          callback({
            success: false,
            error: 'Failed to set WebRTC policy'
          });
        case 6:
          return _context5.a(2);
      }
    }, _callee5, null, [[0, 4]]);
  }));
  return _setWebRTCLeakProtection.apply(this, arguments);
}
function enableWebRTCProtection(_x0) {
  return _enableWebRTCProtection.apply(this, arguments);
}
function _enableWebRTCProtection() {
  _enableWebRTCProtection = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(enabled) {
    var webrtcSetting, isFirefox, value;
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.n) {
        case 0:
          if (!(!browserApi.privacy || !browserApi.privacy.network || !browserApi.privacy.network.webRTCIPHandlingPolicy)) {
            _context6.n = 2;
            break;
          }
          log(LOG_LEVELS.INFO, 'Privacy API or webRTCIPHandlingPolicy is not available', 'error');
          _context6.n = 1;
          return LogsService.addEvents('service.setWebRTCLeakProtection', 'error');
        case 1:
          return _context6.a(2);
        case 2:
          _context6.n = 3;
          return LogsService.addEvents('service.setWebRTCLeakProtection', 'init');
        case 3:
          webrtcSetting = browserApi.privacy.network.webRTCIPHandlingPolicy;
          isFirefox = typeof browser !== 'undefined' && browser.runtime && browser.runtime.getBrowserInfo;
          value = isFirefox ? 'disable_non_proxied_udp' : enabled ? WEBRTC_DISABLE_NON_PROXIED_UDP : WEBRTC_DEFAULT_PUBLIC_AND_PRIVATE;
          _context6.n = 4;
          return webrtcSetting.set({
            value: value,
            scope: 'regular'
          });
        case 4:
          return _context6.a(2);
      }
    }, _callee6);
  }));
  return _enableWebRTCProtection.apply(this, arguments);
}
function setSplitTunneling(_x1, _x10) {
  return _setSplitTunneling.apply(this, arguments);
}
function _setSplitTunneling() {
  _setSplitTunneling = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(enabled, callback) {
    var settings, _t5;
    return _regenerator().w(function (_context7) {
      while (1) switch (_context7.p = _context7.n) {
        case 0:
          _context7.p = 0;
          _context7.n = 1;
          return LogsService.addEvents('service.setSplitTunneling');
        case 1:
          _context7.n = 2;
          return StorageService.getSettings();
        case 2:
          settings = _context7.v;
          settings.splitTunneling = enabled;
          _context7.n = 3;
          return StorageService.saveSettings(settings);
        case 3:
          callback({
            success: true
          });
          _context7.n = 6;
          break;
        case 4:
          _context7.p = 4;
          _t5 = _context7.v;
          _context7.n = 5;
          return LogsService.addEvents('service.error.setSplitTunneling', _t5.message);
        case 5:
          callback({
            success: false
          });
        case 6:
          return _context7.a(2);
      }
    }, _callee7, null, [[0, 4]]);
  }));
  return _setSplitTunneling.apply(this, arguments);
}
module.exports = {
  updateIcon: updateIcon,
  setWarnings: setWarnings,
  checkWebsiteSecurity: checkWebsiteSecurity,
  setThreatProtection: setThreatProtection,
  setWebRTCLeakProtection: setWebRTCLeakProtection,
  enableWebRTCProtection: enableWebRTCProtection,
  enableThreatProtection: enableThreatProtection,
  showKillSwitchWarning: showKillSwitchWarning,
  createBypassMatchers: createBypassMatchers,
  setSplitTunneling: setSplitTunneling
};

/***/ }),

/***/ "./src/tools/tools.js":
/*!****************************!*\
  !*** ./src/tools/tools.js ***!
  \****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   parseJwt: () => (/* binding */ parseJwt)
/* harmony export */ });
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
/**
 * @param {string} token
 * @returns {Object}
 */
var translateService = __webpack_require__(/*! @common/services/TranslateService */ "./src/common/services/TranslateService.js");
function parseJwt(token) {
  try {
    if (typeof token !== 'string' || !token.includes('.')) {
      throw new Error(translateService.t('invalid_jwt'));
    }
    var _token$split = token.split('.'),
      _token$split2 = _slicedToArray(_token$split, 3),
      headerEncoded = _token$split2[0],
      payloadEncoded = _token$split2[1],
      signature = _token$split2[2];
    if (!headerEncoded || !payloadEncoded || !signature) {
      throw new Error(translateService.t('miss_jwt'));
    }
    var decodeBase64Url = function decodeBase64Url(str) {
      str = str.replace(/-/g, '+').replace(/_/g, '/');
      var pad = str.length % 4;
      if (pad) {
        str += '='.repeat(4 - pad);
      }
      return atob(str);
    };
    var header = JSON.parse(decodeBase64Url(headerEncoded));
    var payload = JSON.parse(decodeBase64Url(payloadEncoded));
    return {
      header: header,
      payload: payload,
      signature: signature
    };
  } catch (error) {
    return {
      error: error.message
    };
  }
}


/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// 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] = {
/******/ 			id: moduleId,
/******/ 			loaded: false,
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;
/******/ 	
/******/ 		// 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/create fake namespace object */
/******/ 	(() => {
/******/ 		var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ 		var leafPrototypes;
/******/ 		// create a fake namespace object
/******/ 		// mode & 1: value is a module id, require it
/******/ 		// mode & 2: merge all properties of value into the ns
/******/ 		// mode & 4: return value when already ns object
/******/ 		// mode & 16: return value when it's Promise-like
/******/ 		// mode & 8|1: behave like require
/******/ 		__webpack_require__.t = function(value, mode) {
/******/ 			if(mode & 1) value = this(value);
/******/ 			if(mode & 8) return value;
/******/ 			if(typeof value === 'object' && value) {
/******/ 				if((mode & 4) && value.__esModule) return value;
/******/ 				if((mode & 16) && typeof value.then === 'function') return value;
/******/ 			}
/******/ 			var ns = Object.create(null);
/******/ 			__webpack_require__.r(ns);
/******/ 			var def = {};
/******/ 			leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ 			for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {
/******/ 				Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ 			}
/******/ 			def['default'] = () => (value);
/******/ 			__webpack_require__.d(ns, def);
/******/ 			return ns;
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* 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/ensure chunk */
/******/ 	(() => {
/******/ 		// The chunk loading function for additional chunks
/******/ 		// Since all referenced chunks are already included
/******/ 		// in this file, this function is empty here.
/******/ 		__webpack_require__.e = () => (Promise.resolve());
/******/ 	})();
/******/ 	
/******/ 	/* 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 });
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/node module decorator */
/******/ 	(() => {
/******/ 		__webpack_require__.nmd = (module) => {
/******/ 			module.paths = [];
/******/ 			if (!module.children) module.children = [];
/******/ 			return module;
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
(() => {
/*!******************************!*\
  !*** ./src/sw/background.js ***!
  \******************************/
var _excluded = ["token", "password", "username", "access_token", "refresh_token"],
  _excluded2 = ["token", "password", "username", "access_token", "refresh_token"];
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
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 _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
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); }
var LISTEN_CONSTANTS = __webpack_require__(/*! ./constants/listen_constants */ "./src/sw/constants/listen_constants.js");
var websocket = __webpack_require__(/*! ./main/websocket */ "./src/sw/main/websocket.js");
var _require = __webpack_require__(/*! ./main/auth */ "./src/sw/main/auth.js"),
  handleOpenRegistration = _require.handleOpenRegistration,
  handleOpenLogin = _require.handleOpenLogin,
  handleTokenReceivedMessage = _require.handleTokenReceivedMessage,
  handleLogout = _require.handleLogout,
  refreshToken = _require.refreshToken,
  handlePrivateLink = _require.handlePrivateLink;
var _require2 = __webpack_require__(/*! ./settings_services/pause_service */ "./src/sw/settings_services/pause_service.js"),
  handleSetPause = _require2.handleSetPause,
  handleDeletePause = _require2.handleDeletePause;
var _require3 = __webpack_require__(/*! ./settings_services/split_tunneling_service */ "./src/sw/settings_services/split_tunneling_service.js"),
  handleSplitTunneling = _require3.handleSplitTunneling,
  handleUpdateSplitTunnelingList = _require3.handleUpdateSplitTunnelingList;
var _require4 = __webpack_require__(/*! ./settings_services/selective_proxy_service */ "./src/sw/settings_services/selective_proxy_service.js"),
  handleSelectiveProxy = _require4.handleSelectiveProxy,
  handleUpdateSelectiveProxyList = _require4.handleUpdateSelectiveProxyList;
var _require5 = __webpack_require__(/*! ./main/tab_management_service */ "./src/sw/main/tab_management_service.js"),
  initializeTabListeners = _require5.initializeTabListeners;
var _require6 = __webpack_require__(/*! ./main/error_handling_service */ "./src/sw/main/error_handling_service.js"),
  initializeErrorListeners = _require6.initializeErrorListeners;
var _require7 = __webpack_require__(/*! ./initialization */ "./src/sw/initialization.js"),
  initialize = _require7.initialize;
var translateService = __webpack_require__(/*! @common/services/TranslateService */ "./src/common/services/TranslateService.js");
var importSettingsService = __webpack_require__(/*! @common/services/ImportSettingsService */ "./src/common/services/ImportSettingsService.js");
var browserApi = __webpack_require__(/*! @common/browserApi */ "./src/common/browserApi.js");
var _require8 = __webpack_require__(/*! @services/ConnectService */ "./src/common/services/ConnectService.js"),
  connect = _require8.connect,
  connectBySelectedServer = _require8.connectBySelectedServer;
var _require9 = __webpack_require__(/*! @sw/tools/utils */ "./src/sw/tools/utils.js"),
  setWebRTCLeakProtection = _require9.setWebRTCLeakProtection,
  setThreatProtection = _require9.setThreatProtection,
  setWarnings = _require9.setWarnings,
  checkWebsiteSecurity = _require9.checkWebsiteSecurity;
var _require0 = __webpack_require__(/*! @sw/tools/log */ "./src/sw/tools/log.js"),
  log = _require0.log,
  LOG_LEVELS = _require0.LOG_LEVELS;
var _require1 = __webpack_require__(/*! @sw/main/ping_manager */ "./src/sw/main/ping_manager.js"),
  initializePingAction = _require1.initializePingAction;
var _require10 = __webpack_require__(/*! @sw/constants/api_urls */ "./src/sw/constants/api_urls.js"),
  PRIVATE_LINKS_TYPES = _require10.PRIVATE_LINKS_TYPES;
var _require11 = __webpack_require__(/*! @sw/main/auto_connect_with_retry */ "./src/sw/main/auto_connect_with_retry.js"),
  startAutoConnectWithRetry = _require11.startAutoConnectWithRetry,
  startAutoConnectWithRetryFromState = _require11.startAutoConnectWithRetryFromState;
var _require12 = __webpack_require__(/*! @sw/content/context_menu_manager */ "./src/sw/content/context_menu_manager.js"),
  initVPNContextMenu = _require12.initVPNContextMenu;
var StorageService = __webpack_require__(/*! @services/StorageService */ "./src/common/services/StorageService.js");
var _require13 = __webpack_require__(/*! @sw/main/proxy */ "./src/sw/main/proxy.js"),
  checkManualCancelConnectAndDisconnectWithForce = _require13.checkManualCancelConnectAndDisconnectWithForce,
  clearKillSwitch = _require13.clearKillSwitch,
  disconnectProxyWithUpdateState = _require13.disconnectProxyWithUpdateState;
var _require14 = __webpack_require__(/*! @common/functions/checkDomains */ "./src/common/functions/checkDomains.js"),
  checkDomains = _require14.checkDomains;
var _require15 = __webpack_require__(/*! @sw/tools/proxy_utils */ "./src/sw/tools/proxy_utils.js"),
  enableForceKillSwitch = _require15.enableForceKillSwitch;
var LogsService = (__webpack_require__(/*! @services/LogsService */ "./src/common/services/LogsService.js")["default"]);
var _require16 = __webpack_require__(/*! @common/functions/checkSubscriptions */ "./src/common/functions/checkSubscriptions.js"),
  initSubscriptionChecker = _require16.initSubscriptionChecker,
  updateSubscriptionOnce = _require16.updateSubscriptionOnce;
var _require17 = __webpack_require__(/*! @services/CountrySelectorService */ "./src/common/services/CountrySelectorService.js"),
  CountrySelectorService = _require17.CountrySelectorService;
var _require18 = __webpack_require__(/*! @common/functions/apiGatewaysForCity */ "./src/common/functions/apiGatewaysForCity.js"),
  getApiGatewaysForCity = _require18.getApiGatewaysForCity;
var _require19 = __webpack_require__(/*! @common/functions/connectWithChangeApiGateway */ "./src/common/functions/connectWithChangeApiGateway.js"),
  connectWithChangeApiGateway = _require19.connectWithChangeApiGateway;
var _require20 = __webpack_require__(/*! @sw/constants/statuses_constants */ "./src/sw/constants/statuses_constants.js"),
  PROXY_STATUSES = _require20.PROXY_STATUSES;
var _require21 = __webpack_require__(/*! @common/functions/checkUpdateExtension */ "./src/common/functions/checkUpdateExtension.js"),
  checkUpdateExtension = _require21.checkUpdateExtension;
var _require22 = __webpack_require__(/*! @common/functions/getSpoofedData */ "./src/common/functions/getSpoofedData.js"),
  getSpoofedData = _require22.getSpoofedData,
  getSpoofedDataMessage = _require22.getSpoofedDataMessage;
var config = __webpack_require__(/*! ../../config */ "./config.js");
checkUpdateExtension();
function handleInternalMessage(message) {
  var sendResponse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
  if (message && _typeof(message) === 'object') {
    LogsService.addEvents("action.".concat(message === null || message === void 0 ? void 0 : message.action), {
      message: function (_ref) {
        var token = _ref.token,
          password = _ref.password,
          username = _ref.username,
          access_token = _ref.access_token,
          refresh_token = _ref.refresh_token,
          rest = _objectWithoutProperties(_ref, _excluded);
        return rest;
      }(message)
    });
  }
  switch (message.action) {
    case LISTEN_CONSTANTS.LOGOUT:
      handleLogout(function () {});
      break;
    case LISTEN_CONSTANTS.DISCONNECT:
      disconnectProxyWithUpdateState();
      break;
    case LISTEN_CONSTANTS.CONNECT:
      if (message && message.loggedIn) {
        connect(sendResponse, message.country);
      } else {
        sendResponse({
          success: false,
          error: ''
        });
      }
      break;
    case LISTEN_CONSTANTS.LOGIN_SUCCESS:
      handleTokenReceivedMessage(message, sendResponse);
      enableForceKillSwitch(true);
      return true;
    case LISTEN_CONSTANTS.REFRESH_TOKEN:
      refreshToken(message.refresh_token, true).then(function () {
        return sendResponse({
          success: true
        });
      })["catch"](function (error) {
        return sendResponse({
          success: false,
          error: error.message
        });
      });
      break;
    case LISTEN_CONSTANTS.UPDATE_SPLIT_TUNNELING_LIST:
      handleUpdateSplitTunnelingList(message, sendResponse);
      break;
    default:
      LogsService.addEvents('service.errorHandleOnmessage', message);
      log(LOG_LEVELS.INFO, 'Unknown internal action:', message.action);
  }
}
browserApi.runtime.onMessage.addListener(function (message, sender, sendResponse) {
  var _message$data;
  if (message && _typeof(message) === 'object') {
    LogsService.addEvents("action.".concat(message.action), {
      message: function (_ref2) {
        var token = _ref2.token,
          password = _ref2.password,
          username = _ref2.username,
          access_token = _ref2.access_token,
          refresh_token = _ref2.refresh_token,
          rest = _objectWithoutProperties(_ref2, _excluded2);
        return rest;
      }(message)
    });
  }
  switch (message.action) {
    case LISTEN_CONSTANTS.OPEN_LOGIN:
      handleOpenLogin(sendResponse);
      return true;
    case LISTEN_CONSTANTS.OPEN_REGISTRATION:
      handleOpenRegistration(sendResponse);
      return true;
    case LISTEN_CONSTANTS.OPEN_DASHBOARD:
      handlePrivateLink(PRIVATE_LINKS_TYPES.DASHBOARD, sendResponse);
      return true;
    case LISTEN_CONSTANTS.OPEN_PRICING:
      handlePrivateLink(PRIVATE_LINKS_TYPES.PRICING, sendResponse);
      return true;
    case LISTEN_CONSTANTS.CONNECT:
      if (message && message.loggedIn) {
        connect(sendResponse, message.country, message.isPause);
      } else {
        sendResponse({
          success: false,
          error: ''
        });
      }
      return true;
    case LISTEN_CONSTANTS.CONNECT_BY_SELECTED_SERVER:
      if (message && message.server) {
        connectBySelectedServer(message.server, sendResponse, message.locationSpoofing, message.isPause);
      } else {
        sendResponse({
          success: false,
          error: ''
        });
      }
      return true;
    case LISTEN_CONSTANTS.DISCONNECT:
      disconnectProxyWithUpdateState(sendResponse, false, true, false, message === null || message === void 0 || (_message$data = message.data) === null || _message$data === void 0 ? void 0 : _message$data.manual_disconnect);
      return true;
    case LISTEN_CONSTANTS.LOGOUT:
      handleLogout(sendResponse);
      return true;
    case LISTEN_CONSTANTS.ENABLE_KILL_SWITCH:
      enableForceKillSwitch(true);
      return true;
    case LISTEN_CONSTANTS.ENABLE_FIRST_LOAD_KILL_SWITCH:
      enableForceKillSwitch();
      return true;
    case LISTEN_CONSTANTS.DISABLE_KILL_SWITCH:
      clearKillSwitch(function () {});
      return true;
    case LISTEN_CONSTANTS.SET_WEBRTC_LEAK_PROTECTION:
      setWebRTCLeakProtection(message.enabled, sendResponse);
      return true;
    case LISTEN_CONSTANTS.SET_THREAT_PROTECTION:
      setThreatProtection(message.enabled, sendResponse, message.dontUpdateStorage);
      return true;
    case LISTEN_CONSTANTS.SET_WARNINGS:
      setWarnings(message.enabled, sendResponse);
      return true;
    case LISTEN_CONSTANTS.ENABLE_SPLIT_TUNNELING:
      handleSplitTunneling(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.DISABLE_SPLIT_TUNNELING:
      handleSplitTunneling(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.UPDATE_SPLIT_TUNNELING_LIST:
      handleUpdateSplitTunnelingList(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.ENABLE_SELECTIVE_PROXY:
      handleSelectiveProxy(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.DISABLE_SELECTIVE_PROXY:
      handleSelectiveProxy(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.UPDATE_SELECTIVE_PROXY_LIST:
      handleUpdateSelectiveProxyList(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.SET_PAUSE:
      handleSetPause(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.DELETE_PAUSE:
      handleDeletePause(sendResponse);
      return true;
    case LISTEN_CONSTANTS.LANGUAGE_CHANGED:
      translateService.changeLanguageByMessage(message, sendResponse);
      return true;
    case LISTEN_CONSTANTS.OPEN_IMPORT_SETTINGS:
      importSettingsService.openImportSettings(sendResponse);
      return true;
    case LISTEN_CONSTANTS.IMPORT_SETTINGS:
      importSettingsService.importSettings(message, sendResponse, handleInternalMessage);
      return true;
    case LISTEN_CONSTANTS.REFRESH_TOKEN:
      refreshToken(message.refresh_token, true).then(function () {
        return sendResponse({
          success: true
        });
      })["catch"](function (error) {
        return sendResponse({
          success: false,
          error: error.message
        });
      });
      return true;
    case LISTEN_CONSTANTS.UPDATE_SUBSCRIPTION_ONCE:
      updateSubscriptionOnce();
      return false;
    case LISTEN_CONSTANTS.GET_SPOOFED_DATA:
      getSpoofedDataMessage(sendResponse);
      return true;
    default:
      LogsService.addEvents('service.errorOnmessage', message);
      log(LOG_LEVELS.INFO, 'Unknown action:', message.action);
      return false;
  }
});
browserApi.runtime.onStartup.addListener(function () {
  startAutoConnectWithRetry(handleInternalMessage);
});
function main() {
  return _main.apply(this, arguments);
}
function _main() {
  _main = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
    return _regenerator().w(function (_context6) {
      while (1) switch (_context6.n) {
        case 0:
          initializeErrorListeners();
          _context6.n = 1;
          return initialize(handleInternalMessage);
        case 1:
          initializeTabListeners(handleInternalMessage);
          _context6.n = 2;
          return initSubscriptionChecker();
        case 2:
          _context6.n = 3;
          return websocket.initializeWebSocket(handleInternalMessage);
        case 3:
          _context6.n = 4;
          return startAutoConnectWithRetry(handleInternalMessage);
        case 4:
          initializePingAction();
          _context6.n = 5;
          return initVPNContextMenu(handleInternalMessage);
        case 5:
          return _context6.a(2);
      }
    }, _callee6);
  }));
  return _main.apply(this, arguments);
}
browserApi.alarms.create('keepAlive', {
  periodInMinutes: 0.1
});
browserApi.alarms.onAlarm.addListener(function (alarm) {
  if (alarm.name === 'keepAlive') {
    startAutoConnectWithRetryFromState(handleInternalMessage);
    checkDomains();
  }
});
main()["catch"](function (error) {
  LogsService.addEvents('error.error_main', {}, error === null || error === void 0 ? void 0 : error.message);
});
browserApi.webNavigation.onCompleted.addListener(/*#__PURE__*/function () {
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(details) {
    return _regenerator().w(function (_context) {
      while (1) switch (_context.n) {
        case 0:
          if (!(details.frameId === 0)) {
            _context.n = 1;
            break;
          }
          if (!(details.url && !details.url.startsWith('chrome://') && !details.url.startsWith('about:'))) {
            _context.n = 1;
            break;
          }
          _context.n = 1;
          return checkWebsiteSecurity(details, handleInternalMessage);
        case 1:
          return _context.a(2);
      }
    }, _callee);
  }));
  return function (_x) {
    return _ref3.apply(this, arguments);
  };
}(), {
  url: [{
    schemes: ['http', 'https']
  }]
});
var cancelTimeout;
browserApi.storage.onChanged.addListener(/*#__PURE__*/function () {
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(details) {
    var _details$loggedIn, _details$jwt, _details$refresh_toke, _details$loggedIn2, _details$apiCities, _details$apiCities2;
    var settings, _details$cancelConnec, tabs, _iterator, _step, t, currentProxy, cityCode, cityInfo, apiGatewaysForCity, proxyStatus, _t, _t2;
    return _regenerator().w(function (_context4) {
      while (1) switch (_context4.p = _context4.n) {
        case 0:
          if (!((_details$loggedIn = details.loggedIn) !== null && _details$loggedIn !== void 0 && _details$loggedIn.oldValue && !((_details$jwt = details.jwt) !== null && _details$jwt !== void 0 && _details$jwt.newValue) && !((_details$refresh_toke = details.refresh_token) !== null && _details$refresh_toke !== void 0 && _details$refresh_toke.newValue))) {
            _context4.n = 2;
            break;
          }
          _context4.n = 1;
          return clearKillSwitch(function () {});
        case 1:
          _context4.n = 2;
          return translateService.refreshTranslations();
        case 2:
          if ((_details$loggedIn2 = details.loggedIn) !== null && _details$loggedIn2 !== void 0 && _details$loggedIn2.newValue) {
            setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
              return _regenerator().w(function (_context2) {
                while (1) switch (_context2.n) {
                  case 0:
                    _context2.n = 1;
                    return enableForceKillSwitch(true);
                  case 1:
                    return _context2.a(2);
                }
              }, _callee2);
            })), 1000);
          }
          if (!(details.userData && details.userData.newValue && !details.userData.newValue.has_active_subscription)) {
            _context4.n = 4;
            break;
          }
          _context4.n = 3;
          return StorageService.getSettings();
        case 3:
          settings = _context4.v;
          if (!settings.killSwitch) {
            _context4.n = 4;
            break;
          }
          _context4.n = 4;
          return StorageService.saveSettings(_objectSpread(_objectSpread({}, settings), {}, {
            killSwitch: false
          }));
        case 4:
          if (details.cancelConnect) {
            if (cancelTimeout) {
              clearTimeout(cancelTimeout);
            }
            if ((_details$cancelConnec = details.cancelConnect) !== null && _details$cancelConnec !== void 0 && _details$cancelConnec.newValue) {
              cancelTimeout = setTimeout(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
                return _regenerator().w(function (_context3) {
                  while (1) switch (_context3.n) {
                    case 0:
                      _context3.n = 1;
                      return checkManualCancelConnectAndDisconnectWithForce();
                    case 1:
                      log(LOG_LEVELS.WARN, "Down cansel function: ");
                    case 2:
                      return _context3.a(2);
                  }
                }, _callee3);
              })), 20000);
            }
          }
          if (!(details.loadConnectStatus && browserApi.getBrowser() === 'edge')) {
            _context4.n = 15;
            break;
          }
          _context4.n = 5;
          return chrome.tabs.query({
            url: "about:srcdoc"
          });
        case 5:
          tabs = _context4.v;
          _iterator = _createForOfIteratorHelper(tabs);
          _context4.p = 6;
          _iterator.s();
        case 7:
          if ((_step = _iterator.n()).done) {
            _context4.n = 12;
            break;
          }
          t = _step.value;
          _context4.p = 8;
          _context4.n = 9;
          return chrome.tabs.update(t.id, {
            url: "edge://newtab/"
          });
        case 9:
          _context4.n = 11;
          break;
        case 10:
          _context4.p = 10;
          _t = _context4.v;
        case 11:
          _context4.n = 7;
          break;
        case 12:
          _context4.n = 14;
          break;
        case 13:
          _context4.p = 13;
          _t2 = _context4.v;
          _iterator.e(_t2);
        case 14:
          _context4.p = 14;
          _iterator.f();
          return _context4.f(14);
        case 15:
          if (!(details.isNeedUpdateApiDomain && details.isNeedUpdateApiDomain.newValue)) {
            _context4.n = 21;
            break;
          }
          _context4.n = 16;
          return StorageService.getCurrentProxy();
        case 16:
          currentProxy = _context4.v;
          _context4.n = 17;
          return CountrySelectorService.getCityCodeForCountry(currentProxy.country);
        case 17:
          cityCode = _context4.v;
          _context4.n = 18;
          return CountrySelectorService.getInfoByCityCode(cityCode);
        case 18:
          cityInfo = _context4.v;
          _context4.n = 19;
          return getApiGatewaysForCity(cityInfo, true);
        case 19:
          apiGatewaysForCity = _context4.v;
          _context4.n = 20;
          return StorageService.saveIsNeedUpdateApiDomain(false);
        case 20:
          _context4.n = 21;
          return connectWithChangeApiGateway(apiGatewaysForCity, currentProxy);
        case 21:
          if (!(details !== null && details !== void 0 && details.apiCities && !(details !== null && details !== void 0 && (_details$apiCities = details.apiCities) !== null && _details$apiCities !== void 0 && _details$apiCities.newValue) && !(details !== null && details !== void 0 && (_details$apiCities2 = details.apiCities) !== null && _details$apiCities2 !== void 0 && (_details$apiCities2 = _details$apiCities2.newValue) !== null && _details$apiCities2 !== void 0 && _details$apiCities2.length))) {
            _context4.n = 23;
            break;
          }
          _context4.n = 22;
          return StorageService.getProxyStatus();
        case 22:
          proxyStatus = _context4.v;
          if (!(proxyStatus === PROXY_STATUSES.CONNECT)) {
            _context4.n = 23;
            break;
          }
          _context4.n = 23;
          return disconnectProxyWithUpdateState();
        case 23:
          return _context4.a(2);
      }
    }, _callee4, null, [[8, 10], [6, 13, 14, 15]]);
  }));
  return function (_x2) {
    return _ref4.apply(this, arguments);
  };
}());
browserApi.webNavigation.onCommitted.addListener(/*#__PURE__*/function () {
  var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(details) {
    var _details$url;
    var spoof;
    return _regenerator().w(function (_context5) {
      while (1) switch (_context5.n) {
        case 0:
          if (config.EXECUTE_SPOOFING_SCRIPT) {
            _context5.n = 1;
            break;
          }
          return _context5.a(2);
        case 1:
          if (!(details.frameId !== 0)) {
            _context5.n = 2;
            break;
          }
          return _context5.a(2);
        case 2:
          if ((_details$url = details.url) !== null && _details$url !== void 0 && _details$url.startsWith('http')) {
            _context5.n = 3;
            break;
          }
          return _context5.a(2);
        case 3:
          _context5.n = 4;
          return getSpoofedData();
        case 4:
          spoof = _context5.v;
          if (!(!(spoof !== null && spoof !== void 0 && spoof.enabled) || !spoof.lat || !spoof.lon)) {
            _context5.n = 5;
            break;
          }
          return _context5.a(2);
        case 5:
          _context5.n = 6;
          return browserApi.scripting.executeScript({
            target: {
              tabId: details.tabId,
              allFrames: true
            },
            world: "MAIN",
            injectImmediately: true,
            func: function func(data) {
              if (!navigator.geolocation) return;
              var spoofGeolocation = function spoofGeolocation(position) {
                Object.defineProperty(position, 'coords', {
                  value: Object.create(position === null || position === void 0 ? void 0 : position.coords, {
                    latitude: {
                      value: data === null || data === void 0 ? void 0 : data.lat
                    },
                    longitude: {
                      value: data === null || data === void 0 ? void 0 : data.lon
                    },
                    accuracy: {
                      value: 200
                    },
                    altitude: {
                      value: null
                    },
                    altitudeAccuracy: {
                      value: null
                    },
                    heading: {
                      value: null
                    },
                    speed: {
                      value: null
                    }
                  })
                });
                Object.defineProperty(position, 'timestamp', {
                  value: Date.now()
                });
              };
              var proxyHandler = {
                apply: function apply(target, thisArg, argumentsList) {
                  var successCallback = argumentsList[0];
                  argumentsList[0] = function (pos) {
                    spoofGeolocation(pos);
                    successCallback(pos);
                  };
                  return target.apply(thisArg, argumentsList);
                }
              };
              navigator.geolocation.getCurrentPosition = new Proxy(navigator.geolocation.getCurrentPosition, proxyHandler);
              navigator.geolocation.watchPosition = new Proxy(navigator.geolocation.watchPosition, proxyHandler);
              var originalResolvedOptions = Intl.DateTimeFormat.prototype.resolvedOptions;
              Intl.DateTimeFormat.prototype.resolvedOptions = function () {
                var options = originalResolvedOptions.call(this);
                var newOptions = {};
                for (var key in options) newOptions[key] = options[key];
                if (data.timeZone) newOptions.timeZone = data.timeZone;
                return newOptions;
              };
              navigator.permissions.query({
                name: 'geolocation'
              }).then(function (p) {
                p.onchange = function () {
                  return location.reload(true);
                };
              });
            },
            args: [spoof]
          });
        case 6:
          return _context5.a(2);
      }
    }, _callee5);
  }));
  return function (_x3) {
    return _ref7.apply(this, arguments);
  };
}());
})();

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