{"size": 2248, "ext": "js", "max_stars_repo_path": "skype/latest/decompiled/fullExperience/rjs$$swx-jskype-main/lib/modelHelpers/signIn/skypeTokenManager.js", "max_stars_repo_name": "demurgos/skype-web-reversed", "max_stars_repo_stars_event_min_datetime": "2017-06-17T09:12:32.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-16T15:37:44.000Z", "max_issues_repo_path": "skype/latest/decompiled/fullExperience/rjs$$swx-jskype-main/lib/modelHelpers/signIn/skypeTokenManager.js", "max_issues_repo_name": "Demurgos/skype-web-reversed", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "skype/latest/decompiled/fullExperience/rjs$$swx-jskype-main/lib/modelHelpers/signIn/skypeTokenManager.js", "max_forks_repo_name": "Demurgos/skype-web-reversed", "max_forks_repo_forks_event_min_datetime": "2017-03-06T21:44:25.000Z", "max_forks_repo_forks_event_max_datetime": "2018-10-11T16:04:43.000Z"}
{"max_stars_count": 7, "max_issues_count": null, "max_forks_count": 3, "avg_line_length": 35.6825396825, "max_line_length": 211, "alphanum_fraction": 0.4964412811}
(function (e) {
  if (typeof module == "object" && typeof module.exports == "object") {
    var t = e(require, exports);
    t !== undefined && (module.exports = t);
  } else
    typeof define == "function" && define.amd && define("swx-jskype-main/lib/modelHelpers/signIn/skypeTokenManager", [
      "require",
      "exports",
      "jcafe-property-model",
      "./handlers",
      "swx-enums",
      "../../telemetry/people/skypeTokenFetched",
      "../../services/electron"
    ], e);
}(function (e, t) {
  function h(e) {
    return new c(e);
  }
  var n = e("jcafe-property-model"), r = e("./handlers"), i = e("swx-enums"), s = e("../../telemetry/people/skypeTokenFetched"), o = e("../../services/electron"), u = 600000, a = !0, f = !1, l, c = function () {
      function e(e) {
        function p() {
          return t && !v() ? m() : b(c);
        }
        function d() {
          return o.isRefreshAuthenticationAvailable() ? o.refreshAuthentication() : (l = s["default"].updateIfNeeded(l), l.reauth = !0, b(i.authType.ImplicitOAuth));
        }
        function v() {
          return c === i.authType.ImplicitOAuth ? Date.now() >= t.getExpiryTime() - u : !1;
        }
        function m() {
          var e = {
            token: t.getToken ? t.getToken() : undefined,
            expiration: t.getExpiryTime ? t.getExpiryTime() : undefined
          };
          return c === i.authType.ImplicitOAuth && (e.rpsToken = t.getRpsToken(), e.siteName = t.getSiteName()), e;
        }
        function g(e) {
          w(e);
          this.resolve(m());
          l.publish(c, a, e.getRetryCount && e.getRetryCount());
        }
        function y(e) {
          this.reject(e);
          e = e || {};
          l.publish(c, f, e.retryCount, e.error);
        }
        function b(t) {
          var i = r[t], o = n.task();
          return t && i ? (l = s["default"].updateIfNeeded(l), i(e).then(g.bind(o), y.bind(o))) : o.reject("Unknown sign in parameters"), o.promise;
        }
        function w(e) {
          e && (t = e);
        }
        e = e || {};
        var t, c = e.type || null, h = n.property({ get: p });
        this.get = h.get.bind(h);
        this.check = d;
      }
      return e;
    }();
  t.build = h;
}));
