@chainstream-io/centrifuge 1.0.5 → 1.0.6

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.
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var Ze=Object.create;var Bt=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var P=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports);var en=(s,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Qe(r))!tn.call(s,o)&&o!==i&&Bt(s,o,{get:()=>r[o],enumerable:!(n=Xe(r,o))||n.enumerable});return s};var Q=(s,r,i)=>(i=s!=null?Ze(Ye(s)):{},en(r||!s||!s.__esModule?Bt(i,"default",{value:s,enumerable:!0}):i,s));var gt=P((Rn,_t)=>{"use strict";var W=typeof Reflect=="object"?Reflect:null,Ut=W&&typeof W.apply=="function"?W.apply:function(r,i,n){return Function.prototype.apply.call(r,i,n)},Y;W&&typeof W.ownKeys=="function"?Y=W.ownKeys:Object.getOwnPropertySymbols?Y=function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:Y=function(r){return Object.getOwnPropertyNames(r)};function nn(s){console&&console.warn&&console.warn(s)}var Nt=Number.isNaN||function(r){return r!==r};function v(){v.init.call(this)}_t.exports=v;_t.exports.once=sn;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var zt=10;function tt(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return zt},set:function(s){if(typeof s!="number"||s<0||Nt(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");zt=s}});v.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};v.prototype.setMaxListeners=function(r){if(typeof r!="number"||r<0||Nt(r))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+r+".");return this._maxListeners=r,this};function Mt(s){return s._maxListeners===void 0?v.defaultMaxListeners:s._maxListeners}v.prototype.getMaxListeners=function(){return Mt(this)};v.prototype.emit=function(r){for(var i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);var o=r==="error",t=this._events;if(t!==void 0)o=o&&t.error===void 0;else if(!o)return!1;if(o){var e;if(i.length>0&&(e=i[0]),e instanceof Error)throw e;var l=new Error("Unhandled error."+(e?" ("+e.message+")":""));throw l.context=e,l}var c=t[r];if(c===void 0)return!1;if(typeof c=="function")Ut(c,this,i);else for(var u=c.length,p=$t(c,u),n=0;n<u;++n)Ut(p[n],this,i);return!0};function Ft(s,r,i,n){var o,t,e;if(tt(i),t=s._events,t===void 0?(t=s._events=Object.create(null),s._eventsCount=0):(t.newListener!==void 0&&(s.emit("newListener",r,i.listener?i.listener:i),t=s._events),e=t[r]),e===void 0)e=t[r]=i,++s._eventsCount;else if(typeof e=="function"?e=t[r]=n?[i,e]:[e,i]:n?e.unshift(i):e.push(i),o=Mt(s),o>0&&e.length>o&&!e.warned){e.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+e.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=s,l.type=r,l.count=e.length,nn(l)}return s}v.prototype.addListener=function(r,i){return Ft(this,r,i,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(r,i){return Ft(this,r,i,!0)};function on(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Wt(s,r,i){var n={fired:!1,wrapFn:void 0,target:s,type:r,listener:i},o=on.bind(n);return o.listener=i,n.wrapFn=o,o}v.prototype.once=function(r,i){return tt(i),this.on(r,Wt(this,r,i)),this};v.prototype.prependOnceListener=function(r,i){return tt(i),this.prependListener(r,Wt(this,r,i)),this};v.prototype.removeListener=function(r,i){var n,o,t,e,l;if(tt(i),o=this._events,o===void 0)return this;if(n=o[r],n===void 0)return this;if(n===i||n.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete o[r],o.removeListener&&this.emit("removeListener",r,n.listener||i));else if(typeof n!="function"){for(t=-1,e=n.length-1;e>=0;e--)if(n[e]===i||n[e].listener===i){l=n[e].listener,t=e;break}if(t<0)return this;t===0?n.shift():rn(n,t),n.length===1&&(o[r]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",r,l||i)}return this};v.prototype.off=v.prototype.removeListener;v.prototype.removeAllListeners=function(r){var i,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[r]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[r]),this;if(arguments.length===0){var t=Object.keys(n),e;for(o=0;o<t.length;++o)e=t[o],e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=n[r],typeof i=="function")this.removeListener(r,i);else if(i!==void 0)for(o=i.length-1;o>=0;o--)this.removeListener(r,i[o]);return this};function Ht(s,r,i){var n=s._events;if(n===void 0)return[];var o=n[r];return o===void 0?[]:typeof o=="function"?i?[o.listener||o]:[o]:i?cn(o):$t(o,o.length)}v.prototype.listeners=function(r){return Ht(this,r,!0)};v.prototype.rawListeners=function(r){return Ht(this,r,!1)};v.listenerCount=function(s,r){return typeof s.listenerCount=="function"?s.listenerCount(r):Jt.call(s,r)};v.prototype.listenerCount=Jt;function Jt(s){var r=this._events;if(r!==void 0){var i=r[s];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?Y(this._events):[]};function $t(s,r){for(var i=new Array(r),n=0;n<r;++n)i[n]=s[n];return i}function rn(s,r){for(;r+1<s.length;r++)s[r]=s[r+1];s.pop()}function cn(s){for(var r=new Array(s.length),i=0;i<r.length;++i)r[i]=s[i].listener||s[i];return r}function sn(s,r){return new Promise(function(i,n){function o(e){s.removeListener(r,t),n(e)}function t(){typeof s.removeListener=="function"&&s.removeListener("error",o),i([].slice.call(arguments))}Vt(s,r,t,{once:!0}),r!=="error"&&ln(s,o,{once:!0})})}function ln(s,r,i){typeof s.on=="function"&&Vt(s,"error",r,i)}function Vt(s,r,i,n){if(typeof s.on=="function")n.once?s.once(r,i):s.on(r,i);else if(typeof s.addEventListener=="function")s.addEventListener(r,function o(t){n.once&&s.removeEventListener(r,o),i(t)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var te=P((xi,Yt)=>{"use strict";Yt.exports=yn;function yn(s,r){for(var i=new Array(arguments.length-1),n=0,o=2,t=!0;o<arguments.length;)i[n++]=arguments[o++];return new Promise(function(l,c){i[n]=function(p){if(t)if(t=!1,p)c(p);else{for(var y=new Array(arguments.length-1),w=0;w<y.length;)y[w++]=arguments[w];l.apply(null,y)}};try{s.apply(r||null,i)}catch(u){t&&(t=!1,c(u))}})}});var oe=P(ie=>{"use strict";var ut=ie;ut.length=function(r){var i=r.length;if(!i)return 0;for(var n=0;--i%4>1&&r.charAt(i)==="=";)++n;return Math.ceil(r.length*3)/4-n};var $=new Array(64),ne=new Array(123);for(D=0;D<64;)ne[$[D]=D<26?D+65:D<52?D+71:D<62?D-4:D-59|43]=D++;var D;ut.encode=function(r,i,n){for(var o=null,t=[],e=0,l=0,c;i<n;){var u=r[i++];switch(l){case 0:t[e++]=$[u>>2],c=(u&3)<<4,l=1;break;case 1:t[e++]=$[c|u>>4],c=(u&15)<<2,l=2;break;case 2:t[e++]=$[c|u>>6],t[e++]=$[u&63],l=0;break}e>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,t)),e=0)}return l&&(t[e++]=$[c],t[e++]=61,l===1&&(t[e++]=61)),o?(e&&o.push(String.fromCharCode.apply(String,t.slice(0,e))),o.join("")):String.fromCharCode.apply(String,t.slice(0,e))};var ee="invalid encoding";ut.decode=function(r,i,n){for(var o=n,t=0,e,l=0;l<r.length;){var c=r.charCodeAt(l++);if(c===61&&t>1)break;if((c=ne[c])===void 0)throw Error(ee);switch(t){case 0:e=c,t=1;break;case 1:i[n++]=e<<2|(c&48)>>4,e=c,t=2;break;case 2:i[n++]=(e&15)<<4|(c&60)>>2,e=c,t=3;break;case 3:i[n++]=(e&3)<<6|c,t=0;break}}if(t===1)throw Error(ee);return n-o};ut.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}});var ce=P((ji,re)=>{"use strict";re.exports=ft;function ft(){this._listeners={}}ft.prototype.on=function(r,i,n){return(this._listeners[r]||(this._listeners[r]=[])).push({fn:i,ctx:n||this}),this};ft.prototype.off=function(r,i){if(r===void 0)this._listeners={};else if(i===void 0)this._listeners[r]=[];else for(var n=this._listeners[r],o=0;o<n.length;)n[o].fn===i?n.splice(o,1):++o;return this};ft.prototype.emit=function(r){var i=this._listeners[r];if(i){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<i.length;)i[o].fn.apply(i[o++].ctx,n)}return this}});var pe=P((Ti,he)=>{"use strict";he.exports=se(se);function se(s){return typeof Float32Array<"u"?function(){var r=new Float32Array([-0]),i=new Uint8Array(r.buffer),n=i[3]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3]}function t(c,u,p){r[0]=c,u[p]=i[3],u[p+1]=i[2],u[p+2]=i[1],u[p+3]=i[0]}s.writeFloatLE=n?o:t,s.writeFloatBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],r[0]}function l(c,u){return i[3]=c[u],i[2]=c[u+1],i[1]=c[u+2],i[0]=c[u+3],r[0]}s.readFloatLE=n?e:l,s.readFloatBE=n?l:e}():function(){function r(n,o,t,e){var l=o<0?1:0;if(l&&(o=-o),o===0)n(1/o>0?0:2147483648,t,e);else if(isNaN(o))n(2143289344,t,e);else if(o>34028234663852886e22)n((l<<31|2139095040)>>>0,t,e);else if(o<11754943508222875e-54)n((l<<31|Math.round(o/1401298464324817e-60))>>>0,t,e);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((l<<31|c+127<<23|u)>>>0,t,e)}}s.writeFloatLE=r.bind(null,le),s.writeFloatBE=r.bind(null,ue);function i(n,o,t){var e=n(o,t),l=(e>>31)*2+1,c=e>>>23&255,u=e&8388607;return c===255?u?NaN:l*(1/0):c===0?l*1401298464324817e-60*u:l*Math.pow(2,c-150)*(u+8388608)}s.readFloatLE=i.bind(null,fe),s.readFloatBE=i.bind(null,ae)}(),typeof Float64Array<"u"?function(){var r=new Float64Array([-0]),i=new Uint8Array(r.buffer),n=i[7]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3],u[p+4]=i[4],u[p+5]=i[5],u[p+6]=i[6],u[p+7]=i[7]}function t(c,u,p){r[0]=c,u[p]=i[7],u[p+1]=i[6],u[p+2]=i[5],u[p+3]=i[4],u[p+4]=i[3],u[p+5]=i[2],u[p+6]=i[1],u[p+7]=i[0]}s.writeDoubleLE=n?o:t,s.writeDoubleBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],i[4]=c[u+4],i[5]=c[u+5],i[6]=c[u+6],i[7]=c[u+7],r[0]}function l(c,u){return i[7]=c[u],i[6]=c[u+1],i[5]=c[u+2],i[4]=c[u+3],i[3]=c[u+4],i[2]=c[u+5],i[1]=c[u+6],i[0]=c[u+7],r[0]}s.readDoubleLE=n?e:l,s.readDoubleBE=n?l:e}():function(){function r(n,o,t,e,l,c){var u=e<0?1:0;if(u&&(e=-e),e===0)n(0,l,c+o),n(1/e>0?0:2147483648,l,c+t);else if(isNaN(e))n(0,l,c+o),n(2146959360,l,c+t);else if(e>17976931348623157e292)n(0,l,c+o),n((u<<31|2146435072)>>>0,l,c+t);else{var p;if(e<22250738585072014e-324)p=e/5e-324,n(p>>>0,l,c+o),n((u<<31|p/4294967296)>>>0,l,c+t);else{var y=Math.floor(Math.log(e)/Math.LN2);y===1024&&(y=1023),p=e*Math.pow(2,-y),n(p*4503599627370496>>>0,l,c+o),n((u<<31|y+1023<<20|p*1048576&1048575)>>>0,l,c+t)}}}s.writeDoubleLE=r.bind(null,le,0,4),s.writeDoubleBE=r.bind(null,ue,4,0);function i(n,o,t,e,l){var c=n(e,l+o),u=n(e,l+t),p=(u>>31)*2+1,y=u>>>20&2047,w=4294967296*(u&1048575)+c;return y===2047?w?NaN:p*(1/0):y===0?p*5e-324*w:p*Math.pow(2,y-1075)*(w+4503599627370496)}s.readDoubleLE=i.bind(null,fe,0,4),s.readDoubleBE=i.bind(null,ae,4,0)}(),s}function le(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}function ue(s,r,i){r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255}function fe(s,r){return(s[r]|s[r+1]<<8|s[r+2]<<16|s[r+3]<<24)>>>0}function ae(s,r){return(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3])>>>0}});var de=P((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(s){}return null}});var ye=P(be=>{"use strict";var Ot=be;Ot.length=function(r){for(var i=0,n=0,o=0;o<r.length;++o)n=r.charCodeAt(o),n<128?i+=1:n<2048?i+=2:(n&64512)===55296&&(r.charCodeAt(o+1)&64512)===56320?(++o,i+=4):i+=3;return i};Ot.read=function(r,i,n){var o=n-i;if(o<1)return"";for(var t=null,e=[],l=0,c;i<n;)c=r[i++],c<128?e[l++]=c:c>191&&c<224?e[l++]=(c&31)<<6|r[i++]&63:c>239&&c<365?(c=((c&7)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,e[l++]=55296+(c>>10),e[l++]=56320+(c&1023)):e[l++]=(c&15)<<12|(r[i++]&63)<<6|r[i++]&63,l>8191&&((t||(t=[])).push(String.fromCharCode.apply(String,e)),l=0);return t?(l&&t.push(String.fromCharCode.apply(String,e.slice(0,l))),t.join("")):String.fromCharCode.apply(String,e.slice(0,l))};Ot.write=function(r,i,n){for(var o=n,t,e,l=0;l<r.length;++l)t=r.charCodeAt(l),t<128?i[n++]=t:t<2048?(i[n++]=t>>6|192,i[n++]=t&63|128):(t&64512)===55296&&((e=r.charCodeAt(l+1))&64512)===56320?(t=65536+((t&1023)<<10)+(e&1023),++l,i[n++]=t>>18|240,i[n++]=t>>12&63|128,i[n++]=t>>6&63|128,i[n++]=t&63|128):(i[n++]=t>>12|224,i[n++]=t>>6&63|128,i[n++]=t&63|128);return n-o}});var ge=P((Di,_e)=>{"use strict";_e.exports=_n;function _n(s,r,i){var n=i||8192,o=n>>>1,t=null,e=n;return function(c){if(c<1||c>o)return s(c);e+c>n&&(t=s(n),e=0);var u=r.call(t,e,e+=c);return e&7&&(e=(e|7)+1),u}}});var ke=P((Ci,ve)=>{"use strict";ve.exports=m;var K=B();function m(s,r){this.lo=s>>>0,this.hi=r>>>0}var M=m.zero=new m(0,0);M.toNumber=function(){return 0};M.zzEncode=M.zzDecode=function(){return this};M.length=function(){return 1};var gn=m.zeroHash="\0\0\0\0\0\0\0\0";m.fromNumber=function(r){if(r===0)return M;var i=r<0;i&&(r=-r);var n=r>>>0,o=(r-n)/4294967296>>>0;return i&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new m(n,o)};m.from=function(r){if(typeof r=="number")return m.fromNumber(r);if(K.isString(r))if(K.Long)r=K.Long.fromString(r);else return m.fromNumber(parseInt(r,10));return r.low||r.high?new m(r.low>>>0,r.high>>>0):M};m.prototype.toNumber=function(r){if(!r&&this.hi>>>31){var i=~this.lo+1>>>0,n=~this.hi>>>0;return i||(n=n+1>>>0),-(i+n*4294967296)}return this.lo+this.hi*4294967296};m.prototype.toLong=function(r){return K.Long?new K.Long(this.lo|0,this.hi|0,!!r):{low:this.lo|0,high:this.hi|0,unsigned:!!r}};var A=String.prototype.charCodeAt;m.fromHash=function(r){return r===gn?M:new m((A.call(r,0)|A.call(r,1)<<8|A.call(r,2)<<16|A.call(r,3)<<24)>>>0,(A.call(r,4)|A.call(r,5)<<8|A.call(r,6)<<16|A.call(r,7)<<24)>>>0)};m.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)};m.prototype.zzEncode=function(){var r=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^r)>>>0,this.lo=(this.lo<<1^r)>>>0,this};m.prototype.zzDecode=function(){var r=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^r)>>>0,this.hi=(this.hi>>>1^r)>>>0,this};m.prototype.length=function(){var r=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?i===0?r<16384?r<128?1:2:r<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}});var B=P(Pt=>{"use strict";var d=Pt;d.asPromise=te();d.base64=oe();d.EventEmitter=ce();d.float=pe();d.inquire=de();d.utf8=ye();d.pool=ge();d.LongBits=ke();d.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);d.global=d.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Pt;d.emptyArray=Object.freeze?Object.freeze([]):[];d.emptyObject=Object.freeze?Object.freeze({}):{};d.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};d.isString=function(r){return typeof r=="string"||r instanceof String};d.isObject=function(r){return r&&typeof r=="object"};d.isset=d.isSet=function(r,i){var n=r[i];return n!=null&&r.hasOwnProperty(i)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};d.Buffer=function(){try{var s=d.inquire("buffer").Buffer;return s.prototype.utf8Write?s:null}catch{return null}}();d._Buffer_from=null;d._Buffer_allocUnsafe=null;d.newBuffer=function(r){return typeof r=="number"?d.Buffer?d._Buffer_allocUnsafe(r):new d.Array(r):d.Buffer?d._Buffer_from(r):typeof Uint8Array>"u"?r:new Uint8Array(r)};d.Array=typeof Uint8Array<"u"?Uint8Array:Array;d.Long=d.global.dcodeIO&&d.global.dcodeIO.Long||d.global.Long||d.inquire("long");d.key2Re=/^true|false|0|1$/;d.key32Re=/^-?(?:0|[1-9][0-9]*)$/;d.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;d.longToHash=function(r){return r?d.LongBits.from(r).toHash():d.LongBits.zeroHash};d.longFromHash=function(r,i){var n=d.LongBits.fromHash(r);return d.Long?d.Long.fromBits(n.lo,n.hi,i):n.toNumber(!!i)};function we(s,r,i){for(var n=Object.keys(r),o=0;o<n.length;++o)(s[n[o]]===void 0||!i)&&(s[n[o]]=r[n[o]]);return s}d.merge=we;d.lcFirst=function(r){return r.charAt(0).toLowerCase()+r.substring(1)};function Oe(s){function r(i,n){if(!(this instanceof r))return new r(i,n);Object.defineProperty(this,"message",{get:function(){return i}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&we(this,n)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return s},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}d.newError=Oe;d.ProtocolError=Oe("ProtocolError");d.oneOfGetter=function(r){for(var i={},n=0;n<r.length;++n)i[r[n]]=1;return function(){for(var o=Object.keys(this),t=o.length-1;t>-1;--t)if(i[o[t]]===1&&this[o[t]]!==void 0&&this[o[t]]!==null)return o[t]}};d.oneOfSetter=function(r){return function(i){for(var n=0;n<r.length;++n)r[n]!==i&&delete this[r[n]]}};d.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};d._configure=function(){var s=d.Buffer;if(!s){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=s.from!==Uint8Array.from&&s.from||function(i,n){return new s(i,n)},d._Buffer_allocUnsafe=s.allocUnsafe||function(i){return new s(i)}}});var Et=P((Ii,xe)=>{"use strict";xe.exports=_;var E=B(),St,at=E.LongBits,Pe=E.base64,Se=E.utf8;function Z(s,r,i){this.fn=s,this.len=r,this.next=void 0,this.val=i}function xt(){}function vn(s){this.head=s.head,this.tail=s.tail,this.len=s.len,this.next=s.states}function _(){this.len=0,this.head=new Z(xt,0,0),this.tail=this.head,this.states=null}var me=function(){return E.Buffer?function(){return(_.create=function(){return new St})()}:function(){return new _}};_.create=me();_.alloc=function(r){return new E.Array(r)};E.Array!==Array&&(_.alloc=E.pool(_.alloc,E.Array.prototype.subarray));_.prototype._push=function(r,i,n){return this.tail=this.tail.next=new Z(r,i,n),this.len+=i,this};function Rt(s,r,i){r[i]=s&255}function kn(s,r,i){for(;s>127;)r[i++]=s&127|128,s>>>=7;r[i]=s}function jt(s,r){this.len=s,this.next=void 0,this.val=r}jt.prototype=Object.create(Z.prototype);jt.prototype.fn=kn;_.prototype.uint32=function(r){return this.len+=(this.tail=this.tail.next=new jt((r=r>>>0)<128?1:r<16384?2:r<2097152?3:r<268435456?4:5,r)).len,this};_.prototype.int32=function(r){return r<0?this._push(Tt,10,at.fromNumber(r)):this.uint32(r)};_.prototype.sint32=function(r){return this.uint32((r<<1^r>>31)>>>0)};function Tt(s,r,i){for(;s.hi;)r[i++]=s.lo&127|128,s.lo=(s.lo>>>7|s.hi<<25)>>>0,s.hi>>>=7;for(;s.lo>127;)r[i++]=s.lo&127|128,s.lo=s.lo>>>7;r[i++]=s.lo}_.prototype.uint64=function(r){var i=at.from(r);return this._push(Tt,i.length(),i)};_.prototype.int64=_.prototype.uint64;_.prototype.sint64=function(r){var i=at.from(r).zzEncode();return this._push(Tt,i.length(),i)};_.prototype.bool=function(r){return this._push(Rt,1,r?1:0)};function mt(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}_.prototype.fixed32=function(r){return this._push(mt,4,r>>>0)};_.prototype.sfixed32=_.prototype.fixed32;_.prototype.fixed64=function(r){var i=at.from(r);return this._push(mt,4,i.lo)._push(mt,4,i.hi)};_.prototype.sfixed64=_.prototype.fixed64;_.prototype.float=function(r){return this._push(E.float.writeFloatLE,4,r)};_.prototype.double=function(r){return this._push(E.float.writeDoubleLE,8,r)};var wn=E.Array.prototype.set?function(r,i,n){i.set(r,n)}:function(r,i,n){for(var o=0;o<r.length;++o)i[n+o]=r[o]};_.prototype.bytes=function(r){var i=r.length>>>0;if(!i)return this._push(Rt,1,0);if(E.isString(r)){var n=_.alloc(i=Pe.length(r));Pe.decode(r,n,0),r=n}return this.uint32(i)._push(wn,i,r)};_.prototype.string=function(r){var i=Se.length(r);return i?this.uint32(i)._push(Se.write,i,r):this._push(Rt,1,0)};_.prototype.fork=function(){return this.states=new vn(this),this.head=this.tail=new Z(xt,0,0),this.len=0,this};_.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Z(xt,0,0),this.len=0),this};_.prototype.ldelim=function(){var r=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=r.next,this.tail=i,this.len+=n),this};_.prototype.finish=function(){for(var r=this.head.next,i=this.constructor.alloc(this.len),n=0;r;)r.fn(r.val,i,n),n+=r.len,r=r.next;return i};_._configure=function(s){St=s,_.create=me(),St._configure()}});var Te=P((qi,je)=>{"use strict";je.exports=I;var Re=Et();(I.prototype=Object.create(Re.prototype)).constructor=I;var U=B();function I(){Re.call(this)}I._configure=function(){I.alloc=U._Buffer_allocUnsafe,I.writeBytesBuffer=U.Buffer&&U.Buffer.prototype instanceof Uint8Array&&U.Buffer.prototype.set.name==="set"?function(r,i,n){i.set(r,n)}:function(r,i,n){if(r.copy)r.copy(i,n,0,r.length);else for(var o=0;o<r.length;)i[n++]=r[o++]}};I.prototype.bytes=function(r){U.isString(r)&&(r=U._Buffer_from(r,"base64"));var i=r.length>>>0;return this.uint32(i),i&&this._push(I.writeBytesBuffer,i,r),this};function On(s,r,i){s.length<40?U.utf8.write(s,r,i):r.utf8Write?r.utf8Write(s,i):r.write(s,i)}I.prototype.string=function(r){var i=U.Buffer.byteLength(r);return this.uint32(i),i&&this._push(On,i,r),this};I._configure()});var Lt=P((Ai,Ie)=>{"use strict";Ie.exports=O;var C=B(),Ct,Ce=C.LongBits,Pn=C.utf8;function L(s,r){return RangeError("index out of range: "+s.pos+" + "+(r||1)+" > "+s.len)}function O(s){this.buf=s,this.pos=0,this.len=s.length}var Ee=typeof Uint8Array<"u"?function(r){if(r instanceof Uint8Array||Array.isArray(r))return new O(r);throw Error("illegal buffer")}:function(r){if(Array.isArray(r))return new O(r);throw Error("illegal buffer")},Le=function(){return C.Buffer?function(i){return(O.create=function(o){return C.Buffer.isBuffer(o)?new Ct(o):Ee(o)})(i)}:Ee};O.create=Le();O.prototype._slice=C.Array.prototype.subarray||C.Array.prototype.slice;O.prototype.uint32=function(){var r=4294967295;return function(){if(r=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(r=(r|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return r;if((this.pos+=5)>this.len)throw this.pos=this.len,L(this,10);return r}}();O.prototype.int32=function(){return this.uint32()|0};O.prototype.sint32=function(){var r=this.uint32();return r>>>1^-(r&1)|0};function Dt(){var s=new Ce(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*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;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw L(this);if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return s}return s.lo=(s.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,s}if(this.len-this.pos>4){for(;r<5;++r)if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}else for(;r<5;++r){if(this.pos>=this.len)throw L(this);if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}throw Error("invalid varint encoding")}O.prototype.bool=function(){return this.uint32()!==0};function ht(s,r){return(s[r-4]|s[r-3]<<8|s[r-2]<<16|s[r-1]<<24)>>>0}O.prototype.fixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)};O.prototype.sfixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)|0};function De(){if(this.pos+8>this.len)throw L(this,8);return new Ce(ht(this.buf,this.pos+=4),ht(this.buf,this.pos+=4))}O.prototype.float=function(){if(this.pos+4>this.len)throw L(this,4);var r=C.float.readFloatLE(this.buf,this.pos);return this.pos+=4,r};O.prototype.double=function(){if(this.pos+8>this.len)throw L(this,4);var r=C.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,r};O.prototype.bytes=function(){var r=this.uint32(),i=this.pos,n=this.pos+r;if(n>this.len)throw L(this,r);if(this.pos+=r,Array.isArray(this.buf))return this.buf.slice(i,n);if(i===n){var o=C.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,i,n)};O.prototype.string=function(){var r=this.bytes();return Pn.read(r,0,r.length)};O.prototype.skip=function(r){if(typeof r=="number"){if(this.pos+r>this.len)throw L(this,r);this.pos+=r}else do if(this.pos>=this.len)throw L(this);while(this.buf[this.pos++]&128);return this};O.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};O._configure=function(s){Ct=s,O.create=Le(),Ct._configure();var r=C.Long?"toLong":"toNumber";C.merge(O.prototype,{int64:function(){return Dt.call(this)[r](!1)},uint64:function(){return Dt.call(this)[r](!0)},sint64:function(){return Dt.call(this).zzDecode()[r](!1)},fixed64:function(){return De.call(this)[r](!0)},sfixed64:function(){return De.call(this)[r](!1)}})}});var Ue=P((Bi,Be)=>{"use strict";Be.exports=F;var Ae=Lt();(F.prototype=Object.create(Ae.prototype)).constructor=F;var qe=B();function F(s){Ae.call(this,s)}F._configure=function(){qe.Buffer&&(F.prototype._slice=qe.Buffer.prototype.slice)};F.prototype.string=function(){var r=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+r,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+r,this.len))};F._configure()});var Ne=P((Ui,ze)=>{"use strict";ze.exports=X;var It=B();(X.prototype=Object.create(It.EventEmitter.prototype)).constructor=X;function X(s,r,i){if(typeof s!="function")throw TypeError("rpcImpl must be a function");It.EventEmitter.call(this),this.rpcImpl=s,this.requestDelimited=!!r,this.responseDelimited=!!i}X.prototype.rpcCall=function s(r,i,n,o,t){if(!o)throw TypeError("request must be specified");var e=this;if(!t)return It.asPromise(s,e,r,i,n,o);if(!e.rpcImpl){setTimeout(function(){t(Error("already ended"))},0);return}try{return e.rpcImpl(r,i[e.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return e.emit("error",c,r),t(c);if(u===null){e.end(!0);return}if(!(u instanceof n))try{u=n[e.responseDelimited?"decodeDelimited":"decode"](u)}catch(p){return e.emit("error",p,r),t(p)}return e.emit("data",u,r),t(null,u)})}catch(l){e.emit("error",l,r),setTimeout(function(){t(l)},0);return}};X.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Fe=P(Me=>{"use strict";var Sn=Me;Sn.Service=Ne()});var He=P((Ni,We)=>{"use strict";We.exports={}});var Ve=P($e=>{"use strict";var j=$e;j.build="minimal";j.Writer=Et();j.BufferWriter=Te();j.Reader=Lt();j.BufferReader=Ue();j.util=B();j.rpc=Fe();j.roots=He();j.configure=Je;function Je(){j.util._configure(),j.Writer._configure(j.BufferWriter),j.Reader._configure(j.BufferReader)}Je()});var qt=P((Fi,Ge)=>{"use strict";Ge.exports=Ve()});var Xt=Q(gt());var et=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected",n))(et||{}),nt=(n=>(n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed",n))(nt||{});function Gt(s,r){return s.lastIndexOf(r,0)===0}function vt(s){return s==null?!1:typeof s=="function"}function Kt(s,r){if(globalThis.console){let i=globalThis.console[s];vt(i)&&i.apply(globalThis.console,r)}}function un(s,r){return Math.floor(Math.random()*(r-s+1)+s)}function H(s,r,i){s>31&&(s=31);let n=un(0,Math.min(i,r*Math.pow(2,s)));return Math.min(i,r+n)}function Zt(s){return"error"in s&&s.error!==null}function J(s){return Math.min(s*1e3,2147483647)}var it=class extends Xt.default{constructor(i,n,o){super();this._resubscribeTimeout=null;this._refreshTimeout=null;this.channel=n,this.state="unsubscribed",this._centrifuge=i,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._filter="",this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(o),this._centrifuge._debugEnabled?(this.on("state",t=>{this._debug("subscription state",n,t.oldState,"->",t.newState)}),this.on("error",t=>{this._debug("subscription error",n,t)})):this.on("error",function(){Function.prototype()})}ready(i){return this.state==="unsubscribed"?Promise.reject({code:7,message:this.state}):this.state==="subscribed"?Promise.resolve():new Promise((n,o)=>{let t={resolve:n,reject:o};i&&(t.timeout=setTimeout(function(){o({code:1,message:"timeout"})},i)),this._promises[this._nextPromiseId()]=t})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(0,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(0,"unsubscribe called",!0)}async publish(i){return await this._methodCall(),this._centrifuge.publish(this.channel,i)}async presence(){return await this._methodCall(),this._centrifuge.presence(this.channel)}async presenceStats(){return await this._methodCall(),this._centrifuge.presenceStats(this.channel)}async history(i){return await this._methodCall(),this._centrifuge.history(this.channel,i)}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:7,message:this.state}):new Promise((i,n)=>{let o=this._centrifuge._config.timeout,t=setTimeout(()=>{n({code:1,message:"timeout"})},o);this._promises[this._nextPromiseId()]={timeout:t,resolve:i,reject:n}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state==="unsubscribed"}_isSubscribing(){return this.state==="subscribing"}_isSubscribed(){return this.state==="subscribed"}_setState(i){if(this.state!==i){let n=this.state;return this.state=i,this.emit("state",{newState:i,oldState:n,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(i){if(!this._isSubscribing())return;this._clearSubscribingState(),i.recoverable&&(this._recover=!0,this._offset=i.offset||0,this._epoch=i.epoch||""),i.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState("subscribed");let n=this._centrifuge._getSubscribeContext(this.channel,i);this.emit("subscribed",n),this._resolvePromises();let o=i.publications;if(o&&o.length>0)for(let t in o)o.hasOwnProperty(t)&&this._handlePublication(o[t]);i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl)))}async _setSubscribing(i,n){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState("subscribing")&&this.emit("subscribing",{channel:this.channel,code:i,reason:n}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&await this._unsubPromise,this._isSubscribing()&&this._subscribe())}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(i=>this._handleTokenResponse(i)).catch(i=>this._handleTokenError(i)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(i){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(n=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=n,this._sendSubscribe(i)}).catch(n=>this._handleGetDataError(n))}_handleGetDataError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:12,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(i){if(!this._isSubscribing()){this._inflight=!1;return}if(!i){this._inflight=!1,this._failUnauthorized();return}this._token=i,this._getData?this._getDataAndSubscribe(i):this._sendSubscribe(i)}_handleTokenError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:8,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(i){if(!this._isTransportOpen())return this._inflight=!1,null;let n=this._buildSubscribeCommand(i);return this._centrifuge._call(n).then(o=>{this._inflight=!1;let t=o.reply.subscribe;this._handleSubscribeResponse(t),o.next&&o.next()},o=>{this._inflight=!1,this._handleSubscribeError(o.error),o.next&&o.next()}),n}_buildSubscribeCommand(i){let n={channel:this.channel};if(i&&(n.token=i),this._data&&(n.data=this._data),this._positioned&&(n.positioned=!0),this._recoverable&&(n.recoverable=!0),this._joinLeave&&(n.join_leave=!0),this._needRecover()){n.recover=!0;let o=this._getOffset();o&&(n.offset=o);let t=this._getEpoch();t&&(n.epoch=t)}return this._delta&&(n.delta=this._delta),this._filter&&(n.filter=this._filter),{subscribe:n}}_debug(...i){this._centrifuge._debug(...i)}_handleSubscribeError(i){if(this._isSubscribing()){if(i.code===1){this._centrifuge._disconnect(3,"subscribe timeout",!0);return}this._subscribeError(i)}}_handleSubscribeResponse(i){this._isSubscribing()&&this._setSubscribed(i)}_setUnsubscribed(i,n,o){if(this._isUnsubscribed())return Promise.resolve();let t=Promise.resolve();return this._isSubscribed()?(o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState("unsubscribed")&&this.emit("unsubscribed",{channel:this.channel,code:i,reason:n}),this._rejectPromises({code:7,message:this.state}),t}_handlePublication(i){if(this._delta&&this._delta_negotiated){let{newData:o,newPrevValue:t}=this._centrifuge._codec.applyDeltaIfNeeded(i,this._prevValue);i.data=o,this._prevValue=t}let n=this._centrifuge._getPublicationContext(this.channel,i);this.emit("publication",n),i.offset&&(this._offset=i.offset)}_handleJoin(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("join",{channel:this.channel,info:n})}_handleLeave(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("leave",{channel:this.channel,info:n})}_resolvePromises(){for(let i in this._promises)this._promises.hasOwnProperty(i)&&(this._promises[i].timeout&&clearTimeout(this._promises[i].timeout),this._promises[i].resolve(),delete this._promises[i])}_rejectPromises(i){for(let n in this._promises)this._promises.hasOwnProperty(n)&&(this._promises[n].timeout&&clearTimeout(this._promises[n].timeout),this._promises[n].reject(i),delete this._promises[n])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}let i=this,n=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){i._isSubscribing()&&i._subscribe()},n),this._debug("resubscribe scheduled after "+n,this.channel)}_subscribeError(i){if(this._isSubscribing())if(i.code<100||i.code===109||i.temporary===!0){i.code===109&&(this._token="");let n={channel:this.channel,type:"subscribe",error:i};this._centrifuge.state==="connected"&&this.emit("error",n),this._scheduleResubscribe()}else this._setUnsubscribed(i.code,i.message,!1)}_getResubscribeDelay(){let i=H(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,i}_setOptions(i){if(i){if(i.since&&(this._offset=i.since.offset||0,this._epoch=i.since.epoch||"",this._recover=!0),i.data&&(this._data=i.data),i.getData&&(this._getData=i.getData),i.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=i.minResubscribeDelay),i.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=i.maxResubscribeDelay),i.token&&(this._token=i.token),i.getToken&&(this._getToken=i.getToken),i.positioned===!0&&(this._positioned=!0),i.recoverable===!0&&(this._recoverable=!0),i.joinLeave===!0&&(this._joinLeave=!0),i.delta){if(i.delta!=="fossil")throw new Error("unsupported delta format");this._delta=i.delta}i.filter&&(this._filter=i.filter)}}_getOffset(){let i=this._offset;return i!==null?i:0}_getEpoch(){let i=this._epoch;return i!==null?i:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);let i={channel:this.channel},n=this._getToken;return n===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:12,message:"provide a function to get channel subscription token"}}),Promise.reject(new T(""))):n(i)}_refresh(){this._clearRefreshTimeout();let i=this;this._getSubscriptionToken().then(function(n){if(!i._isSubscribed())return;if(!n){i._failUnauthorized();return}i._token=n;let t={sub_refresh:{channel:i.channel,token:n}};i._centrifuge._call(t).then(e=>{let l=e.reply.sub_refresh;i._refreshResponse(l),e.next&&e.next()},e=>{i._refreshError(e.error),e.next&&e.next()})}).catch(function(n){if(n instanceof T){i._failUnauthorized();return}i.emit("error",{type:"refreshToken",channel:i.channel,error:{code:9,message:n!==void 0?n.toString():""}}),i._refreshTimeout=setTimeout(()=>i._refresh(),i._getRefreshRetryDelay())})}_refreshResponse(i){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl))))}_refreshError(i){this._isSubscribed()&&(i.code<100||i.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:i}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(i.code,i.message,!0))}_getRefreshRetryDelay(){return H(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(1,"unauthorized",!0)}};var ot=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(r,i){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=n=>{i.onError(n)},this._transport.onclose=n=>{i.onClose(n)},this._transport.onmessage=n=>{i.onMessage(n.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var V=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(r,i){let n=[];r==="protobuf"&&n.push("centrifuge-protobuf");let o=this.options.wsProtocolToken;o&&n.push(`Bearer ${o}`);let t=n.length>0?n:void 0;this._transport=new this.options.websocket(this.endpoint,t),r==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=e=>{i.onError(e)},this._transport.onclose=e=>{i.onClose(e)},this._transport.onmessage=e=>{i.onMessage(e.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var rt=class{constructor(r,i){this.endpoint=r,this.options=i,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(r){if(!r.ok)throw new Error(r.status);return r}_fetchEventTarget(r,i,n){let o=new EventTarget,t=r.options.fetch;return t(i,n).then(r._handleErrors).then(e=>{o.dispatchEvent(new Event("open"));let l="",c=0,u=new Uint8Array,p=e.body.getReader();return new r.options.readableStream({start(y){function w(){return p.read().then(({done:g,value:k})=>{if(g){o.dispatchEvent(new Event("close")),y.close();return}try{if(r._protocol==="json")for(l+=r._utf8decoder.decode(k);c<l.length;)if(l[c]===`
1
+ "use strict";(()=>{var Ze=Object.create;var Bt=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var Ye=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var P=(s,r)=>()=>(r||s((r={exports:{}}).exports,r),r.exports);var en=(s,r,i,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Qe(r))!tn.call(s,o)&&o!==i&&Bt(s,o,{get:()=>r[o],enumerable:!(n=Xe(r,o))||n.enumerable});return s};var Q=(s,r,i)=>(i=s!=null?Ze(Ye(s)):{},en(r||!s||!s.__esModule?Bt(i,"default",{value:s,enumerable:!0}):i,s));var gt=P((Rn,_t)=>{"use strict";var W=typeof Reflect=="object"?Reflect:null,Ut=W&&typeof W.apply=="function"?W.apply:function(r,i,n){return Function.prototype.apply.call(r,i,n)},Y;W&&typeof W.ownKeys=="function"?Y=W.ownKeys:Object.getOwnPropertySymbols?Y=function(r){return Object.getOwnPropertyNames(r).concat(Object.getOwnPropertySymbols(r))}:Y=function(r){return Object.getOwnPropertyNames(r)};function nn(s){console&&console.warn&&console.warn(s)}var Nt=Number.isNaN||function(r){return r!==r};function v(){v.init.call(this)}_t.exports=v;_t.exports.once=sn;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var zt=10;function tt(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return zt},set:function(s){if(typeof s!="number"||s<0||Nt(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");zt=s}});v.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};v.prototype.setMaxListeners=function(r){if(typeof r!="number"||r<0||Nt(r))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+r+".");return this._maxListeners=r,this};function Mt(s){return s._maxListeners===void 0?v.defaultMaxListeners:s._maxListeners}v.prototype.getMaxListeners=function(){return Mt(this)};v.prototype.emit=function(r){for(var i=[],n=1;n<arguments.length;n++)i.push(arguments[n]);var o=r==="error",t=this._events;if(t!==void 0)o=o&&t.error===void 0;else if(!o)return!1;if(o){var e;if(i.length>0&&(e=i[0]),e instanceof Error)throw e;var l=new Error("Unhandled error."+(e?" ("+e.message+")":""));throw l.context=e,l}var c=t[r];if(c===void 0)return!1;if(typeof c=="function")Ut(c,this,i);else for(var u=c.length,p=$t(c,u),n=0;n<u;++n)Ut(p[n],this,i);return!0};function Ft(s,r,i,n){var o,t,e;if(tt(i),t=s._events,t===void 0?(t=s._events=Object.create(null),s._eventsCount=0):(t.newListener!==void 0&&(s.emit("newListener",r,i.listener?i.listener:i),t=s._events),e=t[r]),e===void 0)e=t[r]=i,++s._eventsCount;else if(typeof e=="function"?e=t[r]=n?[i,e]:[e,i]:n?e.unshift(i):e.push(i),o=Mt(s),o>0&&e.length>o&&!e.warned){e.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+e.length+" "+String(r)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=s,l.type=r,l.count=e.length,nn(l)}return s}v.prototype.addListener=function(r,i){return Ft(this,r,i,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(r,i){return Ft(this,r,i,!0)};function on(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Wt(s,r,i){var n={fired:!1,wrapFn:void 0,target:s,type:r,listener:i},o=on.bind(n);return o.listener=i,n.wrapFn=o,o}v.prototype.once=function(r,i){return tt(i),this.on(r,Wt(this,r,i)),this};v.prototype.prependOnceListener=function(r,i){return tt(i),this.prependListener(r,Wt(this,r,i)),this};v.prototype.removeListener=function(r,i){var n,o,t,e,l;if(tt(i),o=this._events,o===void 0)return this;if(n=o[r],n===void 0)return this;if(n===i||n.listener===i)--this._eventsCount===0?this._events=Object.create(null):(delete o[r],o.removeListener&&this.emit("removeListener",r,n.listener||i));else if(typeof n!="function"){for(t=-1,e=n.length-1;e>=0;e--)if(n[e]===i||n[e].listener===i){l=n[e].listener,t=e;break}if(t<0)return this;t===0?n.shift():rn(n,t),n.length===1&&(o[r]=n[0]),o.removeListener!==void 0&&this.emit("removeListener",r,l||i)}return this};v.prototype.off=v.prototype.removeListener;v.prototype.removeAllListeners=function(r){var i,n,o;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[r]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[r]),this;if(arguments.length===0){var t=Object.keys(n),e;for(o=0;o<t.length;++o)e=t[o],e!=="removeListener"&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(i=n[r],typeof i=="function")this.removeListener(r,i);else if(i!==void 0)for(o=i.length-1;o>=0;o--)this.removeListener(r,i[o]);return this};function Ht(s,r,i){var n=s._events;if(n===void 0)return[];var o=n[r];return o===void 0?[]:typeof o=="function"?i?[o.listener||o]:[o]:i?cn(o):$t(o,o.length)}v.prototype.listeners=function(r){return Ht(this,r,!0)};v.prototype.rawListeners=function(r){return Ht(this,r,!1)};v.listenerCount=function(s,r){return typeof s.listenerCount=="function"?s.listenerCount(r):Jt.call(s,r)};v.prototype.listenerCount=Jt;function Jt(s){var r=this._events;if(r!==void 0){var i=r[s];if(typeof i=="function")return 1;if(i!==void 0)return i.length}return 0}v.prototype.eventNames=function(){return this._eventsCount>0?Y(this._events):[]};function $t(s,r){for(var i=new Array(r),n=0;n<r;++n)i[n]=s[n];return i}function rn(s,r){for(;r+1<s.length;r++)s[r]=s[r+1];s.pop()}function cn(s){for(var r=new Array(s.length),i=0;i<r.length;++i)r[i]=s[i].listener||s[i];return r}function sn(s,r){return new Promise(function(i,n){function o(e){s.removeListener(r,t),n(e)}function t(){typeof s.removeListener=="function"&&s.removeListener("error",o),i([].slice.call(arguments))}Vt(s,r,t,{once:!0}),r!=="error"&&ln(s,o,{once:!0})})}function ln(s,r,i){typeof s.on=="function"&&Vt(s,"error",r,i)}function Vt(s,r,i,n){if(typeof s.on=="function")n.once?s.once(r,i):s.on(r,i);else if(typeof s.addEventListener=="function")s.addEventListener(r,function o(t){n.once&&s.removeEventListener(r,o),i(t)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}});var te=P((xi,Yt)=>{"use strict";Yt.exports=yn;function yn(s,r){for(var i=new Array(arguments.length-1),n=0,o=2,t=!0;o<arguments.length;)i[n++]=arguments[o++];return new Promise(function(l,c){i[n]=function(p){if(t)if(t=!1,p)c(p);else{for(var y=new Array(arguments.length-1),w=0;w<y.length;)y[w++]=arguments[w];l.apply(null,y)}};try{s.apply(r||null,i)}catch(u){t&&(t=!1,c(u))}})}});var oe=P(ie=>{"use strict";var ut=ie;ut.length=function(r){var i=r.length;if(!i)return 0;for(var n=0;--i%4>1&&r.charAt(i)==="=";)++n;return Math.ceil(r.length*3)/4-n};var $=new Array(64),ne=new Array(123);for(D=0;D<64;)ne[$[D]=D<26?D+65:D<52?D+71:D<62?D-4:D-59|43]=D++;var D;ut.encode=function(r,i,n){for(var o=null,t=[],e=0,l=0,c;i<n;){var u=r[i++];switch(l){case 0:t[e++]=$[u>>2],c=(u&3)<<4,l=1;break;case 1:t[e++]=$[c|u>>4],c=(u&15)<<2,l=2;break;case 2:t[e++]=$[c|u>>6],t[e++]=$[u&63],l=0;break}e>8191&&((o||(o=[])).push(String.fromCharCode.apply(String,t)),e=0)}return l&&(t[e++]=$[c],t[e++]=61,l===1&&(t[e++]=61)),o?(e&&o.push(String.fromCharCode.apply(String,t.slice(0,e))),o.join("")):String.fromCharCode.apply(String,t.slice(0,e))};var ee="invalid encoding";ut.decode=function(r,i,n){for(var o=n,t=0,e,l=0;l<r.length;){var c=r.charCodeAt(l++);if(c===61&&t>1)break;if((c=ne[c])===void 0)throw Error(ee);switch(t){case 0:e=c,t=1;break;case 1:i[n++]=e<<2|(c&48)>>4,e=c,t=2;break;case 2:i[n++]=(e&15)<<4|(c&60)>>2,e=c,t=3;break;case 3:i[n++]=(e&3)<<6|c,t=0;break}}if(t===1)throw Error(ee);return n-o};ut.test=function(r){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(r)}});var ce=P((ji,re)=>{"use strict";re.exports=ft;function ft(){this._listeners={}}ft.prototype.on=function(r,i,n){return(this._listeners[r]||(this._listeners[r]=[])).push({fn:i,ctx:n||this}),this};ft.prototype.off=function(r,i){if(r===void 0)this._listeners={};else if(i===void 0)this._listeners[r]=[];else for(var n=this._listeners[r],o=0;o<n.length;)n[o].fn===i?n.splice(o,1):++o;return this};ft.prototype.emit=function(r){var i=this._listeners[r];if(i){for(var n=[],o=1;o<arguments.length;)n.push(arguments[o++]);for(o=0;o<i.length;)i[o].fn.apply(i[o++].ctx,n)}return this}});var pe=P((Ti,he)=>{"use strict";he.exports=se(se);function se(s){return typeof Float32Array<"u"?function(){var r=new Float32Array([-0]),i=new Uint8Array(r.buffer),n=i[3]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3]}function t(c,u,p){r[0]=c,u[p]=i[3],u[p+1]=i[2],u[p+2]=i[1],u[p+3]=i[0]}s.writeFloatLE=n?o:t,s.writeFloatBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],r[0]}function l(c,u){return i[3]=c[u],i[2]=c[u+1],i[1]=c[u+2],i[0]=c[u+3],r[0]}s.readFloatLE=n?e:l,s.readFloatBE=n?l:e}():function(){function r(n,o,t,e){var l=o<0?1:0;if(l&&(o=-o),o===0)n(1/o>0?0:2147483648,t,e);else if(isNaN(o))n(2143289344,t,e);else if(o>34028234663852886e22)n((l<<31|2139095040)>>>0,t,e);else if(o<11754943508222875e-54)n((l<<31|Math.round(o/1401298464324817e-60))>>>0,t,e);else{var c=Math.floor(Math.log(o)/Math.LN2),u=Math.round(o*Math.pow(2,-c)*8388608)&8388607;n((l<<31|c+127<<23|u)>>>0,t,e)}}s.writeFloatLE=r.bind(null,le),s.writeFloatBE=r.bind(null,ue);function i(n,o,t){var e=n(o,t),l=(e>>31)*2+1,c=e>>>23&255,u=e&8388607;return c===255?u?NaN:l*(1/0):c===0?l*1401298464324817e-60*u:l*Math.pow(2,c-150)*(u+8388608)}s.readFloatLE=i.bind(null,fe),s.readFloatBE=i.bind(null,ae)}(),typeof Float64Array<"u"?function(){var r=new Float64Array([-0]),i=new Uint8Array(r.buffer),n=i[7]===128;function o(c,u,p){r[0]=c,u[p]=i[0],u[p+1]=i[1],u[p+2]=i[2],u[p+3]=i[3],u[p+4]=i[4],u[p+5]=i[5],u[p+6]=i[6],u[p+7]=i[7]}function t(c,u,p){r[0]=c,u[p]=i[7],u[p+1]=i[6],u[p+2]=i[5],u[p+3]=i[4],u[p+4]=i[3],u[p+5]=i[2],u[p+6]=i[1],u[p+7]=i[0]}s.writeDoubleLE=n?o:t,s.writeDoubleBE=n?t:o;function e(c,u){return i[0]=c[u],i[1]=c[u+1],i[2]=c[u+2],i[3]=c[u+3],i[4]=c[u+4],i[5]=c[u+5],i[6]=c[u+6],i[7]=c[u+7],r[0]}function l(c,u){return i[7]=c[u],i[6]=c[u+1],i[5]=c[u+2],i[4]=c[u+3],i[3]=c[u+4],i[2]=c[u+5],i[1]=c[u+6],i[0]=c[u+7],r[0]}s.readDoubleLE=n?e:l,s.readDoubleBE=n?l:e}():function(){function r(n,o,t,e,l,c){var u=e<0?1:0;if(u&&(e=-e),e===0)n(0,l,c+o),n(1/e>0?0:2147483648,l,c+t);else if(isNaN(e))n(0,l,c+o),n(2146959360,l,c+t);else if(e>17976931348623157e292)n(0,l,c+o),n((u<<31|2146435072)>>>0,l,c+t);else{var p;if(e<22250738585072014e-324)p=e/5e-324,n(p>>>0,l,c+o),n((u<<31|p/4294967296)>>>0,l,c+t);else{var y=Math.floor(Math.log(e)/Math.LN2);y===1024&&(y=1023),p=e*Math.pow(2,-y),n(p*4503599627370496>>>0,l,c+o),n((u<<31|y+1023<<20|p*1048576&1048575)>>>0,l,c+t)}}}s.writeDoubleLE=r.bind(null,le,0,4),s.writeDoubleBE=r.bind(null,ue,4,0);function i(n,o,t,e,l){var c=n(e,l+o),u=n(e,l+t),p=(u>>31)*2+1,y=u>>>20&2047,w=4294967296*(u&1048575)+c;return y===2047?w?NaN:p*(1/0):y===0?p*5e-324*w:p*Math.pow(2,y-1075)*(w+4503599627370496)}s.readDoubleLE=i.bind(null,fe,0,4),s.readDoubleBE=i.bind(null,ae,4,0)}(),s}function le(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}function ue(s,r,i){r[i]=s>>>24,r[i+1]=s>>>16&255,r[i+2]=s>>>8&255,r[i+3]=s&255}function fe(s,r){return(s[r]|s[r+1]<<8|s[r+2]<<16|s[r+3]<<24)>>>0}function ae(s,r){return(s[r]<<24|s[r+1]<<16|s[r+2]<<8|s[r+3])>>>0}});var de=P((exports,module)=>{"use strict";module.exports=inquire;function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(s){}return null}});var ye=P(be=>{"use strict";var Ot=be;Ot.length=function(r){for(var i=0,n=0,o=0;o<r.length;++o)n=r.charCodeAt(o),n<128?i+=1:n<2048?i+=2:(n&64512)===55296&&(r.charCodeAt(o+1)&64512)===56320?(++o,i+=4):i+=3;return i};Ot.read=function(r,i,n){var o=n-i;if(o<1)return"";for(var t=null,e=[],l=0,c;i<n;)c=r[i++],c<128?e[l++]=c:c>191&&c<224?e[l++]=(c&31)<<6|r[i++]&63:c>239&&c<365?(c=((c&7)<<18|(r[i++]&63)<<12|(r[i++]&63)<<6|r[i++]&63)-65536,e[l++]=55296+(c>>10),e[l++]=56320+(c&1023)):e[l++]=(c&15)<<12|(r[i++]&63)<<6|r[i++]&63,l>8191&&((t||(t=[])).push(String.fromCharCode.apply(String,e)),l=0);return t?(l&&t.push(String.fromCharCode.apply(String,e.slice(0,l))),t.join("")):String.fromCharCode.apply(String,e.slice(0,l))};Ot.write=function(r,i,n){for(var o=n,t,e,l=0;l<r.length;++l)t=r.charCodeAt(l),t<128?i[n++]=t:t<2048?(i[n++]=t>>6|192,i[n++]=t&63|128):(t&64512)===55296&&((e=r.charCodeAt(l+1))&64512)===56320?(t=65536+((t&1023)<<10)+(e&1023),++l,i[n++]=t>>18|240,i[n++]=t>>12&63|128,i[n++]=t>>6&63|128,i[n++]=t&63|128):(i[n++]=t>>12|224,i[n++]=t>>6&63|128,i[n++]=t&63|128);return n-o}});var ge=P((Di,_e)=>{"use strict";_e.exports=_n;function _n(s,r,i){var n=i||8192,o=n>>>1,t=null,e=n;return function(c){if(c<1||c>o)return s(c);e+c>n&&(t=s(n),e=0);var u=r.call(t,e,e+=c);return e&7&&(e=(e|7)+1),u}}});var ke=P((Ci,ve)=>{"use strict";ve.exports=m;var K=B();function m(s,r){this.lo=s>>>0,this.hi=r>>>0}var M=m.zero=new m(0,0);M.toNumber=function(){return 0};M.zzEncode=M.zzDecode=function(){return this};M.length=function(){return 1};var gn=m.zeroHash="\0\0\0\0\0\0\0\0";m.fromNumber=function(r){if(r===0)return M;var i=r<0;i&&(r=-r);var n=r>>>0,o=(r-n)/4294967296>>>0;return i&&(o=~o>>>0,n=~n>>>0,++n>4294967295&&(n=0,++o>4294967295&&(o=0))),new m(n,o)};m.from=function(r){if(typeof r=="number")return m.fromNumber(r);if(K.isString(r))if(K.Long)r=K.Long.fromString(r);else return m.fromNumber(parseInt(r,10));return r.low||r.high?new m(r.low>>>0,r.high>>>0):M};m.prototype.toNumber=function(r){if(!r&&this.hi>>>31){var i=~this.lo+1>>>0,n=~this.hi>>>0;return i||(n=n+1>>>0),-(i+n*4294967296)}return this.lo+this.hi*4294967296};m.prototype.toLong=function(r){return K.Long?new K.Long(this.lo|0,this.hi|0,!!r):{low:this.lo|0,high:this.hi|0,unsigned:!!r}};var A=String.prototype.charCodeAt;m.fromHash=function(r){return r===gn?M:new m((A.call(r,0)|A.call(r,1)<<8|A.call(r,2)<<16|A.call(r,3)<<24)>>>0,(A.call(r,4)|A.call(r,5)<<8|A.call(r,6)<<16|A.call(r,7)<<24)>>>0)};m.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)};m.prototype.zzEncode=function(){var r=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^r)>>>0,this.lo=(this.lo<<1^r)>>>0,this};m.prototype.zzDecode=function(){var r=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^r)>>>0,this.hi=(this.hi>>>1^r)>>>0,this};m.prototype.length=function(){var r=this.lo,i=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?i===0?r<16384?r<128?1:2:r<2097152?3:4:i<16384?i<128?5:6:i<2097152?7:8:n<128?9:10}});var B=P(Pt=>{"use strict";var d=Pt;d.asPromise=te();d.base64=oe();d.EventEmitter=ce();d.float=pe();d.inquire=de();d.utf8=ye();d.pool=ge();d.LongBits=ke();d.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);d.global=d.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||Pt;d.emptyArray=Object.freeze?Object.freeze([]):[];d.emptyObject=Object.freeze?Object.freeze({}):{};d.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};d.isString=function(r){return typeof r=="string"||r instanceof String};d.isObject=function(r){return r&&typeof r=="object"};d.isset=d.isSet=function(r,i){var n=r[i];return n!=null&&r.hasOwnProperty(i)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};d.Buffer=function(){try{var s=d.inquire("buffer").Buffer;return s.prototype.utf8Write?s:null}catch{return null}}();d._Buffer_from=null;d._Buffer_allocUnsafe=null;d.newBuffer=function(r){return typeof r=="number"?d.Buffer?d._Buffer_allocUnsafe(r):new d.Array(r):d.Buffer?d._Buffer_from(r):typeof Uint8Array>"u"?r:new Uint8Array(r)};d.Array=typeof Uint8Array<"u"?Uint8Array:Array;d.Long=d.global.dcodeIO&&d.global.dcodeIO.Long||d.global.Long||d.inquire("long");d.key2Re=/^true|false|0|1$/;d.key32Re=/^-?(?:0|[1-9][0-9]*)$/;d.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;d.longToHash=function(r){return r?d.LongBits.from(r).toHash():d.LongBits.zeroHash};d.longFromHash=function(r,i){var n=d.LongBits.fromHash(r);return d.Long?d.Long.fromBits(n.lo,n.hi,i):n.toNumber(!!i)};function we(s,r,i){for(var n=Object.keys(r),o=0;o<n.length;++o)(s[n[o]]===void 0||!i)&&(s[n[o]]=r[n[o]]);return s}d.merge=we;d.lcFirst=function(r){return r.charAt(0).toLowerCase()+r.substring(1)};function Oe(s){function r(i,n){if(!(this instanceof r))return new r(i,n);Object.defineProperty(this,"message",{get:function(){return i}}),Error.captureStackTrace?Error.captureStackTrace(this,r):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&we(this,n)}return r.prototype=Object.create(Error.prototype,{constructor:{value:r,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return s},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),r}d.newError=Oe;d.ProtocolError=Oe("ProtocolError");d.oneOfGetter=function(r){for(var i={},n=0;n<r.length;++n)i[r[n]]=1;return function(){for(var o=Object.keys(this),t=o.length-1;t>-1;--t)if(i[o[t]]===1&&this[o[t]]!==void 0&&this[o[t]]!==null)return o[t]}};d.oneOfSetter=function(r){return function(i){for(var n=0;n<r.length;++n)r[n]!==i&&delete this[r[n]]}};d.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};d._configure=function(){var s=d.Buffer;if(!s){d._Buffer_from=d._Buffer_allocUnsafe=null;return}d._Buffer_from=s.from!==Uint8Array.from&&s.from||function(i,n){return new s(i,n)},d._Buffer_allocUnsafe=s.allocUnsafe||function(i){return new s(i)}}});var Et=P((Ii,xe)=>{"use strict";xe.exports=_;var E=B(),St,at=E.LongBits,Pe=E.base64,Se=E.utf8;function Z(s,r,i){this.fn=s,this.len=r,this.next=void 0,this.val=i}function xt(){}function vn(s){this.head=s.head,this.tail=s.tail,this.len=s.len,this.next=s.states}function _(){this.len=0,this.head=new Z(xt,0,0),this.tail=this.head,this.states=null}var me=function(){return E.Buffer?function(){return(_.create=function(){return new St})()}:function(){return new _}};_.create=me();_.alloc=function(r){return new E.Array(r)};E.Array!==Array&&(_.alloc=E.pool(_.alloc,E.Array.prototype.subarray));_.prototype._push=function(r,i,n){return this.tail=this.tail.next=new Z(r,i,n),this.len+=i,this};function Rt(s,r,i){r[i]=s&255}function kn(s,r,i){for(;s>127;)r[i++]=s&127|128,s>>>=7;r[i]=s}function jt(s,r){this.len=s,this.next=void 0,this.val=r}jt.prototype=Object.create(Z.prototype);jt.prototype.fn=kn;_.prototype.uint32=function(r){return this.len+=(this.tail=this.tail.next=new jt((r=r>>>0)<128?1:r<16384?2:r<2097152?3:r<268435456?4:5,r)).len,this};_.prototype.int32=function(r){return r<0?this._push(Tt,10,at.fromNumber(r)):this.uint32(r)};_.prototype.sint32=function(r){return this.uint32((r<<1^r>>31)>>>0)};function Tt(s,r,i){for(;s.hi;)r[i++]=s.lo&127|128,s.lo=(s.lo>>>7|s.hi<<25)>>>0,s.hi>>>=7;for(;s.lo>127;)r[i++]=s.lo&127|128,s.lo=s.lo>>>7;r[i++]=s.lo}_.prototype.uint64=function(r){var i=at.from(r);return this._push(Tt,i.length(),i)};_.prototype.int64=_.prototype.uint64;_.prototype.sint64=function(r){var i=at.from(r).zzEncode();return this._push(Tt,i.length(),i)};_.prototype.bool=function(r){return this._push(Rt,1,r?1:0)};function mt(s,r,i){r[i]=s&255,r[i+1]=s>>>8&255,r[i+2]=s>>>16&255,r[i+3]=s>>>24}_.prototype.fixed32=function(r){return this._push(mt,4,r>>>0)};_.prototype.sfixed32=_.prototype.fixed32;_.prototype.fixed64=function(r){var i=at.from(r);return this._push(mt,4,i.lo)._push(mt,4,i.hi)};_.prototype.sfixed64=_.prototype.fixed64;_.prototype.float=function(r){return this._push(E.float.writeFloatLE,4,r)};_.prototype.double=function(r){return this._push(E.float.writeDoubleLE,8,r)};var wn=E.Array.prototype.set?function(r,i,n){i.set(r,n)}:function(r,i,n){for(var o=0;o<r.length;++o)i[n+o]=r[o]};_.prototype.bytes=function(r){var i=r.length>>>0;if(!i)return this._push(Rt,1,0);if(E.isString(r)){var n=_.alloc(i=Pe.length(r));Pe.decode(r,n,0),r=n}return this.uint32(i)._push(wn,i,r)};_.prototype.string=function(r){var i=Se.length(r);return i?this.uint32(i)._push(Se.write,i,r):this._push(Rt,1,0)};_.prototype.fork=function(){return this.states=new vn(this),this.head=this.tail=new Z(xt,0,0),this.len=0,this};_.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Z(xt,0,0),this.len=0),this};_.prototype.ldelim=function(){var r=this.head,i=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=r.next,this.tail=i,this.len+=n),this};_.prototype.finish=function(){for(var r=this.head.next,i=this.constructor.alloc(this.len),n=0;r;)r.fn(r.val,i,n),n+=r.len,r=r.next;return i};_._configure=function(s){St=s,_.create=me(),St._configure()}});var Te=P((qi,je)=>{"use strict";je.exports=I;var Re=Et();(I.prototype=Object.create(Re.prototype)).constructor=I;var U=B();function I(){Re.call(this)}I._configure=function(){I.alloc=U._Buffer_allocUnsafe,I.writeBytesBuffer=U.Buffer&&U.Buffer.prototype instanceof Uint8Array&&U.Buffer.prototype.set.name==="set"?function(r,i,n){i.set(r,n)}:function(r,i,n){if(r.copy)r.copy(i,n,0,r.length);else for(var o=0;o<r.length;)i[n++]=r[o++]}};I.prototype.bytes=function(r){U.isString(r)&&(r=U._Buffer_from(r,"base64"));var i=r.length>>>0;return this.uint32(i),i&&this._push(I.writeBytesBuffer,i,r),this};function On(s,r,i){s.length<40?U.utf8.write(s,r,i):r.utf8Write?r.utf8Write(s,i):r.write(s,i)}I.prototype.string=function(r){var i=U.Buffer.byteLength(r);return this.uint32(i),i&&this._push(On,i,r),this};I._configure()});var Lt=P((Ai,Ie)=>{"use strict";Ie.exports=O;var C=B(),Ct,Ce=C.LongBits,Pn=C.utf8;function L(s,r){return RangeError("index out of range: "+s.pos+" + "+(r||1)+" > "+s.len)}function O(s){this.buf=s,this.pos=0,this.len=s.length}var Ee=typeof Uint8Array<"u"?function(r){if(r instanceof Uint8Array||Array.isArray(r))return new O(r);throw Error("illegal buffer")}:function(r){if(Array.isArray(r))return new O(r);throw Error("illegal buffer")},Le=function(){return C.Buffer?function(i){return(O.create=function(o){return C.Buffer.isBuffer(o)?new Ct(o):Ee(o)})(i)}:Ee};O.create=Le();O.prototype._slice=C.Array.prototype.subarray||C.Array.prototype.slice;O.prototype.uint32=function(){var r=4294967295;return function(){if(r=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(r=(r|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(r=(r|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return r;if((this.pos+=5)>this.len)throw this.pos=this.len,L(this,10);return r}}();O.prototype.int32=function(){return this.uint32()|0};O.prototype.sint32=function(){var r=this.uint32();return r>>>1^-(r&1)|0};function Dt(){var s=new Ce(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*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;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw L(this);if(s.lo=(s.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return s}return s.lo=(s.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,s}if(this.len-this.pos>4){for(;r<5;++r)if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}else for(;r<5;++r){if(this.pos>=this.len)throw L(this);if(s.hi=(s.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return s}throw Error("invalid varint encoding")}O.prototype.bool=function(){return this.uint32()!==0};function ht(s,r){return(s[r-4]|s[r-3]<<8|s[r-2]<<16|s[r-1]<<24)>>>0}O.prototype.fixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)};O.prototype.sfixed32=function(){if(this.pos+4>this.len)throw L(this,4);return ht(this.buf,this.pos+=4)|0};function De(){if(this.pos+8>this.len)throw L(this,8);return new Ce(ht(this.buf,this.pos+=4),ht(this.buf,this.pos+=4))}O.prototype.float=function(){if(this.pos+4>this.len)throw L(this,4);var r=C.float.readFloatLE(this.buf,this.pos);return this.pos+=4,r};O.prototype.double=function(){if(this.pos+8>this.len)throw L(this,4);var r=C.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,r};O.prototype.bytes=function(){var r=this.uint32(),i=this.pos,n=this.pos+r;if(n>this.len)throw L(this,r);if(this.pos+=r,Array.isArray(this.buf))return this.buf.slice(i,n);if(i===n){var o=C.Buffer;return o?o.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,i,n)};O.prototype.string=function(){var r=this.bytes();return Pn.read(r,0,r.length)};O.prototype.skip=function(r){if(typeof r=="number"){if(this.pos+r>this.len)throw L(this,r);this.pos+=r}else do if(this.pos>=this.len)throw L(this);while(this.buf[this.pos++]&128);return this};O.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};O._configure=function(s){Ct=s,O.create=Le(),Ct._configure();var r=C.Long?"toLong":"toNumber";C.merge(O.prototype,{int64:function(){return Dt.call(this)[r](!1)},uint64:function(){return Dt.call(this)[r](!0)},sint64:function(){return Dt.call(this).zzDecode()[r](!1)},fixed64:function(){return De.call(this)[r](!0)},sfixed64:function(){return De.call(this)[r](!1)}})}});var Ue=P((Bi,Be)=>{"use strict";Be.exports=F;var Ae=Lt();(F.prototype=Object.create(Ae.prototype)).constructor=F;var qe=B();function F(s){Ae.call(this,s)}F._configure=function(){qe.Buffer&&(F.prototype._slice=qe.Buffer.prototype.slice)};F.prototype.string=function(){var r=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+r,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+r,this.len))};F._configure()});var Ne=P((Ui,ze)=>{"use strict";ze.exports=X;var It=B();(X.prototype=Object.create(It.EventEmitter.prototype)).constructor=X;function X(s,r,i){if(typeof s!="function")throw TypeError("rpcImpl must be a function");It.EventEmitter.call(this),this.rpcImpl=s,this.requestDelimited=!!r,this.responseDelimited=!!i}X.prototype.rpcCall=function s(r,i,n,o,t){if(!o)throw TypeError("request must be specified");var e=this;if(!t)return It.asPromise(s,e,r,i,n,o);if(!e.rpcImpl){setTimeout(function(){t(Error("already ended"))},0);return}try{return e.rpcImpl(r,i[e.requestDelimited?"encodeDelimited":"encode"](o).finish(),function(c,u){if(c)return e.emit("error",c,r),t(c);if(u===null){e.end(!0);return}if(!(u instanceof n))try{u=n[e.responseDelimited?"decodeDelimited":"decode"](u)}catch(p){return e.emit("error",p,r),t(p)}return e.emit("data",u,r),t(null,u)})}catch(l){e.emit("error",l,r),setTimeout(function(){t(l)},0);return}};X.prototype.end=function(r){return this.rpcImpl&&(r||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var Fe=P(Me=>{"use strict";var Sn=Me;Sn.Service=Ne()});var He=P((Ni,We)=>{"use strict";We.exports={}});var Ve=P($e=>{"use strict";var j=$e;j.build="minimal";j.Writer=Et();j.BufferWriter=Te();j.Reader=Lt();j.BufferReader=Ue();j.util=B();j.rpc=Fe();j.roots=He();j.configure=Je;function Je(){j.util._configure(),j.Writer._configure(j.BufferWriter),j.Reader._configure(j.BufferReader)}Je()});var qt=P((Fi,Ge)=>{"use strict";Ge.exports=Ve()});var Xt=Q(gt());var et=(n=>(n.Disconnected="disconnected",n.Connecting="connecting",n.Connected="connected",n))(et||{}),nt=(n=>(n.Unsubscribed="unsubscribed",n.Subscribing="subscribing",n.Subscribed="subscribed",n))(nt||{});function Gt(s,r){return s.lastIndexOf(r,0)===0}function vt(s){return s==null?!1:typeof s=="function"}function Kt(s,r){if(globalThis.console){let i=globalThis.console[s];vt(i)&&i.apply(globalThis.console,r)}}function un(s,r){return Math.floor(Math.random()*(r-s+1)+s)}function H(s,r,i){s>31&&(s=31);let n=un(0,Math.min(i,r*Math.pow(2,s)));return Math.min(i,r+n)}function Zt(s){return"error"in s&&s.error!==null}function J(s){return Math.min(s*1e3,2147483647)}var it=class extends Xt.default{constructor(i,n,o){super();this._resubscribeTimeout=null;this._refreshTimeout=null;this.channel=n,this.state="unsubscribed",this._centrifuge=i,this._token="",this._getToken=null,this._data=null,this._getData=null,this._recover=!1,this._offset=null,this._epoch=null,this._recoverable=!1,this._positioned=!1,this._joinLeave=!1,this._filter="",this._minResubscribeDelay=500,this._maxResubscribeDelay=2e4,this._resubscribeTimeout=null,this._resubscribeAttempts=0,this._promises={},this._promiseId=0,this._inflight=!1,this._refreshTimeout=null,this._delta="",this._delta_negotiated=!1,this._prevValue=null,this._unsubPromise=Promise.resolve(),this._setOptions(o),this._centrifuge._debugEnabled?(this.on("state",t=>{this._debug("subscription state",n,t.oldState,"->",t.newState)}),this.on("error",t=>{this._debug("subscription error",n,t)})):this.on("error",function(){Function.prototype()})}ready(i){return this.state==="unsubscribed"?Promise.reject({code:7,message:this.state}):this.state==="subscribed"?Promise.resolve():new Promise((n,o)=>{let t={resolve:n,reject:o};i&&(t.timeout=setTimeout(function(){o({code:1,message:"timeout"})},i)),this._promises[this._nextPromiseId()]=t})}subscribe(){this._isSubscribed()||(this._resubscribeAttempts=0,this._setSubscribing(0,"subscribe called"))}unsubscribe(){this._unsubPromise=this._setUnsubscribed(0,"unsubscribe called",!0)}async publish(i){return await this._methodCall(),this._centrifuge.publish(this.channel,i)}async presence(){return await this._methodCall(),this._centrifuge.presence(this.channel)}async presenceStats(){return await this._methodCall(),this._centrifuge.presenceStats(this.channel)}async history(i){return await this._methodCall(),this._centrifuge.history(this.channel,i)}_methodCall(){return this._isSubscribed()?Promise.resolve():this._isUnsubscribed()?Promise.reject({code:7,message:this.state}):new Promise((i,n)=>{let o=this._centrifuge._config.timeout,t=setTimeout(()=>{n({code:1,message:"timeout"})},o);this._promises[this._nextPromiseId()]={timeout:t,resolve:i,reject:n}})}_nextPromiseId(){return++this._promiseId}_needRecover(){return this._recover===!0}_isUnsubscribed(){return this.state==="unsubscribed"}_isSubscribing(){return this.state==="subscribing"}_isSubscribed(){return this.state==="subscribed"}_setState(i){if(this.state!==i){let n=this.state;return this.state=i,this.emit("state",{newState:i,oldState:n,channel:this.channel}),!0}return!1}_usesToken(){return this._token!==""||this._getToken!==null}_clearSubscribingState(){this._resubscribeAttempts=0,this._clearResubscribeTimeout()}_clearSubscribedState(){this._clearRefreshTimeout()}_setSubscribed(i){if(!this._isSubscribing())return;this._clearSubscribingState(),i.recoverable&&(this._recover=!0,this._offset=i.offset||0,this._epoch=i.epoch||""),i.delta?this._delta_negotiated=!0:this._delta_negotiated=!1,this._setState("subscribed");let n=this._centrifuge._getSubscribeContext(this.channel,i);this.emit("subscribed",n),this._resolvePromises();let o=i.publications;if(o&&o.length>0)for(let t in o)o.hasOwnProperty(t)&&this._handlePublication(o[t]);i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl)))}async _setSubscribing(i,n){this._isSubscribing()||(this._isSubscribed()&&this._clearSubscribedState(),this._setState("subscribing")&&this.emit("subscribing",{channel:this.channel,code:i,reason:n}),this._centrifuge._transport&&this._centrifuge._transport.emulation()&&await this._unsubPromise,this._isSubscribing()&&this._subscribe())}_subscribe(){return this._debug("subscribing on",this.channel),this._isTransportOpen()?this._inflight?null:(this._inflight=!0,this._canSubscribeWithoutGettingToken()?this._subscribeWithoutToken():(this._getSubscriptionToken().then(i=>this._handleTokenResponse(i)).catch(i=>this._handleTokenError(i)),null)):(this._debug("delay subscribe on",this.channel,"till connected"),null)}_isTransportOpen(){return this._centrifuge._transportIsOpen}_canSubscribeWithoutGettingToken(){return!this._usesToken()||!!this._token}_subscribeWithoutToken(){return this._getData?(this._getDataAndSubscribe(this._token),null):this._sendSubscribe(this._token)}_getDataAndSubscribe(i){if(!this._getData){this._inflight=!1;return}this._getData({channel:this.channel}).then(n=>{if(!this._isSubscribing()){this._inflight=!1;return}this._data=n,this._sendSubscribe(i)}).catch(n=>this._handleGetDataError(n))}_handleGetDataError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeData",channel:this.channel,error:{code:12,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_handleTokenResponse(i){if(!this._isSubscribing()){this._inflight=!1;return}if(!i){this._inflight=!1,this._failUnauthorized();return}this._token=i,this._getData?this._getDataAndSubscribe(i):this._sendSubscribe(i)}_handleTokenError(i){if(!this._isSubscribing()){this._inflight=!1;return}if(i instanceof T){this._inflight=!1,this._failUnauthorized();return}this.emit("error",{type:"subscribeToken",channel:this.channel,error:{code:8,message:i?.toString()||""}}),this._inflight=!1,this._scheduleResubscribe()}_sendSubscribe(i){if(!this._isTransportOpen())return this._inflight=!1,null;let n=this._buildSubscribeCommand(i);return this._centrifuge._call(n).then(o=>{this._inflight=!1;let t=o.reply.subscribe;this._handleSubscribeResponse(t),o.next&&o.next()},o=>{this._inflight=!1,this._handleSubscribeError(o.error),o.next&&o.next()}),n}_buildSubscribeCommand(i){let n={channel:this.channel};if(i&&(n.token=i),this._data&&(n.data=this._data),this._positioned&&(n.positioned=!0),this._recoverable&&(n.recoverable=!0),this._joinLeave&&(n.join_leave=!0),this._needRecover()){n.recover=!0;let o=this._getOffset();o&&(n.offset=o);let t=this._getEpoch();t&&(n.epoch=t)}return this._delta&&(n.delta=this._delta),this._filter&&(n.filter=this._filter),{subscribe:n}}_debug(...i){this._centrifuge._debug(...i)}_handleSubscribeError(i){if(this._isSubscribing()){if(i.code===1){this._centrifuge._disconnect(3,"subscribe timeout",!0);return}this._subscribeError(i)}}_handleSubscribeResponse(i){this._isSubscribing()&&this._setSubscribed(i)}_setUnsubscribed(i,n,o){if(this._isUnsubscribed())return Promise.resolve();let t=Promise.resolve();return this._isSubscribed()?(o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribedState()):this._isSubscribing()&&(this._inflight&&o&&(t=this._centrifuge._unsubscribe(this)),this._clearSubscribingState()),this._inflight=!1,this._setState("unsubscribed")&&this.emit("unsubscribed",{channel:this.channel,code:i,reason:n}),this._rejectPromises({code:7,message:this.state}),t}_handlePublication(i){if(this._delta&&this._delta_negotiated){let{newData:o,newPrevValue:t}=this._centrifuge._codec.applyDeltaIfNeeded(i,this._prevValue);i.data=o,this._prevValue=t}let n=this._centrifuge._getPublicationContext(this.channel,i);this.emit("publication",n),i.offset&&(this._offset=i.offset)}_handleJoin(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("join",{channel:this.channel,info:n})}_handleLeave(i){let n=this._centrifuge._getJoinLeaveContext(i.info);this.emit("leave",{channel:this.channel,info:n})}_resolvePromises(){for(let i in this._promises)this._promises.hasOwnProperty(i)&&(this._promises[i].timeout&&clearTimeout(this._promises[i].timeout),this._promises[i].resolve(),delete this._promises[i])}_rejectPromises(i){for(let n in this._promises)this._promises.hasOwnProperty(n)&&(this._promises[n].timeout&&clearTimeout(this._promises[n].timeout),this._promises[n].reject(i),delete this._promises[n])}_scheduleResubscribe(){if(!this._isSubscribing()){this._debug("not in subscribing state, skip resubscribe scheduling",this.channel);return}let i=this,n=this._getResubscribeDelay();this._resubscribeTimeout=setTimeout(function(){i._isSubscribing()&&i._subscribe()},n),this._debug("resubscribe scheduled after "+n,this.channel)}_subscribeError(i){if(this._isSubscribing())if(i.code<100||i.code===109||i.temporary===!0){i.code===109&&(this._token="");let n={channel:this.channel,type:"subscribe",error:i};this._centrifuge.state==="connected"&&this.emit("error",n),this._scheduleResubscribe()}else this._setUnsubscribed(i.code,i.message,!1)}_getResubscribeDelay(){let i=H(this._resubscribeAttempts,this._minResubscribeDelay,this._maxResubscribeDelay);return this._resubscribeAttempts++,i}_setOptions(i){if(i){if(i.since&&(this._offset=i.since.offset||0,this._epoch=i.since.epoch||"",this._recover=!0),i.data&&(this._data=i.data),i.getData&&(this._getData=i.getData),i.minResubscribeDelay!==void 0&&(this._minResubscribeDelay=i.minResubscribeDelay),i.maxResubscribeDelay!==void 0&&(this._maxResubscribeDelay=i.maxResubscribeDelay),i.token&&(this._token=i.token),i.getToken&&(this._getToken=i.getToken),i.positioned===!0&&(this._positioned=!0),i.recoverable===!0&&(this._recoverable=!0),i.joinLeave===!0&&(this._joinLeave=!0),i.delta){if(i.delta!=="fossil")throw new Error("unsupported delta format");this._delta=i.delta}i.filter&&(this._filter=i.filter)}}_getOffset(){let i=this._offset;return i!==null?i:0}_getEpoch(){let i=this._epoch;return i!==null?i:""}_clearRefreshTimeout(){this._refreshTimeout!==null&&(clearTimeout(this._refreshTimeout),this._refreshTimeout=null)}_clearResubscribeTimeout(){this._resubscribeTimeout!==null&&(clearTimeout(this._resubscribeTimeout),this._resubscribeTimeout=null)}_getSubscriptionToken(){this._debug("get subscription token for channel",this.channel);let i={channel:this.channel},n=this._getToken;return n===null?(this.emit("error",{type:"configuration",channel:this.channel,error:{code:12,message:"provide a function to get channel subscription token"}}),Promise.reject(new T(""))):n(i)}_refresh(){this._clearRefreshTimeout();let i=this;this._getSubscriptionToken().then(function(n){if(!i._isSubscribed())return;if(!n){i._failUnauthorized();return}i._token=n;let t={sub_refresh:{channel:i.channel,token:n}};i._centrifuge._call(t).then(e=>{let l=e.reply.sub_refresh;i._refreshResponse(l),e.next&&e.next()},e=>{i._refreshError(e.error),e.next&&e.next()})}).catch(function(n){if(n instanceof T){i._failUnauthorized();return}i.emit("error",{type:"refreshToken",channel:i.channel,error:{code:9,message:n!==void 0?n.toString():""}}),i._refreshTimeout=setTimeout(()=>i._refresh(),i._getRefreshRetryDelay())})}_refreshResponse(i){this._isSubscribed()&&(this._debug("subscription token refreshed, channel",this.channel),this._clearRefreshTimeout(),i.expires===!0&&(this._refreshTimeout=setTimeout(()=>this._refresh(),J(i.ttl))))}_refreshError(i){this._isSubscribed()&&(i.code<100||i.temporary===!0?(this.emit("error",{type:"refresh",channel:this.channel,error:i}),this._refreshTimeout=setTimeout(()=>this._refresh(),this._getRefreshRetryDelay())):this._setUnsubscribed(i.code,i.message,!0))}_getRefreshRetryDelay(){return H(0,1e4,2e4)}_failUnauthorized(){this._setUnsubscribed(1,"unauthorized",!0)}};var ot=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"sockjs"}subName(){return"sockjs-"+this._transport.transport}emulation(){return!1}supported(){return this.options.sockjs!==null}initialize(r,i){this._transport=new this.options.sockjs(this.endpoint,null,this.options.sockjsOptions),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=n=>{i.onError(n)},this._transport.onclose=n=>{i.onClose(n)},this._transport.onmessage=n=>{i.onMessage(n.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var V=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null}name(){return"websocket"}subName(){return"websocket"}emulation(){return!1}supported(){return this.options.websocket!==void 0&&this.options.websocket!==null}initialize(r,i){let n=[];r==="protobuf"&&n.push("centrifuge-protobuf");let o=this.options.wsProtocolToken;o&&n.push(o);let t=n.length>0?n:void 0;this._transport=new this.options.websocket(this.endpoint,t),r==="protobuf"&&(this._transport.binaryType="arraybuffer"),this._transport.onopen=()=>{i.onOpen()},this._transport.onerror=e=>{i.onError(e)},this._transport.onclose=e=>{i.onClose(e)},this._transport.onmessage=e=>{i.onMessage(e.data)}}close(){this._transport.close()}send(r){this._transport.send(r)}};var rt=class{constructor(r,i){this.endpoint=r,this.options=i,this._abortController=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"http_stream"}subName(){return"http_stream"}emulation(){return!0}_handleErrors(r){if(!r.ok)throw new Error(r.status);return r}_fetchEventTarget(r,i,n){let o=new EventTarget,t=r.options.fetch;return t(i,n).then(r._handleErrors).then(e=>{o.dispatchEvent(new Event("open"));let l="",c=0,u=new Uint8Array,p=e.body.getReader();return new r.options.readableStream({start(y){function w(){return p.read().then(({done:g,value:k})=>{if(g){o.dispatchEvent(new Event("close")),y.close();return}try{if(r._protocol==="json")for(l+=r._utf8decoder.decode(k);c<l.length;)if(l[c]===`
2
2
  `){let x=l.substring(0,c);o.dispatchEvent(new MessageEvent("message",{data:x})),l=l.substring(c+1),c=0}else++c;else{let x=new Uint8Array(u.length+k.length);for(x.set(u),x.set(k,u.length),u=x;;){let R=r.options.decoder.decodeReply(u);if(R.ok){let S=u.slice(0,R.pos);o.dispatchEvent(new MessageEvent("message",{data:S})),u=u.slice(R.pos);continue}break}}}catch(x){o.dispatchEvent(new Event("error",{detail:x})),o.dispatchEvent(new Event("close")),y.close();return}w()}).catch(function(g){o.dispatchEvent(new Event("error",{detail:g})),o.dispatchEvent(new Event("close")),y.close()})}return w()}})}).catch(e=>{o.dispatchEvent(new Event("error",{detail:e})),o.dispatchEvent(new Event("close"))}),o}supported(){return this.options.fetch!==null&&this.options.readableStream!==null&&typeof TextDecoder<"u"&&typeof AbortController<"u"&&typeof EventTarget<"u"&&typeof Event<"u"&&typeof MessageEvent<"u"&&typeof Error<"u"}initialize(r,i,n){this._protocol=r,this._abortController=new AbortController;let o,t;r==="json"?(o={Accept:"application/json","Content-Type":"application/json"},t=n):(o={Accept:"application/octet-stream","Content-Type":"application/octet-stream"},t=n);let e={method:"POST",headers:o,body:t,mode:"cors",credentials:"same-origin",signal:this._abortController.signal},l=this._fetchEventTarget(this,this.endpoint,e);l.addEventListener("open",()=>{i.onOpen()}),l.addEventListener("error",c=>{this._abortController.abort(),i.onError(c)}),l.addEventListener("close",()=>{this._abortController.abort(),i.onClose({code:4,reason:"connection closed"})}),l.addEventListener("message",c=>{i.onMessage(c.data)})}close(){this._abortController.abort()}send(r,i,n){let o,t,e={session:i,node:n,data:r};this._protocol==="json"?(o={"Content-Type":"application/json"},t=JSON.stringify(e)):(o={"Content-Type":"application/octet-stream"},t=this.options.encoder.encodeEmulationRequest(e));let l=this.options.fetch,c={method:"POST",headers:o,body:t,mode:"cors",credentials:"same-origin"};l(this.options.emulationEndpoint,c)}};var ct=class{constructor(r,i){this.endpoint=r,this.options=i,this._protocol="json",this._transport=null,this._onClose=null}name(){return"sse"}subName(){return"sse"}emulation(){return!0}supported(){return this.options.eventsource!==null&&this.options.fetch!==null}initialize(r,i,n){let o;globalThis&&globalThis.document&&globalThis.document.baseURI?o=new URL(this.endpoint,globalThis.document.baseURI):o=new URL(this.endpoint),o.searchParams.append("cf_connect",n);let t={},e=new this.options.eventsource(o.toString(),t);this._transport=e;let l=this;e.onopen=function(){i.onOpen()},e.onerror=function(c){e.close(),i.onError(c),i.onClose({code:4,reason:"connection closed"})},e.onmessage=function(c){i.onMessage(c.data)},l._onClose=function(){i.onClose({code:4,reason:"connection closed"})}}close(){this._transport.close(),this._onClose!==null&&this._onClose()}send(r,i,n){let o={session:i,node:n,data:r},t={"Content-Type":"application/json"},e=JSON.stringify(o),l=this.options.fetch,c={method:"POST",headers:t,body:e,mode:"cors",credentials:"same-origin"};l(this.options.emulationEndpoint,c)}};var st=class{constructor(r,i){this.endpoint=r,this.options=i,this._transport=null,this._stream=null,this._writer=null,this._utf8decoder=new TextDecoder,this._protocol="json"}name(){return"webtransport"}subName(){return"webtransport"}emulation(){return!1}supported(){return this.options.webtransport!==void 0&&this.options.webtransport!==null}async initialize(r,i){let n;globalThis&&globalThis.document&&globalThis.document.baseURI?n=new URL(this.endpoint,globalThis.document.baseURI):n=new URL(this.endpoint),r==="protobuf"&&n.searchParams.append("cf_protocol","protobuf"),this._protocol=r;let o=new EventTarget;this._transport=new this.options.webtransport(n.toString()),this._transport.closed.then(()=>{i.onClose({code:4,reason:"connection closed"})}).catch(()=>{i.onClose({code:4,reason:"connection closed"})});try{await this._transport.ready}catch{this.close();return}let t;try{t=await this._transport.createBidirectionalStream()}catch{this.close();return}this._stream=t,this._writer=this._stream.writable.getWriter(),o.addEventListener("close",()=>{i.onClose({code:4,reason:"connection closed"})}),o.addEventListener("message",e=>{i.onMessage(e.data)}),this._startReading(o),i.onOpen()}async _startReading(r){let i=this._stream.readable.getReader(),n="",o=0,t=new Uint8Array;try{for(;;){let{done:e,value:l}=await i.read();if(l.length>0)if(this._protocol==="json")for(n+=this._utf8decoder.decode(l);o<n.length;)if(n[o]===`
3
3
  `){let c=n.substring(0,o);r.dispatchEvent(new MessageEvent("message",{data:c})),n=n.substring(o+1),o=0}else++o;else{let c=new Uint8Array(t.length+l.length);for(c.set(t),c.set(l,t.length),t=c;;){let u=this.options.decoder.decodeReply(t);if(u.ok){let p=t.slice(0,u.pos);r.dispatchEvent(new MessageEvent("message",{data:p})),t=t.slice(u.pos);continue}break}}if(e)break}}catch{r.dispatchEvent(new Event("close"))}}async close(){try{this._writer&&await this._writer.close(),this._transport.close()}catch{}}async send(r){let i;this._protocol==="json"?i=new TextEncoder().encode(r+`
4
4
  `):i=r;try{await this._writer.write(i)}catch{this.close()}}};var pn=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,36,-1,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,-1,-1,-1,63,-1],kt=class{constructor(r){this.a=r,this.pos=0}haveBytes(){return this.pos<this.a.length}getByte(){let r=this.a[this.pos];if(this.pos++,this.pos>this.a.length)throw new RangeError("out of bounds");return r}getChar(){return String.fromCharCode(this.getByte())}getInt(){let r=0,i;for(;this.haveBytes()&&(i=pn[127&this.getByte()])>=0;)r=(r<<6)+i;return this.pos--,r>>>0}},wt=class{constructor(){this.a=[]}toByteArray(r){return Array.isArray(r)?this.a:new Uint8Array(this.a)}putArray(r,i,n){for(let o=i;o<n;o++)this.a.push(r[o])}};function dn(s){let r=0,i=0,n=0,o=0,t=0,e=s.length;for(;e>=16;)r=r+s[t+0]|0,i=i+s[t+1]|0,n=n+s[t+2]|0,o=o+s[t+3]|0,r=r+s[t+4]|0,i=i+s[t+5]|0,n=n+s[t+6]|0,o=o+s[t+7]|0,r=r+s[t+8]|0,i=i+s[t+9]|0,n=n+s[t+10]|0,o=o+s[t+11]|0,r=r+s[t+12]|0,i=i+s[t+13]|0,n=n+s[t+14]|0,o=o+s[t+15]|0,t+=16,e-=16;for(;e>=4;)r=r+s[t+0]|0,i=i+s[t+1]|0,n=n+s[t+2]|0,o=o+s[t+3]|0,t+=4,e-=4;switch(o=((o+(n<<8)|0)+(i<<16)|0)+(r<<24)|0,e){case 3:o=o+(s[t+2]<<8)|0;case 2:o=o+(s[t+1]<<16)|0;case 1:o=o+(s[t+0]<<24)|0}return o>>>0}function lt(s,r){let i=0,n=new kt(r),o=s.length,t=r.length,e=n.getInt();if(n.getChar()!==`