@busy-app/busy-lib 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +41 -1
- package/dist/index.d.ts +1386 -242
- package/dist/index.js +1189 -703
- package/dist/index.worker.cjs +11 -0
- package/dist/index.worker.d.ts +1 -0
- package/dist/index.worker.js +4025 -0
- package/dist/types.status-BeqxtQVd.cjs +1 -0
- package/dist/types.status-gCPe7MrJ.js +16 -0
- package/package.json +5 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";const types_status=require("./types.status-BeqxtQVd.cjs");var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise,hasRequiredAspromise;function requireAspromise(){if(hasRequiredAspromise)return aspromise;hasRequiredAspromise=1,aspromise=d;function d(u,h){for(var c=new Array(arguments.length-1),l=0,n=2,e=!0;n<arguments.length;)c[l++]=arguments[n++];return new Promise(function(i,t){c[l]=function(s){if(e)if(e=!1,s)t(s);else{for(var a=new Array(arguments.length-1),o=0;o<a.length;)a[o++]=arguments[o];i.apply(null,a)}};try{u.apply(h||null,c)}catch(f){e&&(e=!1,t(f))}})}return aspromise}var base64={},hasRequiredBase64;function requireBase64(){return hasRequiredBase64||(hasRequiredBase64=1,function(d){var u=d;u.length=function(r){var i=r.length;if(!i)return 0;for(var t=0;--i%4>1&&r.charAt(i)==="=";)++t;return Math.ceil(r.length*3)/4-t};for(var h=new Array(64),c=new Array(123),l=0;l<64;)c[h[l]=l<26?l+65:l<52?l+71:l<62?l-4:l-59|43]=l++;u.encode=function(r,i,t){for(var f=null,s=[],a=0,o=0,p;i<t;){var y=r[i++];switch(o){case 0:s[a++]=h[y>>2],p=(y&3)<<4,o=1;break;case 1:s[a++]=h[p|y>>4],p=(y&15)<<2,o=2;break;case 2:s[a++]=h[p|y>>6],s[a++]=h[y&63],o=0;break}a>8191&&((f||(f=[])).push(String.fromCharCode.apply(String,s)),a=0)}return o&&(s[a++]=h[p],s[a++]=61,o===1&&(s[a++]=61)),f?(a&&f.push(String.fromCharCode.apply(String,s.slice(0,a))),f.join("")):String.fromCharCode.apply(String,s.slice(0,a))};var n="invalid encoding";u.decode=function(r,i,t){for(var f=t,s=0,a,o=0;o<r.length;){var p=r.charCodeAt(o++);if(p===61&&s>1)break;if((p=c[p])===void 0)throw Error(n);switch(s){case 0:a=p,s=1;break;case 1:i[t++]=a<<2|(p&48)>>4,a=p,s=2;break;case 2:i[t++]=(a&15)<<4|(p&60)>>2,a=p,s=3;break;case 3:i[t++]=(a&3)<<6|p,s=0;break}}if(s===1)throw Error(n);return t-f},u.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}}(base64)),base64}var eventemitter,hasRequiredEventemitter;function requireEventemitter(){if(hasRequiredEventemitter)return eventemitter;hasRequiredEventemitter=1,eventemitter=d;function d(){this._listeners={}}return d.prototype.on=function(h,c,l){return(this._listeners[h]||(this._listeners[h]=[])).push({fn:c,ctx:l||this}),this},d.prototype.off=function(h,c){if(h===void 0)this._listeners={};else if(c===void 0)this._listeners[h]=[];else for(var l=this._listeners[h],n=0;n<l.length;)l[n].fn===c?l.splice(n,1):++n;return this},d.prototype.emit=function(h){var c=this._listeners[h];if(c){for(var l=[],n=1;n<arguments.length;)l.push(arguments[n++]);for(n=0;n<c.length;)c[n].fn.apply(c[n++].ctx,l)}return this},eventemitter}var float,hasRequiredFloat;function requireFloat(){if(hasRequiredFloat)return float;hasRequiredFloat=1,float=d(d);function d(n){return typeof Float32Array<"u"?function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),i=r[3]===128;function t(o,p,y){e[0]=o,p[y]=r[0],p[y+1]=r[1],p[y+2]=r[2],p[y+3]=r[3]}function f(o,p,y){e[0]=o,p[y]=r[3],p[y+1]=r[2],p[y+2]=r[1],p[y+3]=r[0]}n.writeFloatLE=i?t:f,n.writeFloatBE=i?f:t;function s(o,p){return r[0]=o[p],r[1]=o[p+1],r[2]=o[p+2],r[3]=o[p+3],e[0]}function a(o,p){return r[3]=o[p],r[2]=o[p+1],r[1]=o[p+2],r[0]=o[p+3],e[0]}n.readFloatLE=i?s:a,n.readFloatBE=i?a:s}():function(){function e(i,t,f,s){var a=t<0?1:0;if(a&&(t=-t),t===0)i(1/t>0?0:2147483648,f,s);else if(isNaN(t))i(2143289344,f,s);else if(t>34028234663852886e22)i((a<<31|2139095040)>>>0,f,s);else if(t<11754943508222875e-54)i((a<<31|Math.round(t/1401298464324817e-60))>>>0,f,s);else{var o=Math.floor(Math.log(t)/Math.LN2),p=Math.round(t*Math.pow(2,-o)*8388608)&8388607;i((a<<31|o+127<<23|p)>>>0,f,s)}}n.writeFloatLE=e.bind(null,u),n.writeFloatBE=e.bind(null,h);function r(i,t,f){var s=i(t,f),a=(s>>31)*2+1,o=s>>>23&255,p=s&8388607;return o===255?p?NaN:a*(1/0):o===0?a*1401298464324817e-60*p:a*Math.pow(2,o-150)*(p+8388608)}n.readFloatLE=r.bind(null,c),n.readFloatBE=r.bind(null,l)}(),typeof Float64Array<"u"?function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),i=r[7]===128;function t(o,p,y){e[0]=o,p[y]=r[0],p[y+1]=r[1],p[y+2]=r[2],p[y+3]=r[3],p[y+4]=r[4],p[y+5]=r[5],p[y+6]=r[6],p[y+7]=r[7]}function f(o,p,y){e[0]=o,p[y]=r[7],p[y+1]=r[6],p[y+2]=r[5],p[y+3]=r[4],p[y+4]=r[3],p[y+5]=r[2],p[y+6]=r[1],p[y+7]=r[0]}n.writeDoubleLE=i?t:f,n.writeDoubleBE=i?f:t;function s(o,p){return r[0]=o[p],r[1]=o[p+1],r[2]=o[p+2],r[3]=o[p+3],r[4]=o[p+4],r[5]=o[p+5],r[6]=o[p+6],r[7]=o[p+7],e[0]}function a(o,p){return r[7]=o[p],r[6]=o[p+1],r[5]=o[p+2],r[4]=o[p+3],r[3]=o[p+4],r[2]=o[p+5],r[1]=o[p+6],r[0]=o[p+7],e[0]}n.readDoubleLE=i?s:a,n.readDoubleBE=i?a:s}():function(){function e(i,t,f,s,a,o){var p=s<0?1:0;if(p&&(s=-s),s===0)i(0,a,o+t),i(1/s>0?0:2147483648,a,o+f);else if(isNaN(s))i(0,a,o+t),i(2146959360,a,o+f);else if(s>17976931348623157e292)i(0,a,o+t),i((p<<31|2146435072)>>>0,a,o+f);else{var y;if(s<22250738585072014e-324)y=s/5e-324,i(y>>>0,a,o+t),i((p<<31|y/4294967296)>>>0,a,o+f);else{var b=Math.floor(Math.log(s)/Math.LN2);b===1024&&(b=1023),y=s*Math.pow(2,-b),i(y*4503599627370496>>>0,a,o+t),i((p<<31|b+1023<<20|y*1048576&1048575)>>>0,a,o+f)}}}n.writeDoubleLE=e.bind(null,u,0,4),n.writeDoubleBE=e.bind(null,h,4,0);function r(i,t,f,s,a){var o=i(s,a+t),p=i(s,a+f),y=(p>>31)*2+1,b=p>>>20&2047,v=4294967296*(p&1048575)+o;return b===2047?v?NaN:y*(1/0):b===0?y*5e-324*v:y*Math.pow(2,b-1075)*(v+4503599627370496)}n.readDoubleLE=r.bind(null,c,0,4),n.readDoubleBE=r.bind(null,l,4,0)}(),n}function u(n,e,r){e[r]=n&255,e[r+1]=n>>>8&255,e[r+2]=n>>>16&255,e[r+3]=n>>>24}function h(n,e,r){e[r]=n>>>24,e[r+1]=n>>>16&255,e[r+2]=n>>>8&255,e[r+3]=n&255}function c(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0}function l(n,e){return(n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3])>>>0}return float}var inquire_1,hasRequiredInquire;function requireInquire(){if(hasRequiredInquire)return inquire_1;hasRequiredInquire=1,inquire_1=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(d){}return null}return inquire_1}var utf8={},hasRequiredUtf8;function requireUtf8(){return hasRequiredUtf8||(hasRequiredUtf8=1,function(d){var u=d;u.length=function(c){for(var l=0,n=0,e=0;e<c.length;++e)n=c.charCodeAt(e),n<128?l+=1:n<2048?l+=2:(n&64512)===55296&&(c.charCodeAt(e+1)&64512)===56320?(++e,l+=4):l+=3;return l},u.read=function(c,l,n){var e=n-l;if(e<1)return"";for(var r=null,i=[],t=0,f;l<n;)f=c[l++],f<128?i[t++]=f:f>191&&f<224?i[t++]=(f&31)<<6|c[l++]&63:f>239&&f<365?(f=((f&7)<<18|(c[l++]&63)<<12|(c[l++]&63)<<6|c[l++]&63)-65536,i[t++]=55296+(f>>10),i[t++]=56320+(f&1023)):i[t++]=(f&15)<<12|(c[l++]&63)<<6|c[l++]&63,t>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,i)),t=0);return r?(t&&r.push(String.fromCharCode.apply(String,i.slice(0,t))),r.join("")):String.fromCharCode.apply(String,i.slice(0,t))},u.write=function(c,l,n){for(var e=n,r,i,t=0;t<c.length;++t)r=c.charCodeAt(t),r<128?l[n++]=r:r<2048?(l[n++]=r>>6|192,l[n++]=r&63|128):(r&64512)===55296&&((i=c.charCodeAt(t+1))&64512)===56320?(r=65536+((r&1023)<<10)+(i&1023),++t,l[n++]=r>>18|240,l[n++]=r>>12&63|128,l[n++]=r>>6&63|128,l[n++]=r&63|128):(l[n++]=r>>12|224,l[n++]=r>>6&63|128,l[n++]=r&63|128);return n-e}}(utf8)),utf8}var pool_1,hasRequiredPool;function requirePool(){if(hasRequiredPool)return pool_1;hasRequiredPool=1,pool_1=d;function d(u,h,c){var l=c||8192,n=l>>>1,e=null,r=l;return function(t){if(t<1||t>n)return u(t);r+t>l&&(e=u(l),r=0);var f=h.call(e,r,r+=t);return r&7&&(r=(r|7)+1),f}}return pool_1}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=u;var d=requireMinimal();function u(n,e){this.lo=n>>>0,this.hi=e>>>0}var h=u.zero=new u(0,0);h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1};var c=u.zeroHash="\0\0\0\0\0\0\0\0";u.fromNumber=function(e){if(e===0)return h;var r=e<0;r&&(e=-e);var i=e>>>0,t=(e-i)/4294967296>>>0;return r&&(t=~t>>>0,i=~i>>>0,++i>4294967295&&(i=0,++t>4294967295&&(t=0))),new u(i,t)},u.from=function(e){if(typeof e=="number")return u.fromNumber(e);if(d.isString(e))if(d.Long)e=d.Long.fromString(e);else return u.fromNumber(parseInt(e,10));return e.low||e.high?new u(e.low>>>0,e.high>>>0):h},u.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,i=~this.hi>>>0;return r||(i=i+1>>>0),-(r+i*4294967296)}return this.lo+this.hi*4294967296},u.prototype.toLong=function(e){return d.Long?new d.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var l=String.prototype.charCodeAt;return u.fromHash=function(e){return e===c?h:new u((l.call(e,0)|l.call(e,1)<<8|l.call(e,2)<<16|l.call(e,3)<<24)>>>0,(l.call(e,4)|l.call(e,5)<<8|l.call(e,6)<<16|l.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,r=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return i===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:i<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(d){var u=d;u.asPromise=requireAspromise(),u.base64=requireBase64(),u.EventEmitter=requireEventemitter(),u.float=requireFloat(),u.inquire=requireInquire(),u.utf8=requireUtf8(),u.pool=requirePool(),u.LongBits=requireLongbits(),u.isNode=!!(typeof commonjsGlobal<"u"&&commonjsGlobal&&commonjsGlobal.process&&commonjsGlobal.process.versions&&commonjsGlobal.process.versions.node),u.global=u.isNode&&commonjsGlobal||typeof window<"u"&&window||typeof self<"u"&&self||minimal,u.emptyArray=Object.freeze?Object.freeze([]):[],u.emptyObject=Object.freeze?Object.freeze({}):{},u.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},u.isString=function(n){return typeof n=="string"||n instanceof String},u.isObject=function(n){return n&&typeof n=="object"},u.isset=u.isSet=function(n,e){var r=n[e];return r!=null&&n.hasOwnProperty(e)?typeof r!="object"||(Array.isArray(r)?r.length:Object.keys(r).length)>0:!1},u.Buffer=function(){try{var l=u.inquire("buffer").Buffer;return l.prototype.utf8Write?l:null}catch{return null}}(),u._Buffer_from=null,u._Buffer_allocUnsafe=null,u.newBuffer=function(n){return typeof n=="number"?u.Buffer?u._Buffer_allocUnsafe(n):new u.Array(n):u.Buffer?u._Buffer_from(n):typeof Uint8Array>"u"?n:new Uint8Array(n)},u.Array=typeof Uint8Array<"u"?Uint8Array:Array,u.Long=u.global.dcodeIO&&u.global.dcodeIO.Long||u.global.Long||u.inquire("long"),u.key2Re=/^true|false|0|1$/,u.key32Re=/^-?(?:0|[1-9][0-9]*)$/,u.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,u.longToHash=function(n){return n?u.LongBits.from(n).toHash():u.LongBits.zeroHash},u.longFromHash=function(n,e){var r=u.LongBits.fromHash(n);return u.Long?u.Long.fromBits(r.lo,r.hi,e):r.toNumber(!!e)};function h(l,n,e){for(var r=Object.keys(n),i=0;i<r.length;++i)(l[r[i]]===void 0||!e)&&(l[r[i]]=n[r[i]]);return l}u.merge=h,u.lcFirst=function(n){return n.charAt(0).toLowerCase()+n.substring(1)};function c(l){function n(e,r){if(!(this instanceof n))return new n(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:new Error().stack||""}),r&&h(this,r)}return n.prototype=Object.create(Error.prototype,{constructor:{value:n,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return l},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),n}u.newError=c,u.ProtocolError=c("ProtocolError"),u.oneOfGetter=function(n){for(var e={},r=0;r<n.length;++r)e[n[r]]=1;return function(){for(var i=Object.keys(this),t=i.length-1;t>-1;--t)if(e[i[t]]===1&&this[i[t]]!==void 0&&this[i[t]]!==null)return i[t]}},u.oneOfSetter=function(n){return function(e){for(var r=0;r<n.length;++r)n[r]!==e&&delete this[n[r]]}},u.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},u._configure=function(){var l=u.Buffer;if(!l){u._Buffer_from=u._Buffer_allocUnsafe=null;return}u._Buffer_from=l.from!==Uint8Array.from&&l.from||function(e,r){return new l(e,r)},u._Buffer_allocUnsafe=l.allocUnsafe||function(e){return new l(e)}}}(minimal)),minimal}var writer,hasRequiredWriter;function requireWriter(){if(hasRequiredWriter)return writer;hasRequiredWriter=1,writer=i;var d=requireMinimal(),u,h=d.LongBits,c=d.base64,l=d.utf8;function n(b,v,m){this.fn=b,this.len=v,this.next=void 0,this.val=m}function e(){}function r(b){this.head=b.head,this.tail=b.tail,this.len=b.len,this.next=b.states}function i(){this.len=0,this.head=new n(e,0,0),this.tail=this.head,this.states=null}var t=function(){return d.Buffer?function(){return(i.create=function(){return new u})()}:function(){return new i}};i.create=t(),i.alloc=function(v){return new d.Array(v)},d.Array!==Array&&(i.alloc=d.pool(i.alloc,d.Array.prototype.subarray)),i.prototype._push=function(v,m,_){return this.tail=this.tail.next=new n(v,m,_),this.len+=m,this};function f(b,v,m){v[m]=b&255}function s(b,v,m){for(;b>127;)v[m++]=b&127|128,b>>>=7;v[m]=b}function a(b,v){this.len=b,this.next=void 0,this.val=v}a.prototype=Object.create(n.prototype),a.prototype.fn=s,i.prototype.uint32=function(v){return this.len+=(this.tail=this.tail.next=new a((v=v>>>0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},i.prototype.int32=function(v){return v<0?this._push(o,10,h.fromNumber(v)):this.uint32(v)},i.prototype.sint32=function(v){return this.uint32((v<<1^v>>31)>>>0)};function o(b,v,m){for(;b.hi;)v[m++]=b.lo&127|128,b.lo=(b.lo>>>7|b.hi<<25)>>>0,b.hi>>>=7;for(;b.lo>127;)v[m++]=b.lo&127|128,b.lo=b.lo>>>7;v[m++]=b.lo}i.prototype.uint64=function(v){var m=h.from(v);return this._push(o,m.length(),m)},i.prototype.int64=i.prototype.uint64,i.prototype.sint64=function(v){var m=h.from(v).zzEncode();return this._push(o,m.length(),m)},i.prototype.bool=function(v){return this._push(f,1,v?1:0)};function p(b,v,m){v[m]=b&255,v[m+1]=b>>>8&255,v[m+2]=b>>>16&255,v[m+3]=b>>>24}i.prototype.fixed32=function(v){return this._push(p,4,v>>>0)},i.prototype.sfixed32=i.prototype.fixed32,i.prototype.fixed64=function(v){var m=h.from(v);return this._push(p,4,m.lo)._push(p,4,m.hi)},i.prototype.sfixed64=i.prototype.fixed64,i.prototype.float=function(v){return this._push(d.float.writeFloatLE,4,v)},i.prototype.double=function(v){return this._push(d.float.writeDoubleLE,8,v)};var y=d.Array.prototype.set?function(v,m,_){m.set(v,_)}:function(v,m,_){for(var E=0;E<v.length;++E)m[_+E]=v[E]};return i.prototype.bytes=function(v){var m=v.length>>>0;if(!m)return this._push(f,1,0);if(d.isString(v)){var _=i.alloc(m=c.length(v));c.decode(v,_,0),v=_}return this.uint32(m)._push(y,m,v)},i.prototype.string=function(v){var m=l.length(v);return m?this.uint32(m)._push(l.write,m,v):this._push(f,1,0)},i.prototype.fork=function(){return this.states=new r(this),this.head=this.tail=new n(e,0,0),this.len=0,this},i.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new n(e,0,0),this.len=0),this},i.prototype.ldelim=function(){var v=this.head,m=this.tail,_=this.len;return this.reset().uint32(_),_&&(this.tail.next=v.next,this.tail=m,this.len+=_),this},i.prototype.finish=function(){for(var v=this.head.next,m=this.constructor.alloc(this.len),_=0;v;)v.fn(v.val,m,_),_+=v.len,v=v.next;return m},i._configure=function(b){u=b,i.create=t(),u._configure()},writer}var writer_buffer,hasRequiredWriter_buffer;function requireWriter_buffer(){if(hasRequiredWriter_buffer)return writer_buffer;hasRequiredWriter_buffer=1,writer_buffer=h;var d=requireWriter();(h.prototype=Object.create(d.prototype)).constructor=h;var u=requireMinimal();function h(){d.call(this)}h._configure=function(){h.alloc=u._Buffer_allocUnsafe,h.writeBytesBuffer=u.Buffer&&u.Buffer.prototype instanceof Uint8Array&&u.Buffer.prototype.set.name==="set"?function(n,e,r){e.set(n,r)}:function(n,e,r){if(n.copy)n.copy(e,r,0,n.length);else for(var i=0;i<n.length;)e[r++]=n[i++]}},h.prototype.bytes=function(n){u.isString(n)&&(n=u._Buffer_from(n,"base64"));var e=n.length>>>0;return this.uint32(e),e&&this._push(h.writeBytesBuffer,e,n),this};function c(l,n,e){l.length<40?u.utf8.write(l,n,e):n.utf8Write?n.utf8Write(l,e):n.write(l,e)}return h.prototype.string=function(n){var e=u.Buffer.byteLength(n);return this.uint32(e),e&&this._push(c,e,n),this},h._configure(),writer_buffer}var reader,hasRequiredReader;function requireReader(){if(hasRequiredReader)return reader;hasRequiredReader=1,reader=n;var d=requireMinimal(),u,h=d.LongBits,c=d.utf8;function l(s,a){return RangeError("index out of range: "+s.pos+" + "+(a||1)+" > "+s.len)}function n(s){this.buf=s,this.pos=0,this.len=s.length}var e=typeof Uint8Array<"u"?function(a){if(a instanceof Uint8Array||Array.isArray(a))return new n(a);throw Error("illegal buffer")}:function(a){if(Array.isArray(a))return new n(a);throw Error("illegal buffer")},r=function(){return d.Buffer?function(o){return(n.create=function(y){return d.Buffer.isBuffer(y)?new u(y):e(y)})(o)}:e};n.create=r(),n.prototype._slice=d.Array.prototype.subarray||d.Array.prototype.slice,n.prototype.uint32=function(){var a=4294967295;return function(){if(a=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(a=(a|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(a=(a|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(a=(a|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(a=(a|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return a;if((this.pos+=5)>this.len)throw this.pos=this.len,l(this,10);return a}}(),n.prototype.int32=function(){return this.uint32()|0},n.prototype.sint32=function(){var a=this.uint32();return a>>>1^-(a&1)|0};function i(){var s=new h(0,0),a=0;if(this.len-this.pos>4){for(;a<4;++a)if(s.lo=(s.lo|(this.buf[this.pos]&127)<<a*7)>>>0,this.buf[this.pos++]<128)return s;if(s.lo=(s.lo|(this.buf[this.pos]&127)<<28)>>>0,s.hi=(s.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return s;a=0}else{for(;a<3;++a){if(this.pos>=this.len)throw l(this);if(s.lo=(s.lo|(this.buf[this.pos]&127)<<a*7)>>>0,this.buf[this.pos++]<128)return s}return s.lo=(s.lo|(this.buf[this.pos++]&127)<<a*7)>>>0,s}if(this.len-this.pos>4){for(;a<5;++a)if(s.hi=(s.hi|(this.buf[this.pos]&127)<<a*7+3)>>>0,this.buf[this.pos++]<128)return s}else for(;a<5;++a){if(this.pos>=this.len)throw l(this);if(s.hi=(s.hi|(this.buf[this.pos]&127)<<a*7+3)>>>0,this.buf[this.pos++]<128)return s}throw Error("invalid varint encoding")}n.prototype.bool=function(){return this.uint32()!==0};function t(s,a){return(s[a-4]|s[a-3]<<8|s[a-2]<<16|s[a-1]<<24)>>>0}n.prototype.fixed32=function(){if(this.pos+4>this.len)throw l(this,4);return t(this.buf,this.pos+=4)},n.prototype.sfixed32=function(){if(this.pos+4>this.len)throw l(this,4);return t(this.buf,this.pos+=4)|0};function f(){if(this.pos+8>this.len)throw l(this,8);return new h(t(this.buf,this.pos+=4),t(this.buf,this.pos+=4))}return n.prototype.float=function(){if(this.pos+4>this.len)throw l(this,4);var a=d.float.readFloatLE(this.buf,this.pos);return this.pos+=4,a},n.prototype.double=function(){if(this.pos+8>this.len)throw l(this,4);var a=d.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,a},n.prototype.bytes=function(){var a=this.uint32(),o=this.pos,p=this.pos+a;if(p>this.len)throw l(this,a);if(this.pos+=a,Array.isArray(this.buf))return this.buf.slice(o,p);if(o===p){var y=d.Buffer;return y?y.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,o,p)},n.prototype.string=function(){var a=this.bytes();return c.read(a,0,a.length)},n.prototype.skip=function(a){if(typeof a=="number"){if(this.pos+a>this.len)throw l(this,a);this.pos+=a}else do if(this.pos>=this.len)throw l(this);while(this.buf[this.pos++]&128);return this},n.prototype.skipType=function(s){switch(s){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(s=this.uint32()&7)!==4;)this.skipType(s);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+s+" at offset "+this.pos)}return this},n._configure=function(s){u=s,n.create=r(),u._configure();var a=d.Long?"toLong":"toNumber";d.merge(n.prototype,{int64:function(){return i.call(this)[a](!1)},uint64:function(){return i.call(this)[a](!0)},sint64:function(){return i.call(this).zzDecode()[a](!1)},fixed64:function(){return f.call(this)[a](!0)},sfixed64:function(){return f.call(this)[a](!1)}})},reader}var reader_buffer,hasRequiredReader_buffer;function requireReader_buffer(){if(hasRequiredReader_buffer)return reader_buffer;hasRequiredReader_buffer=1,reader_buffer=h;var d=requireReader();(h.prototype=Object.create(d.prototype)).constructor=h;var u=requireMinimal();function h(c){d.call(this,c)}return h._configure=function(){u.Buffer&&(h.prototype._slice=u.Buffer.prototype.slice)},h.prototype.string=function(){var l=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+l,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+l,this.len))},h._configure(),reader_buffer}var rpc={},service$1,hasRequiredService$1;function requireService$1(){if(hasRequiredService$1)return service$1;hasRequiredService$1=1,service$1=u;var d=requireMinimal();(u.prototype=Object.create(d.EventEmitter.prototype)).constructor=u;function u(h,c,l){if(typeof h!="function")throw TypeError("rpcImpl must be a function");d.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!c,this.responseDelimited=!!l}return u.prototype.rpcCall=function h(c,l,n,e,r){if(!e)throw TypeError("request must be specified");var i=this;if(!r)return d.asPromise(h,i,c,l,n,e);if(!i.rpcImpl){setTimeout(function(){r(Error("already ended"))},0);return}try{return i.rpcImpl(c,l[i.requestDelimited?"encodeDelimited":"encode"](e).finish(),function(f,s){if(f)return i.emit("error",f,c),r(f);if(s===null){i.end(!0);return}if(!(s instanceof n))try{s=n[i.responseDelimited?"decodeDelimited":"decode"](s)}catch(a){return i.emit("error",a,c),r(a)}return i.emit("data",s,c),r(null,s)})}catch(t){i.emit("error",t,c),setTimeout(function(){r(t)},0);return}},u.prototype.end=function(c){return this.rpcImpl&&(c||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this},service$1}var hasRequiredRpc;function requireRpc(){return hasRequiredRpc||(hasRequiredRpc=1,function(d){var u=d;u.Service=requireService$1()}(rpc)),rpc}var roots,hasRequiredRoots;function requireRoots(){return hasRequiredRoots||(hasRequiredRoots=1,roots={}),roots}var hasRequiredIndexMinimal;function requireIndexMinimal(){return hasRequiredIndexMinimal||(hasRequiredIndexMinimal=1,function(d){var u=d;u.build="minimal",u.Writer=requireWriter(),u.BufferWriter=requireWriter_buffer(),u.Reader=requireReader(),u.BufferReader=requireReader_buffer(),u.util=requireMinimal(),u.rpc=requireRpc(),u.roots=requireRoots(),u.configure=h;function h(){u.util._configure(),u.Writer._configure(u.BufferWriter),u.Reader._configure(u.BufferReader)}h()}(indexMinimal)),indexMinimal}var types={},util={exports:{}},codegen_1,hasRequiredCodegen;function requireCodegen(){if(hasRequiredCodegen)return codegen_1;hasRequiredCodegen=1,codegen_1=d;function d(u,h){typeof u=="string"&&(h=u,u=void 0);var c=[];function l(e){if(typeof e!="string"){var r=n();if(d.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var i=Object.keys(e),t=new Array(i.length+1),f=new Array(i.length),s=0;s<i.length;)t[s]=i[s],f[s]=e[i[s++]];return t[s]=r,Function.apply(null,t).apply(null,f)}return Function(r)()}for(var a=new Array(arguments.length-1),o=0;o<a.length;)a[o]=arguments[++o];if(o=0,e=e.replace(/%([%dfijs])/g,function(y,b){var v=a[o++];switch(b){case"d":case"f":return String(Number(v));case"i":return String(Math.floor(v));case"j":return JSON.stringify(v);case"s":return String(v)}return"%"}),o!==a.length)throw Error("parameter count mismatch");return c.push(e),l}function n(e){return"function "+(e||h||"")+"("+(u&&u.join(",")||"")+`){
|
|
2
|
+
`+c.join(`
|
|
3
|
+
`)+`
|
|
4
|
+
}`}return l.toString=n,l}return d.verbose=!1,codegen_1}var fetch_1,hasRequiredFetch;function requireFetch(){if(hasRequiredFetch)return fetch_1;hasRequiredFetch=1,fetch_1=c;var d=requireAspromise(),u=requireInquire(),h=u("fs");function c(l,n,e){return typeof n=="function"?(e=n,n={}):n||(n={}),e?!n.xhr&&h&&h.readFile?h.readFile(l,function(i,t){return i&&typeof XMLHttpRequest<"u"?c.xhr(l,n,e):i?e(i):e(null,n.binary?t:t.toString("utf8"))}):c.xhr(l,n,e):d(c,this,l,n)}return c.xhr=function(n,e,r){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(i.readyState===4){if(i.status!==0&&i.status!==200)return r(Error("status "+i.status));if(e.binary){var f=i.response;if(!f){f=[];for(var s=0;s<i.responseText.length;++s)f.push(i.responseText.charCodeAt(s)&255)}return r(null,typeof Uint8Array<"u"?new Uint8Array(f):f)}return r(null,i.responseText)}},e.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",n),i.send()},fetch_1}var path={},hasRequiredPath;function requirePath(){return hasRequiredPath||(hasRequiredPath=1,function(d){var u=d,h=u.isAbsolute=function(n){return/^(?:\/|\w+:)/.test(n)},c=u.normalize=function(n){n=n.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var e=n.split("/"),r=h(n),i="";r&&(i=e.shift()+"/");for(var t=0;t<e.length;)e[t]===".."?t>0&&e[t-1]!==".."?e.splice(--t,2):r?e.splice(t,1):++t:e[t]==="."?e.splice(t,1):++t;return i+e.join("/")};u.resolve=function(n,e,r){return r||(e=c(e)),h(e)?e:(r||(n=c(n)),(n=n.replace(/(?:\/|^)[^/]+$/,"")).length?c(n+"/"+e):e)}}(path)),path}var namespace,hasRequiredNamespace;function requireNamespace(){if(hasRequiredNamespace)return namespace;hasRequiredNamespace=1,namespace=i;var d=requireObject();((i.prototype=Object.create(d.prototype)).constructor=i).className="Namespace";var u=requireField(),h=requireUtil(),c=requireOneof(),l,n,e;i.fromJSON=function(s,a){return new i(s,a.options).addJSON(a.nested)};function r(f,s){if(f&&f.length){for(var a={},o=0;o<f.length;++o)a[f[o].name]=f[o].toJSON(s);return a}}i.arrayToJSON=r,i.isReservedId=function(s,a){if(s){for(var o=0;o<s.length;++o)if(typeof s[o]!="string"&&s[o][0]<=a&&s[o][1]>a)return!0}return!1},i.isReservedName=function(s,a){if(s){for(var o=0;o<s.length;++o)if(s[o]===a)return!0}return!1};function i(f,s){d.call(this,f,s),this.nested=void 0,this._nestedArray=null,this._lookupCache={},this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function t(f){f._nestedArray=null,f._lookupCache={};for(var s=f;s=s.parent;)s._lookupCache={};return f}return Object.defineProperty(i.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=h.toArray(this.nested))}}),i.prototype.toJSON=function(s){return h.toObject(["options",this.options,"nested",r(this.nestedArray,s)])},i.prototype.addJSON=function(s){var a=this;if(s)for(var o=Object.keys(s),p=0,y;p<o.length;++p)y=s[o[p]],a.add((y.fields!==void 0?l.fromJSON:y.values!==void 0?e.fromJSON:y.methods!==void 0?n.fromJSON:y.id!==void 0?u.fromJSON:i.fromJSON)(o[p],y));return this},i.prototype.get=function(s){return this.nested&&this.nested[s]||null},i.prototype.getEnum=function(s){if(this.nested&&this.nested[s]instanceof e)return this.nested[s].values;throw Error("no such enum: "+s)},i.prototype.add=function(s){if(!(s instanceof u&&s.extend!==void 0||s instanceof l||s instanceof c||s instanceof e||s instanceof n||s instanceof i))throw TypeError("object must be a valid nested object");if(!this.nested)this.nested={};else{var a=this.get(s.name);if(a)if(a instanceof i&&s instanceof i&&!(a instanceof l||a instanceof n)){for(var o=a.nestedArray,p=0;p<o.length;++p)s.add(o[p]);this.remove(a),this.nested||(this.nested={}),s.setOptions(a.options,!0)}else throw Error("duplicate name '"+s.name+"' in "+this)}this.nested[s.name]=s,this instanceof l||this instanceof n||this instanceof e||this instanceof u||s._edition||(s._edition=s._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var y=this;y=y.parent;)y._needsRecursiveFeatureResolution=!0,y._needsRecursiveResolve=!0;return s.onAdd(this),t(this)},i.prototype.remove=function(s){if(!(s instanceof d))throw TypeError("object must be a ReflectionObject");if(s.parent!==this)throw Error(s+" is not a member of "+this);return delete this.nested[s.name],Object.keys(this.nested).length||(this.nested=void 0),s.onRemove(this),t(this)},i.prototype.define=function(s,a){if(h.isString(s))s=s.split(".");else if(!Array.isArray(s))throw TypeError("illegal path");if(s&&s.length&&s[0]==="")throw Error("path must be relative");for(var o=this;s.length>0;){var p=s.shift();if(o.nested&&o.nested[p]){if(o=o.nested[p],!(o instanceof i))throw Error("path conflicts with non-namespace objects")}else o.add(o=new i(p))}return a&&o.addJSON(a),o},i.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var s=this.nestedArray,a=0;for(this.resolve();a<s.length;)s[a]instanceof i?s[a++].resolveAll():s[a++].resolve();return this._needsRecursiveResolve=!1,this},i.prototype._resolveFeaturesRecursive=function(s){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,s=this._edition||s,d.prototype._resolveFeaturesRecursive.call(this,s),this.nestedArray.forEach(a=>{a._resolveFeaturesRecursive(s)}),this):this},i.prototype.lookup=function(s,a,o){if(typeof a=="boolean"?(o=a,a=void 0):a&&!Array.isArray(a)&&(a=[a]),h.isString(s)&&s.length){if(s===".")return this.root;s=s.split(".")}else if(!s.length)return this;var p=s.join(".");if(s[0]==="")return this.root.lookup(s.slice(1),a);var y=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+p];if(y&&(!a||a.indexOf(y.constructor)>-1)||(y=this._lookupImpl(s,p),y&&(!a||a.indexOf(y.constructor)>-1)))return y;if(o)return null;for(var b=this;b.parent;){if(y=b.parent._lookupImpl(s,p),y&&(!a||a.indexOf(y.constructor)>-1))return y;b=b.parent}return null},i.prototype._lookupImpl=function(s,a){if(Object.prototype.hasOwnProperty.call(this._lookupCache,a))return this._lookupCache[a];var o=this.get(s[0]),p=null;if(o)s.length===1?p=o:o instanceof i&&(s=s.slice(1),p=o._lookupImpl(s,s.join(".")));else for(var y=0;y<this.nestedArray.length;++y)this._nestedArray[y]instanceof i&&(o=this._nestedArray[y]._lookupImpl(s,a))&&(p=o);return this._lookupCache[a]=p,p},i.prototype.lookupType=function(s){var a=this.lookup(s,[l]);if(!a)throw Error("no such type: "+s);return a},i.prototype.lookupEnum=function(s){var a=this.lookup(s,[e]);if(!a)throw Error("no such Enum '"+s+"' in "+this);return a},i.prototype.lookupTypeOrEnum=function(s){var a=this.lookup(s,[l,e]);if(!a)throw Error("no such Type or Enum '"+s+"' in "+this);return a},i.prototype.lookupService=function(s){var a=this.lookup(s,[n]);if(!a)throw Error("no such Service '"+s+"' in "+this);return a},i._configure=function(f,s,a){l=f,n=s,e=a},namespace}var mapfield,hasRequiredMapfield;function requireMapfield(){if(hasRequiredMapfield)return mapfield;hasRequiredMapfield=1,mapfield=c;var d=requireField();((c.prototype=Object.create(d.prototype)).constructor=c).className="MapField";var u=requireTypes(),h=requireUtil();function c(l,n,e,r,i,t){if(d.call(this,l,n,r,void 0,void 0,i,t),!h.isString(e))throw TypeError("keyType must be a string");this.keyType=e,this.resolvedKeyType=null,this.map=!0}return c.fromJSON=function(n,e){return new c(n,e.id,e.keyType,e.type,e.options,e.comment)},c.prototype.toJSON=function(n){var e=n?!!n.keepComments:!1;return h.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",e?this.comment:void 0])},c.prototype.resolve=function(){if(this.resolved)return this;if(u.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return d.prototype.resolve.call(this)},c.d=function(n,e,r){return typeof r=="function"?r=h.decorateType(r).name:r&&typeof r=="object"&&(r=h.decorateEnum(r).name),function(t,f){h.decorateType(t.constructor).add(new c(f,n,e,r))}},mapfield}var method,hasRequiredMethod;function requireMethod(){if(hasRequiredMethod)return method;hasRequiredMethod=1,method=h;var d=requireObject();((h.prototype=Object.create(d.prototype)).constructor=h).className="Method";var u=requireUtil();function h(c,l,n,e,r,i,t,f,s){if(u.isObject(r)?(t=r,r=i=void 0):u.isObject(i)&&(t=i,i=void 0),!(l===void 0||u.isString(l)))throw TypeError("type must be a string");if(!u.isString(n))throw TypeError("requestType must be a string");if(!u.isString(e))throw TypeError("responseType must be a string");d.call(this,c,t),this.type=l||"rpc",this.requestType=n,this.requestStream=r?!0:void 0,this.responseType=e,this.responseStream=i?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=f,this.parsedOptions=s}return h.fromJSON=function(l,n){return new h(l,n.type,n.requestType,n.responseType,n.requestStream,n.responseStream,n.options,n.comment,n.parsedOptions)},h.prototype.toJSON=function(l){var n=l?!!l.keepComments:!1;return u.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",n?this.comment:void 0,"parsedOptions",this.parsedOptions])},h.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),d.prototype.resolve.call(this))},method}var service,hasRequiredService;function requireService(){if(hasRequiredService)return service;hasRequiredService=1,service=l;var d=requireNamespace();((l.prototype=Object.create(d.prototype)).constructor=l).className="Service";var u=requireMethod(),h=requireUtil(),c=requireRpc();function l(e,r){d.call(this,e,r),this.methods={},this._methodsArray=null}l.fromJSON=function(r,i){var t=new l(r,i.options);if(i.methods)for(var f=Object.keys(i.methods),s=0;s<f.length;++s)t.add(u.fromJSON(f[s],i.methods[f[s]]));return i.nested&&t.addJSON(i.nested),i.edition&&(t._edition=i.edition),t.comment=i.comment,t._defaultEdition="proto3",t},l.prototype.toJSON=function(r){var i=d.prototype.toJSON.call(this,r),t=r?!!r.keepComments:!1;return h.toObject(["edition",this._editionToJSON(),"options",i&&i.options||void 0,"methods",d.arrayToJSON(this.methodsArray,r)||{},"nested",i&&i.nested||void 0,"comment",t?this.comment:void 0])},Object.defineProperty(l.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=h.toArray(this.methods))}});function n(e){return e._methodsArray=null,e}return l.prototype.get=function(r){return this.methods[r]||d.prototype.get.call(this,r)},l.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;d.prototype.resolve.call(this);for(var r=this.methodsArray,i=0;i<r.length;++i)r[i].resolve();return this},l.prototype._resolveFeaturesRecursive=function(r){return this._needsRecursiveFeatureResolution?(r=this._edition||r,d.prototype._resolveFeaturesRecursive.call(this,r),this.methodsArray.forEach(i=>{i._resolveFeaturesRecursive(r)}),this):this},l.prototype.add=function(r){if(this.get(r.name))throw Error("duplicate name '"+r.name+"' in "+this);return r instanceof u?(this.methods[r.name]=r,r.parent=this,n(this)):d.prototype.add.call(this,r)},l.prototype.remove=function(r){if(r instanceof u){if(this.methods[r.name]!==r)throw Error(r+" is not a member of "+this);return delete this.methods[r.name],r.parent=null,n(this)}return d.prototype.remove.call(this,r)},l.prototype.create=function(r,i,t){for(var f=new c.Service(r,i,t),s=0,a;s<this.methodsArray.length;++s){var o=h.lcFirst((a=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");f[o]=h.codegen(["r","c"],h.isReserved(o)?o+"_":o)("return this.rpcCall(m,q,s,r,c)")({m:a,q:a.resolvedRequestType.ctor,s:a.resolvedResponseType.ctor})}return f},service}var message,hasRequiredMessage;function requireMessage(){if(hasRequiredMessage)return message;hasRequiredMessage=1,message=u;var d=requireMinimal();function u(h){if(h)for(var c=Object.keys(h),l=0;l<c.length;++l){var n=c[l];n!=="__proto__"&&(this[n]=h[n])}}return u.create=function(c){return this.$type.create(c)},u.encode=function(c,l){return this.$type.encode(c,l)},u.encodeDelimited=function(c,l){return this.$type.encodeDelimited(c,l)},u.decode=function(c){return this.$type.decode(c)},u.decodeDelimited=function(c){return this.$type.decodeDelimited(c)},u.verify=function(c){return this.$type.verify(c)},u.fromObject=function(c){return this.$type.fromObject(c)},u.toObject=function(c,l){return this.$type.toObject(c,l)},u.prototype.toJSON=function(){return this.$type.toObject(this,d.toJSONOptions)},message}var decoder_1,hasRequiredDecoder;function requireDecoder(){if(hasRequiredDecoder)return decoder_1;hasRequiredDecoder=1,decoder_1=l;var d=require_enum(),u=requireTypes(),h=requireUtil();function c(n){return"missing required '"+n.name+"'"}function l(n){for(var e=h.codegen(["r","l","e"],n.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(n.fieldsArray.filter(function(a){return a.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),r=0;r<n.fieldsArray.length;++r){var i=n._fieldsArray[r].resolve(),t=i.resolvedType instanceof d?"int32":i.type,f="m"+h.safeProp(i.name);e("case %i: {",i.id),i.map?(e("if(%s===util.emptyObject)",f)("%s={}",f)("var c2 = r.uint32()+r.pos"),u.defaults[i.keyType]!==void 0?e("k=%j",u.defaults[i.keyType]):e("k=null"),u.defaults[t]!==void 0?e("value=%j",u.defaults[t]):e("value=null"),e("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",i.keyType)("case 2:"),u.basic[t]===void 0?e("value=types[%i].decode(r,r.uint32())",r):e("value=r.%s()",t),e("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),u.long[i.keyType]!==void 0?e('%s[typeof k==="object"?util.longToHash(k):k]=value',f):e("%s[k]=value",f)):i.repeated?(e("if(!(%s&&%s.length))",f,f)("%s=[]",f),u.packed[t]!==void 0&&e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",f,t)("}else"),u.basic[t]===void 0?e(i.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4)))":"%s.push(types[%i].decode(r,r.uint32()))",f,r):e("%s.push(r.%s())",f,t)):u.basic[t]===void 0?e(i.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4))":"%s=types[%i].decode(r,r.uint32())",f,r):e("%s=r.%s()",f,t),e("break")("}")}for(e("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<n._fieldsArray.length;++r){var s=n._fieldsArray[r];s.required&&e("if(!m.hasOwnProperty(%j))",s.name)("throw util.ProtocolError(%j,{instance:m})",c(s))}return e("return m")}return decoder_1}var verifier_1,hasRequiredVerifier;function requireVerifier(){if(hasRequiredVerifier)return verifier_1;hasRequiredVerifier=1,verifier_1=n;var d=require_enum(),u=requireUtil();function h(e,r){return e.name+": "+r+(e.repeated&&r!=="array"?"[]":e.map&&r!=="object"?"{k:"+e.keyType+"}":"")+" expected"}function c(e,r,i,t){if(r.resolvedType)if(r.resolvedType instanceof d){e("switch(%s){",t)("default:")("return%j",h(r,"enum value"));for(var f=Object.keys(r.resolvedType.values),s=0;s<f.length;++s)e("case %i:",r.resolvedType.values[f[s]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",i,t)("if(e)")("return%j+e",r.name+".")("}");else switch(r.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",t)("return%j",h(r,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",t,t,t,t)("return%j",h(r,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',t)("return%j",h(r,"number"));break;case"bool":e('if(typeof %s!=="boolean")',t)("return%j",h(r,"boolean"));break;case"string":e("if(!util.isString(%s))",t)("return%j",h(r,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',t,t,t)("return%j",h(r,"buffer"));break}return e}function l(e,r,i){switch(r.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",i)("return%j",h(r,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",i)("return%j",h(r,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",i)("return%j",h(r,"boolean key"));break}return e}function n(e){var r=u.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),i=e.oneofsArray,t={};i.length&&r("var p={}");for(var f=0;f<e.fieldsArray.length;++f){var s=e._fieldsArray[f].resolve(),a="m"+u.safeProp(s.name);if(s.optional&&r("if(%s!=null&&m.hasOwnProperty(%j)){",a,s.name),s.map)r("if(!util.isObject(%s))",a)("return%j",h(s,"object"))("var k=Object.keys(%s)",a)("for(var i=0;i<k.length;++i){"),l(r,s,"k[i]"),c(r,s,f,a+"[k[i]]")("}");else if(s.repeated)r("if(!Array.isArray(%s))",a)("return%j",h(s,"array"))("for(var i=0;i<%s.length;++i){",a),c(r,s,f,a+"[i]")("}");else{if(s.partOf){var o=u.safeProp(s.partOf.name);t[s.partOf.name]===1&&r("if(p%s===1)",o)("return%j",s.partOf.name+": multiple values"),t[s.partOf.name]=1,r("p%s=1",o)}c(r,s,f,a)}s.optional&&r("}")}return r("return null")}return verifier_1}var converter={},hasRequiredConverter;function requireConverter(){return hasRequiredConverter||(hasRequiredConverter=1,function(d){var u=d,h=require_enum(),c=requireUtil();function l(e,r,i,t){var f=!1;if(r.resolvedType)if(r.resolvedType instanceof h){e("switch(d%s){",t);for(var s=r.resolvedType.values,a=Object.keys(s),o=0;o<a.length;++o)s[a[o]]===r.typeDefault&&!f&&(e("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',t,t,t),r.repeated||e("break"),f=!0),e("case%j:",a[o])("case %i:",s[a[o]])("m%s=%j",t,s[a[o]])("break");e("}")}else e('if(typeof d%s!=="object")',t)("throw TypeError(%j)",r.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",t,i,t);else{var p=!1;switch(r.type){case"double":case"float":e("m%s=Number(d%s)",t,t);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",t,t);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",t,t);break;case"uint64":p=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",t,t,p)('else if(typeof d%s==="string")',t)("m%s=parseInt(d%s,10)",t,t)('else if(typeof d%s==="number")',t)("m%s=d%s",t,t)('else if(typeof d%s==="object")',t)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",t,t,t,p?"true":"");break;case"bytes":e('if(typeof d%s==="string")',t)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",t,t,t)("else if(d%s.length >= 0)",t)("m%s=d%s",t,t);break;case"string":e("m%s=String(d%s)",t,t);break;case"bool":e("m%s=Boolean(d%s)",t,t);break}}return e}u.fromObject=function(r){var i=r.fieldsArray,t=c.codegen(["d"],r.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!i.length)return t("return new this.ctor");t("var m=new this.ctor");for(var f=0;f<i.length;++f){var s=i[f].resolve(),a=c.safeProp(s.name);s.map?(t("if(d%s){",a)('if(typeof d%s!=="object")',a)("throw TypeError(%j)",s.fullName+": object expected")("m%s={}",a)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",a),l(t,s,f,a+"[ks[i]]")("}")("}")):s.repeated?(t("if(d%s){",a)("if(!Array.isArray(d%s))",a)("throw TypeError(%j)",s.fullName+": array expected")("m%s=[]",a)("for(var i=0;i<d%s.length;++i){",a),l(t,s,f,a+"[i]")("}")("}")):(s.resolvedType instanceof h||t("if(d%s!=null){",a),l(t,s,f,a),s.resolvedType instanceof h||t("}"))}return t("return m")};function n(e,r,i,t){if(r.resolvedType)r.resolvedType instanceof h?e("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",t,i,t,t,i,t,t):e("d%s=types[%i].toObject(m%s,o)",t,i,t);else{var f=!1;switch(r.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",t,t,t,t);break;case"uint64":f=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',t)("d%s=o.longs===String?String(m%s):m%s",t,t,t)("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",t,t,t,t,f?"true":"",t);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",t,t,t,t,t);break;default:e("d%s=m%s",t,t);break}}return e}u.toObject=function(r){var i=r.fieldsArray.slice().sort(c.compareFieldsById);if(!i.length)return c.codegen()("return {}");for(var t=c.codegen(["m","o"],r.name+"$toObject")("if(!o)")("o={}")("var d={}"),f=[],s=[],a=[],o=0;o<i.length;++o)i[o].partOf||(i[o].resolve().repeated?f:i[o].map?s:a).push(i[o]);if(f.length){for(t("if(o.arrays||o.defaults){"),o=0;o<f.length;++o)t("d%s=[]",c.safeProp(f[o].name));t("}")}if(s.length){for(t("if(o.objects||o.defaults){"),o=0;o<s.length;++o)t("d%s={}",c.safeProp(s[o].name));t("}")}if(a.length){for(t("if(o.defaults){"),o=0;o<a.length;++o){var p=a[o],y=c.safeProp(p.name);if(p.resolvedType instanceof h)t("d%s=o.enums===String?%j:%j",y,p.resolvedType.valuesById[p.typeDefault],p.typeDefault);else if(p.long)t("if(util.Long){")("var n=new util.Long(%i,%i,%j)",p.typeDefault.low,p.typeDefault.high,p.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",y)("}else")("d%s=o.longs===String?%j:%i",y,p.typeDefault.toString(),p.typeDefault.toNumber());else if(p.bytes){var b="["+Array.prototype.slice.call(p.typeDefault).join(",")+"]";t("if(o.bytes===String)d%s=%j",y,String.fromCharCode.apply(String,p.typeDefault))("else{")("d%s=%s",y,b)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",y,y)("}")}else t("d%s=%j",y,p.typeDefault)}t("}")}var v=!1;for(o=0;o<i.length;++o){var p=i[o],m=r._fieldsArray.indexOf(p),y=c.safeProp(p.name);p.map?(v||(v=!0,t("var ks2")),t("if(m%s&&(ks2=Object.keys(m%s)).length){",y,y)("d%s={}",y)("for(var j=0;j<ks2.length;++j){"),n(t,p,m,y+"[ks2[j]]")("}")):p.repeated?(t("if(m%s&&m%s.length){",y,y)("d%s=[]",y)("for(var j=0;j<m%s.length;++j){",y),n(t,p,m,y+"[j]")("}")):(t("if(m%s!=null&&m.hasOwnProperty(%j)){",y,p.name),n(t,p,m,y),p.partOf&&t("if(o.oneofs)")("d%s=%j",c.safeProp(p.partOf.name),p.name)),t("}")}return t("return d")}}(converter)),converter}var wrappers={},hasRequiredWrappers;function requireWrappers(){return hasRequiredWrappers||(hasRequiredWrappers=1,function(d){var u=d,h=requireMessage();u[".google.protobuf.Any"]={fromObject:function(c){if(c&&c["@type"]){var l=c["@type"].substring(c["@type"].lastIndexOf("/")+1),n=this.lookup(l);if(n){var e=c["@type"].charAt(0)==="."?c["@type"].slice(1):c["@type"];return e.indexOf("/")===-1&&(e="/"+e),this.create({type_url:e,value:n.encode(n.fromObject(c)).finish()})}}return this.fromObject(c)},toObject:function(c,l){var n="type.googleapis.com/",e="",r="";if(l&&l.json&&c.type_url&&c.value){r=c.type_url.substring(c.type_url.lastIndexOf("/")+1),e=c.type_url.substring(0,c.type_url.lastIndexOf("/")+1);var i=this.lookup(r);i&&(c=i.decode(c.value))}if(!(c instanceof this.ctor)&&c instanceof h){var t=c.$type.toObject(c,l),f=c.$type.fullName[0]==="."?c.$type.fullName.slice(1):c.$type.fullName;return e===""&&(e=n),r=e+f,t["@type"]=r,t}return this.toObject(c,l)}}}(wrappers)),wrappers}var type,hasRequiredType;function requireType(){if(hasRequiredType)return type;hasRequiredType=1,type=y;var d=requireNamespace();((y.prototype=Object.create(d.prototype)).constructor=y).className="Type";var u=require_enum(),h=requireOneof(),c=requireField(),l=requireMapfield(),n=requireService(),e=requireMessage(),r=requireReader(),i=requireWriter(),t=requireUtil(),f=requireEncoder(),s=requireDecoder(),a=requireVerifier(),o=requireConverter(),p=requireWrappers();function y(v,m){v=v.replace(/\W/g,""),d.call(this,v,m),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(y.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var v=Object.keys(this.fields),m=0;m<v.length;++m){var _=this.fields[v[m]],E=_.id;if(this._fieldsById[E])throw Error("duplicate id "+E+" in "+this);this._fieldsById[E]=_}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=t.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=t.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=y.generateConstructor(this)())},set:function(v){var m=v.prototype;m instanceof e||((v.prototype=new e).constructor=v,t.merge(v.prototype,m)),v.$type=v.prototype.$type=this,t.merge(v,e,!0),this._ctor=v;for(var _=0;_<this.fieldsArray.length;++_)this._fieldsArray[_].resolve();var E={};for(_=0;_<this.oneofsArray.length;++_)E[this._oneofsArray[_].resolve().name]={get:t.oneOfGetter(this._oneofsArray[_].oneof),set:t.oneOfSetter(this._oneofsArray[_].oneof)};_&&Object.defineProperties(v.prototype,E)}}}),y.generateConstructor=function(m){for(var _=t.codegen(["p"],m.name),E=0,k;E<m.fieldsArray.length;++E)(k=m._fieldsArray[E]).map?_("this%s={}",t.safeProp(k.name)):k.repeated&&_("this%s=[]",t.safeProp(k.name));return _("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")};function b(v){return v._fieldsById=v._fieldsArray=v._oneofsArray=null,delete v.encode,delete v.decode,delete v.verify,v}return y.fromJSON=function(m,_){var E=new y(m,_.options);E.extensions=_.extensions,E.reserved=_.reserved;for(var k=Object.keys(_.fields),C=0;C<k.length;++C)E.add((typeof _.fields[k[C]].keyType<"u"?l.fromJSON:c.fromJSON)(k[C],_.fields[k[C]]));if(_.oneofs)for(k=Object.keys(_.oneofs),C=0;C<k.length;++C)E.add(h.fromJSON(k[C],_.oneofs[k[C]]));if(_.nested)for(k=Object.keys(_.nested),C=0;C<k.length;++C){var j=_.nested[k[C]];E.add((j.id!==void 0?c.fromJSON:j.fields!==void 0?y.fromJSON:j.values!==void 0?u.fromJSON:j.methods!==void 0?n.fromJSON:d.fromJSON)(k[C],j))}return _.extensions&&_.extensions.length&&(E.extensions=_.extensions),_.reserved&&_.reserved.length&&(E.reserved=_.reserved),_.group&&(E.group=!0),_.comment&&(E.comment=_.comment),_.edition&&(E._edition=_.edition),E._defaultEdition="proto3",E},y.prototype.toJSON=function(m){var _=d.prototype.toJSON.call(this,m),E=m?!!m.keepComments:!1;return t.toObject(["edition",this._editionToJSON(),"options",_&&_.options||void 0,"oneofs",d.arrayToJSON(this.oneofsArray,m),"fields",d.arrayToJSON(this.fieldsArray.filter(function(k){return!k.declaringField}),m)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",_&&_.nested||void 0,"comment",E?this.comment:void 0])},y.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;d.prototype.resolveAll.call(this);var m=this.oneofsArray;for(E=0;E<m.length;)m[E++].resolve();for(var _=this.fieldsArray,E=0;E<_.length;)_[E++].resolve();return this},y.prototype._resolveFeaturesRecursive=function(m){return this._needsRecursiveFeatureResolution?(m=this._edition||m,d.prototype._resolveFeaturesRecursive.call(this,m),this.oneofsArray.forEach(_=>{_._resolveFeatures(m)}),this.fieldsArray.forEach(_=>{_._resolveFeatures(m)}),this):this},y.prototype.get=function(m){return this.fields[m]||this.oneofs&&this.oneofs[m]||this.nested&&this.nested[m]||null},y.prototype.add=function(m){if(this.get(m.name))throw Error("duplicate name '"+m.name+"' in "+this);if(m instanceof c&&m.extend===void 0){if(this._fieldsById?this._fieldsById[m.id]:this.fieldsById[m.id])throw Error("duplicate id "+m.id+" in "+this);if(this.isReservedId(m.id))throw Error("id "+m.id+" is reserved in "+this);if(this.isReservedName(m.name))throw Error("name '"+m.name+"' is reserved in "+this);return m.parent&&m.parent.remove(m),this.fields[m.name]=m,m.message=this,m.onAdd(this),b(this)}return m instanceof h?(this.oneofs||(this.oneofs={}),this.oneofs[m.name]=m,m.onAdd(this),b(this)):d.prototype.add.call(this,m)},y.prototype.remove=function(m){if(m instanceof c&&m.extend===void 0){if(!this.fields||this.fields[m.name]!==m)throw Error(m+" is not a member of "+this);return delete this.fields[m.name],m.parent=null,m.onRemove(this),b(this)}if(m instanceof h){if(!this.oneofs||this.oneofs[m.name]!==m)throw Error(m+" is not a member of "+this);return delete this.oneofs[m.name],m.parent=null,m.onRemove(this),b(this)}return d.prototype.remove.call(this,m)},y.prototype.isReservedId=function(m){return d.isReservedId(this.reserved,m)},y.prototype.isReservedName=function(m){return d.isReservedName(this.reserved,m)},y.prototype.create=function(m){return new this.ctor(m)},y.prototype.setup=function(){for(var m=this.fullName,_=[],E=0;E<this.fieldsArray.length;++E)_.push(this._fieldsArray[E].resolve().resolvedType);this.encode=f(this)({Writer:i,types:_,util:t}),this.decode=s(this)({Reader:r,types:_,util:t}),this.verify=a(this)({types:_,util:t}),this.fromObject=o.fromObject(this)({types:_,util:t}),this.toObject=o.toObject(this)({types:_,util:t});var k=p[m];if(k){var C=Object.create(this);C.fromObject=this.fromObject,this.fromObject=k.fromObject.bind(C),C.toObject=this.toObject,this.toObject=k.toObject.bind(C)}return this},y.prototype.encode=function(m,_){return this.setup().encode(m,_)},y.prototype.encodeDelimited=function(m,_){return this.encode(m,_&&_.len?_.fork():_).ldelim()},y.prototype.decode=function(m,_){return this.setup().decode(m,_)},y.prototype.decodeDelimited=function(m){return m instanceof r||(m=r.create(m)),this.decode(m,m.uint32())},y.prototype.verify=function(m){return this.setup().verify(m)},y.prototype.fromObject=function(m){return this.setup().fromObject(m)},y.prototype.toObject=function(m,_){return this.setup().toObject(m,_)},y.d=function(m){return function(E){t.decorateType(E,m)}},type}var root$1,hasRequiredRoot;function requireRoot(){if(hasRequiredRoot)return root$1;hasRequiredRoot=1,root$1=i;var d=requireNamespace();((i.prototype=Object.create(d.prototype)).constructor=i).className="Root";var u=requireField(),h=require_enum(),c=requireOneof(),l=requireUtil(),n,e,r;function i(a){d.call(this,"",a),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}i.fromJSON=function(o,p){return p||(p=new i),o.options&&p.setOptions(o.options),p.addJSON(o.nested).resolveAll()},i.prototype.resolvePath=l.path.resolve,i.prototype.fetch=l.fetch;function t(){}i.prototype.load=function a(o,p,y){typeof p=="function"&&(y=p,p=void 0);var b=this;if(!y)return l.asPromise(a,b,o,p);var v=y===t;function m(P,D){if(y){if(v)throw P;D&&D.resolveAll();var S=y;y=null,S(P,D)}}function _(P){var D=P.lastIndexOf("google/protobuf/");if(D>-1){var S=P.substring(D);if(S in r)return S}return null}function E(P,D){try{if(l.isString(D)&&D.charAt(0)==="{"&&(D=JSON.parse(D)),!l.isString(D))b.setOptions(D.options).addJSON(D.nested);else{e.filename=P;var S=e(D,b,p),J,U=0;if(S.imports)for(;U<S.imports.length;++U)(J=_(S.imports[U])||b.resolvePath(P,S.imports[U]))&&k(J);if(S.weakImports)for(U=0;U<S.weakImports.length;++U)(J=_(S.weakImports[U])||b.resolvePath(P,S.weakImports[U]))&&k(J,!0)}}catch(T){m(T)}!v&&!C&&m(null,b)}function k(P,D){if(P=_(P)||P,!(b.files.indexOf(P)>-1)){if(b.files.push(P),P in r){v?E(P,r[P]):(++C,setTimeout(function(){--C,E(P,r[P])}));return}if(v){var S;try{S=l.fs.readFileSync(P).toString("utf8")}catch(J){D||m(J);return}E(P,S)}else++C,b.fetch(P,function(J,U){if(--C,!!y){if(J){D?C||m(null,b):m(J);return}E(P,U)}})}}var C=0;l.isString(o)&&(o=[o]);for(var j=0,X;j<o.length;++j)(X=b.resolvePath("",o[j]))&&k(X);return v?(b.resolveAll(),b):(C||m(null,b),b)},i.prototype.loadSync=function(o,p){if(!l.isNode)throw Error("not supported");return this.load(o,p,t)},i.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(o){return"'extend "+o.extend+"' in "+o.parent.fullName}).join(", "));return d.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function s(a,o){var p=o.parent.lookup(o.extend);if(p){var y=new u(o.fullName,o.id,o.type,o.rule,void 0,o.options);return p.get(y.name)||(y.declaringField=o,o.extensionField=y,p.add(y)),!0}return!1}return i.prototype._handleAdd=function(o){if(o instanceof u)o.extend!==void 0&&!o.extensionField&&(s(this,o)||this.deferred.push(o));else if(o instanceof h)f.test(o.name)&&(o.parent[o.name]=o.values);else if(!(o instanceof c)){if(o instanceof n)for(var p=0;p<this.deferred.length;)s(this,this.deferred[p])?this.deferred.splice(p,1):++p;for(var y=0;y<o.nestedArray.length;++y)this._handleAdd(o._nestedArray[y]);f.test(o.name)&&(o.parent[o.name]=o)}(o instanceof n||o instanceof h||o instanceof u)&&(this._fullyQualifiedObjects[o.fullName]=o)},i.prototype._handleRemove=function(o){if(o instanceof u){if(o.extend!==void 0)if(o.extensionField)o.extensionField.parent.remove(o.extensionField),o.extensionField=null;else{var p=this.deferred.indexOf(o);p>-1&&this.deferred.splice(p,1)}}else if(o instanceof h)f.test(o.name)&&delete o.parent[o.name];else if(o instanceof d){for(var y=0;y<o.nestedArray.length;++y)this._handleRemove(o._nestedArray[y]);f.test(o.name)&&delete o.parent[o.name]}delete this._fullyQualifiedObjects[o.fullName]},i._configure=function(a,o,p){n=a,e=o,r=p},root$1}var hasRequiredUtil;function requireUtil(){if(hasRequiredUtil)return util.exports;hasRequiredUtil=1;var d=util.exports=requireMinimal(),u=requireRoots(),h,c;d.codegen=requireCodegen(),d.fetch=requireFetch(),d.path=requirePath(),d.fs=d.inquire("fs"),d.toArray=function(t){if(t){for(var f=Object.keys(t),s=new Array(f.length),a=0;a<f.length;)s[a]=t[f[a++]];return s}return[]},d.toObject=function(t){for(var f={},s=0;s<t.length;){var a=t[s++],o=t[s++];o!==void 0&&(f[a]=o)}return f};var l=/\\/g,n=/"/g;d.isReserved=function(t){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(t)},d.safeProp=function(t){return!/^[$\w_]+$/.test(t)||d.isReserved(t)?'["'+t.replace(l,"\\\\").replace(n,'\\"')+'"]':"."+t},d.ucFirst=function(t){return t.charAt(0).toUpperCase()+t.substring(1)};var e=/_([a-z])/g;d.camelCase=function(t){return t.substring(0,1)+t.substring(1).replace(e,function(f,s){return s.toUpperCase()})},d.compareFieldsById=function(t,f){return t.id-f.id},d.decorateType=function(t,f){if(t.$type)return f&&t.$type.name!==f&&(d.decorateRoot.remove(t.$type),t.$type.name=f,d.decorateRoot.add(t.$type)),t.$type;h||(h=requireType());var s=new h(f||t.name);return d.decorateRoot.add(s),s.ctor=t,Object.defineProperty(t,"$type",{value:s,enumerable:!1}),Object.defineProperty(t.prototype,"$type",{value:s,enumerable:!1}),s};var r=0;return d.decorateEnum=function(t){if(t.$type)return t.$type;c||(c=require_enum());var f=new c("Enum"+r++,t);return d.decorateRoot.add(f),Object.defineProperty(t,"$type",{value:f,enumerable:!1}),f},d.setProperty=function(t,f,s,a){function o(p,y,b){var v=y.shift();if(v==="__proto__"||v==="prototype")return p;if(y.length>0)p[v]=o(p[v]||{},y,b);else{var m=p[v];if(m&&a)return p;m&&(b=[].concat(m).concat(b)),p[v]=b}return p}if(typeof t!="object")throw TypeError("dst must be an object");if(!f)throw TypeError("path must be specified");return f=f.split("."),o(t,f,s)},Object.defineProperty(d,"decorateRoot",{get:function(){return u.decorated||(u.decorated=new(requireRoot()))}}),util.exports}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(d){var u=d,h=requireUtil(),c=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function l(n,e){var r=0,i={};for(e|=0;r<n.length;)i[c[r+e]]=n[r++];return i}u.basic=l([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),u.defaults=l([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",h.emptyArray,null]),u.long=l([0,0,0,1,1],7),u.mapKey=l([0,0,0,5,5,0,0,0,1,1,0,2],2),u.packed=l([1,5,0,0,0,5,5,0,0,0,1,1,0])}(types)),types}var field,hasRequiredField;function requireField(){if(hasRequiredField)return field;hasRequiredField=1,field=e;var d=requireObject();((e.prototype=Object.create(d.prototype)).constructor=e).className="Field";var u=require_enum(),h=requireTypes(),c=requireUtil(),l,n=/^required|optional|repeated$/;e.fromJSON=function(i,t){var f=new e(i,t.id,t.type,t.rule,t.extend,t.options,t.comment);return t.edition&&(f._edition=t.edition),f._defaultEdition="proto3",f};function e(r,i,t,f,s,a,o){if(c.isObject(f)?(o=s,a=f,f=s=void 0):c.isObject(s)&&(o=a,a=s,s=void 0),d.call(this,r,a),!c.isInteger(i)||i<0)throw TypeError("id must be a non-negative integer");if(!c.isString(t))throw TypeError("type must be a string");if(f!==void 0&&!n.test(f=f.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(s!==void 0&&!c.isString(s))throw TypeError("extend must be a string");f==="proto3_optional"&&(f="optional"),this.rule=f&&f!=="optional"?f:void 0,this.type=t,this.id=i,this.extend=s||void 0,this.repeated=f==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=c.Long?h.long[t]!==void 0:!1,this.bytes=t==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=o}return Object.defineProperty(e.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(e.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(e.prototype,"delimited",{get:function(){return this.resolvedType instanceof l&&this._features.message_encoding==="DELIMITED"}}),Object.defineProperty(e.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}}),Object.defineProperty(e.prototype,"hasPresence",{get:function(){return this.repeated||this.map?!1:this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}}),e.prototype.setOption=function(i,t,f){return d.prototype.setOption.call(this,i,t,f)},e.prototype.toJSON=function(i){var t=i?!!i.keepComments:!1;return c.toObject(["edition",this._editionToJSON(),"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])},e.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=h.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof l?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 u&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof u)&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=c.Long.fromNumber(this.typeDefault,this.type.charAt(0)==="u"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var i;c.base64.test(this.typeDefault)?c.base64.decode(this.typeDefault,i=c.newBuffer(c.base64.length(this.typeDefault)),0):c.utf8.write(this.typeDefault,i=c.newBuffer(c.utf8.length(this.typeDefault)),0),this.typeDefault=i}return this.map?this.defaultValue=c.emptyObject:this.repeated?this.defaultValue=c.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof l&&(this.parent.ctor.prototype[this.name]=this.defaultValue),d.prototype.resolve.call(this)},e.prototype._inferLegacyProtoFeatures=function(i){if(i!=="proto2"&&i!=="proto3")return{};var t={};if(this.rule==="required"&&(t.field_presence="LEGACY_REQUIRED"),this.parent&&h.defaults[this.type]===void 0){var f=this.parent.get(this.type.split(".").pop());f&&f instanceof l&&f.group&&(t.message_encoding="DELIMITED")}return this.getOption("packed")===!0?t.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(t.repeated_field_encoding="EXPANDED"),t},e.prototype._resolveFeatures=function(i){return d.prototype._resolveFeatures.call(this,this._edition||i)},e.d=function(i,t,f,s){return typeof t=="function"?t=c.decorateType(t).name:t&&typeof t=="object"&&(t=c.decorateEnum(t).name),function(o,p){c.decorateType(o.constructor).add(new e(p,i,t,f,{default:s}))}},e._configure=function(i){l=i},field}var oneof,hasRequiredOneof;function requireOneof(){if(hasRequiredOneof)return oneof;hasRequiredOneof=1,oneof=c;var d=requireObject();((c.prototype=Object.create(d.prototype)).constructor=c).className="OneOf";var u=requireField(),h=requireUtil();function c(n,e,r,i){if(Array.isArray(e)||(r=e,e=void 0),d.call(this,n,r),!(e===void 0||Array.isArray(e)))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=i}c.fromJSON=function(e,r){return new c(e,r.oneof,r.options,r.comment)},c.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return h.toObject(["options",this.options,"oneof",this.oneof,"comment",r?this.comment:void 0])};function l(n){if(n.parent)for(var e=0;e<n.fieldsArray.length;++e)n.fieldsArray[e].parent||n.parent.add(n.fieldsArray[e])}return c.prototype.add=function(e){if(!(e instanceof u))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,l(this),this},c.prototype.remove=function(e){if(!(e instanceof u))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),r=this.oneof.indexOf(e.name),r>-1&&this.oneof.splice(r,1),e.partOf=null,this},c.prototype.onAdd=function(e){d.prototype.onAdd.call(this,e);for(var r=this,i=0;i<this.oneof.length;++i){var t=e.get(this.oneof[i]);t&&!t.partOf&&(t.partOf=r,r.fieldsArray.push(t))}l(this)},c.prototype.onRemove=function(e){for(var r=0,i;r<this.fieldsArray.length;++r)(i=this.fieldsArray[r]).parent&&i.parent.remove(i);d.prototype.onRemove.call(this,e)},Object.defineProperty(c.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var n=this.fieldsArray[0];return n.options!=null&&n.options.proto3_optional===!0}}),c.d=function(){for(var e=new Array(arguments.length),r=0;r<arguments.length;)e[r]=arguments[r++];return function(t,f){h.decorateType(t.constructor).add(new c(f,e)),Object.defineProperty(t,f,{get:h.oneOfGetter(e),set:h.oneOfSetter(e)})}},oneof}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=r,r.className="ReflectionObject";const d=requireOneof();var u=requireUtil(),h,c={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY",enforce_naming_style:"STYLE2024",default_symbol_visibility:"EXPORT_TOP_LEVEL"},l={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY",enforce_naming_style:"STYLE_LEGACY",default_symbol_visibility:"EXPORT_ALL"},n={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE",enforce_naming_style:"STYLE_LEGACY",default_symbol_visibility:"EXPORT_ALL"},e={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY",enforce_naming_style:"STYLE_LEGACY",default_symbol_visibility:"EXPORT_ALL"};function r(i,t){if(!u.isString(i))throw TypeError("name must be a string");if(t&&!u.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=i,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(r.prototype,{root:{get:function(){for(var i=this;i.parent!==null;)i=i.parent;return i}},fullName:{get:function(){for(var i=[this.name],t=this.parent;t;)i.unshift(t.name),t=t.parent;return i.join(".")}}}),r.prototype.toJSON=function(){throw Error()},r.prototype.onAdd=function(t){this.parent&&this.parent!==t&&this.parent.remove(this),this.parent=t,this.resolved=!1;var f=t.root;f instanceof h&&f._handleAdd(this)},r.prototype.onRemove=function(t){var f=t.root;f instanceof h&&f._handleRemove(this),this.parent=null,this.resolved=!1},r.prototype.resolve=function(){return this.resolved?this:(this.root instanceof h&&(this.resolved=!0),this)},r.prototype._resolveFeaturesRecursive=function(t){return this._resolveFeatures(this._edition||t)},r.prototype._resolveFeatures=function(t){if(!this._featuresResolved){var f={};if(!t)throw new Error("Unknown edition for "+this.fullName);var s=Object.assign(this.options?Object.assign({},this.options.features):{},this._inferLegacyProtoFeatures(t));if(this._edition){if(t==="proto2")f=Object.assign({},n);else if(t==="proto3")f=Object.assign({},e);else if(t==="2023")f=Object.assign({},l);else if(t==="2024")f=Object.assign({},c);else throw new Error("Unknown edition: "+t);this._features=Object.assign(f,s||{}),this._featuresResolved=!0;return}if(this.partOf instanceof d){var a=Object.assign({},this.partOf._features);this._features=Object.assign(a,s||{})}else if(!this.declaringField)if(this.parent){var o=Object.assign({},this.parent._features);this._features=Object.assign(o,s||{})}else throw new Error("Unable to find a parent for "+this.fullName);this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}},r.prototype._inferLegacyProtoFeatures=function(){return{}},r.prototype.getOption=function(t){if(this.options)return this.options[t]},r.prototype.setOption=function(t,f,s){return this.options||(this.options={}),/^features\./.test(t)?u.setProperty(this.options,t,f,s):(!s||this.options[t]===void 0)&&(this.getOption(t)!==f&&(this.resolved=!1),this.options[t]=f),this},r.prototype.setParsedOption=function(t,f,s){this.parsedOptions||(this.parsedOptions=[]);var a=this.parsedOptions;if(s){var o=a.find(function(b){return Object.prototype.hasOwnProperty.call(b,t)});if(o){var p=o[t];u.setProperty(p,s,f)}else o={},o[t]=u.setProperty({},s,f),a.push(o)}else{var y={};y[t]=f,a.push(y)}return this},r.prototype.setOptions=function(t,f){if(t)for(var s=Object.keys(t),a=0;a<s.length;++a)this.setOption(s[a],t[s[a]],f);return this},r.prototype.toString=function(){var t=this.constructor.className,f=this.fullName;return f.length?t+" "+f:t},r.prototype._editionToJSON=function(){if(!(!this._edition||this._edition==="proto3"))return this._edition},r._configure=function(i){h=i},object}var _enum,hasRequired_enum;function require_enum(){if(hasRequired_enum)return _enum;hasRequired_enum=1,_enum=c;var d=requireObject();((c.prototype=Object.create(d.prototype)).constructor=c).className="Enum";var u=requireNamespace(),h=requireUtil();function c(l,n,e,r,i,t){if(d.call(this,l,e),n&&typeof n!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=r,this.comments=i||{},this.valuesOptions=t,this._valuesFeatures={},this.reserved=void 0,n)for(var f=Object.keys(n),s=0;s<f.length;++s)typeof n[f[s]]=="number"&&(this.valuesById[this.values[f[s]]=n[f[s]]]=f[s])}return c.prototype._resolveFeatures=function(n){return n=this._edition||n,d.prototype._resolveFeatures.call(this,n),Object.keys(this.values).forEach(e=>{var r=Object.assign({},this._features);this._valuesFeatures[e]=Object.assign(r,this.valuesOptions&&this.valuesOptions[e]&&this.valuesOptions[e].features)}),this},c.fromJSON=function(n,e){var r=new c(n,e.values,e.options,e.comment,e.comments);return r.reserved=e.reserved,e.edition&&(r._edition=e.edition),r._defaultEdition="proto3",r},c.prototype.toJSON=function(n){var e=n?!!n.keepComments:!1;return h.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",e?this.comment:void 0,"comments",e?this.comments:void 0])},c.prototype.add=function(n,e,r,i){if(!h.isString(n))throw TypeError("name must be a string");if(!h.isInteger(e))throw TypeError("id must be an integer");if(this.values[n]!==void 0)throw Error("duplicate name '"+n+"' in "+this);if(this.isReservedId(e))throw Error("id "+e+" is reserved in "+this);if(this.isReservedName(n))throw Error("name '"+n+"' is reserved in "+this);if(this.valuesById[e]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+e+" in "+this);this.values[n]=e}else this.valuesById[this.values[n]=e]=n;return i&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[n]=i||null),this.comments[n]=r||null,this},c.prototype.remove=function(n){if(!h.isString(n))throw TypeError("name must be a string");var e=this.values[n];if(e==null)throw Error("name '"+n+"' does not exist in "+this);return delete this.valuesById[e],delete this.values[n],delete this.comments[n],this.valuesOptions&&delete this.valuesOptions[n],this},c.prototype.isReservedId=function(n){return u.isReservedId(this.reserved,n)},c.prototype.isReservedName=function(n){return u.isReservedName(this.reserved,n)},_enum}var encoder_1,hasRequiredEncoder;function requireEncoder(){if(hasRequiredEncoder)return encoder_1;hasRequiredEncoder=1,encoder_1=l;var d=require_enum(),u=requireTypes(),h=requireUtil();function c(n,e,r,i){return e.delimited?n("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,i,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):n("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,i,(e.id<<3|2)>>>0)}function l(n){for(var e=h.codegen(["m","w"],n.name+"$encode")("if(!w)")("w=Writer.create()"),r,i,t=n.fieldsArray.slice().sort(h.compareFieldsById),r=0;r<t.length;++r){var f=t[r].resolve(),s=n._fieldsArray.indexOf(f),a=f.resolvedType instanceof d?"int32":f.type,o=u.basic[a];i="m"+h.safeProp(f.name),f.map?(e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",i,f.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",i)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(f.id<<3|2)>>>0,8|u.mapKey[f.keyType],f.keyType),o===void 0?e("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",s,i):e(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|o,a,i),e("}")("}")):f.repeated?(e("if(%s!=null&&%s.length){",i,i),f.packed&&u.packed[a]!==void 0?e("w.uint32(%i).fork()",(f.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",i)("w.%s(%s[i])",a,i)("w.ldelim()"):(e("for(var i=0;i<%s.length;++i)",i),o===void 0?c(e,f,s,i+"[i]"):e("w.uint32(%i).%s(%s[i])",(f.id<<3|o)>>>0,a,i)),e("}")):(f.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",i,f.name),o===void 0?c(e,f,s,i):e("w.uint32(%i).%s(%s)",(f.id<<3|o)>>>0,a,i))}return e("return w")}return encoder_1}var hasRequiredIndexLight;function requireIndexLight(){if(hasRequiredIndexLight)return indexLight.exports;hasRequiredIndexLight=1;var d=indexLight.exports=requireIndexMinimal();d.build="light";function u(c,l,n){return typeof l=="function"?(n=l,l=new d.Root):l||(l=new d.Root),l.load(c,n)}d.load=u;function h(c,l){return l||(l=new d.Root),l.loadSync(c)}return d.loadSync=h,d.encoder=requireEncoder(),d.decoder=requireDecoder(),d.verifier=requireVerifier(),d.converter=requireConverter(),d.ReflectionObject=requireObject(),d.Namespace=requireNamespace(),d.Root=requireRoot(),d.Enum=require_enum(),d.Type=requireType(),d.Field=requireField(),d.OneOf=requireOneof(),d.MapField=requireMapfield(),d.Service=requireService(),d.Method=requireMethod(),d.Message=requireMessage(),d.wrappers=requireWrappers(),d.types=requireTypes(),d.util=requireUtil(),d.ReflectionObject._configure(d.Root),d.Namespace._configure(d.Type,d.Service,d.Enum),d.Root._configure(d.Type),d.Field._configure(d.Type),indexLight.exports}var tokenize_1,hasRequiredTokenize;function requireTokenize(){if(hasRequiredTokenize)return tokenize_1;hasRequiredTokenize=1,tokenize_1=f;var d=/[\s{}=;:[\],'"()<>]/g,u=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,h=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,c=/^ *[*/]+ */,l=/^\s*\*?\/*/,n=/\n/g,e=/\s/,r=/\\(.?)/g,i={0:"\0",r:"\r",n:`
|
|
5
|
+
`,t:" "};function t(s){return s.replace(r,function(a,o){switch(o){case"\\":case"":return o;default:return i[o]||""}})}f.unescape=t;function f(s,a){s=s.toString();var o=0,p=s.length,y=1,b=0,v={},m=[],_=null;function E(I){return Error("illegal "+I+" (line "+y+")")}function k(){var I=_==="'"?h:u;I.lastIndex=o-1;var x=I.exec(s);if(!x)throw E("string");return o=I.lastIndex,S(_),_=null,t(x[1])}function C(I){return s.charAt(I)}function j(I,x,B){var W={type:s.charAt(I++),lineEmpty:!1,leading:B},z;a?z=2:z=3;var F=I-z,$;do if(--F<0||($=s.charAt(F))===`
|
|
6
|
+
`){W.lineEmpty=!0;break}while($===" "||$===" ");for(var K=s.substring(I,x).split(n),H=0;H<K.length;++H)K[H]=K[H].replace(a?l:c,"").trim();W.text=K.join(`
|
|
7
|
+
`).trim(),v[y]=W,b=y}function X(I){var x=P(I),B=s.substring(I,x),W=/^\s*\/\//.test(B);return W}function P(I){for(var x=I;x<p&&C(x)!==`
|
|
8
|
+
`;)x++;return x}function D(){if(m.length>0)return m.shift();if(_)return k();var I,x,B,W,z,F=o===0;do{if(o===p)return null;for(I=!1;e.test(B=C(o));)if(B===`
|
|
9
|
+
`&&(F=!0,++y),++o===p)return null;if(C(o)==="/"){if(++o===p)throw E("comment");if(C(o)==="/")if(a){if(W=o,z=!1,X(o-1)){z=!0;do if(o=P(o),o===p||(o++,!F))break;while(X(o))}else o=Math.min(p,P(o)+1);z&&(j(W,o,F),F=!0),y++,I=!0}else{for(z=C(W=o+1)==="/";C(++o)!==`
|
|
10
|
+
`;)if(o===p)return null;++o,z&&(j(W,o-1,F),F=!0),++y,I=!0}else if((B=C(o))==="*"){W=o+1,z=a||C(W)==="*";do{if(B===`
|
|
11
|
+
`&&++y,++o===p)throw E("comment");x=B,B=C(o)}while(x!=="*"||B!=="/");++o,z&&(j(W,o-2,F),F=!0),I=!0}else return"/"}}while(I);var $=o;d.lastIndex=0;var K=d.test(C($++));if(!K)for(;$<p&&!d.test(C($));)++$;var H=s.substring(o,o=$);return(H==='"'||H==="'")&&(_=H),H}function S(I){m.push(I)}function J(){if(!m.length){var I=D();if(I===null)return null;S(I)}return m[0]}function U(I,x){var B=J(),W=B===I;if(W)return D(),!0;if(!x)throw E("token '"+B+"', '"+I+"' expected");return!1}function T(I){var x=null,B;return I===void 0?(B=v[y-1],delete v[y-1],B&&(a||B.type==="*"||B.lineEmpty)&&(x=B.leading?B.text:null)):(b<I&&J(),B=v[I],delete v[I],B&&!B.lineEmpty&&(a||B.type==="/")&&(x=B.leading?null:B.text)),x}return Object.defineProperty({next:D,peek:J,push:S,skip:U,cmnt:T},"line",{get:function(){return y}})}return tokenize_1}var parse_1,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse_1;hasRequiredParse=1,parse_1=k,k.filename=null,k.defaults={keepCase:!1};var d=requireTokenize(),u=requireRoot(),h=requireType(),c=requireField(),l=requireMapfield(),n=requireOneof(),e=require_enum(),r=requireService(),i=requireMethod(),t=requireObject(),f=requireTypes(),s=requireUtil(),a=/^[1-9][0-9]*$/,o=/^-?[1-9][0-9]*$/,p=/^0[x][0-9a-fA-F]+$/,y=/^-?0[x][0-9a-fA-F]+$/,b=/^0[0-7]+$/,v=/^-?0[0-7]+$/,m=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,_=/^[a-zA-Z_][a-zA-Z_0-9]*$/,E=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;function k(C,j,X){j instanceof u||(X=j,j=new u),X||(X=k.defaults);var P=X.preferTrailingComment||!1,D=d(C,X.alternateCommentMode||!1),S=D.next,J=D.push,U=D.peek,T=D.skip,I=D.cmnt,x=!0,B,W,z,F="proto2",$=j,K=[],H={},ae=X.keepCase?function(O){return O}:s.camelCase;function he(){K.forEach(O=>{O._edition=F,Object.keys(H).forEach(g=>{O.getOption(g)===void 0&&O.setOption(g,H[g],!0)})})}function q(O,g,R){var w=k.filename;return R||(k.filename=null),Error("illegal "+(g||"token")+" '"+O+"' ("+(w?w+", ":"")+"line "+D.line+")")}function ee(){var O=[],g;do{if((g=S())!=='"'&&g!=="'")throw q(g);O.push(S()),T(g),g=U()}while(g==='"'||g==="'");return O.join("")}function ue(O){var g=S();switch(g){case"'":case'"':return J(g),ee();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return pe(g,!0)}catch{if(E.test(g))return g;throw q(g,"value")}}function re(O,g){var R,w;do if(g&&((R=U())==='"'||R==="'")){var A=ee();if(O.push(A),F>=2023)throw q(A,"id")}else try{O.push([w=te(S()),T("to",!0)?te(S()):w])}catch(L){if(g&&E.test(R)&&F>=2023)O.push(R);else throw L}while(T(",",!0));var N={options:void 0};N.setOption=function(L,G){this.options===void 0&&(this.options={}),this.options[L]=G},Z(N,function(G){if(G==="option")Q(N,G),T(";");else throw q(G)},function(){se(N)})}function pe(O,g){var R=1;switch(O.charAt(0)==="-"&&(R=-1,O=O.substring(1)),O){case"inf":case"INF":case"Inf":return R*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(a.test(O))return R*parseInt(O,10);if(p.test(O))return R*parseInt(O,16);if(b.test(O))return R*parseInt(O,8);if(m.test(O))return R*parseFloat(O);throw q(O,"number",g)}function te(O,g){switch(O){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!g&&O.charAt(0)==="-")throw q(O,"id");if(o.test(O))return parseInt(O,10);if(y.test(O))return parseInt(O,16);if(v.test(O))return parseInt(O,8);throw q(O,"id")}function ye(){if(B!==void 0)throw q("package");if(B=S(),!E.test(B))throw q(B,"name");$=$.define(B),T(";")}function me(){var O=U(),g;switch(O){case"option":if(F<"2024")throw q("option");S(),ee(),T(";");return;case"weak":g=z||(z=[]),S();break;case"public":S();default:g=W||(W=[]);break}O=ee(),T(";"),g.push(O)}function ve(){if(T("="),F=ee(),F<2023)throw q(F,"syntax");T(";")}function ge(){if(T("="),F=ee(),!["2023","2024"].includes(F))throw q(F,"edition");T(";")}function ie(O,g){switch(g){case"option":return Q(O,g),T(";"),!0;case"message":return ne(O,g),!0;case"enum":return de(O,g),!0;case"export":case"local":return F<"2024"||(g=S(),g==="export"||g==="local")||g!=="message"&&g!=="enum"?!1:ie(O,g);case"service":return we(O,g),!0;case"extend":return Se(O,g),!0}return!1}function Z(O,g,R){var w=D.line;if(O&&(typeof O.comment!="string"&&(O.comment=I()),O.filename=k.filename),T("{",!0)){for(var A;(A=S())!=="}";)g(A);T(";",!0)}else R&&R(),T(";"),O&&(typeof O.comment!="string"||P)&&(O.comment=I(w)||O.comment)}function ne(O,g){if(!_.test(g=S()))throw q(g,"type name");var R=new h(g);Z(R,function(A){if(!ie(R,A))switch(A){case"map":be(R);break;case"required":if(F!=="proto2")throw q(A);case"repeated":Y(R,A);break;case"optional":if(F==="proto3")Y(R,"proto3_optional");else{if(F!=="proto2")throw q(A);Y(R,"optional")}break;case"oneof":Oe(R,A);break;case"extensions":re(R.extensions||(R.extensions=[]));break;case"reserved":re(R.reserved||(R.reserved=[]),!0);break;default:if(F==="proto2"||!E.test(A))throw q(A);J(A),Y(R,"optional");break}}),O.add(R),O===$&&K.push(R)}function Y(O,g,R){var w=S();if(w==="group"){_e(O,g);return}for(;w.endsWith(".")||U().startsWith(".");)w+=S();if(!E.test(w))throw q(w,"type");var A=S();if(!_.test(A))throw q(A,"name");A=ae(A),T("=");var N=new c(A,te(S()),w,g,R);if(Z(N,function(M){if(M==="option")Q(N,M),T(";");else throw q(M)},function(){se(N)}),g==="proto3_optional"){var L=new n("_"+A);N.setOption("proto3_optional",!0),L.add(N),O.add(L)}else O.add(N);O===$&&K.push(N)}function _e(O,g){if(F>=2023)throw q("group");var R=S();if(!_.test(R))throw q(R,"name");var w=s.lcFirst(R);R===w&&(R=s.ucFirst(R)),T("=");var A=te(S()),N=new h(R);N.group=!0;var L=new c(w,A,R,g);L.filename=k.filename,Z(N,function(M){switch(M){case"option":Q(N,M),T(";");break;case"required":case"repeated":Y(N,M);break;case"optional":F==="proto3"?Y(N,"proto3_optional"):Y(N,"optional");break;case"message":ne(N,M);break;case"enum":de(N,M);break;case"reserved":re(N.reserved||(N.reserved=[]),!0);break;case"export":case"local":if(F<"2024")throw q(M);switch(M=S(),M){case"message":ne(N,M);break;case"enum":ne(N,M);break;default:throw q(M)}break;default:throw q(M)}}),O.add(N).add(L)}function be(O){T("<");var g=S();if(f.mapKey[g]===void 0)throw q(g,"type");T(",");var R=S();if(!E.test(R))throw q(R,"type");T(">");var w=S();if(!_.test(w))throw q(w,"name");T("=");var A=new l(ae(w),te(S()),g,R);Z(A,function(L){if(L==="option")Q(A,L),T(";");else throw q(L)},function(){se(A)}),O.add(A)}function Oe(O,g){if(!_.test(g=S()))throw q(g,"name");var R=new n(ae(g));Z(R,function(A){A==="option"?(Q(R,A),T(";")):(J(A),Y(R,"optional"))}),O.add(R)}function de(O,g){if(!_.test(g=S()))throw q(g,"name");var R=new e(g);Z(R,function(A){switch(A){case"option":Q(R,A),T(";");break;case"reserved":re(R.reserved||(R.reserved=[]),!0),R.reserved===void 0&&(R.reserved=[]);break;default:Re(R,A)}}),O.add(R),O===$&&K.push(R)}function Re(O,g){if(!_.test(g))throw q(g,"name");T("=");var R=te(S(),!0),w={options:void 0};w.getOption=function(A){return this.options[A]},w.setOption=function(A,N){t.prototype.setOption.call(w,A,N)},w.setParsedOption=function(){},Z(w,function(N){if(N==="option")Q(w,N),T(";");else throw q(N)},function(){se(w)}),O.add(g,R,w.comment,w.parsedOptions||w.options)}function Q(O,g){var R,w,A=!0;for(g==="option"&&(g=S());g!=="=";){if(g==="("){var N=S();T(")"),g="("+N+")"}if(A){if(A=!1,g.includes(".")&&!g.includes("(")){var L=g.split(".");R=L[0]+".",g=L[1];continue}R=g}else w=w?w+=g:g;g=S()}var G=w?R.concat(w):R,M=ce(O,G);w=w&&w[0]==="."?w.slice(1):w,R=R&&R[R.length-1]==="."?R.slice(0,-1):R,Ee(O,R,M,w)}function ce(O,g){if(T("{",!0)){for(var R={};!T("}",!0);){if(!_.test(V=S()))throw q(V,"name");if(V===null)throw q(V,"end of input");var w,A=V;if(T(":",!0),U()==="{")w=ce(O,g+"."+V);else if(U()==="["){w=[];var N;if(T("[",!0)){do N=ue(),w.push(N);while(T(",",!0));T("]"),typeof N<"u"&&fe(O,g+"."+V,N)}}else w=ue(),fe(O,g+"."+V,w);var L=R[A];L&&(w=[].concat(L).concat(w)),R[A]=w,T(",",!0),T(";",!0)}return R}var G=ue();return fe(O,g,G),G}function fe(O,g,R){if($===O&&/^features\./.test(g)){H[g]=R;return}O.setOption&&O.setOption(g,R)}function Ee(O,g,R,w){O.setParsedOption&&O.setParsedOption(g,R,w)}function se(O){if(T("[",!0)){do Q(O,"option");while(T(",",!0));T("]")}return O}function we(O,g){if(!_.test(g=S()))throw q(g,"service name");var R=new r(g);Z(R,function(A){if(!ie(R,A))if(A==="rpc")Ae(R,A);else throw q(A)}),O.add(R),O===$&&K.push(R)}function Ae(O,g){var R=I(),w=g;if(!_.test(g=S()))throw q(g,"name");var A=g,N,L,G,M;if(T("("),T("stream",!0)&&(L=!0),!E.test(g=S())||(N=g,T(")"),T("returns"),T("("),T("stream",!0)&&(M=!0),!E.test(g=S())))throw q(g);G=g,T(")");var oe=new i(A,w,N,G,L,M);oe.comment=R,Z(oe,function(le){if(le==="option")Q(oe,le),T(";");else throw q(le)}),O.add(oe)}function Se(O,g){if(!E.test(g=S()))throw q(g,"reference");var R=g;Z(null,function(A){switch(A){case"required":case"repeated":Y(O,A,R);break;case"optional":F==="proto3"?Y(O,"proto3_optional",R):Y(O,"optional",R);break;default:if(F==="proto2"||!E.test(A))throw q(A);J(A),Y(O,"optional",R);break}})}for(var V;(V=S())!==null;)switch(V){case"package":if(!x)throw q(V);ye();break;case"import":if(!x)throw q(V);me();break;case"syntax":if(!x)throw q(V);ve();break;case"edition":if(!x)throw q(V);ge();break;case"option":Q($,V),T(";",!0);break;default:if(ie($,V)){x=!1;continue}throw q(V)}return he(),k.filename=null,{package:B,imports:W,weakImports:z,root:j}}return parse_1}var common_1,hasRequiredCommon;function requireCommon(){if(hasRequiredCommon)return common_1;hasRequiredCommon=1,common_1=u;var d=/\/|\./;function u(c,l){d.test(c)||(c="google/protobuf/"+c+".proto",l={nested:{google:{nested:{protobuf:{nested:l}}}}}),u[c]=l}u("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var h;return u("duration",{Duration:h={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}}),u("timestamp",{Timestamp:h}),u("empty",{Empty:{fields:{}}}),u("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}}),u("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}}),u("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}}),u.get=function(l){return u[l]||null},common_1}var hasRequiredSrc;function requireSrc(){if(hasRequiredSrc)return src.exports;hasRequiredSrc=1;var d=src.exports=requireIndexLight();return d.build="full",d.tokenize=requireTokenize(),d.parse=requireParse(),d.common=requireCommon(),d.Root._configure(d.Type,d.parse,d.common),src.exports}var protobufjs,hasRequiredProtobufjs;function requireProtobufjs(){return hasRequiredProtobufjs||(hasRequiredProtobufjs=1,protobufjs=requireSrc()),protobufjs}var protobufjsExports=requireProtobufjs();const nested={BSB_State:{nested:{StateUpdate:{oneofs:{state:{oneof:["deviceName","power","brightness","audioVolume","wifi","updateState","updateCheck","timezone","matter","frame","input","timer","ble","autoUpdateState"]}},fields:{deviceName:{type:"BSB_State.DeviceName",id:1},power:{type:"BSB_State.Power",id:2},brightness:{type:"BSB_State.Brightness",id:3},audioVolume:{type:"BSB_State.AudioVolume",id:4},wifi:{type:"BSB_State.Wifi",id:5},updateState:{type:"BSB_Update.UpdateState",id:6},updateCheck:{type:"BSB_Update.CheckState",id:7},timezone:{type:"BSB_State.Timezone",id:8},matter:{type:"BSB_State.Matter",id:9},frame:{type:"BSB_Frame.Frame",id:10},input:{type:"BSB_Input.InputEvent",id:11},timer:{type:"BSB_Timer.Timer",id:12},ble:{type:"BSB_State.Ble.Ble",id:13},autoUpdateState:{type:"BSB_Update.AutoUpdateState",id:14}}},State:{oneofs:{_error:{oneof:["error"]}},fields:{timestamp:{type:"fixed64",id:1},updates:{rule:"repeated",type:"StateUpdate",id:2},error:{type:"BSB_Error.Error",id:3,options:{proto3_optional:!0}}}},DeviceName:{fields:{name:{type:"string",id:1}}},BrightnessAutomatic:{fields:{}},BrightnessManual:{fields:{brightness:{type:"uint32",id:1}}},Brightness:{oneofs:{setting:{oneof:["automatic","manual"]}},fields:{automatic:{type:"BrightnessAutomatic",id:1},manual:{type:"BrightnessManual",id:2},actualBrightness:{type:"uint32",id:3}}},BatteryStatus:{values:{DISCHARGING:0,CHARGING:1,CHARGED:2}},UnknownPowerState:{fields:{}},PowerState:{fields:{batteryStatus:{type:"BatteryStatus",id:1},batteryChargePercent:{type:"uint32",id:2},batteryVoltageMv:{type:"uint32",id:3},batteryCurrentMa:{type:"sint32",id:4},usbVoltageMv:{type:"uint32",id:5}}},Power:{oneofs:{state:{oneof:["unknown","known"]}},fields:{unknown:{type:"UnknownPowerState",id:1},known:{type:"PowerState",id:2}}},AudioVolume:{fields:{volume:{type:"uint32",id:1}}},WifiConnectionStatus:{values:{CONNECTED:0,CONNECTING:1,DISCONNECTING:2,RECONNECTING:3}},WifiSecurity:{values:{UNKNOWN:0,OPEN:1,WPA:2,WPA2:3,WEP:4,WPA_WPA2:5,WPA3:6,WPA2_WPA3:7}},IpConfigurationMethod:{values:{DHCP:0,STATIC:1}},IpProtocol:{values:{IPV4:0,IPV6:1}},WifiStateUnknown:{fields:{}},WifiStateDisconnected:{fields:{}},WifiStateConnected:{fields:{status:{type:"WifiConnectionStatus",id:1},ssid:{type:"string",id:2},bssid:{type:"string",id:3},channel:{type:"uint32",id:4},rssi:{type:"sint32",id:5},security:{type:"WifiSecurity",id:6}}},IpAddress:{fields:{protocol:{type:"IpProtocol",id:1},method:{type:"IpConfigurationMethod",id:2},address:{type:"string",id:3},gateway:{type:"string",id:4},netmask:{type:"string",id:5}}},Wifi:{oneofs:{wifiState:{oneof:["unknown","disconnected","connected"]}},fields:{unknown:{type:"WifiStateUnknown",id:1},disconnected:{type:"WifiStateDisconnected",id:2},connected:{type:"WifiStateConnected",id:3},ipAddresses:{rule:"repeated",type:"IpAddress",id:4}}},Timezone:{fields:{name:{type:"string",id:1},offset:{type:"sint32",id:2},abbr:{type:"string",id:3}}},MatterCommissioningStatus:{values:{NEVER_STARTED:0,STARTED:1,COMPLETED_SUCCESSFULLY:2,FAILED:3}},MatterCommissioningState:{fields:{status:{type:"MatterCommissioningStatus",id:1},timestamp:{type:"fixed64",id:2}}},Matter:{fields:{fabricCount:{type:"uint32",id:1},state:{type:"MatterCommissioningState",id:2}}},Ble:{nested:{ServiceStatus:{values:{RESET:0,INITIALIZATION:1,READY:2,ADVERTISING:3,CONNECTABLE:4,CONNECTED:5,ERROR:6}},Ble:{oneofs:{_remoteAddress:{oneof:["remoteAddress"]}},fields:{status:{type:"ServiceStatus",id:1},remoteAddress:{type:"string",id:2,options:{proto3_optional:!0}}}}}}}},BSB_Update:{nested:{UpdateEvent:{values:{SESSION_START:0,SESSION_STOP:1,ACTION_BEGIN:2,ACTION_DONE:3,DETAIL_CHANGE:4,ACTION_PROGRESS:5,EVENT_NONE:6}},UpdateAction:{values:{DOWNLOAD:0,SHA_VERIFICATION:1,UNPACK:2,INSTALLATION_PREPARE:3,INSTALLATION_APPLY:4,ACTION_NONE:5}},UpdateStatus:{values:{OK:0,BATTERY_LOW:1,BUSY:2,DOWNLOAD_FAILURE:3,DOWNLOAD_ABORT:4,SHA_MISMATCH:5,UNPACK_CREATE_STAGING_DIRECTORY_FAILURE:6,UNPACK_ARCHIVE_OPEN_FAILURE:7,UNPACK_ARCHIVE_UNPACK_FAILURE:8,INSTALLATION_PREPARE_MANIFEST_NOT_FOUND:9,INSTALLATION_PREPARE_MANIFEST_INVALID:10,INSTALLATION_PREPARE_SESSION_CONFIG_SETUP_FAILURE:11,INSTALLATION_PREPARE_POINTER_SETUP_FAILURE:12,UNKNOWN_FAILURE:13}},CheckError:{values:{NOT_AVAILABLE:0,FAILURE:1,IDLE:2}},UpdateAvailable:{fields:{version:{type:"string",id:1}}},UpdateUnavailable:{fields:{reason:{type:"CheckError",id:1}}},UpdateState:{fields:{event:{type:"UpdateEvent",id:1},action:{type:"UpdateAction",id:2},status:{type:"UpdateStatus",id:3}}},CheckState:{oneofs:{status:{oneof:["available","unavailable"]}},fields:{available:{type:"UpdateAvailable",id:1},unavailable:{type:"UpdateUnavailable",id:2}}},AutoUpdateInterval:{fields:{start:{type:"uint32",id:1},end:{type:"uint32",id:2}}},AutoUpdateState:{fields:{enabled:{type:"bool",id:1},interval:{type:"AutoUpdateInterval",id:2}}}}},BSB_Frame:{nested:{Encoding:{values:{PLAIN:0,RUN_LENGTH:1,DEFLATE:2,DEFLATE_RUN_LENGTH:3}},PixelFormat:{values:{RGB888:0,L8:1,L4:2}},Screen:{values:{FRONT:0,BACK:1}},Frame:{fields:{screen:{type:"Screen",id:1},width:{type:"uint32",id:2},height:{type:"uint32",id:3},encoding:{type:"Encoding",id:4},pixelFormat:{type:"PixelFormat",id:5},data:{type:"bytes",id:6}}}}},BSB_Timer:{nested:{Timer:{fields:{json:{type:"BSB_Util.Json",id:1}}}}},BSB_Util:{nested:{Compression:{values:{PLAIN:0,GZIP:1}},Json:{fields:{compression:{type:"Compression",id:1},data:{type:"bytes",id:2}}}}},BSB_Input:{nested:{Button:{values:{OK:0,BACK:1,START:2}},ButtonAction:{values:{PRESS:0,RELEASE:1}},SwitchPosition:{values:{BUSY:0,CUSTOM:1,OFF:2,APPS:3,SETTINGS:4}},ButtonEvent:{fields:{button:{type:"Button",id:1},action:{type:"ButtonAction",id:2}}},SwitchEvent:{fields:{position:{type:"SwitchPosition",id:1}}},EncoderEvent:{fields:{delta:{type:"sint32",id:1}}},InputEvent:{oneofs:{event:{oneof:["buttonEvent","switchEvent","encoderEvent"]}},fields:{buttonEvent:{type:"ButtonEvent",id:1},switchEvent:{type:"SwitchEvent",id:2},encoderEvent:{type:"EncoderEvent",id:3}}}}},BSB_Error:{nested:{Cause:{values:{RESOURCE_LIMIT:0}},Severity:{values:{FATAL:0,ERROR:1,WARNING:2}},Error:{fields:{cause:{type:"Cause",id:1},severity:{type:"Severity",id:2}}}}}},bundle={nested};function decompressRLE(d,u){const h=[];for(let c=0;c<d.length;){const l=d[c++];if(l===void 0)break;const n=l&127;if(!n)continue;if(l&128){const r=n*u,i=d.subarray(c,c+r);for(let t=0;t<i.length;t++)h.push(i[t]);c+=r;continue}const e=d.subarray(c,c+u);c+=u;for(let r=0;r<n;r++)for(let i=0;i<u;i++)h.push(e[i])}return new Uint8Array(h)}async function decompressDeflate(d){if(typeof DecompressionStream>"u")throw new Error("DecompressionStream is not supported in this environment.");try{const u=new DecompressionStream("deflate"),h=u.writable.getWriter();h.write(d),h.close();const l=await new Response(u.readable).arrayBuffer();return new Uint8Array(l)}catch(u){throw new Error(`Deflate decompression failed: ${u instanceof Error?u.message:String(u)}`)}}function convertL4toRGBA(d,u,h){const c=new Uint8ClampedArray(u*h*4);let l=0;for(let n=0;n<d.length;n++){const e=d[n],r=(e&15)*17,i=(e>>4&15)*17,t=[r,i];for(const f of t)if(l<u*h){const s=l*4;c[s]=f,c[s+1]=f,c[s+2]=f,c[s+3]=255,l++}}return c}function convertL8toRGBA(d,u,h){const c=new Uint8ClampedArray(u*h*4),l=Math.min(d.length,u*h);for(let n=0;n<l;n++){const e=d[n],r=n*4;c[r]=e,c[r+1]=e,c[r+2]=e,c[r+3]=255}return c}function convertRGB888toRGBA(d,u,h){const c=new Uint8ClampedArray(u*h*4),l=u*h;for(let n=0;n<l;n++){const e=n*3,r=n*4;e+2<d.length&&(c[r]=d[e+2],c[r+1]=d[e+1],c[r+2]=d[e],c[r+3]=255)}return c}async function processFrame(d){if(!d.data||!d.width||!d.height)return null;let u=d.data;const h=d.pixelFormat===0?3:1;switch(d.encoding){case 1:u=decompressRLE(u,h);break;case 2:u=await decompressDeflate(u);break;case 3:u=await decompressDeflate(u),u=decompressRLE(u,h);break}switch(d.pixelFormat){case 2:return convertL4toRGBA(u,d.width,d.height);case 1:return convertL8toRGBA(u,d.width,d.height);case 0:return convertRGB888toRGBA(u,d.width,d.height);default:return new Uint8ClampedArray(d.width*d.height*4)}}const root=protobufjsExports.Root.fromJSON(bundle),StateType=root.lookupType("BSB_State.State"),AUTH_CODE=3e3,RECONNECT_CODES=new Set([1001,1006,1012,1013,1014,3008]),MAX_AUTH_ATTEMPTS=5,MAX_RECONNECT_ATTEMPTS=5;let socket=null,isBinaryMode=!0,currentMode="local",currentToken,currentAddr="",retryCount=0,authRetryCount=0,isAuthReported=!1,stabilityTimeout;const activePorts=new Set,subscriptions=new Map;let processingQueue=Promise.resolve();function broadcast(d){for(const u of activePorts)u.postMessage(d)}function sendAuth(){currentMode==="remote"&¤tToken&&(socket==null?void 0:socket.readyState)===WebSocket.OPEN&&(broadcast({type:"STATUS_UPDATE",auth:types_status.AuthStatus.AUTHENTICATING}),socket.send(JSON.stringify({token:currentToken})))}function sendSubscriptions(){(socket==null?void 0:socket.readyState)===WebSocket.OPEN&¤tMode==="remote"&&subscriptions.size>0&&socket.send(JSON.stringify({subscribe:Array.from(subscriptions.keys())}))}function stopAndCleanup(){socket&&(socket.close(),socket=null),stabilityTimeout&&(clearTimeout(stabilityTimeout),stabilityTimeout=void 0),subscriptions.clear(),activePorts.clear(),retryCount=0,authRetryCount=0,isAuthReported=!1}function connect(d,u,h=!0,c="local"){socket&&socket.close(),broadcast({type:"STATUS_UPDATE",connection:types_status.ConnectionStatus.CONNECTING}),currentAddr=d,isBinaryMode=h,currentMode=c,currentToken=u,isAuthReported=!1;const l=new URL(d);socket=new WebSocket(l.toString()),socket.binaryType="arraybuffer",socket.onopen=()=>{broadcast({type:"CONNECTED"}),currentMode==="local"&&(socket==null||socket.send(JSON.stringify({enable:!0}))),sendAuth(),stabilityTimeout&&clearTimeout(stabilityTimeout),stabilityTimeout=setTimeout(()=>{retryCount=0,authRetryCount=0,console.log("[Worker] Connection stable. All retry counters reset.")},5e3),currentMode==="remote"&&subscriptions.size>0&&sendSubscriptions(),currentMode==="local"&&broadcast({type:"STATUS_UPDATE",auth:types_status.AuthStatus.AUTHENTICATED})},socket.onmessage=n=>{processingQueue=processingQueue.then(async()=>{try{let e=null,r="",i;if(isBinaryMode)n.data instanceof ArrayBuffer&&(e=new Uint8Array(n.data),r=e);else{const t=JSON.parse(n.data);i=t.bar_id||t.barId,r=n.data,t.state&&(typeof t.state=="string"?e=Uint8Array.from(atob(t.state),f=>f.charCodeAt(0)):e=new Uint8Array(t.state)),currentMode==="remote"&&!isAuthReported&&(isAuthReported=!0,broadcast({type:"STATUS_UPDATE",auth:types_status.AuthStatus.AUTHENTICATED}))}if(r&&broadcast({type:"RAW_DATA",data:r}),e){const t=StateType.decode(e),f=StateType.toObject(t,{longs:Number,bytes:Uint8Array,enums:Number,defaults:!0});if(f.error){const{cause:s,severity:a}=f.error;if(s!=null&&a!=null){const o=root.lookupEnum("BSB_Error.Cause"),p=root.lookupEnum("BSB_Error.Severity"),y=o.valuesById[s]||"UNKNOWN",b=p.valuesById[a]||"UNKNOWN";if(broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.DEVICE_ERROR,message:`Server reported ${b}: ${y}`,data:f.error}),a===p.values.FATAL||a===p.values.ERROR){stopAndCleanup();return}}else broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.DEVICE_ERROR,message:"Server reported an unspecified application error",data:f.error})}if(f.updates)for(const s of f.updates){const a=s.frame;if(a&&a.data)try{const o=await processFrame(a);o&&(a.data=o)}catch(o){broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.FRAME_PROCESS_ERROR,message:o instanceof Error?o.message:String(o),data:a.data})}}broadcast(currentMode==="remote"&&i?{type:"DATA",data:{bar_id:i,state:f}}:{type:"DATA",data:f})}}catch(e){broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.DECODE_ERROR,message:`Decode error: ${String(e)}`})}}).catch(console.error)},socket.onerror=()=>{broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.CONNECTION_FAILED,message:"WebSocket connection error"})},socket.onclose=n=>{if(console.log("[Worker] Socket closed:",n),stabilityTimeout&&(clearTimeout(stabilityTimeout),stabilityTimeout=void 0),!socket||activePorts.size===0){console.log("[Worker] Connection closed or no active ports. No retries.");return}if(n.code===AUTH_CODE&¤tMode==="remote"){authRetryCount<MAX_AUTH_ATTEMPTS?(authRetryCount++,console.warn(`[Worker] Auth failed (3000). Requesting new token... (Attempt ${authRetryCount}/${MAX_AUTH_ATTEMPTS})`),broadcast({type:"TOKEN_EXPIRED"})):(broadcast({type:"STATUS_UPDATE",auth:types_status.AuthStatus.FAILED}),broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.AUTH_FAILED,message:`Maximum authentication attempts (${MAX_AUTH_ATTEMPTS}) reached. Please log in again.`}));return}if(currentMode==="remote"&&RECONNECT_CODES.has(n.code)){if(retryCount<MAX_RECONNECT_ATTEMPTS){retryCount++;const e=Math.min(1e3*retryCount,5e3);console.log(`[Worker] Reconnecting (network code: ${n.code}) in ${e}ms... (Attempt ${retryCount}/${MAX_RECONNECT_ATTEMPTS})`),broadcast({type:"STATUS_UPDATE",connection:types_status.ConnectionStatus.RECONNECTING}),setTimeout(()=>{activePorts.size>0&&socket&&connect(currentAddr,currentToken,isBinaryMode,currentMode)},e)}else broadcast({type:"STATUS_UPDATE",connection:types_status.ConnectionStatus.DISCONNECTED}),broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.RECONNECT_FAILED,message:`Maximum reconnection attempts (${MAX_RECONNECT_ATTEMPTS}) reached. Connection lost.`});return}broadcast({type:"DISCONNECTED"}),broadcast({type:"ERROR",code:types_status.StateStreamErrorCode.CONNECTION_LOST,message:`Stream closed with unexpected code: ${n.code}. Stopping stream.`})}}function handleCommand(d,u){switch(d.type){case"START":activePorts.add(u),socket&&socket.readyState===WebSocket.OPEN&¤tAddr===d.addr?(u.postMessage({type:"CONNECTED"}),u.postMessage({type:"STATUS_UPDATE",auth:types_status.AuthStatus.AUTHENTICATED})):connect(d.addr,d.token,d.isBinary,d.mode);break;case"STOP":activePorts.delete(u);for(const[e,r]of subscriptions.entries())r.delete(u),r.size===0&&(subscriptions.delete(e),(socket==null?void 0:socket.readyState)===WebSocket.OPEN&¤tMode==="remote"&&socket.send(JSON.stringify({unsubscribe:[e]})));u.postMessage({type:"STATUS_UPDATE",connection:types_status.ConnectionStatus.DISCONNECTED}),activePorts.size===0&&stopAndCleanup();break;case"UPDATE_TOKEN":const h=currentToken;if(currentToken=d.token,currentMode==="remote"){const e=socket&&socket.readyState===WebSocket.OPEN;if(e&&h===d.token)return;e?sendAuth():h!==d.token&¤tAddr&&activePorts.size>0&&connect(currentAddr,currentToken,isBinaryMode,currentMode)}break;case"SUBSCRIBE":let c=subscriptions.get(d.guid);c||(c=new Set,subscriptions.set(d.guid,c));const l=c.size===0;c.add(u),l&&(socket==null?void 0:socket.readyState)===WebSocket.OPEN&¤tMode==="remote"&&socket.send(JSON.stringify({subscribe:[d.guid]}));break;case"UNSUBSCRIBE":const n=subscriptions.get(d.guid);n&&(n.delete(u),n.size===0&&(subscriptions.delete(d.guid),(socket==null?void 0:socket.readyState)===WebSocket.OPEN&¤tMode==="remote"&&socket.send(JSON.stringify({unsubscribe:[d.guid]}))));break}}if("SharedWorkerGlobalScope"in self){const d=self;d.onconnect=u=>{const h=u.ports[0];h&&(h.onmessage=c=>handleCommand(c.data,h),h.start())}}else{const d=self;d.onmessage=u=>{handleCommand(u.data,d)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { }
|