@stinkycomputing/cachearoo 1.0.24 → 1.0.25

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,15 +1,15 @@
1
- var Cachearoo=function(K){"use strict";var Ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Tr(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var It={},Le={};Le.byteLength=Ir,Le.toByteArray=kr,Le.fromByteArray=Br;for(var Y=[],J=[],Or=typeof Uint8Array<"u"?Uint8Array:Array,Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",we=0,Fr=Ze.length;we<Fr;++we)Y[we]=Ze[we],J[Ze.charCodeAt(we)]=we;J["-".charCodeAt(0)]=62,J["_".charCodeAt(0)]=63;function xt(o){var e=o.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=o.indexOf("=");n===-1&&(n=e);var a=n===e?0:4-n%4;return[n,a]}function Ir(o){var e=xt(o),n=e[0],a=e[1];return(n+a)*3/4-a}function xr(o,e,n){return(e+n)*3/4-n}function kr(o){var e,n=xt(o),a=n[0],u=n[1],f=new Or(xr(o,a,u)),l=0,c=u>0?a-4:a,m;for(m=0;m<c;m+=4)e=J[o.charCodeAt(m)]<<18|J[o.charCodeAt(m+1)]<<12|J[o.charCodeAt(m+2)]<<6|J[o.charCodeAt(m+3)],f[l++]=e>>16&255,f[l++]=e>>8&255,f[l++]=e&255;return u===2&&(e=J[o.charCodeAt(m)]<<2|J[o.charCodeAt(m+1)]>>4,f[l++]=e&255),u===1&&(e=J[o.charCodeAt(m)]<<10|J[o.charCodeAt(m+1)]<<4|J[o.charCodeAt(m+2)]>>2,f[l++]=e>>8&255,f[l++]=e&255),f}function Pr(o){return Y[o>>18&63]+Y[o>>12&63]+Y[o>>6&63]+Y[o&63]}function Rr(o,e,n){for(var a,u=[],f=e;f<n;f+=3)a=(o[f]<<16&16711680)+(o[f+1]<<8&65280)+(o[f+2]&255),u.push(Pr(a));return u.join("")}function Br(o){for(var e,n=o.length,a=n%3,u=[],f=16383,l=0,c=n-a;l<c;l+=f)u.push(Rr(o,l,l+f>c?c:l+f));return a===1?(e=o[n-1],u.push(Y[e>>2]+Y[e<<4&63]+"==")):a===2&&(e=(o[n-2]<<8)+o[n-1],u.push(Y[e>>10]+Y[e>>4&63]+Y[e<<2&63]+"=")),u.join("")}var et={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */et.read=function(o,e,n,a,u){var f,l,c=u*8-a-1,m=(1<<c)-1,E=m>>1,w=-7,O=n?u-1:0,R=n?-1:1,_=o[e+O];for(O+=R,f=_&(1<<-w)-1,_>>=-w,w+=c;w>0;f=f*256+o[e+O],O+=R,w-=8);for(l=f&(1<<-w)-1,f>>=-w,w+=a;w>0;l=l*256+o[e+O],O+=R,w-=8);if(f===0)f=1-E;else{if(f===m)return l?NaN:(_?-1:1)*(1/0);l=l+Math.pow(2,a),f=f-E}return(_?-1:1)*l*Math.pow(2,f-a)},et.write=function(o,e,n,a,u,f){var l,c,m,E=f*8-u-1,w=(1<<E)-1,O=w>>1,R=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=a?0:f-1,D=a?1:-1,G=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,l=w):(l=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-l))<1&&(l--,m*=2),l+O>=1?e+=R/m:e+=R*Math.pow(2,1-O),e*m>=2&&(l++,m/=2),l+O>=w?(c=0,l=w):l+O>=1?(c=(e*m-1)*Math.pow(2,u),l=l+O):(c=e*Math.pow(2,O-1)*Math.pow(2,u),l=0));u>=8;o[n+_]=c&255,_+=D,c/=256,u-=8);for(l=l<<u|c,E+=u;E>0;o[n+_]=l&255,_+=D,l/=256,E-=8);o[n+_-D]|=G*128};/*!
1
+ var Cachearoo=function(G){"use strict";var kt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Or(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Rt={},Le={};Le.byteLength=xr,Le.toByteArray=Rr,Le.fromByteArray=_r;for(var Y=[],z=[],Fr=typeof Uint8Array<"u"?Uint8Array:Array,Ze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",we=0,Ir=Ze.length;we<Ir;++we)Y[we]=Ze[we],z[Ze.charCodeAt(we)]=we;z["-".charCodeAt(0)]=62,z["_".charCodeAt(0)]=63;function Pt(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=i.indexOf("=");n===-1&&(n=e);var a=n===e?0:4-n%4;return[n,a]}function xr(i){var e=Pt(i),n=e[0],a=e[1];return(n+a)*3/4-a}function kr(i,e,n){return(e+n)*3/4-n}function Rr(i){var e,n=Pt(i),a=n[0],u=n[1],f=new Fr(kr(i,a,u)),l=0,c=u>0?a-4:a,m;for(m=0;m<c;m+=4)e=z[i.charCodeAt(m)]<<18|z[i.charCodeAt(m+1)]<<12|z[i.charCodeAt(m+2)]<<6|z[i.charCodeAt(m+3)],f[l++]=e>>16&255,f[l++]=e>>8&255,f[l++]=e&255;return u===2&&(e=z[i.charCodeAt(m)]<<2|z[i.charCodeAt(m+1)]>>4,f[l++]=e&255),u===1&&(e=z[i.charCodeAt(m)]<<10|z[i.charCodeAt(m+1)]<<4|z[i.charCodeAt(m+2)]>>2,f[l++]=e>>8&255,f[l++]=e&255),f}function Pr(i){return Y[i>>18&63]+Y[i>>12&63]+Y[i>>6&63]+Y[i&63]}function Br(i,e,n){for(var a,u=[],f=e;f<n;f+=3)a=(i[f]<<16&16711680)+(i[f+1]<<8&65280)+(i[f+2]&255),u.push(Pr(a));return u.join("")}function _r(i){for(var e,n=i.length,a=n%3,u=[],f=16383,l=0,c=n-a;l<c;l+=f)u.push(Br(i,l,l+f>c?c:l+f));return a===1?(e=i[n-1],u.push(Y[e>>2]+Y[e<<4&63]+"==")):a===2&&(e=(i[n-2]<<8)+i[n-1],u.push(Y[e>>10]+Y[e>>4&63]+Y[e<<2&63]+"=")),u.join("")}var et={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */et.read=function(i,e,n,a,u){var f,l,c=u*8-a-1,m=(1<<c)-1,b=m>>1,w=-7,O=n?u-1:0,P=n?-1:1,_=i[e+O];for(O+=P,f=_&(1<<-w)-1,_>>=-w,w+=c;w>0;f=f*256+i[e+O],O+=P,w-=8);for(l=f&(1<<-w)-1,f>>=-w,w+=a;w>0;l=l*256+i[e+O],O+=P,w-=8);if(f===0)f=1-b;else{if(f===m)return l?NaN:(_?-1:1)*(1/0);l=l+Math.pow(2,a),f=f-b}return(_?-1:1)*l*Math.pow(2,f-a)},et.write=function(i,e,n,a,u,f){var l,c,m,b=f*8-u-1,w=(1<<b)-1,O=w>>1,P=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=a?0:f-1,D=a?1:-1,W=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,l=w):(l=Math.floor(Math.log(e)/Math.LN2),e*(m=Math.pow(2,-l))<1&&(l--,m*=2),l+O>=1?e+=P/m:e+=P*Math.pow(2,1-O),e*m>=2&&(l++,m/=2),l+O>=w?(c=0,l=w):l+O>=1?(c=(e*m-1)*Math.pow(2,u),l=l+O):(c=e*Math.pow(2,O-1)*Math.pow(2,u),l=0));u>=8;i[n+_]=c&255,_+=D,c/=256,u-=8);for(l=l<<u|c,b+=u;b>0;i[n+_]=l&255,_+=D,l/=256,b-=8);i[n+_-D]|=W*128};/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
5
5
  * @license MIT
6
- */(function(o){var e=Le,n=et,a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=c,o.SlowBuffer=ce,o.INSPECT_MAX_BYTES=50;var u=2147483647;o.kMaxLength=u,c.TYPED_ARRAY_SUPPORT=f(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function f(){try{var s=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(s,t),s.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function l(s){if(s>u)throw new RangeError('The value "'+s+'" is invalid for option "size"');var t=new Uint8Array(s);return Object.setPrototypeOf(t,c.prototype),t}function c(s,t,r){if(typeof s=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O(s)}return m(s,t,r)}c.poolSize=8192;function m(s,t,r){if(typeof s=="string")return R(s,t);if(ArrayBuffer.isView(s))return D(s);if(s==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s);if($(s,ArrayBuffer)||s&&$(s.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($(s,SharedArrayBuffer)||s&&$(s.buffer,SharedArrayBuffer)))return G(s,t,r);if(typeof s=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=s.valueOf&&s.valueOf();if(i!=null&&i!==s)return c.from(i,t,r);var p=Ie(s);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof s[Symbol.toPrimitive]=="function")return c.from(s[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s)}c.from=function(s,t,r){return m(s,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function E(s){if(typeof s!="number")throw new TypeError('"size" argument must be of type number');if(s<0)throw new RangeError('The value "'+s+'" is invalid for option "size"')}function w(s,t,r){return E(s),s<=0?l(s):t!==void 0?typeof r=="string"?l(s).fill(t,r):l(s).fill(t):l(s)}c.alloc=function(s,t,r){return w(s,t,r)};function O(s){return E(s),l(s<0?0:se(s)|0)}c.allocUnsafe=function(s){return O(s)},c.allocUnsafeSlow=function(s){return O(s)};function R(s,t){if((typeof t!="string"||t==="")&&(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=xe(s,t)|0,i=l(r),p=i.write(s,t);return p!==r&&(i=i.slice(0,p)),i}function _(s){for(var t=s.length<0?0:se(s.length)|0,r=l(t),i=0;i<t;i+=1)r[i]=s[i]&255;return r}function D(s){if($(s,Uint8Array)){var t=new Uint8Array(s);return G(t.buffer,t.byteOffset,t.byteLength)}return _(s)}function G(s,t,r){if(t<0||s.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(s.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return t===void 0&&r===void 0?i=new Uint8Array(s):r===void 0?i=new Uint8Array(s,t):i=new Uint8Array(s,t,r),Object.setPrototypeOf(i,c.prototype),i}function Ie(s){if(c.isBuffer(s)){var t=se(s.length)|0,r=l(t);return r.length===0||s.copy(r,0,0,t),r}if(s.length!==void 0)return typeof s.length!="number"||ne(s.length)?l(0):_(s);if(s.type==="Buffer"&&Array.isArray(s.data))return _(s.data)}function se(s){if(s>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return s|0}function ce(s){return+s!=s&&(s=0),c.alloc(+s)}c.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==c.prototype},c.compare=function(t,r){if($(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),$(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var i=t.length,p=r.length,d=0,v=Math.min(i,p);d<v;++d)if(t[d]!==r[d]){i=t[d],p=r[d];break}return i<p?-1:p<i?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return c.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var p=c.allocUnsafe(r),d=0;for(i=0;i<t.length;++i){var v=t[i];if($(v,Uint8Array))d+v.length>p.length?c.from(v).copy(p,d):Uint8Array.prototype.set.call(p,v,d);else if(c.isBuffer(v))v.copy(p,d);else throw new TypeError('"list" argument must be an Array of Buffers');d+=v.length}return p};function xe(s,t){if(c.isBuffer(s))return s.length;if(ArrayBuffer.isView(s)||$(s,ArrayBuffer))return s.byteLength;if(typeof s!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof s);var r=s.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var p=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(s).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return N(s).length;default:if(p)return i?-1:A(s).length;t=(""+t).toLowerCase(),p=!0}}c.byteLength=xe;function ke(s,t,r){var i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(s||(s="utf8");;)switch(s){case"hex":return X(this,t,r);case"utf8":case"utf-8":return V(this,t,r);case"ascii":return Ce(this,t,r);case"latin1":case"binary":return he(this,t,r);case"base64":return Ue(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ye(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+s);s=(s+"").toLowerCase(),i=!0}}c.prototype._isBuffer=!0;function W(s,t,r){var i=s[t];s[t]=s[r],s[r]=i}c.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)W(this,r,r+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)W(this,r,r+3),W(this,r+1,r+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)W(this,r,r+7),W(this,r+1,r+6),W(this,r+2,r+5),W(this,r+3,r+4);return this},c.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?V(this,0,t):ke.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:c.compare(this,t)===0},c.prototype.inspect=function(){var t="",r=o.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},a&&(c.prototype[a]=c.prototype.inspect),c.prototype.compare=function(t,r,i,p,d){if($(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),p===void 0&&(p=0),d===void 0&&(d=this.length),r<0||i>t.length||p<0||d>this.length)throw new RangeError("out of range index");if(p>=d&&r>=i)return 0;if(p>=d)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,p>>>=0,d>>>=0,this===t)return 0;for(var v=d-p,I=i-r,B=Math.min(v,I),j=this.slice(p,d),q=t.slice(r,i),C=0;C<B;++C)if(j[C]!==q[C]){v=j[C],I=q[C];break}return v<I?-1:I<v?1:0};function Pe(s,t,r,i,p){if(s.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ne(r)&&(r=p?0:s.length-1),r<0&&(r=s.length+r),r>=s.length){if(p)return-1;r=s.length-1}else if(r<0)if(p)r=0;else return-1;if(typeof t=="string"&&(t=c.from(t,i)),c.isBuffer(t))return t.length===0?-1:z(s,t,r,i,p);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(s,t,r):Uint8Array.prototype.lastIndexOf.call(s,t,r):z(s,[t],r,i,p);throw new TypeError("val must be string, number or Buffer")}function z(s,t,r,i,p){var d=1,v=s.length,I=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(s.length<2||t.length<2)return-1;d=2,v/=2,I/=2,r/=2}function B(Ar,Sr){return d===1?Ar[Sr]:Ar.readUInt16BE(Sr*d)}var j;if(p){var q=-1;for(j=r;j<v;j++)if(B(s,j)===B(t,q===-1?0:j-q)){if(q===-1&&(q=j),j-q+1===I)return q*d}else q!==-1&&(j-=j-q),q=-1}else for(r+I>v&&(r=v-I),j=r;j>=0;j--){for(var C=!0,Ye=0;Ye<I;Ye++)if(B(s,j+Ye)!==B(t,Ye)){C=!1;break}if(C)return j}return-1}c.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1},c.prototype.indexOf=function(t,r,i){return Pe(this,t,r,i,!0)},c.prototype.lastIndexOf=function(t,r,i){return Pe(this,t,r,i,!1)};function ae(s,t,r,i){r=Number(r)||0;var p=s.length-r;i?(i=Number(i),i>p&&(i=p)):i=p;var d=t.length;i>d/2&&(i=d/2);for(var v=0;v<i;++v){var I=parseInt(t.substr(v*2,2),16);if(ne(I))return v;s[r+v]=I}return v}function re(s,t,r,i){return H(A(t,s.length-r),s,r,i)}function fe(s,t,r,i){return H(T(t),s,r,i)}function ue(s,t,r,i){return H(N(t),s,r,i)}function Q(s,t,r,i){return H(k(t,s.length-r),s,r,i)}c.prototype.write=function(t,r,i,p){if(r===void 0)p="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")p=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,p===void 0&&(p="utf8")):(p=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var d=this.length-r;if((i===void 0||i>d)&&(i=d),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var v=!1;;)switch(p){case"hex":return ae(this,t,r,i);case"utf8":case"utf-8":return re(this,t,r,i);case"ascii":case"latin1":case"binary":return fe(this,t,r,i);case"base64":return ue(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,r,i);default:if(v)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),v=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ue(s,t,r){return t===0&&r===s.length?e.fromByteArray(s):e.fromByteArray(s.slice(t,r))}function V(s,t,r){r=Math.min(s.length,r);for(var i=[],p=t;p<r;){var d=s[p],v=null,I=d>239?4:d>223?3:d>191?2:1;if(p+I<=r){var B,j,q,C;switch(I){case 1:d<128&&(v=d);break;case 2:B=s[p+1],(B&192)===128&&(C=(d&31)<<6|B&63,C>127&&(v=C));break;case 3:B=s[p+1],j=s[p+2],(B&192)===128&&(j&192)===128&&(C=(d&15)<<12|(B&63)<<6|j&63,C>2047&&(C<55296||C>57343)&&(v=C));break;case 4:B=s[p+1],j=s[p+2],q=s[p+3],(B&192)===128&&(j&192)===128&&(q&192)===128&&(C=(d&15)<<18|(B&63)<<12|(j&63)<<6|q&63,C>65535&&C<1114112&&(v=C))}}v===null?(v=65533,I=1):v>65535&&(v-=65536,i.push(v>>>10&1023|55296),v=56320|v&1023),i.push(v),p+=I}return pe(i)}var le=4096;function pe(s){var t=s.length;if(t<=le)return String.fromCharCode.apply(String,s);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,s.slice(i,i+=le));return r}function Ce(s,t,r){var i="";r=Math.min(s.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(s[p]&127);return i}function he(s,t,r){var i="";r=Math.min(s.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(s[p]);return i}function X(s,t,r){var i=s.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var p="",d=t;d<r;++d)p+=Re[s[d]];return p}function ye(s,t,r){for(var i=s.slice(t,r),p="",d=0;d<i.length-1;d+=2)p+=String.fromCharCode(i[d]+i[d+1]*256);return p}c.prototype.slice=function(t,r){var i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);var p=this.subarray(t,r);return Object.setPrototypeOf(p,c.prototype),p};function U(s,t,r){if(s%1!==0||s<0)throw new RangeError("offset is not uint");if(s+t>r)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||U(t,r,this.length);for(var p=this[t],d=1,v=0;++v<r&&(d*=256);)p+=this[t+v]*d;return p},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||U(t,r,this.length);for(var p=this[t+--r],d=1;r>0&&(d*=256);)p+=this[t+--r]*d;return p},c.prototype.readUint8=c.prototype.readUInt8=function(t,r){return t=t>>>0,r||U(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||U(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||U(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||U(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||U(t,r,this.length);for(var p=this[t],d=1,v=0;++v<r&&(d*=256);)p+=this[t+v]*d;return d*=128,p>=d&&(p-=Math.pow(2,8*r)),p},c.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||U(t,r,this.length);for(var p=r,d=1,v=this[t+--p];p>0&&(d*=256);)v+=this[t+--p]*d;return d*=128,v>=d&&(v-=Math.pow(2,8*r)),v},c.prototype.readInt8=function(t,r){return t=t>>>0,r||U(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},c.prototype.readInt16LE=function(t,r){t=t>>>0,r||U(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i},c.prototype.readInt16BE=function(t,r){t=t>>>0,r||U(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i},c.prototype.readInt32LE=function(t,r){return t=t>>>0,r||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,r){return t=t>>>0,r||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,r){return t=t>>>0,r||U(t,4,this.length),n.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,r){return t=t>>>0,r||U(t,4,this.length),n.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||U(t,8,this.length),n.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||U(t,8,this.length),n.read(this,t,!1,52,8)};function h(s,t,r,i,p,d){if(!c.isBuffer(s))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>p||t<d)throw new RangeError('"value" argument is out of bounds');if(r+i>s.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,r,i,p){if(t=+t,r=r>>>0,i=i>>>0,!p){var d=Math.pow(2,8*i)-1;h(this,t,r,i,d,0)}var v=1,I=0;for(this[r]=t&255;++I<i&&(v*=256);)this[r+I]=t/v&255;return r+i},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,r,i,p){if(t=+t,r=r>>>0,i=i>>>0,!p){var d=Math.pow(2,8*i)-1;h(this,t,r,i,d,0)}var v=i-1,I=1;for(this[r+v]=t&255;--v>=0&&(I*=256);)this[r+v]=t/I&255;return r+i},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,1,255,0),this[r]=t&255,r+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},c.prototype.writeIntLE=function(t,r,i,p){if(t=+t,r=r>>>0,!p){var d=Math.pow(2,8*i-1);h(this,t,r,i,d-1,-d)}var v=0,I=1,B=0;for(this[r]=t&255;++v<i&&(I*=256);)t<0&&B===0&&this[r+v-1]!==0&&(B=1),this[r+v]=(t/I>>0)-B&255;return r+i},c.prototype.writeIntBE=function(t,r,i,p){if(t=+t,r=r>>>0,!p){var d=Math.pow(2,8*i-1);h(this,t,r,i,d-1,-d)}var v=i-1,I=1,B=0;for(this[r+v]=t&255;--v>=0&&(I*=256);)t<0&&B===0&&this[r+v+1]!==0&&(B=1),this[r+v]=(t/I>>0)-B&255;return r+i},c.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},c.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},c.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||h(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function y(s,t,r,i,p,d){if(r+i>s.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function g(s,t,r,i,p){return t=+t,r=r>>>0,p||y(s,t,r,4),n.write(s,t,r,i,23,4),r+4}c.prototype.writeFloatLE=function(t,r,i){return g(this,t,r,!0,i)},c.prototype.writeFloatBE=function(t,r,i){return g(this,t,r,!1,i)};function b(s,t,r,i,p){return t=+t,r=r>>>0,p||y(s,t,r,8),n.write(s,t,r,i,52,8),r+8}c.prototype.writeDoubleLE=function(t,r,i){return b(this,t,r,!0,i)},c.prototype.writeDoubleBE=function(t,r,i){return b(this,t,r,!1,i)},c.prototype.copy=function(t,r,i,p){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!p&&p!==0&&(p=this.length),r>=t.length&&(r=t.length),r||(r=0),p>0&&p<i&&(p=i),p===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),t.length-r<p-i&&(p=t.length-r+i);var d=p-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,p):Uint8Array.prototype.set.call(t,this.subarray(i,p),r),d},c.prototype.fill=function(t,r,i,p){if(typeof t=="string"){if(typeof r=="string"?(p=r,r=0,i=this.length):typeof i=="string"&&(p=i,i=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!c.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(t.length===1){var d=t.charCodeAt(0);(p==="utf8"&&d<128||p==="latin1")&&(t=d)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);var v;if(typeof t=="number")for(v=r;v<i;++v)this[v]=t;else{var I=c.isBuffer(t)?t:c.from(t,p),B=I.length;if(B===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(v=0;v<i-r;++v)this[v+r]=I[v%B]}return this};var F=/[^+/0-9A-Za-z-_]/g;function x(s){if(s=s.split("=")[0],s=s.trim().replace(F,""),s.length<2)return"";for(;s.length%4!==0;)s=s+"=";return s}function A(s,t){t=t||1/0;for(var r,i=s.length,p=null,d=[],v=0;v<i;++v){if(r=s.charCodeAt(v),r>55295&&r<57344){if(!p){if(r>56319){(t-=3)>-1&&d.push(239,191,189);continue}else if(v+1===i){(t-=3)>-1&&d.push(239,191,189);continue}p=r;continue}if(r<56320){(t-=3)>-1&&d.push(239,191,189),p=r;continue}r=(p-55296<<10|r-56320)+65536}else p&&(t-=3)>-1&&d.push(239,191,189);if(p=null,r<128){if((t-=1)<0)break;d.push(r)}else if(r<2048){if((t-=2)<0)break;d.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;d.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;d.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return d}function T(s){for(var t=[],r=0;r<s.length;++r)t.push(s.charCodeAt(r)&255);return t}function k(s,t){for(var r,i,p,d=[],v=0;v<s.length&&!((t-=2)<0);++v)r=s.charCodeAt(v),i=r>>8,p=r%256,d.push(p),d.push(i);return d}function N(s){return e.toByteArray(x(s))}function H(s,t,r,i){for(var p=0;p<i&&!(p+r>=t.length||p>=s.length);++p)t[p+r]=s[p];return p}function $(s,t){return s instanceof t||s!=null&&s.constructor!=null&&s.constructor.name!=null&&s.constructor.name===t.name}function ne(s){return s!==s}var Re=function(){for(var s="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var i=r*16,p=0;p<16;++p)t[i+p]=s[r]+s[p];return t}()})(It);var kt={exports:{}},L=kt.exports={},Z,ee;function tt(){throw new Error("setTimeout has not been defined")}function rt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Z=setTimeout:Z=tt}catch{Z=tt}try{typeof clearTimeout=="function"?ee=clearTimeout:ee=rt}catch{ee=rt}})();function Pt(o){if(Z===setTimeout)return setTimeout(o,0);if((Z===tt||!Z)&&setTimeout)return Z=setTimeout,setTimeout(o,0);try{return Z(o,0)}catch{try{return Z.call(null,o,0)}catch{return Z.call(this,o,0)}}}function _r(o){if(ee===clearTimeout)return clearTimeout(o);if((ee===rt||!ee)&&clearTimeout)return ee=clearTimeout,clearTimeout(o);try{return ee(o)}catch{try{return ee.call(null,o)}catch{return ee.call(this,o)}}}var ie=[],be=!1,de,De=-1;function jr(){!be||!de||(be=!1,de.length?ie=de.concat(ie):De=-1,ie.length&&Rt())}function Rt(){if(!be){var o=Pt(jr);be=!0;for(var e=ie.length;e;){for(de=ie,ie=[];++De<e;)de&&de[De].run();De=-1,e=ie.length}de=null,be=!1,_r(o)}}L.nextTick=function(o){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];ie.push(new Bt(o,e)),ie.length===1&&!be&&Pt(Rt)};function Bt(o,e){this.fun=o,this.array=e}Bt.prototype.run=function(){this.fun.apply(null,this.array)},L.title="browser",L.browser=!0,L.env={},L.argv=[],L.version="",L.versions={};function oe(){}L.on=oe,L.addListener=oe,L.once=oe,L.off=oe,L.removeListener=oe,L.removeAllListeners=oe,L.emit=oe,L.prependListener=oe,L.prependOnceListener=oe,L.listeners=function(o){return[]},L.binding=function(o){throw new Error("process.binding is not supported")},L.cwd=function(){return"/"},L.chdir=function(o){throw new Error("process.chdir is not supported")},L.umask=function(){return 0};var Ur=kt.exports;const te=Tr(Ur);var Cr=function(o){function e(){var a=this||self;return delete o.prototype.__magic__,a}if(typeof globalThis=="object")return globalThis;if(this)return e();o.defineProperty(o.prototype,"__magic__",{configurable:!0,get:e});var n=__magic__;return n}(Object),Lr=Cr,nt={},_t={},jt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),a=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(a)!=="[object Symbol]")return!1;var u=42;e[n]=u;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var f=Object.getOwnPropertySymbols(e);if(f.length!==1||f[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,n);if(l.value!==u||l.enumerable!==!0)return!1}return!0},Dr=jt,it=function(){return Dr()&&!!Symbol.toStringTag},Ut=typeof Symbol<"u"&&Symbol,Mr=jt,Nr=function(){return typeof Ut!="function"||typeof Symbol!="function"||typeof Ut("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Mr()},Ct={foo:{}},qr=Object,$r=function(){return{__proto__:Ct}.foo===Ct.foo&&!({__proto__:null}instanceof qr)},Gr="Function.prototype.bind called on incompatible ",ot=Array.prototype.slice,Wr=Object.prototype.toString,Jr="[object Function]",zr=function(e){var n=this;if(typeof n!="function"||Wr.call(n)!==Jr)throw new TypeError(Gr+n);for(var a=ot.call(arguments,1),u,f=function(){if(this instanceof u){var w=n.apply(this,a.concat(ot.call(arguments)));return Object(w)===w?w:this}else return n.apply(e,a.concat(ot.call(arguments)))},l=Math.max(0,n.length-a.length),c=[],m=0;m<l;m++)c.push("$"+m);if(u=Function("binder","return function ("+c.join(",")+"){ return binder.apply(this,arguments); }")(f),n.prototype){var E=function(){};E.prototype=n.prototype,u.prototype=new E,E.prototype=null}return u},Hr=zr,st=Function.prototype.bind||Hr,Kr=st,Qr=Kr.call(Function.call,Object.prototype.hasOwnProperty),S,Ee=SyntaxError,Lt=Function,Ae=TypeError,at=function(o){try{return Lt('"use strict"; return ('+o+").constructor;")()}catch{}},ge=Object.getOwnPropertyDescriptor;if(ge)try{ge({},"")}catch{ge=null}var ut=function(){throw new Ae},Vr=ge?function(){try{return arguments.callee,ut}catch{try{return ge(arguments,"callee").get}catch{return ut}}}():ut,Se=Nr(),Xr=$r(),M=Object.getPrototypeOf||(Xr?function(o){return o.__proto__}:null),Te={},Yr=typeof Uint8Array>"u"||!M?S:M(Uint8Array),ve={"%AggregateError%":typeof AggregateError>"u"?S:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?S:ArrayBuffer,"%ArrayIteratorPrototype%":Se&&M?M([][Symbol.iterator]()):S,"%AsyncFromSyncIteratorPrototype%":S,"%AsyncFunction%":Te,"%AsyncGenerator%":Te,"%AsyncGeneratorFunction%":Te,"%AsyncIteratorPrototype%":Te,"%Atomics%":typeof Atomics>"u"?S:Atomics,"%BigInt%":typeof BigInt>"u"?S:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?S:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?S:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?S:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?S:Float32Array,"%Float64Array%":typeof Float64Array>"u"?S:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?S:FinalizationRegistry,"%Function%":Lt,"%GeneratorFunction%":Te,"%Int8Array%":typeof Int8Array>"u"?S:Int8Array,"%Int16Array%":typeof Int16Array>"u"?S:Int16Array,"%Int32Array%":typeof Int32Array>"u"?S:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Se&&M?M(M([][Symbol.iterator]())):S,"%JSON%":typeof JSON=="object"?JSON:S,"%Map%":typeof Map>"u"?S:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Se||!M?S:M(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?S:Promise,"%Proxy%":typeof Proxy>"u"?S:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?S:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?S:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Se||!M?S:M(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?S:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Se&&M?M(""[Symbol.iterator]()):S,"%Symbol%":Se?Symbol:S,"%SyntaxError%":Ee,"%ThrowTypeError%":Vr,"%TypedArray%":Yr,"%TypeError%":Ae,"%Uint8Array%":typeof Uint8Array>"u"?S:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?S:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?S:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?S:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?S:WeakMap,"%WeakRef%":typeof WeakRef>"u"?S:WeakRef,"%WeakSet%":typeof WeakSet>"u"?S:WeakSet};if(M)try{null.error}catch(o){var Zr=M(M(o));ve["%Error.prototype%"]=Zr}var en=function o(e){var n;if(e==="%AsyncFunction%")n=at("async function () {}");else if(e==="%GeneratorFunction%")n=at("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=at("async function* () {}");else if(e==="%AsyncGenerator%"){var a=o("%AsyncGeneratorFunction%");a&&(n=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var u=o("%AsyncGenerator%");u&&M&&(n=M(u.prototype))}return ve[e]=n,n},Dt={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Be=st,Me=Qr,tn=Be.call(Function.call,Array.prototype.concat),rn=Be.call(Function.apply,Array.prototype.splice),Mt=Be.call(Function.call,String.prototype.replace),Ne=Be.call(Function.call,String.prototype.slice),nn=Be.call(Function.call,RegExp.prototype.exec),on=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,sn=/\\(\\)?/g,an=function(e){var n=Ne(e,0,1),a=Ne(e,-1);if(n==="%"&&a!=="%")throw new Ee("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&n!=="%")throw new Ee("invalid intrinsic syntax, expected opening `%`");var u=[];return Mt(e,on,function(f,l,c,m){u[u.length]=c?Mt(m,sn,"$1"):l||f}),u},un=function(e,n){var a=e,u;if(Me(Dt,a)&&(u=Dt[a],a="%"+u[0]+"%"),Me(ve,a)){var f=ve[a];if(f===Te&&(f=en(a)),typeof f>"u"&&!n)throw new Ae("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:u,name:a,value:f}}throw new Ee("intrinsic "+e+" does not exist!")},ct=function(e,n){if(typeof e!="string"||e.length===0)throw new Ae("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Ae('"allowMissing" argument must be a boolean');if(nn(/^%?[^%]*%?$/,e)===null)throw new Ee("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=an(e),u=a.length>0?a[0]:"",f=un("%"+u+"%",n),l=f.name,c=f.value,m=!1,E=f.alias;E&&(u=E[0],rn(a,tn([0,1],E)));for(var w=1,O=!0;w<a.length;w+=1){var R=a[w],_=Ne(R,0,1),D=Ne(R,-1);if((_==='"'||_==="'"||_==="`"||D==='"'||D==="'"||D==="`")&&_!==D)throw new Ee("property names with quotes must have matching quotes");if((R==="constructor"||!O)&&(m=!0),u+="."+R,l="%"+u+"%",Me(ve,l))c=ve[l];else if(c!=null){if(!(R in c)){if(!n)throw new Ae("base intrinsic for "+e+" exists, but the property is not available.");return}if(ge&&w+1>=a.length){var G=ge(c,R);O=!!G,O&&"get"in G&&!("originalValue"in G.get)?c=G.get:c=c[R]}else O=Me(c,R),c=c[R];O&&!m&&(ve[l]=c)}}return c},Nt={exports:{}};(function(o){var e=st,n=ct,a=n("%Function.prototype.apply%"),u=n("%Function.prototype.call%"),f=n("%Reflect.apply%",!0)||e.call(u,a),l=n("%Object.getOwnPropertyDescriptor%",!0),c=n("%Object.defineProperty%",!0),m=n("%Math.max%");if(c)try{c({},"a",{value:1})}catch{c=null}o.exports=function(O){var R=f(e,u,arguments);if(l&&c){var _=l(R,"length");_.configurable&&c(R,"length",{value:1+m(0,O.length-(arguments.length-1))})}return R};var E=function(){return f(e,a,arguments)};c?c(o.exports,"apply",{value:E}):o.exports.apply=E})(Nt);var qt=Nt.exports,$t=ct,Gt=qt,cn=Gt($t("String.prototype.indexOf")),Wt=function(e,n){var a=$t(e,!!n);return typeof a=="function"&&cn(e,".prototype.")>-1?Gt(a):a},fn=it(),ln=Wt,ft=ln("Object.prototype.toString"),qe=function(e){return fn&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:ft(e)==="[object Arguments]"},Jt=function(e){return qe(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ft(e)!=="[object Array]"&&ft(e.callee)==="[object Function]"},pn=function(){return qe(arguments)}();qe.isLegacyArguments=Jt;var hn=pn?qe:Jt,yn=Object.prototype.toString,dn=Function.prototype.toString,gn=/^\s*(?:function)?\*/,zt=it(),lt=Object.getPrototypeOf,vn=function(){if(!zt)return!1;try{return Function("return function*() {}")()}catch{}},pt,mn=function(e){if(typeof e!="function")return!1;if(gn.test(dn.call(e)))return!0;if(!zt){var n=yn.call(e);return n==="[object GeneratorFunction]"}if(!lt)return!1;if(typeof pt>"u"){var a=vn();pt=a?lt(a):!1}return lt(e)===pt},Ht=Function.prototype.toString,Oe=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ht,$e;if(typeof Oe=="function"&&typeof Object.defineProperty=="function")try{ht=Object.defineProperty({},"length",{get:function(){throw $e}}),$e={},Oe(function(){throw 42},null,ht)}catch(o){o!==$e&&(Oe=null)}else Oe=null;var wn=/^\s*class\b/,yt=function(e){try{var n=Ht.call(e);return wn.test(n)}catch{return!1}},dt=function(e){try{return yt(e)?!1:(Ht.call(e),!0)}catch{return!1}},Ge=Object.prototype.toString,bn="[object Object]",En="[object Function]",An="[object GeneratorFunction]",Sn="[object HTMLAllCollection]",Tn="[object HTML document.all class]",On="[object HTMLCollection]",Fn=typeof Symbol=="function"&&!!Symbol.toStringTag,In=!(0 in[,]),gt=function(){return!1};if(typeof document=="object"){var xn=document.all;Ge.call(xn)===Ge.call(document.all)&&(gt=function(e){if((In||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Ge.call(e);return(n===Sn||n===Tn||n===On||n===bn)&&e("")==null}catch{}return!1})}var kn=Oe?function(e){if(gt(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Oe(e,null,ht)}catch(n){if(n!==$e)return!1}return!yt(e)&&dt(e)}:function(e){if(gt(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Fn)return dt(e);if(yt(e))return!1;var n=Ge.call(e);return n!==En&&n!==An&&!/^\[object HTML/.test(n)?!1:dt(e)},Pn=kn,Rn=Object.prototype.toString,Kt=Object.prototype.hasOwnProperty,Bn=function(e,n,a){for(var u=0,f=e.length;u<f;u++)Kt.call(e,u)&&(a==null?n(e[u],u,e):n.call(a,e[u],u,e))},_n=function(e,n,a){for(var u=0,f=e.length;u<f;u++)a==null?n(e.charAt(u),u,e):n.call(a,e.charAt(u),u,e)},jn=function(e,n,a){for(var u in e)Kt.call(e,u)&&(a==null?n(e[u],u,e):n.call(a,e[u],u,e))},Un=function(e,n,a){if(!Pn(n))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=a),Rn.call(e)==="[object Array]"?Bn(e,n,u):typeof e=="string"?_n(e,n,u):jn(e,n,u)},Cn=Un,vt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],Ln=typeof globalThis>"u"?Ft:globalThis,Dn=function(){for(var e=[],n=0;n<vt.length;n++)typeof Ln[vt[n]]=="function"&&(e[e.length]=vt[n]);return e},Mn=ct,We=Mn("%Object.getOwnPropertyDescriptor%",!0);if(We)try{We([],"length")}catch{We=null}var Nn=We,Je=Cn,qn=Dn,Qt=qt,mt=Wt,ze=Nn,$n=mt("Object.prototype.toString"),Vt=it(),Xt=typeof globalThis>"u"?Ft:globalThis,wt=qn(),bt=mt("String.prototype.slice"),Et=Object.getPrototypeOf,Gn=mt("Array.prototype.indexOf",!0)||function(e,n){for(var a=0;a<e.length;a+=1)if(e[a]===n)return a;return-1},He={__proto__:null};Vt&&ze&&Et?Je(wt,function(o){var e=new Xt[o];if(Symbol.toStringTag in e){var n=Et(e),a=ze(n,Symbol.toStringTag);if(!a){var u=Et(n);a=ze(u,Symbol.toStringTag)}He["$"+o]=Qt(a.get)}}):Je(wt,function(o){var e=new Xt[o];He["$"+o]=Qt(e.slice)});var Wn=function(e){var n=!1;return Je(He,function(a,u){if(!n)try{"$"+a(e)===u&&(n=bt(u,1))}catch{}}),n},Jn=function(e){var n=!1;return Je(He,function(a,u){if(!n)try{a(e),n=bt(u,1)}catch{}}),n},Yt=function(e){if(!e||typeof e!="object")return!1;if(!Vt){var n=bt($n(e),8,-1);return Gn(wt,n)>-1?n:n!=="Object"?!1:Jn(e)}return ze?Wn(e):null},zn=Yt,Hn=function(e){return!!zn(e)};(function(o){var e=hn,n=mn,a=Yt,u=Hn;function f(i){return i.call.bind(i)}var l=typeof BigInt<"u",c=typeof Symbol<"u",m=f(Object.prototype.toString),E=f(Number.prototype.valueOf),w=f(String.prototype.valueOf),O=f(Boolean.prototype.valueOf);if(l)var R=f(BigInt.prototype.valueOf);if(c)var _=f(Symbol.prototype.valueOf);function D(i,p){if(typeof i!="object")return!1;try{return p(i),!0}catch{return!1}}o.isArgumentsObject=e,o.isGeneratorFunction=n,o.isTypedArray=u;function G(i){return typeof Promise<"u"&&i instanceof Promise||i!==null&&typeof i=="object"&&typeof i.then=="function"&&typeof i.catch=="function"}o.isPromise=G;function Ie(i){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(i):u(i)||y(i)}o.isArrayBufferView=Ie;function se(i){return a(i)==="Uint8Array"}o.isUint8Array=se;function ce(i){return a(i)==="Uint8ClampedArray"}o.isUint8ClampedArray=ce;function xe(i){return a(i)==="Uint16Array"}o.isUint16Array=xe;function ke(i){return a(i)==="Uint32Array"}o.isUint32Array=ke;function W(i){return a(i)==="Int8Array"}o.isInt8Array=W;function Pe(i){return a(i)==="Int16Array"}o.isInt16Array=Pe;function z(i){return a(i)==="Int32Array"}o.isInt32Array=z;function ae(i){return a(i)==="Float32Array"}o.isFloat32Array=ae;function re(i){return a(i)==="Float64Array"}o.isFloat64Array=re;function fe(i){return a(i)==="BigInt64Array"}o.isBigInt64Array=fe;function ue(i){return a(i)==="BigUint64Array"}o.isBigUint64Array=ue;function Q(i){return m(i)==="[object Map]"}Q.working=typeof Map<"u"&&Q(new Map);function Ue(i){return typeof Map>"u"?!1:Q.working?Q(i):i instanceof Map}o.isMap=Ue;function V(i){return m(i)==="[object Set]"}V.working=typeof Set<"u"&&V(new Set);function le(i){return typeof Set>"u"?!1:V.working?V(i):i instanceof Set}o.isSet=le;function pe(i){return m(i)==="[object WeakMap]"}pe.working=typeof WeakMap<"u"&&pe(new WeakMap);function Ce(i){return typeof WeakMap>"u"?!1:pe.working?pe(i):i instanceof WeakMap}o.isWeakMap=Ce;function he(i){return m(i)==="[object WeakSet]"}he.working=typeof WeakSet<"u"&&he(new WeakSet);function X(i){return he(i)}o.isWeakSet=X;function ye(i){return m(i)==="[object ArrayBuffer]"}ye.working=typeof ArrayBuffer<"u"&&ye(new ArrayBuffer);function U(i){return typeof ArrayBuffer>"u"?!1:ye.working?ye(i):i instanceof ArrayBuffer}o.isArrayBuffer=U;function h(i){return m(i)==="[object DataView]"}h.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&h(new DataView(new ArrayBuffer(1),0,1));function y(i){return typeof DataView>"u"?!1:h.working?h(i):i instanceof DataView}o.isDataView=y;var g=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function b(i){return m(i)==="[object SharedArrayBuffer]"}function F(i){return typeof g>"u"?!1:(typeof b.working>"u"&&(b.working=b(new g)),b.working?b(i):i instanceof g)}o.isSharedArrayBuffer=F;function x(i){return m(i)==="[object AsyncFunction]"}o.isAsyncFunction=x;function A(i){return m(i)==="[object Map Iterator]"}o.isMapIterator=A;function T(i){return m(i)==="[object Set Iterator]"}o.isSetIterator=T;function k(i){return m(i)==="[object Generator]"}o.isGeneratorObject=k;function N(i){return m(i)==="[object WebAssembly.Module]"}o.isWebAssemblyCompiledModule=N;function H(i){return D(i,E)}o.isNumberObject=H;function $(i){return D(i,w)}o.isStringObject=$;function ne(i){return D(i,O)}o.isBooleanObject=ne;function Re(i){return l&&D(i,R)}o.isBigIntObject=Re;function s(i){return c&&D(i,_)}o.isSymbolObject=s;function t(i){return H(i)||$(i)||ne(i)||Re(i)||s(i)}o.isBoxedPrimitive=t;function r(i){return typeof Uint8Array<"u"&&(U(i)||F(i))}o.isAnyArrayBuffer=r,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(i){Object.defineProperty(o,i,{enumerable:!1,value:function(){throw new Error(i+" is not supported in userland")}})})})(_t);var Kn=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},At={exports:{}};typeof Object.create=="function"?At.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:At.exports=function(e,n){if(n){e.super_=n;var a=function(){};a.prototype=n.prototype,e.prototype=new a,e.prototype.constructor=e}};var Qn=At.exports;(function(o){var e=Object.getOwnPropertyDescriptors||function(y){for(var g=Object.keys(y),b={},F=0;F<g.length;F++)b[g[F]]=Object.getOwnPropertyDescriptor(y,g[F]);return b},n=/%[sdj%]/g;o.format=function(h){if(!W(h)){for(var y=[],g=0;g<arguments.length;g++)y.push(l(arguments[g]));return y.join(" ")}for(var g=1,b=arguments,F=b.length,x=String(h).replace(n,function(T){if(T==="%%")return"%";if(g>=F)return T;switch(T){case"%s":return String(b[g++]);case"%d":return Number(b[g++]);case"%j":try{return JSON.stringify(b[g++])}catch{return"[Circular]"}default:return T}}),A=b[g];g<F;A=b[++g])ce(A)||!re(A)?x+=" "+A:x+=" "+l(A);return x},o.deprecate=function(h,y){if(typeof te<"u"&&te.noDeprecation===!0)return h;if(typeof te>"u")return function(){return o.deprecate(h,y).apply(this,arguments)};var g=!1;function b(){if(!g){if(te.throwDeprecation)throw new Error(y);te.traceDeprecation?console.trace(y):console.error(y),g=!0}return h.apply(this,arguments)}return b};var a={},u=/^$/;if(te.env.NODE_DEBUG){var f=te.env.NODE_DEBUG;f=f.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),u=new RegExp("^"+f+"$","i")}o.debuglog=function(h){if(h=h.toUpperCase(),!a[h])if(u.test(h)){var y=te.pid;a[h]=function(){var g=o.format.apply(o,arguments);console.error("%s %d: %s",h,y,g)}}else a[h]=function(){};return a[h]};function l(h,y){var g={seen:[],stylize:m};return arguments.length>=3&&(g.depth=arguments[2]),arguments.length>=4&&(g.colors=arguments[3]),se(y)?g.showHidden=y:y&&o._extend(g,y),z(g.showHidden)&&(g.showHidden=!1),z(g.depth)&&(g.depth=2),z(g.colors)&&(g.colors=!1),z(g.customInspect)&&(g.customInspect=!0),g.colors&&(g.stylize=c),w(g,h,g.depth)}o.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function c(h,y){var g=l.styles[y];return g?"\x1B["+l.colors[g][0]+"m"+h+"\x1B["+l.colors[g][1]+"m":h}function m(h,y){return h}function E(h){var y={};return h.forEach(function(g,b){y[g]=!0}),y}function w(h,y,g){if(h.customInspect&&y&&Q(y.inspect)&&y.inspect!==o.inspect&&!(y.constructor&&y.constructor.prototype===y)){var b=y.inspect(g,h);return W(b)||(b=w(h,b,g)),b}var F=O(h,y);if(F)return F;var x=Object.keys(y),A=E(x);if(h.showHidden&&(x=Object.getOwnPropertyNames(y)),ue(y)&&(x.indexOf("message")>=0||x.indexOf("description")>=0))return R(y);if(x.length===0){if(Q(y)){var T=y.name?": "+y.name:"";return h.stylize("[Function"+T+"]","special")}if(ae(y))return h.stylize(RegExp.prototype.toString.call(y),"regexp");if(fe(y))return h.stylize(Date.prototype.toString.call(y),"date");if(ue(y))return R(y)}var k="",N=!1,H=["{","}"];if(Ie(y)&&(N=!0,H=["[","]"]),Q(y)){var $=y.name?": "+y.name:"";k=" [Function"+$+"]"}if(ae(y)&&(k=" "+RegExp.prototype.toString.call(y)),fe(y)&&(k=" "+Date.prototype.toUTCString.call(y)),ue(y)&&(k=" "+R(y)),x.length===0&&(!N||y.length==0))return H[0]+k+H[1];if(g<0)return ae(y)?h.stylize(RegExp.prototype.toString.call(y),"regexp"):h.stylize("[Object]","special");h.seen.push(y);var ne;return N?ne=_(h,y,g,A,x):ne=x.map(function(Re){return D(h,y,g,A,Re,N)}),h.seen.pop(),G(ne,k,H)}function O(h,y){if(z(y))return h.stylize("undefined","undefined");if(W(y)){var g="'"+JSON.stringify(y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(g,"string")}if(ke(y))return h.stylize(""+y,"number");if(se(y))return h.stylize(""+y,"boolean");if(ce(y))return h.stylize("null","null")}function R(h){return"["+Error.prototype.toString.call(h)+"]"}function _(h,y,g,b,F){for(var x=[],A=0,T=y.length;A<T;++A)he(y,String(A))?x.push(D(h,y,g,b,String(A),!0)):x.push("");return F.forEach(function(k){k.match(/^\d+$/)||x.push(D(h,y,g,b,k,!0))}),x}function D(h,y,g,b,F,x){var A,T,k;if(k=Object.getOwnPropertyDescriptor(y,F)||{value:y[F]},k.get?k.set?T=h.stylize("[Getter/Setter]","special"):T=h.stylize("[Getter]","special"):k.set&&(T=h.stylize("[Setter]","special")),he(b,F)||(A="["+F+"]"),T||(h.seen.indexOf(k.value)<0?(ce(g)?T=w(h,k.value,null):T=w(h,k.value,g-1),T.indexOf(`
6
+ */(function(i){var e=Le,n=et,a=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=c,i.SlowBuffer=ce,i.INSPECT_MAX_BYTES=50;var u=2147483647;i.kMaxLength=u,c.TYPED_ARRAY_SUPPORT=f(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function f(){try{var s=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(s,t),s.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function l(s){if(s>u)throw new RangeError('The value "'+s+'" is invalid for option "size"');var t=new Uint8Array(s);return Object.setPrototypeOf(t,c.prototype),t}function c(s,t,r){if(typeof s=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O(s)}return m(s,t,r)}c.poolSize=8192;function m(s,t,r){if(typeof s=="string")return P(s,t);if(ArrayBuffer.isView(s))return D(s);if(s==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s);if($(s,ArrayBuffer)||s&&$(s.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($(s,SharedArrayBuffer)||s&&$(s.buffer,SharedArrayBuffer)))return W(s,t,r);if(typeof s=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var o=s.valueOf&&s.valueOf();if(o!=null&&o!==s)return c.from(o,t,r);var p=Ie(s);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof s[Symbol.toPrimitive]=="function")return c.from(s[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof s)}c.from=function(s,t,r){return m(s,t,r)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function b(s){if(typeof s!="number")throw new TypeError('"size" argument must be of type number');if(s<0)throw new RangeError('The value "'+s+'" is invalid for option "size"')}function w(s,t,r){return b(s),s<=0?l(s):t!==void 0?typeof r=="string"?l(s).fill(t,r):l(s).fill(t):l(s)}c.alloc=function(s,t,r){return w(s,t,r)};function O(s){return b(s),l(s<0?0:se(s)|0)}c.allocUnsafe=function(s){return O(s)},c.allocUnsafeSlow=function(s){return O(s)};function P(s,t){if((typeof t!="string"||t==="")&&(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=xe(s,t)|0,o=l(r),p=o.write(s,t);return p!==r&&(o=o.slice(0,p)),o}function _(s){for(var t=s.length<0?0:se(s.length)|0,r=l(t),o=0;o<t;o+=1)r[o]=s[o]&255;return r}function D(s){if($(s,Uint8Array)){var t=new Uint8Array(s);return W(t.buffer,t.byteOffset,t.byteLength)}return _(s)}function W(s,t,r){if(t<0||s.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(s.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var o;return t===void 0&&r===void 0?o=new Uint8Array(s):r===void 0?o=new Uint8Array(s,t):o=new Uint8Array(s,t,r),Object.setPrototypeOf(o,c.prototype),o}function Ie(s){if(c.isBuffer(s)){var t=se(s.length)|0,r=l(t);return r.length===0||s.copy(r,0,0,t),r}if(s.length!==void 0)return typeof s.length!="number"||ne(s.length)?l(0):_(s);if(s.type==="Buffer"&&Array.isArray(s.data))return _(s.data)}function se(s){if(s>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return s|0}function ce(s){return+s!=s&&(s=0),c.alloc(+s)}c.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==c.prototype},c.compare=function(t,r){if($(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),$(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(t)||!c.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var o=t.length,p=r.length,d=0,v=Math.min(o,p);d<v;++d)if(t[d]!==r[d]){o=t[d],p=r[d];break}return o<p?-1:p<o?1:0},c.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return c.alloc(0);var o;if(r===void 0)for(r=0,o=0;o<t.length;++o)r+=t[o].length;var p=c.allocUnsafe(r),d=0;for(o=0;o<t.length;++o){var v=t[o];if($(v,Uint8Array))d+v.length>p.length?c.from(v).copy(p,d):Uint8Array.prototype.set.call(p,v,d);else if(c.isBuffer(v))v.copy(p,d);else throw new TypeError('"list" argument must be an Array of Buffers');d+=v.length}return p};function xe(s,t){if(c.isBuffer(s))return s.length;if(ArrayBuffer.isView(s)||$(s,ArrayBuffer))return s.byteLength;if(typeof s!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof s);var r=s.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&r===0)return 0;for(var p=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return A(s).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return N(s).length;default:if(p)return o?-1:A(s).length;t=(""+t).toLowerCase(),p=!0}}c.byteLength=xe;function ke(s,t,r){var o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(s||(s="utf8");;)switch(s){case"hex":return X(this,t,r);case"utf8":case"utf-8":return V(this,t,r);case"ascii":return Ce(this,t,r);case"latin1":case"binary":return he(this,t,r);case"base64":return Ue(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ye(this,t,r);default:if(o)throw new TypeError("Unknown encoding: "+s);s=(s+"").toLowerCase(),o=!0}}c.prototype._isBuffer=!0;function J(s,t,r){var o=s[t];s[t]=s[r],s[r]=o}c.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)J(this,r,r+1);return this},c.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)J(this,r,r+3),J(this,r+1,r+2);return this},c.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)J(this,r,r+7),J(this,r+1,r+6),J(this,r+2,r+5),J(this,r+3,r+4);return this},c.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?V(this,0,t):ke.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:c.compare(this,t)===0},c.prototype.inspect=function(){var t="",r=i.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},a&&(c.prototype[a]=c.prototype.inspect),c.prototype.compare=function(t,r,o,p,d){if($(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),o===void 0&&(o=t?t.length:0),p===void 0&&(p=0),d===void 0&&(d=this.length),r<0||o>t.length||p<0||d>this.length)throw new RangeError("out of range index");if(p>=d&&r>=o)return 0;if(p>=d)return-1;if(r>=o)return 1;if(r>>>=0,o>>>=0,p>>>=0,d>>>=0,this===t)return 0;for(var v=d-p,I=o-r,B=Math.min(v,I),j=this.slice(p,d),q=t.slice(r,o),C=0;C<B;++C)if(j[C]!==q[C]){v=j[C],I=q[C];break}return v<I?-1:I<v?1:0};function Re(s,t,r,o,p){if(s.length===0)return-1;if(typeof r=="string"?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ne(r)&&(r=p?0:s.length-1),r<0&&(r=s.length+r),r>=s.length){if(p)return-1;r=s.length-1}else if(r<0)if(p)r=0;else return-1;if(typeof t=="string"&&(t=c.from(t,o)),c.isBuffer(t))return t.length===0?-1:H(s,t,r,o,p);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(s,t,r):Uint8Array.prototype.lastIndexOf.call(s,t,r):H(s,[t],r,o,p);throw new TypeError("val must be string, number or Buffer")}function H(s,t,r,o,p){var d=1,v=s.length,I=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(s.length<2||t.length<2)return-1;d=2,v/=2,I/=2,r/=2}function B(Sr,Tr){return d===1?Sr[Tr]:Sr.readUInt16BE(Tr*d)}var j;if(p){var q=-1;for(j=r;j<v;j++)if(B(s,j)===B(t,q===-1?0:j-q)){if(q===-1&&(q=j),j-q+1===I)return q*d}else q!==-1&&(j-=j-q),q=-1}else for(r+I>v&&(r=v-I),j=r;j>=0;j--){for(var C=!0,Ye=0;Ye<I;Ye++)if(B(s,j+Ye)!==B(t,Ye)){C=!1;break}if(C)return j}return-1}c.prototype.includes=function(t,r,o){return this.indexOf(t,r,o)!==-1},c.prototype.indexOf=function(t,r,o){return Re(this,t,r,o,!0)},c.prototype.lastIndexOf=function(t,r,o){return Re(this,t,r,o,!1)};function ae(s,t,r,o){r=Number(r)||0;var p=s.length-r;o?(o=Number(o),o>p&&(o=p)):o=p;var d=t.length;o>d/2&&(o=d/2);for(var v=0;v<o;++v){var I=parseInt(t.substr(v*2,2),16);if(ne(I))return v;s[r+v]=I}return v}function re(s,t,r,o){return K(A(t,s.length-r),s,r,o)}function fe(s,t,r,o){return K(T(t),s,r,o)}function ue(s,t,r,o){return K(N(t),s,r,o)}function Q(s,t,r,o){return K(k(t,s.length-r),s,r,o)}c.prototype.write=function(t,r,o,p){if(r===void 0)p="utf8",o=this.length,r=0;else if(o===void 0&&typeof r=="string")p=r,o=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(o)?(o=o>>>0,p===void 0&&(p="utf8")):(p=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var d=this.length-r;if((o===void 0||o>d)&&(o=d),t.length>0&&(o<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");for(var v=!1;;)switch(p){case"hex":return ae(this,t,r,o);case"utf8":case"utf-8":return re(this,t,r,o);case"ascii":case"latin1":case"binary":return fe(this,t,r,o);case"base64":return ue(this,t,r,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,t,r,o);default:if(v)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),v=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ue(s,t,r){return t===0&&r===s.length?e.fromByteArray(s):e.fromByteArray(s.slice(t,r))}function V(s,t,r){r=Math.min(s.length,r);for(var o=[],p=t;p<r;){var d=s[p],v=null,I=d>239?4:d>223?3:d>191?2:1;if(p+I<=r){var B,j,q,C;switch(I){case 1:d<128&&(v=d);break;case 2:B=s[p+1],(B&192)===128&&(C=(d&31)<<6|B&63,C>127&&(v=C));break;case 3:B=s[p+1],j=s[p+2],(B&192)===128&&(j&192)===128&&(C=(d&15)<<12|(B&63)<<6|j&63,C>2047&&(C<55296||C>57343)&&(v=C));break;case 4:B=s[p+1],j=s[p+2],q=s[p+3],(B&192)===128&&(j&192)===128&&(q&192)===128&&(C=(d&15)<<18|(B&63)<<12|(j&63)<<6|q&63,C>65535&&C<1114112&&(v=C))}}v===null?(v=65533,I=1):v>65535&&(v-=65536,o.push(v>>>10&1023|55296),v=56320|v&1023),o.push(v),p+=I}return pe(o)}var le=4096;function pe(s){var t=s.length;if(t<=le)return String.fromCharCode.apply(String,s);for(var r="",o=0;o<t;)r+=String.fromCharCode.apply(String,s.slice(o,o+=le));return r}function Ce(s,t,r){var o="";r=Math.min(s.length,r);for(var p=t;p<r;++p)o+=String.fromCharCode(s[p]&127);return o}function he(s,t,r){var o="";r=Math.min(s.length,r);for(var p=t;p<r;++p)o+=String.fromCharCode(s[p]);return o}function X(s,t,r){var o=s.length;(!t||t<0)&&(t=0),(!r||r<0||r>o)&&(r=o);for(var p="",d=t;d<r;++d)p+=Pe[s[d]];return p}function ye(s,t,r){for(var o=s.slice(t,r),p="",d=0;d<o.length-1;d+=2)p+=String.fromCharCode(o[d]+o[d+1]*256);return p}c.prototype.slice=function(t,r){var o=this.length;t=~~t,r=r===void 0?o:~~r,t<0?(t+=o,t<0&&(t=0)):t>o&&(t=o),r<0?(r+=o,r<0&&(r=0)):r>o&&(r=o),r<t&&(r=t);var p=this.subarray(t,r);return Object.setPrototypeOf(p,c.prototype),p};function U(s,t,r){if(s%1!==0||s<0)throw new RangeError("offset is not uint");if(s+t>r)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||U(t,r,this.length);for(var p=this[t],d=1,v=0;++v<r&&(d*=256);)p+=this[t+v]*d;return p},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||U(t,r,this.length);for(var p=this[t+--r],d=1;r>0&&(d*=256);)p+=this[t+--r]*d;return p},c.prototype.readUint8=c.prototype.readUInt8=function(t,r){return t=t>>>0,r||U(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||U(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||U(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||U(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||U(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readIntLE=function(t,r,o){t=t>>>0,r=r>>>0,o||U(t,r,this.length);for(var p=this[t],d=1,v=0;++v<r&&(d*=256);)p+=this[t+v]*d;return d*=128,p>=d&&(p-=Math.pow(2,8*r)),p},c.prototype.readIntBE=function(t,r,o){t=t>>>0,r=r>>>0,o||U(t,r,this.length);for(var p=r,d=1,v=this[t+--p];p>0&&(d*=256);)v+=this[t+--p]*d;return d*=128,v>=d&&(v-=Math.pow(2,8*r)),v},c.prototype.readInt8=function(t,r){return t=t>>>0,r||U(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},c.prototype.readInt16LE=function(t,r){t=t>>>0,r||U(t,2,this.length);var o=this[t]|this[t+1]<<8;return o&32768?o|4294901760:o},c.prototype.readInt16BE=function(t,r){t=t>>>0,r||U(t,2,this.length);var o=this[t+1]|this[t]<<8;return o&32768?o|4294901760:o},c.prototype.readInt32LE=function(t,r){return t=t>>>0,r||U(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,r){return t=t>>>0,r||U(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readFloatLE=function(t,r){return t=t>>>0,r||U(t,4,this.length),n.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,r){return t=t>>>0,r||U(t,4,this.length),n.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||U(t,8,this.length),n.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||U(t,8,this.length),n.read(this,t,!1,52,8)};function h(s,t,r,o,p,d){if(!c.isBuffer(s))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>p||t<d)throw new RangeError('"value" argument is out of bounds');if(r+o>s.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,r,o,p){if(t=+t,r=r>>>0,o=o>>>0,!p){var d=Math.pow(2,8*o)-1;h(this,t,r,o,d,0)}var v=1,I=0;for(this[r]=t&255;++I<o&&(v*=256);)this[r+I]=t/v&255;return r+o},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,r,o,p){if(t=+t,r=r>>>0,o=o>>>0,!p){var d=Math.pow(2,8*o)-1;h(this,t,r,o,d,0)}var v=o-1,I=1;for(this[r+v]=t&255;--v>=0&&(I*=256);)this[r+v]=t/I&255;return r+o},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,1,255,0),this[r]=t&255,r+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4},c.prototype.writeIntLE=function(t,r,o,p){if(t=+t,r=r>>>0,!p){var d=Math.pow(2,8*o-1);h(this,t,r,o,d-1,-d)}var v=0,I=1,B=0;for(this[r]=t&255;++v<o&&(I*=256);)t<0&&B===0&&this[r+v-1]!==0&&(B=1),this[r+v]=(t/I>>0)-B&255;return r+o},c.prototype.writeIntBE=function(t,r,o,p){if(t=+t,r=r>>>0,!p){var d=Math.pow(2,8*o-1);h(this,t,r,o,d-1,-d)}var v=o-1,I=1,B=0;for(this[r+v]=t&255;--v>=0&&(I*=256);)t<0&&B===0&&this[r+v+1]!==0&&(B=1),this[r+v]=(t/I>>0)-B&255;return r+o},c.prototype.writeInt8=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1},c.prototype.writeInt16LE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2},c.prototype.writeInt16BE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2},c.prototype.writeInt32LE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4},c.prototype.writeInt32BE=function(t,r,o){return t=+t,r=r>>>0,o||h(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function y(s,t,r,o,p,d){if(r+o>s.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function g(s,t,r,o,p){return t=+t,r=r>>>0,p||y(s,t,r,4),n.write(s,t,r,o,23,4),r+4}c.prototype.writeFloatLE=function(t,r,o){return g(this,t,r,!0,o)},c.prototype.writeFloatBE=function(t,r,o){return g(this,t,r,!1,o)};function E(s,t,r,o,p){return t=+t,r=r>>>0,p||y(s,t,r,8),n.write(s,t,r,o,52,8),r+8}c.prototype.writeDoubleLE=function(t,r,o){return E(this,t,r,!0,o)},c.prototype.writeDoubleBE=function(t,r,o){return E(this,t,r,!1,o)},c.prototype.copy=function(t,r,o,p){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(o||(o=0),!p&&p!==0&&(p=this.length),r>=t.length&&(r=t.length),r||(r=0),p>0&&p<o&&(p=o),p===o||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),t.length-r<p-o&&(p=t.length-r+o);var d=p-o;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,o,p):Uint8Array.prototype.set.call(t,this.subarray(o,p),r),d},c.prototype.fill=function(t,r,o,p){if(typeof t=="string"){if(typeof r=="string"?(p=r,r=0,o=this.length):typeof o=="string"&&(p=o,o=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!c.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(t.length===1){var d=t.charCodeAt(0);(p==="utf8"&&d<128||p==="latin1")&&(t=d)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<o)throw new RangeError("Out of range index");if(o<=r)return this;r=r>>>0,o=o===void 0?this.length:o>>>0,t||(t=0);var v;if(typeof t=="number")for(v=r;v<o;++v)this[v]=t;else{var I=c.isBuffer(t)?t:c.from(t,p),B=I.length;if(B===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(v=0;v<o-r;++v)this[v+r]=I[v%B]}return this};var F=/[^+/0-9A-Za-z-_]/g;function x(s){if(s=s.split("=")[0],s=s.trim().replace(F,""),s.length<2)return"";for(;s.length%4!==0;)s=s+"=";return s}function A(s,t){t=t||1/0;for(var r,o=s.length,p=null,d=[],v=0;v<o;++v){if(r=s.charCodeAt(v),r>55295&&r<57344){if(!p){if(r>56319){(t-=3)>-1&&d.push(239,191,189);continue}else if(v+1===o){(t-=3)>-1&&d.push(239,191,189);continue}p=r;continue}if(r<56320){(t-=3)>-1&&d.push(239,191,189),p=r;continue}r=(p-55296<<10|r-56320)+65536}else p&&(t-=3)>-1&&d.push(239,191,189);if(p=null,r<128){if((t-=1)<0)break;d.push(r)}else if(r<2048){if((t-=2)<0)break;d.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;d.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;d.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return d}function T(s){for(var t=[],r=0;r<s.length;++r)t.push(s.charCodeAt(r)&255);return t}function k(s,t){for(var r,o,p,d=[],v=0;v<s.length&&!((t-=2)<0);++v)r=s.charCodeAt(v),o=r>>8,p=r%256,d.push(p),d.push(o);return d}function N(s){return e.toByteArray(x(s))}function K(s,t,r,o){for(var p=0;p<o&&!(p+r>=t.length||p>=s.length);++p)t[p+r]=s[p];return p}function $(s,t){return s instanceof t||s!=null&&s.constructor!=null&&s.constructor.name!=null&&s.constructor.name===t.name}function ne(s){return s!==s}var Pe=function(){for(var s="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var o=r*16,p=0;p<16;++p)t[o+p]=s[r]+s[p];return t}()})(Rt);var Bt={exports:{}},L=Bt.exports={},Z,ee;function tt(){throw new Error("setTimeout has not been defined")}function rt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Z=setTimeout:Z=tt}catch{Z=tt}try{typeof clearTimeout=="function"?ee=clearTimeout:ee=rt}catch{ee=rt}})();function _t(i){if(Z===setTimeout)return setTimeout(i,0);if((Z===tt||!Z)&&setTimeout)return Z=setTimeout,setTimeout(i,0);try{return Z(i,0)}catch{try{return Z.call(null,i,0)}catch{return Z.call(this,i,0)}}}function jr(i){if(ee===clearTimeout)return clearTimeout(i);if((ee===rt||!ee)&&clearTimeout)return ee=clearTimeout,clearTimeout(i);try{return ee(i)}catch{try{return ee.call(null,i)}catch{return ee.call(this,i)}}}var ie=[],be=!1,de,De=-1;function Ur(){!be||!de||(be=!1,de.length?ie=de.concat(ie):De=-1,ie.length&&jt())}function jt(){if(!be){var i=_t(Ur);be=!0;for(var e=ie.length;e;){for(de=ie,ie=[];++De<e;)de&&de[De].run();De=-1,e=ie.length}de=null,be=!1,jr(i)}}L.nextTick=function(i){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];ie.push(new Ut(i,e)),ie.length===1&&!be&&_t(jt)};function Ut(i,e){this.fun=i,this.array=e}Ut.prototype.run=function(){this.fun.apply(null,this.array)},L.title="browser",L.browser=!0,L.env={},L.argv=[],L.version="",L.versions={};function oe(){}L.on=oe,L.addListener=oe,L.once=oe,L.off=oe,L.removeListener=oe,L.removeAllListeners=oe,L.emit=oe,L.prependListener=oe,L.prependOnceListener=oe,L.listeners=function(i){return[]},L.binding=function(i){throw new Error("process.binding is not supported")},L.cwd=function(){return"/"},L.chdir=function(i){throw new Error("process.chdir is not supported")},L.umask=function(){return 0};var Cr=Bt.exports;const te=Or(Cr);var Lr=function(i){function e(){var a=this||self;return delete i.prototype.__magic__,a}if(typeof globalThis=="object")return globalThis;if(this)return e();i.defineProperty(i.prototype,"__magic__",{configurable:!0,get:e});var n=__magic__;return n}(Object),Dr=Lr,nt={},Ct={},Lt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),a=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(a)!=="[object Symbol]")return!1;var u=42;e[n]=u;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var f=Object.getOwnPropertySymbols(e);if(f.length!==1||f[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var l=Object.getOwnPropertyDescriptor(e,n);if(l.value!==u||l.enumerable!==!0)return!1}return!0},Mr=Lt,it=function(){return Mr()&&!!Symbol.toStringTag},Dt=typeof Symbol<"u"&&Symbol,Nr=Lt,qr=function(){return typeof Dt!="function"||typeof Symbol!="function"||typeof Dt("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Nr()},Mt={foo:{}},$r=Object,Gr=function(){return{__proto__:Mt}.foo===Mt.foo&&!({__proto__:null}instanceof $r)},Wr="Function.prototype.bind called on incompatible ",ot=Array.prototype.slice,Jr=Object.prototype.toString,zr="[object Function]",Hr=function(e){var n=this;if(typeof n!="function"||Jr.call(n)!==zr)throw new TypeError(Wr+n);for(var a=ot.call(arguments,1),u,f=function(){if(this instanceof u){var w=n.apply(this,a.concat(ot.call(arguments)));return Object(w)===w?w:this}else return n.apply(e,a.concat(ot.call(arguments)))},l=Math.max(0,n.length-a.length),c=[],m=0;m<l;m++)c.push("$"+m);if(u=Function("binder","return function ("+c.join(",")+"){ return binder.apply(this,arguments); }")(f),n.prototype){var b=function(){};b.prototype=n.prototype,u.prototype=new b,b.prototype=null}return u},Kr=Hr,st=Function.prototype.bind||Kr,Qr=st,Vr=Qr.call(Function.call,Object.prototype.hasOwnProperty),S,Ee=SyntaxError,Nt=Function,Ae=TypeError,at=function(i){try{return Nt('"use strict"; return ('+i+").constructor;")()}catch{}},ge=Object.getOwnPropertyDescriptor;if(ge)try{ge({},"")}catch{ge=null}var ut=function(){throw new Ae},Xr=ge?function(){try{return arguments.callee,ut}catch{try{return ge(arguments,"callee").get}catch{return ut}}}():ut,Se=qr(),Yr=Gr(),M=Object.getPrototypeOf||(Yr?function(i){return i.__proto__}:null),Te={},Zr=typeof Uint8Array>"u"||!M?S:M(Uint8Array),ve={"%AggregateError%":typeof AggregateError>"u"?S:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?S:ArrayBuffer,"%ArrayIteratorPrototype%":Se&&M?M([][Symbol.iterator]()):S,"%AsyncFromSyncIteratorPrototype%":S,"%AsyncFunction%":Te,"%AsyncGenerator%":Te,"%AsyncGeneratorFunction%":Te,"%AsyncIteratorPrototype%":Te,"%Atomics%":typeof Atomics>"u"?S:Atomics,"%BigInt%":typeof BigInt>"u"?S:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?S:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?S:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?S:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?S:Float32Array,"%Float64Array%":typeof Float64Array>"u"?S:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?S:FinalizationRegistry,"%Function%":Nt,"%GeneratorFunction%":Te,"%Int8Array%":typeof Int8Array>"u"?S:Int8Array,"%Int16Array%":typeof Int16Array>"u"?S:Int16Array,"%Int32Array%":typeof Int32Array>"u"?S:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Se&&M?M(M([][Symbol.iterator]())):S,"%JSON%":typeof JSON=="object"?JSON:S,"%Map%":typeof Map>"u"?S:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Se||!M?S:M(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?S:Promise,"%Proxy%":typeof Proxy>"u"?S:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?S:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?S:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Se||!M?S:M(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?S:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Se&&M?M(""[Symbol.iterator]()):S,"%Symbol%":Se?Symbol:S,"%SyntaxError%":Ee,"%ThrowTypeError%":Xr,"%TypedArray%":Zr,"%TypeError%":Ae,"%Uint8Array%":typeof Uint8Array>"u"?S:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?S:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?S:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?S:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?S:WeakMap,"%WeakRef%":typeof WeakRef>"u"?S:WeakRef,"%WeakSet%":typeof WeakSet>"u"?S:WeakSet};if(M)try{null.error}catch(i){var en=M(M(i));ve["%Error.prototype%"]=en}var tn=function i(e){var n;if(e==="%AsyncFunction%")n=at("async function () {}");else if(e==="%GeneratorFunction%")n=at("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=at("async function* () {}");else if(e==="%AsyncGenerator%"){var a=i("%AsyncGeneratorFunction%");a&&(n=a.prototype)}else if(e==="%AsyncIteratorPrototype%"){var u=i("%AsyncGenerator%");u&&M&&(n=M(u.prototype))}return ve[e]=n,n},qt={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Be=st,Me=Vr,rn=Be.call(Function.call,Array.prototype.concat),nn=Be.call(Function.apply,Array.prototype.splice),$t=Be.call(Function.call,String.prototype.replace),Ne=Be.call(Function.call,String.prototype.slice),on=Be.call(Function.call,RegExp.prototype.exec),sn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,an=/\\(\\)?/g,un=function(e){var n=Ne(e,0,1),a=Ne(e,-1);if(n==="%"&&a!=="%")throw new Ee("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&n!=="%")throw new Ee("invalid intrinsic syntax, expected opening `%`");var u=[];return $t(e,sn,function(f,l,c,m){u[u.length]=c?$t(m,an,"$1"):l||f}),u},cn=function(e,n){var a=e,u;if(Me(qt,a)&&(u=qt[a],a="%"+u[0]+"%"),Me(ve,a)){var f=ve[a];if(f===Te&&(f=tn(a)),typeof f>"u"&&!n)throw new Ae("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:u,name:a,value:f}}throw new Ee("intrinsic "+e+" does not exist!")},ct=function(e,n){if(typeof e!="string"||e.length===0)throw new Ae("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Ae('"allowMissing" argument must be a boolean');if(on(/^%?[^%]*%?$/,e)===null)throw new Ee("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=un(e),u=a.length>0?a[0]:"",f=cn("%"+u+"%",n),l=f.name,c=f.value,m=!1,b=f.alias;b&&(u=b[0],nn(a,rn([0,1],b)));for(var w=1,O=!0;w<a.length;w+=1){var P=a[w],_=Ne(P,0,1),D=Ne(P,-1);if((_==='"'||_==="'"||_==="`"||D==='"'||D==="'"||D==="`")&&_!==D)throw new Ee("property names with quotes must have matching quotes");if((P==="constructor"||!O)&&(m=!0),u+="."+P,l="%"+u+"%",Me(ve,l))c=ve[l];else if(c!=null){if(!(P in c)){if(!n)throw new Ae("base intrinsic for "+e+" exists, but the property is not available.");return}if(ge&&w+1>=a.length){var W=ge(c,P);O=!!W,O&&"get"in W&&!("originalValue"in W.get)?c=W.get:c=c[P]}else O=Me(c,P),c=c[P];O&&!m&&(ve[l]=c)}}return c},Gt={exports:{}};(function(i){var e=st,n=ct,a=n("%Function.prototype.apply%"),u=n("%Function.prototype.call%"),f=n("%Reflect.apply%",!0)||e.call(u,a),l=n("%Object.getOwnPropertyDescriptor%",!0),c=n("%Object.defineProperty%",!0),m=n("%Math.max%");if(c)try{c({},"a",{value:1})}catch{c=null}i.exports=function(O){var P=f(e,u,arguments);if(l&&c){var _=l(P,"length");_.configurable&&c(P,"length",{value:1+m(0,O.length-(arguments.length-1))})}return P};var b=function(){return f(e,a,arguments)};c?c(i.exports,"apply",{value:b}):i.exports.apply=b})(Gt);var Wt=Gt.exports,Jt=ct,zt=Wt,fn=zt(Jt("String.prototype.indexOf")),Ht=function(e,n){var a=Jt(e,!!n);return typeof a=="function"&&fn(e,".prototype.")>-1?zt(a):a},ln=it(),pn=Ht,ft=pn("Object.prototype.toString"),qe=function(e){return ln&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:ft(e)==="[object Arguments]"},Kt=function(e){return qe(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ft(e)!=="[object Array]"&&ft(e.callee)==="[object Function]"},hn=function(){return qe(arguments)}();qe.isLegacyArguments=Kt;var yn=hn?qe:Kt,dn=Object.prototype.toString,gn=Function.prototype.toString,vn=/^\s*(?:function)?\*/,Qt=it(),lt=Object.getPrototypeOf,mn=function(){if(!Qt)return!1;try{return Function("return function*() {}")()}catch{}},pt,wn=function(e){if(typeof e!="function")return!1;if(vn.test(gn.call(e)))return!0;if(!Qt){var n=dn.call(e);return n==="[object GeneratorFunction]"}if(!lt)return!1;if(typeof pt>"u"){var a=mn();pt=a?lt(a):!1}return lt(e)===pt},Vt=Function.prototype.toString,Oe=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ht,$e;if(typeof Oe=="function"&&typeof Object.defineProperty=="function")try{ht=Object.defineProperty({},"length",{get:function(){throw $e}}),$e={},Oe(function(){throw 42},null,ht)}catch(i){i!==$e&&(Oe=null)}else Oe=null;var bn=/^\s*class\b/,yt=function(e){try{var n=Vt.call(e);return bn.test(n)}catch{return!1}},dt=function(e){try{return yt(e)?!1:(Vt.call(e),!0)}catch{return!1}},Ge=Object.prototype.toString,En="[object Object]",An="[object Function]",Sn="[object GeneratorFunction]",Tn="[object HTMLAllCollection]",On="[object HTML document.all class]",Fn="[object HTMLCollection]",In=typeof Symbol=="function"&&!!Symbol.toStringTag,xn=!(0 in[,]),gt=function(){return!1};if(typeof document=="object"){var kn=document.all;Ge.call(kn)===Ge.call(document.all)&&(gt=function(e){if((xn||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=Ge.call(e);return(n===Tn||n===On||n===Fn||n===En)&&e("")==null}catch{}return!1})}var Rn=Oe?function(e){if(gt(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Oe(e,null,ht)}catch(n){if(n!==$e)return!1}return!yt(e)&&dt(e)}:function(e){if(gt(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(In)return dt(e);if(yt(e))return!1;var n=Ge.call(e);return n!==An&&n!==Sn&&!/^\[object HTML/.test(n)?!1:dt(e)},Pn=Rn,Bn=Object.prototype.toString,Xt=Object.prototype.hasOwnProperty,_n=function(e,n,a){for(var u=0,f=e.length;u<f;u++)Xt.call(e,u)&&(a==null?n(e[u],u,e):n.call(a,e[u],u,e))},jn=function(e,n,a){for(var u=0,f=e.length;u<f;u++)a==null?n(e.charAt(u),u,e):n.call(a,e.charAt(u),u,e)},Un=function(e,n,a){for(var u in e)Xt.call(e,u)&&(a==null?n(e[u],u,e):n.call(a,e[u],u,e))},Cn=function(e,n,a){if(!Pn(n))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=a),Bn.call(e)==="[object Array]"?_n(e,n,u):typeof e=="string"?jn(e,n,u):Un(e,n,u)},Ln=Cn,vt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],Dn=typeof globalThis>"u"?kt:globalThis,Mn=function(){for(var e=[],n=0;n<vt.length;n++)typeof Dn[vt[n]]=="function"&&(e[e.length]=vt[n]);return e},Nn=ct,We=Nn("%Object.getOwnPropertyDescriptor%",!0);if(We)try{We([],"length")}catch{We=null}var qn=We,Je=Ln,$n=Mn,Yt=Wt,mt=Ht,ze=qn,Gn=mt("Object.prototype.toString"),Zt=it(),er=typeof globalThis>"u"?kt:globalThis,wt=$n(),bt=mt("String.prototype.slice"),Et=Object.getPrototypeOf,Wn=mt("Array.prototype.indexOf",!0)||function(e,n){for(var a=0;a<e.length;a+=1)if(e[a]===n)return a;return-1},He={__proto__:null};Zt&&ze&&Et?Je(wt,function(i){var e=new er[i];if(Symbol.toStringTag in e){var n=Et(e),a=ze(n,Symbol.toStringTag);if(!a){var u=Et(n);a=ze(u,Symbol.toStringTag)}He["$"+i]=Yt(a.get)}}):Je(wt,function(i){var e=new er[i];He["$"+i]=Yt(e.slice)});var Jn=function(e){var n=!1;return Je(He,function(a,u){if(!n)try{"$"+a(e)===u&&(n=bt(u,1))}catch{}}),n},zn=function(e){var n=!1;return Je(He,function(a,u){if(!n)try{a(e),n=bt(u,1)}catch{}}),n},tr=function(e){if(!e||typeof e!="object")return!1;if(!Zt){var n=bt(Gn(e),8,-1);return Wn(wt,n)>-1?n:n!=="Object"?!1:zn(e)}return ze?Jn(e):null},Hn=tr,Kn=function(e){return!!Hn(e)};(function(i){var e=yn,n=wn,a=tr,u=Kn;function f(o){return o.call.bind(o)}var l=typeof BigInt<"u",c=typeof Symbol<"u",m=f(Object.prototype.toString),b=f(Number.prototype.valueOf),w=f(String.prototype.valueOf),O=f(Boolean.prototype.valueOf);if(l)var P=f(BigInt.prototype.valueOf);if(c)var _=f(Symbol.prototype.valueOf);function D(o,p){if(typeof o!="object")return!1;try{return p(o),!0}catch{return!1}}i.isArgumentsObject=e,i.isGeneratorFunction=n,i.isTypedArray=u;function W(o){return typeof Promise<"u"&&o instanceof Promise||o!==null&&typeof o=="object"&&typeof o.then=="function"&&typeof o.catch=="function"}i.isPromise=W;function Ie(o){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(o):u(o)||y(o)}i.isArrayBufferView=Ie;function se(o){return a(o)==="Uint8Array"}i.isUint8Array=se;function ce(o){return a(o)==="Uint8ClampedArray"}i.isUint8ClampedArray=ce;function xe(o){return a(o)==="Uint16Array"}i.isUint16Array=xe;function ke(o){return a(o)==="Uint32Array"}i.isUint32Array=ke;function J(o){return a(o)==="Int8Array"}i.isInt8Array=J;function Re(o){return a(o)==="Int16Array"}i.isInt16Array=Re;function H(o){return a(o)==="Int32Array"}i.isInt32Array=H;function ae(o){return a(o)==="Float32Array"}i.isFloat32Array=ae;function re(o){return a(o)==="Float64Array"}i.isFloat64Array=re;function fe(o){return a(o)==="BigInt64Array"}i.isBigInt64Array=fe;function ue(o){return a(o)==="BigUint64Array"}i.isBigUint64Array=ue;function Q(o){return m(o)==="[object Map]"}Q.working=typeof Map<"u"&&Q(new Map);function Ue(o){return typeof Map>"u"?!1:Q.working?Q(o):o instanceof Map}i.isMap=Ue;function V(o){return m(o)==="[object Set]"}V.working=typeof Set<"u"&&V(new Set);function le(o){return typeof Set>"u"?!1:V.working?V(o):o instanceof Set}i.isSet=le;function pe(o){return m(o)==="[object WeakMap]"}pe.working=typeof WeakMap<"u"&&pe(new WeakMap);function Ce(o){return typeof WeakMap>"u"?!1:pe.working?pe(o):o instanceof WeakMap}i.isWeakMap=Ce;function he(o){return m(o)==="[object WeakSet]"}he.working=typeof WeakSet<"u"&&he(new WeakSet);function X(o){return he(o)}i.isWeakSet=X;function ye(o){return m(o)==="[object ArrayBuffer]"}ye.working=typeof ArrayBuffer<"u"&&ye(new ArrayBuffer);function U(o){return typeof ArrayBuffer>"u"?!1:ye.working?ye(o):o instanceof ArrayBuffer}i.isArrayBuffer=U;function h(o){return m(o)==="[object DataView]"}h.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&h(new DataView(new ArrayBuffer(1),0,1));function y(o){return typeof DataView>"u"?!1:h.working?h(o):o instanceof DataView}i.isDataView=y;var g=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function E(o){return m(o)==="[object SharedArrayBuffer]"}function F(o){return typeof g>"u"?!1:(typeof E.working>"u"&&(E.working=E(new g)),E.working?E(o):o instanceof g)}i.isSharedArrayBuffer=F;function x(o){return m(o)==="[object AsyncFunction]"}i.isAsyncFunction=x;function A(o){return m(o)==="[object Map Iterator]"}i.isMapIterator=A;function T(o){return m(o)==="[object Set Iterator]"}i.isSetIterator=T;function k(o){return m(o)==="[object Generator]"}i.isGeneratorObject=k;function N(o){return m(o)==="[object WebAssembly.Module]"}i.isWebAssemblyCompiledModule=N;function K(o){return D(o,b)}i.isNumberObject=K;function $(o){return D(o,w)}i.isStringObject=$;function ne(o){return D(o,O)}i.isBooleanObject=ne;function Pe(o){return l&&D(o,P)}i.isBigIntObject=Pe;function s(o){return c&&D(o,_)}i.isSymbolObject=s;function t(o){return K(o)||$(o)||ne(o)||Pe(o)||s(o)}i.isBoxedPrimitive=t;function r(o){return typeof Uint8Array<"u"&&(U(o)||F(o))}i.isAnyArrayBuffer=r,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(o){Object.defineProperty(i,o,{enumerable:!1,value:function(){throw new Error(o+" is not supported in userland")}})})})(Ct);var Qn=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},At={exports:{}};typeof Object.create=="function"?At.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:At.exports=function(e,n){if(n){e.super_=n;var a=function(){};a.prototype=n.prototype,e.prototype=new a,e.prototype.constructor=e}};var Vn=At.exports;(function(i){var e=Object.getOwnPropertyDescriptors||function(y){for(var g=Object.keys(y),E={},F=0;F<g.length;F++)E[g[F]]=Object.getOwnPropertyDescriptor(y,g[F]);return E},n=/%[sdj%]/g;i.format=function(h){if(!J(h)){for(var y=[],g=0;g<arguments.length;g++)y.push(l(arguments[g]));return y.join(" ")}for(var g=1,E=arguments,F=E.length,x=String(h).replace(n,function(T){if(T==="%%")return"%";if(g>=F)return T;switch(T){case"%s":return String(E[g++]);case"%d":return Number(E[g++]);case"%j":try{return JSON.stringify(E[g++])}catch{return"[Circular]"}default:return T}}),A=E[g];g<F;A=E[++g])ce(A)||!re(A)?x+=" "+A:x+=" "+l(A);return x},i.deprecate=function(h,y){if(typeof te<"u"&&te.noDeprecation===!0)return h;if(typeof te>"u")return function(){return i.deprecate(h,y).apply(this,arguments)};var g=!1;function E(){if(!g){if(te.throwDeprecation)throw new Error(y);te.traceDeprecation?console.trace(y):console.error(y),g=!0}return h.apply(this,arguments)}return E};var a={},u=/^$/;if(te.env.NODE_DEBUG){var f=te.env.NODE_DEBUG;f=f.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),u=new RegExp("^"+f+"$","i")}i.debuglog=function(h){if(h=h.toUpperCase(),!a[h])if(u.test(h)){var y=te.pid;a[h]=function(){var g=i.format.apply(i,arguments);console.error("%s %d: %s",h,y,g)}}else a[h]=function(){};return a[h]};function l(h,y){var g={seen:[],stylize:m};return arguments.length>=3&&(g.depth=arguments[2]),arguments.length>=4&&(g.colors=arguments[3]),se(y)?g.showHidden=y:y&&i._extend(g,y),H(g.showHidden)&&(g.showHidden=!1),H(g.depth)&&(g.depth=2),H(g.colors)&&(g.colors=!1),H(g.customInspect)&&(g.customInspect=!0),g.colors&&(g.stylize=c),w(g,h,g.depth)}i.inspect=l,l.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},l.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function c(h,y){var g=l.styles[y];return g?"\x1B["+l.colors[g][0]+"m"+h+"\x1B["+l.colors[g][1]+"m":h}function m(h,y){return h}function b(h){var y={};return h.forEach(function(g,E){y[g]=!0}),y}function w(h,y,g){if(h.customInspect&&y&&Q(y.inspect)&&y.inspect!==i.inspect&&!(y.constructor&&y.constructor.prototype===y)){var E=y.inspect(g,h);return J(E)||(E=w(h,E,g)),E}var F=O(h,y);if(F)return F;var x=Object.keys(y),A=b(x);if(h.showHidden&&(x=Object.getOwnPropertyNames(y)),ue(y)&&(x.indexOf("message")>=0||x.indexOf("description")>=0))return P(y);if(x.length===0){if(Q(y)){var T=y.name?": "+y.name:"";return h.stylize("[Function"+T+"]","special")}if(ae(y))return h.stylize(RegExp.prototype.toString.call(y),"regexp");if(fe(y))return h.stylize(Date.prototype.toString.call(y),"date");if(ue(y))return P(y)}var k="",N=!1,K=["{","}"];if(Ie(y)&&(N=!0,K=["[","]"]),Q(y)){var $=y.name?": "+y.name:"";k=" [Function"+$+"]"}if(ae(y)&&(k=" "+RegExp.prototype.toString.call(y)),fe(y)&&(k=" "+Date.prototype.toUTCString.call(y)),ue(y)&&(k=" "+P(y)),x.length===0&&(!N||y.length==0))return K[0]+k+K[1];if(g<0)return ae(y)?h.stylize(RegExp.prototype.toString.call(y),"regexp"):h.stylize("[Object]","special");h.seen.push(y);var ne;return N?ne=_(h,y,g,A,x):ne=x.map(function(Pe){return D(h,y,g,A,Pe,N)}),h.seen.pop(),W(ne,k,K)}function O(h,y){if(H(y))return h.stylize("undefined","undefined");if(J(y)){var g="'"+JSON.stringify(y).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(g,"string")}if(ke(y))return h.stylize(""+y,"number");if(se(y))return h.stylize(""+y,"boolean");if(ce(y))return h.stylize("null","null")}function P(h){return"["+Error.prototype.toString.call(h)+"]"}function _(h,y,g,E,F){for(var x=[],A=0,T=y.length;A<T;++A)he(y,String(A))?x.push(D(h,y,g,E,String(A),!0)):x.push("");return F.forEach(function(k){k.match(/^\d+$/)||x.push(D(h,y,g,E,k,!0))}),x}function D(h,y,g,E,F,x){var A,T,k;if(k=Object.getOwnPropertyDescriptor(y,F)||{value:y[F]},k.get?k.set?T=h.stylize("[Getter/Setter]","special"):T=h.stylize("[Getter]","special"):k.set&&(T=h.stylize("[Setter]","special")),he(E,F)||(A="["+F+"]"),T||(h.seen.indexOf(k.value)<0?(ce(g)?T=w(h,k.value,null):T=w(h,k.value,g-1),T.indexOf(`
7
7
  `)>-1&&(x?T=T.split(`
8
8
  `).map(function(N){return" "+N}).join(`
9
9
  `).slice(2):T=`
10
10
  `+T.split(`
11
11
  `).map(function(N){return" "+N}).join(`
12
- `))):T=h.stylize("[Circular]","special")),z(A)){if(x&&F.match(/^\d+$/))return T;A=JSON.stringify(""+F),A.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(A=A.slice(1,-1),A=h.stylize(A,"name")):(A=A.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),A=h.stylize(A,"string"))}return A+": "+T}function G(h,y,g){var b=h.reduce(function(F,x){return x.indexOf(`
13
- `)>=0,F+x.replace(/\u001b\[\d\d?m/g,"").length+1},0);return b>60?g[0]+(y===""?"":y+`
12
+ `))):T=h.stylize("[Circular]","special")),H(A)){if(x&&F.match(/^\d+$/))return T;A=JSON.stringify(""+F),A.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(A=A.slice(1,-1),A=h.stylize(A,"name")):(A=A.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),A=h.stylize(A,"string"))}return A+": "+T}function W(h,y,g){var E=h.reduce(function(F,x){return x.indexOf(`
13
+ `)>=0,F+x.replace(/\u001b\[\d\d?m/g,"").length+1},0);return E>60?g[0]+(y===""?"":y+`
14
14
  `)+" "+h.join(`,
15
- `)+" "+g[1]:g[0]+y+" "+h.join(", ")+" "+g[1]}o.types=_t;function Ie(h){return Array.isArray(h)}o.isArray=Ie;function se(h){return typeof h=="boolean"}o.isBoolean=se;function ce(h){return h===null}o.isNull=ce;function xe(h){return h==null}o.isNullOrUndefined=xe;function ke(h){return typeof h=="number"}o.isNumber=ke;function W(h){return typeof h=="string"}o.isString=W;function Pe(h){return typeof h=="symbol"}o.isSymbol=Pe;function z(h){return h===void 0}o.isUndefined=z;function ae(h){return re(h)&&V(h)==="[object RegExp]"}o.isRegExp=ae,o.types.isRegExp=ae;function re(h){return typeof h=="object"&&h!==null}o.isObject=re;function fe(h){return re(h)&&V(h)==="[object Date]"}o.isDate=fe,o.types.isDate=fe;function ue(h){return re(h)&&(V(h)==="[object Error]"||h instanceof Error)}o.isError=ue,o.types.isNativeError=ue;function Q(h){return typeof h=="function"}o.isFunction=Q;function Ue(h){return h===null||typeof h=="boolean"||typeof h=="number"||typeof h=="string"||typeof h=="symbol"||typeof h>"u"}o.isPrimitive=Ue,o.isBuffer=Kn;function V(h){return Object.prototype.toString.call(h)}function le(h){return h<10?"0"+h.toString(10):h.toString(10)}var pe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ce(){var h=new Date,y=[le(h.getHours()),le(h.getMinutes()),le(h.getSeconds())].join(":");return[h.getDate(),pe[h.getMonth()],y].join(" ")}o.log=function(){console.log("%s - %s",Ce(),o.format.apply(o,arguments))},o.inherits=Qn,o._extend=function(h,y){if(!y||!re(y))return h;for(var g=Object.keys(y),b=g.length;b--;)h[g[b]]=y[g[b]];return h};function he(h,y){return Object.prototype.hasOwnProperty.call(h,y)}var X=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;o.promisify=function(y){if(typeof y!="function")throw new TypeError('The "original" argument must be of type Function');if(X&&y[X]){var g=y[X];if(typeof g!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(g,X,{value:g,enumerable:!1,writable:!1,configurable:!0}),g}function g(){for(var b,F,x=new Promise(function(k,N){b=k,F=N}),A=[],T=0;T<arguments.length;T++)A.push(arguments[T]);A.push(function(k,N){k?F(k):b(N)});try{y.apply(this,A)}catch(k){F(k)}return x}return Object.setPrototypeOf(g,Object.getPrototypeOf(y)),X&&Object.defineProperty(g,X,{value:g,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(g,e(y))},o.promisify.custom=X;function ye(h,y){if(!h){var g=new Error("Promise was rejected with a falsy value");g.reason=h,h=g}return y(h)}function U(h){if(typeof h!="function")throw new TypeError('The "original" argument must be of type Function');function y(){for(var g=[],b=0;b<arguments.length;b++)g.push(arguments[b]);var F=g.pop();if(typeof F!="function")throw new TypeError("The last argument must be of type Function");var x=this,A=function(){return F.apply(x,arguments)};h.apply(this,g).then(function(T){te.nextTick(A.bind(null,null,T))},function(T){te.nextTick(ye.bind(null,T,A))})}return Object.setPrototypeOf(y,Object.getPrototypeOf(h)),Object.defineProperties(y,e(h)),y}o.callbackify=U})(nt);var St,Zt;function Vn(){if(Zt)return St;Zt=1;var o=function(){if(typeof self=="object"&&self)return self;if(typeof window=="object"&&window)return window;throw new Error("Unable to resolve global `this`")};return St=function(){if(this)return this;if(typeof globalThis=="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch{return o()}try{return __global__||o()}finally{delete Object.prototype.__global__}}(),St}var Xn={_from:"websocket@^1.0.30",_id:"websocket@1.0.34",_inBundle:!1,_integrity:"sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==",_location:"/websocket",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"websocket@^1.0.30",name:"websocket",escapedName:"websocket",rawSpec:"^1.0.30",saveSpec:null,fetchSpec:"^1.0.30"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz",_shasum:"2bdc2602c08bf2c82253b730655c0ef7dcab3111",_spec:"websocket@^1.0.30",_where:"/Users/peter/dev/cachearoo-js",author:{name:"Brian McKelvey",email:"theturtle32@gmail.com",url:"https://github.com/theturtle32"},browser:"lib/browser.js",bugs:{url:"https://github.com/theturtle32/WebSocket-Node/issues"},bundleDependencies:!1,config:{verbose:!1},contributors:[{name:"Iñaki Baz Castillo",email:"ibc@aliax.net",url:"http://dev.sipdoc.net"}],dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},deprecated:!1,description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4",jshint:"^2.0.0","jshint-stylish":"^2.2.1",tape:"^4.9.1"},directories:{lib:"./lib"},engines:{node:">=4.0.0"},homepage:"https://github.com/theturtle32/WebSocket-Node",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],license:"Apache-2.0",main:"index",name:"websocket",repository:{type:"git",url:"git+https://github.com/theturtle32/WebSocket-Node.git"},scripts:{gulp:"gulp",test:"tape test/unit/*.js"},version:"1.0.34"}.version,me;if(typeof globalThis=="object")me=globalThis;else try{me=Vn()}catch{}finally{if(!me&&typeof window<"u"&&(me=window),!me)throw new Error("Could not determine global this")}var _e=me.WebSocket||me.MozWebSocket,Yn=Xn;function er(o,e){var n;return e?n=new _e(o,e):n=new _e(o),n}_e&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(o){Object.defineProperty(er,o,{get:function(){return _e[o]}})});var Zn={w3cwebsocket:_e?er:null,version:Yn};const ei=3e3;function ti(o){const e=new Uint8Array(128);let n=0;const a=typeof window<"u"?window.TextEncoder:nt.TextEncoder,u=new a,f=u.encode(o.bucket),l=u.encode(o.key),c=u.encode(o.apiKey);if(f.byteLength>36||l.byteLength>36||c.byteLength>36)throw new Error("Cannot write binary header, bucket/key/apiKey cannot exceed 36 bytes each");return e[0]=o.type,e[1]=f.byteLength,e[2]=l.byteLength,e[3]=c.byteLength,n=4,e.set(f,n),n+=e[1],e.set(l,n),n+=e[2],e.set(c,n),e}function ri(o){let e=o[1],n=o[2],a=o[3];const u=typeof window<"u"?window.TextDecoder:nt.TextDecoder,f=new u("utf-8"),l={type:o[0],bucket:"",key:"",apiKey:""};let c=4;return l.bucket=f.decode(o.slice(c,c+e)),c=c+e,l.key=f.decode(o.slice(c,c+n)),c=c+n,l.apiKey=f.decode(o.slice(c,c+a)),l}class ni{constructor(e){this.connected=!1,this.id=void 0,this.enablePing=!1,this.requestID=0,this.events=[],this.binaryEvents=[],this.sendValues=!1,this.ws=void 0,this.eventsReceived=0,this.skipReconnect=!1,this.requests=[],this.requestTimer=void 0,this.reconnectTimer=void 0,this.pingTimer=void 0,this.pingInterval=5e3,this.settings=e,this.enablePing=!!e.enablePing,this.pingInterval=e.pingInterval||this.pingInterval;var n=e.secure?"wss://":"ws://";this.apiKey=e.apiKey;const a=e.wsSubDomain?e.wsSubDomain+".":"",u=n+a+e.host+":"+e.port+e.path+"?id="+e.clientId+"&apiKey="+(e.apiKey||"");this.wsStart(u),this.checkRequestTimeouts()}async request(e){e.key||(e.key="");const n=e.bucket||this.settings.bucket||"",a=e.method||"GET";if(a==="GET"&&e.key==="")return this.list(n,e.keysOnly,e.filter);if(a==="GET")return this.read(n,e.key);if(a==="POST"||a==="PUT")return this.write(n,e.key,e.data,e.failIfExists,e.expire);if(a==="DELETE")return this.delete(n,e.key);if(a==="PATCH")return this.patch(n,e.key,e.data,e.removeDataFromReply);if(a==="EVENT")return this.signalEvent(n,e.key,e.data)}async read(e,n){return new Promise((a,u)=>{this.addRequest({op:"read",bucket:e,key:n},function(f,l){f?u(new Error("Cachearoo ws READ error: "+JSON.stringify(f)+" for bucket: "+e+", key: "+n)):a(l)})})}async list(e,n,a){return new Promise((u,f)=>{this.addRequest({op:"filter",bucket:e,keysOnly:n,filter:a},function(l,c){l?f(new Error("Cachearoo ws FILTER error: "+JSON.stringify(l)+" for bucket: "+e)):u(c)})})}async write(e,n,a,u,f){return new Promise((l,c)=>{this.addRequest({op:"write",bucket:e,key:n,value:a,failIfExists:u,expire:f},function(m,E){if(m){const w=m.alreadyExists?new nr(`Key ${n} already exists`):new Error("Cachearoo ws WRITE error: "+JSON.stringify(m)+" for bucket: "+e+", key: "+n);c(w)}else l(E)})})}async patch(e,n,a,u){return new Promise((f,l)=>{this.addRequest({op:"patch",bucket:e,key:n,patch:a,removeDataFromReply:u},function(c,m){c?l(new Error("Cachearoo ws PATCH error: "+JSON.stringify(c)+" for bucket: "+e+", key: "+n)):f(m)})})}async delete(e,n){return new Promise((a,u)=>{this.addRequest({op:"remove",bucket:e,key:n},function(f){f?u(new Error("Cachearoo ws REMOVE error: "+JSON.stringify(f)+" for bucket: "+e+", key: "+n)):a()})})}async signalEvent(e,n,a){var u={bucket:e,key:n,value:a};return this.connected&&this.ws?(this.ws.send(JSON.stringify({msg:"event-broadcast",apiKey:this.apiKey,event:u})),Promise.resolve()):Promise.reject(new Error("Cannot call SignalEvent when disconnected"))}async signalEventBinary(e,n,a,u){const f={type:e,bucket:n,key:a,apiKey:this.apiKey||""},l=ti(f);this.connected&&this.ws&&this.ws.send(It.Buffer.concat([l,u]))}close(){this.events=[],this.skipReconnect=!0,this.connected=!1,this.ws&&this.ws.close&&this.ws.close(),this.ws=void 0,clearTimeout(this.reconnectTimer),clearInterval(this.pingTimer),clearTimeout(this.requestTimer)}addListenerBinary(e,n,a){if(a==null||typeof a!="function")throw"Callback is not a function";this.binaryEvents.push({bucket:e,key:n,callback:a}),this.registerEvents()}addListener(e,n,a,u){if(u==null||typeof u!="function")throw"Callback is not a function";a&&(this.sendValues=!0),this.events.push({bucket:e,key:n,callback:u}),this.registerEvents()}removeListener(e){this.events=this.events.filter(n=>n.callback!==e),this.binaryEvents=this.binaryEvents.filter(n=>n.callback!==e),this.registerEvents()}removeAllListeners(){this.events=[],this.binaryEvents=[]}addRequest(e,n){this.requestID=this.requestID+1,this.requests[this.requestID]={timeStamp:new Date,callback:n},e.id=this.requestID+"",this.connected&&this.ws&&this.ws.send(JSON.stringify({msg:"datastore-operation",apiKey:this.apiKey,request:e}))}handleReponse(e){this.requests[e.id]&&(this.requests[e.id].callback(e.error,e.value||e.location),this.requests[e.id]=null)}checkRequestTimeouts(){this.requestTimer=setTimeout(()=>{for(var e in this.requests){var n=this.requests[e+""];if(n){var a=new Date().getTime();a-this.requests[e].timeStamp>ei&&(n.callback("Timeout occured for request "+n.id),this.requests[e]=null)}}this.skipReconnect||this.checkRequestTimeouts()},1e3)}registerEvents(){var f;if(this.connected){var e=[],n=[];const l=[...this.events,...this.binaryEvents];for(var a=0;a<l.length;a++){var u=JSON.stringify(l[a]);e[u]||(n.push({bucket:l[a].bucket,key:l[a].key}),e[u]=!0)}(f=this.ws)==null||f.send(JSON.stringify({msg:"register-events",events:n,sendValues:this.sendValues,apiKey:this.apiKey}))}}processBinaryMessage(e){if(e.byteLength<128)return console.error("Binary data without header");const n=ri(new Uint8Array(e));for(var a=0;a<this.binaryEvents.length;a++)(this.binaryEvents[a].bucket==="*"||this.binaryEvents[a].bucket==n.bucket)&&(this.binaryEvents[a].key==="*"||this.binaryEvents[a].key==n.key)&&this.binaryEvents[a].callback({type:n.type,bucket:n.bucket,key:n.key,content:e.slice(128)})}processStringMessage(e){var n=JSON.parse(e);if(n.id){this.id=n.id,typeof this.onConnect=="function"&&this.onConnect(this);return}if(n.response){this.handleReponse(n.response);return}if(n.pong){typeof this.onPong=="function"&&this.onPong();return}this.eventsReceived++;var a=typeof n.value<"u"&&typeof n.isDeleted>"u"?n.value:null,u={bucket:n.bucket,key:n.key,value:a,isDeleted:void 0};n.isDeleted&&(u.isDeleted=!0);for(var f=0;f<this.events.length;f++)(this.events[f].bucket==="*"||this.events[f].bucket==u.bucket)&&(this.events[f].key==="*"||this.events[f].key==u.key)&&this.events[f].callback(u)}wsStart(e){this.skipReconnect=!1,this.connected=!1,this.pingTimer&&clearInterval(this.pingTimer),this.ws&&this.ws.close&&this.ws.close(),this.ws=new Zn.w3cwebsocket(e,"",void 0,void 0,void 0,{maxReceivedMessageSize:134217728}),this.ws.binaryType="arraybuffer",this.enablePing&&(this.pingTimer=setInterval(()=>{this.ws!=null&&this.connected&&this.ws.send(JSON.stringify({msg:"ping"}))},this.pingInterval)),this.ws.onerror=n=>{typeof this.onError=="function"&&this.onError(n)},this.ws.onmessage=n=>{typeof n.data=="string"?this.processStringMessage(n.data):this.processBinaryMessage(n.data)},this.ws.onclose=()=>{this.connected&&(this.connected=!1,typeof this.onDisconnect=="function"&&this.onDisconnect(this)),this.skipReconnect||(this.reconnectTimer=setTimeout(()=>{this.skipReconnect||this.wsStart(e)},3e3))},this.ws.onopen=()=>{this.connected=!0,this.registerEvents()}}}const ii=Lr.fetch,oi=4300,Ke=200,si=404,tr=201,ai=304,ui=50;class rr extends Error{constructor(e,n){super(e),Error.captureStackTrace(this,this.constructor),this.progressTimeout=n}}class nr extends Error{constructor(e){super(e),this.name="AlreadyExistsError",Error.captureStackTrace(this,this.constructor)}}function ir(){function o(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()}class Tt{constructor(){this.bucket=void 0,this.host=void 0,this.port=void 0,this.path="",this.apiKey=void 0,this.secure=!1,this.enablePing=!1,this.pingInterval=5e3,this.clientId=void 0,this.wsSubDomain=void 0}}class je{constructor(e){this.bucket=void 0,this.data=void 0,this.failIfExists=!1,this.expire=void 0,this.async=!0,this.forceHttp=!1,this.keysOnly=!1,this.filter=void 0,this.removeDataFromReply=!1,e&&(this.bucket=e.bucket,this.data=e.data,this.failIfExists=e.failIfExists,this.expire=e.expire,this.async=e.async,this.forceHttp=e.forceHttp,this.keysOnly=e.keysOnly,this.filter=e.filter,this.removeDataFromReply=e.removeDataFromReply)}}class ci extends je{constructor(){super(...arguments),this.url=void 0,this.method=void 0,this.key=void 0,this.forceHttp=!1,this.keysOnly=!1,this.filter=void 0,this.removeDataFromReply=!1,this.isList=!1}}class or{constructor(e){this.pendingRequests=0,e==null&&(e=new Tt),e.host=e.host||"127.0.0.1",e.port=e.port||oi,typeof e.path!="string"&&(e.path=""),e.path!==""&&e.path.charAt(0)!=="/"&&(e.path="/"+e.path),e.path.charAt(e.path.length-1)!=="/"&&(e.path=e.path+"/"),this.settings=e,this.connection=new ni(e),this.requestQueue=[]}internalizeRequestOptions(e,n,a=!1){var u=n.bucket||this.settings.bucket||"";n.async==null&&(n.async=!0);var f=new ci(null);return n.keysOnly!==void 0&&(f.keysOnly=n.keysOnly),n.filter!==void 0&&(f.filter=n.filter),f.url=this.getUrl(e,u,f.keysOnly,f.filter,a),f.bucket=u,f.key=e,f.async=n.async,f.failIfExists=n.failIfExists,f.forceHttp=n.forceHttp,f.expire=n.expire,f.isList=a,f.removeDataFromReply=n.removeDataFromReply,f}checkOptions(e){return e instanceof je||(e=new je(e)),e}async read(e,n){let a=this.internalizeRequestOptions(e,this.checkOptions(n));return a.method="GET",this.request(a)}async list(e){let n={...e};n.keysOnly===void 0&&(n.keysOnly=!0);let a=this.internalizeRequestOptions("",this.checkOptions(n),!0);return a.method="GET",await this.request(a)}async write(e,n,a){let u=this.internalizeRequestOptions(e,this.checkOptions(a));return u.method=u.key?"PUT":"POST",u.data=n,this.request(u)}async patch(e,n,a){let u=this.internalizeRequestOptions(e,this.checkOptions(a));return u.method="PATCH",u.data=n,this.request(u)}async remove(e,n){let a=this.internalizeRequestOptions(e,this.checkOptions(n));return a.method="DELETE",this.request(a)}async repair(e){var n=this.settings.secure?"https://":"http://",a=n+this.settings.host+":"+this.settings.port+this.settings.path+"_repair/"+e;const u={url:a,method:"GET"};return await this.requestHttp(u)}getUrl(e,n,a,u,f=!1){e||(e="");var l="d="+new Date().getTime();l=(e.indexOf("?")>-1?"&":"?")+l,a&&(l=l+"&keysOnly=true"),u!=null&&u!==""&&(l=l+"&filter="+u);var c=this.settings.secure?"https://":"http://";return f?c+this.settings.host+":"+this.settings.port+this.settings.path+"_data/"+encodeURIComponent(n)+l:c+this.settings.host+":"+this.settings.port+this.settings.path+"_data/"+encodeURIComponent(n)+"/"+encodeURIComponent(e)+l}async requestHttp(e){const n=e.method||"GET";let a={method:n,headers:{},body:void 0};this.settings.apiKey&&(a.headers["API-Key"]=this.settings.apiKey,a.headers["x-api-key"]=this.settings.apiKey),(n=="PUT"||n=="POST"||n=="PATCH")&&(a.body=JSON.stringify(e.data),a.headers["Content-Type"]="application/json",e.failIfExists&&(a.headers.failIfExists=e.failIfExists),e.removeDataFromReply&&(a.headers.RemoveDataFromReply=e.removeDataFromReply),e.expire&&(a.headers.expire=e.expire));const u=await ii(e.url,a);if((n==="GET"||n==="PATCH")&&[Ke,ai].indexOf(u.status)>-1)return await u.json();if(["POST","PUT"].indexOf(n)>-1&&[Ke,tr].indexOf(u.status)>-1){let f=e.key;return u.status===tr&&(f=u.headers.location),f}else{if(n==="DELETE"&&[Ke,si].indexOf(u.status)>-1)return;if(u.status==Ke)return;throw new Error(`${u.status}`)}}async request(e){var n,a,u=new Promise(function(l,c){n=l,a=c});e.async===void 0&&(e.async=!0);var f={resolve:n,reject:a,options:e};return setTimeout(()=>{this.requestQueue.unshift(f),this.processRequestQueue()}),u}processRequestQueue(){if(this.pendingRequests>=ui||this.requestQueue.length===0)return;const e=this.requestQueue.pop();this.pendingRequests++;var n;this.connection&&e.options.async&&this.connection.connected&&!e.options.forceHttp?n=this.connection.request(e.options):n=this.requestHttp(e.options),n.then(a=>{this.pendingRequests--,e.resolve(a),setTimeout(this.processRequestQueue.bind(this))}).catch(a=>{this.pendingRequests--,e.reject(a),setTimeout(this.processRequestQueue.bind(this))})}close(){this.connection.close()}}var Ot={exports:{}},Fe=typeof Reflect=="object"?Reflect:null,sr=Fe&&typeof Fe.apply=="function"?Fe.apply:function(e,n,a){return Function.prototype.apply.call(e,n,a)},Qe;Fe&&typeof Fe.ownKeys=="function"?Qe=Fe.ownKeys:Object.getOwnPropertySymbols?Qe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Qe=function(e){return Object.getOwnPropertyNames(e)};function fi(o){console&&console.warn&&console.warn(o)}var ar=Number.isNaN||function(e){return e!==e};function P(){P.init.call(this)}Ot.exports=P,Ot.exports.once=yi,P.EventEmitter=P,P.prototype._events=void 0,P.prototype._eventsCount=0,P.prototype._maxListeners=void 0;var ur=10;function Ve(o){if(typeof o!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof o)}Object.defineProperty(P,"defaultMaxListeners",{enumerable:!0,get:function(){return ur},set:function(o){if(typeof o!="number"||o<0||ar(o))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+o+".");ur=o}}),P.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},P.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ar(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function cr(o){return o._maxListeners===void 0?P.defaultMaxListeners:o._maxListeners}P.prototype.getMaxListeners=function(){return cr(this)},P.prototype.emit=function(e){for(var n=[],a=1;a<arguments.length;a++)n.push(arguments[a]);var u=e==="error",f=this._events;if(f!==void 0)u=u&&f.error===void 0;else if(!u)return!1;if(u){var l;if(n.length>0&&(l=n[0]),l instanceof Error)throw l;var c=new Error("Unhandled error."+(l?" ("+l.message+")":""));throw c.context=l,c}var m=f[e];if(m===void 0)return!1;if(typeof m=="function")sr(m,this,n);else for(var E=m.length,w=yr(m,E),a=0;a<E;++a)sr(w[a],this,n);return!0};function fr(o,e,n,a){var u,f,l;if(Ve(n),f=o._events,f===void 0?(f=o._events=Object.create(null),o._eventsCount=0):(f.newListener!==void 0&&(o.emit("newListener",e,n.listener?n.listener:n),f=o._events),l=f[e]),l===void 0)l=f[e]=n,++o._eventsCount;else if(typeof l=="function"?l=f[e]=a?[n,l]:[l,n]:a?l.unshift(n):l.push(n),u=cr(o),u>0&&l.length>u&&!l.warned){l.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=o,c.type=e,c.count=l.length,fi(c)}return o}P.prototype.addListener=function(e,n){return fr(this,e,n,!1)},P.prototype.on=P.prototype.addListener,P.prototype.prependListener=function(e,n){return fr(this,e,n,!0)};function li(){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 lr(o,e,n){var a={fired:!1,wrapFn:void 0,target:o,type:e,listener:n},u=li.bind(a);return u.listener=n,a.wrapFn=u,u}P.prototype.once=function(e,n){return Ve(n),this.on(e,lr(this,e,n)),this},P.prototype.prependOnceListener=function(e,n){return Ve(n),this.prependListener(e,lr(this,e,n)),this},P.prototype.removeListener=function(e,n){var a,u,f,l,c;if(Ve(n),u=this._events,u===void 0)return this;if(a=u[e],a===void 0)return this;if(a===n||a.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete u[e],u.removeListener&&this.emit("removeListener",e,a.listener||n));else if(typeof a!="function"){for(f=-1,l=a.length-1;l>=0;l--)if(a[l]===n||a[l].listener===n){c=a[l].listener,f=l;break}if(f<0)return this;f===0?a.shift():pi(a,f),a.length===1&&(u[e]=a[0]),u.removeListener!==void 0&&this.emit("removeListener",e,c||n)}return this},P.prototype.off=P.prototype.removeListener,P.prototype.removeAllListeners=function(e){var n,a,u;if(a=this._events,a===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete a[e]),this;if(arguments.length===0){var f=Object.keys(a),l;for(u=0;u<f.length;++u)l=f[u],l!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=a[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(u=n.length-1;u>=0;u--)this.removeListener(e,n[u]);return this};function pr(o,e,n){var a=o._events;if(a===void 0)return[];var u=a[e];return u===void 0?[]:typeof u=="function"?n?[u.listener||u]:[u]:n?hi(u):yr(u,u.length)}P.prototype.listeners=function(e){return pr(this,e,!0)},P.prototype.rawListeners=function(e){return pr(this,e,!1)},P.listenerCount=function(o,e){return typeof o.listenerCount=="function"?o.listenerCount(e):hr.call(o,e)},P.prototype.listenerCount=hr;function hr(o){var e=this._events;if(e!==void 0){var n=e[o];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}P.prototype.eventNames=function(){return this._eventsCount>0?Qe(this._events):[]};function yr(o,e){for(var n=new Array(e),a=0;a<e;++a)n[a]=o[a];return n}function pi(o,e){for(;e+1<o.length;e++)o[e]=o[e+1];o.pop()}function hi(o){for(var e=new Array(o.length),n=0;n<e.length;++n)e[n]=o[n].listener||o[n];return e}function yi(o,e){return new Promise(function(n,a){function u(l){o.removeListener(e,f),a(l)}function f(){typeof o.removeListener=="function"&&o.removeListener("error",u),n([].slice.call(arguments))}dr(o,e,f,{once:!0}),e!=="error"&&di(o,u,{once:!0})})}function di(o,e,n){typeof o.on=="function"&&dr(o,"error",e,n)}function dr(o,e,n,a){if(typeof o.on=="function")a.once?o.once(e,n):o.on(e,n);else if(typeof o.addEventListener=="function")o.addEventListener(e,function u(f){a.once&&o.removeEventListener(e,u),n(f)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof o)}var gi=Ot.exports;const Xe="messaging.compcon",vi=1e4,mi=1e4,wi=20,gr=100,vr=200;class bi{constructor(e){const n=new Date().valueOf();this.lastProgress=void 0,this.publishTime=n,this.callback=e}}async function Ei(o){o!==0&&await new Promise(e=>{setTimeout(()=>e(null),o)})}class Ai{constructor(e,n,a,u){this.pendingJobs=new Map,this.jobQueue=Xe+"."+n+".jobs",this.statusQueue=Xe+"."+n+".status",this.timeout=a||vi,this.progressTimeout=u||mi,this.de=e,this.jobStatusQueueListener=f=>{if(this.pendingJobs.has(f.key)){const l=this.pendingJobs.get(f.key);l.lastProgress=new Date().valueOf(),l.callback(f.value.err,f),f.value.done&&this.pendingJobs.delete(f.key)}},e.connection.addListener(this.statusQueue,"*",!0,this.jobStatusQueueListener)}destroy(){this.de.connection&&this.de.connection.removeListener(this.jobStatusQueueListener)}async addJob(e,n,a,u){a=a||this.timeout,u=u||this.progressTimeout;const f=ir();return await this.de.connection.write(this.jobQueue,f,e),new Promise((l,c)=>{const m=setInterval(()=>{const E=new Date().valueOf();let w=!1;this.pendingJobs[f].lastProgress!=null&&(w=E>this.pendingJobs[f].lastProgress+u);const O=E>this.pendingJobs[f].publishTime+a;(w||O)&&(this.pendingJobs[f]=null,clearInterval(m),c(new rr(`Timeout for job id ${f}`,w)))},500);this.pendingJobs[f]=new bi((E,w)=>{E?(clearInterval(m),c(new Error(E))):w.value.done?(clearInterval(m),l(w.value),this.de.connection.delete(this.statusQueue,w.key)):typeof n=="function"&&n(w.value)})})}}class Si extends gi.EventEmitter{constructor(e,n,a){super(),this.jobCount=0,this.statusQueue=Xe+"."+n+".status",this.jobQueue=Xe+"."+n+".jobs",this.de=e,this.clientId=a,this.jobQueueListener=u=>{u.isDeleted||u.value==null||this.jobHandler(u.key,u.value).catch(()=>this.emit("job",{id:u.value.id,status:"No worker"}))},e.connection.addListener(this.jobQueue,"*",!0,this.jobQueueListener)}destroy(){this.de.connection.removeListener(this.jobQueueListener),this.removeAllListeners()}async jobHandler(e,n){this.emit("job",{id:n.id,status:"Job received"}),await Ei(Math.floor(Math.random()*wi));const a=await this.waitForWorker(n);try{const u={claim:{id:this.clientId},done:!1,err:null,data:null,progress:null};await this.de.connection.write(this.statusQueue,e,u,!0),await this.de.connection.delete(this.jobQueue,e),this.jobCount+=1,a.work&&await a.work(n,async(f,l)=>{this.jobCount-=1,f instanceof Error&&(f=f.message),this.emit("job",{id:n.id,done:!0,data:l}),await this.de.connection.write(this.statusQueue,e,{...u,err:f,data:l,done:!0})},f=>{this.emit("job",{id:n.id,done:!1,progress:f}),this.de.connection.write(this.statusQueue,e,{...u,progress:f})})}catch(u){if(a.release(),!(u instanceof nr))throw u}}async waitForWorker(e){return new Promise((n,a)=>{var u=setInterval(()=>{this.onJobQuery!=null&&this.onJobQuery(e,(f,l)=>{if(f==null){clearInterval(u),this.emit("job",{id:e.id,status:"Worker assigned"}),n(l);return}else f==gr?(clearInterval(u),this.emit("job",{id:e.id,error:"Not supported"}),a(new Error("Job not supported"))):f==vr||(clearInterval(u),this.emit("job",{id:e.id,errno:f}),a(new Error(`Error no : ${f}`)))})},100)})}}const mr="#reqrep/",wr="#reqrep-progress/";class Ti{constructor(e,n){const a=new Date().valueOf();this.lastProgress=a,this.requestTime=a,this.reply=e,this.progress=n}}class br{constructor(e,n,a,u){this.pendingRequests=new Map,this.timeout=a||5e3,this.progressTimeout=u||5e3,this.channel=mr+n,this.progressChannel=wr+n,this.de=e,this.progressListener=f=>{const l=this.pendingRequests[f.key];l&&(l.lastProgress=new Date().valueOf(),typeof l.progress=="function"&&l.progress(f.value.data))},this.replyListener=f=>{this.pendingRequests[f.key]&&(this.pendingRequests[f.key].reply(f.value.err,f.value.data),this.pendingRequests[f.key]=null)},e.connection.addListener(this.channel,"*",!0,this.replyListener),e.connection.addListener(this.progressChannel,"*",!0,this.progressListener)}destroy(){this.de.connection.removeListener(this.progressListener),this.de.connection.removeListener(this.replyListener)}async request(e,n,a,u){return a=a||this.timeout,u=u||this.progressTimeout,new Promise((f,l)=>{var c=ir();this.de.connection.signalEvent(this.channel,c,e);const m=setInterval(()=>{const E=new Date().valueOf(),w=E>this.pendingRequests[c].lastProgress+u,O=E>this.pendingRequests[c].requestTime+a;(w||O)&&(this.pendingRequests[c]=null,clearInterval(m),l(new rr(`Timeout in request id ${c}`,w)))},500);this.pendingRequests[c]=new Ti((E,w)=>{clearInterval(m),E?l(new Error(E)):f(w)},n)})}}class Er{constructor(e,n){this.channel=mr+n,this.progressChannel=wr+n,this.de=e,this.requestListener=a=>{this.onMessage!==void 0&&this.onMessage(a.value,(u,f)=>{if(this.de.connection.connected){const l=u instanceof Error?u.message:u;this.de.connection.signalEvent(this.channel,a.key,{err:l,data:f})}},u=>{this.de.connection.connected&&this.de.connection.signalEvent(this.progressChannel,a.key,{data:u})})},e.connection.addListener(this.channel,"*",!0,this.requestListener)}destroy(){this.de.connection.removeListener(this.requestListener)}}return K.Messaging=void 0,(o=>{o.RequestReply={Requestor:br,Replier:Er},o.CompetingConsumers={CompetingConsumer:Si,Producer:Ai},o.Errors={JOB_NOT_SUPPORTED:gr,NO_WORKER_AVAILABLE:vr}})(K.Messaging||(K.Messaging={})),typeof window<"u"&&window&&(window.Cachearoo={Cachearoo:or,CachearooSettings:Tt,RequestOptions:je,Messaging:K.Messaging}),K.Cachearoo=or,K.CachearooSettings=Tt,K.Replier=Er,K.RequestOptions=je,K.Requestor=br,Object.defineProperty(K,Symbol.toStringTag,{value:"Module"}),K}({});
15
+ `)+" "+g[1]:g[0]+y+" "+h.join(", ")+" "+g[1]}i.types=Ct;function Ie(h){return Array.isArray(h)}i.isArray=Ie;function se(h){return typeof h=="boolean"}i.isBoolean=se;function ce(h){return h===null}i.isNull=ce;function xe(h){return h==null}i.isNullOrUndefined=xe;function ke(h){return typeof h=="number"}i.isNumber=ke;function J(h){return typeof h=="string"}i.isString=J;function Re(h){return typeof h=="symbol"}i.isSymbol=Re;function H(h){return h===void 0}i.isUndefined=H;function ae(h){return re(h)&&V(h)==="[object RegExp]"}i.isRegExp=ae,i.types.isRegExp=ae;function re(h){return typeof h=="object"&&h!==null}i.isObject=re;function fe(h){return re(h)&&V(h)==="[object Date]"}i.isDate=fe,i.types.isDate=fe;function ue(h){return re(h)&&(V(h)==="[object Error]"||h instanceof Error)}i.isError=ue,i.types.isNativeError=ue;function Q(h){return typeof h=="function"}i.isFunction=Q;function Ue(h){return h===null||typeof h=="boolean"||typeof h=="number"||typeof h=="string"||typeof h=="symbol"||typeof h>"u"}i.isPrimitive=Ue,i.isBuffer=Qn;function V(h){return Object.prototype.toString.call(h)}function le(h){return h<10?"0"+h.toString(10):h.toString(10)}var pe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Ce(){var h=new Date,y=[le(h.getHours()),le(h.getMinutes()),le(h.getSeconds())].join(":");return[h.getDate(),pe[h.getMonth()],y].join(" ")}i.log=function(){console.log("%s - %s",Ce(),i.format.apply(i,arguments))},i.inherits=Vn,i._extend=function(h,y){if(!y||!re(y))return h;for(var g=Object.keys(y),E=g.length;E--;)h[g[E]]=y[g[E]];return h};function he(h,y){return Object.prototype.hasOwnProperty.call(h,y)}var X=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;i.promisify=function(y){if(typeof y!="function")throw new TypeError('The "original" argument must be of type Function');if(X&&y[X]){var g=y[X];if(typeof g!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(g,X,{value:g,enumerable:!1,writable:!1,configurable:!0}),g}function g(){for(var E,F,x=new Promise(function(k,N){E=k,F=N}),A=[],T=0;T<arguments.length;T++)A.push(arguments[T]);A.push(function(k,N){k?F(k):E(N)});try{y.apply(this,A)}catch(k){F(k)}return x}return Object.setPrototypeOf(g,Object.getPrototypeOf(y)),X&&Object.defineProperty(g,X,{value:g,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(g,e(y))},i.promisify.custom=X;function ye(h,y){if(!h){var g=new Error("Promise was rejected with a falsy value");g.reason=h,h=g}return y(h)}function U(h){if(typeof h!="function")throw new TypeError('The "original" argument must be of type Function');function y(){for(var g=[],E=0;E<arguments.length;E++)g.push(arguments[E]);var F=g.pop();if(typeof F!="function")throw new TypeError("The last argument must be of type Function");var x=this,A=function(){return F.apply(x,arguments)};h.apply(this,g).then(function(T){te.nextTick(A.bind(null,null,T))},function(T){te.nextTick(ye.bind(null,T,A))})}return Object.setPrototypeOf(y,Object.getPrototypeOf(h)),Object.defineProperties(y,e(h)),y}i.callbackify=U})(nt);var St,rr;function Xn(){if(rr)return St;rr=1;var i=function(){if(typeof self=="object"&&self)return self;if(typeof window=="object"&&window)return window;throw new Error("Unable to resolve global `this`")};return St=function(){if(this)return this;if(typeof globalThis=="object"&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch{return i()}try{return __global__||i()}finally{delete Object.prototype.__global__}}(),St}var Yn={_from:"websocket@^1.0.30",_id:"websocket@1.0.34",_inBundle:!1,_integrity:"sha512-PRDso2sGwF6kM75QykIesBijKSVceR6jL2G8NGYyq2XrItNC2P5/qL5XeR056GhA+Ly7JMFvJb9I312mJfmqnQ==",_location:"/websocket",_phantomChildren:{},_requested:{type:"range",registry:!0,raw:"websocket@^1.0.30",name:"websocket",escapedName:"websocket",rawSpec:"^1.0.30",saveSpec:null,fetchSpec:"^1.0.30"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/websocket/-/websocket-1.0.34.tgz",_shasum:"2bdc2602c08bf2c82253b730655c0ef7dcab3111",_spec:"websocket@^1.0.30",_where:"/Users/peter/dev/cachearoo-js",author:{name:"Brian McKelvey",email:"theturtle32@gmail.com",url:"https://github.com/theturtle32"},browser:"lib/browser.js",bugs:{url:"https://github.com/theturtle32/WebSocket-Node/issues"},bundleDependencies:!1,config:{verbose:!1},contributors:[{name:"Iñaki Baz Castillo",email:"ibc@aliax.net",url:"http://dev.sipdoc.net"}],dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},deprecated:!1,description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4",jshint:"^2.0.0","jshint-stylish":"^2.2.1",tape:"^4.9.1"},directories:{lib:"./lib"},engines:{node:">=4.0.0"},homepage:"https://github.com/theturtle32/WebSocket-Node",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],license:"Apache-2.0",main:"index",name:"websocket",repository:{type:"git",url:"git+https://github.com/theturtle32/WebSocket-Node.git"},scripts:{gulp:"gulp",test:"tape test/unit/*.js"},version:"1.0.34"}.version,me;if(typeof globalThis=="object")me=globalThis;else try{me=Xn()}catch{}finally{if(!me&&typeof window<"u"&&(me=window),!me)throw new Error("Could not determine global this")}var _e=me.WebSocket||me.MozWebSocket,Zn=Yn;function nr(i,e){var n;return e?n=new _e(i,e):n=new _e(i),n}_e&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(i){Object.defineProperty(nr,i,{get:function(){return _e[i]}})});var ei={w3cwebsocket:_e?nr:null,version:Zn};const ti=3e3;function ri(i){const e=new Uint8Array(128);let n=0;const a=typeof window<"u"?window.TextEncoder:nt.TextEncoder,u=new a,f=u.encode(i.bucket),l=u.encode(i.key),c=u.encode(i.apiKey);if(f.byteLength>36||l.byteLength>36||c.byteLength>36)throw new Error("Cannot write binary header, bucket/key/apiKey cannot exceed 36 bytes each");return e[0]=i.type,e[1]=f.byteLength,e[2]=l.byteLength,e[3]=c.byteLength,n=4,e.set(f,n),n+=e[1],e.set(l,n),n+=e[2],e.set(c,n),e}function ni(i){let e=i[1],n=i[2],a=i[3];const u=typeof window<"u"?window.TextDecoder:nt.TextDecoder,f=new u("utf-8"),l={type:i[0],bucket:"",key:"",apiKey:""};let c=4;return l.bucket=f.decode(i.slice(c,c+e)),c=c+e,l.key=f.decode(i.slice(c,c+n)),c=c+n,l.apiKey=f.decode(i.slice(c,c+a)),l}class ii{constructor(e){this.connected=!1,this.id=void 0,this.enablePing=!1,this.requestID=0,this.events=[],this.binaryEvents=[],this.sendValues=!1,this.ws=void 0,this.eventsReceived=0,this.skipReconnect=!1,this.requests=[],this.requestTimer=void 0,this.reconnectTimer=void 0,this.pingTimer=void 0,this.pingInterval=5e3,this.settings=e,this.enablePing=!!e.enablePing,this.pingInterval=e.pingInterval||this.pingInterval;var n=e.secure?"wss://":"ws://";this.apiKey=e.apiKey;const a=e.wsSubDomain?e.wsSubDomain+".":"",u=n+a+e.host+":"+e.port+e.path+"?id="+e.clientId+"&apiKey="+(e.apiKey||"");this.wsStart(u),this.checkRequestTimeouts()}async request(e){e.key||(e.key="");const n=e.bucket||this.settings.bucket||"",a=e.method||"GET";if(a==="GET"&&e.key==="")return this.list(n,e.keysOnly,e.filter);if(a==="GET")return this.read(n,e.key);if(a==="POST"||a==="PUT")return this.write(n,e.key,e.data,e.failIfExists,e.expire);if(a==="DELETE")return this.delete(n,e.key);if(a==="PATCH")return this.patch(n,e.key,e.data,e.removeDataFromReply);if(a==="EVENT")return this.signalEvent(n,e.key,e.data)}async read(e,n){return new Promise((a,u)=>{this.addRequest({op:"read",bucket:e,key:n},function(f,l){f?u(new Error("Cachearoo ws READ error: "+JSON.stringify(f)+" for bucket: "+e+", key: "+n)):a(l)})})}async list(e,n,a){return new Promise((u,f)=>{this.addRequest({op:"filter",bucket:e,keysOnly:n,filter:a},function(l,c){l?f(new Error("Cachearoo ws FILTER error: "+JSON.stringify(l)+" for bucket: "+e)):u(c)})})}async write(e,n,a,u,f){return new Promise((l,c)=>{this.addRequest({op:"write",bucket:e,key:n,value:a,failIfExists:u,expire:f},function(m,b){if(m){const w=m.alreadyExists?new Ot(`Key ${n} already exists`):new Error("Cachearoo ws WRITE error: "+JSON.stringify(m)+" for bucket: "+e+", key: "+n);c(w)}else l(b)})})}async patch(e,n,a,u){return new Promise((f,l)=>{this.addRequest({op:"patch",bucket:e,key:n,patch:a,removeDataFromReply:u},function(c,m){c?l(new Error("Cachearoo ws PATCH error: "+JSON.stringify(c)+" for bucket: "+e+", key: "+n)):f(m)})})}async delete(e,n){return new Promise((a,u)=>{this.addRequest({op:"remove",bucket:e,key:n},function(f){f?u(new Error("Cachearoo ws REMOVE error: "+JSON.stringify(f)+" for bucket: "+e+", key: "+n)):a()})})}async signalEvent(e,n,a){var u={bucket:e,key:n,value:a};return this.connected&&this.ws?(this.ws.send(JSON.stringify({msg:"event-broadcast",apiKey:this.apiKey,event:u})),Promise.resolve()):Promise.reject(new Error("Cannot call SignalEvent when disconnected"))}async signalEventBinary(e,n,a,u){const f={type:e,bucket:n,key:a,apiKey:this.apiKey||""},l=ri(f);this.connected&&this.ws&&this.ws.send(Rt.Buffer.concat([l,u]))}close(){this.events=[],this.skipReconnect=!0,this.connected=!1,this.ws&&this.ws.close&&this.ws.close(),this.ws=void 0,clearTimeout(this.reconnectTimer),clearInterval(this.pingTimer),clearTimeout(this.requestTimer)}addListenerBinary(e,n,a){if(a==null||typeof a!="function")throw"Callback is not a function";this.binaryEvents.push({bucket:e,key:n,callback:a}),this.registerEvents()}addListener(e,n,a,u){if(u==null||typeof u!="function")throw"Callback is not a function";a&&(this.sendValues=!0),this.events.push({bucket:e,key:n,callback:u}),this.registerEvents()}removeListener(e){this.events=this.events.filter(n=>n.callback!==e),this.binaryEvents=this.binaryEvents.filter(n=>n.callback!==e),this.registerEvents()}removeAllListeners(){this.events=[],this.binaryEvents=[]}addRequest(e,n){this.requestID=this.requestID+1,this.requests[this.requestID]={timeStamp:new Date,callback:n},e.id=this.requestID+"",this.connected&&this.ws&&this.ws.send(JSON.stringify({msg:"datastore-operation",apiKey:this.apiKey,request:e}))}handleReponse(e){this.requests[e.id]&&(this.requests[e.id].callback(e.error,e.value||e.location),this.requests[e.id]=null)}checkRequestTimeouts(){this.requestTimer=setTimeout(()=>{for(var e in this.requests){var n=this.requests[e+""];if(n){var a=new Date().getTime();a-this.requests[e].timeStamp>ti&&(n.callback("Timeout occured for request "+n.id),this.requests[e]=null)}}this.skipReconnect||this.checkRequestTimeouts()},1e3)}registerEvents(){var f;if(this.connected){var e=[],n=[];const l=[...this.events,...this.binaryEvents];for(var a=0;a<l.length;a++){var u=JSON.stringify(l[a]);e[u]||(n.push({bucket:l[a].bucket,key:l[a].key}),e[u]=!0)}(f=this.ws)==null||f.send(JSON.stringify({msg:"register-events",events:n,sendValues:this.sendValues,apiKey:this.apiKey}))}}processBinaryMessage(e){if(e.byteLength<128)return console.error("Binary data without header");const n=ni(new Uint8Array(e));for(var a=0;a<this.binaryEvents.length;a++)(this.binaryEvents[a].bucket==="*"||this.binaryEvents[a].bucket==n.bucket)&&(this.binaryEvents[a].key==="*"||this.binaryEvents[a].key==n.key)&&this.binaryEvents[a].callback({type:n.type,bucket:n.bucket,key:n.key,content:e.slice(128)})}processStringMessage(e){var n=JSON.parse(e);if(n.id){this.id=n.id,typeof this.onConnect=="function"&&this.onConnect(this);return}if(n.response){this.handleReponse(n.response);return}if(n.pong){typeof this.onPong=="function"&&this.onPong();return}this.eventsReceived++;var a=typeof n.value<"u"&&typeof n.isDeleted>"u"?n.value:null,u={bucket:n.bucket,key:n.key,value:a,isDeleted:void 0};n.isDeleted&&(u.isDeleted=!0);for(var f=0;f<this.events.length;f++)(this.events[f].bucket==="*"||this.events[f].bucket==u.bucket)&&(this.events[f].key==="*"||this.events[f].key==u.key)&&this.events[f].callback(u)}wsStart(e){this.skipReconnect=!1,this.connected=!1,this.pingTimer&&clearInterval(this.pingTimer),this.ws&&this.ws.close&&this.ws.close(),this.ws=new ei.w3cwebsocket(e,"",void 0,void 0,void 0,{maxReceivedMessageSize:134217728}),this.ws.binaryType="arraybuffer",this.enablePing&&(this.pingTimer=setInterval(()=>{this.ws!=null&&this.connected&&this.ws.send(JSON.stringify({msg:"ping"}))},this.pingInterval)),this.ws.onerror=n=>{typeof this.onError=="function"&&this.onError(n)},this.ws.onmessage=n=>{typeof n.data=="string"?this.processStringMessage(n.data):this.processBinaryMessage(n.data)},this.ws.onclose=()=>{this.connected&&(this.connected=!1,typeof this.onDisconnect=="function"&&this.onDisconnect(this)),this.skipReconnect||(this.reconnectTimer=setTimeout(()=>{this.skipReconnect||this.wsStart(e)},3e3))},this.ws.onopen=()=>{this.connected=!0,this.registerEvents()}}}const oi=Dr.fetch,si=4300,Ke=200,ai=404,ir=201,ui=304,ci=50;class Tt extends Error{constructor(e,n){super(e),Error.captureStackTrace(this,this.constructor),this.progressTimeout=n}}class Ot extends Error{constructor(e){super(e),this.name="AlreadyExistsError",Error.captureStackTrace(this,this.constructor)}}function fi(i){if(typeof i=="string")return i;if(i&&typeof i=="object"){if(typeof i.message=="string")return i.message;if(typeof i.msg=="string")return i.msg;try{return JSON.stringify(i)}catch{return String(i)}}return String(i)}class Ft extends Error{constructor(e){super(fi(e)),this.name="ReplyError",this.reply=e,Error.captureStackTrace(this,this.constructor)}}function or(){function i(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return i()+i()+"-"+i()+"-"+i()+"-"+i()+"-"+i()+i()+i()}class It{constructor(){this.bucket=void 0,this.host=void 0,this.port=void 0,this.path="",this.apiKey=void 0,this.secure=!1,this.enablePing=!1,this.pingInterval=5e3,this.clientId=void 0,this.wsSubDomain=void 0}}class je{constructor(e){this.bucket=void 0,this.data=void 0,this.failIfExists=!1,this.expire=void 0,this.async=!0,this.forceHttp=!1,this.keysOnly=!1,this.filter=void 0,this.removeDataFromReply=!1,e&&(this.bucket=e.bucket,this.data=e.data,this.failIfExists=e.failIfExists,this.expire=e.expire,this.async=e.async,this.forceHttp=e.forceHttp,this.keysOnly=e.keysOnly,this.filter=e.filter,this.removeDataFromReply=e.removeDataFromReply)}}class li extends je{constructor(){super(...arguments),this.url=void 0,this.method=void 0,this.key=void 0,this.forceHttp=!1,this.keysOnly=!1,this.filter=void 0,this.removeDataFromReply=!1,this.isList=!1}}class sr{constructor(e){this.pendingRequests=0,e==null&&(e=new It),e.host=e.host||"127.0.0.1",e.port=e.port||si,typeof e.path!="string"&&(e.path=""),e.path!==""&&e.path.charAt(0)!=="/"&&(e.path="/"+e.path),e.path.charAt(e.path.length-1)!=="/"&&(e.path=e.path+"/"),this.settings=e,this.connection=new ii(e),this.requestQueue=[]}internalizeRequestOptions(e,n,a=!1){var u=n.bucket||this.settings.bucket||"";n.async==null&&(n.async=!0);var f=new li(null);return n.keysOnly!==void 0&&(f.keysOnly=n.keysOnly),n.filter!==void 0&&(f.filter=n.filter),f.url=this.getUrl(e,u,f.keysOnly,f.filter,a),f.bucket=u,f.key=e,f.async=n.async,f.failIfExists=n.failIfExists,f.forceHttp=n.forceHttp,f.expire=n.expire,f.isList=a,f.removeDataFromReply=n.removeDataFromReply,f}checkOptions(e){return e instanceof je||(e=new je(e)),e}async read(e,n){let a=this.internalizeRequestOptions(e,this.checkOptions(n));return a.method="GET",this.request(a)}async list(e){let n={...e};n.keysOnly===void 0&&(n.keysOnly=!0);let a=this.internalizeRequestOptions("",this.checkOptions(n),!0);return a.method="GET",await this.request(a)}async write(e,n,a){let u=this.internalizeRequestOptions(e,this.checkOptions(a));return u.method=u.key?"PUT":"POST",u.data=n,this.request(u)}async patch(e,n,a){let u=this.internalizeRequestOptions(e,this.checkOptions(a));return u.method="PATCH",u.data=n,this.request(u)}async remove(e,n){let a=this.internalizeRequestOptions(e,this.checkOptions(n));return a.method="DELETE",this.request(a)}async repair(e){var n=this.settings.secure?"https://":"http://",a=n+this.settings.host+":"+this.settings.port+this.settings.path+"_repair/"+e;const u={url:a,method:"GET"};return await this.requestHttp(u)}getUrl(e,n,a,u,f=!1){e||(e="");var l="d="+new Date().getTime();l=(e.indexOf("?")>-1?"&":"?")+l,a&&(l=l+"&keysOnly=true"),u!=null&&u!==""&&(l=l+"&filter="+u);var c=this.settings.secure?"https://":"http://";return f?c+this.settings.host+":"+this.settings.port+this.settings.path+"_data/"+encodeURIComponent(n)+l:c+this.settings.host+":"+this.settings.port+this.settings.path+"_data/"+encodeURIComponent(n)+"/"+encodeURIComponent(e)+l}async requestHttp(e){const n=e.method||"GET";let a={method:n,headers:{},body:void 0};this.settings.apiKey&&(a.headers["API-Key"]=this.settings.apiKey,a.headers["x-api-key"]=this.settings.apiKey),(n=="PUT"||n=="POST"||n=="PATCH")&&(a.body=JSON.stringify(e.data),a.headers["Content-Type"]="application/json",e.failIfExists&&(a.headers.failIfExists=e.failIfExists),e.removeDataFromReply&&(a.headers.RemoveDataFromReply=e.removeDataFromReply),e.expire&&(a.headers.expire=e.expire));const u=await oi(e.url,a);if((n==="GET"||n==="PATCH")&&[Ke,ui].indexOf(u.status)>-1)return await u.json();if(["POST","PUT"].indexOf(n)>-1&&[Ke,ir].indexOf(u.status)>-1){let f=e.key;return u.status===ir&&(f=u.headers.location),f}else{if(n==="DELETE"&&[Ke,ai].indexOf(u.status)>-1)return;if(u.status==Ke)return;throw new Error(`${u.status}`)}}async request(e){var n,a,u=new Promise(function(l,c){n=l,a=c});e.async===void 0&&(e.async=!0);var f={resolve:n,reject:a,options:e};return setTimeout(()=>{this.requestQueue.unshift(f),this.processRequestQueue()}),u}processRequestQueue(){if(this.pendingRequests>=ci||this.requestQueue.length===0)return;const e=this.requestQueue.pop();this.pendingRequests++;var n;this.connection&&e.options.async&&this.connection.connected&&!e.options.forceHttp?n=this.connection.request(e.options):n=this.requestHttp(e.options),n.then(a=>{this.pendingRequests--,e.resolve(a),setTimeout(this.processRequestQueue.bind(this))}).catch(a=>{this.pendingRequests--,e.reject(a),setTimeout(this.processRequestQueue.bind(this))})}close(){this.connection.close()}}var xt={exports:{}},Fe=typeof Reflect=="object"?Reflect:null,ar=Fe&&typeof Fe.apply=="function"?Fe.apply:function(e,n,a){return Function.prototype.apply.call(e,n,a)},Qe;Fe&&typeof Fe.ownKeys=="function"?Qe=Fe.ownKeys:Object.getOwnPropertySymbols?Qe=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Qe=function(e){return Object.getOwnPropertyNames(e)};function pi(i){console&&console.warn&&console.warn(i)}var ur=Number.isNaN||function(e){return e!==e};function R(){R.init.call(this)}xt.exports=R,xt.exports.once=gi,R.EventEmitter=R,R.prototype._events=void 0,R.prototype._eventsCount=0,R.prototype._maxListeners=void 0;var cr=10;function Ve(i){if(typeof i!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof i)}Object.defineProperty(R,"defaultMaxListeners",{enumerable:!0,get:function(){return cr},set:function(i){if(typeof i!="number"||i<0||ur(i))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+i+".");cr=i}}),R.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},R.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ur(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function fr(i){return i._maxListeners===void 0?R.defaultMaxListeners:i._maxListeners}R.prototype.getMaxListeners=function(){return fr(this)},R.prototype.emit=function(e){for(var n=[],a=1;a<arguments.length;a++)n.push(arguments[a]);var u=e==="error",f=this._events;if(f!==void 0)u=u&&f.error===void 0;else if(!u)return!1;if(u){var l;if(n.length>0&&(l=n[0]),l instanceof Error)throw l;var c=new Error("Unhandled error."+(l?" ("+l.message+")":""));throw c.context=l,c}var m=f[e];if(m===void 0)return!1;if(typeof m=="function")ar(m,this,n);else for(var b=m.length,w=dr(m,b),a=0;a<b;++a)ar(w[a],this,n);return!0};function lr(i,e,n,a){var u,f,l;if(Ve(n),f=i._events,f===void 0?(f=i._events=Object.create(null),i._eventsCount=0):(f.newListener!==void 0&&(i.emit("newListener",e,n.listener?n.listener:n),f=i._events),l=f[e]),l===void 0)l=f[e]=n,++i._eventsCount;else if(typeof l=="function"?l=f[e]=a?[n,l]:[l,n]:a?l.unshift(n):l.push(n),u=fr(i),u>0&&l.length>u&&!l.warned){l.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=i,c.type=e,c.count=l.length,pi(c)}return i}R.prototype.addListener=function(e,n){return lr(this,e,n,!1)},R.prototype.on=R.prototype.addListener,R.prototype.prependListener=function(e,n){return lr(this,e,n,!0)};function hi(){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 pr(i,e,n){var a={fired:!1,wrapFn:void 0,target:i,type:e,listener:n},u=hi.bind(a);return u.listener=n,a.wrapFn=u,u}R.prototype.once=function(e,n){return Ve(n),this.on(e,pr(this,e,n)),this},R.prototype.prependOnceListener=function(e,n){return Ve(n),this.prependListener(e,pr(this,e,n)),this},R.prototype.removeListener=function(e,n){var a,u,f,l,c;if(Ve(n),u=this._events,u===void 0)return this;if(a=u[e],a===void 0)return this;if(a===n||a.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete u[e],u.removeListener&&this.emit("removeListener",e,a.listener||n));else if(typeof a!="function"){for(f=-1,l=a.length-1;l>=0;l--)if(a[l]===n||a[l].listener===n){c=a[l].listener,f=l;break}if(f<0)return this;f===0?a.shift():yi(a,f),a.length===1&&(u[e]=a[0]),u.removeListener!==void 0&&this.emit("removeListener",e,c||n)}return this},R.prototype.off=R.prototype.removeListener,R.prototype.removeAllListeners=function(e){var n,a,u;if(a=this._events,a===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete a[e]),this;if(arguments.length===0){var f=Object.keys(a),l;for(u=0;u<f.length;++u)l=f[u],l!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=a[e],typeof n=="function")this.removeListener(e,n);else if(n!==void 0)for(u=n.length-1;u>=0;u--)this.removeListener(e,n[u]);return this};function hr(i,e,n){var a=i._events;if(a===void 0)return[];var u=a[e];return u===void 0?[]:typeof u=="function"?n?[u.listener||u]:[u]:n?di(u):dr(u,u.length)}R.prototype.listeners=function(e){return hr(this,e,!0)},R.prototype.rawListeners=function(e){return hr(this,e,!1)},R.listenerCount=function(i,e){return typeof i.listenerCount=="function"?i.listenerCount(e):yr.call(i,e)},R.prototype.listenerCount=yr;function yr(i){var e=this._events;if(e!==void 0){var n=e[i];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}R.prototype.eventNames=function(){return this._eventsCount>0?Qe(this._events):[]};function dr(i,e){for(var n=new Array(e),a=0;a<e;++a)n[a]=i[a];return n}function yi(i,e){for(;e+1<i.length;e++)i[e]=i[e+1];i.pop()}function di(i){for(var e=new Array(i.length),n=0;n<e.length;++n)e[n]=i[n].listener||i[n];return e}function gi(i,e){return new Promise(function(n,a){function u(l){i.removeListener(e,f),a(l)}function f(){typeof i.removeListener=="function"&&i.removeListener("error",u),n([].slice.call(arguments))}gr(i,e,f,{once:!0}),e!=="error"&&vi(i,u,{once:!0})})}function vi(i,e,n){typeof i.on=="function"&&gr(i,"error",e,n)}function gr(i,e,n,a){if(typeof i.on=="function")a.once?i.once(e,n):i.on(e,n);else if(typeof i.addEventListener=="function")i.addEventListener(e,function u(f){a.once&&i.removeEventListener(e,u),n(f)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof i)}var mi=xt.exports;const Xe="messaging.compcon",wi=1e4,bi=1e4,Ei=20,vr=100,mr=200;class Ai{constructor(e){const n=new Date().valueOf();this.lastProgress=void 0,this.publishTime=n,this.callback=e}}async function Si(i){i!==0&&await new Promise(e=>{setTimeout(()=>e(null),i)})}class Ti{constructor(e,n,a,u){this.pendingJobs=new Map,this.jobQueue=Xe+"."+n+".jobs",this.statusQueue=Xe+"."+n+".status",this.timeout=a||wi,this.progressTimeout=u||bi,this.de=e,this.jobStatusQueueListener=f=>{if(this.pendingJobs.has(f.key)){const l=this.pendingJobs.get(f.key);l.lastProgress=new Date().valueOf(),l.callback(f.value.err,f),f.value.done&&this.pendingJobs.delete(f.key)}},e.connection.addListener(this.statusQueue,"*",!0,this.jobStatusQueueListener)}destroy(){this.de.connection&&this.de.connection.removeListener(this.jobStatusQueueListener)}async addJob(e,n,a,u){a=a||this.timeout,u=u||this.progressTimeout;const f=or();return await this.de.connection.write(this.jobQueue,f,e),new Promise((l,c)=>{const m=setInterval(()=>{const b=new Date().valueOf();let w=!1;this.pendingJobs[f].lastProgress!=null&&(w=b>this.pendingJobs[f].lastProgress+u);const O=b>this.pendingJobs[f].publishTime+a;(w||O)&&(this.pendingJobs[f]=null,clearInterval(m),c(new Tt(`Timeout for job id ${f}`,w)))},500);this.pendingJobs[f]=new Ai((b,w)=>{b?(clearInterval(m),c(new Ft(b))):w.value.done?(clearInterval(m),l(w.value),this.de.connection.delete(this.statusQueue,w.key)):typeof n=="function"&&n(w.value)})})}}class Oi extends mi.EventEmitter{constructor(e,n,a){super(),this.jobCount=0,this.statusQueue=Xe+"."+n+".status",this.jobQueue=Xe+"."+n+".jobs",this.de=e,this.clientId=a,this.jobQueueListener=u=>{u.isDeleted||u.value==null||this.jobHandler(u.key,u.value).catch(()=>this.emit("job",{id:u.value.id,status:"No worker"}))},e.connection.addListener(this.jobQueue,"*",!0,this.jobQueueListener)}destroy(){this.de.connection.removeListener(this.jobQueueListener),this.removeAllListeners()}async jobHandler(e,n){this.emit("job",{id:n.id,status:"Job received"}),await Si(Math.floor(Math.random()*Ei));const a=await this.waitForWorker(n);try{const u={claim:{id:this.clientId},done:!1,err:null,data:null,progress:null};await this.de.connection.write(this.statusQueue,e,u,!0),await this.de.connection.delete(this.jobQueue,e),this.jobCount+=1,a.work&&await a.work(n,async(f,l)=>{this.jobCount-=1,f instanceof Error&&(f=f.message),this.emit("job",{id:n.id,done:!0,data:l}),await this.de.connection.write(this.statusQueue,e,{...u,err:f,data:l,done:!0})},f=>{this.emit("job",{id:n.id,done:!1,progress:f}),this.de.connection.write(this.statusQueue,e,{...u,progress:f})})}catch(u){if(a.release(),!(u instanceof Ot))throw u}}async waitForWorker(e){return new Promise((n,a)=>{var u=setInterval(()=>{this.onJobQuery!=null&&this.onJobQuery(e,(f,l)=>{if(f==null){clearInterval(u),this.emit("job",{id:e.id,status:"Worker assigned"}),n(l);return}else f==vr?(clearInterval(u),this.emit("job",{id:e.id,error:"Not supported"}),a(new Error("Job not supported"))):f==mr||(clearInterval(u),this.emit("job",{id:e.id,errno:f}),a(new Error(`Error no : ${f}`)))})},100)})}}const wr="#reqrep/",br="#reqrep-progress/";class Fi{constructor(e,n){const a=new Date().valueOf();this.lastProgress=a,this.requestTime=a,this.reply=e,this.progress=n}}class Er{constructor(e,n,a,u){this.pendingRequests=new Map,this.timeout=a||5e3,this.progressTimeout=u||5e3,this.channel=wr+n,this.progressChannel=br+n,this.de=e,this.progressListener=f=>{const l=this.pendingRequests[f.key];l&&(l.lastProgress=new Date().valueOf(),typeof l.progress=="function"&&l.progress(f.value.data))},this.replyListener=f=>{this.pendingRequests[f.key]&&(this.pendingRequests[f.key].reply(f.value.err,f.value.data),this.pendingRequests[f.key]=null)},e.connection.addListener(this.channel,"*",!0,this.replyListener),e.connection.addListener(this.progressChannel,"*",!0,this.progressListener)}destroy(){this.de.connection.removeListener(this.progressListener),this.de.connection.removeListener(this.replyListener)}async request(e,n,a,u){return a=a||this.timeout,u=u||this.progressTimeout,new Promise((f,l)=>{var c=or();this.de.connection.signalEvent(this.channel,c,e).catch(b=>{this.pendingRequests[c]=null,clearInterval(m),l(b)});const m=setInterval(()=>{const b=new Date().valueOf(),w=b>this.pendingRequests[c].lastProgress+u,O=b>this.pendingRequests[c].requestTime+a;(w||O)&&(this.pendingRequests[c]=null,clearInterval(m),l(new Tt(`Timeout in request id ${c}`,w)))},500);this.pendingRequests[c]=new Fi((b,w)=>{clearInterval(m),b?l(new Ft(b)):f(w)},n)})}}class Ar{constructor(e,n){this.channel=wr+n,this.progressChannel=br+n,this.de=e,this.requestListener=a=>{this.onMessage!==void 0&&this.onMessage(a.value,(u,f)=>{if(this.de.connection.connected){const l=u instanceof Error?u.message:u;this.de.connection.signalEvent(this.channel,a.key,{err:l,data:f}).catch(()=>{})}},u=>{this.de.connection.connected&&this.de.connection.signalEvent(this.progressChannel,a.key,{data:u}).catch(()=>{})})},e.connection.addListener(this.channel,"*",!0,this.requestListener)}destroy(){this.de.connection.removeListener(this.requestListener)}}return G.Messaging=void 0,(i=>{i.RequestReply={Requestor:Er,Replier:Ar},i.CompetingConsumers={CompetingConsumer:Oi,Producer:Ti},i.Errors={JOB_NOT_SUPPORTED:vr,NO_WORKER_AVAILABLE:mr}})(G.Messaging||(G.Messaging={})),typeof window<"u"&&window&&(window.Cachearoo={Cachearoo:sr,CachearooSettings:It,RequestOptions:je,Messaging:G.Messaging}),G.AlreadyExistsError=Ot,G.Cachearoo=sr,G.CachearooSettings=It,G.Replier=Ar,G.ReplyError=Ft,G.RequestOptions=je,G.Requestor=Er,G.TimeoutError=Tt,Object.defineProperty(G,Symbol.toStringTag,{value:"Module"}),G}({});
@@ -6,6 +6,10 @@ export declare class TimeoutError extends Error {
6
6
  export declare class AlreadyExistsError extends Error {
7
7
  constructor(message: any);
8
8
  }
9
+ export declare class ReplyError extends Error {
10
+ readonly reply: any;
11
+ constructor(reply: any);
12
+ }
9
13
  export declare function generateUUID(): string;
10
14
  export interface ICachearooSettings {
11
15
  bucket?: string;
package/dist/libs/cro.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Cachearoo = exports.RequestOptionsInternal = exports.RequestOptions = exports.CachearooSettings = exports.generateUUID = exports.AlreadyExistsError = exports.TimeoutError = void 0;
3
+ exports.Cachearoo = exports.RequestOptionsInternal = exports.RequestOptions = exports.CachearooSettings = exports.generateUUID = exports.ReplyError = exports.AlreadyExistsError = exports.TimeoutError = void 0;
4
4
  const fetch = global.fetch;
5
5
  const cro_connection_1 = require("./cro.connection");
6
6
  const CACHEAROO_DEFAULT_PORT = 4300;
@@ -26,6 +26,33 @@ class AlreadyExistsError extends Error {
26
26
  }
27
27
  }
28
28
  exports.AlreadyExistsError = AlreadyExistsError;
29
+ function formatReplyMessage(reply) {
30
+ if (typeof reply === 'string')
31
+ return reply;
32
+ if (reply && typeof reply === 'object') {
33
+ if (typeof reply.message === 'string')
34
+ return reply.message;
35
+ if (typeof reply.msg === 'string')
36
+ return reply.msg;
37
+ try {
38
+ return JSON.stringify(reply);
39
+ }
40
+ catch {
41
+ return String(reply);
42
+ }
43
+ }
44
+ return String(reply);
45
+ }
46
+ class ReplyError extends Error {
47
+ reply;
48
+ constructor(reply) {
49
+ super(formatReplyMessage(reply));
50
+ this.name = 'ReplyError';
51
+ this.reply = reply;
52
+ Error.captureStackTrace(this, this.constructor);
53
+ }
54
+ }
55
+ exports.ReplyError = ReplyError;
29
56
  function generateUUID() {
30
57
  function s4() {
31
58
  return Math.floor((1 + Math.random()) * 0x10000)
@@ -93,7 +93,7 @@ class Producer {
93
93
  this.pendingJobs[id] = new PendingJob((err, ev) => {
94
94
  if (err) {
95
95
  clearInterval(intervalRef);
96
- reject(new Error(err));
96
+ reject(new cro_1.ReplyError(err));
97
97
  }
98
98
  else {
99
99
  if (ev.value.done) {
@@ -59,7 +59,11 @@ class Requestor {
59
59
  progressTimeout = progressTimeout || this.progressTimeout;
60
60
  return new Promise((resolve, reject) => {
61
61
  var id = cro_1.generateUUID();
62
- this.de.connection.signalEvent(this.channel, id, msg);
62
+ this.de.connection.signalEvent(this.channel, id, msg).catch((err) => {
63
+ this.pendingRequests[id] = null;
64
+ clearInterval(intervalRef);
65
+ reject(err);
66
+ });
63
67
  const intervalRef = setInterval(() => {
64
68
  const now = new Date().valueOf();
65
69
  const isProgressTimeout = (now > this.pendingRequests[id].lastProgress + progressTimeout);
@@ -73,7 +77,7 @@ class Requestor {
73
77
  this.pendingRequests[id] = new Request((err, data) => {
74
78
  clearInterval(intervalRef);
75
79
  if (err) {
76
- reject(new Error(err));
80
+ reject(new cro_1.ReplyError(err));
77
81
  }
78
82
  else {
79
83
  resolve(data);
@@ -100,11 +104,11 @@ class Replier {
100
104
  this.onMessage(ev.value, (err, data) => {
101
105
  if (this.de.connection.connected) {
102
106
  const errmsg = (err instanceof Error) ? err.message : err;
103
- this.de.connection.signalEvent(this.channel, ev.key, { err: errmsg, data: data });
107
+ this.de.connection.signalEvent(this.channel, ev.key, { err: errmsg, data: data }).catch(() => { });
104
108
  }
105
109
  }, (data) => {
106
110
  if (this.de.connection.connected) {
107
- this.de.connection.signalEvent(this.progressChannel, ev.key, { data });
111
+ this.de.connection.signalEvent(this.progressChannel, ev.key, { data }).catch(() => { });
108
112
  }
109
113
  });
110
114
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stinkycomputing/cachearoo",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "type": "commonjs",
5
5
  "description": "Cachearoo Client for Node.js",
6
6
  "main": "dist/cachearoo-node.js",