text: (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){(function(){var Bottleneck,DEFAULT_PRIORITY,DLList,Local,NUM_PRIORITIES,RedisStorage,Sync,packagejson,parser,slice=[].slice;NUM_PRIORITIES=10;DEFAULT_PRIORITY=5;parser=require("./parser");Local=require("./Local");RedisStorage=require("./RedisStorage");DLList=require("./DLList");Sync=require("./Sync");packagejson=require("../package.json");Bottleneck=function(){class Bottleneck{constructor(options={},...invalid){var sDefaults;this.ready=this.ready.bind(this);this.disconnect=this.disconnect.bind(this);this.chain=this.chain.bind(this);this.queued=this.queued.bind(this);this.running=this.running.bind(this);this.check=this.check.bind(this);this._drainOne=this._drainOne.bind(this);this.submit=this.submit.bind(this);this.schedule=this.schedule.bind(this);this.wrap=this.wrap.bind(this);this.updateSettings=this.updateSettings.bind(this);this.currentReservoir=this.currentReservoir.bind(this);this.incrementReservoir=this.incrementReservoir.bind(this);this.on=this.on.bind(this);this.once=this.once.bind(this);this.removeAllListeners=this.removeAllListeners.bind(this);this.stopAll=this.stopAll.bind(this);if(!(options!=null&&typeof options==="object"&&invalid.length===0)){throw new Bottleneck.prototype.BottleneckError("Bottleneck v2 takes a single object argument. Refer to https://github.com/SGrondin/bottleneck#upgrading-from-v1 if you're upgrading from Bottleneck v1.")}parser.load(options,this.instanceDefaults,this);this._queues=this._makeQueues();this._executing={};this._limiter=null;this._events={};this._submitLock=new Sync("submit");this._registerLock=new Sync("register");sDefaults=parser.load(options,this.storeDefaults,{});this._store=function(){if(this.datastore==="local"){return new Local(parser.load(options,this.storeInstanceDefaults,sDefaults))}else if(this.datastore==="redis"){return new RedisStorage(this,sDefaults,parser.load(options,this.storeInstanceDefaults,{}))}else{throw new Bottleneck.prototype.BottleneckError(`Invalid datastore type: ${this.datastore}`)}}.call(this)}ready(){return this._store.ready}disconnect(flush){return this._store.disconnect(flush)}_addListener(name,status,cb){var base;if((base=this._events)[name]==null){base[name]=[]}this._events[name].push({cb:cb,status:status});return this}_trigger(name,args){if(name!=="debug"){this._trigger("debug",[`Event triggered: ${name}`,args])}if(name==="dropped"&&this.rejectOnDrop){args.forEach(function(job){return job.cb.apply({},[new Bottleneck.prototype.BottleneckError("This job has been dropped by Bottleneck")])})}if(this._events[name]==null){return}this._events[name]=this._events[name].filter(function(listener){return listener.status!=="none"});return this._events[name].forEach(function(listener){if(listener.status==="none"){return}if(listener.status==="once"){listener.status="none"}return listener.cb.apply({},args)})}_makeQueues(){var i,j,ref,results;results=[];for(i=j=1,ref=NUM_PRIORITIES;1<=ref?j<=ref:j>=ref;i=1<=ref?++j:--j){results.push(new DLList)}return results}chain(_limiter){this._limiter=_limiter;return this}_sanitizePriority(priority){var sProperty;sProperty=~~priority!==priority?DEFAULT_PRIORITY:priority;if(sProperty<0){return 0}else if(sProperty>NUM_PRIORITIES-1){return NUM_PRIORITIES-1}else{return sProperty}}_find(arr,fn){var ref;return(ref=function(){var i,j,len,x;for(i=j=0,len=arr.length;j<len;i=++j){x=arr[i];if(fn(x)){return x}}}())!=null?ref:[]}queued(priority){if(priority!=null){return this._queues[priority].length}else{return this._queues.reduce(function(a,b){return a+b.length},0)}}running(){return this._store.__running__()}_getFirst(arr){return this._find(arr,function(x){return x.length>0})}_randomIndex(){return Math.random().toString(36).slice(2)}check(weight=1){return this._store.__check__(weight)}_run(next,wait,index){var completed,done;this._trigger("debug",[`Scheduling ${next.options.id}`,{args:next.args,options:next.options}]);done=false;completed=(async(...args)=>{var e,ref,running;if(!done){try{done=true;clearTimeout(this._executing[index].expiration);delete this._executing[index];this._trigger("debug",[`Completed ${next.options.id}`,{args:next.args,options:next.options}]);({running:running}=await this._store.__free__(index,next.options.weight));this._trigger("debug",[`Freed ${next.options.id}`,{args:next.args,options:next.options}]);this._drainAll().catch(e=>{return this._trigger("error",[e])});if(running===0&&this.queued()===0){this._trigger("idle",[])}if(!this.interrupt){return(ref=next.cb)!=null?ref.apply({},args):void 0}}catch(error){e=error;return this._trigger("error",[e])}}});return this._executing[index]={timeout:setTimeout(()=>{this._trigger("debug",[`Executing ${next.options.id}`,{args:next.args,options:next.options}]);if(this._limiter!=null){return this._limiter.submit.apply(this._limiter,Array.prototype.concat(next.task,next.args,completed))}else{return next.task.apply({},next.args.concat(completed))}},wait),expiration:next.options.expiration!=null?setTimeout(()=>{return completed(new Bottleneck.prototype.BottleneckError(`This job timed out after ${next.options.expiration} ms.`))},next.options.expiration):void 0,job:next}}_drainOne(freed){return this._registerLock.schedule(()=>{var args,index,options,queue,queued;if((queued=this.queued())===0){return this.Promise.resolve(false)}queue=this._getFirst(this._queues);({options:options,args:args}=queue.first());if(freed!=null&&options.weight>freed){return this.Promise.resolve(false)}this._trigger("debug",[`Draining ${options.id}`,{args:args,options:options}]);index=this._randomIndex();return this._store.__register__(index,options.weight,options.expiration).then(({success:success,wait:wait})=>{var next;this._trigger("debug",[`Drained ${options.id}`,{success:success,args:args,options:options}]);if(success){next=queue.shift();if(this.queued()===0&&this._submitLock._queue.length===0){this._trigger("empty",[])}this._run(next,wait,index)}return this.Promise.resolve(success)})})}_drainAll(freed){return this._drainOne(freed).then(success=>{if(success){return this._drainAll()}else{return this.Promise.resolve(success)}}).catch(e=>{return this._trigger("error",[e])})}submit(...args){var cb,j,job,l,options,ref,ref1,task;if(typeof args[0]==="function"){ref=args,task=ref[0],args=3<=ref.length?slice.call(ref,1,j=ref.length-1):(j=1,[]),cb=ref[j++];options=this.jobDefaults}else{ref1=args,options=ref1[0],task=ref1[1],args=4<=ref1.length?slice.call(ref1,2,l=ref1.length-1):(l=2,[]),cb=ref1[l++];options=parser.load(options,this.jobDefaults)}job={options:options,task:task,args:args,cb:cb};options.priority=this._sanitizePriority(options.priority);this._trigger("debug",[`Queueing ${options.id}`,{args:args,options:options}]);return this._submitLock.schedule(async()=>{var blocked,e,reachedHWM,shifted,strategy;try{({reachedHWM:reachedHWM,blocked:blocked,strategy:strategy}=await this._store.__submit__(this.queued(),options.weight));this._trigger("debug",[`Queued ${options.id}`,{args:args,options:options,reachedHWM:reachedHWM,blocked:blocked}])}catch(error){e=error;this._trigger("debug",[`Could not queue ${options.id}`,{args:args,options:options,error:e}]);job.cb(e);return false}if(blocked){this._queues=this._makeQueues();this._trigger("dropped",[job]);return true}else if(reachedHWM){shifted=strategy===Bottleneck.prototype.strategy.LEAK?this._getFirst(this._queues.slice(options.priority).reverse()).shift():strategy===Bottleneck.prototype.strategy.OVERFLOW_PRIORITY?this._getFirst(this._queues.slice(options.priority+1).reverse()).shift():strategy===Bottleneck.prototype.strategy.OVERFLOW?job:void 0;if(shifted!=null){this._trigger("dropped",[shifted])}if(shifted==null||strategy===Bottleneck.prototype.strategy.OVERFLOW){return reachedHWM}}this._queues[options.priority].push(job);await this._drainAll();return reachedHWM})}schedule(...args){var options,task,wrapped;if(typeof args[0]==="function"){[task,...args]=args;options=this.jobDefaults}else{[options,task,...args]=args;options=parser.load(options,this.jobDefaults)}wrapped=function(...args){var cb,j,ref;ref=args,args=2<=ref.length?slice.call(ref,0,j=ref.length-1):(j=0,[]),cb=ref[j++];return task.apply({},args).then(function(...args){return cb.apply({},Array.prototype.concat(null,args))}).catch(function(...args){return cb.apply({},args)})};return new this.Promise((resolve,reject)=>{return this.submit.apply({},Array.prototype.concat(options,wrapped,args,function(...args){return(args[0]!=null?reject:(args.shift(),resolve)).apply({},args)})).catch(e=>{return this._trigger("error",[e])})})}wrap(fn){return(...args)=>{return this.schedule.apply({},Array.prototype.concat(fn,args))}}async updateSettings(options={}){await this._store.__updateSettings__(parser.overwrite(options,this.storeDefaults));parser.overwrite(options,this.instanceDefaults,this);this._drainAll().catch(e=>{return this._trigger("error",[e])});return this}currentReservoir(){return this._store.__currentReservoir__()}async incrementReservoir(incr=0){await this._store.__incrementReservoir__(incr);this._drainAll().catch(e=>{return this._trigger("error",[e])});return this}on(name,cb){return this._addListener(name,"many",cb)}once(name,cb){return this._addListener(name,"once",cb)}removeAllListeners(name=null){if(name!=null){delete this._events[name]}else{this._events={}}return this}stopAll(interrupt=this.interrupt){var job,k,keys;this.interrupt=interrupt;keys=Object.keys(this._executing);(function(){var j,len,results;results=[];for(j=0,len=keys.length;j<len;j++){k=keys[j];results.push(clearTimeout(this._executing[k].timeout))}return results}).call(this);this._drainOne=function(){};this._drainAll=function(){};this.check=function(){return false};this.submit=function(...args){var cb,j,ref;ref=args,args=2<=ref.length?slice.call(ref,0,j=ref.length-1):(j=0,[]),cb=ref[j++];return cb(new Bottleneck.prototype.BottleneckError("This limiter is stopped"))};this.schedule=function(){return this.Promise.reject(new Bottleneck.prototype.BottleneckError("This limiter is stopped"))};if(this.interrupt){(function(){var j,len,results;results=[];for(j=0,len=keys.length;j<len;j++){k=keys[j];results.push(this._trigger("dropped",[this._executing[k].job]))}return results}).call(this)}while(job=this._getFirst(this._queues).shift()){this._trigger("dropped",[job])}this._trigger("empty",[]);if(this.running()===0){this._trigger("idle",[])}return this}}Bottleneck.default=Bottleneck;Bottleneck.version=Bottleneck.prototype.version=packagejson.version;Bottleneck.strategy=Bottleneck.prototype.strategy={LEAK:1,OVERFLOW:2,OVERFLOW_PRIORITY:4,BLOCK:3};Bottleneck.BottleneckError=Bottleneck.prototype.BottleneckError=require("./BottleneckError");Bottleneck.Cluster=Bottleneck.prototype.Cluster=require("./Cluster");Bottleneck.prototype.jobDefaults={priority:DEFAULT_PRIORITY,weight:1,expiration:null,id:"<no-id>"};Bottleneck.prototype.storeDefaults={maxConcurrent:null,minTime:0,highWater:null,strategy:Bottleneck.prototype.strategy.LEAK,penalty:null,reservoir:null};Bottleneck.prototype.storeInstanceDefaults={clientOptions:{},clearDatastore:false,Promise:Promise};Bottleneck.prototype.instanceDefaults={datastore:"local",id:"<no-id>",rejectOnDrop:true,interrupt:false,Promise:Promise};return Bottleneck}();module.exports=Bottleneck}).call(this)},{"../package.json":14,"./BottleneckError":2,"./Cluster":3,"./DLList":4,"./Local":5,"./RedisStorage":6,"./Sync":7,"./parser":9}],2:[function(require,module,exports){(function(){var BottleneckError;BottleneckError=class BottleneckError extends Error{};module.exports=BottleneckError}).call(this)},{}],3:[function(require,module,exports){(function(){var Cluster,parser,hasProp={}.hasOwnProperty;parser=require("./parser");Cluster=function(){class Cluster{constructor(limiterOptions={},clusterOptions={}){this.limiterOptions=limiterOptions;parser.load(clusterOptions,this.defaults,this);this.limiters={};this.Bottleneck=require("./Bottleneck");this.startAutoCleanup()}key(key=""){var ref;return(ref=this.limiters[key])!=null?ref:this.limiters[key]=new this.Bottleneck(this.limiterOptions)}deleteKey(key=""){return delete this.limiters[key]}all(cb){var k,ref,results,v;ref=this.limiters;results=[];for(k in ref){if(!hasProp.call(ref,k))continue;v=ref[k];results.push(cb(v))}return results}keys(){return Object.keys(this.limiters)}startAutoCleanup(){var base;this.stopAutoCleanup();return typeof(base=this.interval=setInterval(()=>{var k,ref,results,time,v;time=Date.now();ref=this.limiters;results=[];for(k in ref){v=ref[k];if(v._nextRequest+this.timeout<time){results.push(this.deleteKey(k))}else{results.push(void 0)}}return results},this.timeout/10)).unref==="function"?base.unref():void 0}stopAutoCleanup(){return clearInterval(this.interval)}updateSettings(options={}){parser.overwrite(options,this.defaults,this);if(options.timeout!=null){return this.startAutoCleanup()}}}Cluster.prototype.defaults={timeout:1e3*60*5};return Cluster}();module.exports=Cluster}).call(this)},{"./Bottleneck":1,"./parser":9}],4:[function(require,module,exports){(function(){var DLList;DLList=class DLList{constructor(){this._first=null;this._last=null;this.length=0}push(value){var node;this.length++;node={value:value,next:null};if(this._last!=null){this._last.next=node;this._last=node}else{this._first=this._last=node}return void 0}shift(){var ref1,value;if(this._first==null){return void 0}else{this.length--}value=this._first.value;this._first=(ref1=this._first.next)!=null?ref1:this._last=null;return value}first(){if(this._first!=null){return this._first.value}}getArray(){var node,ref,results;node=this._first;results=[];while(node!=null){results.push((ref=node,node=node.next,ref.value))}return results}};module.exports=DLList}).call(this)},{}],5:[function(require,module,exports){(function(){var BottleneckError,DLList,Local,parser;parser=require("./parser");DLList=require("./DLList");BottleneckError=require("./BottleneckError");Local=class Local{constructor(options){parser.load(options,options,this);this._nextRequest=Date.now();this._running=0;this._executing={};this._unblockTime=0;this.ready=this.yieldLoop()}disconnect(flush){return this}yieldLoop(t=0){return new this.Promise(function(resolve,reject){return setTimeout(resolve,t)})}computePenalty(){var ref;return(ref=this.penalty)!=null?ref:15*this.minTime||5e3}async __updateSettings__(options){await this.yieldLoop();parser.overwrite(options,options,this);return true}async __running__(){await this.yieldLoop();return this._running}conditionsCheck(weight){return(this.maxConcurrent==null||this._running+weight<=this.maxConcurrent)&&(this.reservoir==null||this.reservoir-weight>=0)}async __incrementReservoir__(incr){await this.yieldLoop();return this.reservoir+=incr}async __currentReservoir__(){await this.yieldLoop();return this.reservoir}isBlocked(now){return this._unblockTime>=now}check(weight,now){return this.conditionsCheck(weight)&&this._nextRequest-now<=0}async __check__(weight){var now;await this.yieldLoop();now=Date.now();return this.check(weight,now)}async __register__(index,weight,expiration){var now,wait;await this.yieldLoop();now=Date.now();if(this.conditionsCheck(weight)){this._running+=weight;this._executing[index]={timeout:expiration!=null?setTimeout(()=>{if(!this._executing[index].freed){this._executing[index].freed=true;return this._running-=weight}},expiration):void 0,freed:false};if(this.reservoir!=null){this.reservoir-=weight}wait=Math.max(this._nextRequest-now,0);this._nextRequest=now+wait+this.minTime;return{success:true,wait:wait}}else{return{success:false}}}strategyIsBlock(){return this.strategy===3}async __submit__(queueLength,weight){var blocked,now,reachedHWM;await this.yieldLoop();if(this.maxConcurrent!=null&&weight>this.maxConcurrent){throw new BottleneckError(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${this.maxConcurrent}`)}now=Date.now();reachedHWM=this.highWater!=null&&queueLength===this.highWater&&!this.check(weight,now);blocked=this.strategyIsBlock()&&(reachedHWM||this.isBlocked(now));if(blocked){this._unblockTime=now+this.computePenalty();this._nextRequest=this._unblockTime+this.minTime}return{reachedHWM:reachedHWM,blocked:blocked,strategy:this.strategy}}async __free__(index,weight){await this.yieldLoop();clearTimeout(this._executing[index].timeout);if(!this._executing[index].freed){this._executing[index].freed=true;this._running-=weight}return{running:this._running}}};module.exports=Local}).call(this)},{"./BottleneckError":2,"./DLList":4,"./parser":9}],6:[function(require,module,exports){(function(process,Buffer){(function(){var BottleneckError,DLList,RedisStorage,fs,libraries,parser,scripts;parser=require("./parser");DLList=require("./DLList");BottleneckError=require("./BottleneckError");libraries={};scripts={init:{keys:["b_settings","b_running","b_executing"],libs:[]},updateSettings:{keys:["b_settings"],libs:[]},running:{keys:["b_settings","b_running","b_executing"],libs:["refresh_running"]},check:{keys:["b_settings","b_running","b_executing"],libs:["refresh_running","conditions_check"]},submit:{keys:["b_settings","b_running","b_executing"],libs:["refresh_running","conditions_check"]},register:{keys:["b_settings","b_running","b_executing"],libs:["refresh_running","conditions_check"]},free:{keys:["b_settings","b_running","b_executing"],libs:["refresh_running"]},current_reservoir:{keys:["b_settings"],libs:[]},increment_reservoir:{keys:["b_settings"],libs:[]}};process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return libraries["refresh_running"]=data.toString("utf8")}})(null,Buffer("bG9jYWwgcmVmcmVzaF9ydW5uaW5nID0gZnVuY3Rpb24gKGV4ZWN1dGluZ19rZXksIHJ1bm5pbmdfa2V5LCBzZXR0aW5nc19rZXksIG5vdykKCiAgbG9jYWwgZXhwaXJlZCA9IHJlZGlzLmNhbGwoJ3pyYW5nZWJ5c2NvcmUnLCBleGVjdXRpbmdfa2V5LCAnLWluZicsICcoJy4ubm93KQoKICBpZiAjZXhwaXJlZCA9PSAwIHRoZW4KICAgIHJldHVybiByZWRpcy5jYWxsKCdoZ2V0Jywgc2V0dGluZ3Nfa2V5LCAncnVubmluZycpCiAgZWxzZQogICAgcmVkaXMuY2FsbCgnenJlbXJhbmdlYnlzY29yZScsIGV4ZWN1dGluZ19rZXksICctaW5mJywgJygnLi5ub3cpCgogICAgbG9jYWwgYXJncyA9IHsnaG1nZXQnLCBydW5uaW5nX2tleX0KICAgIGZvciBpID0gMSwgI2V4cGlyZWQgZG8KICAgICAgdGFibGUuaW5zZXJ0KGFyZ3MsIGV4cGlyZWRbaV0pCiAgICBlbmQKCiAgICBsb2NhbCB3ZWlnaHRzID0gcmVkaXMuY2FsbCh1bnBhY2soYXJncykpCgogICAgYXJnc1sxXSA9ICdoZGVsJwogICAgbG9jYWwgZGVsZXRlZCA9IHJlZGlzLmNhbGwodW5wYWNrKGFyZ3MpKQoKICAgIGxvY2FsIHRvdGFsID0gMAogICAgZm9yIGkgPSAxLCAjd2VpZ2h0cyBkbwogICAgICB0b3RhbCA9IHRvdGFsICsgKHRvbnVtYmVyKHdlaWdodHNbaV0pIG9yIDApCiAgICBlbmQKICAgIGxvY2FsIGluY3IgPSAtdG90YWwKICAgIGlmIHRvdGFsID09IDAgdGhlbgogICAgICBpbmNyID0gMAogICAgZWxzZQogICAgICByZWRpcy5jYWxsKCdwdWJsaXNoJywgJ2JvdHRsZW5lY2snLCAnZnJlZWQ6Jy4udG90YWwpCiAgICBlbmQKCiAgICByZXR1cm4gcmVkaXMuY2FsbCgnaGluY3JieScsIHNldHRpbmdzX2tleSwgJ3J1bm5pbmcnLCBpbmNyKQogIGVuZAoKZW5kCg==","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return libraries["conditions_check"]=data.toString("utf8")}})(null,Buffer("bG9jYWwgY29uZGl0aW9uc19jaGVjayA9IGZ1bmN0aW9uICh3ZWlnaHQsIG1heENvbmN1cnJlbnQsIHJ1bm5pbmcsIHJlc2Vydm9pcikKICByZXR1cm4gKAogICAgKG1heENvbmN1cnJlbnQgPT0gbmlsIG9yIHJ1bm5pbmcgKyB3ZWlnaHQgPD0gbWF4Q29uY3VycmVudCkgYW5kCiAgICAocmVzZXJ2b2lyID09IG5pbCBvciByZXNlcnZvaXIgLSB3ZWlnaHQgPj0gMCkKICApCmVuZAo=","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["init"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQpsb2NhbCBydW5uaW5nX2tleSA9IEtFWVNbMl0KbG9jYWwgZXhlY3V0aW5nX2tleSA9IEtFWVNbM10KCmxvY2FsIGNsZWFyID0gdG9udW1iZXIoQVJHVlsxXSkKCmlmIGNsZWFyID09IDEgdGhlbgogIHJlZGlzLmNhbGwoJ2RlbCcsIHNldHRpbmdzX2tleSwgcnVubmluZ19rZXksIGV4ZWN1dGluZ19rZXkpCmVuZAoKaWYgcmVkaXMuY2FsbCgnZXhpc3RzJywgc2V0dGluZ3Nfa2V5KSA9PSAwIHRoZW4KICBsb2NhbCBhcmdzID0geydobXNldCcsIHNldHRpbmdzX2tleX0KCiAgZm9yIGkgPSAyLCAjQVJHViBkbwogICAgdGFibGUuaW5zZXJ0KGFyZ3MsIEFSR1ZbaV0pCiAgZW5kCgogIHJlZGlzLmNhbGwodW5wYWNrKGFyZ3MpKQplbmQKCnJldHVybiB7fQo=","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["running"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQpsb2NhbCBydW5uaW5nX2tleSA9IEtFWVNbMl0KbG9jYWwgZXhlY3V0aW5nX2tleSA9IEtFWVNbM10KbG9jYWwgbm93ID0gQVJHVlsxXQoKcmV0dXJuIHRvbnVtYmVyKHJlZnJlc2hfcnVubmluZyhleGVjdXRpbmdfa2V5LCBydW5uaW5nX2tleSwgc2V0dGluZ3Nfa2V5LCBub3cpKQo=","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["updateSettings"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQoKbG9jYWwgYXJncyA9IHsnaG1zZXQnLCBzZXR0aW5nc19rZXl9Cgpmb3IgaSA9IDEsICNBUkdWIGRvCiAgdGFibGUuaW5zZXJ0KGFyZ3MsIEFSR1ZbaV0pCmVuZAoKcmVkaXMuY2FsbCh1bnBhY2soYXJncykpCgpyZXR1cm4ge30K","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["check"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQpsb2NhbCBydW5uaW5nX2tleSA9IEtFWVNbMl0KbG9jYWwgZXhlY3V0aW5nX2tleSA9IEtFWVNbM10KCmxvY2FsIHdlaWdodCA9IHRvbnVtYmVyKEFSR1ZbMV0pCmxvY2FsIG5vdyA9IHRvbnVtYmVyKEFSR1ZbMl0pCgpsb2NhbCBydW5uaW5nID0gdG9udW1iZXIocmVmcmVzaF9ydW5uaW5nKGV4ZWN1dGluZ19rZXksIHJ1bm5pbmdfa2V5LCBzZXR0aW5nc19rZXksIG5vdykpCmxvY2FsIHNldHRpbmdzID0gcmVkaXMuY2FsbCgnaG1nZXQnLCBzZXR0aW5nc19rZXksCiAgJ21heENvbmN1cnJlbnQnLAogICdyZXNlcnZvaXInLAogICduZXh0UmVxdWVzdCcKKQpsb2NhbCBtYXhDb25jdXJyZW50ID0gdG9udW1iZXIoc2V0dGluZ3NbMV0pCmxvY2FsIHJlc2Vydm9pciA9IHRvbnVtYmVyKHNldHRpbmdzWzJdKQpsb2NhbCBuZXh0UmVxdWVzdCA9IHRvbnVtYmVyKHNldHRpbmdzWzNdKQoKbG9jYWwgY29uZGl0aW9uc0NoZWNrID0gY29uZGl0aW9uc19jaGVjayh3ZWlnaHQsIG1heENvbmN1cnJlbnQsIHJ1bm5pbmcsIHJlc2Vydm9pcikKCmxvY2FsIHJlc3VsdCA9IGNvbmRpdGlvbnNDaGVjayBhbmQgbmV4dFJlcXVlc3QgLSBub3cgPD0gMAoKcmV0dXJuIHJlc3VsdAo=","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["submit"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQpsb2NhbCBydW5uaW5nX2tleSA9IEtFWVNbMl0KbG9jYWwgZXhlY3V0aW5nX2tleSA9IEtFWVNbM10KCmxvY2FsIHF1ZXVlTGVuZ3RoID0gdG9udW1iZXIoQVJHVlsxXSkKbG9jYWwgd2VpZ2h0ID0gdG9udW1iZXIoQVJHVlsyXSkKbG9jYWwgbm93ID0gdG9udW1iZXIoQVJHVlszXSkKCmxvY2FsIHJ1bm5pbmcgPSB0b251bWJlcihyZWZyZXNoX3J1bm5pbmcoZXhlY3V0aW5nX2tleSwgcnVubmluZ19rZXksIHNldHRpbmdzX2tleSwgbm93KSkKbG9jYWwgc2V0dGluZ3MgPSByZWRpcy5jYWxsKCdobWdldCcsIHNldHRpbmdzX2tleSwKICAnbWF4Q29uY3VycmVudCcsCiAgJ2hpZ2hXYXRlcicsCiAgJ3Jlc2Vydm9pcicsCiAgJ25leHRSZXF1ZXN0JywKICAnc3RyYXRlZ3knLAogICd1bmJsb2NrVGltZScsCiAgJ3BlbmFsdHknLAogICdtaW5UaW1lJwopCmxvY2FsIG1heENvbmN1cnJlbnQgPSB0b251bWJlcihzZXR0aW5nc1sxXSkKbG9jYWwgaGlnaFdhdGVyID0gdG9udW1iZXIoc2V0dGluZ3NbMl0pCmxvY2FsIHJlc2Vydm9pciA9IHRvbnVtYmVyKHNldHRpbmdzWzNdKQpsb2NhbCBuZXh0UmVxdWVzdCA9IHRvbnVtYmVyKHNldHRpbmdzWzRdKQpsb2NhbCBzdHJhdGVneSA9IHRvbnVtYmVyKHNldHRpbmdzWzVdKQpsb2NhbCB1bmJsb2NrVGltZSA9IHRvbnVtYmVyKHNldHRpbmdzWzZdKQpsb2NhbCBwZW5hbHR5ID0gdG9udW1iZXIoc2V0dGluZ3NbN10pCmxvY2FsIG1pblRpbWUgPSB0b251bWJlcihzZXR0aW5nc1s4XSkKCmlmIG1heENvbmN1cnJlbnQgfj0gbmlsIGFuZCB3ZWlnaHQgPiBtYXhDb25jdXJyZW50IHRoZW4KICByZXR1cm4gcmVkaXMuZXJyb3JfcmVwbHkoJ09WRVJXRUlHSFQgJy4ud2VpZ2h0Li4nICcuLm1heENvbmN1cnJlbnQpCmVuZAoKbG9jYWwgcmVhY2hlZEhXTSA9IChoaWdoV2F0ZXIgfj0gbmlsIGFuZCBxdWV1ZUxlbmd0aCA9PSBoaWdoV2F0ZXIKICBhbmQgbm90ICgKICAgIGNvbmRpdGlvbnNfY2hlY2sod2VpZ2h0LCBtYXhDb25jdXJyZW50LCBydW5uaW5nLCByZXNlcnZvaXIpCiAgICBhbmQgbmV4dFJlcXVlc3QgLSBub3cgPD0gMAogICkKKQoKbG9jYWwgYmxvY2tlZCA9IHN0cmF0ZWd5ID09IDMgYW5kIChyZWFjaGVkSFdNIG9yIHVuYmxvY2tUaW1lID49IG5vdykKCmlmIGJsb2NrZWQgdGhlbgogIGxvY2FsIGNvbXB1dGVkUGVuYWx0eSA9IHBlbmFsdHkKICBpZiBjb21wdXRlZFBlbmFsdHkgPT0gbmlsIHRoZW4KICAgIGlmIG1pblRpbWUgPT0gMCB0aGVuCiAgICAgIGNvbXB1dGVkUGVuYWx0eSA9IDUwMDAKICAgIGVsc2UKICAgICAgY29tcHV0ZWRQZW5hbHR5ID0gMTUgKiBtaW5UaW1lCiAgICBlbmQKICBlbmQKCiAgcmVkaXMuY2FsbCgnaG1zZXQnLCBzZXR0aW5nc19rZXksCiAgICAndW5ibG9ja1RpbWUnLCBub3cgKyBjb21wdXRlZFBlbmFsdHksCiAgICAnbmV4dFJlcXVlc3QnLCB1bmJsb2NrVGltZSArIG1pblRpbWUKICApCmVuZAoKcmV0dXJuIHtyZWFjaGVkSFdNLCBibG9ja2VkLCBzdHJhdGVneX0K","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["register"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQpsb2NhbCBydW5uaW5nX2tleSA9IEtFWVNbMl0KbG9jYWwgZXhlY3V0aW5nX2tleSA9IEtFWVNbM10KCmxvY2FsIGluZGV4ID0gQVJHVlsxXQpsb2NhbCB3ZWlnaHQgPSB0b251bWJlcihBUkdWWzJdKQpsb2NhbCBleHBpcmF0aW9uID0gdG9udW1iZXIoQVJHVlszXSkKbG9jYWwgbm93ID0gdG9udW1iZXIoQVJHVls0XSkKCmxvY2FsIHJ1bm5pbmcgPSB0b251bWJlcihyZWZyZXNoX3J1bm5pbmcoZXhlY3V0aW5nX2tleSwgcnVubmluZ19rZXksIHNldHRpbmdzX2tleSwgbm93KSkKbG9jYWwgc2V0dGluZ3MgPSByZWRpcy5jYWxsKCdobWdldCcsIHNldHRpbmdzX2tleSwKICAnbWF4Q29uY3VycmVudCcsCiAgJ3Jlc2Vydm9pcicsCiAgJ25leHRSZXF1ZXN0JywKICAnbWluVGltZScKKQpsb2NhbCBtYXhDb25jdXJyZW50ID0gdG9udW1iZXIoc2V0dGluZ3NbMV0pCmxvY2FsIHJlc2Vydm9pciA9IHRvbnVtYmVyKHNldHRpbmdzWzJdKQpsb2NhbCBuZXh0UmVxdWVzdCA9IHRvbnVtYmVyKHNldHRpbmdzWzNdKQpsb2NhbCBtaW5UaW1lID0gdG9udW1iZXIoc2V0dGluZ3NbNF0pCgppZiBjb25kaXRpb25zX2NoZWNrKHdlaWdodCwgbWF4Q29uY3VycmVudCwgcnVubmluZywgcmVzZXJ2b2lyKSB0aGVuCgogIGlmIGV4cGlyYXRpb24gfj0gbmlsIHRoZW4KICAgIHJlZGlzLmNhbGwoJ3phZGQnLCBleGVjdXRpbmdfa2V5LCBub3cgKyBleHBpcmF0aW9uLCBpbmRleCkKICBlbmQKICByZWRpcy5jYWxsKCdoc2V0JywgcnVubmluZ19rZXksIGluZGV4LCB3ZWlnaHQpCiAgcmVkaXMuY2FsbCgnaGluY3JieScsIHNldHRpbmdzX2tleSwgJ3J1bm5pbmcnLCB3ZWlnaHQpCgogIGxvY2FsIHdhaXQgPSBtYXRoLm1heChuZXh0UmVxdWVzdCAtIG5vdywgMCkKCiAgaWYgcmVzZXJ2b2lyID09IG5pbCB0aGVuCiAgICByZWRpcy5jYWxsKCdoc2V0Jywgc2V0dGluZ3Nfa2V5LAogICAgJ25leHRSZXF1ZXN0Jywgbm93ICsgd2FpdCArIG1pblRpbWUKICAgICkKICBlbHNlCiAgICByZWRpcy5jYWxsKCdobXNldCcsIHNldHRpbmdzX2tleSwKICAgICAgJ3Jlc2Vydm9pcicsIHJlc2Vydm9pciAtIHdlaWdodCwKICAgICAgJ25leHRSZXF1ZXN0Jywgbm93ICsgd2FpdCArIG1pblRpbWUKICAgICkKICBlbmQKCiAgcmV0dXJuIHt0cnVlLCB3YWl0fQoKZWxzZQogIHJldHVybiB7ZmFsc2V9CmVuZAo=","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["free"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQpsb2NhbCBydW5uaW5nX2tleSA9IEtFWVNbMl0KbG9jYWwgZXhlY3V0aW5nX2tleSA9IEtFWVNbM10KCmxvY2FsIGluZGV4ID0gQVJHVlsxXQpsb2NhbCBub3cgPSBBUkdWWzJdCgpyZWRpcy5jYWxsKCd6YWRkJywgZXhlY3V0aW5nX2tleSwgMCwgaW5kZXgpCgpyZXR1cm4gcmVmcmVzaF9ydW5uaW5nKGV4ZWN1dGluZ19rZXksIHJ1bm5pbmdfa2V5LCBzZXR0aW5nc19rZXksIG5vdykK","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["current_reservoir"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQoKcmV0dXJuIHRvbnVtYmVyKHJlZGlzLmNhbGwoJ2hnZXQnLCBzZXR0aW5nc19rZXksICdyZXNlcnZvaXInKSkK","base64"))});process.nextTick(function(){(function(err,data){if(err!=null){throw err}else{return scripts["increment_reservoir"].code=data.toString("utf8")}})(null,Buffer("bG9jYWwgc2V0dGluZ3Nfa2V5ID0gS0VZU1sxXQpsb2NhbCBpbmNyID0gQVJHVlsxXQoKcmV0dXJuIHJlZGlzLmNhbGwoJ2hpbmNyYnknLCBzZXR0aW5nc19rZXksICdyZXNlcnZvaXInLCBpbmNyKQo=","base64"))});RedisStorage=class RedisStorage{constructor(instance,initSettings,options){var redis;this.loadAll=this.loadAll.bind(this);this.instance=instance;redis=require("redis");parser.load(options,options,this);this.client=redis.createClient(this.clientOptions);this.subClient=redis.createClient(this.clientOptions);this.shas={};this.ready=new this.Promise((resolve,reject)=>{var count,done;count=0;done=function(){count++;if(count===2){return resolve()}};this.client.on("error",function(e){return reject(e)});this.client.on("ready",function(){return done()});this.subClient.on("error",function(e){return reject(e)});return this.subClient.on("ready",()=>{this.subClient.on("subscribe",function(){return done()});return this.subClient.subscribe("bottleneck")})}).then(this.loadAll).then(()=>{var args;this.subClient.on("message",(channel,message)=>{var info,type;[type,info]=message.split(":");if(type==="freed"){return this.instance._drainAll(~~info)}});initSettings.nextRequest=Date.now();initSettings.running=0;initSettings.unblockTime=0;args=this.prepareObject(initSettings);args.unshift(options.clearDatastore?1:0);return this.runScript("init",args)}).then(results=>{return this.client})}disconnect(flush){this.client.end(flush);this.subClient.end(flush);return this}loadScript(name){return new this.Promise((resolve,reject)=>{var payload;payload=scripts[name].libs.map(function(lib){return libraries[lib]}).join("\n")+scripts[name].code;return this.client.multi([["script","load",payload]]).exec((err,replies)=>{if(err!=null){return reject(err)}this.shas[name]=replies[0];return resolve(replies[0])})})}loadAll(){var k,v;return this.Promise.all(function(){var results1;results1=[];for(k in scripts){v=scripts[k];results1.push(this.loadScript(k))}return results1}.call(this))}prepareArray(arr){return arr.map(function(x){if(x!=null){return x.toString()}else{return""}})}prepareObject(obj){var arr,k,v;arr=[];for(k in obj){v=obj[k];arr.push(k,v!=null?v.toString():"")}return arr}runScript(name,args){return new this.Promise((resolve,reject)=>{var arr,script;script=scripts[name];arr=[this.shas[name],script.keys.length].concat(script.keys,args,function(err,replies){if(err!=null){return reject(err)}return resolve(replies)});return this.client.evalsha.bind(this.client).apply({},arr)})}convertBool(b){return!!b}__updateSettings__(options){return this.runScript("updateSettings",this.prepareObject(options))}async __running__(){return await this.runScript("running",[Date.now()])}__incrementReservoir__(incr){return this.runScript("increment_reservoir",[incr])}__currentReservoir__(){return this.runScript("current_reservoir",this.prepareArray([]))}async __check__(weight){return this.convertBool(await this.runScript("check",this.prepareArray([weight,Date.now()])))}async __register__(index,weight,expiration){var success,wait;[success,wait]=await this.runScript("register",this.prepareArray([index,weight,expiration,Date.now()]));return{success:this.convertBool(success),wait:wait}}async __submit__(queueLength,weight){var blocked,e,maxConcurrent,overweight,reachedHWM,strategy;try{[reachedHWM,blocked,strategy]=await this.runScript("submit",this.prepareArray([queueLength,weight,Date.now()]));return{reachedHWM:this.convertBool(reachedHWM),blocked:this.convertBool(blocked),strategy:strategy}}catch(error){e=error;if(e.message.indexOf("OVERWEIGHT")===0){[overweight,weight,maxConcurrent]=e.message.split(" ");throw new BottleneckError(`Impossible to add a job having a weight of ${weight} to a limiter having a maxConcurrent setting of ${maxConcurrent}`)}else{throw e}}}async __free__(index,weight){var result;result=await this.runScript("free",this.prepareArray([index,Date.now()]));return{running:result}}};module.exports=RedisStorage}).call(this)}).call(this,require("_process"),require("buffer").Buffer)},{"./BottleneckError":2,"./DLList":4,"./parser":9,_process:13,buffer:11,redis:undefined}],7:[function(require,module,exports){(function(){var BottleneckError,DLList,Sync,slice=[].slice;DLList=require("./DLList");BottleneckError=require("./BottleneckError");Sync=class Sync{constructor(name){this.submit=this.submit.bind(this);this.schedule=this.schedule.bind(this);this.wrap=this.wrap.bind(this);this.name=name;this._running=0;this._queue=new DLList}_tryToRun(){var next;if(this._running<1&&this._queue.length>0){this._running++;next=this._queue.shift();return next.task.apply({},next.args.concat((...args)=>{var ref;this._running--;this._tryToRun();return(ref=next.cb)!=null?ref.apply({},args):void 0}))}}submit(task,...args){var cb,i,ref;ref=args,args=2<=ref.length?slice.call(ref,0,i=ref.length-1):(i=0,[]),cb=ref[i++];this._queue.push({task:task,args:args,cb:cb});return this._tryToRun()}schedule(task,...args){var wrapped;wrapped=function(...args){var cb,i,ref;ref=args,args=2<=ref.length?slice.call(ref,0,i=ref.length-1):(i=0,[]),cb=ref[i++];return task.apply({},args).then(function(...args){return cb.apply({},Array.prototype.concat(null,args))}).catch(function(...args){return cb.apply({},args)})};return new Promise((resolve,reject)=>{return this.submit.apply({},Array.prototype.concat(wrapped,args,function(...args){return(args[0]!=null?reject:(args.shift(),resolve)).apply({},args)}))})}wrap(fn){return(...args)=>{return this.schedule.apply({},Array.prototype.concat(fn,args))}}};module.exports=Sync}).call(this)},{"./BottleneckError":2,"./DLList":4}],8:[function(require,module,exports){(function(){module.exports=require("./Bottleneck")}).call(this)},{"./Bottleneck":1}],9:[function(require,module,exports){(function(){exports.load=function(received,defaults,onto={}){var k,ref,v;for(k in defaults){v=defaults[k];onto[k]=(ref=received[k])!=null?ref:v}return onto};exports.overwrite=function(received,defaults,onto={}){var k,v;for(k in received){v=received[k];if(defaults[k]!==void 0){onto[k]=v}}return onto}}).call(this)},{}],10:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63;function placeHoldersCount(b64){var len=b64.length;if(len%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}return b64[len-2]==="="?2:b64[len-1]==="="?1:0}function byteLength(b64){return b64.length*3/4-placeHoldersCount(b64)}function toByteArray(b64){var i,l,tmp,placeHolders,arr;var len=b64.length;placeHolders=placeHoldersCount(b64);arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0;i<l;i+=4){tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)];arr[L++]=tmp>>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;i<end;i+=3){tmp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output.push(tripletToBase64(tmp))}return output.join("")}function fromByteArray(uint8){var tmp;var len=uint8.length;var extraBytes=len%3;var output="";var parts=[];var maxChunkLength=16383;for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}},{}],11:[function(require,module,exports){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;exports.kMaxLength=K_MAX_LENGTH;Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport();if(!Buffer.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42}catch(e){return false}}function createBuffer(length){if(length>K_MAX_LENGTH){throw new RangeError("Invalid typed array length")}var buf=new Uint8Array(length);buf.__proto__=Buffer.prototype;return buf}function Buffer(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new Error("If encoding is specified then the first argument must be a string")}return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}if(typeof Symbol!=="undefined"&&Symbol.species&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;function from(value,encodingOrOffset,length){if(typeof value==="number"){throw new TypeError('"value" argument must not be a number')}if(isArrayBuffer(value)){return fromArrayBuffer(value,encodingOrOffset,length)}if(typeof value==="string"){return fromString(value,encodingOrOffset)}return fromObject(value)}Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be a number')}else if(size<0){throw new RangeError('"size" argument must not be negative')}}function alloc(size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}return createBuffer(size)}Buffer.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};function allocUnsafe(size){assertSize(size);return createBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){return allocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)};function fromString(string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError('"encoding" must be a valid string encoding')}var length=byteLength(string,encoding)|0;var buf=createBuffer(length);var actual=buf.write(string,encoding);if(actual!==length){buf=buf.slice(0,actual)}return buf}function fromArrayLike(array){var length=array.length<0?0:checked(array.length)|0;var buf=createBuffer(length);for(var i=0;i<length;i+=1){buf[i]=array[i]&255}return buf}function fromArrayBuffer(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset){throw new RangeError("'offset' is out of bounds")}if(array.byteLength<byteOffset+(length||0)){throw new RangeError("'length' is out of bounds")}var buf;if(byteOffset===undefined&&length===undefined){buf=new Uint8Array(array)}else if(length===undefined){buf=new Uint8Array(array,byteOffset)}else{buf=new Uint8Array(array,byteOffset,length)}buf.__proto__=Buffer.prototype;return buf}function fromObject(obj){if(Buffer.isBuffer(obj)){var len=checked(obj.length)|0;var buf=createBuffer(len);if(buf.length===0){return buf}obj.copy(buf,0,0,len);return buf}if(obj){if(isArrayBufferView(obj)||"length"in obj){if(typeof obj.length!=="number"||numberIsNaN(obj.length)){return createBuffer(0)}return fromArrayLike(obj)}if(obj.type==="Buffer"&&Array.isArray(obj.data)){return fromArrayLike(obj.data)}}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function checked(length){if(length>=K_MAX_LENGTH){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+K_MAX_LENGTH.toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return b!=null&&b._isBuffer===true};Buffer.compare=function compare(a,b){if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len;++i){if(a[i]!==b[i]){x=a[i];y=b[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function isEncoding(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function concat(list,length){if(!Array.isArray(list)){throw new TypeError('"list" argument must be an Array of Buffers')}if(list.length===0){return Buffer.alloc(0)}var i;if(length===undefined){length=0;for(i=0;i<list.length;++i){length+=list[i].length}}var buffer=Buffer.allocUnsafe(length);var pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(!Buffer.isBuffer(buf)){throw new TypeError('"list" argument must be an Array of Buffers')}buf.copy(buffer,pos);pos+=buf.length}return buffer};function byteLength(string,encoding){if(Buffer.isBuffer(string)){return string.length}if(isArrayBufferView(string)||isArrayBuffer(string)){return string.byteLength}if(typeof string!=="string"){string=""+string}var len=string.length;if(len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":case undefined:return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i<len;i+=2){swap(this,i,i+1)}return this};Buffer.prototype.swap32=function swap32(){var len=this.length;if(len%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var i=0;i<len;i+=4){swap(this,i,i+3);swap(this,i+1,i+2)}return this};Buffer.prototype.swap64=function swap64(){var len=this.length;if(len%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var i=0;i<len;i+=8){swap(this,i,i+7);swap(this,i+1,i+6);swap(this,i+2,i+5);swap(this,i+3,i+4)}return this};Buffer.prototype.toString=function toString(){var length=this.length;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;if(this.length>0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return"<Buffer "+str+">"};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!Buffer.isBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i<len;++i){if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i];y=targetCopy[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(buffer.length===0)return-1;if(typeof byteOffset==="string"){encoding=byteOffset;byteOffset=0}else if(byteOffset>2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(numberIsNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++){if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1)foundIndex=i;if(i-foundIndex+1===valLength)return foundIndex*indexSize}else{if(foundIndex!==-1)i-=i-foundIndex;foundIndex=-1}}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;j<valLength;j++){if(read(arr,i+j)!==read(val,j)){found=false;break}}if(found)return i}}return-1}Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,true)};Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,false)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;++i){var parsed=parseInt(string.substr(i*2,2),16);if(numberIsNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}Buffer.prototype.write=function write(string,offset,length,encoding){if(offset===undefined){encoding="utf8";length=this.length;offset=0}else if(length===undefined&&typeof offset==="string"){encoding=offset;length=this.length;offset=0}else if(isFinite(offset)){offset=offset>>>0;if(isFinite(length)){length=length>>>0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i<end){var firstByte=buf[i];var codePoint=null;var bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(i<len){res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH))}return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]&127)}return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;++i){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function slice(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf=this.subarray(start,end);newBuf.__proto__=Buffer.prototype;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}return val};Buffer.prototype.readUIntBE=function readUIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);this[offset]=value&255;return offset+1};Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255;return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){if(value<0&&sub===0&&this[offset+i-1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,4,3.4028234663852886e38,-3.4028234663852886e38)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,8,1.7976931348623157e308,-1.7976931348623157e308)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||this.length===0)return 0;if(targetStart<0){throw new RangeError("targetStart out of bounds")}if(start<0||start>=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart<end-start){end=target.length-targetStart+start}var len=end-start;var i;if(this===target&&start<targetStart&&targetStart<end){for(i=len-1;i>=0;--i){target[i+targetStart]=this[i+start]}}else if(len<1e3){for(i=0;i<len;++i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,start+len),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(val.length===1){var code=val.charCodeAt(0);if(code<256){val=code}}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}}else if(typeof val==="number"){val=val&255}if(start<0||this.length<start||this.length<end){throw new RangeError("Out of range index")}if(end<=start){return this}start=start>>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i<end;++i){this[i]=val}}else{var bytes=Buffer.isBuffer(val)?val:new Buffer(val,encoding);var len=bytes.length;for(i=0;i<end-start;++i){this[i+start]=bytes[i%len]}}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function base64clean(str){str=str.trim().replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];for(var i=0;i<length;++i){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;++i){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isArrayBuffer(obj){return obj instanceof ArrayBuffer||obj!=null&&obj.constructor!=null&&obj.constructor.name==="ArrayBuffer"&&typeof obj.byteLength==="number"}function isArrayBufferView(obj){return typeof ArrayBuffer.isView==="function"&&ArrayBuffer.isView(obj)}function numberIsNaN(obj){return obj!==obj}},{"base64-js":10,ieee754:12}],12:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],13:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],14:[function(require,module,exports){module.exports={name:"bottleneck",version:"1.16.0",description:"Async rate limiter",main:"lib/index.js",typings:"bottleneck.d.ts",scripts:{test:"./node_modules/mocha/bin/mocha test",build:"./scripts/build.sh",compile:"./scripts/build.sh compile"},repository:{type:"git",url:"https://github.com/SGrondin/bottleneck"},keywords:["async rate limiter","rate limiter","rate limiting","async","rate","limiting","limiter","throttle","throttling","load","ddos"],author:{name:"Simon Grondin"},license:"MIT",bugs:{url:"https://github.com/SGrondin/bottleneck/issues"},devDependencies:{coffeescript:"2.0.x",browserify:"*",mocha:"4.x",assert:"1.4.x","uglify-es":"3.x"},dependencies:{bluebird:"^3.5.1",brfs:"^1.4.3",redis:"^2.8.0"}}},{}]},{},[8]);