ipfs-grpc-client
Version:
A client library for the IPFS gRPC API
5 lines • 182 kB
JavaScript
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.IpfsGrpcClient = factory()}(typeof self !== 'undefined' ? self : this, function () {
"use strict";var IpfsGrpcClient=(()=>{var Rc=Object.create;var hr=Object.defineProperty;var Cc=Object.getOwnPropertyDescriptor;var Dc=Object.getOwnPropertyNames;var qc=Object.getPrototypeOf,zc=Object.prototype.hasOwnProperty;var b=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Z=(r,e)=>{for(var t in e)hr(r,t,{get:e[t],enumerable:!0})},_o=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Dc(e))!zc.call(r,i)&&i!==t&&hr(r,i,{get:()=>e[i],enumerable:!(n=Cc(e,i))||n.enumerable});return r};var H=(r,e,t)=>(t=r!=null?Rc(qc(r)):{},_o(e||!r||!r.__esModule?hr(t,"default",{value:r,enumerable:!0}):t,r)),Lc=r=>_o(hr({},"__esModule",{value:!0}),r);var Ko=b((md,Go)=>{Go.exports=Nn;var Xo=128,Zf=127,Qf=~Zf,Yf=Math.pow(2,31);function Nn(r,e,t){if(Number.MAX_SAFE_INTEGER&&r>Number.MAX_SAFE_INTEGER)throw Nn.bytes=0,new RangeError("Could not encode varint");e=e||[],t=t||0;for(var n=t;r>=Yf;)e[t++]=r&255|Xo,r/=128;for(;r&Qf;)e[t++]=r&255|Xo,r>>>=7;return e[t]=r|0,Nn.bytes=t-n+1,e}});var Yo=b((gd,Qo)=>{Qo.exports=Rn;var el=128,Zo=127;function Rn(r,n){var t=0,n=n||0,i=0,o=n,s,a=r.length;do{if(o>=a||i>49)throw Rn.bytes=0,new RangeError("Could not decode varint");s=r[o++],t+=i<28?(s&Zo)<<i:(s&Zo)*Math.pow(2,i),i+=7}while(s>=el);return Rn.bytes=o-n,t}});var ts=b((bd,es)=>{var tl=Math.pow(2,7),rl=Math.pow(2,14),nl=Math.pow(2,21),il=Math.pow(2,28),ol=Math.pow(2,35),sl=Math.pow(2,42),al=Math.pow(2,49),ul=Math.pow(2,56),cl=Math.pow(2,63);es.exports=function(r){return r<tl?1:r<rl?2:r<nl?3:r<il?4:r<ol?5:r<sl?6:r<al?7:r<ul?8:r<cl?9:10}});var Ze=b((wd,rs)=>{rs.exports={encode:Ko(),decode:Yo(),encodingLength:ts()}});var dt=b((Fd,ps)=>{"use strict";function hs(r,e){for(let t in e)Object.defineProperty(r,t,{value:e[t],enumerable:!0,configurable:!0});return r}function _l(r,e,t){if(!r||typeof r=="string")throw new TypeError("Please pass an Error to err-code");t||(t={}),typeof e=="object"&&(t=e,e=""),e&&(t.code=e);try{return hs(r,t)}catch{t.message=r.message,t.stack=r.stack;let i=function(){};return i.prototype=Object.create(Object.getPrototypeOf(r)),hs(new i,t)}}ps.exports=_l});var Ir=b((lm,qs)=>{"use strict";qs.exports=th;function th(r,e){for(var t=new Array(arguments.length-1),n=0,i=2,o=!0;i<arguments.length;)t[n++]=arguments[i++];return new Promise(function(a,u){t[n]=function(f){if(o)if(o=!1,f)u(f);else{for(var p=new Array(arguments.length-1),y=0;y<p.length;)p[y++]=arguments[y];a.apply(null,p)}};try{r.apply(e||null,t)}catch(c){o&&(o=!1,u(c))}})}});var ei=b(Fs=>{"use strict";var Pr=Fs;Pr.length=function(e){var t=e.length;if(!t)return 0;for(var n=0;--t%4>1&&e.charAt(t)==="=";)++n;return Math.ceil(e.length*3)/4-n};var gt=new Array(64),Ls=new Array(123);for(le=0;le<64;)Ls[gt[le]=le<26?le+65:le<52?le+71:le<62?le-4:le-59|43]=le++;var le;Pr.encode=function(e,t,n){for(var i=null,o=[],s=0,a=0,u;t<n;){var c=e[t++];switch(a){case 0:o[s++]=gt[c>>2],u=(c&3)<<4,a=1;break;case 1:o[s++]=gt[u|c>>4],u=(c&15)<<2,a=2;break;case 2:o[s++]=gt[u|c>>6],o[s++]=gt[c&63],a=0;break}s>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,o)),s=0)}return a&&(o[s++]=gt[u],o[s++]=61,a===1&&(o[s++]=61)),i?(s&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))};var zs="invalid encoding";Pr.decode=function(e,t,n){for(var i=n,o=0,s,a=0;a<e.length;){var u=e.charCodeAt(a++);if(u===61&&o>1)break;if((u=Ls[u])===void 0)throw Error(zs);switch(o){case 0:s=u,o=1;break;case 1:t[n++]=s<<2|(u&48)>>4,s=u,o=2;break;case 2:t[n++]=(s&15)<<4|(u&60)>>2,s=u,o=3;break;case 3:t[n++]=(s&3)<<6|u,o=0;break}}if(o===1)throw Error(zs);return n-i};Pr.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var ti=b((pm,Ms)=>{"use strict";Ms.exports=Nr;function Nr(){this._listeners={}}Nr.prototype.on=function(e,t,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:n||this}),this};Nr.prototype.off=function(e,t){if(e===void 0)this._listeners={};else if(t===void 0)this._listeners[e]=[];else for(var n=this._listeners[e],i=0;i<n.length;)n[i].fn===t?n.splice(i,1):++i;return this};Nr.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,n)}return this}});var ri=b((dm,Js)=>{"use strict";Js.exports=js(js);function js(r){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),t=new Uint8Array(e.buffer),n=t[3]===128;function i(u,c,f){e[0]=u,c[f]=t[0],c[f+1]=t[1],c[f+2]=t[2],c[f+3]=t[3]}function o(u,c,f){e[0]=u,c[f]=t[3],c[f+1]=t[2],c[f+2]=t[1],c[f+3]=t[0]}r.writeFloatLE=n?i:o,r.writeFloatBE=n?o:i;function s(u,c){return t[0]=u[c],t[1]=u[c+1],t[2]=u[c+2],t[3]=u[c+3],e[0]}function a(u,c){return t[3]=u[c],t[2]=u[c+1],t[1]=u[c+2],t[0]=u[c+3],e[0]}r.readFloatLE=n?s:a,r.readFloatBE=n?a:s}():function(){function e(n,i,o,s){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,o,s);else if(isNaN(i))n(2143289344,o,s);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,o,s);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,o,s);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,o,s)}}r.writeFloatLE=e.bind(null,Us),r.writeFloatBE=e.bind(null,$s);function t(n,i,o){var s=n(i,o),a=(s>>31)*2+1,u=s>>>23&255,c=s&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=t.bind(null,Hs),r.readFloatBE=t.bind(null,Vs)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),t=new Uint8Array(e.buffer),n=t[7]===128;function i(u,c,f){e[0]=u,c[f]=t[0],c[f+1]=t[1],c[f+2]=t[2],c[f+3]=t[3],c[f+4]=t[4],c[f+5]=t[5],c[f+6]=t[6],c[f+7]=t[7]}function o(u,c,f){e[0]=u,c[f]=t[7],c[f+1]=t[6],c[f+2]=t[5],c[f+3]=t[4],c[f+4]=t[3],c[f+5]=t[2],c[f+6]=t[1],c[f+7]=t[0]}r.writeDoubleLE=n?i:o,r.writeDoubleBE=n?o:i;function s(u,c){return t[0]=u[c],t[1]=u[c+1],t[2]=u[c+2],t[3]=u[c+3],t[4]=u[c+4],t[5]=u[c+5],t[6]=u[c+6],t[7]=u[c+7],e[0]}function a(u,c){return t[7]=u[c],t[6]=u[c+1],t[5]=u[c+2],t[4]=u[c+3],t[3]=u[c+4],t[2]=u[c+5],t[1]=u[c+6],t[0]=u[c+7],e[0]}r.readDoubleLE=n?s:a,r.readDoubleBE=n?a:s}():function(){function e(n,i,o,s,a,u){var c=s<0?1:0;if(c&&(s=-s),s===0)n(0,a,u+i),n(1/s>0?0:2147483648,a,u+o);else if(isNaN(s))n(0,a,u+i),n(2146959360,a,u+o);else if(s>17976931348623157e292)n(0,a,u+i),n((c<<31|2146435072)>>>0,a,u+o);else{var f;if(s<22250738585072014e-324)f=s/5e-324,n(f>>>0,a,u+i),n((c<<31|f/4294967296)>>>0,a,u+o);else{var p=Math.floor(Math.log(s)/Math.LN2);p===1024&&(p=1023),f=s*Math.pow(2,-p),n(f*4503599627370496>>>0,a,u+i),n((c<<31|p+1023<<20|f*1048576&1048575)>>>0,a,u+o)}}}r.writeDoubleLE=e.bind(null,Us,0,4),r.writeDoubleBE=e.bind(null,$s,4,0);function t(n,i,o,s,a){var u=n(s,a+i),c=n(s,a+o),f=(c>>31)*2+1,p=c>>>20&2047,y=4294967296*(c&1048575)+u;return p===2047?y?NaN:f*(1/0):p===0?f*5e-324*y:f*Math.pow(2,p-1075)*(y+4503599627370496)}r.readDoubleLE=t.bind(null,Hs,0,4),r.readDoubleBE=t.bind(null,Vs,4,0)}(),r}function Us(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}function $s(r,e,t){e[t]=r>>>24,e[t+1]=r>>>16&255,e[t+2]=r>>>8&255,e[t+3]=r&255}function Hs(r,e){return(r[e]|r[e+1]<<8|r[e+2]<<16|r[e+3]<<24)>>>0}function Vs(r,e){return(r[e]<<24|r[e+1]<<16|r[e+2]<<8|r[e+3])>>>0}});var Rr=b((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 ii=b(Ws=>{"use strict";var ni=Ws;ni.length=function(e){for(var t=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?t+=1:n<2048?t+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,t+=4):t+=3;return t};ni.read=function(e,t,n){var i=n-t;if(i<1)return"";for(var o=null,s=[],a=0,u;t<n;)u=e[t++],u<128?s[a++]=u:u>191&&u<224?s[a++]=(u&31)<<6|e[t++]&63:u>239&&u<365?(u=((u&7)<<18|(e[t++]&63)<<12|(e[t++]&63)<<6|e[t++]&63)-65536,s[a++]=55296+(u>>10),s[a++]=56320+(u&1023)):s[a++]=(u&15)<<12|(e[t++]&63)<<6|e[t++]&63,a>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,s)),a=0);return o?(a&&o.push(String.fromCharCode.apply(String,s.slice(0,a))),o.join("")):String.fromCharCode.apply(String,s.slice(0,a))};ni.write=function(e,t,n){for(var i=n,o,s,a=0;a<e.length;++a)o=e.charCodeAt(a),o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=o&63|128):(o&64512)===55296&&((s=e.charCodeAt(a+1))&64512)===56320?(o=65536+((o&1023)<<10)+(s&1023),++a,t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=o&63|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=o&63|128);return n-i}});var oi=b((mm,Xs)=>{"use strict";Xs.exports=rh;function rh(r,e,t){var n=t||8192,i=n>>>1,o=null,s=n;return function(u){if(u<1||u>i)return r(u);s+u>n&&(o=r(n),s=0);var c=e.call(o,s,s+=u);return s&7&&(s=(s|7)+1),c}}});var Ks=b((gm,Gs)=>{"use strict";Gs.exports=U;var Mt=we();function U(r,e){this.lo=r>>>0,this.hi=e>>>0}var Ye=U.zero=new U(0,0);Ye.toNumber=function(){return 0};Ye.zzEncode=Ye.zzDecode=function(){return this};Ye.length=function(){return 1};var nh=U.zeroHash="\0\0\0\0\0\0\0\0";U.fromNumber=function(e){if(e===0)return Ye;var t=e<0;t&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return t&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new U(n,i)};U.from=function(e){if(typeof e=="number")return U.fromNumber(e);if(Mt.isString(e))if(Mt.Long)e=Mt.Long.fromString(e);else return U.fromNumber(parseInt(e,10));return e.low||e.high?new U(e.low>>>0,e.high>>>0):Ye};U.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=~this.lo+1>>>0,n=~this.hi>>>0;return t||(n=n+1>>>0),-(t+n*4294967296)}return this.lo+this.hi*4294967296};U.prototype.toLong=function(e){return Mt.Long?new Mt.Long(this.lo|0,this.hi|0,Boolean(e)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(e)}};var Ue=String.prototype.charCodeAt;U.fromHash=function(e){return e===nh?Ye:new U((Ue.call(e,0)|Ue.call(e,1)<<8|Ue.call(e,2)<<16|Ue.call(e,3)<<24)>>>0,(Ue.call(e,4)|Ue.call(e,5)<<8|Ue.call(e,6)<<16|Ue.call(e,7)<<24)>>>0)};U.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)};U.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};U.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};U.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?t===0?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:n<128?9:10}});var we=b(si=>{"use strict";var w=si;w.asPromise=Ir();w.base64=ei();w.EventEmitter=ti();w.float=ri();w.inquire=Rr();w.utf8=ii();w.pool=oi();w.LongBits=Ks();w.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);w.global=w.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||si;w.emptyArray=Object.freeze?Object.freeze([]):[];w.emptyObject=Object.freeze?Object.freeze({}):{};w.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};w.isString=function(e){return typeof e=="string"||e instanceof String};w.isObject=function(e){return e&&typeof e=="object"};w.isset=w.isSet=function(e,t){var n=e[t];return n!=null&&e.hasOwnProperty(t)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};w.Buffer=function(){try{var r=w.inquire("buffer").Buffer;return r.prototype.utf8Write?r:null}catch{return null}}();w._Buffer_from=null;w._Buffer_allocUnsafe=null;w.newBuffer=function(e){return typeof e=="number"?w.Buffer?w._Buffer_allocUnsafe(e):new w.Array(e):w.Buffer?w._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};w.Array=typeof Uint8Array<"u"?Uint8Array:Array;w.Long=w.global.dcodeIO&&w.global.dcodeIO.Long||w.global.Long||w.inquire("long");w.key2Re=/^true|false|0|1$/;w.key32Re=/^-?(?:0|[1-9][0-9]*)$/;w.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;w.longToHash=function(e){return e?w.LongBits.from(e).toHash():w.LongBits.zeroHash};w.longFromHash=function(e,t){var n=w.LongBits.fromHash(e);return w.Long?w.Long.fromBits(n.lo,n.hi,t):n.toNumber(Boolean(t))};function Zs(r,e,t){for(var n=Object.keys(e),i=0;i<n.length;++i)(r[n[i]]===void 0||!t)&&(r[n[i]]=e[n[i]]);return r}w.merge=Zs;w.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function Qs(r){function e(t,n){if(!(this instanceof e))return new e(t,n);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Zs(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,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}}),e}w.newError=Qs;w.ProtocolError=Qs("ProtocolError");w.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var i=Object.keys(this),o=i.length-1;o>-1;--o)if(t[i[o]]===1&&this[i[o]]!==void 0&&this[i[o]]!==null)return i[o]}};w.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}};w.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};w._configure=function(){var r=w.Buffer;if(!r){w._Buffer_from=w._Buffer_allocUnsafe=null;return}w._Buffer_from=r.from!==Uint8Array.from&&r.from||function(t,n){return new r(t,n)},w._Buffer_allocUnsafe=r.allocUnsafe||function(t){return new r(t)}}});var Dr=b((wm,ra)=>{"use strict";ra.exports=A;var ie=we(),ai,Cr=ie.LongBits,Ys=ie.base64,ea=ie.utf8;function jt(r,e,t){this.fn=r,this.len=e,this.next=void 0,this.val=t}function ci(){}function ih(r){this.head=r.head,this.tail=r.tail,this.len=r.len,this.next=r.states}function A(){this.len=0,this.head=new jt(ci,0,0),this.tail=this.head,this.states=null}var ta=function(){return ie.Buffer?function(){return(A.create=function(){return new ai})()}:function(){return new A}};A.create=ta();A.alloc=function(e){return new ie.Array(e)};ie.Array!==Array&&(A.alloc=ie.pool(A.alloc,ie.Array.prototype.subarray));A.prototype._push=function(e,t,n){return this.tail=this.tail.next=new jt(e,t,n),this.len+=t,this};function fi(r,e,t){e[t]=r&255}function oh(r,e,t){for(;r>127;)e[t++]=r&127|128,r>>>=7;e[t]=r}function li(r,e){this.len=r,this.next=void 0,this.val=e}li.prototype=Object.create(jt.prototype);li.prototype.fn=oh;A.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new li((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};A.prototype.int32=function(e){return e<0?this._push(hi,10,Cr.fromNumber(e)):this.uint32(e)};A.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function hi(r,e,t){for(;r.hi;)e[t++]=r.lo&127|128,r.lo=(r.lo>>>7|r.hi<<25)>>>0,r.hi>>>=7;for(;r.lo>127;)e[t++]=r.lo&127|128,r.lo=r.lo>>>7;e[t++]=r.lo}A.prototype.uint64=function(e){var t=Cr.from(e);return this._push(hi,t.length(),t)};A.prototype.int64=A.prototype.uint64;A.prototype.sint64=function(e){var t=Cr.from(e).zzEncode();return this._push(hi,t.length(),t)};A.prototype.bool=function(e){return this._push(fi,1,e?1:0)};function ui(r,e,t){e[t]=r&255,e[t+1]=r>>>8&255,e[t+2]=r>>>16&255,e[t+3]=r>>>24}A.prototype.fixed32=function(e){return this._push(ui,4,e>>>0)};A.prototype.sfixed32=A.prototype.fixed32;A.prototype.fixed64=function(e){var t=Cr.from(e);return this._push(ui,4,t.lo)._push(ui,4,t.hi)};A.prototype.sfixed64=A.prototype.fixed64;A.prototype.float=function(e){return this._push(ie.float.writeFloatLE,4,e)};A.prototype.double=function(e){return this._push(ie.float.writeDoubleLE,8,e)};var sh=ie.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var i=0;i<e.length;++i)t[n+i]=e[i]};A.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(fi,1,0);if(ie.isString(e)){var n=A.alloc(t=Ys.length(e));Ys.decode(e,n,0),e=n}return this.uint32(t)._push(sh,t,e)};A.prototype.string=function(e){var t=ea.length(e);return t?this.uint32(t)._push(ea.write,t,e):this._push(fi,1,0)};A.prototype.fork=function(){return this.states=new ih(this),this.head=this.tail=new jt(ci,0,0),this.len=0,this};A.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 jt(ci,0,0),this.len=0),this};A.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this};A.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t};A._configure=function(r){ai=r,A.create=ta(),ai._configure()}});var oa=b((vm,ia)=>{"use strict";ia.exports=ve;var na=Dr();(ve.prototype=Object.create(na.prototype)).constructor=ve;var $e=we();function ve(){na.call(this)}ve._configure=function(){ve.alloc=$e._Buffer_allocUnsafe,ve.writeBytesBuffer=$e.Buffer&&$e.Buffer.prototype instanceof Uint8Array&&$e.Buffer.prototype.set.name==="set"?function(e,t,n){t.set(e,n)}:function(e,t,n){if(e.copy)e.copy(t,n,0,e.length);else for(var i=0;i<e.length;)t[n++]=e[i++]}};ve.prototype.bytes=function(e){$e.isString(e)&&(e=$e._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(ve.writeBytesBuffer,t,e),this};function ah(r,e,t){r.length<40?$e.utf8.write(r,e,t):e.utf8Write?e.utf8Write(r,t):e.write(r,t)}ve.prototype.string=function(e){var t=$e.Buffer.byteLength(e);return this.uint32(t),t&&this._push(ah,t,e),this};ve._configure()});var zr=b((xm,fa)=>{"use strict";fa.exports=q;var xe=we(),di,ua=xe.LongBits,uh=xe.utf8;function he(r,e){return RangeError("index out of range: "+r.pos+" + "+(e||1)+" > "+r.len)}function q(r){this.buf=r,this.pos=0,this.len=r.length}var sa=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new q(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new q(e);throw Error("illegal buffer")},ca=function(){return xe.Buffer?function(t){return(q.create=function(i){return xe.Buffer.isBuffer(i)?new di(i):sa(i)})(t)}:sa};q.create=ca();q.prototype._slice=xe.Array.prototype.subarray||xe.Array.prototype.slice;q.prototype.uint32=function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,he(this,10);return e}}();q.prototype.int32=function(){return this.uint32()|0};q.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function pi(){var r=new ua(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*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;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw he(this);if(r.lo=(r.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return r}return r.lo=(r.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,r}if(this.len-this.pos>4){for(;e<5;++e)if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}else for(;e<5;++e){if(this.pos>=this.len)throw he(this);if(r.hi=(r.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return r}throw Error("invalid varint encoding")}q.prototype.bool=function(){return this.uint32()!==0};function qr(r,e){return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0}q.prototype.fixed32=function(){if(this.pos+4>this.len)throw he(this,4);return qr(this.buf,this.pos+=4)};q.prototype.sfixed32=function(){if(this.pos+4>this.len)throw he(this,4);return qr(this.buf,this.pos+=4)|0};function aa(){if(this.pos+8>this.len)throw he(this,8);return new ua(qr(this.buf,this.pos+=4),qr(this.buf,this.pos+=4))}q.prototype.float=function(){if(this.pos+4>this.len)throw he(this,4);var e=xe.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};q.prototype.double=function(){if(this.pos+8>this.len)throw he(this,4);var e=xe.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};q.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw he(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)};q.prototype.string=function(){var e=this.bytes();return uh.read(e,0,e.length)};q.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw he(this,e);this.pos+=e}else do if(this.pos>=this.len)throw he(this);while(this.buf[this.pos++]&128);return this};q.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};q._configure=function(r){di=r,q.create=ca(),di._configure();var e=xe.Long?"toLong":"toNumber";xe.merge(q.prototype,{int64:function(){return pi.call(this)[e](!1)},uint64:function(){return pi.call(this)[e](!0)},sint64:function(){return pi.call(this).zzDecode()[e](!1)},fixed64:function(){return aa.call(this)[e](!0)},sfixed64:function(){return aa.call(this)[e](!1)}})}});var da=b((Sm,pa)=>{"use strict";pa.exports=et;var ha=zr();(et.prototype=Object.create(ha.prototype)).constructor=et;var la=we();function et(r){ha.call(this,r)}et._configure=function(){la.Buffer&&(et.prototype._slice=la.Buffer.prototype.slice)};et.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};et._configure()});var ma=b((Em,ya)=>{"use strict";ya.exports=Ut;var yi=we();(Ut.prototype=Object.create(yi.EventEmitter.prototype)).constructor=Ut;function Ut(r,e,t){if(typeof r!="function")throw TypeError("rpcImpl must be a function");yi.EventEmitter.call(this),this.rpcImpl=r,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(t)}Ut.prototype.rpcCall=function r(e,t,n,i,o){if(!i)throw TypeError("request must be specified");var s=this;if(!o)return yi.asPromise(r,s,e,t,n,i);if(!s.rpcImpl){setTimeout(function(){o(Error("already ended"))},0);return}try{return s.rpcImpl(e,t[s.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(u,c){if(u)return s.emit("error",u,e),o(u);if(c===null){s.end(!0);return}if(!(c instanceof n))try{c=n[s.responseDelimited?"decodeDelimited":"decode"](c)}catch(f){return s.emit("error",f,e),o(f)}return s.emit("data",c,e),o(null,c)})}catch(a){s.emit("error",a,e),setTimeout(function(){o(a)},0);return}};Ut.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var mi=b(ga=>{"use strict";var ch=ga;ch.Service=ma()});var gi=b((Om,ba)=>{"use strict";ba.exports={}});var xa=b(va=>{"use strict";var G=va;G.build="minimal";G.Writer=Dr();G.BufferWriter=oa();G.Reader=zr();G.BufferReader=da();G.util=we();G.rpc=mi();G.roots=gi();G.configure=wa;function wa(){G.util._configure(),G.Writer._configure(G.BufferWriter),G.Reader._configure(G.BufferReader)}wa()});var Ea=b((Am,Sa)=>{"use strict";Sa.exports=bi;function bi(r,e){typeof r=="string"&&(e=r,r=void 0);var t=[];function n(o){if(typeof o!="string"){var s=i();if(bi.verbose&&console.log("codegen: "+s),s="return "+s,o){for(var a=Object.keys(o),u=new Array(a.length+1),c=new Array(a.length),f=0;f<a.length;)u[f]=a[f],c[f]=o[a[f++]];return u[f]=s,Function.apply(null,u).apply(null,c)}return Function(s)()}for(var p=new Array(arguments.length-1),y=0;y<p.length;)p[y]=arguments[++y];if(y=0,o=o.replace(/%([%dfijs])/g,function(l,h){var m=p[y++];switch(h){case"d":case"f":return String(Number(m));case"i":return String(Math.floor(m));case"j":return JSON.stringify(m);case"s":return String(m)}return"%"}),y!==p.length)throw Error("parameter count mismatch");return t.push(o),n}function i(o){return"function "+(o||e||"")+"("+(r&&r.join(",")||"")+`){
`+t.join(`
`)+`
}`}return n.toString=i,n}bi.verbose=!1});var Oa=b((km,_a)=>{"use strict";_a.exports=$t;var fh=Ir(),lh=Rr(),wi=lh("fs");function $t(r,e,t){return typeof e=="function"?(t=e,e={}):e||(e={}),t?!e.xhr&&wi&&wi.readFile?wi.readFile(r,function(i,o){return i&&typeof XMLHttpRequest<"u"?$t.xhr(r,e,t):i?t(i):t(null,e.binary?o:o.toString("utf8"))}):$t.xhr(r,e,t):fh($t,this,r,e)}$t.xhr=function(e,t,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(t.binary){var s=i.response;if(!s){s=[];for(var a=0;a<i.responseText.length;++a)s.push(i.responseText.charCodeAt(a)&255)}return n(null,typeof Uint8Array<"u"?new Uint8Array(s):s)}return n(null,i.responseText)}},t.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}});var ka=b(Aa=>{"use strict";var xi=Aa,Ta=xi.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},vi=xi.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var t=e.split("/"),n=Ta(e),i="";n&&(i=t.shift()+"/");for(var o=0;o<t.length;)t[o]===".."?o>0&&t[o-1]!==".."?t.splice(--o,2):n?t.splice(o,1):++o:t[o]==="."?t.splice(o,1):++o;return i+t.join("/")};xi.resolve=function(e,t,n){return n||(t=vi(t)),Ta(t)?t:(n||(e=vi(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?vi(e+"/"+t):t)}});var bt=b(Ba=>{"use strict";var Ht=Ba,hh=V(),ph=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function Vt(r,e){var t=0,n={};for(e|=0;t<r.length;)n[ph[t+e]]=r[t++];return n}Ht.basic=Vt([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);Ht.defaults=Vt([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",hh.emptyArray,null]);Ht.long=Vt([0,0,0,1,1],7);Ht.mapKey=Vt([0,0,0,5,5,0,0,0,1,1,0,2],2);Ht.packed=Vt([1,5,0,0,0,5,5,0,0,0,1,1,0])});var tt=b((Pm,Na)=>{"use strict";Na.exports=oe;var Lr=rt();((oe.prototype=Object.create(Lr.prototype)).constructor=oe).className="Field";var Ia=Se(),Pa=bt(),M=V(),Si,dh=/^required|optional|repeated$/;oe.fromJSON=function(e,t){return new oe(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)};function oe(r,e,t,n,i,o,s){if(M.isObject(n)?(s=i,o=n,n=i=void 0):M.isObject(i)&&(s=o,o=i,i=void 0),Lr.call(this,r,o),!M.isInteger(e)||e<0)throw TypeError("id must be a non-negative integer");if(!M.isString(t))throw TypeError("type must be a string");if(n!==void 0&&!dh.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(i!==void 0&&!M.isString(i))throw TypeError("extend must be a string");n==="proto3_optional"&&(n="optional"),this.rule=n&&n!=="optional"?n:void 0,this.type=t,this.id=e,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=M.Long?Pa.long[t]!==void 0:!1,this.bytes=t==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=s}Object.defineProperty(oe.prototype,"packed",{get:function(){return this._packed===null&&(this._packed=this.getOption("packed")!==!1),this._packed}});oe.prototype.setOption=function(e,t,n){return e==="packed"&&(this._packed=null),Lr.prototype.setOption.call(this,e,t,n)};oe.prototype.toJSON=function(e){var t=e?Boolean(e.keepComments):!1;return M.toObject(["rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])};oe.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=Pa.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof Si?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 Ia&&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 Ia))&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=M.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var e;M.base64.test(this.typeDefault)?M.base64.decode(this.typeDefault,e=M.newBuffer(M.base64.length(this.typeDefault)),0):M.utf8.write(this.typeDefault,e=M.newBuffer(M.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=M.emptyObject:this.repeated?this.defaultValue=M.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof Si&&(this.parent.ctor.prototype[this.name]=this.defaultValue),Lr.prototype.resolve.call(this)};oe.d=function(e,t,n,i){return typeof t=="function"?t=M.decorateType(t).name:t&&typeof t=="object"&&(t=M.decorateEnum(t).name),function(s,a){M.decorateType(s.constructor).add(new oe(a,e,t,n,{default:i}))}};oe._configure=function(e){Si=e}});var Jt=b((Nm,Da)=>{"use strict";Da.exports=se;var Mr=rt();((se.prototype=Object.create(Mr.prototype)).constructor=se).className="OneOf";var Ra=tt(),Fr=V();function se(r,e,t,n){if(Array.isArray(e)||(t=e,e=void 0),Mr.call(this,r,t),!(e===void 0||Array.isArray(e)))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=n}se.fromJSON=function(e,t){return new se(e,t.oneof,t.options,t.comment)};se.prototype.toJSON=function(e){var t=e?Boolean(e.keepComments):!1;return Fr.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])};function Ca(r){if(r.parent)for(var e=0;e<r.fieldsArray.length;++e)r.fieldsArray[e].parent||r.parent.add(r.fieldsArray[e])}se.prototype.add=function(e){if(!(e instanceof Ra))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,Ca(this),this};se.prototype.remove=function(e){if(!(e instanceof Ra))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};se.prototype.onAdd=function(e){Mr.prototype.onAdd.call(this,e);for(var t=this,n=0;n<this.oneof.length;++n){var i=e.get(this.oneof[n]);i&&!i.partOf&&(i.partOf=t,t.fieldsArray.push(i))}Ca(this)};se.prototype.onRemove=function(e){for(var t=0,n;t<this.fieldsArray.length;++t)(n=this.fieldsArray[t]).parent&&n.parent.remove(n);Mr.prototype.onRemove.call(this,e)};se.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(i,o){Fr.decorateType(i.constructor).add(new se(o,e)),Object.defineProperty(i,o,{get:Fr.oneOfGetter(e),set:Fr.oneOfSetter(e)})}}});var xt=b((Rm,Fa)=>{"use strict";Fa.exports=B;var Ei=rt();((B.prototype=Object.create(Ei.prototype)).constructor=B).className="Namespace";var qa=tt(),jr=V(),yh=Jt(),wt,Wt,vt;B.fromJSON=function(e,t){return new B(e,t.options).addJSON(t.nested)};function za(r,e){if(r&&r.length){for(var t={},n=0;n<r.length;++n)t[r[n].name]=r[n].toJSON(e);return t}}B.arrayToJSON=za;B.isReservedId=function(e,t){if(e){for(var n=0;n<e.length;++n)if(typeof e[n]!="string"&&e[n][0]<=t&&e[n][1]>t)return!0}return!1};B.isReservedName=function(e,t){if(e){for(var n=0;n<e.length;++n)if(e[n]===t)return!0}return!1};function B(r,e){Ei.call(this,r,e),this.nested=void 0,this._nestedArray=null}function La(r){return r._nestedArray=null,r}Object.defineProperty(B.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=jr.toArray(this.nested))}});B.prototype.toJSON=function(e){return jr.toObject(["options",this.options,"nested",za(this.nestedArray,e)])};B.prototype.addJSON=function(e){var t=this;if(e)for(var n=Object.keys(e),i=0,o;i<n.length;++i)o=e[n[i]],t.add((o.fields!==void 0?wt.fromJSON:o.values!==void 0?vt.fromJSON:o.methods!==void 0?Wt.fromJSON:o.id!==void 0?qa.fromJSON:B.fromJSON)(n[i],o));return this};B.prototype.get=function(e){return this.nested&&this.nested[e]||null};B.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof vt)return this.nested[e].values;throw Error("no such enum: "+e)};B.prototype.add=function(e){if(!(e instanceof qa&&e.extend!==void 0||e instanceof wt||e instanceof yh||e instanceof vt||e instanceof Wt||e instanceof B))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var t=this.get(e.name);if(t)if(t instanceof B&&e instanceof B&&!(t instanceof wt||t instanceof Wt)){for(var n=t.nestedArray,i=0;i<n.length;++i)e.add(n[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}else throw Error("duplicate name '"+e.name+"' in "+this)}return this.nested[e.name]=e,e.onAdd(this),La(this)};B.prototype.remove=function(e){if(!(e instanceof Ei))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),La(this)};B.prototype.define=function(e,t){if(jr.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 n=this;e.length>0;){var i=e.shift();if(n.nested&&n.nested[i]){if(n=n.nested[i],!(n instanceof B))throw Error("path conflicts with non-namespace objects")}else n.add(n=new B(i))}return t&&n.addJSON(t),n};B.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof B?e[t++].resolveAll():e[t++].resolve();return this.resolve()};B.prototype.lookup=function(e,t,n){if(typeof t=="boolean"?(n=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),jr.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 i=this.get(e[0]);if(i){if(e.length===1){if(!t||t.indexOf(i.constructor)>-1)return i}else if(i instanceof B&&(i=i.lookup(e.slice(1),t,!0)))return i}else for(var o=0;o<this.nestedArray.length;++o)if(this._nestedArray[o]instanceof B&&(i=this._nestedArray[o].lookup(e,t,!0)))return i;return this.parent===null||n?null:this.parent.lookup(e,t)};B.prototype.lookupType=function(e){var t=this.lookup(e,[wt]);if(!t)throw Error("no such type: "+e);return t};B.prototype.lookupEnum=function(e){var t=this.lookup(e,[vt]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t};B.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[wt,vt]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t};B.prototype.lookupService=function(e){var t=this.lookup(e,[Wt]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t};B._configure=function(r,e,t){wt=r,Wt=e,vt=t}});var Oi=b((Cm,Ma)=>{"use strict";Ma.exports=Ne;var _i=tt();((Ne.prototype=Object.create(_i.prototype)).constructor=Ne).className="MapField";var mh=bt(),Xt=V();function Ne(r,e,t,n,i,o){if(_i.call(this,r,e,n,void 0,void 0,i,o),!Xt.isString(t))throw TypeError("keyType must be a string");this.keyType=t,this.resolvedKeyType=null,this.map=!0}Ne.fromJSON=function(e,t){return new Ne(e,t.id,t.keyType,t.type,t.options,t.comment)};Ne.prototype.toJSON=function(e){var t=e?Boolean(e.keepComments):!1;return Xt.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])};Ne.prototype.resolve=function(){if(this.resolved)return this;if(mh.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return _i.prototype.resolve.call(this)};Ne.d=function(e,t,n){return typeof n=="function"?n=Xt.decorateType(n).name:n&&typeof n=="object"&&(n=Xt.decorateEnum(n).name),function(o,s){Xt.decorateType(o.constructor).add(new Ne(s,e,t,n))}}});var Ai=b((Dm,ja)=>{"use strict";ja.exports=nt;var Ti=rt();((nt.prototype=Object.create(Ti.prototype)).constructor=nt).className="Method";var St=V();function nt(r,e,t,n,i,o,s,a,u){if(St.isObject(i)?(s=i,i=o=void 0):St.isObject(o)&&(s=o,o=void 0),!(e===void 0||St.isString(e)))throw TypeError("type must be a string");if(!St.isString(t))throw TypeError("requestType must be a string");if(!St.isString(n))throw TypeError("responseType must be a string");Ti.call(this,r,s),this.type=e||"rpc",this.requestType=t,this.requestStream=i?!0:void 0,this.responseType=n,this.responseStream=o?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=a,this.parsedOptions=u}nt.fromJSON=function(e,t){return new nt(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)};nt.prototype.toJSON=function(e){var t=e?Boolean(e.keepComments):!1;return St.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",t?this.comment:void 0,"parsedOptions",this.parsedOptions])};nt.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),Ti.prototype.resolve.call(this))}});var Bi=b((qm,$a)=>{"use strict";$a.exports=ae;var He=xt();((ae.prototype=Object.create(He.prototype)).constructor=ae).className="Service";var ki=Ai(),Gt=V(),gh=mi();function ae(r,e){He.call(this,r,e),this.methods={},this._methodsArray=null}ae.fromJSON=function(e,t){var n=new ae(e,t.options);if(t.methods)for(var i=Object.keys(t.methods),o=0;o<i.length;++o)n.add(ki.fromJSON(i[o],t.methods[i[o]]));return t.nested&&n.addJSON(t.nested),n.comment=t.comment,n};ae.prototype.toJSON=function(e){var t=He.prototype.toJSON.call(this,e),n=e?Boolean(e.keepComments):!1;return Gt.toObject(["options",t&&t.options||void 0,"methods",He.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",n?this.comment:void 0])};Object.defineProperty(ae.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=Gt.toArray(this.methods))}});function Ua(r){return r._methodsArray=null,r}ae.prototype.get=function(e){return this.methods[e]||He.prototype.get.call(this,e)};ae.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return He.prototype.resolve.call(this)};ae.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof ki?(this.methods[e.name]=e,e.parent=this,Ua(this)):He.prototype.add.call(this,e)};ae.prototype.remove=function(e){if(e instanceof ki){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,Ua(this)}return He.prototype.remove.call(this,e)};ae.prototype.create=function(e,t,n){for(var i=new gh.Service(e,t,n),o=0,s;o<this.methodsArray.length;++o){var a=Gt.lcFirst((s=this._methodsArray[o]).resolve().name).replace(/[^$\w_]/g,"");i[a]=Gt.codegen(["r","c"],Gt.isReserved(a)?a+"_":a)("return this.rpcCall(m,q,s,r,c)")({m:s,q:s.resolvedRequestType.ctor,s:s.resolvedResponseType.ctor})}return i}});var Ur=b((zm,Ha)=>{"use strict";Ha.exports=Ee;var bh=we();function Ee(r){if(r)for(var e=Object.keys(r),t=0;t<e.length;++t)this[e[t]]=r[e[t]]}Ee.create=function(e){return this.$type.create(e)};Ee.encode=function(e,t){return this.$type.encode(e,t)};Ee.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)};Ee.decode=function(e){return this.$type.decode(e)};Ee.decodeDelimited=function(e){return this.$type.decodeDelimited(e)};Ee.verify=function(e){return this.$type.verify(e)};Ee.fromObject=function(e){return this.$type.fromObject(e)};Ee.toObject=function(e,t){return this.$type.toObject(e,t)};Ee.prototype.toJSON=function(){return this.$type.toObject(this,bh.toJSONOptions)}});var Ii=b((Lm,Ja)=>{"use strict";Ja.exports=xh;var wh=Se(),Re=bt(),Va=V();function vh(r){return"missing required '"+r.name+"'"}function xh(r){var e=Va.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&&e("if((t&7)===4)")("break"),e("switch(t>>>3){");for(var t=0;t<r.fieldsArray.length;++t){var n=r._fieldsArray[t].resolve(),i=n.resolvedType instanceof wh?"int32":n.type,o="m"+Va.safeProp(n.name);e("case %i: {",n.id),n.map?(e("if(%s===util.emptyObject)",o)("%s={}",o)("var c2 = r.uint32()+r.pos"),Re.defaults[n.keyType]!==void 0?e("k=%j",Re.defaults[n.keyType]):e("k=null"),Re.defaults[i]!==void 0?e("value=%j",Re.defaults[i]):e("value=null"),e("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",n.keyType)("case 2:"),Re.basic[i]===void 0?e("value=types[%i].decode(r,r.uint32())",t):e("value=r.%s()",i),e("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),Re.long[n.keyType]!==void 0?e('%s[typeof k==="object"?util.longToHash(k):k]=value',o):e("%s[k]=value",o)):n.repeated?(e("if(!(%s&&%s.length))",o,o)("%s=[]",o),Re.packed[i]!==void 0&&e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",o,i)("}else"),Re.basic[i]===void 0?e(n.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",o,t):e("%s.push(r.%s())",o,i)):Re.basic[i]===void 0?e(n.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",o,t):e("%s=r.%s()",o,i),e("break")("}")}for(e("default:")("r.skipType(t&7)")("break")("}")("}"),t=0;t<r._fieldsArray.length;++t){var s=r._fieldsArray[t];s.required&&e("if(!m.hasOwnProperty(%j))",s.name)("throw util.ProtocolError(%j,{instance:m})",vh(s))}return e("return m")}});var Ri=b((Fm,Wa)=>{"use strict";Wa.exports=_h;var Sh=Se(),Pi=V();function ue(r,e){return r.name+": "+e+(r.repeated&&e!=="array"?"[]":r.map&&e!=="object"?"{k:"+r.keyType+"}":"")+" expected"}function Ni(r,e,t,n){if(e.resolvedType)if(e.resolvedType instanceof Sh){r("switch(%s){",n)("default:")("return%j",ue(e,"enum value"));for(var i=Object.keys(e.resolvedType.values),o=0;o<i.length;++o)r("case %i:",e.resolvedType.values[i[o]]);r("break")("}")}else r("{")("var e=types[%i].verify(%s);",t,n)("if(e)")("return%j+e",e.name+".")("}");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":r("if(!util.isInteger(%s))",n)("return%j",ue(e,"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",ue(e,"integer|Long"));break;case"float":case"double":r('if(typeof %s!=="number")',n)("return%j",ue(e,"number"));break;case"bool":r('if(typeof %s!=="boolean")',n)("return%j",ue(e,"boolean"));break;case"string":r("if(!util.isString(%s))",n)("return%j",ue(e,"string"));break;case"bytes":r('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",ue(e,"buffer"));break}return r}function Eh(r,e,t){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":r("if(!util.key32Re.test(%s))",t)("return%j",ue(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":r("if(!util.key64Re.test(%s))",t)("return%j",ue(e,"integer|Long key"));break;case"bool":r("if(!util.key2Re.test(%s))",t)("return%j",ue(e,"boolean key"));break}return r}function _h(r){var e=Pi.codegen(["m"],r.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),t=r.oneofsArray,n={};t.length&&e("var p={}");for(var i=0;i<r.fieldsArray.length;++i){var o=r._fieldsArray[i].resolve(),s="m"+Pi.safeProp(o.name);if(o.optional&&e("if(%s!=null&&m.hasOwnProperty(%j)){",s,o.name),o.map)e("if(!util.isObject(%s))",s)("return%j",ue(o,"object"))("var k=Object.keys(%s)",s)("for(var i=0;i<k.length;++i){"),Eh(e,o,"k[i]"),Ni(e,o,i,s+"[k[i]]")("}");else if(o.repeated)e("if(!Array.isArray(%s))",s)("return%j",ue(o,"array"))("for(var i=0;i<%s.length;++i){",s),Ni(e,o,i,s+"[i]")("}");else{if(o.partOf){var a=Pi.safeProp(o.partOf.name);n[o.partOf.name]===1&&e("if(p%s===1)",a)("return%j",o.partOf.name+": multiple values"),n[o.partOf.name]=1,e("p%s=1",a)}Ni(e,o,i,s)}o.optional&&e("}")}return e("return null")}});var qi=b(Ga=>{"use strict";var Xa=Ga,Kt=Se(),_e=V();function Ci(r,e,t,n){var i=!1;if(e.resolvedType)if(e.resolvedType instanceof Kt){r("switch(d%s){",n);for(var o=e.resolvedType.values,s=Object.keys(o),a=0;a<s.length;++a)o[s[a]]===e.typeDefault&&!i&&(r("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),e.repeated||r("break"),i=!0),r("case%j:",s[a])("case %i:",o[s[a]])("m%s=%j",n,o[s[a]])("break");r("}")}else r('if(typeof d%s!=="object")',n)("throw TypeError(%j)",e.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",n,t,n);else{var u=!1;switch(e.type){case"double":case"float":r("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":r("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":r("m%s=d%s|0",n,n);break;case"uint64":u=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":r("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,u)('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,u?"true":"");break;case"bytes":r('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 >= 0)",n)("m%s=d%s",n,n);break;case"string":r("m%s=String(d%s)",n,n);break;case"bool":r("m%s=Boolean(d%s)",n,n);break}}return r}Xa.fromObject=function(e){var t=e.fieldsArray,n=_e.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return n("return new this.ctor");n("var m=new this.ctor");for(var i=0;i<t.length;++i){var o=t[i].resolve(),s=_e.safeProp(o.name);o.map?(n("if(d%s){",s)('if(typeof d%s!=="object")',s)("throw TypeError(%j)",o.fullName+": object expected")("m%s={}",s)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",s),Ci(n,o,i,s+"[ks[i]]")("}")("}")):o.repeated?(n("if(d%s){",s)("if(!Array.isArray(d%s))",s)("throw TypeError(%j)",o.fullName+": array expected")("m%s=[]",s)("for(var i=0;i<d%s.length;++i){",s),Ci(n,o,i,s+"[i]")("}")("}")):(o.resolvedType instanceof Kt||n("if(d%s!=null){",s),Ci(n,o,i,s),o.resolvedType instanceof Kt||n("}"))}return n("return m")};function Di(r,e,t,n){if(e.resolvedType)e.resolvedType instanceof Kt?r("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,t,n,n,t,n,n):r("d%s=types[%i].toObject(m%s,o)",n,t,n);else{var i=!1;switch(e.type){case"double":case"float":r("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":r('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":r("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:r("d%s=m%s",n,n);break}}return r}Xa.toObject=function(e){var t=e.fieldsArray.slice().sort(_e.compareFieldsById);if(!t.length)return _e.codegen()("return {}");for(var n=_e.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),i=[],o=[],s=[],a=0;a<t.length;++a)t[a].partOf||(t[a].resolve().repeated?i:t[a].map?o:s).push(t[a]);if(i.length){for(n("if(o.arrays||o.defaults){"),a=0;a<i.length;++a)n("d%s=[]",_e.safeProp(i[a].name));n("}")}if(o.length){for(n("if(o.objects||o.defaults){"),a=0;a<o.length;++a)n("d%s={}",_e.safeProp(o[a].name));n("}")}if(s.length){for(n("if(o.defaults){"),a=0;a<s.length;++a){var u=s[a],c=_e.safeProp(u.name);if(u.resolvedType instanceof Kt)n("d%s=o.enums===String?%j:%j",c,u.resolvedType.valuesById[u.typeDefault],u.typeDefault);else if(u.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",u.typeDefault.low,u.typeDefault.high,u.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",c)("}else")("d%s=o.longs===String?%j:%i",c,u.typeDefault.toString(),u.typeDefault.toNumber());else if(u.bytes){var f="["+Array.prototype.slice.call(u.typeDefault).join(",")+"]";n("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,u.typeDefault))("else{")("d%s=%s",c,f)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")}else n("d%s=%j",c,u.typeDefault)}n("}")}var p=!1;for(a=0;a<t.length;++a){var u=t[a],y=e._fieldsArray.indexOf(u),c=_e.safeProp(u.name);u.map?(p||(p=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),Di(n,u,y,c+"[ks2[j]]")("}")):u.repeated?(n("if(m%s