!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Centrifuge",[],t):"object"==typeof exports?exports.Centrifuge=t():e.Centrifuge=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=32)}([function(e,t,r){"use strict";var n,i,s=e.exports=r(1),o=r(20);s.codegen=r(46),s.fetch=r(47),s.path=r(48),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),n=0;n<t.length;)r[n]=e[t[n++]];return r}return[]},s.toObject=function(e){for(var t={},r=0;r<e.length;){var n=e[r++],i=e[r++];void 0!==i&&(t[n]=i)}return t};var u=/\\/g,a=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(u,"\\\\").replace(a,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var c=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(c,function(e,t){return t.toUpperCase()})},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;n||(n=r(22));var i=new n(t||e.name);return s.decorateRoot.add(i),i.ctor=e,Object.defineProperty(e,"$type",{value:i,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:i,enumerable:!1}),i};var l=0;s.decorateEnum=function(e){if(e.$type)return e.$type;i||(i=r(2));var t=new i("Enum"+l++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(30)))}})},function(e,t,r){"use strict";(function(e){function n(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)void 0!==e[n[i]]&&r||(e[n[i]]=t[n[i]]);return e}function i(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&n(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}var s=t;s.asPromise=r(17),s.base64=r(37),s.EventEmitter=r(38),s.float=r(39),s.inquire=r(18),s.utf8=r(40),s.pool=r(41),s.LongBits=r(42),s.global="undefined"!=typeof window&&window||void 0!==e&&e||"undefined"!=typeof self&&self||this,s.emptyArray=Object.freeze?Object.freeze([]):[],s.emptyObject=Object.freeze?Object.freeze({}):{},s.isNode=Boolean(s.global.process&&s.global.process.versions&&s.global.process.versions.node),s.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},s.isString=function(e){return"string"==typeof e||e instanceof String},s.isObject=function(e){return e&&"object"==typeof e},s.isset=s.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},s.Buffer=function(){try{var e=s.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),s._Buffer_from=null,s._Buffer_allocUnsafe=null,s.newBuffer=function(e){return"number"==typeof e?s.Buffer?s._Buffer_allocUnsafe(e):new s.Array(e):s.Buffer?s._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},s.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,s.Long=s.global.dcodeIO&&s.global.dcodeIO.Long||s.global.Long||s.inquire("long"),s.key2Re=/^true|false|0|1$/,s.key32Re=/^-?(?:0|[1-9][0-9]*)$/,s.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,s.longToHash=function(e){return e?s.LongBits.from(e).toHash():s.LongBits.zeroHash},s.longFromHash=function(e,t){var r=s.LongBits.fromHash(e);return s.Long?s.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},s.merge=n,s.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},s.newError=i,s.ProtocolError=i("ProtocolError"),s.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},s.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},s.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},s._configure=function(){var e=s.Buffer;if(!e)return void(s._Buffer_from=s._Buffer_allocUnsafe=null);s._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},s._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}}}).call(t,r(3))},function(e,t,r){"use strict";function n(e,t,r,n,s){if(i.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=s||{},this.reserved=void 0,t)for(var o=Object.keys(t),u=0;u<o.length;++u)"number"==typeof t[o[u]]&&(this.valuesById[this.values[o[u]]=t[o[u]]]=o[u])}e.exports=n;var i=r(4);((n.prototype=Object.create(i.prototype)).constructor=n).className="Enum";var s=r(8),o=r(0);n.fromJSON=function(e,t){var r=new n(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},n.prototype.add=function(e,t,r){if(!o.isString(e))throw TypeError("name must be a string");if(!o.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},n.prototype.remove=function(e){if(!o.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},n.prototype.isReservedId=function(e){return s.isReservedId(this.reserved,e)},n.prototype.isReservedName=function(e){return s.isReservedName(this.reserved,e)}},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";function n(e,t){if(!s.isString(e))throw TypeError("name must be a string");if(t&&!s.isObject(t))throw TypeError("options must be an object");this.options=t,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}e.exports=n,n.className="ReflectionObject";var i,s=r(0);Object.defineProperties(n.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),n.prototype.toJSON=function(){throw Error()},n.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof i&&t._handleAdd(this)},n.prototype.onRemove=function(e){var t=e.root;t instanceof i&&t._handleRemove(this),this.parent=null,this.resolved=!1},n.prototype.resolve=function(){return this.resolved?this:(this.root instanceof i&&(this.resolved=!0),this)},n.prototype.getOption=function(e){if(this.options)return this.options[e]},n.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},n.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),n=0;n<r.length;++n)this.setOption(r[n],e[r[n]],t);return this},n.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},n._configure=function(e){i=e}},function(e,t,r){"use strict";function n(e,t,r,n,s,o,l){if(a.isObject(n)?(l=s,o=n,n=s=void 0):a.isObject(s)&&(l=o,o=s,s=void 0),i.call(this,e,o),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!c.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==u.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=l}e.exports=n;var i=r(4);((n.prototype=Object.create(i.prototype)).constructor=n).className="Field";var s,o=r(2),u=r(9),a=r(0),c=/^required|optional|repeated$/;n.fromJSON=function(e,t){return new n(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(n.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),n.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),i.prototype.setOption.call(this,e,t,r)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},n.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=u.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof s?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof o&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof o)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof s&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},n.d=function(e,t,r,i){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(s,o){a.decorateType(s.constructor).add(new n(o,e,t,r,{default:i}))}},n._configure=function(e){s=e}},function(e,t,r){"use strict";function n(e){console&&console.warn&&console.warn(e)}function i(){i.init.call(this)}function s(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function o(e,t,r,i){var o,u,a;if("function"!=typeof r)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r);if(u=e._events,void 0===u?(u=e._events=Object.create(null),e._eventsCount=0):(void 0!==u.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),u=e._events),a=u[t]),void 0===a)a=u[t]=r,++e._eventsCount;else if("function"==typeof a?a=u[t]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(o=s(e))>0&&a.length>o&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,n(c)}return e}function u(){for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);this.fired||(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,v(this.listener,this.target,e))}function a(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function c(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?p(i):f(i,i.length)}function l(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function h(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function p(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}var d,y="object"==typeof Reflect?Reflect:null,v=y&&"function"==typeof y.apply?y.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};d=y&&"function"==typeof y.ownKeys?y.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var b=Number.isNaN||function(e){return e!==e};e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var m=10;Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return m},set:function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");m=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||b(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)v(u,this,t);else for(var a=u.length,c=f(u,a),r=0;r<a;++r)v(c[r],this,t);return!0},i.prototype.addListener=function(e,t){return o(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return o(this,e,t,!0)},i.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.on(e,a(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);return this.prependListener(e,a(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,i,s,o;if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t);if(void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():h(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return c(this,e,!0)},i.prototype.rawListeners=function(e){return c(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):l.call(e,t)},i.prototype.listenerCount=l,i.prototype.eventNames=function(){return this._eventsCount>0?d(this._events):[]}},function(e,t,r){"use strict";(function(e){function r(e,t){return 0===e.lastIndexOf(t,0)}function n(e){return void 0!==e&&null!==e&&"function"==typeof e}function i(t,r){if(e.console){var i=e.console[t];n(i)&&i.apply(e.console,r)}}function s(e,t,r){var n=.5*Math.random(),i=Math.min(r,t*Math.pow(2,e+1));return Math.floor((1-n)*i)}function o(e){return"error"in e&&null!==e.error}function u(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}Object.defineProperty(t,"__esModule",{value:!0}),t.startsWith=r,t.isFunction=n,t.log=i,t.backoff=s,t.errorExists=o,t.extend=u}).call(t,r(3))},function(e,t,r){"use strict";function n(e,t){if(e&&e.length){for(var r={},n=0;n<e.length;++n)r[e[n].name]=e[n].toJSON(t);return r}}function i(e,t){o.call(this,e,t),this.nested=void 0,this._nestedArray=null}function s(e){return e._nestedArray=null,e}e.exports=i;var o=r(4);((i.prototype=Object.create(o.prototype)).constructor=i).className="Namespace";var u,a,c,l=r(5),f=r(0);i.fromJSON=function(e,t){return new i(e,t.options).addJSON(t.nested)},i.arrayToJSON=n,i.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>=t)return!0;return!1},i.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(i.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=f.toArray(this.nested))}}),i.prototype.toJSON=function(e){return f.toObject(["options",this.options,"nested",n(this.nestedArray,e)])},i.prototype.addJSON=function(e){var t=this;if(e)for(var r,n=Object.keys(e),s=0;s<n.length;++s)r=e[n[s]],t.add((void 0!==r.fields?u.fromJSON:void 0!==r.values?c.fromJSON:void 0!==r.methods?a.fromJSON:void 0!==r.id?l.fromJSON:i.fromJSON)(n[s],r));return this},i.prototype.get=function(e){return this.nested&&this.nested[e]||null},i.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof c)return this.nested[e].values;throw Error("no such enum: "+e)},i.prototype.add=function(e){if(!(e instanceof l&&void 0!==e.extend||e instanceof u||e instanceof c||e instanceof a||e instanceof i))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof i&&e instanceof i)||t instanceof u||t instanceof a)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,n=0;n<r.length;++n)e.add(r[n]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),s(this)},i.prototype.remove=function(e){if(!(e instanceof o))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),s(this)},i.prototype.define=function(e,t){if(f.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var n=e.shift();if(r.nested&&r.nested[n]){if(!((r=r.nested[n])instanceof i))throw Error("path conflicts with non-namespace objects")}else r.add(r=new i(n))}return t&&r.addJSON(t),r},i.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof i?e[t++].resolveAll():e[t++].resolve();return this.resolve()},i.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),f.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var n=this.get(e[0]);if(n){if(1===e.length){if(!t||t.indexOf(n.constructor)>-1)return n}else if(n instanceof i&&(n=n.lookup(e.slice(1),t,!0)))return n}else for(var s=0;s<this.nestedArray.length;++s)if(this._nestedArray[s]instanceof i&&(n=this._nestedArray[s].lookup(e,t,!0)))return n;return null===this.parent||r?null:this.parent.lookup(e,t)},i.prototype.lookupType=function(e){var t=this.lookup(e,[u]);if(!t)throw Error("no such type: "+e);return t},i.prototype.lookupEnum=function(e){var t=this.lookup(e,[c]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},i.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[u,c]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},i.prototype.lookupService=function(e){var t=this.lookup(e,[a]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},i._configure=function(e,t,r){u=e,a=t,c=r}},function(e,t,r){"use strict";function n(e,t){var r=0,n={};for(t|=0;r<e.length;)n[o[r+t]]=e[r++];return n}var i=t,s=r(0),o=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];i.basic=n([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=n([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",s.emptyArray,null]),i.long=n([0,0,0,1,1],7),i.mapKey=n([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=n([1,5,0,0,0,5,5,0,0,0,1,1,0])},function(e,t,r){"use strict";(function(e){function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Centrifuge=void 0;var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c=r(6),l=n(c),f=r(11),h=n(f),p=r(12),d=r(7);t.Centrifuge=function(t){function r(e,t){i(this,r);var n=s(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));return n._url=e,n._websocket=null,n._sockjs=null,n._isSockjs=!1,n._binary=!1,n._methodType=null,n._pushType=null,n._encoder=null,n._decoder=null,n._status="disconnected",n._reconnect=!0,n._reconnecting=!1,n._transport=null,n._transportName=null,n._transportClosed=!0,n._messageId=0,n._clientID=null,n._refreshRequired=!1,n._subs={},n._serverSubs={},n._lastSeq={},n._lastGen={},n._lastEpoch={},n._messages=[],n._isBatching=!1,n._isSubscribeBatching=!1,n._privateChannels={},n._numRefreshFailed=0,n._refreshTimeout=null,n._pingTimeout=null,n._pongTimeout=null,n._subRefreshTimeouts={},n._retries=0,n._callbacks={},n._latency=null,n._latencyStart=null,n._connectData=null,n._token=null,n._xhrID=0,n._xhrs={},n._config={debug:!1,websocket:null,sockjs:null,promise:null,minRetry:1e3,maxRetry:2e4,timeout:5e3,ping:!0,pingInterval:25e3,pongWaitTimeout:5e3,privateChannelPrefix:"$",onTransportClose:null,sockjsServer:null,sockjsTransports:["websocket","xdr-streaming","xhr-streaming","eventsource","iframe-eventsource","iframe-htmlfile","xdr-polling","xhr-polling","iframe-xhr-polling","jsonp-polling"],refreshEndpoint:"/centrifuge/refresh",refreshHeaders:{},refreshParams:{},refreshData:{},refreshAttempts:null,refreshInterval:1e3,onRefreshFailed:null,onRefresh:null,subscribeEndpoint:"/centrifuge/subscribe",subscribeHeaders:{},subscribeParams:{},subRefreshInterval:1e3,onPrivateSubscribe:null},n._configure(t),n}return o(r,t),a(r,[{key:"setToken",value:function(e){this._token=e}},{key:"setConnectData",value:function(e){this._connectData=e}},{key:"setRefreshHeaders",value:function(e){this._config.refreshHeaders=e}},{key:"setRefreshParams",value:function(e){this._config.refreshParams=e}},{key:"setRefreshData",value:function(e){this._config.refreshData=e}},{key:"setSubscribeHeaders",value:function(e){this._config.subscribeHeaders=e}},{key:"setSubscribeParams",value:function(e){this._config.subscribeParams=e}},{key:"_ajax",value:function(t,r,n,i,s){var o=this,u="";this._debug("sending AJAX request to",t,"with data",JSON.stringify(i));var a=e.XMLHttpRequest?new e.XMLHttpRequest:new e.ActiveXObject("Microsoft.XMLHTTP");for(var c in r)r.hasOwnProperty(c)&&(u.length>0&&(u+="&"),u+=encodeURIComponent(c)+"="+encodeURIComponent(r[c]));u.length>0&&(u="?"+u),a.open("POST",t+u,!0),"withCredentials"in a&&(a.withCredentials=!0),a.setRequestHeader("X-Requested-With","XMLHttpRequest"),a.setRequestHeader("Content-Type","application/json");for(var l in n)n.hasOwnProperty(l)&&a.setRequestHeader(l,n[l]);return a.onreadystatechange=function(){if(4===a.readyState)if(200===a.status){var e=void 0,t=!1;try{e=JSON.parse(a.responseText),t=!0}catch(e){s({error:"Invalid JSON. Data was: "+a.responseText,status:200,data:null})}t&&s({data:e,status:200})}else o._log("wrong status code in AJAX response",a.status),s({status:a.status,data:null})},setTimeout(function(){return a.send(JSON.stringify(i))},20),a}},{key:"_log",value:function(){(0,d.log)("info",arguments)}},{key:"_debug",value:function(){!0===this._config.debug&&(0,d.log)("debug",arguments)}},{key:"_websocketSupported",value:function(){return null!==this._config.websocket||!("function"!=typeof WebSocket&&"object"!==("undefined"==typeof WebSocket?"undefined":u(WebSocket)))}},{key:"_setFormat",value:function(e){if(!this._formatOverride(e)){if("protobuf"===e)throw new Error("not implemented by JSON only Centrifuge client – use client with Protobuf");this._binary=!1,this._methodType=p.JsonMethodType,this._pushType=p.JsonPushType,this._encoder=new p.JsonEncoder,this._decoder=new p.JsonDecoder}}},{key:"_formatOverride",value:function(e){return!1}},{key:"_configure",value:function(t){if(!("Promise"in e))throw new Error("Promise polyfill required");if((0,d.extend)(this._config,t||{}),this._debug("centrifuge config",this._config),!this._url)throw new Error("url required");if((0,d.startsWith)(this._url,"ws")&&this._url.indexOf("format=protobuf")>-1?this._setFormat("protobuf"):this._setFormat("json"),(0,d.startsWith)(this._url,"http"))if(this._debug("client will try to connect to SockJS endpoint"),null!==this._config.sockjs)this._debug("SockJS explicitly provided in options"),this._sockjs=this._config.sockjs;else{if(void 0===e.SockJS)throw new Error("SockJS not found, use ws:// in url or include SockJS");this._debug("use globally defined SockJS"),this._sockjs=e.SockJS}else this._debug("client will connect to websocket endpoint")}},{key:"_setStatus",value:function(e){this._status!==e&&(this._debug("Status",this._status,"->",e),this._status=e)}},{key:"_isDisconnected",value:function(){return"disconnected"===this._status}},{key:"_isConnecting",value:function(){return"connecting"===this._status}},{key:"_isConnected",value:function(){return"connected"===this._status}},{key:"_nextMessageId",value:function(){return++this._messageId}},{key:"_resetRetry",value:function(){this._debug("reset retries count to 0"),this._retries=0}},{key:"_getRetryInterval",value:function(){var e=(0,d.backoff)(this._retries,this._config.minRetry,this._config.maxRetry);return this._retries+=1,e}},{key:"_abortInflightXHRs",value:function(){for(var e in this._xhrs){try{this._xhrs[e].abort()}catch(e){this._debug("error aborting xhr",e)}delete this._xhrs[e]}}},{key:"_clearConnectedState",value:function(e){this._clientID=null,this._stopPing();for(var t in this._callbacks)if(this._callbacks.hasOwnProperty(t)){var r=this._callbacks[t];clearTimeout(r.timeout);var n=r.errback;if(!n)continue;n({error:this._createErrorObject("disconnected")})}this._callbacks={};for(var i in this._subs)if(this._subs.hasOwnProperty(i)){var s=this._subs[i];e?(s._isSuccess()&&(s._triggerUnsubscribe(),s._recover=!0),s._shouldResubscribe()&&s._setSubscribing()):s._setUnsubscribed()}this._abortInflightXHRs(),null!==this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null);for(var o in this._subRefreshTimeouts)this._subRefreshTimeouts.hasOwnProperty(o)&&this._subRefreshTimeouts[o]&&this._clearSubRefreshTimeout(o);this._subRefreshTimeouts={},this._reconnect||(this._subs={})}},{key:"_isTransportOpen",value:function(){return this._isSockjs?this._transport&&this._transport.transport&&this._transport.transport.readyState===this._transport.transport.OPEN:this._transport&&this._transport.readyState===this._transport.OPEN}},{key:"_transportSend",value:function(e){if(!e.length)return!0;if(!this._isTransportOpen()){for(var t in e){var r=t.id;if(r in this._callbacks){var n=this._callbacks[r];clearTimeout(this._callbacks[r].timeout),delete this._callbacks[r];(0,n.errback)({error:this._createErrorObject("connection closed",0)})}}return!1}return this._transport.send(this._encoder.encodeCommands(e)),!0}},{key:"_setupTransport",value:function(){var e=this;if(this._isSockjs=!1,null!==this._sockjs){var t={transports:this._config.sockjsTransports};null!==this._config.sockjsServer&&(t.server=this._config.sockjsServer),this._isSockjs=!0,this._transport=new this._sockjs(this._url,null,t)}else{if(!this._websocketSupported())return void this._debug("No Websocket support and no SockJS configured, can not connect");null!==this._config.websocket?this._websocket=this._config.websocket:this._websocket=WebSocket,this._transport=new this._websocket(this._url),!0===this._binary&&(this._transport.binaryType="arraybuffer")}this._transport.onopen=function(){e._transportClosed=!1,e._isSockjs?(e._transportName="sockjs-"+e._transport.transport,e._transport.onheartbeat=function(){return e._restartPing()}):e._transportName="websocket";var t={};(e._token||e._connectData)&&(t.params={}),e._token&&(t.params.token=e._token),e._connectData&&(t.params.data=e._connectData);var r={},n=!1;for(var i in e._serverSubs)if(e._serverSubs.hasOwnProperty(i)&&e._serverSubs[i].recoverable){n=!0;var s={recover:!0};e._serverSubs[i].seq&&(s.seq=e._serverSubs[i].seq),e._serverSubs[i].gen&&(s.gen=e._serverSubs[i].gen),e._serverSubs[i].epoch&&(s.epoch=e._serverSubs[i].epoch),r[i]=s}n&&(t.params||(t.params={}),t.params.subs=r),e._latencyStart=new Date,e._call(t).then(function(t){e._connectResponse(e._decoder.decodeCommandResult(e._methodType.CONNECT,t.result),n),t.next&&t.next()},function(t){109===t.error.code&&(e._refreshRequired=!0),e._disconnect("connect error",!0),t.next&&t.next()})},this._transport.onerror=function(t){e._debug("transport level error",t)},this._transport.onclose=function(t){e._transportClosed=!0;var r="connection closed",n=!0;if(t&&"reason"in t&&t.reason)try{var i=JSON.parse(t.reason);e._debug("reason is an advice object",i),r=i.reason,n=i.reconnect}catch(n){r=t.reason,e._debug("reason is a plain string",r)}if(null!==e._config.onTransportClose&&e._config.onTransportClose({event:t,reason:r,reconnect:n}),e._disconnect(r,n),!0===e._reconnect){e._reconnecting=!0;var s=e._getRetryInterval();e._debug("reconnect after "+s+" milliseconds"),setTimeout(function(){!0===e._reconnect&&(e._refreshRequired?e._refresh():e._connect())},s)}},this._transport.onmessage=function(t){e._dataReceived(t.data)}}},{key:"rpc",value:function(e){var t=this,r={method:this._methodType.RPC,params:{data:e}};return this.isConnected()?this._call(r).then(function(e){return e.next&&e.next(),t._decoder.decodeCommandResult(t._methodType.RPC,e.result)},function(e){return e.next&&e.next(),Promise.reject(e.error)}):Promise.reject(this._createErrorObject("connection closed",0))}},{key:"send",value:function(e){var t={method:this._methodType.SEND,params:{data:e}};return this.isConnected()&&this._transportSend([t])?Promise.resolve({}):Promise.reject(this._createErrorObject("connection closed",0))}},{key:"publish",value:function(e,t){var r={method:this._methodType.PUBLISH,params:{channel:e,data:t}};return this.isConnected()?this._call(r).then(function(e){return e.next&&e.next(),{}}):Promise.reject(this._createErrorObject("connection closed",0))}},{key:"_dataReceived",value:function(e){var t=this,r=this._decoder.decodeReplies(e),n=Promise.resolve();for(var i in r)!function(e){r.hasOwnProperty(e)&&(n=n.then(function(){return t._dispatchReply(r[e])}))}(i);this._restartPing()}},{key:"_call",value:function(e){var t=this;return new Promise(function(r,n){var i=t._addMessage(e);t._registerCall(i,r,n)})}},{key:"_connect",value:function(){if(this.isConnected())return void this._debug("connect called when already connected");"connecting"!==this._status&&(this._debug("start connecting"),this._setStatus("connecting"),this._clientID=null,this._reconnect=!0,this._setupTransport())}},{key:"_disconnect",value:function(e,t){var r=t||!1;if(!1===r&&(this._reconnect=!1),this._isDisconnected())return void(r||this._clearConnectedState(r));if(this._clearConnectedState(r),this._debug("disconnected:",e,t),this._setStatus("disconnected"),this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),!1===this._reconnecting){for(var n in this._serverSubs)this._serverSubs.hasOwnProperty(n)&&this.emit("unsubscribe",{channel:n});this.emit("disconnect",{reason:e,reconnect:r})}!1===r&&(this._subs={},this._serverSubs={}),this._transportClosed||this._transport.close()}},{key:"_refreshFailed",value:function(){this._numRefreshFailed=0,this._isDisconnected()||this._disconnect("refresh failed",!1),null!==this._config.onRefreshFailed&&this._config.onRefreshFailed()}},{key:"_refresh",value:function(){var e=this;if(this._debug("refresh token"),0===this._config.refreshAttempts)return this._debug("refresh attempts set to 0, do not send refresh request at all"),void this._refreshFailed();null!==this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null);var t=this._clientID,r=this._newXHRID(),n=function(n){if(r in e._xhrs&&delete e._xhrs[r],e._clientID===t){if(n.error||200!==n.status){if(n.error?e._debug("error refreshing connection token",n.error):e._debug("error refreshing connection token: wrong status code",n.status),e._numRefreshFailed++,null!==e._refreshTimeout&&(clearTimeout(e._refreshTimeout),e._refreshTimeout=null),null!==e._config.refreshAttempts&&e._numRefreshFailed>=e._config.refreshAttempts)return void e._refreshFailed();var i=Math.round(1e3*Math.random()*Math.max(e._numRefreshFailed,20)),s=e._config.refreshInterval+i;return void(e._refreshTimeout=setTimeout(function(){return e._refresh()},s))}if(e._numRefreshFailed=0,e._token=n.data.token,!e._token)return void e._refreshFailed();if(e._isDisconnected()&&e._reconnect)e._debug("token refreshed, connect from scratch"),e._connect();else{e._debug("send refreshed token");var o={method:e._methodType.REFRESH,params:{token:e._token}};e._call(o).then(function(t){e._refreshResponse(e._decoder.decodeCommandResult(e._methodType.REFRESH,t.result)),t.next&&t.next()},function(t){e._refreshError(t.error),t.next&&t.next()})}}};if(null!==this._config.onRefresh){var i={};this._config.onRefresh(i,n)}else{var s=this._ajax(this._config.refreshEndpoint,this._config.refreshParams,this._config.refreshHeaders,this._config.refreshData,n);this._xhrs[r]=s}}},{key:"_refreshError",value:function(e){var t=this;this._debug("refresh error",e),this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null);var r=this._config.refreshInterval+Math.round(1e3*Math.random());this._refreshTimeout=setTimeout(function(){return t._refresh()},r)}},{key:"_refreshResponse",value:function(e){var t=this;this._refreshTimeout&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null),e.expires&&(this._clientID=e.client,this._refreshTimeout=setTimeout(function(){return t._refresh()},this._getTTLMilliseconds(e.ttl)))}},{key:"_newXHRID",value:function(){return++this._xhrID}},{key:"_subRefresh",value:function(e){var t=this;if(this._debug("refresh subscription token for channel",e),void 0!==this._subRefreshTimeouts[e]){this._clearSubRefreshTimeout(e);var r=this._clientID,n=this._newXHRID(),i=function(i){if(n in t._xhrs&&delete t._xhrs[n],!i.error&&200===i.status&&t._clientID===r){var o={};if(i.data.channels)for(var u in s.channels){var a=i.data.channels[u];a.channel&&(o[a.channel]=a.token)}var c=o[e];if(c){var l={method:t._methodType.SUB_REFRESH,params:{channel:e,token:c}};null!==t._getSub(e)&&t._call(l).then(function(r){t._subRefreshResponse(e,t._decoder.decodeCommandResult(t._methodType.SUB_REFRESH,r.result)),r.next&&r.next()},function(r){t._subRefreshError(e,r.error),r.next&&r.next()})}}},s={client:this._clientID,channels:[e]};if(null!==this._config.onPrivateSubscribe)this._config.onPrivateSubscribe({data:s},i);else{var o=this._ajax(this._config.subscribeEndpoint,this._config.subscribeParams,this._config.subscribeHeaders,s,i);this._xhrs[n]=o}}}},{key:"_clearSubRefreshTimeout",value:function(e){void 0!==this._subRefreshTimeouts[e]&&(clearTimeout(this._subRefreshTimeouts[e]),delete this._subRefreshTimeouts[e])}},{key:"_subRefreshError",value:function(e,t){var r=this;if(this._debug("subscription refresh error",e,t),this._clearSubRefreshTimeout(e),null!==this._getSub(e)){var n=Math.round(1e3*Math.random()),i=setTimeout(function(){return r._subRefresh(e)},this._config.subRefreshInterval+n);this._subRefreshTimeouts[e]=i}}},{key:"_subRefreshResponse",value:function(e,t){var r=this;if(this._debug("subscription refresh success",e),this._clearSubRefreshTimeout(e),null!==this._getSub(e)&&!0===t.expires){var n=setTimeout(function(){return r._subRefresh(e)},this._getTTLMilliseconds(t.ttl));this._subRefreshTimeouts[e]=n}}},{key:"_subscribe",value:function(e,t){var r=this;this._debug("subscribing on",e.channel);var n=e.channel;if(n in this._subs||(this._subs[n]=e),!this.isConnected())return void e._setNew();e._setSubscribing(t);var i={method:this._methodType.SUBSCRIBE,params:{channel:n}};if((0,d.startsWith)(n,this._config.privateChannelPrefix))this._isSubscribeBatching?this._privateChannels[n]=!0:(this.startSubscribeBatching(),this._subscribe(e),this.stopSubscribeBatching());else{var s=e._needRecover();if(!0===s){i.params.recover=!0;var o=this._getLastSeq(n);o&&(i.params.seq=o);var u=this._getLastGen(n);u&&(i.params.gen=u);var a=this._getLastEpoch(n);a&&(i.params.epoch=a)}this._call(i).then(function(e){r._subscribeResponse(n,s,r._decoder.decodeCommandResult(r._methodType.SUBSCRIBE,e.result)),e.next&&e.next()},function(e){r._subscribeError(n,e.error),e.next&&e.next()})}}},{key:"_unsubscribe",value:function(e){this.isConnected()&&this._addMessage({method:this._methodType.UNSUBSCRIBE,params:{channel:e.channel}})}},{key:"_getTTLMilliseconds",value:function(e){return Math.min(1e3*e,2147483647)}},{key:"getSub",value:function(e){return this._getSub(e)}},{key:"_getSub",value:function(e){var t=this._subs[e];return t||null}},{key:"_connectResponse",value:function(e,t){var r=this,n=this._reconnecting;if(this._reconnecting=!1,this._resetRetry(),this._refreshRequired=!1,!this.isConnected()){null!==this._latencyStart&&(this._latency=(new Date).getTime()-this._latencyStart.getTime(),this._latencyStart=null),this._clientID=e.client,this._setStatus("connected"),this._refreshTimeout&&clearTimeout(this._refreshTimeout),e.expires&&(this._refreshTimeout=setTimeout(function(){return r._refresh()},this._getTTLMilliseconds(e.ttl))),this.startBatching(),this.startSubscribeBatching();for(var i in this._subs)if(this._subs.hasOwnProperty(i)){var s=this._subs[i];s._shouldResubscribe()&&this._subscribe(s,n)}this.stopSubscribeBatching(),this.stopBatching(),this._startPing();var o={client:e.client,transport:this._transportName,latency:this._latency};e.data&&(o.data=e.data),this.emit("connect",o),e.subs&&this._processServerSubs(e.subs,t)}}},{key:"_processServerSubs",value:function(e,t){for(var r in e)if(e.hasOwnProperty(r)){var n=e[r],i=!0===n.recovered,s={channel:r,isResubscribe:t,recovered:i};this.emit("subscribe",s)}for(var o in e)if(e.hasOwnProperty(o)){var u=e[o];if(u.recovered){var a=u.publications;if(a&&a.length>0){a=a.reverse();for(var c in a)a.hasOwnProperty(c)&&this._handlePublication(o,a[c])}}this._serverSubs[o]={seq:u.seq,gen:u.gen,epoch:u.epoch,recoverable:u.recoverable}}}},{key:"_stopPing",value:function(){null!==this._pongTimeout&&(clearTimeout(this._pongTimeout),this._pongTimeout=null),null!==this._pingTimeout&&(clearTimeout(this._pingTimeout),this._pingTimeout=null)}},{key:"_startPing",value:function(){var e=this;!0!==this._config.ping||this._config.pingInterval<=0||this.isConnected()&&(this._pingTimeout=setTimeout(function(){if(!e.isConnected())return void e._stopPing();e.ping(),e._pongTimeout=setTimeout(function(){e._disconnect("no ping",!0)},e._config.pongWaitTimeout)},this._config.pingInterval))}},{key:"_restartPing",value:function(){this._stopPing(),this._startPing()}},{key:"_subscribeError",value:function(e,t){var r=this._getSub(e);if(r&&r._isSubscribing())return 0===t.code&&"timeout"===t.message?void this._disconnect("timeout",!0):void r._setSubscribeError(t)}},{key:"_subscribeResponse",value:function(e,t,r){var n=this,i=this._getSub(e);if(i&&i._isSubscribing()){var s=!1;"recovered"in r&&(s=r.recovered),i._setSubscribeSuccess(s);var o=r.publications;if(o&&o.length>0){o=o.reverse();for(var u in o)o.hasOwnProperty(u)&&this._handlePublication(e,o[u])}if(!r.recoverable||t&&s||(this._lastSeq[e]=r.seq||0,this._lastGen[e]=r.gen||0),this._lastEpoch[e]=r.epoch||"",r.recoverable&&(i._recoverable=!0),!0===r.expires){var a=setTimeout(function(){return n._subRefresh(e)},this._getTTLMilliseconds(r.ttl));this._subRefreshTimeouts[e]=a}}}},{key:"_handleReply",value:function(e,t){var r=e.id,n=e.result;if(!(r in this._callbacks))return void t();var i=this._callbacks[r];if(clearTimeout(this._callbacks[r].timeout),delete this._callbacks[r],(0,d.errorExists)(e)){var s=i.errback;if(!s)return void t();s({error:e.error,next:t})}else{var o=i.callback;if(!o)return;o({result:n,next:t})}}},{key:"_handleJoin",value:function(e,t){var r={info:t.info},n=this._getSub(e);if(!n)return r.channel=e,void this.emit("join",r);n.emit("join",r)}},{key:"_handleLeave",value:function(e,t){var r={info:t.info},n=this._getSub(e);if(!n)return r.channel=e,void this.emit("leave",r);n.emit("leave",r)}},{key:"_handleUnsub",value:function(e,t){var r={},n=this._getSub(e);if(!n)return delete this._serverSubs[e],r.channel=e,void this.emit("unsubscribe",r);n.unsubscribe(),!0===t.resubscribe&&n.subscribe()}},{key:"_handleSub",value:function(e,t){this._serverSubs[e]={seq:t.seq,gen:t.gen,epoch:t.epoch,recoverable:t.recoverable};var r={channel:e,isResubscribe:!1,recovered:!1};this.emit("subscribe",r)}},{key:"_handlePublication",value:function(e,t){var r=this._getSub(e),n={data:t.data,seq:t.seq,gen:t.gen};if(!r)return void 0!==this._serverSubs[e]&&(void 0!==t.seq&&(this._serverSubs[e].seq=t.seq),void 0!==t.gen&&(this._serverSubs[e].gen=t.gen)),n.channel=e,void this.emit("publish",n);void 0!==t.seq&&(this._lastSeq[e]=t.seq),void 0!==t.gen&&(this._lastGen[e]=t.gen),r.emit("publish",n)}},{key:"_handleMessage",value:function(e){this.emit("message",e.data)}},{key:"_handlePush",value:function(e,t){var r=this._decoder.decodePush(e),n=0;"type"in r&&(n=r.type);var i=r.channel;if(n===this._pushType.PUBLICATION){var s=this._decoder.decodePushData(this._pushType.PUBLICATION,r.data);this._handlePublication(i,s)}else if(n===this._pushType.MESSAGE){var o=this._decoder.decodePushData(this._pushType.MESSAGE,r.data);this._handleMessage(o)}else if(n===this._pushType.JOIN){var u=this._decoder.decodePushData(this._pushType.JOIN,r.data);this._handleJoin(i,u)}else if(n===this._pushType.LEAVE){var a=this._decoder.decodePushData(this._pushType.LEAVE,r.data);this._handleLeave(i,a)}else if(n===this._pushType.UNSUB){var c=this._decoder.decodePushData(this._pushType.UNSUB,r.data);this._handleUnsub(i,c)}else if(n===this._pushType.SUB){var l=this._decoder.decodePushData(this._pushType.SUB,r.data);this._handleSub(i,l)}t()}},{key:"_dispatchReply",value:function(e){var t,r=new Promise(function(e){t=e});if(void 0===e||null===e)return this._debug("dispatch: got undefined or null reply"),t(),r;var n=e.id;return n&&n>0?this._handleReply(e,t):this._handlePush(e.result,t),r}},{key:"_flush",value:function(){var e=this._messages.slice(0);this._messages=[],this._transportSend(e)}},{key:"_ping",value:function(){var e=this,t={method:this._methodType.PING};this._call(t).then(function(t){e._pingResponse(e._decoder.decodeCommandResult(e._methodType.PING,t.result)),t.next&&t.next()},function(t){e._debug("ping error",t.error),t.next&&t.next()})}},{key:"_pingResponse",value:function(e){this.isConnected()&&(this._stopPing(),this._startPing())}},{key:"_getLastSeq",value:function(e){var t=this._lastSeq[e];return t||0}},{key:"_getLastGen",value:function(e){var t=this._lastGen[e];return t||0}},{key:"_getLastEpoch",value:function(e){var t=this._lastEpoch[e];return t||""}},{key:"_createErrorObject",value:function(e,t){return{message:e,code:t||0}}},{key:"_registerCall",value:function(e,t,r){var n=this;this._callbacks[e]={callback:t,errback:r,timeout:null},this._callbacks[e].timeout=setTimeout(function(){delete n._callbacks[e],(0,d.isFunction)(r)&&r({error:n._createErrorObject("timeout")})},this._config.timeout)}},{key:"_addMessage",value:function(e){var t=this._nextMessageId();return e.id=t,!0===this._isBatching?this._messages.push(e):this._transportSend([e]),t}},{key:"isConnected",value:function(){return this._isConnected()}},{key:"connect",value:function(){this._connect()}},{key:"disconnect",value:function(){this._disconnect("client",!1)}},{key:"ping",value:function(){return this._ping()}},{key:"startBatching",value:function(){this._isBatching=!0}},{key:"stopBatching",value:function(){this._isBatching=!1,this._flush()}},{key:"startSubscribeBatching",value:function(){this._isSubscribeBatching=!0}},{key:"stopSubscribeBatching",value:function(){var e=this;this._isSubscribeBatching=!1;var t=this._privateChannels;this._privateChannels={};var r=[];for(var n in t)if(t.hasOwnProperty(n)){var i=this._getSub(n);if(!i)continue;r.push(n)}if(0===r.length)return void this._debug("no private channels found, no need to make request");var s={client:this._clientID,channels:r},o=this._clientID,u=this._newXHRID(),a=function(t){if(u in e._xhrs&&delete e._xhrs[u],e._clientID===o)if(t.error||200!==t.status){e._debug("authorization request failed");for(var n in r)if(r.hasOwnProperty(n)){var i=r[n];e._subscribeError(i,e._createErrorObject("authorization request failed"))}}else{var s={};if(t.data.channels)for(var a in t.data.channels){var c=t.data.channels[a];c.channel&&(s[c.channel]=c.token)}var l=!1;e._isBatching||(e.startBatching(),l=!0);for(var f in r)if(r.hasOwnProperty(f)){var h=function(){var t=r[f],n=s[t];if(!n)return e._subscribeError(t,e._createErrorObject("permission denied",103)),"continue";var i={method:e._methodType.SUBSCRIBE,params:{channel:t,token:n}},o=e._getSub(t);if(null===o)return"continue";var u=o._needRecover();if(!0===u){i.params.recover=!0;var a=e._getLastSeq(t);a&&(i.params.seq=a);var c=e._getLastGen(t);c&&(i.params.gen=c);var l=e._getLastEpoch(t);l&&(i.params.epoch=l)}e._call(i).then(function(r){e._subscribeResponse(t,u,e._decoder.decodeCommandResult(e._methodType.SUBSCRIBE,r.result)),r.next&&r.next()},function(r){e._subscribeError(t,r.error),r.next&&r.next()})}();if("continue"===h)continue}l&&e.stopBatching()}};if(null!==this._config.onPrivateSubscribe)this._config.onPrivateSubscribe({data:s},a);else{var c=this._ajax(this._config.subscribeEndpoint,this._config.subscribeParams,this._config.subscribeHeaders,s,a);this._xhrs[u]=c}}},{key:"subscribe",value:function(e,t){var r=this._getSub(e);if(null!==r)return r._setEvents(t),r._isUnsubscribed()&&r.subscribe(),r;var n=new h.default(this,e,t);return this._subs[e]=n,n.subscribe(),n}}]),r}(l.default)}).call(t,r(3))},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(6),a=function(e){return e&&e.__esModule?e:{default:e}}(u),c=r(7),l=0,f=function(e){function t(e,r,s){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.channel=r,o._centrifuge=e,o._status=l,o._error=null,o._isResubscribe=!1,o._ready=!1,o._subscriptionPromise=null,o._noResubscribe=!1,o._recoverable=!1,o._recover=!1,o._setEvents(s),o._initializePromise(),o._promises={},o._promiseId=0,o.on("error",function(e){this._centrifuge._debug("subscription error",e)}),o}return s(t,e),o(t,[{key:"_nextPromiseId",value:function(){return++this._promiseId}},{key:"_initializePromise",value:function(){var e=this;this._ready=!1,this._subscriptionPromise=new Promise(function(t,r){e._resolve=function(r){e._ready=!0,t(r)},e._reject=function(t){e._ready=!0,r(t)}}).then(function(){},function(){})}},{key:"_needRecover",value:function(){return!0===this._recoverable&&!0===this._recover}},{key:"_setEvents",value:function(e){if(e)if((0,c.isFunction)(e))this.on("publish",e);else if(Object.prototype.toString.call(e)===Object.prototype.toString.call({}))for(var t=["publish","join","leave","unsubscribe","subscribe","error"],r=0,n=t.length;r<n;r++){var i=t[r];i in e&&this.on(i,e[i])}}},{key:"_isNew",value:function(){return this._status===l}},{key:"_isUnsubscribed",value:function(){return 4===this._status}},{key:"_isSubscribing",value:function(){return 1===this._status}},{key:"_isReady",value:function(){return 2===this._status||3===this._status}},{key:"_isSuccess",value:function(){return 2===this._status}},{key:"_isError",value:function(){return 3===this._status}},{key:"_setNew",value:function(){this._status=l}},{key:"_setSubscribing",value:function(e){this._isResubscribe=e||!1,!0===this._ready&&this._initializePromise(),this._status=1}},{key:"_setSubscribeSuccess",value:function(e){if(2!==this._status){this._status=2;var t=this._getSubscribeSuccessContext(e);this._recover=!1,this.emit("subscribe",t),this._resolve(t);for(var r in this._promises)clearTimeout(this._promises[r].timeout),this._promises[r].resolve(),delete this._promises[r]}}},{key:"_setSubscribeError",value:function(e){if(3!==this._status){this._status=3,this._error=e;var t=this._getSubscribeErrorContext();this.emit("error",t),this._reject(t);for(var r in this._promises)clearTimeout(this._promises[r].timeout),this._promises[r].reject(e),delete this._promises[r]}}},{key:"_triggerUnsubscribe",value:function(){this.emit("unsubscribe",{channel:this.channel})}},{key:"_setUnsubscribed",value:function(e){if(this._centrifuge._clearSubRefreshTimeout(this.channel),4!==this._status){var t=2===this._status;this._status=4,!0===e&&(this._recover=!1,this._noResubscribe=!0,delete this._centrifuge._lastSeq[this.channel],delete this._centrifuge._lastGen[this.channel],delete this._centrifuge._lastEpoch[this.channel]),t&&this._triggerUnsubscribe()}}},{key:"_shouldResubscribe",value:function(){return!this._noResubscribe}},{key:"_getSubscribeSuccessContext",value:function(e){return{channel:this.channel,isResubscribe:this._isResubscribe,recovered:e}}},{key:"_getSubscribeErrorContext",value:function(){var e=this._error;return e.channel=this.channel,e.isResubscribe=this._isResubscribe,e}},{key:"ready",value:function(e,t){this._ready&&(this._isSuccess()?e(this._getSubscribeSuccessContext()):t(this._getSubscribeErrorContext()))}},{key:"subscribe",value:function(){2!==this._status&&(this._noResubscribe=!1,this._centrifuge._subscribe(this))}},{key:"unsubscribe",value:function(){this._setUnsubscribed(!0),this._centrifuge._unsubscribe(this)}},{key:"_methodCall",value:function(e,t){var r=this;return new Promise(function(n,i){var s=void 0;s=r._isSuccess()?Promise.resolve():r._isError()?Promise.reject(r._error):new Promise(function(e,t){var n=setTimeout(function(){t({code:0,message:"timeout"})},r._centrifuge._config.timeout);r._promises[r._nextPromiseId()]={timeout:n,resolve:e,reject:t}}),s.then(function(){return r._centrifuge._call(e).then(function(e){n(r._centrifuge._decoder.decodeCommandResult(t,e.result)),e.next&&e.next()},function(e){i(e.error),e.next&&e.next()})},function(e){i(e)})})}},{key:"publish",value:function(e){return this._methodCall({method:this._centrifuge._methodType.PUBLISH,params:{channel:this.channel,data:e}},this._centrifuge._methodType.PUBLISH)}},{key:"presence",value:function(){return this._methodCall({method:this._centrifuge._methodType.PRESENCE,params:{channel:this.channel}},this._centrifuge._methodType.PRESENCE)}},{key:"presenceStats",value:function(){return this._methodCall({method:this._centrifuge._methodType.PRESENCE_STATS,params:{channel:this.channel}},this._centrifuge._methodType.PRESENCE_STATS)}},{key:"history",value:function(){return this._methodCall({method:this._centrifuge._methodType.HISTORY,params:{channel:this.channel}},this._centrifuge._methodType.HISTORY)}}]),t}(a.default);t.default=f,e.exports=t.default},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.JsonMethodType={CONNECT:0,SUBSCRIBE:1,UNSUBSCRIBE:2,PUBLISH:3,PRESENCE:4,PRESENCE_STATS:5,HISTORY:6,PING:7,SEND:8,RPC:9,REFRESH:10,SUB_REFRESH:11},t.JsonPushType={PUBLICATION:0,JOIN:1,LEAVE:2,UNSUB:3,MESSAGE:4,SUB:5},t.JsonEncoder=function(){function e(){n(this,e)}return i(e,[{key:"encodeCommands",value:function(e){var t=[];for(var r in e)e.hasOwnProperty(r)&&t.push(JSON.stringify(e[r]));return t.join("\n")}}]),e}(),t.JsonDecoder=function(){function e(){n(this,e)}return i(e,[{key:"decodeReplies",value:function(e){var t=[],r=e.split("\n");for(var n in r)if(r.hasOwnProperty(n)){if(!r[n])continue;var i=JSON.parse(r[n]);t.push(i)}return t}},{key:"decodeCommandResult",value:function(e,t){return t}},{key:"decodePush",value:function(e){return e}},{key:"decodePushData",value:function(e,t){return t}}]),e}()},function(e,t,r){"use strict";function n(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function i(){}function s(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function o(){this.len=0,this.head=new n(i,0,0),this.tail=this.head,this.states=null}function u(e,t,r){t[r]=255&e}function a(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e}function c(e,t){this.len=e,this.next=void 0,this.val=t}function l(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function f(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}e.exports=o;var h,p=r(1),d=p.LongBits,y=p.base64,v=p.utf8;o.create=p.Buffer?function(){return(o.create=function(){return new h})()}:function(){return new o},o.alloc=function(e){return new p.Array(e)},p.Array!==Array&&(o.alloc=p.pool(o.alloc,p.Array.prototype.subarray)),o.prototype._push=function(e,t,r){return this.tail=this.tail.next=new n(e,t,r),this.len+=t,this},c.prototype=Object.create(n.prototype),c.prototype.fn=a,o.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new c((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},o.prototype.int32=function(e){return e<0?this._push(l,10,d.fromNumber(e)):this.uint32(e)},o.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},o.prototype.uint64=function(e){var t=d.from(e);return this._push(l,t.length(),t)},o.prototype.int64=o.prototype.uint64,o.prototype.sint64=function(e){var t=d.from(e).zzEncode();return this._push(l,t.length(),t)},o.prototype.bool=function(e){return this._push(u,1,e?1:0)},o.prototype.fixed32=function(e){return this._push(f,4,e>>>0)},o.prototype.sfixed32=o.prototype.fixed32,o.prototype.fixed64=function(e){var t=d.from(e);return this._push(f,4,t.lo)._push(f,4,t.hi)},o.prototype.sfixed64=o.prototype.fixed64,o.prototype.float=function(e){return this._push(p.float.writeFloatLE,4,e)},o.prototype.double=function(e){return this._push(p.float.writeDoubleLE,8,e)};var b=p.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var n=0;n<e.length;++n)t[r+n]=e[n]};o.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(u,1,0);if(p.isString(e)){var r=o.alloc(t=y.length(e));y.decode(e,r,0),e=r}return this.uint32(t)._push(b,t,e)},o.prototype.string=function(e){var t=v.length(e);return t?this.uint32(t)._push(v.write,t,e):this._push(u,1,0)},o.prototype.fork=function(){return this.states=new s(this),this.head=this.tail=new n(i,0,0),this.len=0,this},o.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new n(i,0,0),this.len=0),this},o.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},o.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},o._configure=function(e){h=e}},function(e,t,r){"use strict";function n(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function i(e){this.buf=e,this.pos=0,this.len=e.length}function s(){var e=new l(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw n(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw n(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function o(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function u(){if(this.pos+8>this.len)throw n(this,8);return new l(o(this.buf,this.pos+=4),o(this.buf,this.pos+=4))}e.exports=i;var a,c=r(1),l=c.LongBits,f=c.utf8,h="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new i(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new i(e);throw Error("illegal buffer")};i.create=c.Buffer?function(e){return(i.create=function(e){return c.Buffer.isBuffer(e)?new a(e):h(e)})(e)}:h,i.prototype._slice=c.Array.prototype.subarray||c.Array.prototype.slice,i.prototype.uint32=function(){var e=4294967295;return function(){if(e=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return e;if(e=(e|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return e;if((this.pos+=5)>this.len)throw this.pos=this.len,n(this,10);return e}}(),i.prototype.int32=function(){return 0|this.uint32()},i.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},i.prototype.bool=function(){return 0!==this.uint32()},i.prototype.fixed32=function(){if(this.pos+4>this.len)throw n(this,4);return o(this.buf,this.pos+=4)},i.prototype.sfixed32=function(){if(this.pos+4>this.len)throw n(this,4);return 0|o(this.buf,this.pos+=4)},i.prototype.float=function(){if(this.pos+4>this.len)throw n(this,4);var e=c.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},i.prototype.double=function(){if(this.pos+8>this.len)throw n(this,4);var e=c.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},i.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw n(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},i.prototype.string=function(){var e=this.bytes();return f.read(e,0,e.length)},i.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw n(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw n(this)}while(128&this.buf[this.pos++]);return this},i.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},i._configure=function(e){a=e;var t=c.Long?"toLong":"toNumber";c.merge(i.prototype,{int64:function(){return s.call(this)[t](!1)},uint64:function(){return s.call(this)[t](!0)},sint64:function(){return s.call(this).zzDecode()[t](!1)},fixed64:function(){return u.call(this)[t](!0)},sfixed64:function(){return u.call(this)[t](!1)}})}},function(e,t,r){"use strict";function n(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),s.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function i(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}e.exports=n;var s=r(4);((n.prototype=Object.create(s.prototype)).constructor=n).className="OneOf";var o=r(5),u=r(0);n.fromJSON=function(e,t){return new n(e,t.oneof,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return u.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},n.prototype.add=function(e){if(!(e instanceof o))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,i(this),this},n.prototype.remove=function(e){if(!(e instanceof o))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),t=this.oneof.indexOf(e.name),t>-1&&this.oneof.splice(t,1),e.partOf=null,this},n.prototype.onAdd=function(e){s.prototype.onAdd.call(this,e);for(var t=this,r=0;r<this.oneof.length;++r){var n=e.get(this.oneof[r]);n&&!n.partOf&&(n.partOf=t,t.fieldsArray.push(n))}i(this)},n.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);s.prototype.onRemove.call(this,e)},n.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){u.decorateType(t.constructor).add(new n(r,e)),Object.defineProperty(t,r,{get:u.oneOfGetter(e),set:u.oneOfSetter(e)})}}},function(e,t,r){"use strict";function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}e.exports=n;var i=r(1);n.create=function(e){return this.$type.create(e)},n.encode=function(e,t){return this.$type.encode(e,t)},n.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},n.decode=function(e){return this.$type.decode(e)},n.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},n.verify=function(e){return this.$type.verify(e)},n.fromObject=function(e){return this.$type.fromObject(e)},n.toObject=function(e,t){return this.$type.toObject(e,t)},n.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},function(e,t,r){"use strict";function n(e,t){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(i,o){r[n]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(e){s&&(s=!1,o(e))}})}e.exports=n},function(module,exports,__webpack_require__){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},function(e,t,r){"use strict";t.Service=r(45)},function(e,t,r){"use strict";e.exports={}},function(e,t,r){"use strict";function n(e,t,r,n){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,n,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,n,(t.id<<3|2)>>>0)}function i(e){for(var t,r,i=u.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(u.compareFieldsById),t=0;t<a.length;++t){var c=a[t].resolve(),l=e._fieldsArray.indexOf(c),f=c.resolvedType instanceof s?"int32":c.type,h=o.basic[f];r="m"+u.safeProp(c.name),c.map?(i("if(%s!=null&&m.hasOwnProperty(%j)){",r,c.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",r)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(c.id<<3|2)>>>0,8|o.mapKey[c.keyType],c.keyType),void 0===h?i("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",l,r):i(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|h,f,r),i("}")("}")):c.repeated?(i("if(%s!=null&&%s.length){",r,r),c.packed&&void 0!==o.packed[f]?i("w.uint32(%i).fork()",(c.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",r)("w.%s(%s[i])",f,r)("w.ldelim()"):(i("for(var i=0;i<%s.length;++i)",r),void 0===h?n(i,c,l,r+"[i]"):i("w.uint32(%i).%s(%s[i])",(c.id<<3|h)>>>0,f,r)),i("}")):(c.optional&&i("if(%s!=null&&m.hasOwnProperty(%j))",r,c.name),void 0===h?n(i,c,l,r):i("w.uint32(%i).%s(%s)",(c.id<<3|h)>>>0,f,r))}return i("return w")}e.exports=i;var s=r(2),o=r(9),u=r(0)},function(e,t,r){"use strict";function n(e,t){s.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function i(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}e.exports=n;var s=r(8);((n.prototype=Object.create(s.prototype)).constructor=n).className="Type";var o=r(2),u=r(15),a=r(5),c=r(23),l=r(24),f=r(16),h=r(14),p=r(13),d=r(0),y=r(21),v=r(26),b=r(27),m=r(28),_=r(29);Object.defineProperties(n.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=d.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=d.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=n.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof f||((e.prototype=new f).constructor=e,d.merge(e.prototype,t)),e.$type=e.prototype.$type=this,d.merge(e,f,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:d.oneOfGetter(this._oneofsArray[r].oneof),set:d.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,n)}}}),n.generateConstructor=function(e){for(var t,r=d.codegen(["p"],e.name),n=0;n<e.fieldsArray.length;++n)(t=e._fieldsArray[n]).map?r("this%s={}",d.safeProp(t.name)):t.repeated&&r("this%s=[]",d.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},n.fromJSON=function(e,t){var r=new n(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var i=Object.keys(t.fields),f=0;f<i.length;++f)r.add((void 0!==t.fields[i[f]].keyType?c.fromJSON:a.fromJSON)(i[f],t.fields[i[f]]));if(t.oneofs)for(i=Object.keys(t.oneofs),f=0;f<i.length;++f)r.add(u.fromJSON(i[f],t.oneofs[i[f]]));if(t.nested)for(i=Object.keys(t.nested),f=0;f<i.length;++f){var h=t.nested[i[f]];r.add((void 0!==h.id?a.fromJSON:void 0!==h.fields?n.fromJSON:void 0!==h.values?o.fromJSON:void 0!==h.methods?l.fromJSON:s.fromJSON)(i[f],h))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},n.prototype.toJSON=function(e){var t=s.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return d.toObject(["options",t&&t.options||void 0,"oneofs",s.arrayToJSON(this.oneofsArray,e),"fields",s.arrayToJSON(this.fieldsArray.filter(function(e){return!e.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},n.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return s.prototype.resolveAll.call(this)},n.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},n.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof a&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),i(this)}return e instanceof u?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),i(this)):s.prototype.add.call(this,e)},n.prototype.remove=function(e){if(e instanceof a&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),i(this)}if(e instanceof u){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),i(this)}return s.prototype.remove.call(this,e)},n.prototype.isReservedId=function(e){return s.isReservedId(this.reserved,e)},n.prototype.isReservedName=function(e){return s.isReservedName(this.reserved,e)},n.prototype.create=function(e){return new this.ctor(e)},n.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=y(this)({Writer:p,types:t,util:d}),this.decode=v(this)({Reader:h,types:t,util:d}),this.verify=b(this)({types:t,util:d}),this.fromObject=m.fromObject(this)({types:t,util:d}),this.toObject=m.toObject(this)({types:t,util:d});var n=_[e];if(n){var i=Object.create(this);i.fromObject=this.fromObject,this.fromObject=n.fromObject.bind(i),i.toObject=this.toObject,this.toObject=n.toObject.bind(i)}return this},n.prototype.encode=function(e,t){return this.setup().encode(e,t)},n.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},n.prototype.decode=function(e,t){return this.setup().decode(e,t)},n.prototype.decodeDelimited=function(e){return e instanceof h||(e=h.create(e)),this.decode(e,e.uint32())},n.prototype.verify=function(e){return this.setup().verify(e)},n.prototype.fromObject=function(e){return this.setup().fromObject(e)},n.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},n.d=function(e){return function(t){d.decorateType(t,e)}}},function(e,t,r){"use strict";function n(e,t,r,n,s,u){if(i.call(this,e,t,n,void 0,void 0,s,u),!o.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}e.exports=n;var i=r(5);((n.prototype=Object.create(i.prototype)).constructor=n).className="MapField";var s=r(9),o=r(0);n.fromJSON=function(e,t){return new n(e,t.id,t.keyType,t.type,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return o.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},n.prototype.resolve=function(){if(this.resolved)return this;if(void 0===s.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},n.d=function(e,t,r){return"function"==typeof r?r=o.decorateType(r).name:r&&"object"==typeof r&&(r=o.decorateEnum(r).name),function(i,s){o.decorateType(i.constructor).add(new n(s,e,t,r))}}},function(e,t,r){"use strict";function n(e,t){s.call(this,e,t),this.methods={},this._methodsArray=null}function i(e){return e._methodsArray=null,e}e.exports=n;var s=r(8);((n.prototype=Object.create(s.prototype)).constructor=n).className="Service";var o=r(25),u=r(0),a=r(19);n.fromJSON=function(e,t){var r=new n(e,t.options);if(t.methods)for(var i=Object.keys(t.methods),s=0;s<i.length;++s)r.add(o.fromJSON(i[s],t.methods[i[s]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},n.prototype.toJSON=function(e){var t=s.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return u.toObject(["options",t&&t.options||void 0,"methods",s.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(n.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=u.toArray(this.methods))}}),n.prototype.get=function(e){return this.methods[e]||s.prototype.get.call(this,e)},n.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return s.prototype.resolve.call(this)},n.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof o?(this.methods[e.name]=e,e.parent=this,i(this)):s.prototype.add.call(this,e)},n.prototype.remove=function(e){if(e instanceof o){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,i(this)}return s.prototype.remove.call(this,e)},n.prototype.create=function(e,t,r){for(var n,i=new a.Service(e,t,r),s=0;s<this.methodsArray.length;++s){var o=u.lcFirst((n=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");i[o]=u.codegen(["r","c"],u.isReserved(o)?o+"_":o)("return this.rpcCall(m,q,s,r,c)")({m:n,q:n.resolvedRequestType.ctor,s:n.resolvedResponseType.ctor})}return i}},function(e,t,r){"use strict";function n(e,t,r,n,o,u,a,c){if(s.isObject(o)?(a=o,o=u=void 0):s.isObject(u)&&(a=u,u=void 0),void 0!==t&&!s.isString(t))throw TypeError("type must be a string");if(!s.isString(r))throw TypeError("requestType must be a string");if(!s.isString(n))throw TypeError("responseType must be a string");i.call(this,e,a),this.type=t||"rpc",this.requestType=r,this.requestStream=!!o||void 0,this.responseType=n,this.responseStream=!!u||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=c}e.exports=n;var i=r(4);((n.prototype=Object.create(i.prototype)).constructor=n).className="Method";var s=r(0);n.fromJSON=function(e,t){return new n(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment)},n.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0])},n.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},function(e,t,r){"use strict";function n(e){return"missing required '"+e.name+"'"}function i(e){var t=u.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter(function(e){return e.map}).length?",k":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break"),t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var i=e._fieldsArray[r].resolve(),a=i.resolvedType instanceof s?"int32":i.type,c="m"+u.safeProp(i.name);t("case %i:",i.id),i.map?(t("r.skip().pos++")("if(%s===util.emptyObject)",c)("%s={}",c)("k=r.%s()",i.keyType)("r.pos++"),void 0!==o.long[i.keyType]?void 0===o.basic[a]?t('%s[typeof k==="object"?util.longToHash(k):k]=types[%i].decode(r,r.uint32())',c,r):t('%s[typeof k==="object"?util.longToHash(k):k]=r.%s()',c,a):void 0===o.basic[a]?t("%s[k]=types[%i].decode(r,r.uint32())",c,r):t("%s[k]=r.%s()",c,a)):i.repeated?(t("if(!(%s&&%s.length))",c,c)("%s=[]",c),void 0!==o.packed[a]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",c,a)("}else"),void 0===o.basic[a]?t(i.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",c,r):t("%s.push(r.%s())",c,a)):void 0===o.basic[a]?t(i.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",c,r):t("%s=r.%s()",c,a),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var l=e._fieldsArray[r];l.required&&t("if(!m.hasOwnProperty(%j))",l.name)("throw util.ProtocolError(%j,{instance:m})",n(l))}return t("return m")}e.exports=i;var s=r(2),o=r(9),u=r(0)},function(e,t,r){"use strict";function n(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function i(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof u){e("switch(%s){",i)("default:")("return%j",n(t,"enum value"));for(var s=Object.keys(t.resolvedType.values),o=0;o<s.length;++o)e("case %i:",t.resolvedType.values[s[o]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,i)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",i)("return%j",n(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",i,i,i,i)("return%j",n(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',i)("return%j",n(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',i)("return%j",n(t,"boolean"));break;case"string":e("if(!util.isString(%s))",i)("return%j",n(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',i,i,i)("return%j",n(t,"buffer"))}return e}function s(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",n(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",n(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",n(t,"boolean key"))}return e}function o(e){var t=a.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,o={};r.length&&t("var p={}");for(var u=0;u<e.fieldsArray.length;++u){var c=e._fieldsArray[u].resolve(),l="m"+a.safeProp(c.name);if(c.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",l,c.name),c.map)t("if(!util.isObject(%s))",l)("return%j",n(c,"object"))("var k=Object.keys(%s)",l)("for(var i=0;i<k.length;++i){"),s(t,c,"k[i]"),i(t,c,u,l+"[k[i]]")("}");else if(c.repeated)t("if(!Array.isArray(%s))",l)("return%j",n(c,"array"))("for(var i=0;i<%s.length;++i){",l),i(t,c,u,l+"[i]")("}");else{if(c.partOf){var f=a.safeProp(c.partOf.name);1===o[c.partOf.name]&&t("if(p%s===1)",f)("return%j",c.partOf.name+": multiple values"),o[c.partOf.name]=1,t("p%s=1",f)}i(t,c,u,l)}c.optional&&t("}")}return t("return null")}e.exports=o;var u=r(2),a=r(0)},function(e,t,r){"use strict";function n(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof o){e("switch(d%s){",n);for(var i=t.resolvedType.values,s=Object.keys(i),u=0;u<s.length;++u)t.repeated&&i[s[u]]===t.typeDefault&&e("default:"),e("case%j:",s[u])("case %i:",i[s[u]])("m%s=%j",n,i[s[u]])("break");e("}")}else e('if(typeof d%s!=="object")',n)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,r,n);else{var a=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",n,n);break;case"uint64":a=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,a)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,a?"true":"");break;case"bytes":e('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length)",n)("m%s=d%s",n,n);break;case"string":e("m%s=String(d%s)",n,n);break;case"bool":e("m%s=Boolean(d%s)",n,n)}}return e}function i(e,t,r,n){if(t.resolvedType)t.resolvedType instanceof o?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",n,r,n,n):e("d%s=types[%i].toObject(m%s,o)",n,r,n);else{var i=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":i=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,i?"true":"",n);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:e("d%s=m%s",n,n)}}return e}var s=t,o=r(2),u=r(0);s.fromObject=function(e){var t=e.fieldsArray,r=u.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var i=0;i<t.length;++i){var s=t[i].resolve(),a=u.safeProp(s.name);s.map?(r("if(d%s){",a)('if(typeof d%s!=="object")',a)("throw TypeError(%j)",s.fullName+": object expected")("m%s={}",a)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",a),n(r,s,i,a+"[ks[i]]")("}")("}")):s.repeated?(r("if(d%s){",a)("if(!Array.isArray(d%s))",a)("throw TypeError(%j)",s.fullName+": array expected")("m%s=[]",a)("for(var i=0;i<d%s.length;++i){",a),n(r,s,i,a+"[i]")("}")("}")):(s.resolvedType instanceof o||r("if(d%s!=null){",a),n(r,s,i,a),s.resolvedType instanceof o||r("}"))}return r("return m")},s.toObject=function(e){var t=e.fieldsArray.slice().sort(u.compareFieldsById);if(!t.length)return u.codegen()("return {}");for(var r=u.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],s=[],a=[],c=0;c<t.length;++c)t[c].partOf||(t[c].resolve().repeated?n:t[c].map?s:a).push(t[c]);if(n.length){for(r("if(o.arrays||o.defaults){"),c=0;c<n.length;++c)r("d%s=[]",u.safeProp(n[c].name));r("}")}if(s.length){for(r("if(o.objects||o.defaults){"),c=0;c<s.length;++c)r("d%s={}",u.safeProp(s[c].name));r("}")}if(a.length){for(r("if(o.defaults){"),c=0;c<a.length;++c){var l=a[c],f=u.safeProp(l.name);if(l.resolvedType instanceof o)r("d%s=o.enums===String?%j:%j",f,l.resolvedType.valuesById[l.typeDefault],l.typeDefault);else if(l.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",f)("}else")("d%s=o.longs===String?%j:%i",f,l.typeDefault.toString(),l.typeDefault.toNumber());else if(l.bytes){var h="["+Array.prototype.slice.call(l.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",f,String.fromCharCode.apply(String,l.typeDefault))("else{")("d%s=%s",f,h)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",f,f)("}")}else r("d%s=%j",f,l.typeDefault)}r("}")}var p=!1;for(c=0;c<t.length;++c){var l=t[c],d=e._fieldsArray.indexOf(l),f=u.safeProp(l.name);l.map?(p||(p=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",f,f)("d%s={}",f)("for(var j=0;j<ks2.length;++j){"),i(r,l,d,f+"[ks2[j]]")("}")):l.repeated?(r("if(m%s&&m%s.length){",f,f)("d%s=[]",f)("for(var j=0;j<m%s.length;++j){",f),i(r,l,d,f+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",f,l.name),i(r,l,d,f),l.partOf&&r("if(o.oneofs)")("d%s=%j",u.safeProp(l.partOf.name),l.name)),r("}")}return r("return d")}},function(e,t,r){"use strict";var n=t,i=r(16);n[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=this.lookup(e["@type"]);if(t){var r="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return this.create({type_url:"/"+r,value:t.encode(t.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){if(t&&t.json&&e.type_url&&e.value){var r=e.type_url.substring(e.type_url.lastIndexOf("/")+1),n=this.lookup(r);n&&(e=n.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof i){var s=e.$type.toObject(e,t);return s["@type"]=e.$type.fullName,s}return this.toObject(e,t)}}},function(e,t,r){"use strict";function n(e){o.call(this,"",e),this.deferred=[],this.files=[]}function i(){}function s(e,t){var r=t.parent.lookup(t.extend);if(r){var n=new l(t.fullName,t.id,t.type,t.rule,void 0,t.options);return n.declaringField=t,t.extensionField=n,r.add(n),!0}return!1}e.exports=n;var o=r(8);((n.prototype=Object.create(o.prototype)).constructor=n).className="Root";var u,a,c,l=r(5),f=r(2),h=r(15),p=r(0);n.fromJSON=function(e,t){return t||(t=new n),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},n.prototype.resolvePath=p.path.resolve,n.prototype.load=function e(t,r,n){function s(e,t){if(n){var r=n;if(n=null,f)throw e;r(e,t)}}function o(e,t){try{if(p.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),p.isString(t)){a.filename=e;var n,i=a(t,l,r),o=0;if(i.imports)for(;o<i.imports.length;++o)(n=l.resolvePath(e,i.imports[o]))&&u(n);if(i.weakImports)for(o=0;o<i.weakImports.length;++o)(n=l.resolvePath(e,i.weakImports[o]))&&u(n,!0)}else l.setOptions(t.options).addJSON(t.nested)}catch(e){s(e)}f||h||s(null,l)}function u(e,t){var r=e.lastIndexOf("google/protobuf/");if(r>-1){var i=e.substring(r);i in c&&(e=i)}if(!(l.files.indexOf(e)>-1)){if(l.files.push(e),e in c)return void(f?o(e,c[e]):(++h,setTimeout(function(){--h,o(e,c[e])})));if(f){var u;try{u=p.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||s(e))}o(e,u)}else++h,p.fetch(e,function(r,i){if(--h,n)return r?void(t?h||s(null,l):s(r)):void o(e,i)})}}"function"==typeof r&&(n=r,r=void 0);var l=this;if(!n)return p.asPromise(e,l,t,r);var f=n===i,h=0;p.isString(t)&&(t=[t]);for(var d,y=0;y<t.length;++y)(d=l.resolvePath("",t[y]))&&u(d);if(f)return l;h||s(null,l)},n.prototype.loadSync=function(e,t){if(!p.isNode)throw Error("not supported");return this.load(e,t,i)},n.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return o.prototype.resolveAll.call(this)};var d=/^[A-Z]/;n.prototype._handleAdd=function(e){if(e instanceof l)void 0===e.extend||e.extensionField||s(this,e)||this.deferred.push(e);else if(e instanceof f)d.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof h)){if(e instanceof u)for(var t=0;t<this.deferred.length;)s(this,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);d.test(e.name)&&(e.parent[e.name]=e)}},n.prototype._handleRemove=function(e){if(e instanceof l){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof f)d.test(e.name)&&delete e.parent[e.name];else if(e instanceof o){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);d.test(e.name)&&delete e.parent[e.name]}},n._configure=function(e,t,r){u=e,a=t,c=r}},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(33);t.default=n.CentrifugeProtobuf,e.exports=t.default},function(e,t,r){"use strict";function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0}),t.CentrifugeProtobuf=t.ProtobufDecoder=t.ProtobufEncoder=void 0;var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(10),a=r(34),c=a.Root.fromJSON(r(49)),l=c.lookupEnum("MethodType").values,f={CONNECT:l.CONNECT,SUBSCRIBE:l.SUBSCRIBE,UNSUBSCRIBE:l.UNSUBSCRIBE,PUBLISH:l.PUBLISH,PRESENCE:l.PRESENCE,PRESENCE_STATS:l.PRESENCE_STATS,HISTORY:l.HISTORY,PING:l.PING,RPC:l.RPC,SEND:l.SEND,REFRESH:l.REFRESH,SUB_REFRESH:l.SUB_REFRESH},h={CONNECT:[c.lookupType("protocol.ConnectRequest"),c.lookupType("protocol.ConnectResult")],REFRESH:[c.lookupType("protocol.RefreshRequest"),c.lookupType("protocol.RefreshResult")],SUBSCRIBE:[c.lookupType("protocol.SubscribeRequest"),c.lookupType("protocol.SubscribeResult")],SUB_REFRESH:[c.lookupType("protocol.SubRefreshRequest"),c.lookupType("protocol.SubRefreshResult")],UNSUBSCRIBE:[c.lookupType("protocol.UnsubscribeRequest"),c.lookupType("protocol.UnsubscribeResult")],PUBLISH:[c.lookupType("protocol.PublishRequest"),c.lookupType("protocol.PublishResult")],PRESENCE:[c.lookupType("protocol.PresenceRequest"),c.lookupType("protocol.PresenceResult")],PRESENCE_STATS:[c.lookupType("protocol.PresenceStatsRequest"),c.lookupType("protocol.PresenceStatsResult")],HISTORY:[c.lookupType("protocol.HistoryRequest"),c.lookupType("protocol.HistoryResult")],PING:[c.lookupType("protocol.PingRequest"),c.lookupType("protocol.PingResult")],RPC:[c.lookupType("protocol.RPCRequest"),c.lookupType("protocol.RPCResult")],SEND:[c.lookupType("protocol.SendRequest"),null]},p={PUBLICATION:c.lookupEnum("PushType").values.PUBLICATION,JOIN:c.lookupEnum("PushType").values.JOIN,LEAVE:c.lookupEnum("PushType").values.LEAVE,UNSUB:c.lookupEnum("PushType").values.UNSUB,MESSAGE:c.lookupEnum("PushType").values.MESSAGE},d={PUBLICATION:c.lookupType("protocol.Publication"),JOIN:c.lookupType("protocol.Join"),LEAVE:c.lookupType("protocol.Leave"),UNSUB:c.lookupType("protocol.Unsub"),MESSAGE:c.lookupType("protocol.Message"),SUB:c.lookupType("protocol.Sub")},y=c.lookupType("protocol.Push"),v=c.lookupType("protocol.Command"),b=c.lookupType("protocol.Reply"),m=t.ProtobufEncoder=function(){function e(){s(this,e)}return o(e,[{key:"encodeCommands",value:function(e){var t=a.Writer.create();for(var r in e)if(e.hasOwnProperty(r)){var n=Object.assign({},e[r]);if(n.params){var i=void 0;switch(n.method||(n.method=f.CONNECT),n.method){case f.CONNECT:i=h.CONNECT[0];break;case f.REFRESH:i=h.REFRESH;break;case f.SUBSCRIBE:i=h.SUBSCRIBE[0];break;case f.SUB_REFRESH:i=h.SUB_REFRESH[0];break;case f.UNSUBSCRIBE:i=h.UNSUBSCRIBE[0];break;case f.PUBLISH:i=h.PUBLISH[0];break;case f.PRESENCE:i=h.PRESENCE[0];break;case f.PRESENCE_STATS:i=h.PRESENCE_STATS[0];break;case f.HISTORY:i=h.HISTORY[0];break;case f.PING:i=h.PING[0];break;case f.RPC:i=h.RPC[0];break;case f.SEND:i=h.SEND[0]}n.params=i.encode(n.params).finish()}v.encodeDelimited(n,t)}return t.finish()}}]),e}(),_=t.ProtobufDecoder=function(){function e(){s(this,e)}return o(e,[{key:"decodeReplies",value:function(e){for(var t=[],r=a.Reader.create(new Uint8Array(e));r.pos<r.len;){var n=b.decodeDelimited(r);t.push(n)}return t}},{key:"decodeCommandResult",value:function(e,t){var r;switch(e){case f.CONNECT:r=h.CONNECT[1];break;case f.REFRESH:r=h.REFRESH[1];break;case f.SUBSCRIBE:r=h.SUBSCRIBE[1];break;case f.SUB_REFRESH:r=h.SUB_REFRESH[1];break;case f.UNSUBSCRIBE:r=h.UNSUBSCRIBE[1];break;case f.PUBLISH:r=h.PUBLISH[1];break;case f.PRESENCE:r=h.PRESENCE[1];break;case f.PRESENCE_STATS:r=h.PRESENCE_STATS[1];break;case f.HISTORY:r=h.HISTORY[1];break;case f.PING:r=h.PING[1];break;case f.RPC:r=h.RPC[1]}return this._decode(r,t)}},{key:"decodePush",value:function(e){return this._decode(y,e)}},{key:"decodePushData",value:function(e,t){var r;switch(e){case p.PUBLICATION:r=d.PUBLICATION;break;case p.MESSAGE:r=d.MESSAGE;break;case p.JOIN:r=d.JOIN;break;case p.LEAVE:r=d.LEAVE;break;case p.UNSUB:r=d.UNSUB;break;case p.SUB:r=d.SUB}return this._decode(r,t)}},{key:"_decode",value:function(e,t){var r=void 0;try{r=e.decode(t)}catch(e){return null}return r}}]),e}();t.CentrifugeProtobuf=function(e){function t(){return s(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),o(t,[{key:"_formatOverride",value:function(e){return"protobuf"===e&&(this._binary=!0,this._methodType=f,this._pushType=p,this._encoder=new m,this._decoder=new _,!0)}}]),t}(u.Centrifuge)},function(e,t,r){"use strict";e.exports=r(35)},function(e,t,r){"use strict";function n(e,t,r){return"function"==typeof t?(r=t,t=new s.Root):t||(t=new s.Root),t.load(e,r)}function i(e,t){return t||(t=new s.Root),t.loadSync(e)}var s=e.exports=r(36);s.build="light",s.load=n,s.loadSync=i,s.encoder=r(21),s.decoder=r(26),s.verifier=r(27),s.converter=r(28),s.ReflectionObject=r(4),s.Namespace=r(8),s.Root=r(30),s.Enum=r(2),s.Type=r(22),s.Field=r(5),s.OneOf=r(15),s.MapField=r(23),s.Service=r(24),s.Method=r(25),s.Message=r(16),s.wrappers=r(29),s.types=r(9),s.util=r(0),s.ReflectionObject._configure(s.Root),s.Namespace._configure(s.Type,s.Service,s.Enum),s.Root._configure(s.Type),s.Field._configure(s.Type)},function(e,t,r){"use strict";function n(){i.Reader._configure(i.BufferReader),i.util._configure()}var i=t;i.build="minimal",i.Writer=r(13),i.BufferWriter=r(43),i.Reader=r(14),i.BufferReader=r(44),i.util=r(1),i.rpc=r(19),i.roots=r(20),i.configure=n,i.Writer._configure(i.BufferWriter),n()},function(e,t,r){"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var i=new Array(64),s=new Array(123),o=0;o<64;)s[i[o]=o<26?o+65:o<52?o+71:o<62?o-4:o-59|43]=o++;n.encode=function(e,t,r){for(var n,s=null,o=[],u=0,a=0;t<r;){var c=e[t++];switch(a){case 0:o[u++]=i[c>>2],n=(3&c)<<4,a=1;break;case 1:o[u++]=i[n|c>>4],n=(15&c)<<2,a=2;break;case 2:o[u++]=i[n|c>>6],o[u++]=i[63&c],a=0}u>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),u=0)}return a&&(o[u++]=i[n],o[u++]=61,1===a&&(o[u++]=61)),s?(u&&s.push(String.fromCharCode.apply(String,o.slice(0,u))),s.join("")):String.fromCharCode.apply(String,o.slice(0,u))};n.decode=function(e,t,r){for(var n,i=r,o=0,u=0;u<e.length;){var a=e.charCodeAt(u++);if(61===a&&o>1)break;if(void 0===(a=s[a]))throw Error("invalid encoding");switch(o){case 0:n=a,o=1;break;case 1:t[r++]=n<<2|(48&a)>>4,n=a,o=2;break;case 2:t[r++]=(15&n)<<4|(60&a)>>2,n=a,o=3;break;case 3:t[r++]=(3&n)<<6|a,o=0}}if(1===o)throw Error("invalid encoding");return r-i},n.test=function(e){return/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(e)}},function(e,t,r){"use strict";function n(){this._listeners={}}e.exports=n,n.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},n.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],n=0;n<r.length;)r[n].fn===t?r.splice(n,1):++n;return this},n.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],n=1;n<arguments.length;)r.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,r)}return this}},function(e,t,r){"use strict";function n(e){return"undefined"!=typeof Float32Array?function(){function t(e,t,r){s[0]=e,t[r]=o[0],t[r+1]=o[1],t[r+2]=o[2],t[r+3]=o[3]}function r(e,t,r){s[0]=e,t[r]=o[3],t[r+1]=o[2],t[r+2]=o[1],t[r+3]=o[0]}function n(e,t){return o[0]=e[t],o[1]=e[t+1],o[2]=e[t+2],o[3]=e[t+3],s[0]}function i(e,t){return o[3]=e[t],o[2]=e[t+1],o[1]=e[t+2],o[0]=e[t+3],s[0]}var s=new Float32Array([-0]),o=new Uint8Array(s.buffer),u=128===o[3];e.writeFloatLE=u?t:r,e.writeFloatBE=u?r:t,e.readFloatLE=u?n:i,e.readFloatBE=u?i:n}():function(){function t(e,t,r,n){var i=t<0?1:0;if(i&&(t=-t),0===t)e(1/t>0?0:2147483648,r,n);else if(isNaN(t))e(2143289344,r,n);else if(t>3.4028234663852886e38)e((i<<31|2139095040)>>>0,r,n);else if(t<1.1754943508222875e-38)e((i<<31|Math.round(t/1.401298464324817e-45))>>>0,r,n);else{var s=Math.floor(Math.log(t)/Math.LN2),o=8388607&Math.round(t*Math.pow(2,-s)*8388608);e((i<<31|s+127<<23|o)>>>0,r,n)}}function r(e,t,r){var n=e(t,r),i=2*(n>>31)+1,s=n>>>23&255,o=8388607&n;return 255===s?o?NaN:i*(1/0):0===s?1.401298464324817e-45*i*o:i*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,i),e.writeFloatBE=t.bind(null,s),e.readFloatLE=r.bind(null,o),e.readFloatBE=r.bind(null,u)}(),"undefined"!=typeof Float64Array?function(){function t(e,t,r){s[0]=e,t[r]=o[0],t[r+1]=o[1],t[r+2]=o[2],t[r+3]=o[3],t[r+4]=o[4],t[r+5]=o[5],t[r+6]=o[6],t[r+7]=o[7]}function r(e,t,r){s[0]=e,t[r]=o[7],t[r+1]=o[6],t[r+2]=o[5],t[r+3]=o[4],t[r+4]=o[3],t[r+5]=o[2],t[r+6]=o[1],t[r+7]=o[0]}function n(e,t){return o[0]=e[t],o[1]=e[t+1],o[2]=e[t+2],o[3]=e[t+3],o[4]=e[t+4],o[5]=e[t+5],o[6]=e[t+6],o[7]=e[t+7],s[0]}function i(e,t){return o[7]=e[t],o[6]=e[t+1],o[5]=e[t+2],o[4]=e[t+3],o[3]=e[t+4],o[2]=e[t+5],o[1]=e[t+6],o[0]=e[t+7],s[0]}var s=new Float64Array([-0]),o=new Uint8Array(s.buffer),u=128===o[7];e.writeDoubleLE=u?t:r,e.writeDoubleBE=u?r:t,e.readDoubleLE=u?n:i,e.readDoubleBE=u?i:n}():function(){function t(e,t,r,n,i,s){var o=n<0?1:0;if(o&&(n=-n),0===n)e(0,i,s+t),e(1/n>0?0:2147483648,i,s+r);else if(isNaN(n))e(0,i,s+t),e(2146959360,i,s+r);else if(n>1.7976931348623157e308)e(0,i,s+t),e((o<<31|2146435072)>>>0,i,s+r);else{var u;if(n<2.2250738585072014e-308)u=n/5e-324,e(u>>>0,i,s+t),e((o<<31|u/4294967296)>>>0,i,s+r);else{var a=Math.floor(Math.log(n)/Math.LN2);1024===a&&(a=1023),u=n*Math.pow(2,-a),e(4503599627370496*u>>>0,i,s+t),e((o<<31|a+1023<<20|1048576*u&1048575)>>>0,i,s+r)}}}function r(e,t,r,n,i){var s=e(n,i+t),o=e(n,i+r),u=2*(o>>31)+1,a=o>>>20&2047,c=4294967296*(1048575&o)+s;return 2047===a?c?NaN:u*(1/0):0===a?5e-324*u*c:u*Math.pow(2,a-1075)*(c+4503599627370496)}e.writeDoubleLE=t.bind(null,i,0,4),e.writeDoubleBE=t.bind(null,s,4,0),e.readDoubleLE=r.bind(null,o,0,4),e.readDoubleBE=r.bind(null,u,4,0)}(),e}function i(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function s(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function o(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function u(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=n(n)},function(e,t,r){"use strict";var n=t;n.length=function(e){for(var t=0,r=0,n=0;n<e.length;++n)r=e.charCodeAt(n),r<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},n.read=function(e,t,r){if(r-t<1)return"";for(var n,i=null,s=[],o=0;t<r;)n=e[t++],n<128?s[o++]=n:n>191&&n<224?s[o++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(n>>10),s[o++]=56320+(1023&n)):s[o++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))},n.write=function(e,t,r){for(var n,i,s=r,o=0;o<e.length;++o)n=e.charCodeAt(o),n<128?t[r++]=n:n<2048?(t[r++]=n>>6|192,t[r++]=63&n|128):55296==(64512&n)&&56320==(64512&(i=e.charCodeAt(o+1)))?(n=65536+((1023&n)<<10)+(1023&i),++o,t[r++]=n>>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128);return r-s}},function(e,t,r){"use strict";function n(e,t,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(r){if(r<1||r>i)return e(r);o+r>n&&(s=e(n),o=0);var u=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),u}}e.exports=n},function(e,t,r){"use strict";function n(e,t){this.lo=e>>>0,this.hi=t>>>0}e.exports=n;var i=r(1),s=n.zero=new n(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(i.isString(e)){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):s},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var u=String.prototype.charCodeAt;n.fromHash=function(e){return e===o?s:new n((u.call(e,0)|u.call(e,1)<<8|u.call(e,2)<<16|u.call(e,3)<<24)>>>0,(u.call(e,4)|u.call(e,5)<<8|u.call(e,6)<<16|u.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},function(e,t,r){"use strict";function n(){s.call(this)}function i(e,t,r){e.length<40?o.utf8.write(e,t,r):t.utf8Write(e,r)}e.exports=n;var s=r(13);(n.prototype=Object.create(s.prototype)).constructor=n;var o=r(1),u=o.Buffer;n.alloc=function(e){return(n.alloc=o._Buffer_allocUnsafe)(e)};var a=u&&u.prototype instanceof Uint8Array&&"set"===u.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var n=0;n<e.length;)t[r++]=e[n++]};n.prototype.bytes=function(e){o.isString(e)&&(e=o._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(a,t,e),this},n.prototype.string=function(e){var t=u.byteLength(e);return this.uint32(t),t&&this._push(i,t,e),this}},function(e,t,r){"use strict";function n(e){i.call(this,e)}e.exports=n;var i=r(14);(n.prototype=Object.create(i.prototype)).constructor=n;var s=r(1);s.Buffer&&(n.prototype._slice=s.Buffer.prototype.slice),n.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len))}},function(e,t,r){"use strict";function n(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}e.exports=n;var i=r(1);(n.prototype=Object.create(i.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,r,n,s,o){if(!s)throw TypeError("request must be specified");var u=this;if(!o)return i.asPromise(e,u,t,r,n,s);if(!u.rpcImpl)return void setTimeout(function(){o(Error("already ended"))},0);try{return u.rpcImpl(t,r[u.requestDelimited?"encodeDelimited":"encode"](s).finish(),function(e,r){if(e)return u.emit("error",e,t),o(e);if(null===r)return void u.end(!0);if(!(r instanceof n))try{r=n[u.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return u.emit("error",e,t),o(e)}return u.emit("data",r,t),o(null,r)})}catch(e){return u.emit("error",e,t),void setTimeout(function(){o(e)},0)}},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(e,t,r){"use strict";function n(e,t){function r(e){if("string"!=typeof e){var t=i();if(n.verbose&&console.log("codegen: "+t),t="return "+t,e){for(var o=Object.keys(e),u=new Array(o.length+1),a=new Array(o.length),c=0;c<o.length;)u[c]=o[c],a[c]=e[o[c++]];return u[c]=t,Function.apply(null,u).apply(null,a)}return Function(t)()}for(var l=new Array(arguments.length-1),f=0;f<l.length;)l[f]=arguments[++f];if(f=0,e=e.replace(/%([%dfijs])/g,function(e,t){var r=l[f++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"}),f!==l.length)throw Error("parameter count mismatch");return s.push(e),r}function i(r){return"function "+(r||t||"")+"("+(e&&e.join(",")||"")+"){\n "+s.join("\n ")+"\n}"}"string"==typeof e&&(t=e,e=void 0);var s=[];return r.toString=i,r}e.exports=n,n.verbose=!1},function(e,t,r){"use strict";function n(e,t,r){return"function"==typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&o&&o.readFile?o.readFile(e,function(i,s){return i&&"undefined"!=typeof XMLHttpRequest?n.xhr(e,t,r):i?r(i):r(null,t.binary?s:s.toString("utf8"))}):n.xhr(e,t,r):i(n,this,e,t)}e.exports=n;var i=r(17),s=r(18),o=s("fs");n.xhr=function(e,t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState){if(0!==n.status&&200!==n.status)return r(Error("status "+n.status));if(t.binary){var e=n.response;if(!e){e=[];for(var i=0;i<n.responseText.length;++i)e.push(255&n.responseText.charCodeAt(i))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,n.responseText)}},t.binary&&("overrideMimeType"in n&&n.overrideMimeType("text/plain; charset=x-user-defined"),n.responseType="arraybuffer"),n.open("GET",e),n.send()}},function(e,t,r){"use strict";var n=t,i=n.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},s=n.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var t=e.split("/"),r=i(e),n="";r&&(n=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return n+t.join("/")};n.resolve=function(e,t,r){return r||(t=s(t)),i(t)?t:(r||(e=s(e)),(e=e.replace(/(?:\/|^)[^\/]+$/,"")).length?s(e+"/"+t):t)}},function(e,t){e.exports={nested:{protocol:{nested:{Error:{fields:{code:{type:"uint32",id:1},message:{type:"string",id:2}}},MethodType:{values:{CONNECT:0,SUBSCRIBE:1,UNSUBSCRIBE:2,PUBLISH:3,PRESENCE:4,PRESENCE_STATS:5,HISTORY:6,PING:7,SEND:8,RPC:9,REFRESH:10,SUB_REFRESH:11}},Command:{fields:{id:{type:"uint32",id:1},method:{type:"MethodType",id:2},params:{type:"bytes",id:3}}},Reply:{fields:{id:{type:"uint32",id:1},error:{type:"Error",id:2},result:{type:"bytes",id:3}}},PushType:{values:{PUBLICATION:0,JOIN:1,LEAVE:2,UNSUB:3,MESSAGE:4,SUB:5}},Push:{fields:{type:{type:"PushType",id:1},channel:{type:"string",id:2},data:{type:"bytes",id:3}}},ClientInfo:{fields:{user:{type:"string",id:1},client:{type:"string",id:2},conn_info:{type:"bytes",id:3},chan_info:{type:"bytes",id:4}}},Publication:{fields:{seq:{type:"uint32",id:1},gen:{type:"uint32",id:2},uid:{type:"string",id:3},data:{type:"bytes",id:4},info:{type:"ClientInfo",id:5}}},Join:{fields:{info:{type:"ClientInfo",id:1}}},Leave:{fields:{info:{type:"ClientInfo",id:1}}},Unsub:{fields:{resubscribe:{type:"bool",id:1}}},Sub:{fields:{recoverable:{type:"bool",id:1},seq:{type:"uint32",id:2},gen:{type:"uint32",id:3},epoch:{type:"string",id:4},publications:{rule:"repeated",type:"Publication",id:5}}},Message:{fields:{data:{type:"bytes",id:1}}},ConnectRequest:{fields:{token:{type:"string",id:1},data:{type:"bytes",id:2},subs:{keyType:"string",type:"SubscribeRequest",id:3}}},ConnectResult:{fields:{client:{type:"string",id:1},version:{type:"string",id:2},expires:{type:"bool",id:3},ttl:{type:"uint32",id:4},data:{type:"bytes",id:5},subs:{keyType:"string",type:"SubscribeResult",id:6}}},RefreshRequest:{fields:{token:{type:"string",id:1}}},RefreshResult:{fields:{client:{type:"string",id:1},version:{type:"string",id:2},expires:{type:"bool",id:3},ttl:{type:"uint32",id:4}}},SubscribeRequest:{fields:{channel:{type:"string",id:1},token:{type:"string",id:2},recover:{type:"bool",id:3},seq:{type:"uint32",id:4},gen:{type:"uint32",id:5},epoch:{type:"string",id:6}}},SubscribeResult:{fields:{expires:{type:"bool",id:1},ttl:{type:"uint32",id:2},recoverable:{type:"bool",id:3},seq:{type:"uint32",id:4},gen:{type:"uint32",id:5},epoch:{type:"string",id:6},publications:{rule:"repeated",type:"Publication",id:7},recovered:{type:"bool",id:8}}},SubRefreshRequest:{fields:{channel:{type:"string",id:1},token:{type:"string",id:2}}},SubRefreshResult:{fields:{expires:{type:"bool",id:1},ttl:{type:"uint32",id:2}}},UnsubscribeRequest:{fields:{channel:{type:"string",id:1}}},UnsubscribeResult:{fields:{}},PublishRequest:{fields:{channel:{type:"string",id:1},data:{type:"bytes",id:2}}},PublishResult:{fields:{}},PresenceRequest:{fields:{channel:{type:"string",id:1}}},PresenceResult:{fields:{presence:{keyType:"string",type:"ClientInfo",id:1}}},PresenceStatsRequest:{fields:{channel:{type:"string",id:1}}},PresenceStatsResult:{fields:{num_clients:{type:"uint32",id:1},num_users:{type:"uint32",id:2}}},HistoryRequest:{fields:{channel:{type:"string",id:1}}},HistoryResult:{fields:{publications:{rule:"repeated",type:"Publication",id:1}}},PingRequest:{fields:{}},PingResult:{fields:{}},RPCRequest:{fields:{data:{type:"bytes",id:1},method:{type:"string",id:2}}},RPCResult:{fields:{data:{type:"bytes",id:1}}},SendRequest:{fields:{data:{type:"bytes",id:1}}}}}}}}])});
|