@stinkycomputing/cachearoo 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build_and_test.yml +1 -1
- package/.github/workflows/npm-publish.yml +11 -6
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/THIRD-PARTY-NOTICES.md +17 -0
- package/dist/cachearoo-node.d.ts +2 -2
- package/dist/cachearoo-node.js +4 -3
- package/dist/cachearoo.d.ts +2 -2
- package/dist/cachearoo.es.js +945 -1061
- package/dist/cachearoo.min.js +5 -5
- package/dist/libs/cro.connection.js +14 -2
- package/dist/libs/cro.d.ts +4 -0
- package/dist/libs/cro.js +29 -2
- package/dist/libs/cro.msg.competing-consumers.js +1 -1
- package/dist/libs/cro.msg.request-reply.js +8 -4
- package/package.json +5 -7
package/dist/cachearoo.min.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var Cachearoo=function(
|
|
1
|
+
var Cachearoo=function(W){"use strict";var It=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Er(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var xt={},Le={};Le.byteLength=Tr,Le.toByteArray=Fr,Le.fromByteArray=Rr;for(var Y=[],H=[],Ar=typeof Uint8Array<"u"?Uint8Array:Array,Xe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",me=0,Sr=Xe.length;me<Sr;++me)Y[me]=Xe[me],H[Xe.charCodeAt(me)]=me;H["-".charCodeAt(0)]=62,H["_".charCodeAt(0)]=63;function Rt(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 s=n===e?0:4-n%4;return[n,s]}function Tr(o){var e=Rt(o),n=e[0],s=e[1];return(n+s)*3/4-s}function Or(o,e,n){return(e+n)*3/4-n}function Fr(o){var e,n=Rt(o),s=n[0],u=n[1],c=new Ar(Or(o,s,u)),l=0,f=u>0?s-4:s,m;for(m=0;m<f;m+=4)e=H[o.charCodeAt(m)]<<18|H[o.charCodeAt(m+1)]<<12|H[o.charCodeAt(m+2)]<<6|H[o.charCodeAt(m+3)],c[l++]=e>>16&255,c[l++]=e>>8&255,c[l++]=e&255;return u===2&&(e=H[o.charCodeAt(m)]<<2|H[o.charCodeAt(m+1)]>>4,c[l++]=e&255),u===1&&(e=H[o.charCodeAt(m)]<<10|H[o.charCodeAt(m+1)]<<4|H[o.charCodeAt(m+2)]>>2,c[l++]=e>>8&255,c[l++]=e&255),c}function Ir(o){return Y[o>>18&63]+Y[o>>12&63]+Y[o>>6&63]+Y[o&63]}function xr(o,e,n){for(var s,u=[],c=e;c<n;c+=3)s=(o[c]<<16&16711680)+(o[c+1]<<8&65280)+(o[c+2]&255),u.push(Ir(s));return u.join("")}function Rr(o){for(var e,n=o.length,s=n%3,u=[],c=16383,l=0,f=n-s;l<f;l+=c)u.push(xr(o,l,l+c>f?f:l+c));return s===1?(e=o[n-1],u.push(Y[e>>2]+Y[e<<4&63]+"==")):s===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 Ye={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Ye.read=function(o,e,n,s,u){var c,l,f=u*8-s-1,m=(1<<f)-1,b=m>>1,w=-7,O=n?u-1:0,B=n?-1:1,j=o[e+O];for(O+=B,c=j&(1<<-w)-1,j>>=-w,w+=f;w>0;c=c*256+o[e+O],O+=B,w-=8);for(l=c&(1<<-w)-1,c>>=-w,w+=s;w>0;l=l*256+o[e+O],O+=B,w-=8);if(c===0)c=1-b;else{if(c===m)return l?NaN:(j?-1:1)*(1/0);l=l+Math.pow(2,s),c=c-b}return(j?-1:1)*l*Math.pow(2,c-s)},Ye.write=function(o,e,n,s,u,c){var l,f,m,b=c*8-u-1,w=(1<<b)-1,O=w>>1,B=u===23?Math.pow(2,-24)-Math.pow(2,-77):0,j=s?0:c-1,D=s?1:-1,G=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=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+=B/m:e+=B*Math.pow(2,1-O),e*m>=2&&(l++,m/=2),l+O>=w?(f=0,l=w):l+O>=1?(f=(e*m-1)*Math.pow(2,u),l=l+O):(f=e*Math.pow(2,O-1)*Math.pow(2,u),l=0));u>=8;o[n+j]=f&255,j+=D,f/=256,u-=8);for(l=l<<u|f,b+=u;b>0;o[n+j]=l&255,j+=D,l/=256,b-=8);o[n+j-D]|=G*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(o){var e=Le,n=Ye,s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=f,o.SlowBuffer=fe,o.INSPECT_MAX_BYTES=50;var u=2147483647;o.kMaxLength=u,f.TYPED_ARRAY_SUPPORT=c(),!f.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 c(){try{var a=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(a,t),a.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}}),Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}});function l(a){if(a>u)throw new RangeError('The value "'+a+'" is invalid for option "size"');var t=new Uint8Array(a);return Object.setPrototypeOf(t,f.prototype),t}function f(a,t,r){if(typeof a=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return O(a)}return m(a,t,r)}f.poolSize=8192;function m(a,t,r){if(typeof a=="string")return B(a,t);if(ArrayBuffer.isView(a))return D(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a);if($(a,ArrayBuffer)||a&&$(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($(a,SharedArrayBuffer)||a&&$(a.buffer,SharedArrayBuffer)))return G(a,t,r);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=a.valueOf&&a.valueOf();if(i!=null&&i!==a)return f.from(i,t,r);var p=Fe(a);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return f.from(a[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 a)}f.from=function(a,t,r){return m(a,t,r)},Object.setPrototypeOf(f.prototype,Uint8Array.prototype),Object.setPrototypeOf(f,Uint8Array);function b(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function w(a,t,r){return b(a),a<=0?l(a):t!==void 0?typeof r=="string"?l(a).fill(t,r):l(a).fill(t):l(a)}f.alloc=function(a,t,r){return w(a,t,r)};function O(a){return b(a),l(a<0?0:se(a)|0)}f.allocUnsafe=function(a){return O(a)},f.allocUnsafeSlow=function(a){return O(a)};function B(a,t){if((typeof t!="string"||t==="")&&(t="utf8"),!f.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=Ie(a,t)|0,i=l(r),p=i.write(a,t);return p!==r&&(i=i.slice(0,p)),i}function j(a){for(var t=a.length<0?0:se(a.length)|0,r=l(t),i=0;i<t;i+=1)r[i]=a[i]&255;return r}function D(a){if($(a,Uint8Array)){var t=new Uint8Array(a);return G(t.buffer,t.byteOffset,t.byteLength)}return j(a)}function G(a,t,r){if(t<0||a.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(a.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(a):r===void 0?i=new Uint8Array(a,t):i=new Uint8Array(a,t,r),Object.setPrototypeOf(i,f.prototype),i}function Fe(a){if(f.isBuffer(a)){var t=se(a.length)|0,r=l(t);return r.length===0||a.copy(r,0,0,t),r}if(a.length!==void 0)return typeof a.length!="number"||ne(a.length)?l(0):j(a);if(a.type==="Buffer"&&Array.isArray(a.data))return j(a.data)}function se(a){if(a>=u)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+u.toString(16)+" bytes");return a|0}function fe(a){return+a!=a&&(a=0),f.alloc(+a)}f.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==f.prototype},f.compare=function(t,r){if($(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),$(r,Uint8Array)&&(r=f.from(r,r.offset,r.byteLength)),!f.isBuffer(t)||!f.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},f.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}},f.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return f.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var p=f.allocUnsafe(r),d=0;for(i=0;i<t.length;++i){var v=t[i];if($(v,Uint8Array))d+v.length>p.length?f.from(v).copy(p,d):Uint8Array.prototype.set.call(p,v,d);else if(f.isBuffer(v))v.copy(p,d);else throw new TypeError('"list" argument must be an Array of Buffers');d+=v.length}return p};function Ie(a,t){if(f.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||$(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof a);var r=a.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(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return N(a).length;default:if(p)return i?-1:A(a).length;t=(""+t).toLowerCase(),p=!0}}f.byteLength=Ie;function xe(a,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(a||(a="utf8");;)switch(a){case"hex":return X(this,t,r);case"utf8":case"utf-8":return V(this,t,r);case"ascii":return Ue(this,t,r);case"latin1":case"binary":return he(this,t,r);case"base64":return je(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: "+a);a=(a+"").toLowerCase(),i=!0}}f.prototype._isBuffer=!0;function J(a,t,r){var i=a[t];a[t]=a[r],a[r]=i}f.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},f.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},f.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},f.prototype.toString=function(){var t=this.length;return t===0?"":arguments.length===0?V(this,0,t):xe.apply(this,arguments)},f.prototype.toLocaleString=f.prototype.toString,f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:f.compare(this,t)===0},f.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+">"},s&&(f.prototype[s]=f.prototype.inspect),f.prototype.compare=function(t,r,i,p,d){if($(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.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,k=Math.min(v,I),U=this.slice(p,d),q=t.slice(r,i),C=0;C<k;++C)if(U[C]!==q[C]){v=U[C],I=q[C];break}return v<I?-1:I<v?1:0};function Re(a,t,r,i,p){if(a.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:a.length-1),r<0&&(r=a.length+r),r>=a.length){if(p)return-1;r=a.length-1}else if(r<0)if(p)r=0;else return-1;if(typeof t=="string"&&(t=f.from(t,i)),f.isBuffer(t))return t.length===0?-1:z(a,t,r,i,p);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(a,t,r):Uint8Array.prototype.lastIndexOf.call(a,t,r):z(a,[t],r,i,p);throw new TypeError("val must be string, number or Buffer")}function z(a,t,r,i,p){var d=1,v=a.length,I=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(a.length<2||t.length<2)return-1;d=2,v/=2,I/=2,r/=2}function k(wr,br){return d===1?wr[br]:wr.readUInt16BE(br*d)}var U;if(p){var q=-1;for(U=r;U<v;U++)if(k(a,U)===k(t,q===-1?0:U-q)){if(q===-1&&(q=U),U-q+1===I)return q*d}else q!==-1&&(U-=U-q),q=-1}else for(r+I>v&&(r=v-I),U=r;U>=0;U--){for(var C=!0,Ve=0;Ve<I;Ve++)if(k(a,U+Ve)!==k(t,Ve)){C=!1;break}if(C)return U}return-1}f.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1},f.prototype.indexOf=function(t,r,i){return Re(this,t,r,i,!0)},f.prototype.lastIndexOf=function(t,r,i){return Re(this,t,r,i,!1)};function ae(a,t,r,i){r=Number(r)||0;var p=a.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;a[r+v]=I}return v}function re(a,t,r,i){return K(A(t,a.length-r),a,r,i)}function ce(a,t,r,i){return K(T(t),a,r,i)}function ue(a,t,r,i){return K(N(t),a,r,i)}function Q(a,t,r,i){return K(R(t,a.length-r),a,r,i)}f.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 ce(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}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function je(a,t,r){return t===0&&r===a.length?e.fromByteArray(a):e.fromByteArray(a.slice(t,r))}function V(a,t,r){r=Math.min(a.length,r);for(var i=[],p=t;p<r;){var d=a[p],v=null,I=d>239?4:d>223?3:d>191?2:1;if(p+I<=r){var k,U,q,C;switch(I){case 1:d<128&&(v=d);break;case 2:k=a[p+1],(k&192)===128&&(C=(d&31)<<6|k&63,C>127&&(v=C));break;case 3:k=a[p+1],U=a[p+2],(k&192)===128&&(U&192)===128&&(C=(d&15)<<12|(k&63)<<6|U&63,C>2047&&(C<55296||C>57343)&&(v=C));break;case 4:k=a[p+1],U=a[p+2],q=a[p+3],(k&192)===128&&(U&192)===128&&(q&192)===128&&(C=(d&15)<<18|(k&63)<<12|(U&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(a){var t=a.length;if(t<=le)return String.fromCharCode.apply(String,a);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,a.slice(i,i+=le));return r}function Ue(a,t,r){var i="";r=Math.min(a.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(a[p]&127);return i}function he(a,t,r){var i="";r=Math.min(a.length,r);for(var p=t;p<r;++p)i+=String.fromCharCode(a[p]);return i}function X(a,t,r){var i=a.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var p="",d=t;d<r;++d)p+=Pe[a[d]];return p}function ye(a,t,r){for(var i=a.slice(t,r),p="",d=0;d<i.length-1;d+=2)p+=String.fromCharCode(i[d]+i[d+1]*256);return p}f.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,f.prototype),p};function L(a,t,r){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+t>r)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||L(t,r,this.length);for(var p=this[t],d=1,v=0;++v<r&&(d*=256);)p+=this[t+v]*d;return p},f.prototype.readUintBE=f.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||L(t,r,this.length);for(var p=this[t+--r],d=1;r>0&&(d*=256);)p+=this[t+--r]*d;return p},f.prototype.readUint8=f.prototype.readUInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]},f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||L(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||L(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},f.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||L(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},f.prototype.readInt8=function(t,r){return t=t>>>0,r||L(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},f.prototype.readInt16LE=function(t,r){t=t>>>0,r||L(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i},f.prototype.readInt16BE=function(t,r){t=t>>>0,r||L(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i},f.prototype.readInt32LE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,r){return t=t>>>0,r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,r){return t=t>>>0,r||L(t,4,this.length),n.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,r){return t=t>>>0,r||L(t,4,this.length),n.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||L(t,8,this.length),n.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||L(t,8,this.length),n.read(this,t,!1,52,8)};function h(a,t,r,i,p,d){if(!f.isBuffer(a))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>a.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.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},f.prototype.writeUintBE=f.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},f.prototype.writeUint8=f.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},f.prototype.writeUint16LE=f.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},f.prototype.writeUint16BE=f.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},f.prototype.writeUint32LE=f.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},f.prototype.writeUint32BE=f.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},f.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,k=0;for(this[r]=t&255;++v<i&&(I*=256);)t<0&&k===0&&this[r+v-1]!==0&&(k=1),this[r+v]=(t/I>>0)-k&255;return r+i},f.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,k=0;for(this[r+v]=t&255;--v>=0&&(I*=256);)t<0&&k===0&&this[r+v+1]!==0&&(k=1),this[r+v]=(t/I>>0)-k&255;return r+i},f.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},f.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},f.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},f.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},f.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(a,t,r,i,p,d){if(r+i>a.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function g(a,t,r,i,p){return t=+t,r=r>>>0,p||y(a,t,r,4),n.write(a,t,r,i,23,4),r+4}f.prototype.writeFloatLE=function(t,r,i){return g(this,t,r,!0,i)},f.prototype.writeFloatBE=function(t,r,i){return g(this,t,r,!1,i)};function E(a,t,r,i,p){return t=+t,r=r>>>0,p||y(a,t,r,8),n.write(a,t,r,i,52,8),r+8}f.prototype.writeDoubleLE=function(t,r,i){return E(this,t,r,!0,i)},f.prototype.writeDoubleBE=function(t,r,i){return E(this,t,r,!1,i)},f.prototype.copy=function(t,r,i,p){if(!f.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},f.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"&&!f.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=f.isBuffer(t)?t:f.from(t,p),k=I.length;if(k===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(v=0;v<i-r;++v)this[v+r]=I[v%k]}return this};var F=/[^+/0-9A-Za-z-_]/g;function x(a){if(a=a.split("=")[0],a=a.trim().replace(F,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function A(a,t){t=t||1/0;for(var r,i=a.length,p=null,d=[],v=0;v<i;++v){if(r=a.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(a){for(var t=[],r=0;r<a.length;++r)t.push(a.charCodeAt(r)&255);return t}function R(a,t){for(var r,i,p,d=[],v=0;v<a.length&&!((t-=2)<0);++v)r=a.charCodeAt(v),i=r>>8,p=r%256,d.push(p),d.push(i);return d}function N(a){return e.toByteArray(x(a))}function K(a,t,r,i){for(var p=0;p<i&&!(p+r>=t.length||p>=a.length);++p)t[p+r]=a[p];return p}function $(a,t){return a instanceof t||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===t.name}function ne(a){return a!==a}var Pe=function(){for(var a="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var i=r*16,p=0;p<16;++p)t[i+p]=a[r]+a[p];return t}()})(xt);var Pt={exports:{}},_=Pt.exports={},Z,ee;function Ze(){throw new Error("setTimeout has not been defined")}function et(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Z=setTimeout:Z=Ze}catch{Z=Ze}try{typeof clearTimeout=="function"?ee=clearTimeout:ee=et}catch{ee=et}})();function Bt(o){if(Z===setTimeout)return setTimeout(o,0);if((Z===Ze||!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 Pr(o){if(ee===clearTimeout)return clearTimeout(o);if((ee===et||!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=[],we=!1,de,Ce=-1;function Br(){!we||!de||(we=!1,de.length?ie=de.concat(ie):Ce=-1,ie.length&&kt())}function kt(){if(!we){var o=Bt(Br);we=!0;for(var e=ie.length;e;){for(de=ie,ie=[];++Ce<e;)de&&de[Ce].run();Ce=-1,e=ie.length}de=null,we=!1,Pr(o)}}_.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 jt(o,e)),ie.length===1&&!we&&Bt(kt)};function jt(o,e){this.fun=o,this.array=e}jt.prototype.run=function(){this.fun.apply(null,this.array)},_.title="browser",_.browser=!0,_.env={},_.argv=[],_.version="",_.versions={};function oe(){}_.on=oe,_.addListener=oe,_.once=oe,_.off=oe,_.removeListener=oe,_.removeAllListeners=oe,_.emit=oe,_.prependListener=oe,_.prependOnceListener=oe,_.listeners=function(o){return[]},_.binding=function(o){throw new Error("process.binding is not supported")},_.cwd=function(){return"/"},_.chdir=function(o){throw new Error("process.chdir is not supported")},_.umask=function(){return 0};var kr=Pt.exports;const te=Er(kr);var jr=function(o){function e(){var s=this||self;return delete o.prototype.__magic__,s}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),Ur=jr,tt={},Ut={},Lt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),s=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(s)!=="[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 c=Object.getOwnPropertySymbols(e);if(c.length!==1||c[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},Lr=Lt,rt=function(){return Lr()&&!!Symbol.toStringTag},Ct=typeof Symbol<"u"&&Symbol,Cr=Lt,_r=function(){return typeof Ct!="function"||typeof Symbol!="function"||typeof Ct("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Cr()},_t={foo:{}},Dr=Object,Mr=function(){return{__proto__:_t}.foo===_t.foo&&!({__proto__:null}instanceof Dr)},Nr="Function.prototype.bind called on incompatible ",nt=Array.prototype.slice,qr=Object.prototype.toString,$r="[object Function]",Wr=function(e){var n=this;if(typeof n!="function"||qr.call(n)!==$r)throw new TypeError(Nr+n);for(var s=nt.call(arguments,1),u,c=function(){if(this instanceof u){var w=n.apply(this,s.concat(nt.call(arguments)));return Object(w)===w?w:this}else return n.apply(e,s.concat(nt.call(arguments)))},l=Math.max(0,n.length-s.length),f=[],m=0;m<l;m++)f.push("$"+m);if(u=Function("binder","return function ("+f.join(",")+"){ return binder.apply(this,arguments); }")(c),n.prototype){var b=function(){};b.prototype=n.prototype,u.prototype=new b,b.prototype=null}return u},Gr=Wr,it=Function.prototype.bind||Gr,Jr=it,Hr=Jr.call(Function.call,Object.prototype.hasOwnProperty),S,be=SyntaxError,Dt=Function,Ee=TypeError,ot=function(o){try{return Dt('"use strict"; return ('+o+").constructor;")()}catch{}},ge=Object.getOwnPropertyDescriptor;if(ge)try{ge({},"")}catch{ge=null}var st=function(){throw new Ee},zr=ge?function(){try{return arguments.callee,st}catch{try{return ge(arguments,"callee").get}catch{return st}}}():st,Ae=_r(),Kr=Mr(),M=Object.getPrototypeOf||(Kr?function(o){return o.__proto__}:null),Se={},Qr=typeof Uint8Array>"u"||!M?S:M(Uint8Array),ve={"%AggregateError%":typeof AggregateError>"u"?S:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?S:ArrayBuffer,"%ArrayIteratorPrototype%":Ae&&M?M([][Symbol.iterator]()):S,"%AsyncFromSyncIteratorPrototype%":S,"%AsyncFunction%":Se,"%AsyncGenerator%":Se,"%AsyncGeneratorFunction%":Se,"%AsyncIteratorPrototype%":Se,"%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%":Dt,"%GeneratorFunction%":Se,"%Int8Array%":typeof Int8Array>"u"?S:Int8Array,"%Int16Array%":typeof Int16Array>"u"?S:Int16Array,"%Int32Array%":typeof Int32Array>"u"?S:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Ae&&M?M(M([][Symbol.iterator]())):S,"%JSON%":typeof JSON=="object"?JSON:S,"%Map%":typeof Map>"u"?S:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Ae||!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"||!Ae||!M?S:M(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?S:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Ae&&M?M(""[Symbol.iterator]()):S,"%Symbol%":Ae?Symbol:S,"%SyntaxError%":be,"%ThrowTypeError%":zr,"%TypedArray%":Qr,"%TypeError%":Ee,"%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 Vr=M(M(o));ve["%Error.prototype%"]=Vr}var Xr=function o(e){var n;if(e==="%AsyncFunction%")n=ot("async function () {}");else if(e==="%GeneratorFunction%")n=ot("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=ot("async function* () {}");else if(e==="%AsyncGenerator%"){var s=o("%AsyncGeneratorFunction%");s&&(n=s.prototype)}else if(e==="%AsyncIteratorPrototype%"){var u=o("%AsyncGenerator%");u&&M&&(n=M(u.prototype))}return ve[e]=n,n},Mt={"%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=it,_e=Hr,Yr=Be.call(Function.call,Array.prototype.concat),Zr=Be.call(Function.apply,Array.prototype.splice),Nt=Be.call(Function.call,String.prototype.replace),De=Be.call(Function.call,String.prototype.slice),en=Be.call(Function.call,RegExp.prototype.exec),tn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,rn=/\\(\\)?/g,nn=function(e){var n=De(e,0,1),s=De(e,-1);if(n==="%"&&s!=="%")throw new be("invalid intrinsic syntax, expected closing `%`");if(s==="%"&&n!=="%")throw new be("invalid intrinsic syntax, expected opening `%`");var u=[];return Nt(e,tn,function(c,l,f,m){u[u.length]=f?Nt(m,rn,"$1"):l||c}),u},on=function(e,n){var s=e,u;if(_e(Mt,s)&&(u=Mt[s],s="%"+u[0]+"%"),_e(ve,s)){var c=ve[s];if(c===Se&&(c=Xr(s)),typeof c>"u"&&!n)throw new Ee("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:u,name:s,value:c}}throw new be("intrinsic "+e+" does not exist!")},at=function(e,n){if(typeof e!="string"||e.length===0)throw new Ee("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Ee('"allowMissing" argument must be a boolean');if(en(/^%?[^%]*%?$/,e)===null)throw new be("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var s=nn(e),u=s.length>0?s[0]:"",c=on("%"+u+"%",n),l=c.name,f=c.value,m=!1,b=c.alias;b&&(u=b[0],Zr(s,Yr([0,1],b)));for(var w=1,O=!0;w<s.length;w+=1){var B=s[w],j=De(B,0,1),D=De(B,-1);if((j==='"'||j==="'"||j==="`"||D==='"'||D==="'"||D==="`")&&j!==D)throw new be("property names with quotes must have matching quotes");if((B==="constructor"||!O)&&(m=!0),u+="."+B,l="%"+u+"%",_e(ve,l))f=ve[l];else if(f!=null){if(!(B in f)){if(!n)throw new Ee("base intrinsic for "+e+" exists, but the property is not available.");return}if(ge&&w+1>=s.length){var G=ge(f,B);O=!!G,O&&"get"in G&&!("originalValue"in G.get)?f=G.get:f=f[B]}else O=_e(f,B),f=f[B];O&&!m&&(ve[l]=f)}}return f},qt={exports:{}};(function(o){var e=it,n=at,s=n("%Function.prototype.apply%"),u=n("%Function.prototype.call%"),c=n("%Reflect.apply%",!0)||e.call(u,s),l=n("%Object.getOwnPropertyDescriptor%",!0),f=n("%Object.defineProperty%",!0),m=n("%Math.max%");if(f)try{f({},"a",{value:1})}catch{f=null}o.exports=function(O){var B=c(e,u,arguments);if(l&&f){var j=l(B,"length");j.configurable&&f(B,"length",{value:1+m(0,O.length-(arguments.length-1))})}return B};var b=function(){return c(e,s,arguments)};f?f(o.exports,"apply",{value:b}):o.exports.apply=b})(qt);var $t=qt.exports,Wt=at,Gt=$t,sn=Gt(Wt("String.prototype.indexOf")),Jt=function(e,n){var s=Wt(e,!!n);return typeof s=="function"&&sn(e,".prototype.")>-1?Gt(s):s},an=rt(),un=Jt,ut=un("Object.prototype.toString"),Me=function(e){return an&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:ut(e)==="[object Arguments]"},Ht=function(e){return Me(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&ut(e)!=="[object Array]"&&ut(e.callee)==="[object Function]"},fn=function(){return Me(arguments)}();Me.isLegacyArguments=Ht;var cn=fn?Me:Ht,ln=Object.prototype.toString,pn=Function.prototype.toString,hn=/^\s*(?:function)?\*/,zt=rt(),ft=Object.getPrototypeOf,yn=function(){if(!zt)return!1;try{return Function("return function*() {}")()}catch{}},ct,dn=function(e){if(typeof e!="function")return!1;if(hn.test(pn.call(e)))return!0;if(!zt){var n=ln.call(e);return n==="[object GeneratorFunction]"}if(!ft)return!1;if(typeof ct>"u"){var s=yn();ct=s?ft(s):!1}return ft(e)===ct},Kt=Function.prototype.toString,Te=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,lt,Ne;if(typeof Te=="function"&&typeof Object.defineProperty=="function")try{lt=Object.defineProperty({},"length",{get:function(){throw Ne}}),Ne={},Te(function(){throw 42},null,lt)}catch(o){o!==Ne&&(Te=null)}else Te=null;var gn=/^\s*class\b/,pt=function(e){try{var n=Kt.call(e);return gn.test(n)}catch{return!1}},ht=function(e){try{return pt(e)?!1:(Kt.call(e),!0)}catch{return!1}},qe=Object.prototype.toString,vn="[object Object]",mn="[object Function]",wn="[object GeneratorFunction]",bn="[object HTMLAllCollection]",En="[object HTML document.all class]",An="[object HTMLCollection]",Sn=typeof Symbol=="function"&&!!Symbol.toStringTag,Tn=!(0 in[,]),yt=function(){return!1};if(typeof document=="object"){var On=document.all;qe.call(On)===qe.call(document.all)&&(yt=function(e){if((Tn||!e)&&(typeof e>"u"||typeof e=="object"))try{var n=qe.call(e);return(n===bn||n===En||n===An||n===vn)&&e("")==null}catch{}return!1})}var Fn=Te?function(e){if(yt(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Te(e,null,lt)}catch(n){if(n!==Ne)return!1}return!pt(e)&&ht(e)}:function(e){if(yt(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Sn)return ht(e);if(pt(e))return!1;var n=qe.call(e);return n!==mn&&n!==wn&&!/^\[object HTML/.test(n)?!1:ht(e)},In=Fn,xn=Object.prototype.toString,Qt=Object.prototype.hasOwnProperty,Rn=function(e,n,s){for(var u=0,c=e.length;u<c;u++)Qt.call(e,u)&&(s==null?n(e[u],u,e):n.call(s,e[u],u,e))},Pn=function(e,n,s){for(var u=0,c=e.length;u<c;u++)s==null?n(e.charAt(u),u,e):n.call(s,e.charAt(u),u,e)},Bn=function(e,n,s){for(var u in e)Qt.call(e,u)&&(s==null?n(e[u],u,e):n.call(s,e[u],u,e))},kn=function(e,n,s){if(!In(n))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=s),xn.call(e)==="[object Array]"?Rn(e,n,u):typeof e=="string"?Pn(e,n,u):Bn(e,n,u)},jn=kn,dt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],Un=typeof globalThis>"u"?It:globalThis,Ln=function(){for(var e=[],n=0;n<dt.length;n++)typeof Un[dt[n]]=="function"&&(e[e.length]=dt[n]);return e},Cn=at,$e=Cn("%Object.getOwnPropertyDescriptor%",!0);if($e)try{$e([],"length")}catch{$e=null}var _n=$e,We=jn,Dn=Ln,Vt=$t,gt=Jt,Ge=_n,Mn=gt("Object.prototype.toString"),Xt=rt(),Yt=typeof globalThis>"u"?It:globalThis,vt=Dn(),mt=gt("String.prototype.slice"),wt=Object.getPrototypeOf,Nn=gt("Array.prototype.indexOf",!0)||function(e,n){for(var s=0;s<e.length;s+=1)if(e[s]===n)return s;return-1},Je={__proto__:null};Xt&&Ge&&wt?We(vt,function(o){var e=new Yt[o];if(Symbol.toStringTag in e){var n=wt(e),s=Ge(n,Symbol.toStringTag);if(!s){var u=wt(n);s=Ge(u,Symbol.toStringTag)}Je["$"+o]=Vt(s.get)}}):We(vt,function(o){var e=new Yt[o];Je["$"+o]=Vt(e.slice)});var qn=function(e){var n=!1;return We(Je,function(s,u){if(!n)try{"$"+s(e)===u&&(n=mt(u,1))}catch{}}),n},$n=function(e){var n=!1;return We(Je,function(s,u){if(!n)try{s(e),n=mt(u,1)}catch{}}),n},Zt=function(e){if(!e||typeof e!="object")return!1;if(!Xt){var n=mt(Mn(e),8,-1);return Nn(vt,n)>-1?n:n!=="Object"?!1:$n(e)}return Ge?qn(e):null},Wn=Zt,Gn=function(e){return!!Wn(e)};(function(o){var e=cn,n=dn,s=Zt,u=Gn;function c(i){return i.call.bind(i)}var l=typeof BigInt<"u",f=typeof Symbol<"u",m=c(Object.prototype.toString),b=c(Number.prototype.valueOf),w=c(String.prototype.valueOf),O=c(Boolean.prototype.valueOf);if(l)var B=c(BigInt.prototype.valueOf);if(f)var j=c(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 Fe(i){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(i):u(i)||y(i)}o.isArrayBufferView=Fe;function se(i){return s(i)==="Uint8Array"}o.isUint8Array=se;function fe(i){return s(i)==="Uint8ClampedArray"}o.isUint8ClampedArray=fe;function Ie(i){return s(i)==="Uint16Array"}o.isUint16Array=Ie;function xe(i){return s(i)==="Uint32Array"}o.isUint32Array=xe;function J(i){return s(i)==="Int8Array"}o.isInt8Array=J;function Re(i){return s(i)==="Int16Array"}o.isInt16Array=Re;function z(i){return s(i)==="Int32Array"}o.isInt32Array=z;function ae(i){return s(i)==="Float32Array"}o.isFloat32Array=ae;function re(i){return s(i)==="Float64Array"}o.isFloat64Array=re;function ce(i){return s(i)==="BigInt64Array"}o.isBigInt64Array=ce;function ue(i){return s(i)==="BigUint64Array"}o.isBigUint64Array=ue;function Q(i){return m(i)==="[object Map]"}Q.working=typeof Map<"u"&&Q(new Map);function je(i){return typeof Map>"u"?!1:Q.working?Q(i):i instanceof Map}o.isMap=je;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 Ue(i){return typeof WeakMap>"u"?!1:pe.working?pe(i):i instanceof WeakMap}o.isWeakMap=Ue;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 L(i){return typeof ArrayBuffer>"u"?!1:ye.working?ye(i):i instanceof ArrayBuffer}o.isArrayBuffer=L;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 E(i){return m(i)==="[object SharedArrayBuffer]"}function F(i){return typeof g>"u"?!1:(typeof E.working>"u"&&(E.working=E(new g)),E.working?E(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 R(i){return m(i)==="[object Generator]"}o.isGeneratorObject=R;function N(i){return m(i)==="[object WebAssembly.Module]"}o.isWebAssemblyCompiledModule=N;function K(i){return D(i,b)}o.isNumberObject=K;function $(i){return D(i,w)}o.isStringObject=$;function ne(i){return D(i,O)}o.isBooleanObject=ne;function Pe(i){return l&&D(i,B)}o.isBigIntObject=Pe;function a(i){return f&&D(i,j)}o.isSymbolObject=a;function t(i){return K(i)||$(i)||ne(i)||Pe(i)||a(i)}o.isBoxedPrimitive=t;function r(i){return typeof Uint8Array<"u"&&(L(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")}})})})(Ut);var Jn=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},bt={exports:{}};typeof Object.create=="function"?bt.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:bt.exports=function(e,n){if(n){e.super_=n;var s=function(){};s.prototype=n.prototype,e.prototype=new s,e.prototype.constructor=e}};var Hn=bt.exports;(function(o){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;o.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])fe(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 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 s={},u=/^$/;if(te.env.NODE_DEBUG){var c=te.env.NODE_DEBUG;c=c.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),u=new RegExp("^"+c+"$","i")}o.debuglog=function(h){if(h=h.toUpperCase(),!s[h])if(u.test(h)){var y=te.pid;s[h]=function(){var g=o.format.apply(o,arguments);console.error("%s %d: %s",h,y,g)}}else s[h]=function(){};return s[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=f),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 f(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!==o.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 B(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(ce(y))return h.stylize(Date.prototype.toString.call(y),"date");if(ue(y))return B(y)}var R="",N=!1,K=["{","}"];if(Fe(y)&&(N=!0,K=["[","]"]),Q(y)){var $=y.name?": "+y.name:"";R=" [Function"+$+"]"}if(ae(y)&&(R=" "+RegExp.prototype.toString.call(y)),ce(y)&&(R=" "+Date.prototype.toUTCString.call(y)),ue(y)&&(R=" "+B(y)),x.length===0&&(!N||y.length==0))return K[0]+R+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=j(h,y,g,A,x):ne=x.map(function(Pe){return D(h,y,g,A,Pe,N)}),h.seen.pop(),G(ne,R,K)}function O(h,y){if(z(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(xe(y))return h.stylize(""+y,"number");if(se(y))return h.stylize(""+y,"boolean");if(fe(y))return h.stylize("null","null")}function B(h){return"["+Error.prototype.toString.call(h)+"]"}function j(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(R){R.match(/^\d+$/)||x.push(D(h,y,g,E,R,!0))}),x}function D(h,y,g,E,F,x){var A,T,R;if(R=Object.getOwnPropertyDescriptor(y,F)||{value:y[F]},R.get?R.set?T=h.stylize("[Getter/Setter]","special"):T=h.stylize("[Getter]","special"):R.set&&(T=h.stylize("[Setter]","special")),he(E,F)||(A="["+F+"]"),T||(h.seen.indexOf(R.value)<0?(fe(g)?T=w(h,R.value,null):T=w(h,R.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
|
|
13
|
-
`)>=0,F+x.replace(/\u001b\[\d\d?m/g,"").length+1},0);return
|
|
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 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]}o.types=Ut;function Fe(h){return Array.isArray(h)}o.isArray=Fe;function se(h){return typeof h=="boolean"}o.isBoolean=se;function fe(h){return h===null}o.isNull=fe;function Ie(h){return h==null}o.isNullOrUndefined=Ie;function xe(h){return typeof h=="number"}o.isNumber=xe;function J(h){return typeof h=="string"}o.isString=J;function Re(h){return typeof h=="symbol"}o.isSymbol=Re;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 ce(h){return re(h)&&V(h)==="[object Date]"}o.isDate=ce,o.types.isDate=ce;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 je(h){return h===null||typeof h=="boolean"||typeof h=="number"||typeof h=="string"||typeof h=="symbol"||typeof h>"u"}o.isPrimitive=je,o.isBuffer=Jn;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 Ue(){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",Ue(),o.format.apply(o,arguments))},o.inherits=Hn,o._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;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 E,F,x=new Promise(function(R,N){E=R,F=N}),A=[],T=0;T<arguments.length;T++)A.push(arguments[T]);A.push(function(R,N){R?F(R):E(N)});try{y.apply(this,A)}catch(R){F(R)}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 L(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}o.callbackify=L})(tt);const zn=3e3;let Et;function Kn(){if(Et)return Et;const o=typeof globalThis<"u"&&globalThis.WebSocket||void 0;return o&&(Et=o),o}function Qn(o){const e=new Uint8Array(128);let n=0;const s=typeof window<"u"?window.TextEncoder:tt.TextEncoder,u=new s,c=u.encode(o.bucket),l=u.encode(o.key),f=u.encode(o.apiKey);if(c.byteLength>36||l.byteLength>36||f.byteLength>36)throw new Error("Cannot write binary header, bucket/key/apiKey cannot exceed 36 bytes each");return e[0]=o.type,e[1]=c.byteLength,e[2]=l.byteLength,e[3]=f.byteLength,n=4,e.set(c,n),n+=e[1],e.set(l,n),n+=e[2],e.set(f,n),e}function Vn(o){let e=o[1],n=o[2],s=o[3];const u=typeof window<"u"?window.TextDecoder:tt.TextDecoder,c=new u("utf-8"),l={type:o[0],bucket:"",key:"",apiKey:""};let f=4;return l.bucket=c.decode(o.slice(f,f+e)),f=f+e,l.key=c.decode(o.slice(f,f+n)),f=f+n,l.apiKey=c.decode(o.slice(f,f+s)),l}class Xn{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 s=e.wsSubDomain?e.wsSubDomain+".":"",u=n+s+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||"",s=e.method||"GET";if(s==="GET"&&e.key==="")return this.list(n,e.keysOnly,e.filter);if(s==="GET")return this.read(n,e.key);if(s==="POST"||s==="PUT")return this.write(n,e.key,e.data,e.failIfExists,e.expire);if(s==="DELETE")return this.delete(n,e.key);if(s==="PATCH")return this.patch(n,e.key,e.data,e.removeDataFromReply);if(s==="EVENT")return this.signalEvent(n,e.key,e.data)}async read(e,n){return new Promise((s,u)=>{this.addRequest({op:"read",bucket:e,key:n},function(c,l){c?u(new Error("Cachearoo ws READ error: "+JSON.stringify(c)+" for bucket: "+e+", key: "+n)):s(l)})})}async list(e,n,s){return new Promise((u,c)=>{this.addRequest({op:"filter",bucket:e,keysOnly:n,filter:s},function(l,f){l?c(new Error("Cachearoo ws FILTER error: "+JSON.stringify(l)+" for bucket: "+e)):u(f)})})}async write(e,n,s,u,c){return new Promise((l,f)=>{this.addRequest({op:"write",bucket:e,key:n,value:s,failIfExists:u,expire:c},function(m,b){if(m){const w=m.alreadyExists?new St(`Key ${n} already exists`):new Error("Cachearoo ws WRITE error: "+JSON.stringify(m)+" for bucket: "+e+", key: "+n);f(w)}else l(b)})})}async patch(e,n,s,u){return new Promise((c,l)=>{this.addRequest({op:"patch",bucket:e,key:n,patch:s,removeDataFromReply:u},function(f,m){f?l(new Error("Cachearoo ws PATCH error: "+JSON.stringify(f)+" for bucket: "+e+", key: "+n)):c(m)})})}async delete(e,n){return new Promise((s,u)=>{this.addRequest({op:"remove",bucket:e,key:n},function(c){c?u(new Error("Cachearoo ws REMOVE error: "+JSON.stringify(c)+" for bucket: "+e+", key: "+n)):s()})})}async signalEvent(e,n,s){var u={bucket:e,key:n,value:s};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,s,u){const c={type:e,bucket:n,key:s,apiKey:this.apiKey||""},l=Qn(c);this.connected&&this.ws&&this.ws.send(xt.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,s){if(s==null||typeof s!="function")throw"Callback is not a function";this.binaryEvents.push({bucket:e,key:n,callback:s}),this.registerEvents()}addListener(e,n,s,u){if(u==null||typeof u!="function")throw"Callback is not a function";s&&(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 s=new Date().getTime();s-this.requests[e].timeStamp>zn&&(n.callback("Timeout occured for request "+n.id),this.requests[e]=null)}}this.skipReconnect||this.checkRequestTimeouts()},1e3)}registerEvents(){var c;if(this.connected){var e=[],n=[];const l=[...this.events,...this.binaryEvents];for(var s=0;s<l.length;s++){var u=JSON.stringify(l[s]);e[u]||(n.push({bucket:l[s].bucket,key:l[s].key}),e[u]=!0)}(c=this.ws)==null||c.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=Vn(new Uint8Array(e));for(var s=0;s<this.binaryEvents.length;s++)(this.binaryEvents[s].bucket==="*"||this.binaryEvents[s].bucket==n.bucket)&&(this.binaryEvents[s].key==="*"||this.binaryEvents[s].key==n.key)&&this.binaryEvents[s].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 s=typeof n.value<"u"&&typeof n.isDeleted>"u"?n.value:null,u={bucket:n.bucket,key:n.key,value:s,isDeleted:void 0};n.isDeleted&&(u.isDeleted=!0);for(var c=0;c<this.events.length;c++)(this.events[c].bucket==="*"||this.events[c].bucket==u.bucket)&&(this.events[c].key==="*"||this.events[c].key==u.key)&&this.events[c].callback(u)}wsStart(e){this.skipReconnect=!1,this.connected=!1,this.pingTimer&&clearInterval(this.pingTimer),this.ws&&this.ws.close&&this.ws.close();const n=Kn();if(!n)throw new Error("No global WebSocket implementation available. Use a browser or Node.js >= 22 (or assign one to globalThis.WebSocket).");this.ws=new n(e),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=s=>{typeof this.onError=="function"&&this.onError(s)},this.ws.onmessage=s=>{typeof s.data=="string"?this.processStringMessage(s.data):this.processBinaryMessage(s.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 Yn=Ur.fetch,Zn=4300,He=200,ei=404,er=201,ti=304,ri=50;class At extends Error{constructor(e,n){super(e),Error.captureStackTrace(this,this.constructor),this.progressTimeout=n}}class St extends Error{constructor(e){super(e),this.name="AlreadyExistsError",Error.captureStackTrace(this,this.constructor)}}function ni(o){if(typeof o=="string")return o;if(o&&typeof o=="object"){if(typeof o.message=="string")return o.message;if(typeof o.msg=="string")return o.msg;try{return JSON.stringify(o)}catch{return String(o)}}return String(o)}class Tt extends Error{constructor(e){super(ni(e)),this.name="ReplyError",this.reply=e,Error.captureStackTrace(this,this.constructor)}}function tr(){function o(){return Math.floor((1+Math.random())*65536).toString(16).substring(1)}return o()+o()+"-"+o()+"-"+o()+"-"+o()+"-"+o()+o()+o()}class Ot{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 ke{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 ii extends ke{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 rr{constructor(e){this.pendingRequests=0,e==null&&(e=new Ot),e.host=e.host||"127.0.0.1",e.port=e.port||Zn,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 Xn(e),this.requestQueue=[]}internalizeRequestOptions(e,n,s=!1){var u=n.bucket||this.settings.bucket||"";n.async==null&&(n.async=!0);var c=new ii(null);return n.keysOnly!==void 0&&(c.keysOnly=n.keysOnly),n.filter!==void 0&&(c.filter=n.filter),c.url=this.getUrl(e,u,c.keysOnly,c.filter,s),c.bucket=u,c.key=e,c.async=n.async,c.failIfExists=n.failIfExists,c.forceHttp=n.forceHttp,c.expire=n.expire,c.isList=s,c.removeDataFromReply=n.removeDataFromReply,c}checkOptions(e){return e instanceof ke||(e=new ke(e)),e}async read(e,n){let s=this.internalizeRequestOptions(e,this.checkOptions(n));return s.method="GET",this.request(s)}async list(e){let n={...e};n.keysOnly===void 0&&(n.keysOnly=!0);let s=this.internalizeRequestOptions("",this.checkOptions(n),!0);return s.method="GET",await this.request(s)}async write(e,n,s){let u=this.internalizeRequestOptions(e,this.checkOptions(s));return u.method=u.key?"PUT":"POST",u.data=n,this.request(u)}async patch(e,n,s){let u=this.internalizeRequestOptions(e,this.checkOptions(s));return u.method="PATCH",u.data=n,this.request(u)}async remove(e,n){let s=this.internalizeRequestOptions(e,this.checkOptions(n));return s.method="DELETE",this.request(s)}async repair(e){var n=this.settings.secure?"https://":"http://",s=n+this.settings.host+":"+this.settings.port+this.settings.path+"_repair/"+e;const u={url:s,method:"GET"};return await this.requestHttp(u)}getUrl(e,n,s,u,c=!1){e||(e="");var l="d="+new Date().getTime();l=(e.indexOf("?")>-1?"&":"?")+l,s&&(l=l+"&keysOnly=true"),u!=null&&u!==""&&(l=l+"&filter="+u);var f=this.settings.secure?"https://":"http://";return c?f+this.settings.host+":"+this.settings.port+this.settings.path+"_data/"+encodeURIComponent(n)+l:f+this.settings.host+":"+this.settings.port+this.settings.path+"_data/"+encodeURIComponent(n)+"/"+encodeURIComponent(e)+l}async requestHttp(e){const n=e.method||"GET";let s={method:n,headers:{},body:void 0};this.settings.apiKey&&(s.headers["API-Key"]=this.settings.apiKey,s.headers["x-api-key"]=this.settings.apiKey),(n=="PUT"||n=="POST"||n=="PATCH")&&(s.body=JSON.stringify(e.data),s.headers["Content-Type"]="application/json",e.failIfExists&&(s.headers.failIfExists=e.failIfExists),e.removeDataFromReply&&(s.headers.RemoveDataFromReply=e.removeDataFromReply),e.expire&&(s.headers.expire=e.expire));const u=await Yn(e.url,s);if((n==="GET"||n==="PATCH")&&[He,ti].indexOf(u.status)>-1)return await u.json();if(["POST","PUT"].indexOf(n)>-1&&[He,er].indexOf(u.status)>-1){let c=e.key;return u.status===er&&(c=u.headers.get("location")??c),c}else{if(n==="DELETE"&&[He,ei].indexOf(u.status)>-1)return;if(u.status==He)return;throw new Error(`${u.status}`)}}async request(e){var n,s,u=new Promise(function(l,f){n=l,s=f});e.async===void 0&&(e.async=!0);var c={resolve:n,reject:s,options:e};return setTimeout(()=>{this.requestQueue.unshift(c),this.processRequestQueue()}),u}processRequestQueue(){if(this.pendingRequests>=ri||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(s=>{this.pendingRequests--,e.resolve(s),setTimeout(this.processRequestQueue.bind(this))}).catch(s=>{this.pendingRequests--,e.reject(s),setTimeout(this.processRequestQueue.bind(this))})}close(){this.connection.close()}}var Ft={exports:{}},Oe=typeof Reflect=="object"?Reflect:null,nr=Oe&&typeof Oe.apply=="function"?Oe.apply:function(e,n,s){return Function.prototype.apply.call(e,n,s)},ze;Oe&&typeof Oe.ownKeys=="function"?ze=Oe.ownKeys:Object.getOwnPropertySymbols?ze=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ze=function(e){return Object.getOwnPropertyNames(e)};function oi(o){console&&console.warn&&console.warn(o)}var ir=Number.isNaN||function(e){return e!==e};function P(){P.init.call(this)}Ft.exports=P,Ft.exports.once=fi,P.EventEmitter=P,P.prototype._events=void 0,P.prototype._eventsCount=0,P.prototype._maxListeners=void 0;var or=10;function Ke(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 or},set:function(o){if(typeof o!="number"||o<0||ir(o))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+o+".");or=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||ir(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 sr(o){return o._maxListeners===void 0?P.defaultMaxListeners:o._maxListeners}P.prototype.getMaxListeners=function(){return sr(this)},P.prototype.emit=function(e){for(var n=[],s=1;s<arguments.length;s++)n.push(arguments[s]);var u=e==="error",c=this._events;if(c!==void 0)u=u&&c.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 f=new Error("Unhandled error."+(l?" ("+l.message+")":""));throw f.context=l,f}var m=c[e];if(m===void 0)return!1;if(typeof m=="function")nr(m,this,n);else for(var b=m.length,w=lr(m,b),s=0;s<b;++s)nr(w[s],this,n);return!0};function ar(o,e,n,s){var u,c,l;if(Ke(n),c=o._events,c===void 0?(c=o._events=Object.create(null),o._eventsCount=0):(c.newListener!==void 0&&(o.emit("newListener",e,n.listener?n.listener:n),c=o._events),l=c[e]),l===void 0)l=c[e]=n,++o._eventsCount;else if(typeof l=="function"?l=c[e]=s?[n,l]:[l,n]:s?l.unshift(n):l.push(n),u=sr(o),u>0&&l.length>u&&!l.warned){l.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=o,f.type=e,f.count=l.length,oi(f)}return o}P.prototype.addListener=function(e,n){return ar(this,e,n,!1)},P.prototype.on=P.prototype.addListener,P.prototype.prependListener=function(e,n){return ar(this,e,n,!0)};function si(){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 ur(o,e,n){var s={fired:!1,wrapFn:void 0,target:o,type:e,listener:n},u=si.bind(s);return u.listener=n,s.wrapFn=u,u}P.prototype.once=function(e,n){return Ke(n),this.on(e,ur(this,e,n)),this},P.prototype.prependOnceListener=function(e,n){return Ke(n),this.prependListener(e,ur(this,e,n)),this},P.prototype.removeListener=function(e,n){var s,u,c,l,f;if(Ke(n),u=this._events,u===void 0)return this;if(s=u[e],s===void 0)return this;if(s===n||s.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete u[e],u.removeListener&&this.emit("removeListener",e,s.listener||n));else if(typeof s!="function"){for(c=-1,l=s.length-1;l>=0;l--)if(s[l]===n||s[l].listener===n){f=s[l].listener,c=l;break}if(c<0)return this;c===0?s.shift():ai(s,c),s.length===1&&(u[e]=s[0]),u.removeListener!==void 0&&this.emit("removeListener",e,f||n)}return this},P.prototype.off=P.prototype.removeListener,P.prototype.removeAllListeners=function(e){var n,s,u;if(s=this._events,s===void 0)return this;if(s.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):s[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete s[e]),this;if(arguments.length===0){var c=Object.keys(s),l;for(u=0;u<c.length;++u)l=c[u],l!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(n=s[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 fr(o,e,n){var s=o._events;if(s===void 0)return[];var u=s[e];return u===void 0?[]:typeof u=="function"?n?[u.listener||u]:[u]:n?ui(u):lr(u,u.length)}P.prototype.listeners=function(e){return fr(this,e,!0)},P.prototype.rawListeners=function(e){return fr(this,e,!1)},P.listenerCount=function(o,e){return typeof o.listenerCount=="function"?o.listenerCount(e):cr.call(o,e)},P.prototype.listenerCount=cr;function cr(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?ze(this._events):[]};function lr(o,e){for(var n=new Array(e),s=0;s<e;++s)n[s]=o[s];return n}function ai(o,e){for(;e+1<o.length;e++)o[e]=o[e+1];o.pop()}function ui(o){for(var e=new Array(o.length),n=0;n<e.length;++n)e[n]=o[n].listener||o[n];return e}function fi(o,e){return new Promise(function(n,s){function u(l){o.removeListener(e,c),s(l)}function c(){typeof o.removeListener=="function"&&o.removeListener("error",u),n([].slice.call(arguments))}pr(o,e,c,{once:!0}),e!=="error"&&ci(o,u,{once:!0})})}function ci(o,e,n){typeof o.on=="function"&&pr(o,"error",e,n)}function pr(o,e,n,s){if(typeof o.on=="function")s.once?o.once(e,n):o.on(e,n);else if(typeof o.addEventListener=="function")o.addEventListener(e,function u(c){s.once&&o.removeEventListener(e,u),n(c)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof o)}var li=Ft.exports;const Qe="messaging.compcon",pi=1e4,hi=1e4,yi=20,hr=100,yr=200;class di{constructor(e){const n=new Date().valueOf();this.lastProgress=void 0,this.publishTime=n,this.callback=e}}async function gi(o){o!==0&&await new Promise(e=>{setTimeout(()=>e(null),o)})}class vi{constructor(e,n,s,u){this.pendingJobs=new Map,this.jobQueue=Qe+"."+n+".jobs",this.statusQueue=Qe+"."+n+".status",this.timeout=s||pi,this.progressTimeout=u||hi,this.de=e,this.jobStatusQueueListener=c=>{if(this.pendingJobs.has(c.key)){const l=this.pendingJobs.get(c.key);l.lastProgress=new Date().valueOf(),l.callback(c.value.err,c),c.value.done&&this.pendingJobs.delete(c.key)}},e.connection.addListener(this.statusQueue,"*",!0,this.jobStatusQueueListener)}destroy(){this.de.connection&&this.de.connection.removeListener(this.jobStatusQueueListener)}async addJob(e,n,s,u){s=s||this.timeout,u=u||this.progressTimeout;const c=tr();return await this.de.connection.write(this.jobQueue,c,e),new Promise((l,f)=>{const m=setInterval(()=>{const b=new Date().valueOf();let w=!1;this.pendingJobs[c].lastProgress!=null&&(w=b>this.pendingJobs[c].lastProgress+u);const O=b>this.pendingJobs[c].publishTime+s;(w||O)&&(this.pendingJobs[c]=null,clearInterval(m),f(new At(`Timeout for job id ${c}`,w)))},500);this.pendingJobs[c]=new di((b,w)=>{b?(clearInterval(m),f(new Tt(b))):w.value.done?(clearInterval(m),l(w.value),this.de.connection.delete(this.statusQueue,w.key)):typeof n=="function"&&n(w.value)})})}}class mi extends li.EventEmitter{constructor(e,n,s){super(),this.jobCount=0,this.statusQueue=Qe+"."+n+".status",this.jobQueue=Qe+"."+n+".jobs",this.de=e,this.clientId=s,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 gi(Math.floor(Math.random()*yi));const s=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,s.work&&await s.work(n,async(c,l)=>{this.jobCount-=1,c instanceof Error&&(c=c.message),this.emit("job",{id:n.id,done:!0,data:l}),await this.de.connection.write(this.statusQueue,e,{...u,err:c,data:l,done:!0})},c=>{this.emit("job",{id:n.id,done:!1,progress:c}),this.de.connection.write(this.statusQueue,e,{...u,progress:c})})}catch(u){if(s.release(),!(u instanceof St))throw u}}async waitForWorker(e){return new Promise((n,s)=>{var u=setInterval(()=>{this.onJobQuery!=null&&this.onJobQuery(e,(c,l)=>{if(c==null){clearInterval(u),this.emit("job",{id:e.id,status:"Worker assigned"}),n(l);return}else c==hr?(clearInterval(u),this.emit("job",{id:e.id,error:"Not supported"}),s(new Error("Job not supported"))):c==yr||(clearInterval(u),this.emit("job",{id:e.id,errno:c}),s(new Error(`Error no : ${c}`)))})},100)})}}const dr="#reqrep/",gr="#reqrep-progress/";class wi{constructor(e,n){const s=new Date().valueOf();this.lastProgress=s,this.requestTime=s,this.reply=e,this.progress=n}}class vr{constructor(e,n,s,u){this.pendingRequests=new Map,this.timeout=s||5e3,this.progressTimeout=u||5e3,this.channel=dr+n,this.progressChannel=gr+n,this.de=e,this.progressListener=c=>{const l=this.pendingRequests[c.key];l&&(l.lastProgress=new Date().valueOf(),typeof l.progress=="function"&&l.progress(c.value.data))},this.replyListener=c=>{this.pendingRequests[c.key]&&(this.pendingRequests[c.key].reply(c.value.err,c.value.data),this.pendingRequests[c.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,s,u){return s=s||this.timeout,u=u||this.progressTimeout,new Promise((c,l)=>{var f=tr();this.de.connection.signalEvent(this.channel,f,e).catch(b=>{this.pendingRequests[f]=null,clearInterval(m),l(b)});const m=setInterval(()=>{const b=new Date().valueOf(),w=b>this.pendingRequests[f].lastProgress+u,O=b>this.pendingRequests[f].requestTime+s;(w||O)&&(this.pendingRequests[f]=null,clearInterval(m),l(new At(`Timeout in request id ${f}`,w)))},500);this.pendingRequests[f]=new wi((b,w)=>{clearInterval(m),b?l(new Tt(b)):c(w)},n)})}}class mr{constructor(e,n){this.channel=dr+n,this.progressChannel=gr+n,this.de=e,this.requestListener=s=>{this.onMessage!==void 0&&this.onMessage(s.value,(u,c)=>{if(this.de.connection.connected){const l=u instanceof Error?u.message:u;this.de.connection.signalEvent(this.channel,s.key,{err:l,data:c}).catch(()=>{})}},u=>{this.de.connection.connected&&this.de.connection.signalEvent(this.progressChannel,s.key,{data:u}).catch(()=>{})})},e.connection.addListener(this.channel,"*",!0,this.requestListener)}destroy(){this.de.connection.removeListener(this.requestListener)}}return W.Messaging=void 0,(o=>{o.RequestReply={Requestor:vr,Replier:mr},o.CompetingConsumers={CompetingConsumer:mi,Producer:vi},o.Errors={JOB_NOT_SUPPORTED:hr,NO_WORKER_AVAILABLE:yr}})(W.Messaging||(W.Messaging={})),typeof window<"u"&&window&&(window.Cachearoo={Cachearoo:rr,CachearooSettings:Ot,RequestOptions:ke,Messaging:W.Messaging}),W.AlreadyExistsError=St,W.Cachearoo=rr,W.CachearooSettings=Ot,W.Replier=mr,W.ReplyError=Tt,W.RequestOptions=ke,W.Requestor=vr,W.TimeoutError=At,Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),W}({});
|
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PersistentConnection = void 0;
|
|
4
4
|
const util_1 = require("util");
|
|
5
|
-
const websocket_1 = require("websocket");
|
|
6
5
|
const cro_1 = require("./cro");
|
|
7
6
|
const REQUEST_TIMEOUT = 3000;
|
|
7
|
+
let cachedWebSocket;
|
|
8
|
+
function resolveWebSocket() {
|
|
9
|
+
if (cachedWebSocket)
|
|
10
|
+
return cachedWebSocket;
|
|
11
|
+
const impl = (typeof globalThis !== 'undefined' && globalThis.WebSocket) || undefined;
|
|
12
|
+
if (impl)
|
|
13
|
+
cachedWebSocket = impl;
|
|
14
|
+
return impl;
|
|
15
|
+
}
|
|
8
16
|
function headerToBuffer(header) {
|
|
9
17
|
const buf = new Uint8Array(128);
|
|
10
18
|
let offset = 0;
|
|
@@ -355,7 +363,11 @@ class PersistentConnection {
|
|
|
355
363
|
clearInterval(this.pingTimer);
|
|
356
364
|
if ((this.ws) && (this.ws.close))
|
|
357
365
|
this.ws.close();
|
|
358
|
-
|
|
366
|
+
const NativeWebSocket = resolveWebSocket();
|
|
367
|
+
if (!NativeWebSocket) {
|
|
368
|
+
throw new Error('No global WebSocket implementation available. Use a browser or Node.js >= 22 (or assign one to globalThis.WebSocket).');
|
|
369
|
+
}
|
|
370
|
+
this.ws = new NativeWebSocket(url);
|
|
359
371
|
this.ws.binaryType = 'arraybuffer';
|
|
360
372
|
if (this.enablePing) {
|
|
361
373
|
this.pingTimer = setInterval(() => {
|
package/dist/libs/cro.d.ts
CHANGED
|
@@ -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)
|
|
@@ -204,7 +231,7 @@ class Cachearoo {
|
|
|
204
231
|
else if ((['POST', 'PUT'].indexOf(method) > -1) && ([HTTP_RESPONSE_OK, HTTP_RESPONSE_CREATED].indexOf(response.status) > -1)) {
|
|
205
232
|
let key = options.key;
|
|
206
233
|
if (response.status === HTTP_RESPONSE_CREATED) {
|
|
207
|
-
key = response.headers
|
|
234
|
+
key = response.headers.get('location') ?? key;
|
|
208
235
|
}
|
|
209
236
|
return key;
|
|
210
237
|
}
|
|
@@ -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
|
|
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
|
};
|