{"version":3,"sources":["webpack:///./node_modules/backo2/index.js"],"names":["Backoff","opts","this","ms","min","max","factor","jitter","attempts","module","exports","prototype","duration","Math","pow","rand","random","deviation","floor","reset","setMin","setMax","setJitter"],"mappings":"wGAmBA,SAASA,EAAQC,GACfA,EAAOA,GAAQ,GACfC,KAAKC,GAAKF,EAAKG,KAAO,IACtBF,KAAKG,IAAMJ,EAAKI,KAAO,IACvBH,KAAKI,OAASL,EAAKK,QAAU,EAC7BJ,KAAKK,OAASN,EAAKM,OAAS,GAAKN,EAAKM,QAAU,EAAIN,EAAKM,OAAS,EAClEL,KAAKM,SAAW,EApBlBC,EAAOC,QAAUV,EA8BjBA,EAAQW,UAAUC,SAAW,WAC3B,IAAIT,EAAKD,KAAKC,GAAKU,KAAKC,IAAIZ,KAAKI,OAAQJ,KAAKM,YAC9C,GAAIN,KAAKK,OAAQ,CACf,IAAIQ,EAAQF,KAAKG,SACbC,EAAYJ,KAAKK,MAAMH,EAAOb,KAAKK,OAASJ,GAChDA,EAAoC,IAAN,EAAxBU,KAAKK,MAAa,GAAPH,IAAwBZ,EAAKc,EAAYd,EAAKc,EAEjE,OAAgC,EAAzBJ,KAAKT,IAAID,EAAID,KAAKG,MAS3BL,EAAQW,UAAUQ,MAAQ,WACxBjB,KAAKM,SAAW,GASlBR,EAAQW,UAAUS,OAAS,SAAShB,GAClCF,KAAKC,GAAKC,GASZJ,EAAQW,UAAUU,OAAS,SAAShB,GAClCH,KAAKG,IAAMA,GASbL,EAAQW,UAAUW,UAAY,SAASf,GACrCL,KAAKK,OAASA","file":"js/npm.backo2~ec16be05.2e614933.js","sourcesContent":["\n/**\n * Expose `Backoff`.\n */\n\nmodule.exports = Backoff;\n\n/**\n * Initialize backoff timer with `opts`.\n *\n * - `min` initial timeout in milliseconds [100]\n * - `max` max timeout [10000]\n * - `jitter` [0]\n * - `factor` [2]\n *\n * @param {Object} opts\n * @api public\n */\n\nfunction Backoff(opts) {\n opts = opts || {};\n this.ms = opts.min || 100;\n this.max = opts.max || 10000;\n this.factor = opts.factor || 2;\n this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;\n this.attempts = 0;\n}\n\n/**\n * Return the backoff duration.\n *\n * @return {Number}\n * @api public\n */\n\nBackoff.prototype.duration = function(){\n var ms = this.ms * Math.pow(this.factor, this.attempts++);\n if (this.jitter) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.jitter * ms);\n ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;\n }\n return Math.min(ms, this.max) | 0;\n};\n\n/**\n * Reset the number of attempts.\n *\n * @api public\n */\n\nBackoff.prototype.reset = function(){\n this.attempts = 0;\n};\n\n/**\n * Set the minimum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMin = function(min){\n this.ms = min;\n};\n\n/**\n * Set the maximum duration\n *\n * @api public\n */\n\nBackoff.prototype.setMax = function(max){\n this.max = max;\n};\n\n/**\n * Set the jitter\n *\n * @api public\n */\n\nBackoff.prototype.setJitter = function(jitter){\n this.jitter = jitter;\n};\n\n"],"sourceRoot":""}