protons-runtime
Advanced tools
Comparing version 4.0.2 to 5.0.0
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ProtonsRuntime = factory()}(typeof self !== 'undefined' ? self : this, function () { | ||
"use strict";var ProtonsRuntime=(()=>{var Xt=Object.create;var I=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ee=(e,t)=>{for(var r in t)I(e,r,{get:t[r],enumerable:!0})},et=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qt(t))!te.call(e,i)&&i!==r&&I(e,i,{get:()=>t[i],enumerable:!(n=Kt(t,i))||n.enumerable});return e};var N=(e,t,r)=>(r=e!=null?Xt(Yt(e)):{},et(t||!e||!e.__esModule?I(r,"default",{value:e,enumerable:!0}):r,e)),re=e=>et(I({},"__esModule",{value:!0}),e);var nt=g((ye,rt)=>{"use strict";rt.exports=ne;function ne(e,t){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(h,o){r[n]=function(l){if(s)if(s=!1,l)o(l);else{for(var y=new Array(arguments.length-1),E=0;E<y.length;)y[E++]=arguments[E];h.apply(null,y)}};try{e.apply(t||null,r)}catch(u){s&&(s=!1,o(u))}})}});var ut=g(st=>{"use strict";var O=st;O.length=function(t){var r=t.length;if(!r)return 0;for(var n=0;--r%4>1&&t.charAt(r)==="=";)++n;return Math.ceil(t.length*3)/4-n};var S=new Array(64),ot=new Array(123);for(m=0;m<64;)ot[S[m]=m<26?m+65:m<52?m+71:m<62?m-4:m-59|43]=m++;var m;O.encode=function(t,r,n){for(var i=null,s=[],f=0,h=0,o;r<n;){var u=t[r++];switch(h){case 0:s[f++]=S[u>>2],o=(u&3)<<4,h=1;break;case 1:s[f++]=S[o|u>>4],o=(u&15)<<2,h=2;break;case 2:s[f++]=S[o|u>>6],s[f++]=S[u&63],h=0;break}f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),f=0)}return h&&(s[f++]=S[o],s[f++]=61,h===1&&(s[f++]=61)),i?(f&&i.push(String.fromCharCode.apply(String,s.slice(0,f))),i.join("")):String.fromCharCode.apply(String,s.slice(0,f))};var it="invalid encoding";O.decode=function(t,r,n){for(var i=n,s=0,f,h=0;h<t.length;){var o=t.charCodeAt(h++);if(o===61&&s>1)break;if((o=ot[o])===void 0)throw Error(it);switch(s){case 0:f=o,s=1;break;case 1:r[n++]=f<<2|(o&48)>>4,f=o,s=2;break;case 2:r[n++]=(f&15)<<4|(o&60)>>2,f=o,s=3;break;case 3:r[n++]=(f&3)<<6|o,s=0;break}}if(s===1)throw Error(it);return n-i};O.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var ht=g((me,ft)=>{"use strict";ft.exports=q;function q(){this._listeners={}}q.prototype.on=function(t,r,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:r,ctx:n||this}),this};q.prototype.off=function(t,r){if(t===void 0)this._listeners={};else if(r===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i;return this};q.prototype.emit=function(t){var r=this._listeners[t];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var yt=g((we,gt)=>{"use strict";gt.exports=at(at);function at(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=r[3]===128;function i(o,u,l){t[0]=o,u[l]=r[0],u[l+1]=r[1],u[l+2]=r[2],u[l+3]=r[3]}function s(o,u,l){t[0]=o,u[l]=r[3],u[l+1]=r[2],u[l+2]=r[1],u[l+3]=r[0]}e.writeFloatLE=n?i:s,e.writeFloatBE=n?s:i;function f(o,u){return r[0]=o[u],r[1]=o[u+1],r[2]=o[u+2],r[3]=o[u+3],t[0]}function h(o,u){return r[3]=o[u],r[2]=o[u+1],r[1]=o[u+2],r[0]=o[u+3],t[0]}e.readFloatLE=n?f:h,e.readFloatBE=n?h:f}():function(){function t(n,i,s,f){var h=i<0?1:0;if(h&&(i=-i),i===0)n(1/i>0?0:2147483648,s,f);else if(isNaN(i))n(2143289344,s,f);else if(i>34028234663852886e22)n((h<<31|2139095040)>>>0,s,f);else if(i<11754943508222875e-54)n((h<<31|Math.round(i/1401298464324817e-60))>>>0,s,f);else{var o=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-o)*8388608)&8388607;n((h<<31|o+127<<23|u)>>>0,s,f)}}e.writeFloatLE=t.bind(null,lt),e.writeFloatBE=t.bind(null,ct);function r(n,i,s){var f=n(i,s),h=(f>>31)*2+1,o=f>>>23&255,u=f&8388607;return o===255?u?NaN:h*(1/0):o===0?h*1401298464324817e-60*u:h*Math.pow(2,o-150)*(u+8388608)}e.readFloatLE=r.bind(null,pt),e.readFloatBE=r.bind(null,dt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=r[7]===128;function i(o,u,l){t[0]=o,u[l]=r[0],u[l+1]=r[1],u[l+2]=r[2],u[l+3]=r[3],u[l+4]=r[4],u[l+5]=r[5],u[l+6]=r[6],u[l+7]=r[7]}function s(o,u,l){t[0]=o,u[l]=r[7],u[l+1]=r[6],u[l+2]=r[5],u[l+3]=r[4],u[l+4]=r[3],u[l+5]=r[2],u[l+6]=r[1],u[l+7]=r[0]}e.writeDoubleLE=n?i:s,e.writeDoubleBE=n?s:i;function f(o,u){return r[0]=o[u],r[1]=o[u+1],r[2]=o[u+2],r[3]=o[u+3],r[4]=o[u+4],r[5]=o[u+5],r[6]=o[u+6],r[7]=o[u+7],t[0]}function h(o,u){return r[7]=o[u],r[6]=o[u+1],r[5]=o[u+2],r[4]=o[u+3],r[3]=o[u+4],r[2]=o[u+5],r[1]=o[u+6],r[0]=o[u+7],t[0]}e.readDoubleLE=n?f:h,e.readDoubleBE=n?h:f}():function(){function t(n,i,s,f,h,o){var u=f<0?1:0;if(u&&(f=-f),f===0)n(0,h,o+i),n(1/f>0?0:2147483648,h,o+s);else if(isNaN(f))n(0,h,o+i),n(2146959360,h,o+s);else if(f>17976931348623157e292)n(0,h,o+i),n((u<<31|2146435072)>>>0,h,o+s);else{var l;if(f<22250738585072014e-324)l=f/5e-324,n(l>>>0,h,o+i),n((u<<31|l/4294967296)>>>0,h,o+s);else{var y=Math.floor(Math.log(f)/Math.LN2);y===1024&&(y=1023),l=f*Math.pow(2,-y),n(l*4503599627370496>>>0,h,o+i),n((u<<31|y+1023<<20|l*1048576&1048575)>>>0,h,o+s)}}}e.writeDoubleLE=t.bind(null,lt,0,4),e.writeDoubleBE=t.bind(null,ct,4,0);function r(n,i,s,f,h){var o=n(f,h+i),u=n(f,h+s),l=(u>>31)*2+1,y=u>>>20&2047,E=4294967296*(u&1048575)+o;return y===2047?E?NaN:l*(1/0):y===0?l*5e-324*E:l*Math.pow(2,y-1075)*(E+4503599627370496)}e.readDoubleLE=r.bind(null,pt,0,4),e.readDoubleBE=r.bind(null,dt,4,0)}(),e}function lt(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function ct(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=e&255}function pt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function dt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var _t=g((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(e){}return null}});var wt=g(mt=>{"use strict";var T=mt;T.length=function(t){for(var r=0,n=0,i=0;i<t.length;++i)n=t.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};T.read=function(t,r,n){var i=n-r;if(i<1)return"";for(var s=null,f=[],h=0,o;r<n;)o=t[r++],o<128?f[h++]=o:o>191&&o<224?f[h++]=(o&31)<<6|t[r++]&63:o>239&&o<365?(o=((o&7)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63)-65536,f[h++]=55296+(o>>10),f[h++]=56320+(o&1023)):f[h++]=(o&15)<<12|(t[r++]&63)<<6|t[r++]&63,h>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,f)),h=0);return s?(h&&s.push(String.fromCharCode.apply(String,f.slice(0,h))),s.join("")):String.fromCharCode.apply(String,f.slice(0,h))};T.write=function(t,r,n){for(var i=n,s,f,h=0;h<t.length;++h)s=t.charCodeAt(h),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)===55296&&((f=t.charCodeAt(h+1))&64512)===56320?(s=65536+((s&1023)<<10)+(f&1023),++h,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var bt=g((be,Bt)=>{"use strict";Bt.exports=ie;function ie(e,t,r){var n=r||8192,i=n>>>1,s=null,f=n;return function(o){if(o<1||o>i)return e(o);f+o>n&&(s=e(n),f=0);var u=t.call(s,f,f+=o);return f&7&&(f=(f|7)+1),u}}});var At=g((xe,xt)=>{"use strict";xt.exports=d;var D=F();function d(e,t){this.lo=e>>>0,this.hi=t>>>0}var L=d.zero=new d(0,0);L.toNumber=function(){return 0};L.zzEncode=L.zzDecode=function(){return this};L.length=function(){return 1};var oe=d.zeroHash="\0\0\0\0\0\0\0\0";d.fromNumber=function(t){if(t===0)return L;var r=t<0;r&&(t=-t);var n=t>>>0,i=(t-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new d(n,i)};d.from=function(t){if(typeof t=="number")return d.fromNumber(t);if(D.isString(t))if(D.Long)t=D.Long.fromString(t);else return d.fromNumber(parseInt(t,10));return t.low||t.high?new d(t.low>>>0,t.high>>>0):L};d.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};d.prototype.toLong=function(t){return D.Long?new D.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var x=String.prototype.charCodeAt;d.fromHash=function(t){return t===oe?L:new d((x.call(t,0)|x.call(t,1)<<8|x.call(t,2)<<16|x.call(t,3)<<24)>>>0,(x.call(t,4)|x.call(t,5)<<8|x.call(t,6)<<16|x.call(t,7)<<24)>>>0)};d.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)};d.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};d.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};d.prototype.length=function(){var t=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?t<16384?t<128?1:2:t<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var F=g(U=>{"use strict";var a=U;a.asPromise=nt();a.base64=ut();a.EventEmitter=ht();a.float=yt();a.inquire=_t();a.utf8=wt();a.pool=bt();a.LongBits=At();a.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);a.global=a.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||U;a.emptyArray=Object.freeze?Object.freeze([]):[];a.emptyObject=Object.freeze?Object.freeze({}):{};a.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};a.isString=function(t){return typeof t=="string"||t instanceof String};a.isObject=function(t){return t&&typeof t=="object"};a.isset=a.isSet=function(t,r){var n=t[r];return n!=null&&t.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};a.Buffer=function(){try{var e=a.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();a._Buffer_from=null;a._Buffer_allocUnsafe=null;a.newBuffer=function(t){return typeof t=="number"?a.Buffer?a._Buffer_allocUnsafe(t):new a.Array(t):a.Buffer?a._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};a.Array=typeof Uint8Array<"u"?Uint8Array:Array;a.Long=a.global.dcodeIO&&a.global.dcodeIO.Long||a.global.Long||a.inquire("long");a.key2Re=/^true|false|0|1$/;a.key32Re=/^-?(?:0|[1-9][0-9]*)$/;a.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;a.longToHash=function(t){return t?a.LongBits.from(t).toHash():a.LongBits.zeroHash};a.longFromHash=function(t,r){var n=a.LongBits.fromHash(t);return a.Long?a.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))};function Et(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)(e[n[i]]===void 0||!r)&&(e[n[i]]=t[n[i]]);return e}a.merge=Et;a.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Lt(e){function t(r,n){if(!(this instanceof t))return new t(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Et(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}a.newError=Lt;a.ProtocolError=Lt("ProtocolError");a.oneOfGetter=function(t){for(var r={},n=0;n<t.length;++n)r[t[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};a.oneOfSetter=function(t){return function(r){for(var n=0;n<t.length;++n)t[n]!==r&&delete this[t[n]]}};a.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};a._configure=function(){var e=a.Buffer;if(!e){a._Buffer_from=a._Buffer_allocUnsafe=null;return}a._Buffer_from=e.from!==Uint8Array.from&&e.from||function(r,n){return new e(r,n)},a._Buffer_allocUnsafe=e.allocUnsafe||function(r){return new e(r)}}});var G=g((Ee,Nt)=>{"use strict";Nt.exports=p;var B=F(),V,St=B.LongBits,se=B.utf8;function w(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function p(e){this.buf=e,this.pos=0,this.len=e.length}var Ft=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new p(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new p(t);throw Error("illegal buffer")},kt=function(){return B.Buffer?function(r){return(p.create=function(i){return B.Buffer.isBuffer(i)?new V(i):Ft(i)})(r)}:Ft};p.create=kt();p.prototype._slice=B.Array.prototype.subarray||B.Array.prototype.slice;p.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,w(this,10);return t}}();p.prototype.int32=function(){return this.uint32()|0};p.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function W(){var e=new St(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw w(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw w(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}p.prototype.bool=function(){return this.uint32()!==0};function C(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}p.prototype.fixed32=function(){if(this.pos+4>this.len)throw w(this,4);return C(this.buf,this.pos+=4)};p.prototype.sfixed32=function(){if(this.pos+4>this.len)throw w(this,4);return C(this.buf,this.pos+=4)|0};function vt(){if(this.pos+8>this.len)throw w(this,8);return new St(C(this.buf,this.pos+=4),C(this.buf,this.pos+=4))}p.prototype.float=function(){if(this.pos+4>this.len)throw w(this,4);var t=B.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};p.prototype.double=function(){if(this.pos+8>this.len)throw w(this,4);var t=B.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};p.prototype.bytes=function(){var t=this.uint32(),r=this.pos,n=this.pos+t;if(n>this.len)throw w(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};p.prototype.string=function(){var t=this.bytes();return se.read(t,0,t.length)};p.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw w(this,t);this.pos+=t}else do if(this.pos>=this.len)throw w(this);while(this.buf[this.pos++]&128);return this};p.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};p._configure=function(e){V=e,p.create=kt(),V._configure();var t=B.Long?"toLong":"toNumber";B.merge(p.prototype,{int64:function(){return W.call(this)[t](!1)},uint64:function(){return W.call(this)[t](!0)},sint64:function(){return W.call(this).zzDecode()[t](!1)},fixed64:function(){return vt.call(this)[t](!0)},sfixed64:function(){return vt.call(this)[t](!1)}})}});var Ot=g((Le,It)=>{"use strict";It.exports=v;var Mt=G();(v.prototype=Object.create(Mt.prototype)).constructor=v;var Dt=F();function v(e){Mt.call(this,e)}v._configure=function(){Dt.Buffer&&(v.prototype._slice=Dt.Buffer.prototype.slice)};v.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))};v._configure()});var Q=g((Fe,zt)=>{"use strict";zt.exports=c;var _=F(),P,R=_.LongBits,qt=_.base64,Ct=_.utf8;function M(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function $(){}function ue(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new M($,0,0),this.tail=this.head,this.states=null}var Rt=function(){return _.Buffer?function(){return(c.create=function(){return new P})()}:function(){return new c}};c.create=Rt();c.alloc=function(t){return new _.Array(t)};_.Array!==Array&&(c.alloc=_.pool(c.alloc,_.Array.prototype.subarray));c.prototype._push=function(t,r,n){return this.tail=this.tail.next=new M(t,r,n),this.len+=r,this};function J(e,t,r){t[r]=e&255}function fe(e,t,r){for(;e>127;)t[r++]=e&127|128,e>>>=7;t[r]=e}function X(e,t){this.len=e,this.next=void 0,this.val=t}X.prototype=Object.create(M.prototype);X.prototype.fn=fe;c.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new X((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};c.prototype.int32=function(t){return t<0?this._push(K,10,R.fromNumber(t)):this.uint32(t)};c.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function K(e,t,r){for(;e.hi;)t[r++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=e.lo&127|128,e.lo=e.lo>>>7;t[r++]=e.lo}c.prototype.uint64=function(t){var r=R.from(t);return this._push(K,r.length(),r)};c.prototype.int64=c.prototype.uint64;c.prototype.sint64=function(t){var r=R.from(t).zzEncode();return this._push(K,r.length(),r)};c.prototype.bool=function(t){return this._push(J,1,t?1:0)};function Z(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}c.prototype.fixed32=function(t){return this._push(Z,4,t>>>0)};c.prototype.sfixed32=c.prototype.fixed32;c.prototype.fixed64=function(t){var r=R.from(t);return this._push(Z,4,r.lo)._push(Z,4,r.hi)};c.prototype.sfixed64=c.prototype.fixed64;c.prototype.float=function(t){return this._push(_.float.writeFloatLE,4,t)};c.prototype.double=function(t){return this._push(_.float.writeDoubleLE,8,t)};var he=_.Array.prototype.set?function(t,r,n){r.set(t,n)}:function(t,r,n){for(var i=0;i<t.length;++i)r[n+i]=t[i]};c.prototype.bytes=function(t){var r=t.length>>>0;if(!r)return this._push(J,1,0);if(_.isString(t)){var n=c.alloc(r=qt.length(t));qt.decode(t,n,0),t=n}return this.uint32(r)._push(he,r,t)};c.prototype.string=function(t){var r=Ct.length(t);return r?this.uint32(r)._push(Ct.write,r,t):this._push(J,1,0)};c.prototype.fork=function(){return this.states=new ue(this),this.head=this.tail=new M($,0,0),this.len=0,this};c.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 M($,0,0),this.len=0),this};c.prototype.ldelim=function(){var t=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=r,this.len+=n),this};c.prototype.finish=function(){for(var t=this.head.next,r=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,r,n),n+=t.len,t=t.next;return r};c._configure=function(e){P=e,c.create=Rt(),P._configure()}});var Tt=g((ve,Ht)=>{"use strict";Ht.exports=b;var jt=Q();(b.prototype=Object.create(jt.prototype)).constructor=b;var A=F();function b(){jt.call(this)}b._configure=function(){b.alloc=A._Buffer_allocUnsafe,b.writeBytesBuffer=A.Buffer&&A.Buffer.prototype instanceof Uint8Array&&A.Buffer.prototype.set.name==="set"?function(t,r,n){r.set(t,n)}:function(t,r,n){if(t.copy)t.copy(r,n,0,t.length);else for(var i=0;i<t.length;)r[n++]=t[i++]}};b.prototype.bytes=function(t){A.isString(t)&&(t=A._Buffer_from(t,"base64"));var r=t.length>>>0;return this.uint32(r),r&&this._push(b.writeBytesBuffer,r,t),this};function ae(e,t,r){e.length<40?A.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}b.prototype.string=function(t){var r=A.Buffer.byteLength(t);return this.uint32(r),r&&this._push(ae,r,t),this};b._configure()});var de={};ee(de,{decodeMessage:()=>Pt,encodeMessage:()=>Zt,enumeration:()=>$t,message:()=>Jt,reader:()=>z,writer:()=>j});var Y=N(G(),1),Ut=N(Ot(),1),tt=N(Q(),1),Wt=N(Tt(),1),Vt=N(F(),1);function le(){Vt.default._configure(),Y.default._configure(Ut.default),tt.default._configure(Wt.default)}le();var Gt=["uint64","int64","sint64","fixed64","sfixed64"];function ce(e){for(let t of Gt){if(e[t]==null)continue;let r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}function z(e){return ce(new Y.default(e))}function pe(e){for(let t of Gt){if(e[t]==null)continue;let r=e[t];e[t]=function(n){return r.call(this,n.toString())}}return e}function j(){return pe(tt.default.create())}function Pt(e,t){let r=z(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function Zt(e,t){let r=j();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var k;(function(e){e[e.VARINT=0]="VARINT",e[e.BIT64=1]="BIT64",e[e.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",e[e.START_GROUP=3]="START_GROUP",e[e.END_GROUP=4]="END_GROUP",e[e.BIT32=5]="BIT32"})(k||(k={}));function H(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function $t(e){function t(i){if(e[i.toString()]==null)throw new Error("Invalid enum value");return e[i]}let r=function(s,f){let h=t(s);f.int32(h)},n=function(s){let f=s.int32();return t(f)};return H("enum",k.VARINT,r,n)}function Jt(e,t){return H("message",k.LENGTH_DELIMITED,e,t)}return re(de);})(); | ||
"use strict";var ProtonsRuntime=(()=>{var Xt=Object.create;var I=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var Yt=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ee=(e,t)=>{for(var r in t)I(e,r,{get:t[r],enumerable:!0})},et=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Qt(t))!te.call(e,i)&&i!==r&&I(e,i,{get:()=>t[i],enumerable:!(n=Kt(t,i))||n.enumerable});return e};var N=(e,t,r)=>(r=e!=null?Xt(Yt(e)):{},et(t||!e||!e.__esModule?I(r,"default",{value:e,enumerable:!0}):r,e)),re=e=>et(I({},"__esModule",{value:!0}),e);var nt=g((ye,rt)=>{"use strict";rt.exports=ne;function ne(e,t){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(h,o){r[n]=function(l){if(s)if(s=!1,l)o(l);else{for(var y=new Array(arguments.length-1),E=0;E<y.length;)y[E++]=arguments[E];h.apply(null,y)}};try{e.apply(t||null,r)}catch(u){s&&(s=!1,o(u))}})}});var ut=g(st=>{"use strict";var O=st;O.length=function(t){var r=t.length;if(!r)return 0;for(var n=0;--r%4>1&&t.charAt(r)==="=";)++n;return Math.ceil(t.length*3)/4-n};var S=new Array(64),ot=new Array(123);for(m=0;m<64;)ot[S[m]=m<26?m+65:m<52?m+71:m<62?m-4:m-59|43]=m++;var m;O.encode=function(t,r,n){for(var i=null,s=[],f=0,h=0,o;r<n;){var u=t[r++];switch(h){case 0:s[f++]=S[u>>2],o=(u&3)<<4,h=1;break;case 1:s[f++]=S[o|u>>4],o=(u&15)<<2,h=2;break;case 2:s[f++]=S[o|u>>6],s[f++]=S[u&63],h=0;break}f>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),f=0)}return h&&(s[f++]=S[o],s[f++]=61,h===1&&(s[f++]=61)),i?(f&&i.push(String.fromCharCode.apply(String,s.slice(0,f))),i.join("")):String.fromCharCode.apply(String,s.slice(0,f))};var it="invalid encoding";O.decode=function(t,r,n){for(var i=n,s=0,f,h=0;h<t.length;){var o=t.charCodeAt(h++);if(o===61&&s>1)break;if((o=ot[o])===void 0)throw Error(it);switch(s){case 0:f=o,s=1;break;case 1:r[n++]=f<<2|(o&48)>>4,f=o,s=2;break;case 2:r[n++]=(f&15)<<4|(o&60)>>2,f=o,s=3;break;case 3:r[n++]=(f&3)<<6|o,s=0;break}}if(s===1)throw Error(it);return n-i};O.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}});var ht=g((me,ft)=>{"use strict";ft.exports=q;function q(){this._listeners={}}q.prototype.on=function(t,r,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:r,ctx:n||this}),this};q.prototype.off=function(t,r){if(t===void 0)this._listeners={};else if(r===void 0)this._listeners[t]=[];else for(var n=this._listeners[t],i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i;return this};q.prototype.emit=function(t){var r=this._listeners[t];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var yt=g((we,gt)=>{"use strict";gt.exports=at(at);function at(e){return typeof Float32Array<"u"?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),n=r[3]===128;function i(o,u,l){t[0]=o,u[l]=r[0],u[l+1]=r[1],u[l+2]=r[2],u[l+3]=r[3]}function s(o,u,l){t[0]=o,u[l]=r[3],u[l+1]=r[2],u[l+2]=r[1],u[l+3]=r[0]}e.writeFloatLE=n?i:s,e.writeFloatBE=n?s:i;function f(o,u){return r[0]=o[u],r[1]=o[u+1],r[2]=o[u+2],r[3]=o[u+3],t[0]}function h(o,u){return r[3]=o[u],r[2]=o[u+1],r[1]=o[u+2],r[0]=o[u+3],t[0]}e.readFloatLE=n?f:h,e.readFloatBE=n?h:f}():function(){function t(n,i,s,f){var h=i<0?1:0;if(h&&(i=-i),i===0)n(1/i>0?0:2147483648,s,f);else if(isNaN(i))n(2143289344,s,f);else if(i>34028234663852886e22)n((h<<31|2139095040)>>>0,s,f);else if(i<11754943508222875e-54)n((h<<31|Math.round(i/1401298464324817e-60))>>>0,s,f);else{var o=Math.floor(Math.log(i)/Math.LN2),u=Math.round(i*Math.pow(2,-o)*8388608)&8388607;n((h<<31|o+127<<23|u)>>>0,s,f)}}e.writeFloatLE=t.bind(null,lt),e.writeFloatBE=t.bind(null,ct);function r(n,i,s){var f=n(i,s),h=(f>>31)*2+1,o=f>>>23&255,u=f&8388607;return o===255?u?NaN:h*(1/0):o===0?h*1401298464324817e-60*u:h*Math.pow(2,o-150)*(u+8388608)}e.readFloatLE=r.bind(null,pt),e.readFloatBE=r.bind(null,dt)}(),typeof Float64Array<"u"?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),n=r[7]===128;function i(o,u,l){t[0]=o,u[l]=r[0],u[l+1]=r[1],u[l+2]=r[2],u[l+3]=r[3],u[l+4]=r[4],u[l+5]=r[5],u[l+6]=r[6],u[l+7]=r[7]}function s(o,u,l){t[0]=o,u[l]=r[7],u[l+1]=r[6],u[l+2]=r[5],u[l+3]=r[4],u[l+4]=r[3],u[l+5]=r[2],u[l+6]=r[1],u[l+7]=r[0]}e.writeDoubleLE=n?i:s,e.writeDoubleBE=n?s:i;function f(o,u){return r[0]=o[u],r[1]=o[u+1],r[2]=o[u+2],r[3]=o[u+3],r[4]=o[u+4],r[5]=o[u+5],r[6]=o[u+6],r[7]=o[u+7],t[0]}function h(o,u){return r[7]=o[u],r[6]=o[u+1],r[5]=o[u+2],r[4]=o[u+3],r[3]=o[u+4],r[2]=o[u+5],r[1]=o[u+6],r[0]=o[u+7],t[0]}e.readDoubleLE=n?f:h,e.readDoubleBE=n?h:f}():function(){function t(n,i,s,f,h,o){var u=f<0?1:0;if(u&&(f=-f),f===0)n(0,h,o+i),n(1/f>0?0:2147483648,h,o+s);else if(isNaN(f))n(0,h,o+i),n(2146959360,h,o+s);else if(f>17976931348623157e292)n(0,h,o+i),n((u<<31|2146435072)>>>0,h,o+s);else{var l;if(f<22250738585072014e-324)l=f/5e-324,n(l>>>0,h,o+i),n((u<<31|l/4294967296)>>>0,h,o+s);else{var y=Math.floor(Math.log(f)/Math.LN2);y===1024&&(y=1023),l=f*Math.pow(2,-y),n(l*4503599627370496>>>0,h,o+i),n((u<<31|y+1023<<20|l*1048576&1048575)>>>0,h,o+s)}}}e.writeDoubleLE=t.bind(null,lt,0,4),e.writeDoubleBE=t.bind(null,ct,4,0);function r(n,i,s,f,h){var o=n(f,h+i),u=n(f,h+s),l=(u>>31)*2+1,y=u>>>20&2047,E=4294967296*(u&1048575)+o;return y===2047?E?NaN:l*(1/0):y===0?l*5e-324*E:l*Math.pow(2,y-1075)*(E+4503599627370496)}e.readDoubleLE=r.bind(null,pt,0,4),e.readDoubleBE=r.bind(null,dt,4,0)}(),e}function lt(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function ct(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=e&255}function pt(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function dt(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}});var _t=g((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(e){}return null}});var wt=g(mt=>{"use strict";var T=mt;T.length=function(t){for(var r=0,n=0,i=0;i<t.length;++i)n=t.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(t.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};T.read=function(t,r,n){var i=n-r;if(i<1)return"";for(var s=null,f=[],h=0,o;r<n;)o=t[r++],o<128?f[h++]=o:o>191&&o<224?f[h++]=(o&31)<<6|t[r++]&63:o>239&&o<365?(o=((o&7)<<18|(t[r++]&63)<<12|(t[r++]&63)<<6|t[r++]&63)-65536,f[h++]=55296+(o>>10),f[h++]=56320+(o&1023)):f[h++]=(o&15)<<12|(t[r++]&63)<<6|t[r++]&63,h>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,f)),h=0);return s?(h&&s.push(String.fromCharCode.apply(String,f.slice(0,h))),s.join("")):String.fromCharCode.apply(String,f.slice(0,h))};T.write=function(t,r,n){for(var i=n,s,f,h=0;h<t.length;++h)s=t.charCodeAt(h),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)===55296&&((f=t.charCodeAt(h+1))&64512)===56320?(s=65536+((s&1023)<<10)+(f&1023),++h,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var bt=g((be,Bt)=>{"use strict";Bt.exports=ie;function ie(e,t,r){var n=r||8192,i=n>>>1,s=null,f=n;return function(o){if(o<1||o>i)return e(o);f+o>n&&(s=e(n),f=0);var u=t.call(s,f,f+=o);return f&7&&(f=(f|7)+1),u}}});var At=g((xe,xt)=>{"use strict";xt.exports=d;var D=F();function d(e,t){this.lo=e>>>0,this.hi=t>>>0}var L=d.zero=new d(0,0);L.toNumber=function(){return 0};L.zzEncode=L.zzDecode=function(){return this};L.length=function(){return 1};var oe=d.zeroHash="\0\0\0\0\0\0\0\0";d.fromNumber=function(t){if(t===0)return L;var r=t<0;r&&(t=-t);var n=t>>>0,i=(t-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new d(n,i)};d.from=function(t){if(typeof t=="number")return d.fromNumber(t);if(D.isString(t))if(D.Long)t=D.Long.fromString(t);else return d.fromNumber(parseInt(t,10));return t.low||t.high?new d(t.low>>>0,t.high>>>0):L};d.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};d.prototype.toLong=function(t){return D.Long?new D.Long(this.lo|0,this.hi|0,Boolean(t)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(t)}};var x=String.prototype.charCodeAt;d.fromHash=function(t){return t===oe?L:new d((x.call(t,0)|x.call(t,1)<<8|x.call(t,2)<<16|x.call(t,3)<<24)>>>0,(x.call(t,4)|x.call(t,5)<<8|x.call(t,6)<<16|x.call(t,7)<<24)>>>0)};d.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)};d.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};d.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};d.prototype.length=function(){var t=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?t<16384?t<128?1:2:t<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var F=g(U=>{"use strict";var a=U;a.asPromise=nt();a.base64=ut();a.EventEmitter=ht();a.float=yt();a.inquire=_t();a.utf8=wt();a.pool=bt();a.LongBits=At();a.isNode=Boolean(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node);a.global=a.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||U;a.emptyArray=Object.freeze?Object.freeze([]):[];a.emptyObject=Object.freeze?Object.freeze({}):{};a.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};a.isString=function(t){return typeof t=="string"||t instanceof String};a.isObject=function(t){return t&&typeof t=="object"};a.isset=a.isSet=function(t,r){var n=t[r];return n!=null&&t.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};a.Buffer=function(){try{var e=a.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch{return null}}();a._Buffer_from=null;a._Buffer_allocUnsafe=null;a.newBuffer=function(t){return typeof t=="number"?a.Buffer?a._Buffer_allocUnsafe(t):new a.Array(t):a.Buffer?a._Buffer_from(t):typeof Uint8Array>"u"?t:new Uint8Array(t)};a.Array=typeof Uint8Array<"u"?Uint8Array:Array;a.Long=a.global.dcodeIO&&a.global.dcodeIO.Long||a.global.Long||a.inquire("long");a.key2Re=/^true|false|0|1$/;a.key32Re=/^-?(?:0|[1-9][0-9]*)$/;a.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;a.longToHash=function(t){return t?a.LongBits.from(t).toHash():a.LongBits.zeroHash};a.longFromHash=function(t,r){var n=a.LongBits.fromHash(t);return a.Long?a.Long.fromBits(n.lo,n.hi,r):n.toNumber(Boolean(r))};function Et(e,t,r){for(var n=Object.keys(t),i=0;i<n.length;++i)(e[n[i]]===void 0||!r)&&(e[n[i]]=t[n[i]]);return e}a.merge=Et;a.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)};function Lt(e){function t(r,n){if(!(this instanceof t))return new t(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&Et(this,n)}return t.prototype=Object.create(Error.prototype,{constructor:{value:t,writable:!0,enumerable:!1,configurable:!0},name:{get(){return e},set:void 0,enumerable:!1,configurable:!0},toString:{value(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),t}a.newError=Lt;a.ProtocolError=Lt("ProtocolError");a.oneOfGetter=function(t){for(var r={},n=0;n<t.length;++n)r[t[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};a.oneOfSetter=function(t){return function(r){for(var n=0;n<t.length;++n)t[n]!==r&&delete this[t[n]]}};a.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};a._configure=function(){var e=a.Buffer;if(!e){a._Buffer_from=a._Buffer_allocUnsafe=null;return}a._Buffer_from=e.from!==Uint8Array.from&&e.from||function(r,n){return new e(r,n)},a._Buffer_allocUnsafe=e.allocUnsafe||function(r){return new e(r)}}});var G=g((Ee,Nt)=>{"use strict";Nt.exports=p;var B=F(),V,St=B.LongBits,se=B.utf8;function w(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function p(e){this.buf=e,this.pos=0,this.len=e.length}var Ft=typeof Uint8Array<"u"?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new p(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new p(t);throw Error("illegal buffer")},kt=function(){return B.Buffer?function(r){return(p.create=function(i){return B.Buffer.isBuffer(i)?new V(i):Ft(i)})(r)}:Ft};p.create=kt();p.prototype._slice=B.Array.prototype.subarray||B.Array.prototype.slice;p.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,w(this,10);return t}}();p.prototype.int32=function(){return this.uint32()|0};p.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(t&1)|0};function W(){var e=new St(0,0),t=0;if(this.len-this.pos>4){for(;t<4;++t)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;t=0}else{for(;t<3;++t){if(this.pos>=this.len)throw w(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<t*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<t*7)>>>0,e}if(this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw w(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<t*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}p.prototype.bool=function(){return this.uint32()!==0};function C(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}p.prototype.fixed32=function(){if(this.pos+4>this.len)throw w(this,4);return C(this.buf,this.pos+=4)};p.prototype.sfixed32=function(){if(this.pos+4>this.len)throw w(this,4);return C(this.buf,this.pos+=4)|0};function vt(){if(this.pos+8>this.len)throw w(this,8);return new St(C(this.buf,this.pos+=4),C(this.buf,this.pos+=4))}p.prototype.float=function(){if(this.pos+4>this.len)throw w(this,4);var t=B.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t};p.prototype.double=function(){if(this.pos+8>this.len)throw w(this,4);var t=B.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t};p.prototype.bytes=function(){var t=this.uint32(),r=this.pos,n=this.pos+t;if(n>this.len)throw w(this,t);return this.pos+=t,Array.isArray(this.buf)?this.buf.slice(r,n):r===n?new this.buf.constructor(0):this._slice.call(this.buf,r,n)};p.prototype.string=function(){var t=this.bytes();return se.read(t,0,t.length)};p.prototype.skip=function(t){if(typeof t=="number"){if(this.pos+t>this.len)throw w(this,t);this.pos+=t}else do if(this.pos>=this.len)throw w(this);while(this.buf[this.pos++]&128);return this};p.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this};p._configure=function(e){V=e,p.create=kt(),V._configure();var t=B.Long?"toLong":"toNumber";B.merge(p.prototype,{int64:function(){return W.call(this)[t](!1)},uint64:function(){return W.call(this)[t](!0)},sint64:function(){return W.call(this).zzDecode()[t](!1)},fixed64:function(){return vt.call(this)[t](!0)},sfixed64:function(){return vt.call(this)[t](!1)}})}});var Ot=g((Le,It)=>{"use strict";It.exports=v;var Mt=G();(v.prototype=Object.create(Mt.prototype)).constructor=v;var Dt=F();function v(e){Mt.call(this,e)}v._configure=function(){Dt.Buffer&&(v.prototype._slice=Dt.Buffer.prototype.slice)};v.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))};v._configure()});var Q=g((Fe,zt)=>{"use strict";zt.exports=c;var _=F(),P,R=_.LongBits,qt=_.base64,Ct=_.utf8;function M(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function $(){}function ue(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new M($,0,0),this.tail=this.head,this.states=null}var Rt=function(){return _.Buffer?function(){return(c.create=function(){return new P})()}:function(){return new c}};c.create=Rt();c.alloc=function(t){return new _.Array(t)};_.Array!==Array&&(c.alloc=_.pool(c.alloc,_.Array.prototype.subarray));c.prototype._push=function(t,r,n){return this.tail=this.tail.next=new M(t,r,n),this.len+=r,this};function J(e,t,r){t[r]=e&255}function fe(e,t,r){for(;e>127;)t[r++]=e&127|128,e>>>=7;t[r]=e}function X(e,t){this.len=e,this.next=void 0,this.val=t}X.prototype=Object.create(M.prototype);X.prototype.fn=fe;c.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new X((t=t>>>0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this};c.prototype.int32=function(t){return t<0?this._push(K,10,R.fromNumber(t)):this.uint32(t)};c.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)};function K(e,t,r){for(;e.hi;)t[r++]=e.lo&127|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=e.lo&127|128,e.lo=e.lo>>>7;t[r++]=e.lo}c.prototype.uint64=function(t){var r=R.from(t);return this._push(K,r.length(),r)};c.prototype.int64=c.prototype.uint64;c.prototype.sint64=function(t){var r=R.from(t).zzEncode();return this._push(K,r.length(),r)};c.prototype.bool=function(t){return this._push(J,1,t?1:0)};function Z(e,t,r){t[r]=e&255,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}c.prototype.fixed32=function(t){return this._push(Z,4,t>>>0)};c.prototype.sfixed32=c.prototype.fixed32;c.prototype.fixed64=function(t){var r=R.from(t);return this._push(Z,4,r.lo)._push(Z,4,r.hi)};c.prototype.sfixed64=c.prototype.fixed64;c.prototype.float=function(t){return this._push(_.float.writeFloatLE,4,t)};c.prototype.double=function(t){return this._push(_.float.writeDoubleLE,8,t)};var he=_.Array.prototype.set?function(t,r,n){r.set(t,n)}:function(t,r,n){for(var i=0;i<t.length;++i)r[n+i]=t[i]};c.prototype.bytes=function(t){var r=t.length>>>0;if(!r)return this._push(J,1,0);if(_.isString(t)){var n=c.alloc(r=qt.length(t));qt.decode(t,n,0),t=n}return this.uint32(r)._push(he,r,t)};c.prototype.string=function(t){var r=Ct.length(t);return r?this.uint32(r)._push(Ct.write,r,t):this._push(J,1,0)};c.prototype.fork=function(){return this.states=new ue(this),this.head=this.tail=new M($,0,0),this.len=0,this};c.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 M($,0,0),this.len=0),this};c.prototype.ldelim=function(){var t=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=r,this.len+=n),this};c.prototype.finish=function(){for(var t=this.head.next,r=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,r,n),n+=t.len,t=t.next;return r};c._configure=function(e){P=e,c.create=Rt(),P._configure()}});var Tt=g((ve,Ht)=>{"use strict";Ht.exports=b;var jt=Q();(b.prototype=Object.create(jt.prototype)).constructor=b;var A=F();function b(){jt.call(this)}b._configure=function(){b.alloc=A._Buffer_allocUnsafe,b.writeBytesBuffer=A.Buffer&&A.Buffer.prototype instanceof Uint8Array&&A.Buffer.prototype.set.name==="set"?function(t,r,n){r.set(t,n)}:function(t,r,n){if(t.copy)t.copy(r,n,0,t.length);else for(var i=0;i<t.length;)r[n++]=t[i++]}};b.prototype.bytes=function(t){A.isString(t)&&(t=A._Buffer_from(t,"base64"));var r=t.length>>>0;return this.uint32(r),r&&this._push(b.writeBytesBuffer,r,t),this};function ae(e,t,r){e.length<40?A.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}b.prototype.string=function(t){var r=A.Buffer.byteLength(t);return this.uint32(r),r&&this._push(ae,r,t),this};b._configure()});var de={};ee(de,{decodeMessage:()=>Pt,encodeMessage:()=>Zt,enumeration:()=>$t,message:()=>Jt,reader:()=>z,writer:()=>j});var Y=N(G(),1),Ut=N(Ot(),1),Wt=N(F(),1),tt=N(Q(),1),Vt=N(Tt(),1);function le(){Wt.default._configure(),Y.default._configure(Ut.default),tt.default._configure(Vt.default)}le();var Gt=["uint64","int64","sint64","fixed64","sfixed64"];function ce(e){for(let t of Gt){if(e[t]==null)continue;let r=e[t];e[t]=function(){return BigInt(r.call(this).toString())}}return e}function z(e){return ce(new Y.default(e))}function pe(e){for(let t of Gt){if(e[t]==null)continue;let r=e[t];e[t]=function(n){return r.call(this,n.toString())}}return e}function j(){return pe(tt.default.create())}function Pt(e,t){let r=z(e instanceof Uint8Array?e:e.subarray());return t.decode(r)}function Zt(e,t){let r=j();return t.encode(e,r,{lengthDelimited:!1}),r.finish()}var k;(function(e){e[e.VARINT=0]="VARINT",e[e.BIT64=1]="BIT64",e[e.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",e[e.START_GROUP=3]="START_GROUP",e[e.END_GROUP=4]="END_GROUP",e[e.BIT32=5]="BIT32"})(k||(k={}));function H(e,t,r,n){return{name:e,type:t,encode:r,decode:n}}function $t(e){function t(i){if(e[i.toString()]==null)throw new Error("Invalid enum value");return e[i]}let r=function(s,f){let h=t(s);f.int32(h)},n=function(s){let f=s.int32();return t(f)};return H("enum",k.VARINT,r,n)}function Jt(e,t){return H("message",k.LENGTH_DELIMITED,e,t)}return re(de);})(); | ||
return ProtonsRuntime})); |
@@ -15,3 +15,3 @@ import type { Writer, Reader } from './index.js'; | ||
export interface EncodeFunction<T> { | ||
(value: T, writer: Writer, opts?: EncodeOptions): void; | ||
(value: Partial<T>, writer: Writer, opts?: EncodeOptions): void; | ||
} | ||
@@ -18,0 +18,0 @@ export interface DecodeFunction<T> { |
@@ -7,3 +7,3 @@ import { EncodeOptions } from '../codec.js'; | ||
} | ||
export declare function message<T>(encode: (obj: T, writer: Writer, opts?: EncodeOptions) => void, decode: (reader: Reader, length?: number) => T): Codec<T>; | ||
export declare function message<T>(encode: (obj: Partial<T>, writer: Writer, opts?: EncodeOptions) => void, decode: (reader: Reader, length?: number) => T): Codec<T>; | ||
//# sourceMappingURL=message.d.ts.map |
@@ -6,7 +6,7 @@ // @ts-expect-error no types | ||
// @ts-expect-error no types | ||
import util from 'protobufjs/src/util/minimal.js'; | ||
// @ts-expect-error no types | ||
import WriterClass from 'protobufjs/src/writer.js'; | ||
// @ts-expect-error no types | ||
import WriterBufferClass from 'protobufjs/src/writer_buffer.js'; | ||
// @ts-expect-error no types | ||
import util from 'protobufjs/src/util/minimal.js'; | ||
function configure() { | ||
@@ -13,0 +13,0 @@ util._configure(); |
{ | ||
"name": "protons-runtime", | ||
"version": "4.0.2", | ||
"version": "5.0.0", | ||
"description": "Shared code to make your bundle smaller when running protons in your app", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
@@ -19,3 +19,3 @@ import type { Writer, Reader } from './index.js' | ||
export interface EncodeFunction<T> { | ||
(value: T, writer: Writer, opts?: EncodeOptions): void | ||
(value: Partial<T>, writer: Writer, opts?: EncodeOptions): void | ||
} | ||
@@ -22,0 +22,0 @@ |
@@ -9,4 +9,4 @@ import { createCodec, CODEC_TYPES, EncodeOptions } from '../codec.js' | ||
export function message <T> (encode: (obj: T, writer: Writer, opts?: EncodeOptions) => void, decode: (reader: Reader, length?: number) => T): Codec<T> { | ||
export function message <T> (encode: (obj: Partial<T>, writer: Writer, opts?: EncodeOptions) => void, decode: (reader: Reader, length?: number) => T): Codec<T> { | ||
return createCodec('message', CODEC_TYPES.LENGTH_DELIMITED, encode, decode) | ||
} |
import type { Uint8ArrayList } from 'uint8arraylist' | ||
import type { Codec } from './codec.js' | ||
@@ -3,0 +4,0 @@ import { reader } from './utils.js' |
@@ -6,7 +6,8 @@ // @ts-expect-error no types | ||
// @ts-expect-error no types | ||
import util from 'protobufjs/src/util/minimal.js' | ||
// @ts-expect-error no types | ||
import WriterClass from 'protobufjs/src/writer.js' | ||
// @ts-expect-error no types | ||
import WriterBufferClass from 'protobufjs/src/writer_buffer.js' | ||
// @ts-expect-error no types | ||
import util from 'protobufjs/src/util/minimal.js' | ||
import type { Reader, Writer } from './index.js' | ||
@@ -13,0 +14,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
56004