UNPKG

centrifuge

Version:

JavaScript client SDK for bidirectional communication with Centrifugo and Centrifuge-based server from browser, NodeJS and React Native

4 lines 126 kB
"use strict";(()=>{var pi=Object.create;var ct=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var mi=Object.getOwnPropertyNames;var _i=Object.getPrototypeOf,gi=Object.prototype.hasOwnProperty;var d=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),bi=(r,t)=>{for(var e in t)ct(r,e,{get:t[e],enumerable:!0})},vi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mi(t))!gi.call(r,i)&&i!==e&&ct(r,i,{get:()=>t[i],enumerable:!(n=yi(t,i))||n.enumerable});return r};var lt=(r,t,e)=>(e=r!=null?pi(_i(r)):{},vi(t||!r||!r.__esModule?ct(e,"default",{value:r,enumerable:!0}):e,r));var ft=d((Rs,ht)=>{"use strict";var ce=typeof Reflect=="object"?Reflect:null,fn=ce&&typeof ce.apply=="function"?ce.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},De;ce&&typeof ce.ownKeys=="function"?De=ce.ownKeys:Object.getOwnPropertySymbols?De=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:De=function(t){return Object.getOwnPropertyNames(t)};function wi(r){console&&console.warn&&console.warn(r)}var pn=Number.isNaN||function(t){return t!==t};function S(){S.init.call(this)}ht.exports=S;ht.exports.once=Ei;S.EventEmitter=S;S.prototype._events=void 0;S.prototype._eventsCount=0;S.prototype._maxListeners=void 0;var dn=10;function Ne(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(S,"defaultMaxListeners",{enumerable:!0,get:function(){return dn},set:function(r){if(typeof r!="number"||r<0||pn(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");dn=r}});S.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};S.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||pn(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function yn(r){return r._maxListeners===void 0?S.defaultMaxListeners:r._maxListeners}S.prototype.getMaxListeners=function(){return yn(this)};S.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i=t==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=s[t];if(u===void 0)return!1;if(typeof u=="function")fn(u,this,e);else for(var c=u.length,l=vn(u,c),n=0;n<c;++n)fn(l[n],this,e);return!0};function mn(r,t,e,n){var i,s,o;if(Ne(e),s=r._events,s===void 0?(s=r._events=Object.create(null),r._eventsCount=0):(s.newListener!==void 0&&(r.emit("newListener",t,e.listener?e.listener:e),s=r._events),o=s[t]),o===void 0)o=s[t]=e,++r._eventsCount;else if(typeof o=="function"?o=s[t]=n?[e,o]:[o,e]:n?o.unshift(e):o.push(e),i=yn(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=r,a.type=t,a.count=o.length,wi(a)}return r}S.prototype.addListener=function(t,e){return mn(this,t,e,!1)};S.prototype.on=S.prototype.addListener;S.prototype.prependListener=function(t,e){return mn(this,t,e,!0)};function Si(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _n(r,t,e){var n={fired:!1,wrapFn:void 0,target:r,type:t,listener:e},i=Si.bind(n);return i.listener=e,n.wrapFn=i,i}S.prototype.once=function(t,e){return Ne(e),this.on(t,_n(this,t,e)),this};S.prototype.prependOnceListener=function(t,e){return Ne(e),this.prependListener(t,_n(this,t,e)),this};S.prototype.removeListener=function(t,e){var n,i,s,o,a;if(Ne(e),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():xi(n,s),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,a||e)}return this};S.prototype.off=S.prototype.removeListener;S.prototype.removeAllListeners=function(t){var e,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=n[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this};function gn(r,t,e){var n=r._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?e?[i.listener||i]:[i]:e?Oi(i):vn(i,i.length)}S.prototype.listeners=function(t){return gn(this,t,!0)};S.prototype.rawListeners=function(t){return gn(this,t,!1)};S.listenerCount=function(r,t){return typeof r.listenerCount=="function"?r.listenerCount(t):bn.call(r,t)};S.prototype.listenerCount=bn;function bn(r){var t=this._events;if(t!==void 0){var e=t[r];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}S.prototype.eventNames=function(){return this._eventsCount>0?De(this._events):[]};function vn(r,t){for(var e=new Array(t),n=0;n<t;++n)e[n]=r[n];return e}function xi(r,t){for(;t+1<r.length;t++)r[t]=r[t+1];r.pop()}function Oi(r){for(var t=new Array(r.length),e=0;e<t.length;++e)t[e]=r[e].listener||r[e];return t}function Ei(r,t){return new Promise(function(e,n){function i(o){r.removeListener(t,s),n(o)}function s(){typeof r.removeListener=="function"&&r.removeListener("error",i),e([].slice.call(arguments))}wn(r,t,s,{once:!0}),t!=="error"&&Ti(r,i,{once:!0})})}function Ti(r,t,e){typeof r.on=="function"&&wn(r,"error",t,e)}function wn(r,t,e,n){if(typeof r.on=="function")n.once?r.once(t,e):r.on(t,e);else if(typeof r.addEventListener=="function")r.addEventListener(t,function i(s){n.once&&r.removeEventListener(t,i),e(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}});var mt=d((Ro,kn)=>{"use strict";kn.exports=Ni;function Ni(r,t){for(var e=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)e[n++]=arguments[i++];return new Promise(function(a,u){e[n]=function(l){if(s)if(s=!1,l)u(l);else{for(var b=new Array(arguments.length-1),x=0;x<b.length;)b[x++]=arguments[x];a.apply(null,b)}};try{r.apply(t||null,e)}catch(c){s&&(s=!1,u(c))}})}});var An=d(Pn=>{"use strict";var ze=Pn;ze.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&t.charAt(e)==="=";)++n;return Math.ceil(t.length*3)/4-n};var fe=new Array(64),Cn=new Array(123);for(J=0;J<64;)Cn[fe[J]=J<26?J+65:J<52?J+71:J<62?J-4:J-59|43]=J++;var J;ze.encode=function(t,e,n){for(var i=null,s=[],o=0,a=0,u;e<n;){var c=t[e++];switch(a){case 0:s[o++]=fe[c>>2],u=(c&3)<<4,a=1;break;case 1:s[o++]=fe[u|c>>4],u=(c&15)<<2,a=2;break;case 2:s[o++]=fe[u|c>>6],s[o++]=fe[c&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=fe[u],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var Rn="invalid encoding";ze.decode=function(t,e,n){for(var i=n,s=0,o,a=0;a<t.length;){var u=t.charCodeAt(a++);if(u===61&&s>1)break;if((u=Cn[u])===void 0)throw Error(Rn);switch(s){case 0:o=u,s=1;break;case 1:e[n++]=o<<2|(u&48)>>4,o=u,s=2;break;case 2:e[n++]=(o&15)<<4|(u&60)>>2,o=u,s=3;break;case 3:e[n++]=(o&3)<<6|u,s=0;break}}if(s===1)throw Error(Rn);return n-i};ze.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var Dn=d((Po,qn)=>{"use strict";qn.exports=We;function We(){this._listeners={}}We.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this};We.prototype.off=function(t,e){if(t===void 0)this._listeners={};else if(e===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===e?n.splice(i,1):++i;return this};We.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<e.length;)e[i].fn.apply(e[i++].ctx,n)}return this}});var Jn=d((Ao,Fn)=>{"use strict";Fn.exports=Nn(Nn);function Nn(r){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),e=new Uint8Array(t.buffer),n=e[3]===128;function i(u,c,l){t[0]=u,c[l]=e[0],c[l+1]=e[1],c[l+2]=e[2],c[l+3]=e[3]}function s(u,c,l){t[0]=u,c[l]=e[3],c[l+1]=e[2],c[l+2]=e[1],c[l+3]=e[0]}r.writeFloatLE=n?i:s,r.writeFloatBE=n?s:i;function o(u,c){return e[0]=u[c],e[1]=u[c+1],e[2]=u[c+2],e[3]=u[c+3],t[0]}function a(u,c){return e[3]=u[c],e[2]=u[c+1],e[1]=u[c+2],e[0]=u[c+3],t[0]}r.readFloatLE=n?o:a,r.readFloatBE=n?a:o}():function(){function t(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var u=Math.floor(Math.log(i)/Math.LN2),c=Math.round(i*Math.pow(2,-u)*8388608)&8388607;n((a<<31|u+127<<23|c)>>>0,s,o)}}r.writeFloatLE=t.bind(null,Ln),r.writeFloatBE=t.bind(null,In);function e(n,i,s){var o=n(i,s),a=(o>>31)*2+1,u=o>>>23&255,c=o&8388607;return u===255?c?NaN:a*(1/0):u===0?a*1401298464324817e-60*c:a*Math.pow(2,u-150)*(c+8388608)}r.readFloatLE=e.bind(null,Bn),r.readFloatBE=e.bind(null,jn)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),e=new Uint8Array(t.buffer),n=e[7]===128;function i(u,c,l){t[0]=u,c[l]=e[0],c[l+1]=e[1],c[l+2]=e[2],c[l+3]=e[3],c[l+4]=e[4],c[l+5]=e[5],c[l+6]=e[6],c[l+7]=e[7]}function s(u,c,l){t[0]=u,c[l]=e[7],c[l+1]=e[6],c[l+2]=e[5],c[l+3]=e[4],c[l+4]=e[3],c[l+5]=e[2],c[l+6]=e[1],c[l+7]=e[0]}r.writeDoubleLE=n?i:s,r.writeDoubleBE=n?s:i;function o(u,c){return e[0]=u[c],e[1]=u[c+1],e[2]=u[c+2],e[3]=u[c+3],e[4]=u[c+4],e[5]=u[c+5],e[6]=u[c+6],e[7]=u[c+7],t[0]}function a(u,c){return e[7]=u[c],e[6]=u[c+1],e[5]=u[c+2],e[4]=u[c+3],e[3]=u[c+4],e[2]=u[c+5],e[1]=u[c+6],e[0]=u[c+7],t[0]}r.readDoubleLE=n?o:a,r.readDoubleBE=n?a:o}():function(){function t(n,i,s,o,a,u){var c=o<0?1:0;if(c&&(o=-o),o===0)n(0,a,u+i),n(1/o>0?0:2147483648,a,u+s);else if(isNaN(o))n(0,a,u+i),n(2146959360,a,u+s);else if(o>17976931348623157e292)n(0,a,u+i),n((c<<31|2146435072)>>>0,a,u+s);else{var l;if(o<22250738585072014e-324)l=o/5e-324,n(l>>>0,a,u+i),n((c<<31|l/4294967296)>>>0,a,u+s);else{var b=Math.floor(Math.log(o)/Math.LN2);b===1024&&(b=1023),l=o*Math.pow(2,-b),n(l*4503599627370496>>>0,a,u+i),n((c<<31|b+1023<<20|l*1048576&1048575)>>>0,a,u+s)}}}r.writeDoubleLE=t.bind(null,Ln,0,4),r.writeDoubleBE=t.bind(null,In,4,0);function e(n,i,s,o,a){var u=n(o,a+i),c=n(o,a+s),l=(c>>31)*2+1,b=c>>>20&2047,x=4294967296*(c&1048575)+u;return b===2047?x?NaN:l*(1/0):b===0?l*5e-324*x:l*Math.pow(2,b-1075)*(x+4503599627370496)}r.readDoubleLE=e.bind(null,Bn,0,4),r.readDoubleBE=e.bind(null,jn,4,0)}(),r}function Ln(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}function In(r,t,e){t[e]=r>>>24,t[e+1]=r>>>16&255,t[e+2]=r>>>8&255,t[e+3]=r&255}function Bn(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0}function jn(r,t){return(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}});var _t=d((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(r){}return null}});var Un=d(Mn=>{"use strict";var gt=Mn;gt.length=function(t){for(var e=0,n=0,i=0;i<t.length;++i)n=t.charCodeAt(i),n<128?e+=1:n<2048?e+=2:(n&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,e+=4):e+=3;return e};gt.read=function(t,e,n){var i=n-e;if(i<1)return"";for(var s=null,o=[],a=0,u;e<n;)u=t[e++],u<128?o[a++]=u:u>191&&u<224?o[a++]=(u&31)<<6|t[e++]&63:u>239&&u<365?(u=((u&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[a++]=55296+(u>>10),o[a++]=56320+(u&1023)):o[a++]=(u&15)<<12|(t[e++]&63)<<6|t[e++]&63,a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0);return s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};gt.write=function(t,e,n){for(var i=n,s,o,a=0;a<t.length;++a)s=t.charCodeAt(a),s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&((o=t.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128);return n-i}});var Wn=d((Do,zn)=>{"use strict";zn.exports=Li;function Li(r,t,e){var n=e||8192,i=n>>>1,s=null,o=n;return function(u){if(u<1||u>i)return r(u);o+u>n&&(s=r(n),o=0);var c=t.call(s,o,o+=u);return o&7&&(o=(o|7)+1),c}}});var Hn=d((No,$n)=>{"use strict";$n.exports=R;var we=W();function R(r,t){this.lo=r>>>0,this.hi=t>>>0}var ie=R.zero=new R(0,0);ie.toNumber=function(){return 0};ie.zzEncode=ie.zzDecode=function(){return this};ie.length=function(){return 1};var Ii=R.zeroHash="\0\0\0\0\0\0\0\0";R.fromNumber=function(t){if(t===0)return ie;var e=t<0;e&&(t=-t);var n=t>>>0,i=(t-n)/4294967296>>>0;return e&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new R(n,i)};R.from=function(t){if(typeof t=="number")return R.fromNumber(t);if(we.isString(t))if(we.Long)t=we.Long.fromString(t);else return R.fromNumber(parseInt(t,10));return t.low||t.high?new R(t.low>>>0,t.high>>>0):ie};R.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=~this.lo+1>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+n*4294967296)}return this.lo+this.hi*4294967296};R.prototype.toLong=function(t){return we.Long?new we.Long(this.lo|0,this.hi|0,!!t):{low:this.lo|0,high:this.hi|0,unsigned:!!t}};var Q=String.prototype.charCodeAt;R.fromHash=function(t){return t===Ii?ie:new R((Q.call(t,0)|Q.call(t,1)<<8|Q.call(t,2)<<16|Q.call(t,3)<<24)>>>0,(Q.call(t,4)|Q.call(t,5)<<8|Q.call(t,6)<<16|Q.call(t,7)<<24)>>>0)};R.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};R.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this};R.prototype.zzDecode=function(){var t=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this};R.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?e===0?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}});var W=d(bt=>{"use strict";var h=bt;h.asPromise=mt();h.base64=An();h.EventEmitter=Dn();h.float=Jn();h.inquire=_t();h.utf8=Un();h.pool=Wn();h.LongBits=Hn();h.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);h.global=h.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||bt;h.emptyArray=Object.freeze?Object.freeze([]):[];h.emptyObject=Object.freeze?Object.freeze({}):{};h.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};h.isString=function(t){return typeof t=="string"||t instanceof String};h.isObject=function(t){return t&&typeof t=="object"};h.isset=h.isSet=function(t,e){var n=t[e];return n!=null&&t.hasOwnProperty(e)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};h.Buffer=function(){try{var r=h.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();h._Buffer_from=null;h._Buffer_allocUnsafe=null;h.newBuffer=function(t){return typeof t=="number"?h.Buffer?h._Buffer_allocUnsafe(t):new h.Array(t):h.Buffer?h._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};h.Array=typeof Uint8Array<"u"?Uint8Array:Array;h.Long=h.global.dcodeIO&&h.global.dcodeIO.Long||h.global.Long||h.inquire("long");h.key2Re=/^true|false|0|1$/;h.key32Re=/^-?(?:0|[1-9][0-9]*)$/;h.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;h.longToHash=function(t){return t?h.LongBits.from(t).toHash():h.LongBits.zeroHash};h.longFromHash=function(t,e){var n=h.LongBits.fromHash(t);return h.Long?h.Long.fromBits(n.lo,n.hi,e):n.toNumber(!!e)};function Vn(r,t,e){for(var n=Object.keys(t),i=0;i<n.length;++i)(r[n[i]]===void 0||!e)&&(r[n[i]]=t[n[i]]);return r}h.merge=Vn;h.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Gn(r){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Vn(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return r},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}h.newError=Gn;h.ProtocolError=Gn("ProtocolError");h.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(e[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};h.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}};h.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};h._configure=function(){var r=h.Buffer;if(!r){h._Buffer_from=h._Buffer_allocUnsafe=null;return}h._Buffer_from=r.from!==Uint8Array.from&&r.from||function(e,n){return new r(e,n)},h._Buffer_allocUnsafe=r.allocUnsafe||function(e){return new r(e)}}});var He=d((Io,Qn)=>{"use strict";Qn.exports=_;var L=W(),vt,$e=L.LongBits,Kn=L.base64,Zn=L.utf8;function Se(r,t,e){this.fn=r,this.len=t,this.next=void 0,this.val=e}function St(){}function Bi(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function _(){this.len=0,this.head=new Se(St,0,0),this.tail=this.head,this.states=null}var Xn=function(){return L.Buffer?function(){return(_.create=function(){return new vt})()}:function(){return new _}};_.create=Xn();_.alloc=function(t){return new L.Array(t)};L.Array!==Array&&(_.alloc=L.pool(_.alloc,L.Array.prototype.subarray));_.prototype._push=function(t,e,n){return this.tail=this.tail.next=new Se(t,e,n),this.len+=e,this};function xt(r,t,e){t[e]=r&255}function ji(r,t,e){for(;r>127;)t[e++]=r&127|128,r>>>=7;t[e]=r}function Ot(r,t){this.len=r,this.next=void 0,this.val=t}Ot.prototype=Object.create(Se.prototype);Ot.prototype.fn=ji;_.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new Ot((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};_.prototype.int32=function(t){return t<0?this._push(Et,10,$e.fromNumber(t)):this.uint32(t)};_.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function Et(r,t,e){for(;r.hi;)t[e++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)t[e++]=r.lo&127|128,r.lo=r.lo>>>7;t[e++]=r.lo}_.prototype.uint64=function(t){var e=$e.from(t);return this._push(Et,e.length(),e)};_.prototype.int64=_.prototype.uint64;_.prototype.sint64=function(t){var e=$e.from(t).zzEncode();return this._push(Et,e.length(),e)};_.prototype.bool=function(t){return this._push(xt,1,t?1:0)};function wt(r,t,e){t[e]=r&255,t[e+1]=r>>>8&255,t[e+2]=r>>>16&255,t[e+3]=r>>>24}_.prototype.fixed32=function(t){return this._push(wt,4,t>>>0)};_.prototype.sfixed32=_.prototype.fixed32;_.prototype.fixed64=function(t){var e=$e.from(t);return this._push(wt,4,e.lo)._push(wt,4,e.hi)};_.prototype.sfixed64=_.prototype.fixed64;_.prototype.float=function(t){return this._push(L.float.writeFloatLE,4,t)};_.prototype.double=function(t){return this._push(L.float.writeDoubleLE,8,t)};var Fi=L.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var i=0;i<t.length;++i)e[n+i]=t[i]};_.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(xt,1,0);if(L.isString(t)){var n=_.alloc(e=Kn.length(t));Kn.decode(t,n,0),t=n}return this.uint32(e)._push(Fi,e,t)};_.prototype.string=function(t){var e=Zn.length(t);return e?this.uint32(e)._push(Zn.write,e,t):this._push(xt,1,0)};_.prototype.fork=function(){return this.states=new Bi(this),this.head=this.tail=new Se(St,0,0),this.len=0,this};_.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 Se(St,0,0),this.len=0),this};_.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this};_.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e};_._configure=function(r){vt=r,_.create=Xn(),vt._configure()}});var tr=d((Bo,er)=>{"use strict";er.exports=$;var Yn=He();($.prototype=Object.create(Yn.prototype)).constructor=$;var Y=W();function $(){Yn.call(this)}$._configure=function(){$.alloc=Y._Buffer_allocUnsafe,$.writeBytesBuffer=Y.Buffer&&Y.Buffer.prototype instanceof Uint8Array&&Y.Buffer.prototype.set.name==="set"?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var i=0;i<t.length;)e[n++]=t[i++]}};$.prototype.bytes=function(t){Y.isString(t)&&(t=Y._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push($.writeBytesBuffer,e,t),this};function Ji(r,t,e){r.length<40?Y.utf8.write(r,t,e):t.utf8Write?t.utf8Write(r,e):t.write(r,e)}$.prototype.string=function(t){var e=Y.Buffer.byteLength(t);return this.uint32(e),e&&this._push(Ji,e,t),this};$._configure()});var Ge=d((jo,or)=>{"use strict";or.exports=E;var M=W(),kt,ir=M.LongBits,Mi=M.utf8;function U(r,t){return RangeError("index out of range: "+r.pos+" + "+(t||1)+" > "+r.len)}function E(r){this.buf=r,this.pos=0,this.len=r.length}var nr=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new E(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new E(t);throw Error("illegal buffer")},sr=function(){return M.Buffer?function(e){return(E.create=function(i){return M.Buffer.isBuffer(i)?new kt(i):nr(i)})(e)}:nr};E.create=sr();E.prototype._slice=M.Array.prototype.subarray||M.Array.prototype.slice;E.prototype.uint32=function(){var t=4294967295;return function(){if(t=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(t=(t|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(t=(t|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return t;if((this.pos+=5)>this.len)throw this.pos=this.len,U(this,10);return t}}();E.prototype.int32=function(){return this.uint32()|0};E.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function Tt(){var r=new ir(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r;if(r.lo=(r.lo|(this.buf[this.pos]&127)<<28)>>>0,r.hi=(r.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return r;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw U(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,r}if(this.len-this.pos>4){for(;t<5;++t)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;t<5;++t){if(this.pos>=this.len)throw U(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}E.prototype.bool=function(){return this.uint32()!==0};function Ve(r,t){return(r[t-4]|r[t-3]<<8|r[t-2]<<16|r[t-1]<<24)>>>0}E.prototype.fixed32=function(){if(this.pos+4>this.len)throw U(this,4);return Ve(this.buf,this.pos+=4)};E.prototype.sfixed32=function(){if(this.pos+4>this.len)throw U(this,4);return Ve(this.buf,this.pos+=4)|0};function rr(){if(this.pos+8>this.len)throw U(this,8);return new ir(Ve(this.buf,this.pos+=4),Ve(this.buf,this.pos+=4))}E.prototype.float=function(){if(this.pos+4>this.len)throw U(this,4);var t=M.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};E.prototype.double=function(){if(this.pos+8>this.len)throw U(this,4);var t=M.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};E.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw U(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,n);if(e===n){var i=M.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,n)};E.prototype.string=function(){var t=this.bytes();return Mi.read(t,0,t.length)};E.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw U(this,t);this.pos+=t}else do if(this.pos>=this.len)throw U(this);while(this.buf[this.pos++]&128);return this};E.prototype.skipType=function(r){switch(r){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(r=this.uint32()&7)!==4;)this.skipType(r);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+r+" at offset "+this.pos)}return this};E._configure=function(r){kt=r,E.create=sr(),kt._configure();var t=M.Long?"toLong":"toNumber";M.merge(E.prototype,{int64:function(){return Tt.call(this)[t](!1)},uint64:function(){return Tt.call(this)[t](!0)},sint64:function(){return Tt.call(this).zzDecode()[t](!1)},fixed64:function(){return rr.call(this)[t](!0)},sfixed64:function(){return rr.call(this)[t](!1)}})}});var lr=d((Fo,cr)=>{"use strict";cr.exports=se;var ur=Ge();(se.prototype=Object.create(ur.prototype)).constructor=se;var ar=W();function se(r){ur.call(this,r)}se._configure=function(){ar.Buffer&&(se.prototype._slice=ar.Buffer.prototype.slice)};se.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))};se._configure()});var fr=d((Jo,hr)=>{"use strict";hr.exports=xe;var Rt=W();(xe.prototype=Object.create(Rt.EventEmitter.prototype)).constructor=xe;function xe(r,t,e){if(typeof r!="function")throw TypeError("rpcImpl must be a function");Rt.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=!!t,this.responseDelimited=!!e}xe.prototype.rpcCall=function r(t,e,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return Rt.asPromise(r,o,t,e,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(t,e[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,c){if(u)return o.emit("error",u,t),s(u);if(c===null){o.end(!0);return}if(!(c instanceof n))try{c=n[o.responseDelimited?"decodeDelimited":"decode"](c)}catch(l){return o.emit("error",l,t),s(l)}return o.emit("data",c,t),s(null,c)})}catch(a){o.emit("error",a,t),setTimeout(function(){s(a)},0);return}};xe.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Ct=d(dr=>{"use strict";var Ui=dr;Ui.Service=fr()});var Pt=d((Uo,pr)=>{"use strict";pr.exports={}});var _r=d(mr=>{"use strict";var A=mr;A.build="minimal";A.Writer=He();A.BufferWriter=tr();A.Reader=Ge();A.BufferReader=lr();A.util=W();A.rpc=Ct();A.roots=Pt();A.configure=yr;function yr(){A.util._configure(),A.Writer._configure(A.BufferWriter),A.Reader._configure(A.BufferReader)}yr()});var br=d((Wo,gr)=>{"use strict";gr.exports=At;function At(r,t){typeof r=="string"&&(t=r,r=void 0);var e=[];function n(s){if(typeof s!="string"){var o=i();if(At.verbose&&console.log("codegen: "+o),o="return "+o,s){for(var a=Object.keys(s),u=new Array(a.length+1),c=new Array(a.length),l=0;l<a.length;)u[l]=a[l],c[l]=s[a[l++]];return u[l]=o,Function.apply(null,u).apply(null,c)}return Function(o)()}for(var b=new Array(arguments.length-1),x=0;x<b.length;)b[x]=arguments[++x];if(x=0,s=s.replace(/%([%dfijs])/g,function(f,y){var v=b[x++];switch(y){case"d":case"f":return String(Number(v));case"i":return String(Math.floor(v));case"j":return JSON.stringify(v);case"s":return String(v)}return"%"}),x!==b.length)throw Error("parameter count mismatch");return e.push(s),n}function i(s){return"function "+(s||t||"")+"("+(r&&r.join(",")||"")+`){ `+e.join(` `)+` }`}return n.toString=i,n}At.verbose=!1});var wr=d(($o,vr)=>{"use strict";vr.exports=Oe;var zi=mt(),Wi=_t(),qt=Wi("fs");function Oe(r,t,e){return typeof t=="function"?(e=t,t={}):t||(t={}),e?!t.xhr&&qt&&qt.readFile?qt.readFile(r,function(i,s){return i&&typeof XMLHttpRequest<"u"?Oe.xhr(r,t,e):i?e(i):e(null,t.binary?s:s.toString("utf8"))}):Oe.xhr(r,t,e):zi(Oe,this,r,t)}Oe.xhr=function(t,e,n){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(i.readyState===4){if(i.status!==0&&i.status!==200)return n(Error("status "+i.status));if(e.binary){var o=i.response;if(!o){o=[];for(var a=0;a<i.responseText.length;++a)o.push(i.responseText.charCodeAt(a)&255)}return n(null,typeof Uint8Array<"u"?new Uint8Array(o):o)}return n(null,i.responseText)}},e.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",t),i.send()}});var Or=d(xr=>{"use strict";var Nt=xr,Sr=Nt.isAbsolute=function(t){return/^(?:\/|\w+:)/.test(t)},Dt=Nt.normalize=function(t){t=t.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var e=t.split("/"),n=Sr(t),i="";n&&(i=e.shift()+"/");for(var s=0;s<e.length;)e[s]===".."?s>0&&e[s-1]!==".."?e.splice(--s,2):n?e.splice(s,1):++s:e[s]==="."?e.splice(s,1):++s;return i+e.join("/")};Nt.resolve=function(t,e,n){return n||(e=Dt(e)),Sr(e)?e:(n||(t=Dt(t)),(t=t.replace(/(?:\/|^)[^/]+$/,"")).length?Dt(t+"/"+e):e)}});var de=d(Er=>{"use strict";var Ee=Er,$i=C(),Hi=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function Te(r,t){var e=0,n={};for(t|=0;e<r.length;)n[Hi[e+t]]=r[e++];return n}Ee.basic=Te([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);Ee.defaults=Te([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",$i.emptyArray,null]);Ee.long=Te([0,0,0,1,1],7);Ee.mapKey=Te([0,0,0,5,5,0,0,0,1,1,0,2],2);Ee.packed=Te([1,5,0,0,0,5,5,0,0,0,1,1,0])});var oe=d((Go,Rr)=>{"use strict";Rr.exports=I;var Ke=ae();((I.prototype=Object.create(Ke.prototype)).constructor=I).className="Field";var Tr=H(),kr=de(),k=C(),Lt,Vi=/^required|optional|repeated$/;I.fromJSON=function(t,e){return new I(t,e.id,e.type,e.rule,e.extend,e.options,e.comment)};function I(r,t,e,n,i,s,o){if(k.isObject(n)?(o=i,s=n,n=i=void 0):k.isObject(i)&&(o=s,s=i,i=void 0),Ke.call(this,r,s),!k.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!k.isString(e))throw TypeError("type must be a string");if(n!==void 0&&!Vi.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(i!==void 0&&!k.isString(i))throw TypeError("extend must be a string");n==="proto3_optional"&&(n="optional"),this.rule=n&&n!=="optional"?n:void 0,this.type=e,this.id=t,this.extend=i||void 0,this.required=n==="required",this.optional=!this.required,this.repeated=n==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=k.Long?kr.long[e]!==void 0:!1,this.bytes=e==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=o}Object.defineProperty(I.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}});I.prototype.setOption=function(t,e,n){return t==="packed"&&(this._packed=null),Ke.prototype.setOption.call(this,t,e,n)};I.prototype.toJSON=function(t){var e=t?!!t.keepComments:!1;return k.toObject(["rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])};I.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=kr.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Lt?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof Tr&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&((this.options.packed===!0||this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof Tr))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=k.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var t;k.base64.test(this.typeDefault)?k.base64.decode(this.typeDefault,t=k.newBuffer(k.base64.length(this.typeDefault)),0):k.utf8.write(this.typeDefault,t=k.newBuffer(k.utf8.length(this.typeDefault)),0),this.typeDefault=t}return this.map?this.defaultValue=k.emptyObject:this.repeated?this.defaultValue=k.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof Lt&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Ke.prototype.resolve.call(this)};I.d=function(t,e,n,i){return typeof e=="function"?e=k.decorateType(e).name:e&&typeof e=="object"&&(e=k.decorateEnum(e).name),function(o,a){k.decorateType(o.constructor).add(new I(a,t,e,n,{default:i}))}};I._configure=function(t){Lt=t}});var ke=d((Ko,Ar)=>{"use strict";Ar.exports=B;var Xe=ae();((B.prototype=Object.create(Xe.prototype)).constructor=B).className="OneOf";var Cr=oe(),Ze=C();function B(r,t,e,n){if(Array.isArray(t)||(e=t,t=void 0),Xe.call(this,r,e),!(t===void 0||Array.isArray(t)))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}B.fromJSON=function(t,e){return new B(t,e.oneof,e.options,e.comment)};B.prototype.toJSON=function(t){var e=t?!!t.keepComments:!1;return Ze.toObject(["options",this.options,"oneof",this.oneof,"comment",e?this.comment:void 0])};function Pr(r){if(r.parent)for(var t=0;t<r.fieldsArray.length;++t)r.fieldsArray[t].parent||r.parent.add(r.fieldsArray[t])}B.prototype.add=function(t){if(!(t instanceof Cr))throw TypeError("field must be a Field");return t.parent&&t.parent!==this.parent&&t.parent.remove(t),this.oneof.push(t.name),this.fieldsArray.push(t),t.partOf=this,Pr(this),this};B.prototype.remove=function(t){if(!(t instanceof Cr))throw TypeError("field must be a Field");var e=this.fieldsArray.indexOf(t);if(e<0)throw Error(t+" is not a member of "+this);return this.fieldsArray.splice(e,1),e=this.oneof.indexOf(t.name),e>-1&&this.oneof.splice(e,1),t.partOf=null,this};B.prototype.onAdd=function(t){Xe.prototype.onAdd.call(this,t);for(var e=this,n=0;n<this.oneof.length;++n){var i=t.get(this.oneof[n]);i&&!i.partOf&&(i.partOf=e,e.fieldsArray.push(i))}Pr(this)};B.prototype.onRemove=function(t){for(var e=0,n;e<this.fieldsArray.length;++e)(n=this.fieldsArray[e]).parent&&n.parent.remove(n);Xe.prototype.onRemove.call(this,t)};B.d=function(){for(var t=new Array(arguments.length),e=0;e<arguments.length;)t[e]=arguments[e++];return function(i,s){Ze.decorateType(i.constructor).add(new B(s,t)),Object.defineProperty(i,s,{get:Ze.oneOfGetter(t),set:Ze.oneOfSetter(t)})}}});var me=d((Zo,Lr)=>{"use strict";Lr.exports=g;var It=ae();((g.prototype=Object.create(It.prototype)).constructor=g).className="Namespace";var qr=oe(),Qe=C(),Gi=ke(),pe,Re,ye;g.fromJSON=function(t,e){return new g(t,e.options).addJSON(e.nested)};function Dr(r,t){if(r&&r.length){for(var e={},n=0;n<r.length;++n)e[r[n].name]=r[n].toJSON(t);return e}}g.arrayToJSON=Dr;g.isReservedId=function(t,e){if(t){for(var n=0;n<t.length;++n)if(typeof t[n]!="string"&&t[n][0]<=e&&t[n][1]>e)return!0}return!1};g.isReservedName=function(t,e){if(t){for(var n=0;n<t.length;++n)if(t[n]===e)return!0}return!1};function g(r,t){It.call(this,r,t),this.nested=void 0,this._nestedArray=null}function Nr(r){return r._nestedArray=null,r}Object.defineProperty(g.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=Qe.toArray(this.nested))}});g.prototype.toJSON=function(t){return Qe.toObject(["options",this.options,"nested",Dr(this.nestedArray,t)])};g.prototype.addJSON=function(t){var e=this;if(t)for(var n=Object.keys(t),i=0,s;i<n.length;++i)s=t[n[i]],e.add((s.fields!==void 0?pe.fromJSON:s.values!==void 0?ye.fromJSON:s.methods!==void 0?Re.fromJSON:s.id!==void 0?qr.fromJSON:g.fromJSON)(n[i],s));return this};g.prototype.get=function(t){return this.nested&&this.nested[t]||null};g.prototype.getEnum=function(t){if(this.nested&&this.nested[t]instanceof ye)return this.nested[t].values;throw Error("no such enum: "+t)};g.prototype.add=function(t){if(!(t instanceof qr&&t.extend!==void 0||t instanceof pe||t instanceof Gi||t instanceof ye||t instanceof Re||t instanceof g))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var e=this.get(t.name);if(e)if(e instanceof g&&t instanceof g&&!(e instanceof pe||e instanceof Re)){for(var n=e.nestedArray,i=0;i<n.length;++i)t.add(n[i]);this.remove(e),this.nested||(this.nested={}),t.setOptions(e.options,!0)}else throw Error("duplicate name '"+t.name+"' in "+this)}return this.nested[t.name]=t,t.onAdd(this),Nr(this)};g.prototype.remove=function(t){if(!(t instanceof It))throw TypeError("object must be a ReflectionObject");if(t.parent!==this)throw Error(t+" is not a member of "+this);return delete this.nested[t.name],Object.keys(this.nested).length||(this.nested=void 0),t.onRemove(this),Nr(this)};g.prototype.define=function(t,e){if(Qe.isString(t))t=t.split(".");else if(!Array.isArray(t))throw TypeError("illegal path");if(t&&t.length&&t[0]==="")throw Error("path must be relative");for(var n=this;t.length>0;){var i=t.shift();if(n.nested&&n.nested[i]){if(n=n.nested[i],!(n instanceof g))throw Error("path conflicts with non-namespace objects")}else n.add(n=new g(i))}return e&&n.addJSON(e),n};g.prototype.resolveAll=function(){for(var t=this.nestedArray,e=0;e<t.length;)t[e]instanceof g?t[e++].resolveAll():t[e++].resolve();return this.resolve()};g.prototype.lookup=function(t,e,n){if(typeof e=="boolean"?(n=e,e=void 0):e&&!Array.isArray(e)&&(e=[e]),Qe.isString(t)&&t.length){if(t===".")return this.root;t=t.split(".")}else if(!t.length)return this;if(t[0]==="")return this.root.lookup(t.slice(1),e);var i=this.get(t[0]);if(i){if(t.length===1){if(!e||e.indexOf(i.constructor)>-1)return i}else if(i instanceof g&&(i=i.lookup(t.slice(1),e,!0)))return i}else for(var s=0;s<this.nestedArray.length;++s)if(this._nestedArray[s]instanceof g&&(i=this._nestedArray[s].lookup(t,e,!0)))return i;return this.parent===null||n?null:this.parent.lookup(t,e)};g.prototype.lookupType=function(t){var e=this.lookup(t,[pe]);if(!e)throw Error("no such type: "+t);return e};g.prototype.lookupEnum=function(t){var e=this.lookup(t,[ye]);if(!e)throw Error("no such Enum '"+t+"' in "+this);return e};g.prototype.lookupTypeOrEnum=function(t){var e=this.lookup(t,[pe,ye]);if(!e)throw Error("no such Type or Enum '"+t+"' in "+this);return e};g.prototype.lookupService=function(t){var e=this.lookup(t,[Re]);if(!e)throw Error("no such Service '"+t+"' in "+this);return e};g._configure=function(r,t,e){pe=r,Re=t,ye=e}});var jt=d((Xo,Ir)=>{"use strict";Ir.exports=Z;var Bt=oe();((Z.prototype=Object.create(Bt.prototype)).constructor=Z).className="MapField";var Ki=de(),Ce=C();function Z(r,t,e,n,i,s){if(Bt.call(this,r,t,n,void 0,void 0,i,s),!Ce.isString(e))throw TypeError("keyType must be a string");this.keyType=e,this.resolvedKeyType=null,this.map=!0}Z.fromJSON=function(t,e){return new Z(t,e.id,e.keyType,e.type,e.options,e.comment)};Z.prototype.toJSON=function(t){var e=t?!!t.keepComments:!1;return Ce.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])};Z.prototype.resolve=function(){if(this.resolved)return this;if(Ki.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return Bt.prototype.resolve.call(this)};Z.d=function(t,e,n){return typeof n=="function"?n=Ce.decorateType(n).name:n&&typeof n=="object"&&(n=Ce.decorateEnum(n).name),function(s,o){Ce.decorateType(s.constructor).add(new Z(o,t,e,n))}}});var Jt=d((Qo,Br)=>{"use strict";Br.exports=ue;var Ft=ae();((ue.prototype=Object.create(Ft.prototype)).constructor=ue).className="Method";var _e=C();function ue(r,t,e,n,i,s,o,a,u){if(_e.isObject(i)?(o=i,i=s=void 0):_e.isObject(s)&&(o=s,s=void 0),!(t===void 0||_e.isString(t)))throw TypeError("type must be a string");if(!_e.isString(e))throw TypeError("requestType must be a string");if(!_e.isString(n))throw TypeError("responseType must be a string");Ft.call(this,r,o),this.type=t||"rpc",this.requestType=e,this.requestStream=i?!0:void 0,this.responseType=n,this.responseStream=s?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=a,this.parsedOptions=u}ue.fromJSON=function(t,e){return new ue(t,e.type,e.requestType,e.responseType,e.requestStream,e.responseStream,e.options,e.comment,e.parsedOptions)};ue.prototype.toJSON=function(t){var e=t?!!t.keepComments:!1;return _e.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",e?this.comment:void 0,"parsedOptions",this.parsedOptions])};ue.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),Ft.prototype.resolve.call(this))}});var Ut=d((Yo,Fr)=>{"use strict";Fr.exports=j;var ee=me();((j.prototype=Object.create(ee.prototype)).constructor=j).className="Service";var Mt=Jt(),Pe=C(),Zi=Ct();function j(r,t){ee.call(this,r,t),this.methods={},this._methodsArray=null}j.fromJSON=function(t,e){var n=new j(t,e.options);if(e.methods)for(var i=Object.keys(e.methods),s=0;s<i.length;++s)n.add(Mt.fromJSON(i[s],e.methods[i[s]]));return e.nested&&n.addJSON(e.nested),n.comment=e.comment,n};j.prototype.toJSON=function(t){var e=ee.prototype.toJSON.call(this,t),n=t?!!t.keepComments:!1;return Pe.toObject(["options",e&&e.options||void 0,"methods",ee.arrayToJSON(this.methodsArray,t)||{},"nested",e&&e.nested||void 0,"comment",n?this.comment:void 0])};Object.defineProperty(j.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=Pe.toArray(this.methods))}});function jr(r){return r._methodsArray=null,r}j.prototype.get=function(t){return this.methods[t]||ee.prototype.get.call(this,t)};j.prototype.resolveAll=function(){for(var t=this.methodsArray,e=0;e<t.length;++e)t[e].resolve();return ee.prototype.resolve.call(this)};j.prototype.add=function(t){if(this.get(t.name))throw Error("duplicate name '"+t.name+"' in "+this);return t instanceof Mt?(this.methods[t.name]=t,t.parent=this,jr(this)):ee.prototype.add.call(this,t)};j.prototype.remove=function(t){if(t instanceof Mt){if(this.methods[t.name]!==t)throw Error(t+" is not a member of "+this);return delete this.methods[t.name],t.parent=null,jr(this)}return ee.prototype.remove.call(this,t)};j.prototype.create=function(t,e,n){for(var i=new Zi.Service(t,e,n),s=0,o;s<this.methodsArray.length;++s){var a=Pe.lcFirst((o=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");i[a]=Pe.codegen(["r","c"],Pe.isReserved(a)?a+"_":a)("return this.rpcCall(m,q,s,r,c)")({m:o,q:o.resolvedRequestType.ctor,s:o.resolvedResponseType.ctor})}return i}});var Ye=d((ea,Jr)=>{"use strict";Jr.exports=V;var Xi=W();function V(r){if(r)for(var t=Object.keys(r),e=0;e<t.length;++e)this[t[e]]=r[t[e]]}V.create=function(t){return this.$type.create(t)};V.encode=function(t,e){return this.$type.encode(t,e)};V.encodeDelimited=function(t,e){return this.$type.encodeDelimited(t,e)};V.decode=function(t){return this.$type.decode(t)};V.decodeDelimited=function(t){return this.$type.decodeDelimited(t)};V.verify=function(t){return this.$type.verify(t)};V.fromObject=function(t){return this.$type.fromObject(t)};V.toObject=function(t,e){return this.$type.toObject(t,e)};V.prototype.toJSON=function(){return this.$type.toObject(this,Xi.toJSONOptions)}});var zt=d((ta,Ur)=>{"use strict";Ur.exports=es;var Qi=H(),X=de(),Mr=C();function Yi(r){return"missing required '"+r.name+"'"}function es(r){var t=Mr.codegen(["r","l"],r.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(r.fieldsArray.filter(function(a){return a.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");r.group&&t("if((t&7)===4)")("break"),t("switch(t>>>3){");for(var e=0;e<r.fieldsArray.length;++e){var n=r._fieldsArray[e].resolve(),i=n.resolvedType instanceof Qi?"int32":n.type,s="m"+Mr.safeProp(n.name);t("case %i: {",n.id),n.map?(t("if(%s===util.emptyObject)",s)("%s={}",s)("var c2 = r.uint32()+r.pos"),X.defaults[n.keyType]!==void 0?t("k=%j",X.defaults[n.keyType]):t("k=null"),X.defaults[i]!==void 0?t("value=%j",X.defaults[i]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",n.keyType)("case 2:"),X.basic[i]===void 0?t("value=types[%i].decode(r,r.uint32())",e):t("value=r.%s()",i),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),X.long[n.keyType]!==void 0?t('%s[typeof k==="object"?util.longToHash(k):k]=value',s):t("%s[k]=value",s)):n.repeated?(t("if(!(%s&&%s.length))",s,s)("%s=[]",s),X.packed[i]!==void 0&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",s,i)("}else"),X.basic[i]===void 0?t(n.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",s,e):t("%s.push(r.%s())",s,i)):X.basic[i]===void 0?t(n.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",s,e):t("%s=r.%s()",s,i),t("break")("}")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),e=0;e<r._fieldsArray.length;++e){var o=r._fieldsArray[e];o.required&&t("if(!m.hasOwnProperty(%j))",o.name)("throw util.ProtocolError(%j,{instance:m})",Yi(o))}return t("return m")}});var Ht=d((na,zr)=>{"use strict";zr.exports=rs;var ts=H(),Wt=C();function F(r,t){return r.name+": "+t+(r.repeated&&t!=="array"?"[]":r.map&&t!=="object"?"{k:"+r.keyType+"}":"")+" expected"}function $t(r,t,e,n){if(t.resolvedType)if(t.resolvedType instanceof ts){r("switch(%s){",n)("default:")("return%j",F(t,"enum value"));for(var i=Object.keys(t.resolvedType.values),s=0;s<i.length;++s)r("case %i:",t.resolvedType.values[i[s]]);r("break")("}")}else r("{")("var e=types[%i].verify(%s);",e,n)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":r("if(!util.isInteger(%s))",n)("return%j",F(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":r("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",F(t,"integer|Long"));break;case"float":case"double":r('if(typeof %s!=="number")',n)("return%j",F(t,"number"));break;case"bool":r('if(typeof %s!=="boolean")',n)("return%j",F(t,"boolean"));break;case"string":r("if(!util.isString(%s))",n)("return%j",F(t,"string"));break;case"bytes":r('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",F(t,"buffer"));break}return r}function ns(r,t,e){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":r("if(!util.key32Re.test(%s))",e)("return%j",F(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":r("if(!util.key64Re.test(%s))",e)("return%j",F(t,"integer|Long key"));break;case"bool":r("if(!util.key2Re.test(%s))",e)("return%j",F(t,"boolean key"));break}return r}function rs(r){var t=Wt.codegen(["m"],r.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),e=r.oneofsArray,n={};e.length&&t("var p={}");for(var i=0;i<r.fieldsArray.length;++i){var s=r._fieldsArray[i].resolve(),o="m"+Wt.safeProp(s.name);if(s.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",o,s.name),s.map)t("if(!util.isObject(%s))",o)("return%j",F(s,"object"))("var k=Object.keys(%s)",o)("for(var i=0;i<k.length;++i){"),ns(t,s,"k[i]"),$t(t,s,i,o+"[k[i]]")("}");else if(s.repeated)t("if(!Array.isArray(%s))",o)("return%j",F(s,"array"))("for(var i=0;i<%s.length;++i){",o),$t(t,s,i,o+"[i]")("}");else{if(s.partOf){var a=Wt.safeProp(s.partOf.name);n[s.partOf.name]===1&&t("if(p%s===1)",a)("return%j",s.partOf.name+": multiple values"),n[s.partOf.name]=1,t("p%s=1",a)}$t(t,s,i,o)}s.optional&&t("}")}return t("return null")}});var Kt=d($r=>{"use strict";var Wr=$r,Ae=H(),G=C();function Vt(r,t,e,n){var i=!1;if(t.resolvedType)if(t.resolvedType instanceof Ae){r("switch(d%s){",n);for(var s=t.resolvedType.values,o=Object.keys(s),a=0;a<o.length;++a)s[o[a]]===t.typeDefault&&!i&&(r("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),t.repeated||r("break"),i=!0),r("case%j:",o[a])("case %i:",s[o[a]])("m%s=%j",n,s[o[a]])("