@ecodrix/erix-api 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +3 -3
- package/dist/index.d.cts +1597 -1489
- package/dist/index.d.ts +760 -760
- package/dist/ts/browser/index.global.js +5 -5
- package/dist/ts/browser/index.global.js.map +1 -1
- package/dist/ts/cjs/index.cjs +1 -1
- package/dist/ts/cjs/index.cjs.map +1 -1
- package/dist/ts/cjs/index.d.cts +760 -760
- package/dist/ts/esm/index.d.ts +760 -760
- package/dist/ts/esm/index.js +1 -1
- package/dist/ts/esm/index.js.map +1 -1
- package/package.json +12 -12
- package/src/cli.ts +18 -31
- package/src/core.ts +12 -16
- package/src/index.ts +18 -20
- package/src/resource.ts +6 -25
- package/src/resources/crm/activities.ts +1 -1
- package/src/resources/crm/automations.ts +9 -3
- package/src/resources/crm/index.ts +6 -6
- package/src/resources/crm/leads.ts +20 -15
- package/src/resources/crm/payments.ts +7 -1
- package/src/resources/crm/pipelines.ts +3 -1
- package/src/resources/crm/sequences.ts +5 -1
- package/src/resources/email.ts +2 -5
- package/src/resources/events.ts +12 -3
- package/src/resources/health.ts +3 -1
- package/src/resources/marketing.ts +8 -1
- package/src/resources/media.ts +1 -4
- package/src/resources/meet.ts +4 -1
- package/src/resources/webhooks.ts +3 -8
- package/src/resources/whatsapp/conversations.ts +8 -3
- package/src/resources/whatsapp/index.ts +4 -6
- package/src/resources/whatsapp/templates.ts +14 -4
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
`).join(`
|
|
4
4
|
`+a),t.push(n+"m+"+Bi.exports.humanize(this.diff)+"\x1B[0m")}else t[0]=Eh()+e+" "+t[0]}function Eh(){return se.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Th(...t){return process.stderr.write(qi.formatWithOptions(se.inspectOpts,...t)+`
|
|
5
5
|
`)}function Sh(t){t?process.env.DEBUG=t:delete process.env.DEBUG}function kh(){return process.env.DEBUG}function Rh(t){t.inspectOpts={};let e=Object.keys(se.inspectOpts);for(let s=0;s<e.length;s++)t.inspectOpts[e[s]]=se.inspectOpts[e[s]]}Bi.exports=ia()(se);var{formatters:mp}=Bi.exports;mp.o=function(t){return this.inspectOpts.colors=this.useColors,qi.inspect(t,this.inspectOpts).split(`
|
|
6
|
-
`).map(e=>e.trim()).join(" ")};mp.O=function(t){return this.inspectOpts.colors=this.useColors,qi.inspect(t,this.inspectOpts)}});var ye=b((Ub,aa)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?aa.exports=cp():aa.exports=fp()});var xp=b((Ib,hp)=>{"use strict";var xs;hp.exports=function(){if(!xs){try{xs=ye()("follow-redirects")}catch(t){}typeof xs!="function"&&(xs=function(){})}xs.apply(null,arguments)}});var _p=b((Fb,ga)=>{"use strict";var vs=E("url"),gs=vs.URL,Ch=E("http"),Ah=E("https"),la=E("stream").Writable,ua=E("assert"),gp=xp();(function(){var e=typeof process!="undefined",s=typeof window!="undefined"&&typeof document!="undefined",i=dt(Error.captureStackTrace);!e&&(s||!i)&&console.warn("The follow-redirects package should be excluded from browser builds.")})();var da=!1;try{ua(new gs(""))}catch(t){da=t.code==="ERR_INVALID_URL"}var Oh=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],ma=["abort","aborted","connect","error","socket","timeout"],fa=Object.create(null);ma.forEach(function(t){fa[t]=function(e,s,i){this._redirectable.emit(t,e,s,i)}});var oa=ys("ERR_INVALID_URL","Invalid URL",TypeError),ca=ys("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Ph=ys("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",ca),Nh=ys("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Lh=ys("ERR_STREAM_WRITE_AFTER_END","write after end"),qh=la.prototype.destroy||yp;function xe(t,e){la.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var s=this;this._onNativeResponse=function(i){try{s._processResponse(i)}catch(n){s.emit("error",n instanceof ca?n:new ca({cause:n}))}},this._performRequest()}xe.prototype=Object.create(la.prototype);xe.prototype.abort=function(){xa(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};xe.prototype.destroy=function(t){return xa(this._currentRequest,t),qh.call(this,t),this};xe.prototype.write=function(t,e,s){if(this._ending)throw new Lh;if(!ut(t)&&!jh(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(dt(e)&&(s=e,e=null),t.length===0){s&&s();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,s)):(this.emit("error",new Nh),this.abort())};xe.prototype.end=function(t,e,s){if(dt(t)?(s=t,t=e=null):dt(e)&&(s=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,s);else{var i=this,n=this._currentRequest;this.write(t,e,function(){i._ended=!0,n.end(null,null,s)}),this._ending=!0}};xe.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};xe.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};xe.prototype.setTimeout=function(t,e){var s=this;function i(r){r.setTimeout(t),r.removeListener("timeout",r.destroy),r.addListener("timeout",r.destroy)}function n(r){s._timeout&&clearTimeout(s._timeout),s._timeout=setTimeout(function(){s.emit("timeout"),a()},t),i(r)}function a(){s._timeout&&(clearTimeout(s._timeout),s._timeout=null),s.removeListener("abort",a),s.removeListener("error",a),s.removeListener("response",a),s.removeListener("close",a),e&&s.removeListener("timeout",e),s.socket||s._currentRequest.removeListener("socket",n)}return e&&this.on("timeout",e),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",i),this.on("abort",a),this.on("error",a),this.on("response",a),this.on("close",a),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){xe.prototype[t]=function(e,s){return this._currentRequest[t](e,s)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(xe.prototype,t,{get:function(){return this._currentRequest[t]}})});xe.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};xe.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e)throw new TypeError("Unsupported protocol "+t);if(this._options.agents){var s=t.slice(0,-1);this._options.agent=this._options.agents[s]}var i=this._currentRequest=e.request(this._options,this._onNativeResponse);i._redirectable=this;for(var n of ma)i.on(n,fa[n]);if(this._currentUrl=/^\//.test(this._options.path)?vs.format(this._options):this._options.path,this._isRedirect){var a=0,r=this,o=this._requestBodyBuffers;(function p(l){if(i===r._currentRequest)if(l)r.emit("error",l);else if(a<o.length){var c=o[a++];i.finished||i.write(c.data,c.encoding,p)}else r._ended&&i.end()})()}};xe.prototype._processResponse=function(t){var e=t.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e});var s=t.headers.location;if(!s||this._options.followRedirects===!1||e<300||e>=400){t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[];return}if(xa(this._currentRequest),t.destroy(),++this._redirectCount>this._options.maxRedirects)throw new Ph;var i,n=this._options.beforeRedirect;n&&(i=Object.assign({Host:t.req.getHeader("host")},this._options.headers));var a=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],ra(/^content-/i,this._options.headers));var r=ra(/^host$/i,this._options.headers),o=ha(this._currentUrl),p=r||o.host,l=/^\w+:/.test(s)?this._currentUrl:vs.format(Object.assign(o,{host:p})),c=Bh(s,l);if(gp("redirecting to",c.href),this._isRedirect=!0,pa(c,this._options),(c.protocol!==o.protocol&&c.protocol!=="https:"||c.host!==p&&!Dh(c.host,p))&&ra(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),dt(n)){var m={headers:t.headers,statusCode:e},f={url:l,method:a,headers:i};n(this._options,m,f),this._sanitizeOptions(this._options)}this._performRequest()};function vp(t){var e={maxRedirects:21,maxBodyLength:10485760},s={};return Object.keys(t).forEach(function(i){var n=i+":",a=s[n]=t[i],r=e[i]=Object.create(a);function o(l,c,m){return Uh(l)?l=pa(l):ut(l)?l=pa(ha(l)):(m=c,c=bp(l),l={protocol:n}),dt(c)&&(m=c,c=null),c=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},l,c),c.nativeProtocols=s,!ut(c.host)&&!ut(c.hostname)&&(c.hostname="::1"),ua.equal(c.protocol,n,"protocol mismatch"),gp("options",c),new xe(c,m)}function p(l,c,m){var f=r.request(l,c,m);return f.end(),f}Object.defineProperties(r,{request:{value:o,configurable:!0,enumerable:!0,writable:!0},get:{value:p,configurable:!0,enumerable:!0,writable:!0}})}),e}function yp(){}function ha(t){var e;if(da)e=new gs(t);else if(e=bp(vs.parse(t)),!ut(e.protocol))throw new oa({input:t});return e}function Bh(t,e){return da?new gs(t,e):ha(vs.resolve(e,t))}function bp(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname))throw new oa({input:t.href||t});if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host))throw new oa({input:t.href||t});return t}function pa(t,e){var s=e||{};for(var i of Oh)s[i]=t[i];return s.hostname.startsWith("[")&&(s.hostname=s.hostname.slice(1,-1)),s.port!==""&&(s.port=Number(s.port)),s.path=s.search?s.pathname+s.search:s.pathname,s}function ra(t,e){var s;for(var i in e)t.test(i)&&(s=e[i],delete e[i]);return s===null||typeof s=="undefined"?void 0:String(s).trim()}function ys(t,e,s){function i(n){dt(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,n||{}),this.code=t,this.message=this.cause?e+": "+this.cause.message:e}return i.prototype=new(s||Error),Object.defineProperties(i.prototype,{constructor:{value:i,enumerable:!1},name:{value:"Error ["+t+"]",enumerable:!1}}),i}function xa(t,e){for(var s of ma)t.removeListener(s,fa[s]);t.on("error",yp),t.destroy(e)}function Dh(t,e){ua(ut(t)&&ut(e));var s=t.length-e.length-1;return s>0&&t[s]==="."&&t.endsWith(e)}function ut(t){return typeof t=="string"||t instanceof String}function dt(t){return typeof t=="function"}function jh(t){return typeof t=="object"&&"length"in t}function Uh(t){return gs&&t instanceof gs}ga.exports=vp({http:Ch,https:Ah});ga.exports.wrap=vp});var al=b((UE,nl)=>{"use strict";var xx=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);nl.exports=t=>!xx.has(t&&t.code)});var fl=b((k0,ml)=>{"use strict";var zt=E("fs"),dl=E("url"),Cx=E("child_process").spawn;ml.exports=Fa;Fa.XMLHttpRequest=Fa;function Fa(t){"use strict";t=t||{};var e=this,s=E("http"),i=E("https"),n,a,r={},o=!1,p={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},l=Object.assign({},p),c=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],m=["TRACE","TRACK","CONNECT"],f=!1,v=!1,h=!1,x={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),this.status=null,this.statusText=null;var g=function(y){return o||y&&c.indexOf(y.toLowerCase())===-1},k=function(y){return y&&m.indexOf(y)===-1};this.open=function(y,w,I,P,j){if(this.abort(),v=!1,h=!1,!k(y))throw new Error("SecurityError: Request method not allowed");r={method:y,url:w.toString(),async:typeof I!="boolean"?!0:I,user:P||null,password:j||null},R(this.OPENED)},this.setDisableHeaderCheck=function(y){o=y},this.setRequestHeader=function(y,w){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!g(y))return console.warn('Refused to set unsafe header "'+y+'"'),!1;if(f)throw new Error("INVALID_STATE_ERR: send flag is true");return l[y]=w,!0},this.getResponseHeader=function(y){return typeof y=="string"&&this.readyState>this.OPENED&&a.headers[y.toLowerCase()]&&!v?a.headers[y.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||v)return"";var y="";for(var w in a.headers)w!=="set-cookie"&&w!=="set-cookie2"&&(y+=w+": "+a.headers[w]+`\r
|
|
7
|
-
`);return y.substr(0,y.length-2)},this.getRequestHeader=function(y){return typeof y=="string"&&l[y]?l[y]:""},this.send=function(y){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(f)throw new Error("INVALID_STATE_ERR: send has already been called");var w=!1,I=!1,P=dl.parse(r.url),j;switch(P.protocol){case"https:":w=!0;case"http:":j=P.hostname;break;case"file:":I=!0;break;case void 0:case"":j="localhost";break;default:throw new Error("Protocol not supported.")}if(I){if(r.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(r.async)zt.readFile(unescape(P.pathname),function(L,Z){L?e.handleError(L,L.errno||-1):(e.status=200,e.responseText=Z.toString("utf8"),e.response=Z,R(e.DONE))});else try{this.response=zt.readFileSync(unescape(P.pathname)),this.responseText=this.response.toString("utf8"),this.status=200,R(e.DONE)}catch(L){this.handleError(L,L.errno||-1)}return}var M=P.port||(w?443:80),ce=P.pathname+(P.search?P.search:"");if(l.Host=j,w&&M===443||M===80||(l.Host+=":"+P.port),r.user){typeof r.password=="undefined"&&(r.password="");var De=new Buffer(r.user+":"+r.password);l.Authorization="Basic "+De.toString("base64")}if(r.method==="GET"||r.method==="HEAD")y=null;else if(y){l["Content-Length"]=Buffer.isBuffer(y)?y.length:Buffer.byteLength(y);var Fe=Object.keys(l);Fe.some(function(L){return L.toLowerCase()==="content-type"})||(l["Content-Type"]="text/plain;charset=UTF-8")}else r.method==="POST"&&(l["Content-Length"]=0);var Re=t.agent||!1,K={host:j,port:M,path:ce,method:r.method,headers:l,agent:Re};if(w&&(K.pfx=t.pfx,K.key=t.key,K.passphrase=t.passphrase,K.cert=t.cert,K.ca=t.ca,K.ciphers=t.ciphers,K.rejectUnauthorized=t.rejectUnauthorized!==!1),v=!1,r.async){var ge=w?i.request:s.request;f=!0,e.dispatchEvent("readystatechange");var Ee=function(L){if(a=L,a.statusCode===302||a.statusCode===303||a.statusCode===307){r.url=a.headers.location;var Z=dl.parse(r.url);j=Z.hostname;var ae={hostname:Z.hostname,port:Z.port,path:Z.path,method:a.statusCode===303?"GET":r.method,headers:l};w&&(ae.pfx=t.pfx,ae.key=t.key,ae.passphrase=t.passphrase,ae.cert=t.cert,ae.ca=t.ca,ae.ciphers=t.ciphers,ae.rejectUnauthorized=t.rejectUnauthorized!==!1),n=ge(ae,Ee).on("error",J),n.end();return}R(e.HEADERS_RECEIVED),e.status=a.statusCode,a.on("data",function(ee){if(ee){var Et=Buffer.from(ee);e.response=Buffer.concat([e.response,Et])}f&&R(e.LOADING)}),a.on("end",function(){f&&(f=!1,R(e.DONE),e.responseText=e.response.toString("utf8"))}),a.on("error",function(ee){e.handleError(ee)})},J=function(L){if(n.reusedSocket&&L.code==="ECONNRESET")return ge(K,Ee).on("error",J);e.handleError(L)};n=ge(K,Ee).on("error",J),t.autoUnref&&n.on("socket",L=>{L.unref()}),y&&n.write(y),n.end(),e.dispatchEvent("loadstart")}else{var W=".node-xmlhttprequest-content-"+process.pid,Y=".node-xmlhttprequest-sync-"+process.pid;zt.writeFileSync(Y,"","utf8");for(var Ze="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(w?"s":"")+".request;var options = "+JSON.stringify(K)+";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('"+W+"', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('"+Y+"');});response.on('error', function(error) {fs.writeFileSync('"+W+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Y+"');});}).on('error', function(error) {fs.writeFileSync('"+W+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Y+"');});"+(y?"req.write('"+JSON.stringify(y).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",C=Cx(process.argv[0],["-e",Ze]),T;zt.existsSync(Y););if(e.responseText=zt.readFileSync(W,"utf8"),C.stdin.end(),zt.unlinkSync(W),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var F=JSON.parse(e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,""));e.handleError(F,503)}else{e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1");var ne=JSON.parse(e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"));a={statusCode:e.status,headers:ne.data.headers},e.responseText=ne.data.text,e.response=Buffer.from(ne.data.data,"base64"),R(e.DONE,!0)}}},this.handleError=function(y,w){this.status=w||0,this.statusText=y,this.responseText=y.stack,v=!0,R(this.DONE)},this.abort=function(){n&&(n.abort(),n=null),l=Object.assign({},p),this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),v=h=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||f)&&this.readyState!==this.DONE&&(f=!1,R(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(y,w){y in x||(x[y]=[]),x[y].push(w)},this.removeEventListener=function(y,w){y in x&&(x[y]=x[y].filter(function(I){return I!==w}))},this.dispatchEvent=function(y){if(typeof e["on"+y]=="function"&&(this.readyState===this.DONE&&r.async?setTimeout(function(){e["on"+y]()},0):e["on"+y]()),y in x)for(let w=0,I=x[y].length;w<I;w++)this.readyState===this.DONE?setTimeout(function(){x[y][w].call(e)},0):x[y][w].call(e)};var R=function(y){if(!(e.readyState===y||e.readyState===e.UNSENT&&h)&&(e.readyState=y,(r.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let w;h?w="abort":v?w="error":w="load",e.dispatchEvent(w),e.dispatchEvent("loadend")}}}});var Je=b((rS,Dl)=>{"use strict";var ql=["nodebuffer","arraybuffer","fragments"],Bl=typeof Blob!="undefined";Bl&&ql.push("blob");Dl.exports={BINARY_TYPES:ql,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Bl,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var ti=b((oS,sn)=>{"use strict";var{EMPTY_BUFFER:Ix}=Je(),Ga=Buffer[Symbol.species];function Fx(t,e){if(t.length===0)return Ix;if(t.length===1)return t[0];let s=Buffer.allocUnsafe(e),i=0;for(let n=0;n<t.length;n++){let a=t[n];s.set(a,i),i+=a.length}return i<e?new Ga(s.buffer,s.byteOffset,i):s}function jl(t,e,s,i,n){for(let a=0;a<n;a++)s[i+a]=t[a]^e[a&3]}function Ul(t,e){for(let s=0;s<t.length;s++)t[s]^=e[s&3]}function Mx(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function Ka(t){if(Ka.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Ga(t):ArrayBuffer.isView(t)?e=new Ga(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Ka.readOnly=!1),e}sn.exports={concat:Fx,mask:jl,toArrayBuffer:Mx,toBuffer:Ka,unmask:Ul};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=E("bufferutil");sn.exports.mask=function(e,s,i,n,a){a<48?jl(e,s,i,n,a):t.mask(e,s,i,n,a)},sn.exports.unmask=function(e,s){e.length<32?Ul(e,s):t.unmask(e,s)}}catch(t){}});var Ml=b((cS,Fl)=>{"use strict";var Il=Symbol("kDone"),Ja=Symbol("kRun"),Ya=class{constructor(e){this[Il]=()=>{this.pending--,this[Ja]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Ja]()}[Ja](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Il])}}};Fl.exports=Ya});var ii=b((pS,Wl)=>{"use strict";var si=E("zlib"),zl=ti(),zx=Ml(),{kStatusCode:$l}=Je(),$x=Buffer[Symbol.species],Hx=Buffer.from([0,0,255,255]),an=Symbol("permessage-deflate"),Ye=Symbol("total-length"),Ht=Symbol("callback"),nt=Symbol("buffers"),Wt=Symbol("error"),nn,Xa=class{constructor(e,s,i){if(this._maxPayload=i|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!s,this._deflate=null,this._inflate=null,this.params=null,!nn){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;nn=new zx(n)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Ht];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let s=this._options,i=e.find(n=>!(s.serverNoContextTakeover===!1&&n.server_no_context_takeover||n.server_max_window_bits&&(s.serverMaxWindowBits===!1||typeof s.serverMaxWindowBits=="number"&&s.serverMaxWindowBits>n.server_max_window_bits)||typeof s.clientMaxWindowBits=="number"&&!n.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return s.serverNoContextTakeover&&(i.server_no_context_takeover=!0),s.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof s.serverMaxWindowBits=="number"&&(i.server_max_window_bits=s.serverMaxWindowBits),typeof s.clientMaxWindowBits=="number"?i.client_max_window_bits=s.clientMaxWindowBits:(i.client_max_window_bits===!0||s.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(e){let s=e[0];if(this._options.clientNoContextTakeover===!1&&s.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!s.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(s.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&s.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return s}normalizeParams(e){return e.forEach(s=>{Object.keys(s).forEach(i=>{let n=s[i];if(n.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(n=n[0],i==="client_max_window_bits"){if(n!==!0){let a=+n;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${n}`);n=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${n}`)}else if(i==="server_max_window_bits"){let a=+n;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${n}`);n=a}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(n!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${n}`)}else throw new Error(`Unknown parameter "${i}"`);s[i]=n})}),e}decompress(e,s,i){nn.add(n=>{this._decompress(e,s,(a,r)=>{n(),i(a,r)})})}compress(e,s,i){nn.add(n=>{this._compress(e,s,(a,r)=>{n(),i(a,r)})})}_decompress(e,s,i){let n=this._isServer?"client":"server";if(!this._inflate){let a=`${n}_max_window_bits`,r=typeof this.params[a]!="number"?si.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=si.createInflateRaw(re(N({},this._options.zlibInflateOptions),{windowBits:r})),this._inflate[an]=this,this._inflate[Ye]=0,this._inflate[nt]=[],this._inflate.on("error",Vx),this._inflate.on("data",Hl)}this._inflate[Ht]=i,this._inflate.write(e),s&&this._inflate.write(Hx),this._inflate.flush(()=>{let a=this._inflate[Wt];if(a){this._inflate.close(),this._inflate=null,i(a);return}let r=zl.concat(this._inflate[nt],this._inflate[Ye]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ye]=0,this._inflate[nt]=[],s&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),i(null,r)})}_compress(e,s,i){let n=this._isServer?"server":"client";if(!this._deflate){let a=`${n}_max_window_bits`,r=typeof this.params[a]!="number"?si.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=si.createDeflateRaw(re(N({},this._options.zlibDeflateOptions),{windowBits:r})),this._deflate[Ye]=0,this._deflate[nt]=[],this._deflate.on("data",Wx)}this._deflate[Ht]=i,this._deflate.write(e),this._deflate.flush(si.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=zl.concat(this._deflate[nt],this._deflate[Ye]);s&&(a=new $x(a.buffer,a.byteOffset,a.length-4)),this._deflate[Ht]=null,this._deflate[Ye]=0,this._deflate[nt]=[],s&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),i(null,a)})}};Wl.exports=Xa;function Wx(t){this[nt].push(t),this[Ye]+=t.length}function Hl(t){if(this[Ye]+=t.length,this[an]._maxPayload<1||this[Ye]<=this[an]._maxPayload){this[nt].push(t);return}this[Wt]=new RangeError("Max payload size exceeded"),this[Wt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Wt][$l]=1009,this.removeListener("data",Hl),this.reset()}function Vx(t){if(this[an]._inflate=null,this[Wt]){this[Ht](this[Wt]);return}t[$l]=1007,this[Ht](t)}});var Vt=b((uS,rn)=>{"use strict";var{isUtf8:Vl}=E("buffer"),{hasBlob:Gx}=Je(),Kx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Jx(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Qa(t){let e=t.length,s=0;for(;s<e;)if((t[s]&128)===0)s++;else if((t[s]&224)===192){if(s+1===e||(t[s+1]&192)!==128||(t[s]&254)===192)return!1;s+=2}else if((t[s]&240)===224){if(s+2>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||t[s]===224&&(t[s+1]&224)===128||t[s]===237&&(t[s+1]&224)===160)return!1;s+=3}else if((t[s]&248)===240){if(s+3>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||(t[s+3]&192)!==128||t[s]===240&&(t[s+1]&240)===128||t[s]===244&&t[s+1]>143||t[s]>244)return!1;s+=4}else return!1;return!0}function Yx(t){return Gx&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}rn.exports={isBlob:Yx,isValidStatusCode:Jx,isValidUTF8:Qa,tokenChars:Kx};if(Vl)rn.exports.isValidUTF8=function(t){return t.length<24?Qa(t):Vl(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=E("utf-8-validate");rn.exports.isValidUTF8=function(e){return e.length<32?Qa(e):t(e)}}catch(t){}});var ir=b((dS,Zl)=>{"use strict";var{Writable:Xx}=E("stream"),Gl=ii(),{BINARY_TYPES:Qx,EMPTY_BUFFER:Kl,kStatusCode:Zx,kWebSocket:eg}=Je(),{concat:Za,toArrayBuffer:tg,unmask:sg}=ti(),{isValidStatusCode:ig,isValidUTF8:Jl}=Vt(),on=Buffer[Symbol.species],Se=0,Yl=1,Xl=2,Ql=3,er=4,tr=5,cn=6,sr=class extends Xx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Qx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[eg]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Se}_write(e,s,i){if(this._opcode===8&&this._state==Se)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new on(i.buffer,i.byteOffset+e,i.length-e),new on(i.buffer,i.byteOffset,e)}let s=Buffer.allocUnsafe(e);do{let i=this._buffers[0],n=s.length-e;e>=i.length?s.set(this._buffers.shift(),n):(s.set(new Uint8Array(i.buffer,i.byteOffset,e),n),this._buffers[0]=new on(i.buffer,i.byteOffset+e,i.length-e)),e-=i.length}while(e>0);return s}startLoop(e){this._loop=!0;do switch(this._state){case Se:this.getInfo(e);break;case Yl:this.getPayloadLength16(e);break;case Xl:this.getPayloadLength64(e);break;case Ql:this.getMask();break;case er:this.getData(e);break;case tr:case cn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let s=this.consume(2);if((s[0]&48)!==0){let n=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(n);return}let i=(s[0]&64)===64;if(i&&!this._extensions[Gl.extensionName]){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._fin=(s[0]&128)===128,this._opcode=s[0]&15,this._payloadLength=s[1]&127,this._opcode===0){if(i){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(!this._fragmented){let n=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let n=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(n);return}if(i){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let n=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(n);return}}else{let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(s[1]&128)===128,this._isServer){if(!this._masked){let n=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(n);return}}else if(this._masked){let n=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(n);return}this._payloadLength===126?this._state=Yl:this._payloadLength===127?this._state=Xl:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let s=this.consume(8),i=s.readUInt32BE(0);if(i>Math.pow(2,21)-1){let n=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(n);return}this._payloadLength=i*Math.pow(2,32)+s.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(s);return}this._masked?this._state=Ql:this._state=er}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=er}getData(e){let s=Kl;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}s=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&sg(s,this._mask)}if(this._opcode>7){this.controlMessage(s,e);return}if(this._compressed){this._state=tr,this.decompress(s,e);return}s.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(s)),this.dataMessage(e)}decompress(e,s){this._extensions[Gl.extensionName].decompress(e,this._fin,(n,a)=>{if(n)return s(n);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");s(r);return}this._fragments.push(a)}this.dataMessage(s),this._state===Se&&this.startLoop(s)})}dataMessage(e){if(!this._fin){this._state=Se;return}let s=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let n;this._binaryType==="nodebuffer"?n=Za(i,s):this._binaryType==="arraybuffer"?n=tg(Za(i,s)):this._binaryType==="blob"?n=new Blob(i):n=i,this._allowSynchronousEvents?(this.emit("message",n,!0),this._state=Se):(this._state=cn,setImmediate(()=>{this.emit("message",n,!0),this._state=Se,this.startLoop(e)}))}else{let n=Za(i,s);if(!this._skipUTF8Validation&&!Jl(n)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(a);return}this._state===tr||this._allowSynchronousEvents?(this.emit("message",n,!1),this._state=Se):(this._state=cn,setImmediate(()=>{this.emit("message",n,!1),this._state=Se,this.startLoop(e)}))}}controlMessage(e,s){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Kl),this.end();else{let i=e.readUInt16BE(0);if(!ig(i)){let a=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");s(a);return}let n=new on(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Jl(n)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");s(a);return}this._loop=!1,this.emit("conclude",i,n),this.end()}this._state=Se;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=Se):(this._state=cn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=Se,this.startLoop(s)}))}createError(e,s,i,n,a){this._loop=!1,this._errored=!0;let r=new e(i?`Invalid WebSocket frame: ${s}`:s);return Error.captureStackTrace(r,this.createError),r.code=a,r[Zx]=n,r}};Zl.exports=sr});var rr=b((fS,su)=>{"use strict";var{Duplex:mS}=E("stream"),{randomFillSync:ng}=E("crypto"),eu=ii(),{EMPTY_BUFFER:ag,kWebSocket:rg,NOOP:og}=Je(),{isBlob:Gt,isValidStatusCode:cg}=Vt(),{mask:tu,toBuffer:xt}=ti(),ke=Symbol("kByteLength"),pg=Buffer.alloc(4),pn=8*1024,gt,Kt=pn,Be=0,lg=1,ug=2,nr=class t{constructor(e,s,i){this._extensions=s||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Be,this.onerror=og,this[rg]=void 0}static frame(e,s){let i,n=!1,a=2,r=!1;s.mask&&(i=s.maskBuffer||pg,s.generateMask?s.generateMask(i):(Kt===pn&&(gt===void 0&&(gt=Buffer.alloc(pn)),ng(gt,0,pn),Kt=0),i[0]=gt[Kt++],i[1]=gt[Kt++],i[2]=gt[Kt++],i[3]=gt[Kt++]),r=(i[0]|i[1]|i[2]|i[3])===0,a=6);let o;typeof e=="string"?(!s.mask||r)&&s[ke]!==void 0?o=s[ke]:(e=Buffer.from(e),o=e.length):(o=e.length,n=s.mask&&s.readOnly&&!r);let p=o;o>=65536?(a+=8,p=127):o>125&&(a+=2,p=126);let l=Buffer.allocUnsafe(n?o+a:a);return l[0]=s.fin?s.opcode|128:s.opcode,s.rsv1&&(l[0]|=64),l[1]=p,p===126?l.writeUInt16BE(o,2):p===127&&(l[2]=l[3]=0,l.writeUIntBE(o,4,6)),s.mask?(l[1]|=128,l[a-4]=i[0],l[a-3]=i[1],l[a-2]=i[2],l[a-1]=i[3],r?[l,e]:n?(tu(e,i,l,a,o),[l]):(tu(e,i,e,0,o),[l,e])):[l,e]}close(e,s,i,n){let a;if(e===void 0)a=ag;else{if(typeof e!="number"||!cg(e))throw new TypeError("First argument must be a valid error code number");if(s===void 0||!s.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(e,0);else{let o=Buffer.byteLength(s);if(o>123)throw new RangeError("The message must not be greater than 123 bytes");a=Buffer.allocUnsafe(2+o),a.writeUInt16BE(e,0),typeof s=="string"?a.write(s,2):a.set(s,2)}}let r={[ke]:a.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Be?this.enqueue([this.dispatch,a,!1,r,n]):this.sendFrame(t.frame(a,r),n)}ping(e,s,i){let n,a;if(typeof e=="string"?(n=Buffer.byteLength(e),a=!1):Gt(e)?(n=e.size,a=!1):(e=xt(e),n=e.length,a=xt.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let r={[ke]:n,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Gt(e)?this._state!==Be?this.enqueue([this.getBlobData,e,!1,r,i]):this.getBlobData(e,!1,r,i):this._state!==Be?this.enqueue([this.dispatch,e,!1,r,i]):this.sendFrame(t.frame(e,r),i)}pong(e,s,i){let n,a;if(typeof e=="string"?(n=Buffer.byteLength(e),a=!1):Gt(e)?(n=e.size,a=!1):(e=xt(e),n=e.length,a=xt.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let r={[ke]:n,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Gt(e)?this._state!==Be?this.enqueue([this.getBlobData,e,!1,r,i]):this.getBlobData(e,!1,r,i):this._state!==Be?this.enqueue([this.dispatch,e,!1,r,i]):this.sendFrame(t.frame(e,r),i)}send(e,s,i){let n=this._extensions[eu.extensionName],a=s.binary?2:1,r=s.compress,o,p;typeof e=="string"?(o=Buffer.byteLength(e),p=!1):Gt(e)?(o=e.size,p=!1):(e=xt(e),o=e.length,p=xt.readOnly),this._firstFragment?(this._firstFragment=!1,r&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(r=o>=n._threshold),this._compress=r):(r=!1,a=0),s.fin&&(this._firstFragment=!0);let l={[ke]:o,fin:s.fin,generateMask:this._generateMask,mask:s.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:p,rsv1:r};Gt(e)?this._state!==Be?this.enqueue([this.getBlobData,e,this._compress,l,i]):this.getBlobData(e,this._compress,l,i):this._state!==Be?this.enqueue([this.dispatch,e,this._compress,l,i]):this.dispatch(e,this._compress,l,i)}getBlobData(e,s,i,n){this._bufferedBytes+=i[ke],this._state=ug,e.arrayBuffer().then(a=>{if(this._socket.destroyed){let o=new Error("The socket was closed while the blob was being read");process.nextTick(ar,this,o,n);return}this._bufferedBytes-=i[ke];let r=xt(a);s?this.dispatch(r,s,i,n):(this._state=Be,this.sendFrame(t.frame(r,i),n),this.dequeue())}).catch(a=>{process.nextTick(dg,this,a,n)})}dispatch(e,s,i,n){if(!s){this.sendFrame(t.frame(e,i),n);return}let a=this._extensions[eu.extensionName];this._bufferedBytes+=i[ke],this._state=lg,a.compress(e,i.fin,(r,o)=>{if(this._socket.destroyed){let p=new Error("The socket was closed while data was being compressed");ar(this,p,n);return}this._bufferedBytes-=i[ke],this._state=Be,i.readOnly=!1,this.sendFrame(t.frame(o,i),n),this.dequeue()})}dequeue(){for(;this._state===Be&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ke],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ke],this._queue.push(e)}sendFrame(e,s){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],s),this._socket.uncork()):this._socket.write(e[0],s)}};su.exports=nr;function ar(t,e,s){typeof s=="function"&&s(e);for(let i=0;i<t._queue.length;i++){let n=t._queue[i],a=n[n.length-1];typeof a=="function"&&a(e)}}function dg(t,e,s){ar(t,e,s),t.onerror(e)}});var uu=b((hS,lu)=>{"use strict";var{kForOnEventAttribute:ni,kListener:or}=Je(),iu=Symbol("kCode"),nu=Symbol("kData"),au=Symbol("kError"),ru=Symbol("kMessage"),ou=Symbol("kReason"),Jt=Symbol("kTarget"),cu=Symbol("kType"),pu=Symbol("kWasClean"),Xe=class{constructor(e){this[Jt]=null,this[cu]=e}get target(){return this[Jt]}get type(){return this[cu]}};Object.defineProperty(Xe.prototype,"target",{enumerable:!0});Object.defineProperty(Xe.prototype,"type",{enumerable:!0});var vt=class extends Xe{constructor(e,s={}){super(e),this[iu]=s.code===void 0?0:s.code,this[ou]=s.reason===void 0?"":s.reason,this[pu]=s.wasClean===void 0?!1:s.wasClean}get code(){return this[iu]}get reason(){return this[ou]}get wasClean(){return this[pu]}};Object.defineProperty(vt.prototype,"code",{enumerable:!0});Object.defineProperty(vt.prototype,"reason",{enumerable:!0});Object.defineProperty(vt.prototype,"wasClean",{enumerable:!0});var Yt=class extends Xe{constructor(e,s={}){super(e),this[au]=s.error===void 0?null:s.error,this[ru]=s.message===void 0?"":s.message}get error(){return this[au]}get message(){return this[ru]}};Object.defineProperty(Yt.prototype,"error",{enumerable:!0});Object.defineProperty(Yt.prototype,"message",{enumerable:!0});var ai=class extends Xe{constructor(e,s={}){super(e),this[nu]=s.data===void 0?null:s.data}get data(){return this[nu]}};Object.defineProperty(ai.prototype,"data",{enumerable:!0});var mg={addEventListener(t,e,s={}){for(let n of this.listeners(t))if(!s[ni]&&n[or]===e&&!n[ni])return;let i;if(t==="message")i=function(a,r){let o=new ai("message",{data:r?a:a.toString()});o[Jt]=this,ln(e,this,o)};else if(t==="close")i=function(a,r){let o=new vt("close",{code:a,reason:r.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});o[Jt]=this,ln(e,this,o)};else if(t==="error")i=function(a){let r=new Yt("error",{error:a,message:a.message});r[Jt]=this,ln(e,this,r)};else if(t==="open")i=function(){let a=new Xe("open");a[Jt]=this,ln(e,this,a)};else return;i[ni]=!!s[ni],i[or]=e,s.once?this.once(t,i):this.on(t,i)},removeEventListener(t,e){for(let s of this.listeners(t))if(s[or]===e&&!s[ni]){this.removeListener(t,s);break}}};lu.exports={CloseEvent:vt,ErrorEvent:Yt,Event:Xe,EventTarget:mg,MessageEvent:ai};function ln(t,e,s){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,s):t.call(e,s)}});var cr=b((xS,du)=>{"use strict";var{tokenChars:ri}=Vt();function Ie(t,e,s){t[e]===void 0?t[e]=[s]:t[e].push(s)}function fg(t){let e=Object.create(null),s=Object.create(null),i=!1,n=!1,a=!1,r,o,p=-1,l=-1,c=-1,m=0;for(;m<t.length;m++)if(l=t.charCodeAt(m),r===void 0)if(c===-1&&ri[l]===1)p===-1&&(p=m);else if(m!==0&&(l===32||l===9))c===-1&&p!==-1&&(c=m);else if(l===59||l===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1&&(c=m);let v=t.slice(p,c);l===44?(Ie(e,v,s),s=Object.create(null)):r=v,p=c=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);else if(o===void 0)if(c===-1&&ri[l]===1)p===-1&&(p=m);else if(l===32||l===9)c===-1&&p!==-1&&(c=m);else if(l===59||l===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1&&(c=m),Ie(s,t.slice(p,c),!0),l===44&&(Ie(e,r,s),s=Object.create(null),r=void 0),p=c=-1}else if(l===61&&p!==-1&&c===-1)o=t.slice(p,m),p=c=-1;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(n){if(ri[l]!==1)throw new SyntaxError(`Unexpected character at index ${m}`);p===-1?p=m:i||(i=!0),n=!1}else if(a)if(ri[l]===1)p===-1&&(p=m);else if(l===34&&p!==-1)a=!1,c=m;else if(l===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(l===34&&t.charCodeAt(m-1)===61)a=!0;else if(c===-1&&ri[l]===1)p===-1&&(p=m);else if(p!==-1&&(l===32||l===9))c===-1&&(c=m);else if(l===59||l===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1&&(c=m);let v=t.slice(p,c);i&&(v=v.replace(/\\/g,""),i=!1),Ie(s,o,v),l===44&&(Ie(e,r,s),s=Object.create(null),r=void 0),o=void 0,p=c=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);if(p===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=m);let f=t.slice(p,c);return r===void 0?Ie(e,f,s):(o===void 0?Ie(s,f,!0):i?Ie(s,o,f.replace(/\\/g,"")):Ie(s,o,f),Ie(e,r,s)),e}function hg(t){return Object.keys(t).map(e=>{let s=t[e];return Array.isArray(s)||(s=[s]),s.map(i=>[e].concat(Object.keys(i).map(n=>{let a=i[n];return Array.isArray(a)||(a=[a]),a.map(r=>r===!0?n:`${n}=${r}`).join("; ")})).join("; ")).join(", ")}).join(", ")}du.exports={format:hg,parse:fg}});var fn=b((yS,Tu)=>{"use strict";var xg=E("events"),gg=E("https"),vg=E("http"),hu=E("net"),yg=E("tls"),{randomBytes:bg,createHash:_g}=E("crypto"),{Duplex:gS,Readable:vS}=E("stream"),{URL:pr}=E("url"),at=ii(),wg=ir(),Eg=rr(),{isBlob:Tg}=Vt(),{BINARY_TYPES:mu,EMPTY_BUFFER:un,GUID:Sg,kForOnEventAttribute:lr,kListener:kg,kStatusCode:Rg,kWebSocket:ie,NOOP:xu}=Je(),{EventTarget:{addEventListener:Cg,removeEventListener:Ag}}=uu(),{format:Og,parse:Pg}=cr(),{toBuffer:Ng}=ti(),Lg=30*1e3,gu=Symbol("kAborted"),ur=[8,13],Qe=["CONNECTING","OPEN","CLOSING","CLOSED"],qg=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,H=class t extends xg{constructor(e,s,i){super(),this._binaryType=mu[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=un,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,s===void 0?s=[]:Array.isArray(s)||(typeof s=="object"&&s!==null?(i=s,s=[]):s=[s]),vu(this,e,s,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){mu.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,s,i){let n=new wg({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),a=new Eg(e,this._extensions,i.generateMask);this._receiver=n,this._sender=a,this._socket=e,n[ie]=this,a[ie]=this,e[ie]=this,n.on("conclude",jg),n.on("drain",Ug),n.on("error",Ig),n.on("message",Fg),n.on("ping",Mg),n.on("pong",zg),a.onerror=$g,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),s.length>0&&e.unshift(s),e.on("close",_u),e.on("data",mn),e.on("end",wu),e.on("error",Eu),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[at.extensionName]&&this._extensions[at.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,s){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){_e(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,s,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),bu(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,s,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=s=void 0):typeof s=="function"&&(i=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){dr(this,e,i);return}s===void 0&&(s=!this._isServer),this._sender.ping(e||un,s,i)}pong(e,s,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=s=void 0):typeof s=="function"&&(i=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){dr(this,e,i);return}s===void 0&&(s=!this._isServer),this._sender.pong(e||un,s,i)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,s,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof s=="function"&&(i=s,s={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){dr(this,e,i);return}let n=N({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},s);this._extensions[at.extensionName]||(n.compress=!1),this._sender.send(e||un,n,i)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){_e(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(H,"CONNECTING",{enumerable:!0,value:Qe.indexOf("CONNECTING")});Object.defineProperty(H.prototype,"CONNECTING",{enumerable:!0,value:Qe.indexOf("CONNECTING")});Object.defineProperty(H,"OPEN",{enumerable:!0,value:Qe.indexOf("OPEN")});Object.defineProperty(H.prototype,"OPEN",{enumerable:!0,value:Qe.indexOf("OPEN")});Object.defineProperty(H,"CLOSING",{enumerable:!0,value:Qe.indexOf("CLOSING")});Object.defineProperty(H.prototype,"CLOSING",{enumerable:!0,value:Qe.indexOf("CLOSING")});Object.defineProperty(H,"CLOSED",{enumerable:!0,value:Qe.indexOf("CLOSED")});Object.defineProperty(H.prototype,"CLOSED",{enumerable:!0,value:Qe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(H.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(H.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[lr])return e[kg];return null},set(e){for(let s of this.listeners(t))if(s[lr]){this.removeListener(t,s);break}typeof e=="function"&&this.addEventListener(t,e,{[lr]:!0})}})});H.prototype.addEventListener=Cg;H.prototype.removeEventListener=Ag;Tu.exports=H;function vu(t,e,s,i){let n=re(N({allowSynchronousEvents:!0,autoPong:!0,protocolVersion:ur[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},i),{socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(t._autoPong=n.autoPong,!ur.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${ur.join(", ")})`);let a;if(e instanceof pr)a=e;else try{a=new pr(e)}catch(x){throw new SyntaxError(`Invalid URL: ${e}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),t._url=a.href;let r=a.protocol==="wss:",o=a.protocol==="ws+unix:",p;if(a.protocol!=="ws:"&&!r&&!o?p=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:o&&!a.pathname?p="The URL's pathname is empty":a.hash&&(p="The URL contains a fragment identifier"),p){let x=new SyntaxError(p);if(t._redirects===0)throw x;dn(t,x);return}let l=r?443:80,c=bg(16).toString("base64"),m=r?gg.request:vg.request,f=new Set,v;if(n.createConnection=n.createConnection||(r?Dg:Bg),n.defaultPort=n.defaultPort||l,n.port=a.port||l,n.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,n.headers=re(N({},n.headers),{"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"}),n.path=a.pathname+a.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(v=new at(n.perMessageDeflate!==!0?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=Og({[at.extensionName]:v.offer()})),s.length){for(let x of s){if(typeof x!="string"||!qg.test(x)||f.has(x))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.add(x)}n.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(a.username||a.password)&&(n.auth=`${a.username}:${a.password}`),o){let x=n.path.split(":");n.socketPath=x[0],n.path=x[1]}let h;if(n.followRedirects){if(t._redirects===0){t._originalIpc=o,t._originalSecure=r,t._originalHostOrSocketPath=o?n.socketPath:a.host;let x=i&&i.headers;if(i=re(N({},i),{headers:{}}),x)for(let[g,k]of Object.entries(x))i.headers[g.toLowerCase()]=k}else if(t.listenerCount("redirect")===0){let x=o?t._originalIpc?n.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:a.host===t._originalHostOrSocketPath;(!x||t._originalSecure&&!r)&&(delete n.headers.authorization,delete n.headers.cookie,x||delete n.headers.host,n.auth=void 0)}n.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),h=t._req=m(n),t._redirects&&t.emit("redirect",t.url,h)}else h=t._req=m(n);n.timeout&&h.on("timeout",()=>{_e(t,h,"Opening handshake has timed out")}),h.on("error",x=>{h===null||h[gu]||(h=t._req=null,dn(t,x))}),h.on("response",x=>{let g=x.headers.location,k=x.statusCode;if(g&&n.followRedirects&&k>=300&&k<400){if(++t._redirects>n.maxRedirects){_e(t,h,"Maximum redirects exceeded");return}h.abort();let R;try{R=new pr(g,e)}catch(y){let w=new SyntaxError(`Invalid URL: ${g}`);dn(t,w);return}vu(t,R,s,i)}else t.emit("unexpected-response",h,x)||_e(t,h,`Unexpected server response: ${x.statusCode}`)}),h.on("upgrade",(x,g,k)=>{if(t.emit("upgrade",x),t.readyState!==H.CONNECTING)return;h=t._req=null;let R=x.headers.upgrade;if(R===void 0||R.toLowerCase()!=="websocket"){_e(t,g,"Invalid Upgrade header");return}let y=_g("sha1").update(c+Sg).digest("base64");if(x.headers["sec-websocket-accept"]!==y){_e(t,g,"Invalid Sec-WebSocket-Accept header");return}let w=x.headers["sec-websocket-protocol"],I;if(w!==void 0?f.size?f.has(w)||(I="Server sent an invalid subprotocol"):I="Server sent a subprotocol but none was requested":f.size&&(I="Server sent no subprotocol"),I){_e(t,g,I);return}w&&(t._protocol=w);let P=x.headers["sec-websocket-extensions"];if(P!==void 0){if(!v){_e(t,g,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let j;try{j=Pg(P)}catch(ce){_e(t,g,"Invalid Sec-WebSocket-Extensions header");return}let M=Object.keys(j);if(M.length!==1||M[0]!==at.extensionName){_e(t,g,"Server indicated an extension that was not requested");return}try{v.accept(j[at.extensionName])}catch(ce){_e(t,g,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[at.extensionName]=v}t.setSocket(g,k,{allowSynchronousEvents:n.allowSynchronousEvents,generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}),n.finishRequest?n.finishRequest(h,t):h.end()}function dn(t,e){t._readyState=H.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function Bg(t){return t.path=t.socketPath,hu.connect(t)}function Dg(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=hu.isIP(t.host)?"":t.host),yg.connect(t)}function _e(t,e,s){t._readyState=H.CLOSING;let i=new Error(s);Error.captureStackTrace(i,_e),e.setHeader?(e[gu]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(dn,t,i)):(e.destroy(i),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function dr(t,e,s){if(e){let i=Tg(e)?e.size:Ng(e).length;t._socket?t._sender._bufferedBytes+=i:t._bufferedAmount+=i}if(s){let i=new Error(`WebSocket is not open: readyState ${t.readyState} (${Qe[t.readyState]})`);process.nextTick(s,i)}}function jg(t,e){let s=this[ie];s._closeFrameReceived=!0,s._closeMessage=e,s._closeCode=t,s._socket[ie]!==void 0&&(s._socket.removeListener("data",mn),process.nextTick(yu,s._socket),t===1005?s.close():s.close(t,e))}function Ug(){let t=this[ie];t.isPaused||t._socket.resume()}function Ig(t){let e=this[ie];e._socket[ie]!==void 0&&(e._socket.removeListener("data",mn),process.nextTick(yu,e._socket),e.close(t[Rg])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function fu(){this[ie].emitClose()}function Fg(t,e){this[ie].emit("message",t,e)}function Mg(t){let e=this[ie];e._autoPong&&e.pong(t,!this._isServer,xu),e.emit("ping",t)}function zg(t){this[ie].emit("pong",t)}function yu(t){t.resume()}function $g(t){let e=this[ie];e.readyState!==H.CLOSED&&(e.readyState===H.OPEN&&(e._readyState=H.CLOSING,bu(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function bu(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),Lg)}function _u(){let t=this[ie];this.removeListener("close",_u),this.removeListener("data",mn),this.removeListener("end",wu),t._readyState=H.CLOSING;let e;!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&(e=t._socket.read())!==null&&t._receiver.write(e),t._receiver.end(),this[ie]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",fu),t._receiver.on("finish",fu))}function mn(t){this[ie]._receiver.write(t)||this.pause()}function wu(){let t=this[ie];t._readyState=H.CLOSING,t._receiver.end(),this.end()}function Eu(){let t=this[ie];this.removeListener("error",Eu),this.on("error",xu),t&&(t._readyState=H.CLOSING,this.destroy())}});var Cu=b((wS,Ru)=>{"use strict";var _S=fn(),{Duplex:Hg}=E("stream");function Su(t){t.emit("close")}function Wg(){!this.destroyed&&this._writableState.finished&&this.destroy()}function ku(t){this.removeListener("error",ku),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function Vg(t,e){let s=!0,i=new Hg(re(N({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return t.on("message",function(a,r){let o=!r&&i._readableState.objectMode?a.toString():a;i.push(o)||t.pause()}),t.once("error",function(a){i.destroyed||(s=!1,i.destroy(a))}),t.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(n,a){if(t.readyState===t.CLOSED){a(n),process.nextTick(Su,i);return}let r=!1;t.once("error",function(p){r=!0,a(p)}),t.once("close",function(){r||a(n),process.nextTick(Su,i)}),s&&t.terminate()},i._final=function(n){if(t.readyState===t.CONNECTING){t.once("open",function(){i._final(n)});return}t._socket!==null&&(t._socket._writableState.finished?(n(),i._readableState.endEmitted&&i.destroy()):(t._socket.once("finish",function(){n()}),t.close()))},i._read=function(){t.isPaused&&t.resume()},i._write=function(n,a,r){if(t.readyState===t.CONNECTING){t.once("open",function(){i._write(n,a,r)});return}t.send(n,r)},i.on("end",Wg),i.on("error",ku),i}Ru.exports=Vg});var Ou=b((TS,Au)=>{"use strict";var{tokenChars:Gg}=Vt();function Kg(t){let e=new Set,s=-1,i=-1,n=0;for(n;n<t.length;n++){let r=t.charCodeAt(n);if(i===-1&&Gg[r]===1)s===-1&&(s=n);else if(n!==0&&(r===32||r===9))i===-1&&s!==-1&&(i=n);else if(r===44){if(s===-1)throw new SyntaxError(`Unexpected character at index ${n}`);i===-1&&(i=n);let o=t.slice(s,i);if(e.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);e.add(o),s=i=-1}else throw new SyntaxError(`Unexpected character at index ${n}`)}if(s===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let a=t.slice(s,n);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return e.add(a),e}Au.exports={parse:Kg}});var ju=b((kS,Du)=>{"use strict";var Jg=E("events"),hn=E("http"),{Duplex:SS}=E("stream"),{createHash:Yg}=E("crypto"),Pu=cr(),yt=ii(),Xg=Ou(),Qg=fn(),{GUID:Zg,kWebSocket:ev}=Je(),tv=/^[+/0-9A-Za-z]{22}==$/,Nu=0,Lu=1,Bu=2,mr=class extends Jg{constructor(e,s){if(super(),e=N({allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Qg},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=hn.createServer((i,n)=>{let a=hn.STATUS_CODES[426];n.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),n.end(a)}),this._server.listen(e.port,e.host,e.backlog,s)):e.server&&(this._server=e.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=sv(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,a,r)=>{this.handleUpgrade(n,a,r,i)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Nu}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Bu){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(oi,this);return}if(e&&this.once("close",e),this._state!==Lu)if(this._state=Lu,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(oi,this):process.nextTick(oi,this);else{let s=this._server;this._removeListeners(),this._removeListeners=this._server=null,s.close(()=>{oi(this)})}}shouldHandle(e){if(this.options.path){let s=e.url.indexOf("?");if((s!==-1?e.url.slice(0,s):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,s,i,n){s.on("error",qu);let a=e.headers["sec-websocket-key"],r=e.headers.upgrade,o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){bt(this,e,s,405,"Invalid HTTP method");return}if(r===void 0||r.toLowerCase()!=="websocket"){bt(this,e,s,400,"Invalid Upgrade header");return}if(a===void 0||!tv.test(a)){bt(this,e,s,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==13&&o!==8){bt(this,e,s,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){ci(s,400);return}let p=e.headers["sec-websocket-protocol"],l=new Set;if(p!==void 0)try{l=Xg.parse(p)}catch(f){bt(this,e,s,400,"Invalid Sec-WebSocket-Protocol header");return}let c=e.headers["sec-websocket-extensions"],m={};if(this.options.perMessageDeflate&&c!==void 0){let f=new yt(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let v=Pu.parse(c);v[yt.extensionName]&&(f.accept(v[yt.extensionName]),m[yt.extensionName]=f)}catch(v){bt(this,e,s,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(f,(v,h,x,g)=>{if(!v)return ci(s,h||401,x,g);this.completeUpgrade(m,a,l,e,s,i,n)});return}if(!this.options.verifyClient(f))return ci(s,401)}this.completeUpgrade(m,a,l,e,s,i,n)}completeUpgrade(e,s,i,n,a,r,o){if(!a.readable||!a.writable)return a.destroy();if(a[ev])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Nu)return ci(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Yg("sha1").update(s+Zg).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(i.size){let m=this.options.handleProtocols?this.options.handleProtocols(i,n):i.values().next().value;m&&(l.push(`Sec-WebSocket-Protocol: ${m}`),c._protocol=m)}if(e[yt.extensionName]){let m=e[yt.extensionName].params,f=Pu.format({[yt.extensionName]:[m]});l.push(`Sec-WebSocket-Extensions: ${f}`),c._extensions=e}this.emit("headers",l,n),a.write(l.concat(`\r
|
|
6
|
+
`).map(e=>e.trim()).join(" ")};mp.O=function(t){return this.inspectOpts.colors=this.useColors,qi.inspect(t,this.inspectOpts)}});var ye=b((Ub,aa)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?aa.exports=cp():aa.exports=fp()});var xp=b((Ib,hp)=>{"use strict";var xs;hp.exports=function(){if(!xs){try{xs=ye()("follow-redirects")}catch(t){}typeof xs!="function"&&(xs=function(){})}xs.apply(null,arguments)}});var _p=b((Fb,ga)=>{"use strict";var vs=E("url"),gs=vs.URL,Ch=E("http"),Ah=E("https"),la=E("stream").Writable,ua=E("assert"),gp=xp();(function(){var e=typeof process!="undefined",s=typeof window!="undefined"&&typeof document!="undefined",i=dt(Error.captureStackTrace);!e&&(s||!i)&&console.warn("The follow-redirects package should be excluded from browser builds.")})();var da=!1;try{ua(new gs(""))}catch(t){da=t.code==="ERR_INVALID_URL"}var Oh=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],ma=["abort","aborted","connect","error","socket","timeout"],fa=Object.create(null);ma.forEach(function(t){fa[t]=function(e,s,i){this._redirectable.emit(t,e,s,i)}});var oa=ys("ERR_INVALID_URL","Invalid URL",TypeError),ca=ys("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Ph=ys("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",ca),Nh=ys("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Lh=ys("ERR_STREAM_WRITE_AFTER_END","write after end"),qh=la.prototype.destroy||yp;function xe(t,e){la.call(this),this._sanitizeOptions(t),this._options=t,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var s=this;this._onNativeResponse=function(i){try{s._processResponse(i)}catch(n){s.emit("error",n instanceof ca?n:new ca({cause:n}))}},this._performRequest()}xe.prototype=Object.create(la.prototype);xe.prototype.abort=function(){xa(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};xe.prototype.destroy=function(t){return xa(this._currentRequest,t),qh.call(this,t),this};xe.prototype.write=function(t,e,s){if(this._ending)throw new Lh;if(!ut(t)&&!jh(t))throw new TypeError("data should be a string, Buffer or Uint8Array");if(dt(e)&&(s=e,e=null),t.length===0){s&&s();return}this._requestBodyLength+t.length<=this._options.maxBodyLength?(this._requestBodyLength+=t.length,this._requestBodyBuffers.push({data:t,encoding:e}),this._currentRequest.write(t,e,s)):(this.emit("error",new Nh),this.abort())};xe.prototype.end=function(t,e,s){if(dt(t)?(s=t,t=e=null):dt(e)&&(s=e,e=null),!t)this._ended=this._ending=!0,this._currentRequest.end(null,null,s);else{var i=this,n=this._currentRequest;this.write(t,e,function(){i._ended=!0,n.end(null,null,s)}),this._ending=!0}};xe.prototype.setHeader=function(t,e){this._options.headers[t]=e,this._currentRequest.setHeader(t,e)};xe.prototype.removeHeader=function(t){delete this._options.headers[t],this._currentRequest.removeHeader(t)};xe.prototype.setTimeout=function(t,e){var s=this;function i(r){r.setTimeout(t),r.removeListener("timeout",r.destroy),r.addListener("timeout",r.destroy)}function n(r){s._timeout&&clearTimeout(s._timeout),s._timeout=setTimeout(function(){s.emit("timeout"),a()},t),i(r)}function a(){s._timeout&&(clearTimeout(s._timeout),s._timeout=null),s.removeListener("abort",a),s.removeListener("error",a),s.removeListener("response",a),s.removeListener("close",a),e&&s.removeListener("timeout",e),s.socket||s._currentRequest.removeListener("socket",n)}return e&&this.on("timeout",e),this.socket?n(this.socket):this._currentRequest.once("socket",n),this.on("socket",i),this.on("abort",a),this.on("error",a),this.on("response",a),this.on("close",a),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(t){xe.prototype[t]=function(e,s){return this._currentRequest[t](e,s)}});["aborted","connection","socket"].forEach(function(t){Object.defineProperty(xe.prototype,t,{get:function(){return this._currentRequest[t]}})});xe.prototype._sanitizeOptions=function(t){if(t.headers||(t.headers={}),t.host&&(t.hostname||(t.hostname=t.host),delete t.host),!t.pathname&&t.path){var e=t.path.indexOf("?");e<0?t.pathname=t.path:(t.pathname=t.path.substring(0,e),t.search=t.path.substring(e))}};xe.prototype._performRequest=function(){var t=this._options.protocol,e=this._options.nativeProtocols[t];if(!e)throw new TypeError("Unsupported protocol "+t);if(this._options.agents){var s=t.slice(0,-1);this._options.agent=this._options.agents[s]}var i=this._currentRequest=e.request(this._options,this._onNativeResponse);i._redirectable=this;for(var n of ma)i.on(n,fa[n]);if(this._currentUrl=/^\//.test(this._options.path)?vs.format(this._options):this._options.path,this._isRedirect){var a=0,r=this,o=this._requestBodyBuffers;(function p(l){if(i===r._currentRequest)if(l)r.emit("error",l);else if(a<o.length){var c=o[a++];i.finished||i.write(c.data,c.encoding,p)}else r._ended&&i.end()})()}};xe.prototype._processResponse=function(t){var e=t.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:t.headers,statusCode:e});var s=t.headers.location;if(!s||this._options.followRedirects===!1||e<300||e>=400){t.responseUrl=this._currentUrl,t.redirects=this._redirects,this.emit("response",t),this._requestBodyBuffers=[];return}if(xa(this._currentRequest),t.destroy(),++this._redirectCount>this._options.maxRedirects)throw new Ph;var i,n=this._options.beforeRedirect;n&&(i=Object.assign({Host:t.req.getHeader("host")},this._options.headers));var a=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],ra(/^content-/i,this._options.headers));var r=ra(/^host$/i,this._options.headers),o=ha(this._currentUrl),p=r||o.host,l=/^\w+:/.test(s)?this._currentUrl:vs.format(Object.assign(o,{host:p})),c=Bh(s,l);if(gp("redirecting to",c.href),this._isRedirect=!0,pa(c,this._options),(c.protocol!==o.protocol&&c.protocol!=="https:"||c.host!==p&&!Dh(c.host,p))&&ra(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),dt(n)){var m={headers:t.headers,statusCode:e},f={url:l,method:a,headers:i};n(this._options,m,f),this._sanitizeOptions(this._options)}this._performRequest()};function vp(t){var e={maxRedirects:21,maxBodyLength:10485760},s={};return Object.keys(t).forEach(function(i){var n=i+":",a=s[n]=t[i],r=e[i]=Object.create(a);function o(l,c,m){return Uh(l)?l=pa(l):ut(l)?l=pa(ha(l)):(m=c,c=bp(l),l={protocol:n}),dt(c)&&(m=c,c=null),c=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},l,c),c.nativeProtocols=s,!ut(c.host)&&!ut(c.hostname)&&(c.hostname="::1"),ua.equal(c.protocol,n,"protocol mismatch"),gp("options",c),new xe(c,m)}function p(l,c,m){var f=r.request(l,c,m);return f.end(),f}Object.defineProperties(r,{request:{value:o,configurable:!0,enumerable:!0,writable:!0},get:{value:p,configurable:!0,enumerable:!0,writable:!0}})}),e}function yp(){}function ha(t){var e;if(da)e=new gs(t);else if(e=bp(vs.parse(t)),!ut(e.protocol))throw new oa({input:t});return e}function Bh(t,e){return da?new gs(t,e):ha(vs.resolve(e,t))}function bp(t){if(/^\[/.test(t.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(t.hostname))throw new oa({input:t.href||t});if(/^\[/.test(t.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(t.host))throw new oa({input:t.href||t});return t}function pa(t,e){var s=e||{};for(var i of Oh)s[i]=t[i];return s.hostname.startsWith("[")&&(s.hostname=s.hostname.slice(1,-1)),s.port!==""&&(s.port=Number(s.port)),s.path=s.search?s.pathname+s.search:s.pathname,s}function ra(t,e){var s;for(var i in e)t.test(i)&&(s=e[i],delete e[i]);return s===null||typeof s=="undefined"?void 0:String(s).trim()}function ys(t,e,s){function i(n){dt(Error.captureStackTrace)&&Error.captureStackTrace(this,this.constructor),Object.assign(this,n||{}),this.code=t,this.message=this.cause?e+": "+this.cause.message:e}return i.prototype=new(s||Error),Object.defineProperties(i.prototype,{constructor:{value:i,enumerable:!1},name:{value:"Error ["+t+"]",enumerable:!1}}),i}function xa(t,e){for(var s of ma)t.removeListener(s,fa[s]);t.on("error",yp),t.destroy(e)}function Dh(t,e){ua(ut(t)&&ut(e));var s=t.length-e.length-1;return s>0&&t[s]==="."&&t.endsWith(e)}function ut(t){return typeof t=="string"||t instanceof String}function dt(t){return typeof t=="function"}function jh(t){return typeof t=="object"&&"length"in t}function Uh(t){return gs&&t instanceof gs}ga.exports=vp({http:Ch,https:Ah});ga.exports.wrap=vp});var al=b((UE,nl)=>{"use strict";var xx=new Set(["ENOTFOUND","ENETUNREACH","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_CRL","UNABLE_TO_DECRYPT_CERT_SIGNATURE","UNABLE_TO_DECRYPT_CRL_SIGNATURE","UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY","CERT_SIGNATURE_FAILURE","CRL_SIGNATURE_FAILURE","CERT_NOT_YET_VALID","CERT_HAS_EXPIRED","CRL_NOT_YET_VALID","CRL_HAS_EXPIRED","ERROR_IN_CERT_NOT_BEFORE_FIELD","ERROR_IN_CERT_NOT_AFTER_FIELD","ERROR_IN_CRL_LAST_UPDATE_FIELD","ERROR_IN_CRL_NEXT_UPDATE_FIELD","OUT_OF_MEM","DEPTH_ZERO_SELF_SIGNED_CERT","SELF_SIGNED_CERT_IN_CHAIN","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","UNABLE_TO_VERIFY_LEAF_SIGNATURE","CERT_CHAIN_TOO_LONG","CERT_REVOKED","INVALID_CA","PATH_LENGTH_EXCEEDED","INVALID_PURPOSE","CERT_UNTRUSTED","CERT_REJECTED","HOSTNAME_MISMATCH"]);nl.exports=t=>!xx.has(t&&t.code)});var fl=b((ME,ml)=>{"use strict";var zt=E("fs"),dl=E("url"),Cx=E("child_process").spawn;ml.exports=Ia;Ia.XMLHttpRequest=Ia;function Ia(t){"use strict";t=t||{};var e=this,s=E("http"),i=E("https"),n,a,r={},o=!1,p={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},l=Object.assign({},p),c=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],m=["TRACE","TRACK","CONNECT"],f=!1,v=!1,h=!1,x={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),this.status=null,this.statusText=null;var g=function(y){return o||y&&c.indexOf(y.toLowerCase())===-1},k=function(y){return y&&m.indexOf(y)===-1};this.open=function(y,w,I,P,j){if(this.abort(),v=!1,h=!1,!k(y))throw new Error("SecurityError: Request method not allowed");r={method:y,url:w.toString(),async:typeof I!="boolean"?!0:I,user:P||null,password:j||null},R(this.OPENED)},this.setDisableHeaderCheck=function(y){o=y},this.setRequestHeader=function(y,w){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!g(y))return console.warn('Refused to set unsafe header "'+y+'"'),!1;if(f)throw new Error("INVALID_STATE_ERR: send flag is true");return l[y]=w,!0},this.getResponseHeader=function(y){return typeof y=="string"&&this.readyState>this.OPENED&&a.headers[y.toLowerCase()]&&!v?a.headers[y.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||v)return"";var y="";for(var w in a.headers)w!=="set-cookie"&&w!=="set-cookie2"&&(y+=w+": "+a.headers[w]+`\r
|
|
7
|
+
`);return y.substr(0,y.length-2)},this.getRequestHeader=function(y){return typeof y=="string"&&l[y]?l[y]:""},this.send=function(y){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(f)throw new Error("INVALID_STATE_ERR: send has already been called");var w=!1,I=!1,P=dl.parse(r.url),j;switch(P.protocol){case"https:":w=!0;case"http:":j=P.hostname;break;case"file:":I=!0;break;case void 0:case"":j="localhost";break;default:throw new Error("Protocol not supported.")}if(I){if(r.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(r.async)zt.readFile(unescape(P.pathname),function(L,Z){L?e.handleError(L,L.errno||-1):(e.status=200,e.responseText=Z.toString("utf8"),e.response=Z,R(e.DONE))});else try{this.response=zt.readFileSync(unescape(P.pathname)),this.responseText=this.response.toString("utf8"),this.status=200,R(e.DONE)}catch(L){this.handleError(L,L.errno||-1)}return}var M=P.port||(w?443:80),ce=P.pathname+(P.search?P.search:"");if(l.Host=j,w&&M===443||M===80||(l.Host+=":"+P.port),r.user){typeof r.password=="undefined"&&(r.password="");var De=new Buffer(r.user+":"+r.password);l.Authorization="Basic "+De.toString("base64")}if(r.method==="GET"||r.method==="HEAD")y=null;else if(y){l["Content-Length"]=Buffer.isBuffer(y)?y.length:Buffer.byteLength(y);var Fe=Object.keys(l);Fe.some(function(L){return L.toLowerCase()==="content-type"})||(l["Content-Type"]="text/plain;charset=UTF-8")}else r.method==="POST"&&(l["Content-Length"]=0);var Re=t.agent||!1,K={host:j,port:M,path:ce,method:r.method,headers:l,agent:Re};if(w&&(K.pfx=t.pfx,K.key=t.key,K.passphrase=t.passphrase,K.cert=t.cert,K.ca=t.ca,K.ciphers=t.ciphers,K.rejectUnauthorized=t.rejectUnauthorized!==!1),v=!1,r.async){var ge=w?i.request:s.request;f=!0,e.dispatchEvent("readystatechange");var Ee=function(L){if(a=L,a.statusCode===302||a.statusCode===303||a.statusCode===307){r.url=a.headers.location;var Z=dl.parse(r.url);j=Z.hostname;var ae={hostname:Z.hostname,port:Z.port,path:Z.path,method:a.statusCode===303?"GET":r.method,headers:l};w&&(ae.pfx=t.pfx,ae.key=t.key,ae.passphrase=t.passphrase,ae.cert=t.cert,ae.ca=t.ca,ae.ciphers=t.ciphers,ae.rejectUnauthorized=t.rejectUnauthorized!==!1),n=ge(ae,Ee).on("error",J),n.end();return}R(e.HEADERS_RECEIVED),e.status=a.statusCode,a.on("data",function(ee){if(ee){var Et=Buffer.from(ee);e.response=Buffer.concat([e.response,Et])}f&&R(e.LOADING)}),a.on("end",function(){f&&(f=!1,R(e.DONE),e.responseText=e.response.toString("utf8"))}),a.on("error",function(ee){e.handleError(ee)})},J=function(L){if(n.reusedSocket&&L.code==="ECONNRESET")return ge(K,Ee).on("error",J);e.handleError(L)};n=ge(K,Ee).on("error",J),t.autoUnref&&n.on("socket",L=>{L.unref()}),y&&n.write(y),n.end(),e.dispatchEvent("loadstart")}else{var W=".node-xmlhttprequest-content-"+process.pid,Y=".node-xmlhttprequest-sync-"+process.pid;zt.writeFileSync(Y,"","utf8");for(var Ze="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(w?"s":"")+".request;var options = "+JSON.stringify(K)+";var responseText = '';var responseData = Buffer.alloc(0);var req = doRequest(options, function(response) {response.on('data', function(chunk) { var data = Buffer.from(chunk); responseText += data.toString('utf8'); responseData = Buffer.concat([responseData, data]);});response.on('end', function() {fs.writeFileSync('"+W+"', JSON.stringify({err: null, data: {statusCode: response.statusCode, headers: response.headers, text: responseText, data: responseData.toString('base64')}}), 'utf8');fs.unlinkSync('"+Y+"');});response.on('error', function(error) {fs.writeFileSync('"+W+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Y+"');});}).on('error', function(error) {fs.writeFileSync('"+W+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+Y+"');});"+(y?"req.write('"+JSON.stringify(y).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",C=Cx(process.argv[0],["-e",Ze]),T;zt.existsSync(Y););if(e.responseText=zt.readFileSync(W,"utf8"),C.stdin.end(),zt.unlinkSync(W),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var F=JSON.parse(e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,""));e.handleError(F,503)}else{e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1");var ne=JSON.parse(e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"));a={statusCode:e.status,headers:ne.data.headers},e.responseText=ne.data.text,e.response=Buffer.from(ne.data.data,"base64"),R(e.DONE,!0)}}},this.handleError=function(y,w){this.status=w||0,this.statusText=y,this.responseText=y.stack,v=!0,R(this.DONE)},this.abort=function(){n&&(n.abort(),n=null),l=Object.assign({},p),this.responseText="",this.responseXML="",this.response=Buffer.alloc(0),v=h=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||f)&&this.readyState!==this.DONE&&(f=!1,R(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(y,w){y in x||(x[y]=[]),x[y].push(w)},this.removeEventListener=function(y,w){y in x&&(x[y]=x[y].filter(function(I){return I!==w}))},this.dispatchEvent=function(y){if(typeof e["on"+y]=="function"&&(this.readyState===this.DONE&&r.async?setTimeout(function(){e["on"+y]()},0):e["on"+y]()),y in x)for(let w=0,I=x[y].length;w<I;w++)this.readyState===this.DONE?setTimeout(function(){x[y][w].call(e)},0):x[y][w].call(e)};var R=function(y){if(!(e.readyState===y||e.readyState===e.UNSENT&&h)&&(e.readyState=y,(r.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let w;h?w="abort":v?w="error":w="load",e.dispatchEvent(w),e.dispatchEvent("loadend")}}}});var Je=b((_T,Dl)=>{"use strict";var ql=["nodebuffer","arraybuffer","fragments"],Bl=typeof Blob!="undefined";Bl&&ql.push("blob");Dl.exports={BINARY_TYPES:ql,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Bl,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var As=b((wT,Ji)=>{"use strict";var{EMPTY_BUFFER:Ix}=Je(),Va=Buffer[Symbol.species];function Fx(t,e){if(t.length===0)return Ix;if(t.length===1)return t[0];let s=Buffer.allocUnsafe(e),i=0;for(let n=0;n<t.length;n++){let a=t[n];s.set(a,i),i+=a.length}return i<e?new Va(s.buffer,s.byteOffset,i):s}function jl(t,e,s,i,n){for(let a=0;a<n;a++)s[i+a]=t[a]^e[a&3]}function Ul(t,e){for(let s=0;s<t.length;s++)t[s]^=e[s&3]}function Mx(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function Ga(t){if(Ga.readOnly=!0,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Va(t):ArrayBuffer.isView(t)?e=new Va(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),Ga.readOnly=!1),e}Ji.exports={concat:Fx,mask:jl,toArrayBuffer:Mx,toBuffer:Ga,unmask:Ul};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=E("bufferutil");Ji.exports.mask=function(e,s,i,n,a){a<48?jl(e,s,i,n,a):t.mask(e,s,i,n,a)},Ji.exports.unmask=function(e,s){e.length<32?Ul(e,s):t.unmask(e,s)}}catch(t){}});var Ml=b((ET,Fl)=>{"use strict";var Il=Symbol("kDone"),Ka=Symbol("kRun"),Ja=class{constructor(e){this[Il]=()=>{this.pending--,this[Ka]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Ka]()}[Ka](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Il])}}};Fl.exports=Ja});var Ps=b((TT,Wl)=>{"use strict";var Os=E("zlib"),zl=As(),zx=Ml(),{kStatusCode:$l}=Je(),$x=Buffer[Symbol.species],Hx=Buffer.from([0,0,255,255]),Xi=Symbol("permessage-deflate"),Ye=Symbol("total-length"),Ht=Symbol("callback"),nt=Symbol("buffers"),Wt=Symbol("error"),Yi,Ya=class{constructor(e,s,i){if(this._maxPayload=i|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!s,this._deflate=null,this._inflate=null,this.params=null,!Yi){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Yi=new zx(n)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Ht];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let s=this._options,i=e.find(n=>!(s.serverNoContextTakeover===!1&&n.server_no_context_takeover||n.server_max_window_bits&&(s.serverMaxWindowBits===!1||typeof s.serverMaxWindowBits=="number"&&s.serverMaxWindowBits>n.server_max_window_bits)||typeof s.clientMaxWindowBits=="number"&&!n.client_max_window_bits));if(!i)throw new Error("None of the extension offers can be accepted");return s.serverNoContextTakeover&&(i.server_no_context_takeover=!0),s.clientNoContextTakeover&&(i.client_no_context_takeover=!0),typeof s.serverMaxWindowBits=="number"&&(i.server_max_window_bits=s.serverMaxWindowBits),typeof s.clientMaxWindowBits=="number"?i.client_max_window_bits=s.clientMaxWindowBits:(i.client_max_window_bits===!0||s.clientMaxWindowBits===!1)&&delete i.client_max_window_bits,i}acceptAsClient(e){let s=e[0];if(this._options.clientNoContextTakeover===!1&&s.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!s.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(s.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&s.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return s}normalizeParams(e){return e.forEach(s=>{Object.keys(s).forEach(i=>{let n=s[i];if(n.length>1)throw new Error(`Parameter "${i}" must have only a single value`);if(n=n[0],i==="client_max_window_bits"){if(n!==!0){let a=+n;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${n}`);n=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${i}": ${n}`)}else if(i==="server_max_window_bits"){let a=+n;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${i}": ${n}`);n=a}else if(i==="client_no_context_takeover"||i==="server_no_context_takeover"){if(n!==!0)throw new TypeError(`Invalid value for parameter "${i}": ${n}`)}else throw new Error(`Unknown parameter "${i}"`);s[i]=n})}),e}decompress(e,s,i){Yi.add(n=>{this._decompress(e,s,(a,r)=>{n(),i(a,r)})})}compress(e,s,i){Yi.add(n=>{this._compress(e,s,(a,r)=>{n(),i(a,r)})})}_decompress(e,s,i){let n=this._isServer?"client":"server";if(!this._inflate){let a=`${n}_max_window_bits`,r=typeof this.params[a]!="number"?Os.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Os.createInflateRaw(re(N({},this._options.zlibInflateOptions),{windowBits:r})),this._inflate[Xi]=this,this._inflate[Ye]=0,this._inflate[nt]=[],this._inflate.on("error",Vx),this._inflate.on("data",Hl)}this._inflate[Ht]=i,this._inflate.write(e),s&&this._inflate.write(Hx),this._inflate.flush(()=>{let a=this._inflate[Wt];if(a){this._inflate.close(),this._inflate=null,i(a);return}let r=zl.concat(this._inflate[nt],this._inflate[Ye]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ye]=0,this._inflate[nt]=[],s&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),i(null,r)})}_compress(e,s,i){let n=this._isServer?"server":"client";if(!this._deflate){let a=`${n}_max_window_bits`,r=typeof this.params[a]!="number"?Os.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Os.createDeflateRaw(re(N({},this._options.zlibDeflateOptions),{windowBits:r})),this._deflate[Ye]=0,this._deflate[nt]=[],this._deflate.on("data",Wx)}this._deflate[Ht]=i,this._deflate.write(e),this._deflate.flush(Os.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=zl.concat(this._deflate[nt],this._deflate[Ye]);s&&(a=new $x(a.buffer,a.byteOffset,a.length-4)),this._deflate[Ht]=null,this._deflate[Ye]=0,this._deflate[nt]=[],s&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),i(null,a)})}};Wl.exports=Ya;function Wx(t){this[nt].push(t),this[Ye]+=t.length}function Hl(t){if(this[Ye]+=t.length,this[Xi]._maxPayload<1||this[Ye]<=this[Xi]._maxPayload){this[nt].push(t);return}this[Wt]=new RangeError("Max payload size exceeded"),this[Wt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Wt][$l]=1009,this.removeListener("data",Hl),this.reset()}function Vx(t){if(this[Xi]._inflate=null,this[Wt]){this[Ht](this[Wt]);return}t[$l]=1007,this[Ht](t)}});var Vt=b((kT,Qi)=>{"use strict";var{isUtf8:Vl}=E("buffer"),{hasBlob:Gx}=Je(),Kx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Jx(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Xa(t){let e=t.length,s=0;for(;s<e;)if((t[s]&128)===0)s++;else if((t[s]&224)===192){if(s+1===e||(t[s+1]&192)!==128||(t[s]&254)===192)return!1;s+=2}else if((t[s]&240)===224){if(s+2>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||t[s]===224&&(t[s+1]&224)===128||t[s]===237&&(t[s+1]&224)===160)return!1;s+=3}else if((t[s]&248)===240){if(s+3>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||(t[s+3]&192)!==128||t[s]===240&&(t[s+1]&240)===128||t[s]===244&&t[s+1]>143||t[s]>244)return!1;s+=4}else return!1;return!0}function Yx(t){return Gx&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}Qi.exports={isBlob:Yx,isValidStatusCode:Jx,isValidUTF8:Xa,tokenChars:Kx};if(Vl)Qi.exports.isValidUTF8=function(t){return t.length<24?Xa(t):Vl(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=E("utf-8-validate");Qi.exports.isValidUTF8=function(e){return e.length<32?Xa(e):t(e)}}catch(t){}});var sr=b((RT,Zl)=>{"use strict";var{Writable:Xx}=E("stream"),Gl=Ps(),{BINARY_TYPES:Qx,EMPTY_BUFFER:Kl,kStatusCode:Zx,kWebSocket:eg}=Je(),{concat:Qa,toArrayBuffer:tg,unmask:sg}=As(),{isValidStatusCode:ig,isValidUTF8:Jl}=Vt(),Zi=Buffer[Symbol.species],Se=0,Yl=1,Xl=2,Ql=3,Za=4,er=5,en=6,tr=class extends Xx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Qx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[eg]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Se}_write(e,s,i){if(this._opcode===8&&this._state==Se)return i();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(i)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let i=this._buffers[0];return this._buffers[0]=new Zi(i.buffer,i.byteOffset+e,i.length-e),new Zi(i.buffer,i.byteOffset,e)}let s=Buffer.allocUnsafe(e);do{let i=this._buffers[0],n=s.length-e;e>=i.length?s.set(this._buffers.shift(),n):(s.set(new Uint8Array(i.buffer,i.byteOffset,e),n),this._buffers[0]=new Zi(i.buffer,i.byteOffset+e,i.length-e)),e-=i.length}while(e>0);return s}startLoop(e){this._loop=!0;do switch(this._state){case Se:this.getInfo(e);break;case Yl:this.getPayloadLength16(e);break;case Xl:this.getPayloadLength64(e);break;case Ql:this.getMask();break;case Za:this.getData(e);break;case er:case en:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let s=this.consume(2);if((s[0]&48)!==0){let n=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(n);return}let i=(s[0]&64)===64;if(i&&!this._extensions[Gl.extensionName]){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._fin=(s[0]&128)===128,this._opcode=s[0]&15,this._payloadLength=s[1]&127,this._opcode===0){if(i){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(!this._fragmented){let n=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}this._compressed=i}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let n=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(n);return}if(i){let n=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(n);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let n=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(n);return}}else{let n=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(n);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(s[1]&128)===128,this._isServer){if(!this._masked){let n=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(n);return}}else if(this._masked){let n=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(n);return}this._payloadLength===126?this._state=Yl:this._payloadLength===127?this._state=Xl:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let s=this.consume(8),i=s.readUInt32BE(0);if(i>Math.pow(2,21)-1){let n=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(n);return}this._payloadLength=i*Math.pow(2,32)+s.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(s);return}this._masked?this._state=Ql:this._state=Za}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Za}getData(e){let s=Kl;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}s=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&sg(s,this._mask)}if(this._opcode>7){this.controlMessage(s,e);return}if(this._compressed){this._state=er,this.decompress(s,e);return}s.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(s)),this.dataMessage(e)}decompress(e,s){this._extensions[Gl.extensionName].decompress(e,this._fin,(n,a)=>{if(n)return s(n);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");s(r);return}this._fragments.push(a)}this.dataMessage(s),this._state===Se&&this.startLoop(s)})}dataMessage(e){if(!this._fin){this._state=Se;return}let s=this._messageLength,i=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let n;this._binaryType==="nodebuffer"?n=Qa(i,s):this._binaryType==="arraybuffer"?n=tg(Qa(i,s)):this._binaryType==="blob"?n=new Blob(i):n=i,this._allowSynchronousEvents?(this.emit("message",n,!0),this._state=Se):(this._state=en,setImmediate(()=>{this.emit("message",n,!0),this._state=Se,this.startLoop(e)}))}else{let n=Qa(i,s);if(!this._skipUTF8Validation&&!Jl(n)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(a);return}this._state===er||this._allowSynchronousEvents?(this.emit("message",n,!1),this._state=Se):(this._state=en,setImmediate(()=>{this.emit("message",n,!1),this._state=Se,this.startLoop(e)}))}}controlMessage(e,s){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Kl),this.end();else{let i=e.readUInt16BE(0);if(!ig(i)){let a=this.createError(RangeError,`invalid status code ${i}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");s(a);return}let n=new Zi(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Jl(n)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");s(a);return}this._loop=!1,this.emit("conclude",i,n),this.end()}this._state=Se;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=Se):(this._state=en,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=Se,this.startLoop(s)}))}createError(e,s,i,n,a){this._loop=!1,this._errored=!0;let r=new e(i?`Invalid WebSocket frame: ${s}`:s);return Error.captureStackTrace(r,this.createError),r.code=a,r[Zx]=n,r}};Zl.exports=tr});var ar=b((AT,su)=>{"use strict";var{Duplex:CT}=E("stream"),{randomFillSync:ng}=E("crypto"),eu=Ps(),{EMPTY_BUFFER:ag,kWebSocket:rg,NOOP:og}=Je(),{isBlob:Gt,isValidStatusCode:cg}=Vt(),{mask:tu,toBuffer:ht}=As(),ke=Symbol("kByteLength"),pg=Buffer.alloc(4),tn=8*1024,xt,Kt=tn,Be=0,lg=1,ug=2,ir=class t{constructor(e,s,i){this._extensions=s||{},i&&(this._generateMask=i,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=Be,this.onerror=og,this[rg]=void 0}static frame(e,s){let i,n=!1,a=2,r=!1;s.mask&&(i=s.maskBuffer||pg,s.generateMask?s.generateMask(i):(Kt===tn&&(xt===void 0&&(xt=Buffer.alloc(tn)),ng(xt,0,tn),Kt=0),i[0]=xt[Kt++],i[1]=xt[Kt++],i[2]=xt[Kt++],i[3]=xt[Kt++]),r=(i[0]|i[1]|i[2]|i[3])===0,a=6);let o;typeof e=="string"?(!s.mask||r)&&s[ke]!==void 0?o=s[ke]:(e=Buffer.from(e),o=e.length):(o=e.length,n=s.mask&&s.readOnly&&!r);let p=o;o>=65536?(a+=8,p=127):o>125&&(a+=2,p=126);let l=Buffer.allocUnsafe(n?o+a:a);return l[0]=s.fin?s.opcode|128:s.opcode,s.rsv1&&(l[0]|=64),l[1]=p,p===126?l.writeUInt16BE(o,2):p===127&&(l[2]=l[3]=0,l.writeUIntBE(o,4,6)),s.mask?(l[1]|=128,l[a-4]=i[0],l[a-3]=i[1],l[a-2]=i[2],l[a-1]=i[3],r?[l,e]:n?(tu(e,i,l,a,o),[l]):(tu(e,i,e,0,o),[l,e])):[l,e]}close(e,s,i,n){let a;if(e===void 0)a=ag;else{if(typeof e!="number"||!cg(e))throw new TypeError("First argument must be a valid error code number");if(s===void 0||!s.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(e,0);else{let o=Buffer.byteLength(s);if(o>123)throw new RangeError("The message must not be greater than 123 bytes");a=Buffer.allocUnsafe(2+o),a.writeUInt16BE(e,0),typeof s=="string"?a.write(s,2):a.set(s,2)}}let r={[ke]:a.length,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==Be?this.enqueue([this.dispatch,a,!1,r,n]):this.sendFrame(t.frame(a,r),n)}ping(e,s,i){let n,a;if(typeof e=="string"?(n=Buffer.byteLength(e),a=!1):Gt(e)?(n=e.size,a=!1):(e=ht(e),n=e.length,a=ht.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let r={[ke]:n,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Gt(e)?this._state!==Be?this.enqueue([this.getBlobData,e,!1,r,i]):this.getBlobData(e,!1,r,i):this._state!==Be?this.enqueue([this.dispatch,e,!1,r,i]):this.sendFrame(t.frame(e,r),i)}pong(e,s,i){let n,a;if(typeof e=="string"?(n=Buffer.byteLength(e),a=!1):Gt(e)?(n=e.size,a=!1):(e=ht(e),n=e.length,a=ht.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let r={[ke]:n,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Gt(e)?this._state!==Be?this.enqueue([this.getBlobData,e,!1,r,i]):this.getBlobData(e,!1,r,i):this._state!==Be?this.enqueue([this.dispatch,e,!1,r,i]):this.sendFrame(t.frame(e,r),i)}send(e,s,i){let n=this._extensions[eu.extensionName],a=s.binary?2:1,r=s.compress,o,p;typeof e=="string"?(o=Buffer.byteLength(e),p=!1):Gt(e)?(o=e.size,p=!1):(e=ht(e),o=e.length,p=ht.readOnly),this._firstFragment?(this._firstFragment=!1,r&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(r=o>=n._threshold),this._compress=r):(r=!1,a=0),s.fin&&(this._firstFragment=!0);let l={[ke]:o,fin:s.fin,generateMask:this._generateMask,mask:s.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:p,rsv1:r};Gt(e)?this._state!==Be?this.enqueue([this.getBlobData,e,this._compress,l,i]):this.getBlobData(e,this._compress,l,i):this._state!==Be?this.enqueue([this.dispatch,e,this._compress,l,i]):this.dispatch(e,this._compress,l,i)}getBlobData(e,s,i,n){this._bufferedBytes+=i[ke],this._state=ug,e.arrayBuffer().then(a=>{if(this._socket.destroyed){let o=new Error("The socket was closed while the blob was being read");process.nextTick(nr,this,o,n);return}this._bufferedBytes-=i[ke];let r=ht(a);s?this.dispatch(r,s,i,n):(this._state=Be,this.sendFrame(t.frame(r,i),n),this.dequeue())}).catch(a=>{process.nextTick(dg,this,a,n)})}dispatch(e,s,i,n){if(!s){this.sendFrame(t.frame(e,i),n);return}let a=this._extensions[eu.extensionName];this._bufferedBytes+=i[ke],this._state=lg,a.compress(e,i.fin,(r,o)=>{if(this._socket.destroyed){let p=new Error("The socket was closed while data was being compressed");nr(this,p,n);return}this._bufferedBytes-=i[ke],this._state=Be,i.readOnly=!1,this.sendFrame(t.frame(o,i),n),this.dequeue()})}dequeue(){for(;this._state===Be&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ke],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ke],this._queue.push(e)}sendFrame(e,s){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],s),this._socket.uncork()):this._socket.write(e[0],s)}};su.exports=ir;function nr(t,e,s){typeof s=="function"&&s(e);for(let i=0;i<t._queue.length;i++){let n=t._queue[i],a=n[n.length-1];typeof a=="function"&&a(e)}}function dg(t,e,s){nr(t,e,s),t.onerror(e)}});var uu=b((OT,lu)=>{"use strict";var{kForOnEventAttribute:Ns,kListener:rr}=Je(),iu=Symbol("kCode"),nu=Symbol("kData"),au=Symbol("kError"),ru=Symbol("kMessage"),ou=Symbol("kReason"),Jt=Symbol("kTarget"),cu=Symbol("kType"),pu=Symbol("kWasClean"),Xe=class{constructor(e){this[Jt]=null,this[cu]=e}get target(){return this[Jt]}get type(){return this[cu]}};Object.defineProperty(Xe.prototype,"target",{enumerable:!0});Object.defineProperty(Xe.prototype,"type",{enumerable:!0});var gt=class extends Xe{constructor(e,s={}){super(e),this[iu]=s.code===void 0?0:s.code,this[ou]=s.reason===void 0?"":s.reason,this[pu]=s.wasClean===void 0?!1:s.wasClean}get code(){return this[iu]}get reason(){return this[ou]}get wasClean(){return this[pu]}};Object.defineProperty(gt.prototype,"code",{enumerable:!0});Object.defineProperty(gt.prototype,"reason",{enumerable:!0});Object.defineProperty(gt.prototype,"wasClean",{enumerable:!0});var Yt=class extends Xe{constructor(e,s={}){super(e),this[au]=s.error===void 0?null:s.error,this[ru]=s.message===void 0?"":s.message}get error(){return this[au]}get message(){return this[ru]}};Object.defineProperty(Yt.prototype,"error",{enumerable:!0});Object.defineProperty(Yt.prototype,"message",{enumerable:!0});var Ls=class extends Xe{constructor(e,s={}){super(e),this[nu]=s.data===void 0?null:s.data}get data(){return this[nu]}};Object.defineProperty(Ls.prototype,"data",{enumerable:!0});var mg={addEventListener(t,e,s={}){for(let n of this.listeners(t))if(!s[Ns]&&n[rr]===e&&!n[Ns])return;let i;if(t==="message")i=function(a,r){let o=new Ls("message",{data:r?a:a.toString()});o[Jt]=this,sn(e,this,o)};else if(t==="close")i=function(a,r){let o=new gt("close",{code:a,reason:r.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});o[Jt]=this,sn(e,this,o)};else if(t==="error")i=function(a){let r=new Yt("error",{error:a,message:a.message});r[Jt]=this,sn(e,this,r)};else if(t==="open")i=function(){let a=new Xe("open");a[Jt]=this,sn(e,this,a)};else return;i[Ns]=!!s[Ns],i[rr]=e,s.once?this.once(t,i):this.on(t,i)},removeEventListener(t,e){for(let s of this.listeners(t))if(s[rr]===e&&!s[Ns]){this.removeListener(t,s);break}}};lu.exports={CloseEvent:gt,ErrorEvent:Yt,Event:Xe,EventTarget:mg,MessageEvent:Ls};function sn(t,e,s){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,s):t.call(e,s)}});var or=b((PT,du)=>{"use strict";var{tokenChars:qs}=Vt();function Ie(t,e,s){t[e]===void 0?t[e]=[s]:t[e].push(s)}function fg(t){let e=Object.create(null),s=Object.create(null),i=!1,n=!1,a=!1,r,o,p=-1,l=-1,c=-1,m=0;for(;m<t.length;m++)if(l=t.charCodeAt(m),r===void 0)if(c===-1&&qs[l]===1)p===-1&&(p=m);else if(m!==0&&(l===32||l===9))c===-1&&p!==-1&&(c=m);else if(l===59||l===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1&&(c=m);let v=t.slice(p,c);l===44?(Ie(e,v,s),s=Object.create(null)):r=v,p=c=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);else if(o===void 0)if(c===-1&&qs[l]===1)p===-1&&(p=m);else if(l===32||l===9)c===-1&&p!==-1&&(c=m);else if(l===59||l===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1&&(c=m),Ie(s,t.slice(p,c),!0),l===44&&(Ie(e,r,s),s=Object.create(null),r=void 0),p=c=-1}else if(l===61&&p!==-1&&c===-1)o=t.slice(p,m),p=c=-1;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(n){if(qs[l]!==1)throw new SyntaxError(`Unexpected character at index ${m}`);p===-1?p=m:i||(i=!0),n=!1}else if(a)if(qs[l]===1)p===-1&&(p=m);else if(l===34&&p!==-1)a=!1,c=m;else if(l===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${m}`);else if(l===34&&t.charCodeAt(m-1)===61)a=!0;else if(c===-1&&qs[l]===1)p===-1&&(p=m);else if(p!==-1&&(l===32||l===9))c===-1&&(c=m);else if(l===59||l===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${m}`);c===-1&&(c=m);let v=t.slice(p,c);i&&(v=v.replace(/\\/g,""),i=!1),Ie(s,o,v),l===44&&(Ie(e,r,s),s=Object.create(null),r=void 0),o=void 0,p=c=-1}else throw new SyntaxError(`Unexpected character at index ${m}`);if(p===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=m);let f=t.slice(p,c);return r===void 0?Ie(e,f,s):(o===void 0?Ie(s,f,!0):i?Ie(s,o,f.replace(/\\/g,"")):Ie(s,o,f),Ie(e,r,s)),e}function hg(t){return Object.keys(t).map(e=>{let s=t[e];return Array.isArray(s)||(s=[s]),s.map(i=>[e].concat(Object.keys(i).map(n=>{let a=i[n];return Array.isArray(a)||(a=[a]),a.map(r=>r===!0?n:`${n}=${r}`).join("; ")})).join("; ")).join(", ")}).join(", ")}du.exports={format:hg,parse:fg}});var on=b((qT,Tu)=>{"use strict";var xg=E("events"),gg=E("https"),vg=E("http"),hu=E("net"),yg=E("tls"),{randomBytes:bg,createHash:_g}=E("crypto"),{Duplex:NT,Readable:LT}=E("stream"),{URL:cr}=E("url"),at=Ps(),wg=sr(),Eg=ar(),{isBlob:Tg}=Vt(),{BINARY_TYPES:mu,EMPTY_BUFFER:nn,GUID:Sg,kForOnEventAttribute:pr,kListener:kg,kStatusCode:Rg,kWebSocket:ie,NOOP:xu}=Je(),{EventTarget:{addEventListener:Cg,removeEventListener:Ag}}=uu(),{format:Og,parse:Pg}=or(),{toBuffer:Ng}=As(),Lg=30*1e3,gu=Symbol("kAborted"),lr=[8,13],Qe=["CONNECTING","OPEN","CLOSING","CLOSED"],qg=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,H=class t extends xg{constructor(e,s,i){super(),this._binaryType=mu[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=nn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,s===void 0?s=[]:Array.isArray(s)||(typeof s=="object"&&s!==null?(i=s,s=[]):s=[s]),vu(this,e,s,i)):(this._autoPong=i.autoPong,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){mu.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,s,i){let n=new wg({allowSynchronousEvents:i.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation}),a=new Eg(e,this._extensions,i.generateMask);this._receiver=n,this._sender=a,this._socket=e,n[ie]=this,a[ie]=this,e[ie]=this,n.on("conclude",jg),n.on("drain",Ug),n.on("error",Ig),n.on("message",Fg),n.on("ping",Mg),n.on("pong",zg),a.onerror=$g,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),s.length>0&&e.unshift(s),e.on("close",_u),e.on("data",rn),e.on("end",wu),e.on("error",Eu),this._readyState=t.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[at.extensionName]&&this._extensions[at.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,s){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){be(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,s,!this._isServer,i=>{i||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),bu(this)}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,s,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=s=void 0):typeof s=="function"&&(i=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){ur(this,e,i);return}s===void 0&&(s=!this._isServer),this._sender.ping(e||nn,s,i)}pong(e,s,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(i=e,e=s=void 0):typeof s=="function"&&(i=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){ur(this,e,i);return}s===void 0&&(s=!this._isServer),this._sender.pong(e||nn,s,i)}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,s,i){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof s=="function"&&(i=s,s={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){ur(this,e,i);return}let n=N({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},s);this._extensions[at.extensionName]||(n.compress=!1),this._sender.send(e||nn,n,i)}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){be(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy())}}};Object.defineProperty(H,"CONNECTING",{enumerable:!0,value:Qe.indexOf("CONNECTING")});Object.defineProperty(H.prototype,"CONNECTING",{enumerable:!0,value:Qe.indexOf("CONNECTING")});Object.defineProperty(H,"OPEN",{enumerable:!0,value:Qe.indexOf("OPEN")});Object.defineProperty(H.prototype,"OPEN",{enumerable:!0,value:Qe.indexOf("OPEN")});Object.defineProperty(H,"CLOSING",{enumerable:!0,value:Qe.indexOf("CLOSING")});Object.defineProperty(H.prototype,"CLOSING",{enumerable:!0,value:Qe.indexOf("CLOSING")});Object.defineProperty(H,"CLOSED",{enumerable:!0,value:Qe.indexOf("CLOSED")});Object.defineProperty(H.prototype,"CLOSED",{enumerable:!0,value:Qe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(H.prototype,t,{enumerable:!0})});["open","error","close","message"].forEach(t=>{Object.defineProperty(H.prototype,`on${t}`,{enumerable:!0,get(){for(let e of this.listeners(t))if(e[pr])return e[kg];return null},set(e){for(let s of this.listeners(t))if(s[pr]){this.removeListener(t,s);break}typeof e=="function"&&this.addEventListener(t,e,{[pr]:!0})}})});H.prototype.addEventListener=Cg;H.prototype.removeEventListener=Ag;Tu.exports=H;function vu(t,e,s,i){let n=re(N({allowSynchronousEvents:!0,autoPong:!0,protocolVersion:lr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},i),{socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(t._autoPong=n.autoPong,!lr.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${lr.join(", ")})`);let a;if(e instanceof cr)a=e;else try{a=new cr(e)}catch(x){throw new SyntaxError(`Invalid URL: ${e}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),t._url=a.href;let r=a.protocol==="wss:",o=a.protocol==="ws+unix:",p;if(a.protocol!=="ws:"&&!r&&!o?p=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:o&&!a.pathname?p="The URL's pathname is empty":a.hash&&(p="The URL contains a fragment identifier"),p){let x=new SyntaxError(p);if(t._redirects===0)throw x;an(t,x);return}let l=r?443:80,c=bg(16).toString("base64"),m=r?gg.request:vg.request,f=new Set,v;if(n.createConnection=n.createConnection||(r?Dg:Bg),n.defaultPort=n.defaultPort||l,n.port=a.port||l,n.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,n.headers=re(N({},n.headers),{"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"}),n.path=a.pathname+a.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(v=new at(n.perMessageDeflate!==!0?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=Og({[at.extensionName]:v.offer()})),s.length){for(let x of s){if(typeof x!="string"||!qg.test(x)||f.has(x))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.add(x)}n.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(a.username||a.password)&&(n.auth=`${a.username}:${a.password}`),o){let x=n.path.split(":");n.socketPath=x[0],n.path=x[1]}let h;if(n.followRedirects){if(t._redirects===0){t._originalIpc=o,t._originalSecure=r,t._originalHostOrSocketPath=o?n.socketPath:a.host;let x=i&&i.headers;if(i=re(N({},i),{headers:{}}),x)for(let[g,k]of Object.entries(x))i.headers[g.toLowerCase()]=k}else if(t.listenerCount("redirect")===0){let x=o?t._originalIpc?n.socketPath===t._originalHostOrSocketPath:!1:t._originalIpc?!1:a.host===t._originalHostOrSocketPath;(!x||t._originalSecure&&!r)&&(delete n.headers.authorization,delete n.headers.cookie,x||delete n.headers.host,n.auth=void 0)}n.auth&&!i.headers.authorization&&(i.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),h=t._req=m(n),t._redirects&&t.emit("redirect",t.url,h)}else h=t._req=m(n);n.timeout&&h.on("timeout",()=>{be(t,h,"Opening handshake has timed out")}),h.on("error",x=>{h===null||h[gu]||(h=t._req=null,an(t,x))}),h.on("response",x=>{let g=x.headers.location,k=x.statusCode;if(g&&n.followRedirects&&k>=300&&k<400){if(++t._redirects>n.maxRedirects){be(t,h,"Maximum redirects exceeded");return}h.abort();let R;try{R=new cr(g,e)}catch(y){let w=new SyntaxError(`Invalid URL: ${g}`);an(t,w);return}vu(t,R,s,i)}else t.emit("unexpected-response",h,x)||be(t,h,`Unexpected server response: ${x.statusCode}`)}),h.on("upgrade",(x,g,k)=>{if(t.emit("upgrade",x),t.readyState!==H.CONNECTING)return;h=t._req=null;let R=x.headers.upgrade;if(R===void 0||R.toLowerCase()!=="websocket"){be(t,g,"Invalid Upgrade header");return}let y=_g("sha1").update(c+Sg).digest("base64");if(x.headers["sec-websocket-accept"]!==y){be(t,g,"Invalid Sec-WebSocket-Accept header");return}let w=x.headers["sec-websocket-protocol"],I;if(w!==void 0?f.size?f.has(w)||(I="Server sent an invalid subprotocol"):I="Server sent a subprotocol but none was requested":f.size&&(I="Server sent no subprotocol"),I){be(t,g,I);return}w&&(t._protocol=w);let P=x.headers["sec-websocket-extensions"];if(P!==void 0){if(!v){be(t,g,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let j;try{j=Pg(P)}catch(ce){be(t,g,"Invalid Sec-WebSocket-Extensions header");return}let M=Object.keys(j);if(M.length!==1||M[0]!==at.extensionName){be(t,g,"Server indicated an extension that was not requested");return}try{v.accept(j[at.extensionName])}catch(ce){be(t,g,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[at.extensionName]=v}t.setSocket(g,k,{allowSynchronousEvents:n.allowSynchronousEvents,generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}),n.finishRequest?n.finishRequest(h,t):h.end()}function an(t,e){t._readyState=H.CLOSING,t._errorEmitted=!0,t.emit("error",e),t.emitClose()}function Bg(t){return t.path=t.socketPath,hu.connect(t)}function Dg(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=hu.isIP(t.host)?"":t.host),yg.connect(t)}function be(t,e,s){t._readyState=H.CLOSING;let i=new Error(s);Error.captureStackTrace(i,be),e.setHeader?(e[gu]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(an,t,i)):(e.destroy(i),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)))}function ur(t,e,s){if(e){let i=Tg(e)?e.size:Ng(e).length;t._socket?t._sender._bufferedBytes+=i:t._bufferedAmount+=i}if(s){let i=new Error(`WebSocket is not open: readyState ${t.readyState} (${Qe[t.readyState]})`);process.nextTick(s,i)}}function jg(t,e){let s=this[ie];s._closeFrameReceived=!0,s._closeMessage=e,s._closeCode=t,s._socket[ie]!==void 0&&(s._socket.removeListener("data",rn),process.nextTick(yu,s._socket),t===1005?s.close():s.close(t,e))}function Ug(){let t=this[ie];t.isPaused||t._socket.resume()}function Ig(t){let e=this[ie];e._socket[ie]!==void 0&&(e._socket.removeListener("data",rn),process.nextTick(yu,e._socket),e.close(t[Rg])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t))}function fu(){this[ie].emitClose()}function Fg(t,e){this[ie].emit("message",t,e)}function Mg(t){let e=this[ie];e._autoPong&&e.pong(t,!this._isServer,xu),e.emit("ping",t)}function zg(t){this[ie].emit("pong",t)}function yu(t){t.resume()}function $g(t){let e=this[ie];e.readyState!==H.CLOSED&&(e.readyState===H.OPEN&&(e._readyState=H.CLOSING,bu(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",t)))}function bu(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),Lg)}function _u(){let t=this[ie];this.removeListener("close",_u),this.removeListener("data",rn),this.removeListener("end",wu),t._readyState=H.CLOSING;let e;!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&(e=t._socket.read())!==null&&t._receiver.write(e),t._receiver.end(),this[ie]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",fu),t._receiver.on("finish",fu))}function rn(t){this[ie]._receiver.write(t)||this.pause()}function wu(){let t=this[ie];t._readyState=H.CLOSING,t._receiver.end(),this.end()}function Eu(){let t=this[ie];this.removeListener("error",Eu),this.on("error",xu),t&&(t._readyState=H.CLOSING,this.destroy())}});var Cu=b((jT,Ru)=>{"use strict";var DT=on(),{Duplex:Hg}=E("stream");function Su(t){t.emit("close")}function Wg(){!this.destroyed&&this._writableState.finished&&this.destroy()}function ku(t){this.removeListener("error",ku),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t)}function Vg(t,e){let s=!0,i=new Hg(re(N({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return t.on("message",function(a,r){let o=!r&&i._readableState.objectMode?a.toString():a;i.push(o)||t.pause()}),t.once("error",function(a){i.destroyed||(s=!1,i.destroy(a))}),t.once("close",function(){i.destroyed||i.push(null)}),i._destroy=function(n,a){if(t.readyState===t.CLOSED){a(n),process.nextTick(Su,i);return}let r=!1;t.once("error",function(p){r=!0,a(p)}),t.once("close",function(){r||a(n),process.nextTick(Su,i)}),s&&t.terminate()},i._final=function(n){if(t.readyState===t.CONNECTING){t.once("open",function(){i._final(n)});return}t._socket!==null&&(t._socket._writableState.finished?(n(),i._readableState.endEmitted&&i.destroy()):(t._socket.once("finish",function(){n()}),t.close()))},i._read=function(){t.isPaused&&t.resume()},i._write=function(n,a,r){if(t.readyState===t.CONNECTING){t.once("open",function(){i._write(n,a,r)});return}t.send(n,r)},i.on("end",Wg),i.on("error",ku),i}Ru.exports=Vg});var Ou=b((IT,Au)=>{"use strict";var{tokenChars:Gg}=Vt();function Kg(t){let e=new Set,s=-1,i=-1,n=0;for(n;n<t.length;n++){let r=t.charCodeAt(n);if(i===-1&&Gg[r]===1)s===-1&&(s=n);else if(n!==0&&(r===32||r===9))i===-1&&s!==-1&&(i=n);else if(r===44){if(s===-1)throw new SyntaxError(`Unexpected character at index ${n}`);i===-1&&(i=n);let o=t.slice(s,i);if(e.has(o))throw new SyntaxError(`The "${o}" subprotocol is duplicated`);e.add(o),s=i=-1}else throw new SyntaxError(`Unexpected character at index ${n}`)}if(s===-1||i!==-1)throw new SyntaxError("Unexpected end of input");let a=t.slice(s,n);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return e.add(a),e}Au.exports={parse:Kg}});var ju=b((MT,Du)=>{"use strict";var Jg=E("events"),cn=E("http"),{Duplex:FT}=E("stream"),{createHash:Yg}=E("crypto"),Pu=or(),vt=Ps(),Xg=Ou(),Qg=on(),{GUID:Zg,kWebSocket:ev}=Je(),tv=/^[+/0-9A-Za-z]{22}==$/,Nu=0,Lu=1,Bu=2,dr=class extends Jg{constructor(e,s){if(super(),e=N({allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Qg},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=cn.createServer((i,n)=>{let a=cn.STATUS_CODES[426];n.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),n.end(a)}),this._server.listen(e.port,e.host,e.backlog,s)):e.server&&(this._server=e.server),this._server){let i=this.emit.bind(this,"connection");this._removeListeners=sv(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,a,r)=>{this.handleUpgrade(n,a,r,i)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Nu}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Bu){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Bs,this);return}if(e&&this.once("close",e),this._state!==Lu)if(this._state=Lu,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Bs,this):process.nextTick(Bs,this);else{let s=this._server;this._removeListeners(),this._removeListeners=this._server=null,s.close(()=>{Bs(this)})}}shouldHandle(e){if(this.options.path){let s=e.url.indexOf("?");if((s!==-1?e.url.slice(0,s):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,s,i,n){s.on("error",qu);let a=e.headers["sec-websocket-key"],r=e.headers.upgrade,o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){yt(this,e,s,405,"Invalid HTTP method");return}if(r===void 0||r.toLowerCase()!=="websocket"){yt(this,e,s,400,"Invalid Upgrade header");return}if(a===void 0||!tv.test(a)){yt(this,e,s,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==13&&o!==8){yt(this,e,s,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Ds(s,400);return}let p=e.headers["sec-websocket-protocol"],l=new Set;if(p!==void 0)try{l=Xg.parse(p)}catch(f){yt(this,e,s,400,"Invalid Sec-WebSocket-Protocol header");return}let c=e.headers["sec-websocket-extensions"],m={};if(this.options.perMessageDeflate&&c!==void 0){let f=new vt(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let v=Pu.parse(c);v[vt.extensionName]&&(f.accept(v[vt.extensionName]),m[vt.extensionName]=f)}catch(v){yt(this,e,s,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(f,(v,h,x,g)=>{if(!v)return Ds(s,h||401,x,g);this.completeUpgrade(m,a,l,e,s,i,n)});return}if(!this.options.verifyClient(f))return Ds(s,401)}this.completeUpgrade(m,a,l,e,s,i,n)}completeUpgrade(e,s,i,n,a,r,o){if(!a.readable||!a.writable)return a.destroy();if(a[ev])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Nu)return Ds(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Yg("sha1").update(s+Zg).digest("base64")}`],c=new this.options.WebSocket(null,void 0,this.options);if(i.size){let m=this.options.handleProtocols?this.options.handleProtocols(i,n):i.values().next().value;m&&(l.push(`Sec-WebSocket-Protocol: ${m}`),c._protocol=m)}if(e[vt.extensionName]){let m=e[vt.extensionName].params,f=Pu.format({[vt.extensionName]:[m]});l.push(`Sec-WebSocket-Extensions: ${f}`),c._extensions=e}this.emit("headers",l,n),a.write(l.concat(`\r
|
|
8
8
|
`).join(`\r
|
|
9
|
-
`)),a.removeListener("error",qu),c.setSocket(a,r,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(
|
|
9
|
+
`)),a.removeListener("error",qu),c.setSocket(a,r,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Bs,this)})),o(c,n)}};Du.exports=dr;function sv(t,e){for(let s of Object.keys(e))t.on(s,e[s]);return function(){for(let i of Object.keys(e))t.removeListener(i,e[i])}}function Bs(t){t._state=Bu,t.emit("close")}function qu(){this.destroy()}function Ds(t,e,s,i){s=s||cn.STATUS_CODES[e],i=N({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s)},i),t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${cn.STATUS_CODES[e]}\r
|
|
10
10
|
`+Object.keys(i).map(n=>`${n}: ${i[n]}`).join(`\r
|
|
11
11
|
`)+`\r
|
|
12
12
|
\r
|
|
13
|
-
`+s)}function bt(t,e,s,i,n,a){if(t.listenerCount("wsClientError")){let r=new Error(n);Error.captureStackTrace(r,bt),t.emit("wsClientError",r,s,e)}else ci(s,i,n,a)}});var Rv={};_n(Rv,{APIError:()=>be,Activities:()=>Ns,Analytics:()=>Ls,AuthenticationError:()=>Ts,AutomationDashboard:()=>Us,Automations:()=>qs,Broadcasts:()=>Rs,CRM:()=>Is,Campaigns:()=>Ki,Conversations:()=>ks,Ecodrix:()=>is,EcodrixError:()=>$i,EmailResource:()=>$s,Emails:()=>Gi,EventsResource:()=>Hs,Files:()=>Vi,Folders:()=>Wi,Health:()=>Ks,Leads:()=>Os,Marketing:()=>Gs,MediaResource:()=>Fs,Meetings:()=>Ms,Messages:()=>Ss,Notes:()=>Hi,Notifications:()=>zs,Payments:()=>js,Pipelines:()=>Ps,Queue:()=>Js,RateLimitError:()=>Ia,Scoring:()=>Ds,Sequences:()=>Bs,Storage:()=>Vs,Templates:()=>Cs,WebhookSignatureError:()=>ht,Webhooks:()=>Ws,WhatsApp:()=>As,WhatsAppMarketing:()=>Ji,default:()=>kv});function as(t,e){return function(){return t.apply(e,arguments)}}var{toString:ld}=Object.prototype,{getPrototypeOf:En}=Object,{iterator:xi,toStringTag:Nr}=Symbol,gi=(t=>e=>{let s=ld.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),Ae=t=>(t=t.toLowerCase(),e=>gi(e)===t),vi=t=>e=>typeof e===t,{isArray:kt}=Array,St=vi("undefined");function rs(t){return t!==null&&!St(t)&&t.constructor!==null&&!St(t.constructor)&&me(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Lr=Ae("ArrayBuffer");function ud(t){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Lr(t.buffer),e}var dd=vi("string"),me=vi("function"),qr=vi("number"),os=t=>t!==null&&typeof t=="object",md=t=>t===!0||t===!1,hi=t=>{if(gi(t)!=="object")return!1;let e=En(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Nr in t)&&!(xi in t)},fd=t=>{if(!os(t)||rs(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch(e){return!1}},hd=Ae("Date"),xd=Ae("File"),gd=t=>!!(t&&typeof t.uri!="undefined"),vd=t=>t&&typeof t.getParts!="undefined",yd=Ae("Blob"),bd=Ae("FileList"),_d=t=>os(t)&&me(t.pipe);function wd(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}}var Ar=wd(),Or=typeof Ar.FormData!="undefined"?Ar.FormData:void 0,Ed=t=>{let e;return t&&(Or&&t instanceof Or||me(t.append)&&((e=gi(t))==="formdata"||e==="object"&&me(t.toString)&&t.toString()==="[object FormData]"))},Td=Ae("URLSearchParams"),[Sd,kd,Rd,Cd]=["ReadableStream","Request","Response","Headers"].map(Ae),Ad=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function cs(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t=="undefined")return;let i,n;if(typeof t!="object"&&(t=[t]),kt(t))for(i=0,n=t.length;i<n;i++)e.call(null,t[i],i,t);else{if(rs(t))return;let a=s?Object.getOwnPropertyNames(t):Object.keys(t),r=a.length,o;for(i=0;i<r;i++)o=a[i],e.call(null,t[o],o,t)}}function Br(t,e){if(rs(t))return null;e=e.toLowerCase();let s=Object.keys(t),i=s.length,n;for(;i-- >0;)if(n=s[i],e===n.toLowerCase())return n;return null}var rt=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,Dr=t=>!St(t)&&t!==rt;function wn(){let{caseless:t,skipUndefined:e}=Dr(this)&&this||{},s={},i=(n,a)=>{if(a==="__proto__"||a==="constructor"||a==="prototype")return;let r=t&&Br(s,a)||a;hi(s[r])&&hi(n)?s[r]=wn(s[r],n):hi(n)?s[r]=wn({},n):kt(n)?s[r]=n.slice():(!e||!St(n))&&(s[r]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&cs(arguments[n],i);return s}var Od=(t,e,s,{allOwnKeys:i}={})=>(cs(e,(n,a)=>{s&&me(n)?Object.defineProperty(t,a,{value:as(n,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,a,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),t),Pd=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Nd=(t,e,s,i)=>{t.prototype=Object.create(e.prototype,i),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},Ld=(t,e,s,i)=>{let n,a,r,o={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),a=n.length;a-- >0;)r=n[a],(!i||i(r,t,e))&&!o[r]&&(e[r]=t[r],o[r]=!0);t=s!==!1&&En(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},qd=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;let i=t.indexOf(e,s);return i!==-1&&i===s},Bd=t=>{if(!t)return null;if(kt(t))return t;let e=t.length;if(!qr(e))return null;let s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},Dd=(t=>e=>t&&e instanceof t)(typeof Uint8Array!="undefined"&&En(Uint8Array)),jd=(t,e)=>{let i=(t&&t[xi]).call(t),n;for(;(n=i.next())&&!n.done;){let a=n.value;e.call(t,a[0],a[1])}},Ud=(t,e)=>{let s,i=[];for(;(s=t.exec(e))!==null;)i.push(s);return i},Id=Ae("HTMLFormElement"),Fd=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,i,n){return i.toUpperCase()+n}),Pr=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),Md=Ae("RegExp"),jr=(t,e)=>{let s=Object.getOwnPropertyDescriptors(t),i={};cs(s,(n,a)=>{let r;(r=e(n,a,t))!==!1&&(i[a]=r||n)}),Object.defineProperties(t,i)},zd=t=>{jr(t,(e,s)=>{if(me(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;let i=t[s];if(me(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},$d=(t,e)=>{let s={},i=n=>{n.forEach(a=>{s[a]=!0})};return kt(t)?i(t):i(String(t).split(e)),s},Hd=()=>{},Wd=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Vd(t){return!!(t&&me(t.append)&&t[Nr]==="FormData"&&t[xi])}var Gd=t=>{let e=new Array(10),s=(i,n)=>{if(os(i)){if(e.indexOf(i)>=0)return;if(rs(i))return i;if(!("toJSON"in i)){e[n]=i;let a=kt(i)?[]:{};return cs(i,(r,o)=>{let p=s(r,n+1);!St(p)&&(a[o]=p)}),e[n]=void 0,a}}return i};return s(t,0)},Kd=Ae("AsyncFunction"),Jd=t=>t&&(os(t)||me(t))&&me(t.then)&&me(t.catch),Ur=((t,e)=>t?setImmediate:e?((s,i)=>(rt.addEventListener("message",({source:n,data:a})=>{n===rt&&a===s&&i.length&&i.shift()()},!1),n=>{i.push(n),rt.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",me(rt.postMessage)),Yd=typeof queueMicrotask!="undefined"?queueMicrotask.bind(rt):typeof process!="undefined"&&process.nextTick||Ur,Xd=t=>t!=null&&me(t[xi]),d={isArray:kt,isArrayBuffer:Lr,isBuffer:rs,isFormData:Ed,isArrayBufferView:ud,isString:dd,isNumber:qr,isBoolean:md,isObject:os,isPlainObject:hi,isEmptyObject:fd,isReadableStream:Sd,isRequest:kd,isResponse:Rd,isHeaders:Cd,isUndefined:St,isDate:hd,isFile:xd,isReactNativeBlob:gd,isReactNative:vd,isBlob:yd,isRegExp:Md,isFunction:me,isStream:_d,isURLSearchParams:Td,isTypedArray:Dd,isFileList:bd,forEach:cs,merge:wn,extend:Od,trim:Ad,stripBOM:Pd,inherits:Nd,toFlatObject:Ld,kindOf:gi,kindOfTest:Ae,endsWith:qd,toArray:Bd,forEachEntry:jd,matchAll:Ud,isHTMLForm:Id,hasOwnProperty:Pr,hasOwnProp:Pr,reduceDescriptors:jr,freezeMethods:zd,toObjectSet:$d,toCamelCase:Fd,noop:Hd,toFiniteNumber:Wd,findKey:Br,global:rt,isContextDefined:Dr,isSpecCompliantForm:Vd,toJSONObject:Gd,isAsyncFn:Kd,isThenable:Jd,setImmediate:Ur,asap:Yd,isIterable:Xd};var ue=class t extends Error{static from(e,s,i,n,a,r){let o=new t(e.message,s||e.code,i,n,a);return o.cause=e,o.name=e.name,e.status!=null&&o.status==null&&(o.status=e.status),r&&Object.assign(o,r),o}constructor(e,s,i,n,a){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,s&&(this.code=s),i&&(this.config=i),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}};ue.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";ue.ERR_BAD_OPTION="ERR_BAD_OPTION";ue.ECONNABORTED="ECONNABORTED";ue.ETIMEDOUT="ETIMEDOUT";ue.ERR_NETWORK="ERR_NETWORK";ue.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";ue.ERR_DEPRECATED="ERR_DEPRECATED";ue.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";ue.ERR_BAD_REQUEST="ERR_BAD_REQUEST";ue.ERR_CANCELED="ERR_CANCELED";ue.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";ue.ERR_INVALID_URL="ERR_INVALID_URL";var _=ue;var $c=D(zc(),1),Ai=$c.default;function Hn(t){return d.isPlainObject(t)||d.isArray(t)}function Hc(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function $n(t,e,s){return t?t.concat(e).map(function(n,a){return n=Hc(n),!s&&a?"["+n+"]":n}).join(s?".":""):e}function jf(t){return d.isArray(t)&&!t.some(Hn)}var Uf=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function If(t,e,s){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new(Ai||FormData),s=d.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,g){return!d.isUndefined(g[x])});let i=s.metaTokens,n=s.visitor||c,a=s.dots,r=s.indexes,p=(s.Blob||typeof Blob!="undefined"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(n))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(d.isDate(h))return h.toISOString();if(d.isBoolean(h))return h.toString();if(!p&&d.isBlob(h))throw new _("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(h)||d.isTypedArray(h)?p&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function c(h,x,g){let k=h;if(d.isReactNative(e)&&d.isReactNativeBlob(h))return e.append($n(g,x,a),l(h)),!1;if(h&&!g&&typeof h=="object"){if(d.endsWith(x,"{}"))x=i?x:x.slice(0,-2),h=JSON.stringify(h);else if(d.isArray(h)&&jf(h)||(d.isFileList(h)||d.endsWith(x,"[]"))&&(k=d.toArray(h)))return x=Hc(x),k.forEach(function(y,w){!(d.isUndefined(y)||y===null)&&e.append(r===!0?$n([x],w,a):r===null?x:x+"[]",l(y))}),!1}return Hn(h)?!0:(e.append($n(g,x,a),l(h)),!1)}let m=[],f=Object.assign(Uf,{defaultVisitor:c,convertValue:l,isVisitable:Hn});function v(h,x){if(!d.isUndefined(h)){if(m.indexOf(h)!==-1)throw Error("Circular reference detected in "+x.join("."));m.push(h),d.forEach(h,function(k,R){(!(d.isUndefined(k)||k===null)&&n.call(e,k,d.isString(R)?R.trim():R,x,f))===!0&&v(k,x?x.concat(R):[R])}),m.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return v(t),e}var tt=If;function Wc(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Vc(t,e){this._pairs=[],t&&tt(t,this,e)}var Gc=Vc.prototype;Gc.append=function(e,s){this._pairs.push([e,s])};Gc.toString=function(e){let s=e?function(i){return e.call(this,i,Wc)}:Wc;return this._pairs.map(function(n){return s(n[0])+"="+s(n[1])},"").join("&")};var Kc=Vc;function Ff(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ct(t,e,s){if(!e)return t;let i=s&&s.encode||Ff,n=d.isFunction(s)?{serialize:s}:s,a=n&&n.serialize,r;if(a?r=a(e,n):r=d.isURLSearchParams(e)?e.toString():new Kc(e,n).toString(i),r){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+r}return t}var Wn=class{constructor(){this.handlers=[]}use(e,s,i){return this.handlers.push({fulfilled:e,rejected:s,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(i){i!==null&&e(i)})}},Vn=Wn;var st={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var Qc=D(E("crypto"),1);var Jc=D(E("url"),1),Yc=Jc.default.URLSearchParams;var Gn="abcdefghijklmnopqrstuvwxyz",Xc="0123456789",Zc={DIGIT:Xc,ALPHA:Gn,ALPHA_DIGIT:Gn+Gn.toUpperCase()+Xc},Mf=(t=16,e=Zc.ALPHA_DIGIT)=>{let s="",{length:i}=e,n=new Uint32Array(t);Qc.default.randomFillSync(n);for(let a=0;a<t;a++)s+=e[n[a]%i];return s},ep={isNode:!0,classes:{URLSearchParams:Yc,FormData:Ai,Blob:typeof Blob!="undefined"&&Blob||null},ALPHABET:Zc,generateString:Mf,protocols:["http","https","file","data"]};var Yn={};_n(Yn,{hasBrowserEnv:()=>Jn,hasStandardBrowserEnv:()=>zf,hasStandardBrowserWebWorkerEnv:()=>$f,navigator:()=>Kn,origin:()=>Hf});var Jn=typeof window!="undefined"&&typeof document!="undefined",Kn=typeof navigator=="object"&&navigator||void 0,zf=Jn&&(!Kn||["ReactNative","NativeScript","NS"].indexOf(Kn.product)<0),$f=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hf=Jn&&window.location.href||"http://localhost";var U=N(N({},Yn),ep);function Xn(t,e){return tt(t,new U.classes.URLSearchParams,N({visitor:function(s,i,n,a){return U.isNode&&d.isBuffer(s)?(this.append(i,s.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function Wf(t){return d.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Vf(t){let e={},s=Object.keys(t),i,n=s.length,a;for(i=0;i<n;i++)a=s[i],e[a]=t[a];return e}function Gf(t){function e(s,i,n,a){let r=s[a++];if(r==="__proto__")return!0;let o=Number.isFinite(+r),p=a>=s.length;return r=!r&&d.isArray(n)?n.length:r,p?(d.hasOwnProp(n,r)?n[r]=[n[r],i]:n[r]=i,!o):((!n[r]||!d.isObject(n[r]))&&(n[r]=[]),e(s,i,n[r],a)&&d.isArray(n[r])&&(n[r]=Vf(n[r])),!o)}if(d.isFormData(t)&&d.isFunction(t.entries)){let s={};return d.forEachEntry(t,(i,n)=>{e(Wf(i),n,s,0)}),s}return null}var Oi=Gf;function Kf(t,e,s){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(s||JSON.stringify)(t)}var Qn={transitional:st,adapter:["xhr","http","fetch"],transformRequest:[function(e,s){let i=s.getContentType()||"",n=i.indexOf("application/json")>-1,a=d.isObject(e);if(a&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return n?JSON.stringify(Oi(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Xn(e,this.formSerializer).toString();if((o=d.isFileList(e))||i.indexOf("multipart/form-data")>-1){let p=this.env&&this.env.FormData;return tt(o?{"files[]":e}:e,p&&new p,this.formSerializer)}}return a||n?(s.setContentType("application/json",!1),Kf(e)):e}],transformResponse:[function(e){let s=this.transitional||Qn.transitional,i=s&&s.forcedJSONParsing,n=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(i&&!this.responseType||n)){let r=!(s&&s.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(o){if(r)throw o.name==="SyntaxError"?_.from(o,_.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:U.classes.FormData,Blob:U.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],t=>{Qn.headers[t]={}});var Pt=Qn;var Jf=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tp=t=>{let e={},s,i,n;return t&&t.split(`
|
|
13
|
+
`+s)}function yt(t,e,s,i,n,a){if(t.listenerCount("wsClientError")){let r=new Error(n);Error.captureStackTrace(r,yt),t.emit("wsClientError",r,s,e)}else Ds(s,i,n,a)}});var Rv={};_n(Rv,{APIError:()=>we,Activities:()=>Hs,Analytics:()=>Ws,AuthenticationError:()=>$s,AutomationDashboard:()=>Vs,Automations:()=>Gs,Broadcasts:()=>li,CRM:()=>Zs,Campaigns:()=>hn,Conversations:()=>ui,Ecodrix:()=>is,EcodrixError:()=>dn,EmailResource:()=>ei,Emails:()=>fn,EventsResource:()=>ti,Files:()=>vn,Folders:()=>gn,Health:()=>si,Leads:()=>Ks,Marketing:()=>ii,MediaResource:()=>ni,Meetings:()=>ai,Messages:()=>di,Notes:()=>mn,Notifications:()=>ri,Payments:()=>Js,Pipelines:()=>Ys,Queue:()=>oi,RateLimitError:()=>Er,Scoring:()=>Xs,Sequences:()=>Qs,Storage:()=>ci,Templates:()=>mi,WebhookSignatureError:()=>wt,Webhooks:()=>pi,WhatsApp:()=>fi,WhatsAppMarketing:()=>xn,default:()=>kv});function as(t,e){return function(){return t.apply(e,arguments)}}var{toString:ld}=Object.prototype,{getPrototypeOf:En}=Object,{iterator:xi,toStringTag:Nr}=Symbol,gi=(t=>e=>{let s=ld.call(e);return t[s]||(t[s]=s.slice(8,-1).toLowerCase())})(Object.create(null)),Ae=t=>(t=t.toLowerCase(),e=>gi(e)===t),vi=t=>e=>typeof e===t,{isArray:kt}=Array,St=vi("undefined");function rs(t){return t!==null&&!St(t)&&t.constructor!==null&&!St(t.constructor)&&me(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}var Lr=Ae("ArrayBuffer");function ud(t){let e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Lr(t.buffer),e}var dd=vi("string"),me=vi("function"),qr=vi("number"),os=t=>t!==null&&typeof t=="object",md=t=>t===!0||t===!1,hi=t=>{if(gi(t)!=="object")return!1;let e=En(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Nr in t)&&!(xi in t)},fd=t=>{if(!os(t)||rs(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch(e){return!1}},hd=Ae("Date"),xd=Ae("File"),gd=t=>!!(t&&typeof t.uri!="undefined"),vd=t=>t&&typeof t.getParts!="undefined",yd=Ae("Blob"),bd=Ae("FileList"),_d=t=>os(t)&&me(t.pipe);function wd(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}}var Ar=wd(),Or=typeof Ar.FormData!="undefined"?Ar.FormData:void 0,Ed=t=>{let e;return t&&(Or&&t instanceof Or||me(t.append)&&((e=gi(t))==="formdata"||e==="object"&&me(t.toString)&&t.toString()==="[object FormData]"))},Td=Ae("URLSearchParams"),[Sd,kd,Rd,Cd]=["ReadableStream","Request","Response","Headers"].map(Ae),Ad=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function cs(t,e,{allOwnKeys:s=!1}={}){if(t===null||typeof t=="undefined")return;let i,n;if(typeof t!="object"&&(t=[t]),kt(t))for(i=0,n=t.length;i<n;i++)e.call(null,t[i],i,t);else{if(rs(t))return;let a=s?Object.getOwnPropertyNames(t):Object.keys(t),r=a.length,o;for(i=0;i<r;i++)o=a[i],e.call(null,t[o],o,t)}}function Br(t,e){if(rs(t))return null;e=e.toLowerCase();let s=Object.keys(t),i=s.length,n;for(;i-- >0;)if(n=s[i],e===n.toLowerCase())return n;return null}var rt=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global,Dr=t=>!St(t)&&t!==rt;function wn(){let{caseless:t,skipUndefined:e}=Dr(this)&&this||{},s={},i=(n,a)=>{if(a==="__proto__"||a==="constructor"||a==="prototype")return;let r=t&&Br(s,a)||a;hi(s[r])&&hi(n)?s[r]=wn(s[r],n):hi(n)?s[r]=wn({},n):kt(n)?s[r]=n.slice():(!e||!St(n))&&(s[r]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&cs(arguments[n],i);return s}var Od=(t,e,s,{allOwnKeys:i}={})=>(cs(e,(n,a)=>{s&&me(n)?Object.defineProperty(t,a,{value:as(n,s),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(t,a,{value:n,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:i}),t),Pd=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Nd=(t,e,s,i)=>{t.prototype=Object.create(e.prototype,i),Object.defineProperty(t.prototype,"constructor",{value:t,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t,"super",{value:e.prototype}),s&&Object.assign(t.prototype,s)},Ld=(t,e,s,i)=>{let n,a,r,o={};if(e=e||{},t==null)return e;do{for(n=Object.getOwnPropertyNames(t),a=n.length;a-- >0;)r=n[a],(!i||i(r,t,e))&&!o[r]&&(e[r]=t[r],o[r]=!0);t=s!==!1&&En(t)}while(t&&(!s||s(t,e))&&t!==Object.prototype);return e},qd=(t,e,s)=>{t=String(t),(s===void 0||s>t.length)&&(s=t.length),s-=e.length;let i=t.indexOf(e,s);return i!==-1&&i===s},Bd=t=>{if(!t)return null;if(kt(t))return t;let e=t.length;if(!qr(e))return null;let s=new Array(e);for(;e-- >0;)s[e]=t[e];return s},Dd=(t=>e=>t&&e instanceof t)(typeof Uint8Array!="undefined"&&En(Uint8Array)),jd=(t,e)=>{let i=(t&&t[xi]).call(t),n;for(;(n=i.next())&&!n.done;){let a=n.value;e.call(t,a[0],a[1])}},Ud=(t,e)=>{let s,i=[];for(;(s=t.exec(e))!==null;)i.push(s);return i},Id=Ae("HTMLFormElement"),Fd=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(s,i,n){return i.toUpperCase()+n}),Pr=(({hasOwnProperty:t})=>(e,s)=>t.call(e,s))(Object.prototype),Md=Ae("RegExp"),jr=(t,e)=>{let s=Object.getOwnPropertyDescriptors(t),i={};cs(s,(n,a)=>{let r;(r=e(n,a,t))!==!1&&(i[a]=r||n)}),Object.defineProperties(t,i)},zd=t=>{jr(t,(e,s)=>{if(me(t)&&["arguments","caller","callee"].indexOf(s)!==-1)return!1;let i=t[s];if(me(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+s+"'")})}})},$d=(t,e)=>{let s={},i=n=>{n.forEach(a=>{s[a]=!0})};return kt(t)?i(t):i(String(t).split(e)),s},Hd=()=>{},Wd=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Vd(t){return!!(t&&me(t.append)&&t[Nr]==="FormData"&&t[xi])}var Gd=t=>{let e=new Array(10),s=(i,n)=>{if(os(i)){if(e.indexOf(i)>=0)return;if(rs(i))return i;if(!("toJSON"in i)){e[n]=i;let a=kt(i)?[]:{};return cs(i,(r,o)=>{let p=s(r,n+1);!St(p)&&(a[o]=p)}),e[n]=void 0,a}}return i};return s(t,0)},Kd=Ae("AsyncFunction"),Jd=t=>t&&(os(t)||me(t))&&me(t.then)&&me(t.catch),Ur=((t,e)=>t?setImmediate:e?((s,i)=>(rt.addEventListener("message",({source:n,data:a})=>{n===rt&&a===s&&i.length&&i.shift()()},!1),n=>{i.push(n),rt.postMessage(s,"*")}))(`axios@${Math.random()}`,[]):s=>setTimeout(s))(typeof setImmediate=="function",me(rt.postMessage)),Yd=typeof queueMicrotask!="undefined"?queueMicrotask.bind(rt):typeof process!="undefined"&&process.nextTick||Ur,Xd=t=>t!=null&&me(t[xi]),d={isArray:kt,isArrayBuffer:Lr,isBuffer:rs,isFormData:Ed,isArrayBufferView:ud,isString:dd,isNumber:qr,isBoolean:md,isObject:os,isPlainObject:hi,isEmptyObject:fd,isReadableStream:Sd,isRequest:kd,isResponse:Rd,isHeaders:Cd,isUndefined:St,isDate:hd,isFile:xd,isReactNativeBlob:gd,isReactNative:vd,isBlob:yd,isRegExp:Md,isFunction:me,isStream:_d,isURLSearchParams:Td,isTypedArray:Dd,isFileList:bd,forEach:cs,merge:wn,extend:Od,trim:Ad,stripBOM:Pd,inherits:Nd,toFlatObject:Ld,kindOf:gi,kindOfTest:Ae,endsWith:qd,toArray:Bd,forEachEntry:jd,matchAll:Ud,isHTMLForm:Id,hasOwnProperty:Pr,hasOwnProp:Pr,reduceDescriptors:jr,freezeMethods:zd,toObjectSet:$d,toCamelCase:Fd,noop:Hd,toFiniteNumber:Wd,findKey:Br,global:rt,isContextDefined:Dr,isSpecCompliantForm:Vd,toJSONObject:Gd,isAsyncFn:Kd,isThenable:Jd,setImmediate:Ur,asap:Yd,isIterable:Xd};var ue=class t extends Error{static from(e,s,i,n,a,r){let o=new t(e.message,s||e.code,i,n,a);return o.cause=e,o.name=e.name,e.status!=null&&o.status==null&&(o.status=e.status),r&&Object.assign(o,r),o}constructor(e,s,i,n,a){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,s&&(this.code=s),i&&(this.config=i),n&&(this.request=n),a&&(this.response=a,this.status=a.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:d.toJSONObject(this.config),code:this.code,status:this.status}}};ue.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";ue.ERR_BAD_OPTION="ERR_BAD_OPTION";ue.ECONNABORTED="ECONNABORTED";ue.ETIMEDOUT="ETIMEDOUT";ue.ERR_NETWORK="ERR_NETWORK";ue.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";ue.ERR_DEPRECATED="ERR_DEPRECATED";ue.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";ue.ERR_BAD_REQUEST="ERR_BAD_REQUEST";ue.ERR_CANCELED="ERR_CANCELED";ue.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";ue.ERR_INVALID_URL="ERR_INVALID_URL";var _=ue;var $c=D(zc(),1),Ai=$c.default;function Hn(t){return d.isPlainObject(t)||d.isArray(t)}function Hc(t){return d.endsWith(t,"[]")?t.slice(0,-2):t}function $n(t,e,s){return t?t.concat(e).map(function(n,a){return n=Hc(n),!s&&a?"["+n+"]":n}).join(s?".":""):e}function jf(t){return d.isArray(t)&&!t.some(Hn)}var Uf=d.toFlatObject(d,{},null,function(e){return/^is[A-Z]/.test(e)});function If(t,e,s){if(!d.isObject(t))throw new TypeError("target must be an object");e=e||new(Ai||FormData),s=d.toFlatObject(s,{metaTokens:!0,dots:!1,indexes:!1},!1,function(x,g){return!d.isUndefined(g[x])});let i=s.metaTokens,n=s.visitor||c,a=s.dots,r=s.indexes,p=(s.Blob||typeof Blob!="undefined"&&Blob)&&d.isSpecCompliantForm(e);if(!d.isFunction(n))throw new TypeError("visitor must be a function");function l(h){if(h===null)return"";if(d.isDate(h))return h.toISOString();if(d.isBoolean(h))return h.toString();if(!p&&d.isBlob(h))throw new _("Blob is not supported. Use a Buffer instead.");return d.isArrayBuffer(h)||d.isTypedArray(h)?p&&typeof Blob=="function"?new Blob([h]):Buffer.from(h):h}function c(h,x,g){let k=h;if(d.isReactNative(e)&&d.isReactNativeBlob(h))return e.append($n(g,x,a),l(h)),!1;if(h&&!g&&typeof h=="object"){if(d.endsWith(x,"{}"))x=i?x:x.slice(0,-2),h=JSON.stringify(h);else if(d.isArray(h)&&jf(h)||(d.isFileList(h)||d.endsWith(x,"[]"))&&(k=d.toArray(h)))return x=Hc(x),k.forEach(function(y,w){!(d.isUndefined(y)||y===null)&&e.append(r===!0?$n([x],w,a):r===null?x:x+"[]",l(y))}),!1}return Hn(h)?!0:(e.append($n(g,x,a),l(h)),!1)}let m=[],f=Object.assign(Uf,{defaultVisitor:c,convertValue:l,isVisitable:Hn});function v(h,x){if(!d.isUndefined(h)){if(m.indexOf(h)!==-1)throw Error("Circular reference detected in "+x.join("."));m.push(h),d.forEach(h,function(k,R){(!(d.isUndefined(k)||k===null)&&n.call(e,k,d.isString(R)?R.trim():R,x,f))===!0&&v(k,x?x.concat(R):[R])}),m.pop()}}if(!d.isObject(t))throw new TypeError("data must be an object");return v(t),e}var tt=If;function Wc(t){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Vc(t,e){this._pairs=[],t&&tt(t,this,e)}var Gc=Vc.prototype;Gc.append=function(e,s){this._pairs.push([e,s])};Gc.toString=function(e){let s=e?function(i){return e.call(this,i,Wc)}:Wc;return this._pairs.map(function(n){return s(n[0])+"="+s(n[1])},"").join("&")};var Kc=Vc;function Ff(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ct(t,e,s){if(!e)return t;let i=s&&s.encode||Ff,n=d.isFunction(s)?{serialize:s}:s,a=n&&n.serialize,r;if(a?r=a(e,n):r=d.isURLSearchParams(e)?e.toString():new Kc(e,n).toString(i),r){let o=t.indexOf("#");o!==-1&&(t=t.slice(0,o)),t+=(t.indexOf("?")===-1?"?":"&")+r}return t}var Wn=class{constructor(){this.handlers=[]}use(e,s,i){return this.handlers.push({fulfilled:e,rejected:s,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){d.forEach(this.handlers,function(i){i!==null&&e(i)})}},Vn=Wn;var st={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0};var Qc=D(E("crypto"),1);var Jc=D(E("url"),1),Yc=Jc.default.URLSearchParams;var Gn="abcdefghijklmnopqrstuvwxyz",Xc="0123456789",Zc={DIGIT:Xc,ALPHA:Gn,ALPHA_DIGIT:Gn+Gn.toUpperCase()+Xc},Mf=(t=16,e=Zc.ALPHA_DIGIT)=>{let s="",{length:i}=e,n=new Uint32Array(t);Qc.default.randomFillSync(n);for(let a=0;a<t;a++)s+=e[n[a]%i];return s},ep={isNode:!0,classes:{URLSearchParams:Yc,FormData:Ai,Blob:typeof Blob!="undefined"&&Blob||null},ALPHABET:Zc,generateString:Mf,protocols:["http","https","file","data"]};var Yn={};_n(Yn,{hasBrowserEnv:()=>Jn,hasStandardBrowserEnv:()=>zf,hasStandardBrowserWebWorkerEnv:()=>$f,navigator:()=>Kn,origin:()=>Hf});var Jn=typeof window!="undefined"&&typeof document!="undefined",Kn=typeof navigator=="object"&&navigator||void 0,zf=Jn&&(!Kn||["ReactNative","NativeScript","NS"].indexOf(Kn.product)<0),$f=typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Hf=Jn&&window.location.href||"http://localhost";var U=N(N({},Yn),ep);function Xn(t,e){return tt(t,new U.classes.URLSearchParams,N({visitor:function(s,i,n,a){return U.isNode&&d.isBuffer(s)?(this.append(i,s.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},e))}function Wf(t){return d.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Vf(t){let e={},s=Object.keys(t),i,n=s.length,a;for(i=0;i<n;i++)a=s[i],e[a]=t[a];return e}function Gf(t){function e(s,i,n,a){let r=s[a++];if(r==="__proto__")return!0;let o=Number.isFinite(+r),p=a>=s.length;return r=!r&&d.isArray(n)?n.length:r,p?(d.hasOwnProp(n,r)?n[r]=[n[r],i]:n[r]=i,!o):((!n[r]||!d.isObject(n[r]))&&(n[r]=[]),e(s,i,n[r],a)&&d.isArray(n[r])&&(n[r]=Vf(n[r])),!o)}if(d.isFormData(t)&&d.isFunction(t.entries)){let s={};return d.forEachEntry(t,(i,n)=>{e(Wf(i),n,s,0)}),s}return null}var Oi=Gf;function Kf(t,e,s){if(d.isString(t))try{return(e||JSON.parse)(t),d.trim(t)}catch(i){if(i.name!=="SyntaxError")throw i}return(s||JSON.stringify)(t)}var Qn={transitional:st,adapter:["xhr","http","fetch"],transformRequest:[function(e,s){let i=s.getContentType()||"",n=i.indexOf("application/json")>-1,a=d.isObject(e);if(a&&d.isHTMLForm(e)&&(e=new FormData(e)),d.isFormData(e))return n?JSON.stringify(Oi(e)):e;if(d.isArrayBuffer(e)||d.isBuffer(e)||d.isStream(e)||d.isFile(e)||d.isBlob(e)||d.isReadableStream(e))return e;if(d.isArrayBufferView(e))return e.buffer;if(d.isURLSearchParams(e))return s.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Xn(e,this.formSerializer).toString();if((o=d.isFileList(e))||i.indexOf("multipart/form-data")>-1){let p=this.env&&this.env.FormData;return tt(o?{"files[]":e}:e,p&&new p,this.formSerializer)}}return a||n?(s.setContentType("application/json",!1),Kf(e)):e}],transformResponse:[function(e){let s=this.transitional||Qn.transitional,i=s&&s.forcedJSONParsing,n=this.responseType==="json";if(d.isResponse(e)||d.isReadableStream(e))return e;if(e&&d.isString(e)&&(i&&!this.responseType||n)){let r=!(s&&s.silentJSONParsing)&&n;try{return JSON.parse(e,this.parseReviver)}catch(o){if(r)throw o.name==="SyntaxError"?_.from(o,_.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:U.classes.FormData,Blob:U.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};d.forEach(["delete","get","head","post","put","patch"],t=>{Qn.headers[t]={}});var Pt=Qn;var Jf=d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),tp=t=>{let e={},s,i,n;return t&&t.split(`
|
|
14
14
|
`).forEach(function(r){n=r.indexOf(":"),s=r.substring(0,n).trim().toLowerCase(),i=r.substring(n+1).trim(),!(!s||e[s]&&Jf[s])&&(s==="set-cookie"?e[s]?e[s].push(i):e[s]=[i]:e[s]=e[s]?e[s]+", "+i:i)}),e};var sp=Symbol("internals");function ms(t){return t&&String(t).trim().toLowerCase()}function Pi(t){return t===!1||t==null?t:d.isArray(t)?t.map(Pi):String(t)}function Yf(t){let e=Object.create(null),s=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=s.exec(t);)e[i[1]]=i[2];return e}var Xf=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function Zn(t,e,s,i,n){if(d.isFunction(i))return i.call(this,e,s);if(n&&(e=s),!!d.isString(e)){if(d.isString(i))return e.indexOf(i)!==-1;if(d.isRegExp(i))return i.test(e)}}function Qf(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,s,i)=>s.toUpperCase()+i)}function Zf(t,e){let s=d.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+s,{value:function(n,a,r){return this[i].call(this,e,n,a,r)},configurable:!0})})}var Nt=class{constructor(e){e&&this.set(e)}set(e,s,i){let n=this;function a(o,p,l){let c=ms(p);if(!c)throw new Error("header name must be a non-empty string");let m=d.findKey(n,c);(!m||n[m]===void 0||l===!0||l===void 0&&n[m]!==!1)&&(n[m||p]=Pi(o))}let r=(o,p)=>d.forEach(o,(l,c)=>a(l,c,p));if(d.isPlainObject(e)||e instanceof this.constructor)r(e,s);else if(d.isString(e)&&(e=e.trim())&&!Xf(e))r(tp(e),s);else if(d.isObject(e)&&d.isIterable(e)){let o={},p,l;for(let c of e){if(!d.isArray(c))throw TypeError("Object iterator must return a key-value pair");o[l=c[0]]=(p=o[l])?d.isArray(p)?[...p,c[1]]:[p,c[1]]:c[1]}r(o,s)}else e!=null&&a(s,e,i);return this}get(e,s){if(e=ms(e),e){let i=d.findKey(this,e);if(i){let n=this[i];if(!s)return n;if(s===!0)return Yf(n);if(d.isFunction(s))return s.call(this,n,i);if(d.isRegExp(s))return s.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,s){if(e=ms(e),e){let i=d.findKey(this,e);return!!(i&&this[i]!==void 0&&(!s||Zn(this,this[i],i,s)))}return!1}delete(e,s){let i=this,n=!1;function a(r){if(r=ms(r),r){let o=d.findKey(i,r);o&&(!s||Zn(i,i[o],o,s))&&(delete i[o],n=!0)}}return d.isArray(e)?e.forEach(a):a(e),n}clear(e){let s=Object.keys(this),i=s.length,n=!1;for(;i--;){let a=s[i];(!e||Zn(this,this[a],a,e,!0))&&(delete this[a],n=!0)}return n}normalize(e){let s=this,i={};return d.forEach(this,(n,a)=>{let r=d.findKey(i,a);if(r){s[r]=Pi(n),delete s[a];return}let o=e?Qf(a):String(a).trim();o!==a&&delete s[a],s[o]=Pi(n),i[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let s=Object.create(null);return d.forEach(this,(i,n)=>{i!=null&&i!==!1&&(s[n]=e&&d.isArray(i)?i.join(", "):i)}),s}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,s])=>e+": "+s).join(`
|
|
15
15
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...s){let i=new this(e);return s.forEach(n=>i.set(n)),i}static accessor(e){let i=(this[sp]=this[sp]={accessors:{}}).accessors,n=this.prototype;function a(r){let o=ms(r);i[o]||(Zf(n,r),i[o]=!0)}return d.isArray(e)?e.forEach(a):a(e),this}};Nt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);d.reduceDescriptors(Nt.prototype,({value:t},e)=>{let s=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[s]=i}}});d.freezeMethods(Nt);var V=Nt;function fs(t,e){let s=this||Pt,i=e||s,n=V.from(i.headers),a=i.data;return d.forEach(t,function(o){a=o.call(s,a,n.normalize(),e?e.status:void 0)}),n.normalize(),a}function hs(t){return!!(t&&t.__CANCEL__)}var ea=class extends _{constructor(e,s,i){super(e==null?"canceled":e,_.ERR_CANCELED,s,i),this.name="CanceledError",this.__CANCEL__=!0}},ve=ea;function Ue(t,e,s){let i=s.config.validateStatus;!s.status||!i||i(s.status)?t(s):e(new _("Request failed with status code "+s.status,[_.ERR_BAD_REQUEST,_.ERR_BAD_RESPONSE][Math.floor(s.status/100)-4],s.config,s.request,s))}function ta(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function sa(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function pt(t,e,s){let i=!ta(e);return t&&(i||s==!1)?sa(t,e):e}var jp=D(np(),1),Up=D(E("http"),1),Ip=D(E("https"),1),ka=D(E("http2"),1),Ra=D(E("util"),1),Fp=D(_p(),1),He=D(E("zlib"),1);var mt="1.13.6";function bs(t){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}var Ih=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function va(t,e,s){let i=s&&s.Blob||U.classes.Blob,n=bs(t);if(e===void 0&&i&&(e=!0),n==="data"){t=n.length?t.slice(n.length+1):t;let a=Ih.exec(t);if(!a)throw new _("Invalid URL",_.ERR_INVALID_URL);let r=a[1],o=a[2],p=a[3],l=Buffer.from(decodeURIComponent(p),o?"base64":"utf8");if(e){if(!i)throw new _("Blob is not supported",_.ERR_NOT_SUPPORT);return new i([l],{type:r})}return l}throw new _("Unsupported protocol "+n,_.ERR_NOT_SUPPORT)}var $e=D(E("stream"),1);var wp=D(E("stream"),1);var ya=Symbol("internals"),ba=class extends wp.default.Transform{constructor(e){e=d.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!d.isUndefined(n[i])),super({readableHighWaterMark:e.chunkSize});let s=this[ya]={timeWindow:e.timeWindow,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(s.isCaptured||(s.isCaptured=!0))})}_read(e){let s=this[ya];return s.onReadCallback&&s.onReadCallback(),super._read(e)}_transform(e,s,i){let n=this[ya],a=n.maxRate,r=this.readableHighWaterMark,o=n.timeWindow,p=1e3/o,l=a/p,c=n.minChunkSize!==!1?Math.max(n.minChunkSize,l*.01):0,m=(v,h)=>{let x=Buffer.byteLength(v);n.bytesSeen+=x,n.bytes+=x,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(v)?process.nextTick(h):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(h)}},f=(v,h)=>{let x=Buffer.byteLength(v),g=null,k=r,R,y=0;if(a){let w=Date.now();(!n.ts||(y=w-n.ts)>=o)&&(n.ts=w,R=l-n.bytes,n.bytes=R<0?-R:0,y=0),R=l-n.bytes}if(a){if(R<=0)return setTimeout(()=>{h(null,v)},o-y);R<k&&(k=R)}k&&x>k&&x-k>c&&(g=v.subarray(k),v=v.subarray(0,k)),m(v,g?()=>{process.nextTick(h,null,g)}:h)};f(e,function v(h,x){if(h)return i(h);x?f(x,v):i(null)})}},_a=ba;var Mp=E("events");var Tp=D(E("util"),1),Sp=E("stream");var{asyncIterator:Ep}=Symbol,Fh=function(t){return je(this,null,function*(){t.stream?yield*Me(t.stream()):t.arrayBuffer?yield yield new Ce(t.arrayBuffer()):t[Ep]?yield*Me(t[Ep]()):yield t})},Di=Fh;var Mh=U.ALPHABET.ALPHA_DIGIT+"-_",_s=typeof TextEncoder=="function"?new TextEncoder:new Tp.default.TextEncoder,ft=`\r
|
|
16
16
|
`,zh=_s.encode(ft),$h=2,wa=class{constructor(e,s){let{escapeName:i}=this.constructor,n=d.isString(s),a=`Content-Disposition: form-data; name="${i(e)}"${!n&&s.name?`; filename="${i(s.name)}"`:""}${ft}`;n?s=_s.encode(String(s).replace(/\r?\n|\r\n?/g,ft)):a+=`Content-Type: ${s.type||"application/octet-stream"}${ft}`,this.headers=_s.encode(a+ft),this.contentLength=n?s.byteLength:s.size,this.size=this.headers.byteLength+this.contentLength+$h,this.name=e,this.value=s}encode(){return je(this,null,function*(){yield this.headers;let{value:e}=this;d.isTypedArray(e)?yield e:yield*Me(Di(e)),yield zh})}static escapeName(e){return String(e).replace(/[\r\n"]/g,s=>({"\r":"%0D","\n":"%0A",'"':"%22"})[s])}},Hh=(t,e,s)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+U.generateString(n,Mh)}=s||{};if(!d.isFormData(t))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let r=_s.encode("--"+a+ft),o=_s.encode("--"+a+"--"+ft),p=o.byteLength,l=Array.from(t.entries()).map(([m,f])=>{let v=new wa(m,f);return p+=v.size,v});p+=r.byteLength*l.length,p=d.toFiniteNumber(p);let c={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(p)&&(c["Content-Length"]=p),e&&e(c),Sp.Readable.from((function(){return je(this,null,function*(){for(let m of l)yield r,yield*Me(m.encode());yield o})})())},kp=Hh;var Rp=D(E("stream"),1),Ea=class extends Rp.default.Transform{__transform(e,s,i){this.push(e),i()}_transform(e,s,i){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,s)}this.__transform(e,s,i)}},Cp=Ea;var Wh=(t,e)=>d.isAsyncFn(t)?function(...s){let i=s.pop();t.apply(this,s).then(n=>{try{e?i(null,...e(n)):i(null,n)}catch(a){i(a)}},i)}:t,Ap=Wh;function Vh(t,e){t=t||10;let s=new Array(t),i=new Array(t),n=0,a=0,r;return e=e!==void 0?e:1e3,function(p){let l=Date.now(),c=i[a];r||(r=l),s[n]=p,i[n]=l;let m=a,f=0;for(;m!==n;)f+=s[m++],m=m%t;if(n=(n+1)%t,n===a&&(a=(a+1)%t),l-r<e)return;let v=c&&l-c;return v?Math.round(f*1e3/v):void 0}}var Op=Vh;function Gh(t,e){let s=0,i=1e3/e,n,a,r=(l,c=Date.now())=>{s=c,n=null,a&&(clearTimeout(a),a=null),t(...l)};return[(...l)=>{let c=Date.now(),m=c-s;m>=i?r(l,c):(n=l,a||(a=setTimeout(()=>{a=null,r(n)},i-m)))},()=>n&&r(n)]}var Pp=Gh;var ze=(t,e,s=3)=>{let i=0,n=Op(50,250);return Pp(a=>{let r=a.loaded,o=a.lengthComputable?a.total:void 0,p=r-i,l=n(p),c=r<=o;i=r;let m={loaded:r,total:o,progress:o?r/o:void 0,bytes:p,rate:l||void 0,estimated:l&&o&&c?(o-r)/l:void 0,event:a,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(m)},s)},Ut=(t,e)=>{let s=t!=null;return[i=>e[0]({lengthComputable:s,total:t,loaded:i}),e[1]]},It=t=>(...e)=>d.asap(()=>t(...e));function Ta(t){if(!t||typeof t!="string"||!t.startsWith("data:"))return 0;let e=t.indexOf(",");if(e<0)return 0;let s=t.slice(5,e),i=t.slice(e+1);if(/;base64/i.test(s)){let a=i.length,r=i.length;for(let f=0;f<r;f++)if(i.charCodeAt(f)===37&&f+2<r){let v=i.charCodeAt(f+1),h=i.charCodeAt(f+2);(v>=48&&v<=57||v>=65&&v<=70||v>=97&&v<=102)&&(h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102)&&(a-=2,f+=2)}let o=0,p=r-1,l=f=>f>=2&&i.charCodeAt(f-2)===37&&i.charCodeAt(f-1)===51&&(i.charCodeAt(f)===68||i.charCodeAt(f)===100);p>=0&&(i.charCodeAt(p)===61?(o++,p--):l(p)&&(o++,p-=3)),o===1&&p>=0&&(i.charCodeAt(p)===61||l(p))&&o++;let m=Math.floor(a/4)*3-(o||0);return m>0?m:0}return Buffer.byteLength(i,"utf8")}var Np={flush:He.default.constants.Z_SYNC_FLUSH,finishFlush:He.default.constants.Z_SYNC_FLUSH},Kh={flush:He.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:He.default.constants.BROTLI_OPERATION_FLUSH},Lp=d.isFunction(He.default.createBrotliDecompress),{http:Jh,https:Yh}=Fp.default,Xh=/https:?/,qp=U.protocols.map(t=>t+":"),Bp=(t,[e,s])=>(t.on("end",s).on("error",s),e),Sa=class{constructor(){this.sessions=Object.create(null)}getSession(e,s){s=Object.assign({sessionTimeout:1e3},s);let i=this.sessions[e];if(i){let c=i.length;for(let m=0;m<c;m++){let[f,v]=i[m];if(!f.destroyed&&!f.closed&&Ra.default.isDeepStrictEqual(v,s))return f}}let n=ka.default.connect(e,s),a,r=()=>{if(a)return;a=!0;let c=i,m=c.length,f=m;for(;f--;)if(c[f][0]===n){m===1?delete this.sessions[e]:c.splice(f,1);return}},o=n.request,{sessionTimeout:p}=s;if(p!=null){let c,m=0;n.request=function(){let f=o.apply(this,arguments);return m++,c&&(clearTimeout(c),c=null),f.once("close",()=>{--m||(c=setTimeout(()=>{c=null,r()},p))}),f}}n.once("close",r);let l=[n,s];return i?i.push(l):i=this.sessions[e]=[l],n}},Qh=new Sa;function Zh(t,e){t.beforeRedirects.proxy&&t.beforeRedirects.proxy(t),t.beforeRedirects.config&&t.beforeRedirects.config(t,e)}function zp(t,e,s){let i=e;if(!i&&i!==!1){let n=jp.default.getProxyForUrl(s);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){if(!!(i.auth.username||i.auth.password))i.auth=(i.auth.username||"")+":"+(i.auth.password||"");else if(typeof i.auth=="object")throw new _("Invalid proxy authorization",_.ERR_BAD_OPTION,{proxy:i});let r=Buffer.from(i.auth,"utf8").toString("base64");t.headers["Proxy-Authorization"]="Basic "+r}t.headers.host=t.hostname+(t.port?":"+t.port:"");let n=i.hostname||i.host;t.hostname=n,t.host=n,t.port=i.port,t.path=s,i.protocol&&(t.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}t.beforeRedirects.proxy=function(a){zp(a,e,a.href)}}var ex=typeof process!="undefined"&&d.kindOf(process)==="process",tx=t=>new Promise((e,s)=>{let i,n,a=(p,l)=>{n||(n=!0,i&&i(p,l))},r=p=>{a(p),e(p)},o=p=>{a(p,!0),s(p)};t(r,o,p=>i=p).catch(o)}),sx=({address:t,family:e})=>{if(!d.isString(t))throw TypeError("address must be a string");return{address:t,family:e||(t.indexOf(".")<0?6:4)}},Dp=(t,e)=>sx(d.isObject(t)?t:{address:t,family:e}),ix={request(t,e){let s=t.protocol+"//"+t.hostname+":"+(t.port||(t.protocol==="https:"?443:80)),{http2Options:i,headers:n}=t,a=Qh.getSession(s,i),{HTTP2_HEADER_SCHEME:r,HTTP2_HEADER_METHOD:o,HTTP2_HEADER_PATH:p,HTTP2_HEADER_STATUS:l}=ka.default.constants,c={[r]:t.protocol.replace(":",""),[o]:t.method,[p]:t.path};d.forEach(n,(f,v)=>{v.charAt(0)!==":"&&(c[v]=f)});let m=a.request(c);return m.once("response",f=>{let v=m;f=Object.assign({},f);let h=f[l];delete f[l],v.headers=f,v.statusCode=+h,e(v)}),m}},$p=ex&&function(e){return tx(function(i,n,a){return u(this,null,function*(){let{data:r,lookup:o,family:p,httpVersion:l=1,http2Options:c}=e,{responseType:m,responseEncoding:f}=e,v=e.method.toUpperCase(),h,x=!1,g;if(l=+l,Number.isNaN(l))throw TypeError(`Invalid protocol version: '${e.httpVersion}' is not a number`);if(l!==1&&l!==2)throw TypeError(`Unsupported protocol version '${l}'`);let k=l===2;if(o){let C=Ap(o,T=>d.isArray(T)?T:[T]);o=(T,F,ne)=>{C(T,F,(L,Z,ae)=>{if(L)return ne(L);let ee=d.isArray(Z)?Z.map(Et=>Dp(Et)):[Dp(Z,ae)];F.all?ne(L,ee):ne(L,ee[0].address,ee[0].family)})}}let R=new Mp.EventEmitter;function y(C){try{R.emit("abort",!C||C.type?new ve(null,e,g):C)}catch(T){console.warn("emit error",T)}}R.once("abort",n);let w=()=>{e.cancelToken&&e.cancelToken.unsubscribe(y),e.signal&&e.signal.removeEventListener("abort",y),R.removeAllListeners()};(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(y),e.signal&&(e.signal.aborted?y():e.signal.addEventListener("abort",y))),a((C,T)=>{if(h=!0,T){x=!0,w();return}let{data:F}=C;if(F instanceof $e.default.Readable||F instanceof $e.default.Duplex){let ne=$e.default.finished(F,()=>{ne(),w()})}else w()});let I=pt(e.baseURL,e.url,e.allowAbsoluteUrls),P=new URL(I,U.hasBrowserEnv?U.origin:void 0),j=P.protocol||qp[0];if(j==="data:"){if(e.maxContentLength>-1){let T=String(e.url||I||"");if(Ta(T)>e.maxContentLength)return n(new _("maxContentLength size of "+e.maxContentLength+" exceeded",_.ERR_BAD_RESPONSE,e))}let C;if(v!=="GET")return Ue(i,n,{status:405,statusText:"method not allowed",headers:{},config:e});try{C=va(e.url,m==="blob",{Blob:e.env&&e.env.Blob})}catch(T){throw _.from(T,_.ERR_BAD_REQUEST,e)}return m==="text"?(C=C.toString(f),(!f||f==="utf8")&&(C=d.stripBOM(C))):m==="stream"&&(C=$e.default.Readable.from(C)),Ue(i,n,{data:C,status:200,statusText:"OK",headers:new V,config:e})}if(qp.indexOf(j)===-1)return n(new _("Unsupported protocol "+j,_.ERR_BAD_REQUEST,e));let M=V.from(e.headers).normalize();M.set("User-Agent","axios/"+mt,!1);let{onUploadProgress:ce,onDownloadProgress:De}=e,Fe=e.maxRate,Re,K;if(d.isSpecCompliantForm(r)){let C=M.getContentType(/boundary=([-_\w\d]{10,70})/i);r=kp(r,T=>{M.set(T)},{tag:`axios-${mt}-boundary`,boundary:C&&C[1]||void 0})}else if(d.isFormData(r)&&d.isFunction(r.getHeaders)){if(M.set(r.getHeaders()),!M.hasContentLength())try{let C=yield Ra.default.promisify(r.getLength).call(r);Number.isFinite(C)&&C>=0&&M.setContentLength(C)}catch(C){}}else if(d.isBlob(r)||d.isFile(r))r.size&&M.setContentType(r.type||"application/octet-stream"),M.setContentLength(r.size||0),r=$e.default.Readable.from(Di(r));else if(r&&!d.isStream(r)){if(!Buffer.isBuffer(r))if(d.isArrayBuffer(r))r=Buffer.from(new Uint8Array(r));else if(d.isString(r))r=Buffer.from(r,"utf-8");else return n(new _("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",_.ERR_BAD_REQUEST,e));if(M.setContentLength(r.length,!1),e.maxBodyLength>-1&&r.length>e.maxBodyLength)return n(new _("Request body larger than maxBodyLength limit",_.ERR_BAD_REQUEST,e))}let ge=d.toFiniteNumber(M.getContentLength());d.isArray(Fe)?(Re=Fe[0],K=Fe[1]):Re=K=Fe,r&&(ce||Re)&&(d.isStream(r)||(r=$e.default.Readable.from(r,{objectMode:!1})),r=$e.default.pipeline([r,new _a({maxRate:d.toFiniteNumber(Re)})],d.noop),ce&&r.on("progress",Bp(r,Ut(ge,ze(It(ce),!1,3)))));let Ee;if(e.auth){let C=e.auth.username||"",T=e.auth.password||"";Ee=C+":"+T}if(!Ee&&P.username){let C=P.username,T=P.password;Ee=C+":"+T}Ee&&M.delete("authorization");let J;try{J=ct(P.pathname+P.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(C){let T=new Error(C.message);return T.config=e,T.url=e.url,T.exists=!0,n(T)}M.set("Accept-Encoding","gzip, compress, deflate"+(Lp?", br":""),!1);let W={path:J,method:v,headers:M.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:Ee,protocol:j,family:p,beforeRedirect:Zh,beforeRedirects:{},http2Options:c};!d.isUndefined(o)&&(W.lookup=o),e.socketPath?W.socketPath=e.socketPath:(W.hostname=P.hostname.startsWith("[")?P.hostname.slice(1,-1):P.hostname,W.port=P.port,zp(W,e.proxy,j+"//"+P.hostname+(P.port?":"+P.port:"")+W.path));let Y,Ze=Xh.test(W.protocol);if(W.agent=Ze?e.httpsAgent:e.httpAgent,k?Y=ix:e.transport?Y=e.transport:e.maxRedirects===0?Y=Ze?Ip.default:Up.default:(e.maxRedirects&&(W.maxRedirects=e.maxRedirects),e.beforeRedirect&&(W.beforeRedirects.config=e.beforeRedirect),Y=Ze?Yh:Jh),e.maxBodyLength>-1?W.maxBodyLength=e.maxBodyLength:W.maxBodyLength=1/0,e.insecureHTTPParser&&(W.insecureHTTPParser=e.insecureHTTPParser),g=Y.request(W,function(T){if(g.destroyed)return;let F=[T],ne=d.toFiniteNumber(T.headers["content-length"]);if(De||K){let ee=new _a({maxRate:d.toFiniteNumber(K)});De&&ee.on("progress",Bp(ee,Ut(ne,ze(It(De),!0,3)))),F.push(ee)}let L=T,Z=T.req||g;if(e.decompress!==!1&&T.headers["content-encoding"])switch((v==="HEAD"||T.statusCode===204)&&delete T.headers["content-encoding"],(T.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":F.push(He.default.createUnzip(Np)),delete T.headers["content-encoding"];break;case"deflate":F.push(new Cp),F.push(He.default.createUnzip(Np)),delete T.headers["content-encoding"];break;case"br":Lp&&(F.push(He.default.createBrotliDecompress(Kh)),delete T.headers["content-encoding"])}L=F.length>1?$e.default.pipeline(F,d.noop):F[0];let ae={status:T.statusCode,statusText:T.statusMessage,headers:new V(T.headers),config:e,request:Z};if(m==="stream")ae.data=L,Ue(i,n,ae);else{let ee=[],Et=0;L.on("data",function(le){ee.push(le),Et+=le.length,e.maxContentLength>-1&&Et>e.maxContentLength&&(x=!0,L.destroy(),y(new _("maxContentLength size of "+e.maxContentLength+" exceeded",_.ERR_BAD_RESPONSE,e,Z)))}),L.on("aborted",function(){if(x)return;let le=new _("stream has been aborted",_.ERR_BAD_RESPONSE,e,Z);L.destroy(le),n(le)}),L.on("error",function(le){g.destroyed||n(_.from(le,null,e,Z))}),L.on("end",function(){try{let le=ee.length===1?ee[0]:Buffer.concat(ee);m!=="arraybuffer"&&(le=le.toString(f),(!f||f==="utf8")&&(le=d.stripBOM(le))),ae.data=le}catch(le){return n(_.from(le,null,e,ae.request,ae))}Ue(i,n,ae)})}R.once("abort",ee=>{L.destroyed||(L.emit("error",ee),L.destroy())})}),R.once("abort",C=>{g.close?g.close():g.destroy(C)}),g.on("error",function(T){n(_.from(T,null,e,g))}),g.on("socket",function(T){T.setKeepAlive(!0,1e3*60)}),e.timeout){let C=parseInt(e.timeout,10);if(Number.isNaN(C)){y(new _("error trying to parse `config.timeout` to int",_.ERR_BAD_OPTION_VALUE,e,g));return}g.setTimeout(C,function(){if(h)return;let F=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",ne=e.transitional||st;e.timeoutErrorMessage&&(F=e.timeoutErrorMessage),y(new _(F,ne.clarifyTimeoutError?_.ETIMEDOUT:_.ECONNABORTED,e,g))})}else g.setTimeout(0);if(d.isStream(r)){let C=!1,T=!1;r.on("end",()=>{C=!0}),r.once("error",F=>{T=!0,g.destroy(F)}),r.on("close",()=>{!C&&!T&&y(new ve("Request stream has been aborted",e,g))}),r.pipe(g)}else r&&g.write(r),g.end()})})};var Hp=U.hasStandardBrowserEnv?((t,e)=>s=>(s=new URL(s,U.origin),t.protocol===s.protocol&&t.host===s.host&&(e||t.port===s.port)))(new URL(U.origin),U.navigator&&/(msie|trident)/i.test(U.navigator.userAgent)):()=>!0;var Wp=U.hasStandardBrowserEnv?{write(t,e,s,i,n,a,r){if(typeof document=="undefined")return;let o=[`${t}=${encodeURIComponent(e)}`];d.isNumber(s)&&o.push(`expires=${new Date(s).toUTCString()}`),d.isString(i)&&o.push(`path=${i}`),d.isString(n)&&o.push(`domain=${n}`),a===!0&&o.push("secure"),d.isString(r)&&o.push(`SameSite=${r}`),document.cookie=o.join("; ")},read(t){if(typeof document=="undefined")return null;let e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};var Vp=t=>t instanceof V?N({},t):t;function Ne(t,e){e=e||{};let s={};function i(l,c,m,f){return d.isPlainObject(l)&&d.isPlainObject(c)?d.merge.call({caseless:f},l,c):d.isPlainObject(c)?d.merge({},c):d.isArray(c)?c.slice():c}function n(l,c,m,f){if(d.isUndefined(c)){if(!d.isUndefined(l))return i(void 0,l,m,f)}else return i(l,c,m,f)}function a(l,c){if(!d.isUndefined(c))return i(void 0,c)}function r(l,c){if(d.isUndefined(c)){if(!d.isUndefined(l))return i(void 0,l)}else return i(void 0,c)}function o(l,c,m){if(m in e)return i(l,c);if(m in t)return i(void 0,l)}let p={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,withXSRFToken:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(l,c,m)=>n(Vp(l),Vp(c),m,!0)};return d.forEach(Object.keys(N(N({},t),e)),function(c){if(c==="__proto__"||c==="constructor"||c==="prototype")return;let m=d.hasOwnProp(p,c)?p[c]:n,f=m(t[c],e[c],c);d.isUndefined(f)&&m!==o||(s[c]=f)}),s}var ji=t=>{let e=Ne({},t),{data:s,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:r,auth:o}=e;if(e.headers=r=V.from(r),e.url=ct(pt(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&r.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),d.isFormData(s)){if(U.hasStandardBrowserEnv||U.hasStandardBrowserWebWorkerEnv)r.setContentType(void 0);else if(d.isFunction(s.getHeaders)){let p=s.getHeaders(),l=["content-type","content-length"];Object.entries(p).forEach(([c,m])=>{l.includes(c.toLowerCase())&&r.set(c,m)})}}if(U.hasStandardBrowserEnv&&(i&&d.isFunction(i)&&(i=i(e)),i||i!==!1&&Hp(e.url))){let p=n&&a&&Wp.read(a);p&&r.set(n,p)}return e};var nx=typeof XMLHttpRequest!="undefined",Gp=nx&&function(t){return new Promise(function(s,i){let n=ji(t),a=n.data,r=V.from(n.headers).normalize(),{responseType:o,onUploadProgress:p,onDownloadProgress:l}=n,c,m,f,v,h;function x(){v&&v(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(c),n.signal&&n.signal.removeEventListener("abort",c)}let g=new XMLHttpRequest;g.open(n.method.toUpperCase(),n.url,!0),g.timeout=n.timeout;function k(){if(!g)return;let y=V.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),I={data:!o||o==="text"||o==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:y,config:t,request:g};Ue(function(j){s(j),x()},function(j){i(j),x()},I),g=null}"onloadend"in g?g.onloadend=k:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(k)},g.onabort=function(){g&&(i(new _("Request aborted",_.ECONNABORTED,t,g)),g=null)},g.onerror=function(w){let I=w&&w.message?w.message:"Network Error",P=new _(I,_.ERR_NETWORK,t,g);P.event=w||null,i(P),g=null},g.ontimeout=function(){let w=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",I=n.transitional||st;n.timeoutErrorMessage&&(w=n.timeoutErrorMessage),i(new _(w,I.clarifyTimeoutError?_.ETIMEDOUT:_.ECONNABORTED,t,g)),g=null},a===void 0&&r.setContentType(null),"setRequestHeader"in g&&d.forEach(r.toJSON(),function(w,I){g.setRequestHeader(I,w)}),d.isUndefined(n.withCredentials)||(g.withCredentials=!!n.withCredentials),o&&o!=="json"&&(g.responseType=n.responseType),l&&([f,h]=ze(l,!0),g.addEventListener("progress",f)),p&&g.upload&&([m,v]=ze(p),g.upload.addEventListener("progress",m),g.upload.addEventListener("loadend",v)),(n.cancelToken||n.signal)&&(c=y=>{g&&(i(!y||y.type?new ve(null,t,g):y),g.abort(),g=null)},n.cancelToken&&n.cancelToken.subscribe(c),n.signal&&(n.signal.aborted?c():n.signal.addEventListener("abort",c)));let R=bs(n.url);if(R&&U.protocols.indexOf(R)===-1){i(new _("Unsupported protocol "+R+":",_.ERR_BAD_REQUEST,t));return}g.send(a||null)})};var ax=(t,e)=>{let{length:s}=t=t?t.filter(Boolean):[];if(e||s){let i=new AbortController,n,a=function(l){if(!n){n=!0,o();let c=l instanceof Error?l:this.reason;i.abort(c instanceof _?c:new ve(c instanceof Error?c.message:c))}},r=e&&setTimeout(()=>{r=null,a(new _(`timeout of ${e}ms exceeded`,_.ETIMEDOUT))},e),o=()=>{t&&(r&&clearTimeout(r),r=null,t.forEach(l=>{l.unsubscribe?l.unsubscribe(a):l.removeEventListener("abort",a)}),t=null)};t.forEach(l=>l.addEventListener("abort",a));let{signal:p}=i;return p.unsubscribe=()=>d.asap(o),p}},Kp=ax;var rx=function*(t,e){let s=t.byteLength;if(!e||s<e){yield t;return}let i=0,n;for(;i<s;)n=i+e,yield t.slice(i,n),i=n},ox=function(t,e){return je(this,null,function*(){try{for(var s=Cr(cx(t)),i,n,a;i=!(n=yield new Ce(s.next())).done;i=!1){let r=n.value;yield*Me(rx(r,e))}}catch(n){a=[n]}finally{try{i&&(n=s.return)&&(yield new Ce(n.call(s)))}finally{if(a)throw a[0]}}})},cx=function(t){return je(this,null,function*(){if(t[Symbol.asyncIterator]){yield*Me(t);return}let e=t.getReader();try{for(;;){let{done:s,value:i}=yield new Ce(e.read());if(s)break;yield i}}finally{yield new Ce(e.cancel())}})},Ca=(t,e,s,i)=>{let n=ox(t,e),a=0,r,o=l=>{r||(r=!0,i&&i(l))};return new ReadableStream({pull(l){return u(this,null,function*(){try{let{done:c,value:m}=yield n.next();if(c){o(),l.close();return}let f=m.byteLength;if(s){let v=a+=f;s(v)}l.enqueue(new Uint8Array(m))}catch(c){throw o(c),c}})},cancel(l){return o(l),n.return()}},{highWaterMark:2})};var Jp=64*1024,{isFunction:Ui}=d,px=(({Request:t,Response:e})=>({Request:t,Response:e}))(d.global),{ReadableStream:Yp,TextEncoder:Xp}=d.global,Qp=(t,...e)=>{try{return!!t(...e)}catch(s){return!1}},lx=t=>{t=d.merge.call({skipUndefined:!0},px,t);let{fetch:e,Request:s,Response:i}=t,n=e?Ui(e):typeof fetch=="function",a=Ui(s),r=Ui(i);if(!n)return!1;let o=n&&Ui(Yp),p=n&&(typeof Xp=="function"?(h=>x=>h.encode(x))(new Xp):h=>u(null,null,function*(){return new Uint8Array(yield new s(h).arrayBuffer())})),l=a&&o&&Qp(()=>{let h=!1,x=new s(U.origin,{body:new Yp,method:"POST",get duplex(){return h=!0,"half"}}).headers.has("Content-Type");return h&&!x}),c=r&&o&&Qp(()=>d.isReadableStream(new i("").body)),m={stream:c&&(h=>h.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(h=>{!m[h]&&(m[h]=(x,g)=>{let k=x&&x[h];if(k)return k.call(x);throw new _(`Response type '${h}' is not supported`,_.ERR_NOT_SUPPORT,g)})});let f=h=>u(null,null,function*(){if(h==null)return 0;if(d.isBlob(h))return h.size;if(d.isSpecCompliantForm(h))return(yield new s(U.origin,{method:"POST",body:h}).arrayBuffer()).byteLength;if(d.isArrayBufferView(h)||d.isArrayBuffer(h))return h.byteLength;if(d.isURLSearchParams(h)&&(h=h+""),d.isString(h))return(yield p(h)).byteLength}),v=(h,x)=>u(null,null,function*(){let g=d.toFiniteNumber(h.getContentLength());return g==null?f(x):g});return h=>u(null,null,function*(){let{url:x,method:g,data:k,signal:R,cancelToken:y,timeout:w,onDownloadProgress:I,onUploadProgress:P,responseType:j,headers:M,withCredentials:ce="same-origin",fetchOptions:De}=ji(h),Fe=e||fetch;j=j?(j+"").toLowerCase():"text";let Re=Kp([R,y&&y.toAbortSignal()],w),K=null,ge=Re&&Re.unsubscribe&&(()=>{Re.unsubscribe()}),Ee;try{if(P&&l&&g!=="get"&&g!=="head"&&(Ee=yield v(M,k))!==0){let T=new s(x,{method:"POST",body:k,duplex:"half"}),F;if(d.isFormData(k)&&(F=T.headers.get("content-type"))&&M.setContentType(F),T.body){let[ne,L]=Ut(Ee,ze(It(P)));k=Ca(T.body,Jp,ne,L)}}d.isString(ce)||(ce=ce?"include":"omit");let J=a&&"credentials"in s.prototype,W=re(N({},De),{signal:Re,method:g.toUpperCase(),headers:M.normalize().toJSON(),body:k,duplex:"half",credentials:J?ce:void 0});K=a&&new s(x,W);let Y=yield a?Fe(K,De):Fe(x,W),Ze=c&&(j==="stream"||j==="response");if(c&&(I||Ze&&ge)){let T={};["status","statusText","headers"].forEach(Z=>{T[Z]=Y[Z]});let F=d.toFiniteNumber(Y.headers.get("content-length")),[ne,L]=I&&Ut(F,ze(It(I),!0))||[];Y=new i(Ca(Y.body,Jp,ne,()=>{L&&L(),ge&&ge()}),T)}j=j||"text";let C=yield m[d.findKey(m,j)||"text"](Y,h);return!Ze&&ge&&ge(),yield new Promise((T,F)=>{Ue(T,F,{data:C,headers:V.from(Y.headers),status:Y.status,statusText:Y.statusText,config:h,request:K})})}catch(J){throw ge&&ge(),J&&J.name==="TypeError"&&/Load failed|fetch/i.test(J.message)?Object.assign(new _("Network Error",_.ERR_NETWORK,h,K,J&&J.response),{cause:J.cause||J}):_.from(J,J&&J.code,h,K,J&&J.response)}})},ux=new Map,Aa=t=>{let e=t&&t.env||{},{fetch:s,Request:i,Response:n}=e,a=[i,n,s],r=a.length,o=r,p,l,c=ux;for(;o--;)p=a[o],l=c.get(p),l===void 0&&c.set(p,l=o?new Map:lx(e)),c=l;return l},ww=Aa();var Oa={http:$p,xhr:Gp,fetch:{get:Aa}};d.forEach(Oa,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(s){}Object.defineProperty(t,"adapterName",{value:e})}});var Zp=t=>`- ${t}`,mx=t=>d.isFunction(t)||t===null||t===!1;function fx(t,e){t=d.isArray(t)?t:[t];let{length:s}=t,i,n,a={};for(let r=0;r<s;r++){i=t[r];let o;if(n=i,!mx(i)&&(n=Oa[(o=String(i)).toLowerCase()],n===void 0))throw new _(`Unknown adapter '${o}'`);if(n&&(d.isFunction(n)||(n=n.get(e))))break;a[o||"#"+r]=n}if(!n){let r=Object.entries(a).map(([p,l])=>`adapter ${p} `+(l===!1?"is not supported by the environment":"is not available in the build")),o=s?r.length>1?`since :
|
|
17
17
|
`+r.map(Zp).join(`
|
|
18
18
|
`):" "+Zp(r[0]):"as no adapter specified";throw new _("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return n}var Ii={getAdapter:fx,adapters:Oa};function Pa(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ve(null,t)}function Fi(t){return Pa(t),t.headers=V.from(t.headers),t.data=fs.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Ii.getAdapter(t.adapter||Pt.adapter,t)(t).then(function(i){return Pa(t),i.data=fs.call(t,t.transformResponse,i),i.headers=V.from(i.headers),i},function(i){return hs(i)||(Pa(t),i&&i.response&&(i.response.data=fs.call(t,t.transformResponse,i.response),i.response.headers=V.from(i.response.headers))),Promise.reject(i)})}var Mi={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Mi[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});var el={};Mi.transitional=function(e,s,i){function n(a,r){return"[Axios v"+mt+"] Transitional option '"+a+"'"+r+(i?". "+i:"")}return(a,r,o)=>{if(e===!1)throw new _(n(r," has been removed"+(s?" in "+s:"")),_.ERR_DEPRECATED);return s&&!el[r]&&(el[r]=!0,console.warn(n(r," has been deprecated since v"+s+" and will be removed in the near future"))),e?e(a,r,o):!0}};Mi.spelling=function(e){return(s,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function hx(t,e,s){if(typeof t!="object")throw new _("options must be an object",_.ERR_BAD_OPTION_VALUE);let i=Object.keys(t),n=i.length;for(;n-- >0;){let a=i[n],r=e[a];if(r){let o=t[a],p=o===void 0||r(o,a,t);if(p!==!0)throw new _("option "+a+" must be "+p,_.ERR_BAD_OPTION_VALUE);continue}if(s!==!0)throw new _("Unknown option "+a,_.ERR_BAD_OPTION)}}var ws={assertOptions:hx,validators:Mi};var Te=ws.validators,Ft=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Vn,response:new Vn}}request(e,s){return u(this,null,function*(){try{return yield this._request(e,s)}catch(i){if(i instanceof Error){let n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;let a=n.stack?n.stack.replace(/^.+\n/,""):"";try{i.stack?a&&!String(i.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(i.stack+=`
|
|
19
|
-
`+a):i.stack=a}catch(r){}}throw i}})}_request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=Ne(this.defaults,s);let{transitional:i,paramsSerializer:n,headers:a}=s;i!==void 0&&ws.assertOptions(i,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean),legacyInterceptorReqResOrdering:Te.transitional(Te.boolean)},!1),n!=null&&(d.isFunction(n)?s.paramsSerializer={serialize:n}:ws.assertOptions(n,{encode:Te.function,serialize:Te.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),ws.assertOptions(s,{baseUrl:Te.spelling("baseURL"),withXsrfToken:Te.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let r=a&&d.merge(a.common,a[s.method]);a&&d.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),s.headers=V.concat(r,a);let o=[],p=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(s)===!1)return;p=p&&x.synchronous;let g=s.transitional||st;g&&g.legacyInterceptorReqResOrdering?o.unshift(x.fulfilled,x.rejected):o.push(x.fulfilled,x.rejected)});let l=[];this.interceptors.response.forEach(function(x){l.push(x.fulfilled,x.rejected)});let c,m=0,f;if(!p){let h=[Fi.bind(this),void 0];for(h.unshift(...o),h.push(...l),f=h.length,c=Promise.resolve(s);m<f;)c=c.then(h[m++],h[m++]);return c}f=o.length;let v=s;for(;m<f;){let h=o[m++],x=o[m++];try{v=h(v)}catch(g){x.call(this,g);break}}try{c=Fi.call(this,v)}catch(h){return Promise.reject(h)}for(m=0,f=l.length;m<f;)c=c.then(l[m++],l[m++]);return c}getUri(e){e=Ne(this.defaults,e);let s=pt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(s,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){Ft.prototype[e]=function(s,i){return this.request(Ne(i||{},{method:e,url:s,data:(i||{}).data}))}});d.forEach(["post","put","patch"],function(e){function s(i){return function(a,r,o){return this.request(Ne(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:a,data:r}))}}Ft.prototype[e]=s(),Ft.prototype[e+"Form"]=s(!0)});var Es=Ft;var Na=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(a){s=a});let i=this;this.promise.then(n=>{if(!i._listeners)return;let a=i._listeners.length;for(;a-- >0;)i._listeners[a](n);i._listeners=null}),this.promise.then=n=>{let a,r=new Promise(o=>{i.subscribe(o),a=o}).then(n);return r.cancel=function(){i.unsubscribe(a)},r},e(function(a,r,o){i.reason||(i.reason=new ve(a,r,o),s(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){let e=new AbortController,s=i=>{e.abort(i)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new t(function(n){e=n}),cancel:e}}},tl=Na;function La(t){return function(s){return t.apply(null,s)}}function qa(t){return d.isObject(t)&&t.isAxiosError===!0}var Ba={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ba).forEach(([t,e])=>{Ba[e]=t});var sl=Ba;function il(t){let e=new Es(t),s=as(Es.prototype.request,e);return d.extend(s,Es.prototype,e,{allOwnKeys:!0}),d.extend(s,e,null,{allOwnKeys:!0}),s.create=function(n){return il(Ne(t,n))},s}var X=il(Pt);X.Axios=Es;X.CanceledError=ve;X.CancelToken=tl;X.isCancel=hs;X.VERSION=mt;X.toFormData=tt;X.AxiosError=_;X.Cancel=X.CanceledError;X.all=function(e){return Promise.all(e)};X.spread=La;X.isAxiosError=qa;X.mergeConfig=Ne;X.AxiosHeaders=V;X.formToJSON=t=>Oi(d.isHTMLForm(t)?new FormData(t):t);X.getAdapter=Ii.getAdapter;X.HttpStatusCode=sl;X.default=X;var Mt=X;var{Axios:_E,AxiosError:wE,CanceledError:EE,isCancel:TE,CancelToken:SE,VERSION:kE,all:RE,Cancel:CE,isAxiosError:AE,spread:OE,toFormData:PE,AxiosHeaders:NE,HttpStatusCode:LE,formToJSON:qE,getAdapter:BE,mergeConfig:DE}=Mt;var ol=D(al(),1);var Da="axios-retry";function cl(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,ol.default)(t)}var pl=["get","head","options"],gx=pl.concat(["put","delete"]);function ja(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function vx(t){var e;return(e=t.config)!=null&&e.method?ja(t)&&pl.indexOf(t.config.method)!==-1:!1}function ll(t){var e;return(e=t.config)!=null&&e.method?ja(t)&&gx.indexOf(t.config.method)!==-1:!1}function ul(t){return cl(t)||ll(t)}function Ua(t=void 0){var i;let e=(i=t==null?void 0:t.response)==null?void 0:i.headers["retry-after"];if(!e)return 0;let s=(Number(e)||0)*1e3;return s===0&&(s=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,s)}function yx(t=0,e=void 0){return Math.max(0,Ua(e))}function bx(t=0,e=void 0,s=100){let i=kr(2,t)*s,n=Math.max(i,Ua(e)),a=n*.2*Math.random();return n+a}function _x(t=100){return(e=0,s=void 0)=>{let i=e*t;return Math.max(i,Ua(s))}}var wx={retries:3,retryCondition:ul,retryDelay:yx,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function Ex(t,e){return N(N(N({},wx),e),t[Da])}function rl(t,e,s=!1){let i=Ex(t,e||{});return i.retryCount=i.retryCount||0,(!i.lastRequestTime||s)&&(i.lastRequestTime=Date.now()),t[Da]=i,i}function Tx(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}function Sx(t,e){return u(this,null,function*(){let{retries:s,retryCondition:i}=t,n=(t.retryCount||0)<s&&i(e);if(typeof n=="object")try{return(yield n)!==!1}catch(a){return!1}return n})}function kx(t,e,s,i){return u(this,null,function*(){var p;e.retryCount+=1;let{retryDelay:n,shouldResetTimeout:a,onRetry:r}=e,o=n(e.retryCount,s);if(Tx(t,i),!a&&i.timeout&&e.lastRequestTime){let l=Date.now()-e.lastRequestTime,c=i.timeout-l-o;if(c<=0)return Promise.reject(s);i.timeout=c}return i.transformRequest=[l=>l],yield r(e.retryCount,s,i),(p=i.signal)!=null&&p.aborted?Promise.resolve(t(i)):new Promise(l=>{var f;let c=()=>{clearTimeout(m),l(t(i))},m=setTimeout(()=>{var v;l(t(i)),(v=i.signal)!=null&&v.removeEventListener&&i.signal.removeEventListener("abort",c)},o);(f=i.signal)!=null&&f.addEventListener&&i.signal.addEventListener("abort",c,{once:!0})})})}function Rx(t,e){return u(this,null,function*(){t.retryCount>=t.retries&&(yield t.onMaxRetryTimesExceeded(e,t.retryCount))})}var it=(t,e)=>{let s=t.interceptors.request.use(n=>{var a;return rl(n,e,!0),(a=n[Da])!=null&&a.validateResponse&&(n.validateStatus=()=>!1),n}),i=t.interceptors.response.use(null,n=>u(null,null,function*(){var o;let{config:a}=n;if(!a)return Promise.reject(n);let r=rl(a,e);return n.response&&((o=r.validateResponse)!=null&&o.call(r,n.response))?n.response:(yield Sx(r,n))?kx(t,r,n,a):(yield Rx(r,n),Promise.reject(n))}));return{requestInterceptorId:s,responseInterceptorId:i}};it.isNetworkError=cl;it.isSafeRequestError=vx;it.isIdempotentRequestError=ll;it.isNetworkOrIdempotentRequestError=ul;it.exponentialDelay=bx;it.linearDelay=_x;it.isRetryableError=ja;var zi=it;var $i=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},be=class extends $i{constructor(s,i,n){super(s);A(this,"status");A(this,"code");this.name="APIError",this.status=i,this.code=n}},Ts=class extends be{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},Ia=class extends be{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var S=class{constructor(e){this.client=e}post(e,s,i){return u(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.post(e,s,n)).data}catch(n){this.handleError(n)}})}get(e,s){return u(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.get(e,i)).data}catch(i){this.handleError(i)}})}patch(e,s,i){return u(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.patch(e,s,n)).data}catch(n){this.handleError(n)}})}put(e,s,i){return u(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.put(e,s,n)).data}catch(n){this.handleError(n)}})}deleteRequest(e,s){return u(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.delete(e,i)).data}catch(i){this.handleError(i)}})}buildConfig(e){if(!e)return;let s=N({},e);return e.idempotencyKey&&(s.headers=re(N({},s.headers),{"Idempotency-Key":e.idempotencyKey})),s}handleError(e){var s,i,n;throw e.response?new be(((s=e.response.data)==null?void 0:s.message)||((i=e.response.data)==null?void 0:i.error)||"API Request Failed",e.response.status,(n=e.response.data)==null?void 0:n.code):new be(e.message||"Network Error")}};var Ss=class extends S{send(e){return u(this,null,function*(){return this.post("/api/saas/chat/send",e)})}sendTemplate(e){return u(this,null,function*(){return this.post("/api/saas/chat/send",re(N({},e),{templateLanguage:e.language||"en_US"}))})}star(e,s){return u(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/star`,{isStarred:s})})}react(e,s){return u(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/react`,{reaction:s})})}markRead(e){return u(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`)})}};var ks=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/chat/conversations",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/chat/conversations",e)})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}`)})}messages(e,s){return u(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}/messages`,{params:s})})}linkLead(e,s,i){return u(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/link-lead`,{leadId:s,leadData:i})})}markRead(e){return u(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`,{})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/chat/conversations/${e}`)})}bulkDelete(e){return u(this,null,function*(){return this.post("/api/saas/chat/conversations/bulk-delete",{ids:e})})}};var Rs=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/chat/broadcasts",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/chat/broadcast",e)})}};var Cs=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/whatsapp/templates",{params:e})})}sync(){return u(this,null,function*(){return this.post("/api/saas/whatsapp/templates/sync",{})})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}`)})}create(e){return u(this,null,function*(){return this.post("/api/saas/whatsapp/templates",e)})}update(e,s){return u(this,null,function*(){return this.put(`/api/saas/whatsapp/templates/${e}`,s)})}deleteTemplate(e,s){return u(this,null,function*(){return this.deleteRequest(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}${s?"?force=true":""}`)})}mappingConfig(){return u(this,null,function*(){return this.get("/api/saas/whatsapp/templates/mapping/config")})}collections(){return u(this,null,function*(){return this.get("/api/saas/whatsapp/templates/collections")})}collectionFields(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/collections/${encodeURIComponent(e)}/fields`)})}updateMapping(e,s){return u(this,null,function*(){return this.put(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/mapping`,s)})}validate(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/validate`)})}preview(e,s){return u(this,null,function*(){return this.post(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:s})})}checkUsage(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/usage`)})}};var As=class extends S{constructor(s){super(s);A(this,"messages");A(this,"conversations");A(this,"broadcasts");A(this,"templates");this.messages=new Ss(s),this.conversations=new ks(s),this.broadcasts=new Rs(s),this.templates=new Cs(s)}upload(s,i){return u(this,null,function*(){let n=new FormData;return n.append("file",s,i),this.post("/api/saas/whatsapp/upload",n,{headers:typeof n.getHeaders=="function"?n.getHeaders():void 0})})}sendTemplate(s){return u(this,null,function*(){return this.post("/api/saas/whatsapp/send-template",s)})}};var Os=class extends S{create(e){return u(this,null,function*(){return this.post("/api/services/leads",e)})}upsert(e){return u(this,null,function*(){return this.post("/api/services/leads/upsert",e)})}createMany(e,s=50){return u(this,null,function*(){let i=[];for(let n=0;n<e.length;n+=s){let r=e.slice(n,n+s).map(p=>this.create(p)),o=yield Promise.allSettled(r);for(let p of o)if(p.status==="fulfilled")i.push(p.value);else throw p.reason}return i})}import(e){return u(this,null,function*(){return this.post("/api/services/leads/import",{leads:e})})}list(e){return u(this,null,function*(){let s=N({},e);return Array.isArray(s.tags)&&(s.tags=s.tags.join(",")),this.get("/api/services/leads",{params:s})})}listAutoPaging(e){return je(this,null,function*(){let s=(e==null?void 0:e.page)||1,i=!0;for(;i;){let n=yield new Ce(this.list(re(N({},e),{page:s}))),a=Array.isArray(n.data)?n.data:n||[];if(a.length===0){i=!1;break}for(let r of a)yield r;n.pagination&&s<n.pagination.pages||!n.pagination&&a.length>0?s++:i=!1}})}retrieve(e){return u(this,null,function*(){return this.get(`/api/services/leads/${e}`)})}retrieveByPhone(e){return u(this,null,function*(){return this.get(`/api/services/leads/phone/${encodeURIComponent(e)}`)})}retrieveByRef(e,s){return u(this,null,function*(){return this.get(`/api/services/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(s)}`)})}update(e,s){return u(this,null,function*(){return this.post(`/api/services/leads/${e}`,s)})}move(e,s){return u(this,null,function*(){return this.patch(`/api/services/leads/${e}/move`,{stageId:s})})}convert(e,s,i){return u(this,null,function*(){return this.post(`/api/services/leads/${e}/convert`,{outcome:s,reason:i})})}tags(e,s){return u(this,null,function*(){return this.patch(`/api/services/leads/${e}/tags`,s)})}recalculateScore(e){return u(this,null,function*(){return this.post(`/api/services/leads/${e}/score`,{})})}updateMetadata(e,s){return u(this,null,function*(){return this.patch(`/api/services/leads/${e}/metadata`,s)})}fields(){return u(this,null,function*(){return this.get("/api/services/leads/fields")})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/services/leads/${e}`)})}bulkDelete(e){return u(this,null,function*(){return this.deleteRequest("/api/services/leads",{data:{ids:e}})})}};var Ps=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/crm/pipelines",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/crm/pipelines",e)})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/crm/pipelines/${e}`)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/pipelines/${e}`,s)})}setDefault(e){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/default`,{})})}duplicate(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/duplicate`,{newName:s})})}archive(e){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/archive`,{})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/pipelines/${e}`)})}board(e){return u(this,null,function*(){return this.get(`/api/saas/crm/pipelines/${e}/board`)})}forecast(e){return u(this,null,function*(){return this.get(`/api/saas/crm/pipelines/${e}/forecast`)})}addStage(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/stages`,s)})}reorderStages(e,s){return u(this,null,function*(){return this.put(`/api/saas/crm/pipelines/${e}/stages/reorder`,{order:s})})}updateStage(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/stages/${e}`,s)})}deleteStage(e,s){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/stages/${e}`,{data:s?{moveLeadsToStageId:s}:void 0})})}};var Hi=class extends S{list(e){return u(this,null,function*(){return this.get(`/api/saas/crm/leads/${e}/notes`)})}create(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/leads/${e}/notes`,s)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/notes/${e}`,{content:s})})}pin(e,s=!0){return u(this,null,function*(){return this.patch(`/api/saas/crm/notes/${e}/pin`,{isPinned:s})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/notes/${e}`)})}},Ns=class extends S{constructor(s){super(s);A(this,"notes");this.notes=new Hi(s)}timeline(s,i){return u(this,null,function*(){return this.get(`/api/saas/crm/leads/${s}/timeline`,{params:i})})}list(s,i){return u(this,null,function*(){return this.get("/api/saas/crm/activities",{params:N({leadId:s},i)})})}log(s){return u(this,null,function*(){return this.post("/api/saas/crm/activities",s)})}logCall(s,i){return u(this,null,function*(){return this.post(`/api/saas/crm/leads/${s}/calls`,i)})}};var Ls=class extends S{overview(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/overview",{params:e})})}funnel(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/funnel",{params:{pipelineId:e}})})}forecast(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/forecast",{params:{pipelineId:e}})})}sources(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/sources",{params:e})})}team(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/team",{params:e})})}heatmap(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/heatmap",{params:e})})}scores(){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/scores")})}stageTime(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/stage-time",{params:{pipelineId:e}})})}tiered(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/tiered",{params:e})})}summary(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/summary",{params:e})})}whatsapp(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/whatsapp",{params:e})})}};var qs=class extends S{list(){return u(this,null,function*(){return this.get("/api/saas/crm/automations")})}create(e){return u(this,null,function*(){return this.post("/api/saas/crm/automations",e)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/automations/${e}`,s)})}toggle(e){return u(this,null,function*(){return this.patch(`/api/saas/crm/automations/${e}/toggle`)})}deleteRule(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/automations/${e}`)})}bulkDelete(e){return u(this,null,function*(){return this.post("/api/saas/crm/automations/bulk-delete",{ids:e})})}test(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/${e}/test`,{leadId:s})})}getAvailableEvents(){return u(this,null,function*(){return this.post("/api/saas/crm/automations/events",{})})}enrollments(e,s){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/${e}/enrollments`,{params:s})})}getEnrollment(e){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/enrollments/${e}`)})}pauseEnrollment(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/${e}/enrollments/${s}/pause`,{})})}resumeEnrollment(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/${e}/enrollments/${s}/resume`,{})})}runs(e){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/${e}/runs`)})}getRun(e){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/runs/${e}`)})}resumeRun(e){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/runs/${e}/resume`,{})})}abortRun(e){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/runs/${e}/abort`,{})})}webhookEvent(e,s,i){return u(this,null,function*(){return this.post("/api/saas/crm/webhook-event",{ruleId:e,eventName:s,payload:i})})}};var Bs=class extends S{enroll(e){return u(this,null,function*(){return this.post("/api/saas/crm/sequences/enroll",e)})}unenroll(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/sequences/unenroll/${e}`)})}listForLead(e){return u(this,null,function*(){return this.get(`/api/saas/crm/sequences/lead/${e}`)})}};var Ds=class extends S{getConfig(){return u(this,null,function*(){return this.get("/api/saas/crm/scoring")})}updateConfig(e){return u(this,null,function*(){return this.patch("/api/saas/crm/scoring",e)})}recalculate(e){return u(this,null,function*(){return this.post(`/api/saas/crm/scoring/${e}/recalculate`,{})})}};var js=class extends S{capture(e){return u(this,null,function*(){return this.post("/api/saas/crm/payments/capture",e)})}};var Us=class extends S{stats(){return u(this,null,function*(){return this.get("/api/saas/crm/automation/stats")})}logs(e){return u(this,null,function*(){return this.get("/api/saas/crm/automation/logs",{params:e})})}retryFailedEvent(e){return u(this,null,function*(){return this.post(`/api/saas/crm/automation/logs/${e}/retry`,{})})}};var Is=class{constructor(e){A(this,"leads");A(this,"pipelines");A(this,"activities");A(this,"analytics");A(this,"automations");A(this,"sequences");A(this,"scoring");A(this,"payments");A(this,"automationDashboard");this.leads=new Os(e),this.pipelines=new Ps(e),this.activities=new Ns(e),this.analytics=new Ls(e),this.automations=new qs(e),this.sequences=new Bs(e),this.scoring=new Ds(e),this.payments=new js(e),this.automationDashboard=new Us(e)}};var Fs=class extends S{getUsage(){return u(this,null,function*(){return this.get("/api/saas/storage/usage")})}createFolder(e){return u(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}list(e,s){return u(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}delete(e){return u(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}getDownloadUrl(e){return u(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}upload(e,s){return u(this,null,function*(){let{data:i}=yield this.client.post("/api/saas/storage/upload-url",s),{uploadUrl:n,key:a}=i;yield Mt.put(n,e,{headers:{"Content-Type":s.contentType}});let r=e.size||e.byteLength||0;return this.post("/api/saas/storage/confirm-upload",{key:a,sizeBytes:r})})}};var Ms=class extends S{create(e){return u(this,null,function*(){return this.post("/api/saas/meet",e)})}list(e){return u(this,null,function*(){return this.get("/api/saas/meet",{params:e})})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/meet/${e}`)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}reschedule(e,s){return u(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}delete(e){return u(this,null,function*(){return this.update(e,{status:"cancelled"})})}};var zs=class extends S{listLogs(e){return u(this,null,function*(){return this.get("/api/saas/events/logs",{params:e})})}retrieveLog(e){return u(this,null,function*(){return this.get(`/api/saas/events/logs/${e}`)})}getStats(e){return u(this,null,function*(){return this.get("/api/saas/events/stats",{params:e})})}listCallbacks(e){return u(this,null,function*(){return this.get("/api/saas/callbacks/logs",{params:e})})}listAlerts(e){return u(this,null,function*(){return this.get("/api/saas/crm/notifications",{params:e})})}dismissAlert(e){return u(this,null,function*(){return this.patch(`/api/saas/crm/notifications/${e}/dismiss`)})}clearAllAlerts(){return u(this,null,function*(){return this.deleteRequest("/api/saas/crm/notifications/clear-all")})}retryAction(e){return u(this,null,function*(){return this.post(`/api/saas/crm/notifications/${e}/retry`,{})})}};var $s=class extends S{sendEmailCampaign(e){return u(this,null,function*(){return this.post("/api/saas/emails/campaign",e)})}sendTestEmail(e){return u(this,null,function*(){return this.post("/api/saas/emails/test",{to:e})})}};var Hs=class extends S{list(){return u(this,null,function*(){return this.get("/api/saas/events")})}assign(e){return u(this,null,function*(){return this.post("/api/saas/events/assign",e)})}unassign(e){return u(this,null,function*(){return this.post("/api/saas/events/unassign",{name:e})})}unassignBulk(e){return u(this,null,function*(){return this.post("/api/saas/events/unassign/bulk",{names:e})})}trigger(e){return u(this,null,function*(){return this.post("/api/saas/workflows/trigger",e)})}listCustomEvents(){return u(this,null,function*(){return this.get("/api/saas/crm/custom-events")})}createCustomEvent(e){return u(this,null,function*(){return this.post("/api/saas/crm/custom-events",e)})}deleteCustomEvent(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/custom-events/${e}`)})}emit(e){return u(this,null,function*(){return this.post("/api/saas/crm/events/emit",e)})}};var ht=class extends be{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},Ws=class{constructEvent(e,s,i){return u(this,null,function*(){if(!s)throw new ht("No webhook signature provided");let n=Array.isArray(s)?s[0]:s;n.startsWith("sha256=")&&(n=n.slice(7));try{let a=yield import("crypto"),o=a.createHmac("sha256",i).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(o),Buffer.from(n)))throw new ht("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof ht?a:new ht(`Webhook payload parsing failed: ${a.message}`)}})}};var Wi=class extends S{create(e){return u(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/storage/folders/${encodeURIComponent(e)}`)})}},Vi=class extends S{list(e,s){return u(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}getUploadUrl(e){return u(this,null,function*(){return this.post("/api/saas/storage/upload-url",e)})}confirmUpload(e){return u(this,null,function*(){return this.post("/api/saas/storage/confirm-upload",e)})}getDownloadUrl(e){return u(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}delete(e){return u(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}},Vs=class extends S{constructor(s){super(s);A(this,"folders");A(this,"files");this.folders=new Wi(s),this.files=new Vi(s)}usage(){return u(this,null,function*(){return this.get("/api/saas/storage/usage")})}};var Gi=class extends S{sendCampaign(e){return u(this,null,function*(){return this.post("/api/saas/marketing/emails/campaign",e)})}sendTest(e){return u(this,null,function*(){return this.post("/api/saas/marketing/emails/test",{to:e})})}},Ki=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/marketing/campaigns",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/marketing/campaigns",e)})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/marketing/campaigns/${e}`)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/marketing/campaigns/${e}`,s)})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/marketing/campaigns/${e}`)})}send(e,s){return u(this,null,function*(){return this.post(`/api/saas/marketing/campaigns/${e}/send`,s||{})})}stats(e){return u(this,null,function*(){return this.get(`/api/saas/marketing/campaigns/${e}/stats`)})}},Ji=class extends S{sendTemplate(e){return u(this,null,function*(){return this.post("/api/saas/marketing/whatsapp/send-template",e)})}},Gs=class extends S{constructor(s){super(s);A(this,"emails");A(this,"campaigns");A(this,"whatsapp");this.emails=new Gi(s),this.campaigns=new Ki(s),this.whatsapp=new Ji(s)}};var Ks=class extends S{system(){return u(this,null,function*(){return(yield this.get("/api/saas/health",{headers:{accept:"application/json"}})).data})}clientHealth(){return u(this,null,function*(){return(yield this.get("/api/saas/health/client")).data})}jobStatus(e){return u(this,null,function*(){return(yield this.get(`/api/saas/jobs/status/${e}`)).data})}};var Js=class extends S{listFailed(){return u(this,null,function*(){return this.get("/api/saas/queue/failed")})}getStats(){return u(this,null,function*(){return this.get("/api/saas/queue/stats")})}retryJob(e){return u(this,null,function*(){return this.post(`/api/saas/queue/${e}/retry`,{})})}deleteJob(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/queue/${e}`)})}};var Va=D(fl(),1);var Le=Object.create(null);Le.open="0";Le.close="1";Le.ping="2";Le.pong="3";Le.message="4";Le.upgrade="5";Le.noop="6";var Ys=Object.create(null);Object.keys(Le).forEach(t=>{Ys[Le[t]]=t});var Xs={type:"error",data:"parser error"};var Qs=({type:t,data:e},s,i)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?i(s?e:"b"+hl(e,!0).toString("base64")):i(Le[t]+(e||"")),hl=(t,e)=>Buffer.isBuffer(t)||t instanceof Uint8Array&&!e?t:t instanceof ArrayBuffer?Buffer.from(t):Buffer.from(t.buffer,t.byteOffset,t.byteLength),Ma;function xl(t,e){if(t.data instanceof ArrayBuffer||ArrayBuffer.isView(t.data))return e(hl(t.data,!1));Qs(t,!0,s=>{Ma||(Ma=new TextEncoder),e(Ma.encode(s))})}var Zs=(t,e)=>{if(typeof t!="string")return{type:"message",data:gl(t,e)};let s=t.charAt(0);if(s==="b"){let i=Buffer.from(t.substring(1),"base64");return{type:"message",data:gl(i,e)}}return Ys[s]?t.length>1?{type:Ys[s],data:t.substring(1)}:{type:Ys[s]}:Xs},gl=(t,e)=>{switch(e){case"arraybuffer":return t instanceof ArrayBuffer?t:Buffer.isBuffer(t)?t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength):t.buffer;case"nodebuffer":default:return Buffer.isBuffer(t)?t:Buffer.from(t)}};var vl="",yl=(t,e)=>{let s=t.length,i=new Array(s),n=0;t.forEach((a,r)=>{Qs(a,!1,o=>{i[r]=o,++n===s&&e(i.join(vl))})})},bl=(t,e)=>{let s=t.split(vl),i=[];for(let n=0;n<s.length;n++){let a=Zs(s[n],e);if(i.push(a),a.type==="error")break}return i};function _l(){return new TransformStream({transform(t,e){xl(t,s=>{let i=s.length,n;if(i<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,i);else if(i<65536){n=new Uint8Array(3);let a=new DataView(n.buffer);a.setUint8(0,126),a.setUint16(1,i)}else{n=new Uint8Array(9);let a=new DataView(n.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(s)})}})}var za;function Yi(t){return t.reduce((e,s)=>e+s.length,0)}function Xi(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),i=0;for(let n=0;n<e;n++)s[n]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),s}function wl(t,e){za||(za=new TextDecoder);let s=[],i=0,n=-1,a=!1;return new TransformStream({transform(r,o){for(s.push(r);;){if(i===0){if(Yi(s)<1)break;let p=Xi(s,1);a=(p[0]&128)===128,n=p[0]&127,n<126?i=3:n===126?i=1:i=2}else if(i===1){if(Yi(s)<2)break;let p=Xi(s,2);n=new DataView(p.buffer,p.byteOffset,p.length).getUint16(0),i=3}else if(i===2){if(Yi(s)<8)break;let p=Xi(s,8),l=new DataView(p.buffer,p.byteOffset,p.length),c=l.getUint32(0);if(c>Math.pow(2,21)-1){o.enqueue(Xs);break}n=c*Math.pow(2,32)+l.getUint32(4),i=3}else{if(Yi(s)<n)break;let p=Xi(s,n);o.enqueue(Zs(a?p:za.decode(p),e)),i=0}if(n===0||n>t){o.enqueue(Xs);break}}}})}var $a=4;function $(t){if(t)return Ax(t)}function Ax(t){for(var e in $.prototype)t[e]=$.prototype[e];return t}$.prototype.on=$.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};$.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this};$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+t];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,n=0;n<s.length;n++)if(i=s[n],i===e||i.fn===e){s.splice(n,1);break}return s.length===0&&delete this._callbacks["$"+t],this};$.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,n=s.length;i<n;++i)s[i].apply(this,e)}return this};$.prototype.emitReserved=$.prototype.emit;$.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};$.prototype.hasListeners=function(t){return!!this.listeners(t).length};var We=process.nextTick,de=global,El="nodebuffer";function Tl(){return new Ha}function Ox(t){let e=t.split("; "),s=e[0].indexOf("=");if(s===-1)return;let i=e[0].substring(0,s).trim();if(!i.length)return;let n=e[0].substring(s+1).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));let a={name:i,value:n};for(let r=1;r<e.length;r++){let o=e[r].split("=");if(o.length!==2)continue;let p=o[0].trim(),l=o[1].trim();switch(p){case"Expires":a.expires=new Date(l);break;case"Max-Age":let c=new Date;c.setUTCSeconds(c.getUTCSeconds()+parseInt(l,10)),a.expires=c;break;default:}}return a}var Ha=class{constructor(){this._cookies=new Map}parseCookies(e){e&&e.forEach(s=>{let i=Ox(s);i&&this._cookies.set(i.name,i)})}get cookies(){let e=Date.now();return this._cookies.forEach((s,i)=>{var n;((n=s.expires)===null||n===void 0?void 0:n.getTime())<e&&this._cookies.delete(i)}),this._cookies.entries()}addCookies(e){let s=[];for(let[i,n]of this.cookies)s.push(`${i}=${n.value}`);s.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",s.join("; ")))}appendCookies(e){for(let[s,i]of this.cookies)e.append("cookie",`${s}=${i.value}`)}};function Qi(t,...e){return e.reduce((s,i)=>(t.hasOwnProperty(i)&&(s[i]=t[i]),s),{})}var Px=de.setTimeout,Nx=de.clearTimeout;function Ve(t,e){e.useNativeTimers?(t.setTimeoutFn=Px.bind(de),t.clearTimeoutFn=Nx.bind(de)):(t.setTimeoutFn=de.setTimeout.bind(de),t.clearTimeoutFn=de.clearTimeout.bind(de))}var Lx=1.33;function Sl(t){return typeof t=="string"?qx(t):Math.ceil((t.byteLength||t.size)*Lx)}function qx(t){let e=0,s=0;for(let i=0,n=t.length;i<n;i++)e=t.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function Zi(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function kl(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}function Rl(t){let e={},s=t.split("&");for(let i=0,n=s.length;i<n;i++){let a=s[i].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}var Cl=D(ye(),1),Bx=(0,Cl.default)("engine.io-client:transport"),en=class extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}},Ge=class extends ${constructor(e){super(),this.writable=!1,Ve(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new en(e,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Bx("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let s=Zs(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let s=kl(e);return s.length?"?"+s:""}};var Al=D(ye(),1),qe=(0,Al.default)("engine.io-client:polling"),ei=class extends Ge{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let s=()=>{qe("paused"),this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(qe("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){qe("pre-pause polling complete"),--i||s()})),this.writable||(qe("we are currently writing - waiting to pause"),i++,this.once("drain",function(){qe("pre-pause writing complete"),--i||s()}))}else s()}_poll(){qe("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){qe("polling got data %s",e);let s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};bl(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():qe('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{qe("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(qe("transport open - closing"),e()):(qe("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,yl(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Zi()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}};var Ol=!1;try{Ol=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(t){}var Pl=Ol;var Ll=D(ye(),1),Wa=(0,Ll.default)("engine.io-client:polling");function Dx(){}var tn=class extends ei{constructor(e){if(super(e),typeof location!="undefined"){let s=location.protocol==="https:",i=location.port;i||(i=s?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){let i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(n,a)=>{this.onError("xhr post error",n,a)})}doPoll(){Wa("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}},Ke=class t extends ${constructor(e,s,i){super(),this.createRequest=e,Ve(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;let s=Qi(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{Wa("xhr open %s: %s",this._method,this._uri),i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch(n){}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(n){}try{i.setRequestHeader("Accept","*/*")}catch(n){}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},Wa("xhr data %s",this._data),i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document!="undefined"&&(this._index=t.requestsCount++,t.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr=="undefined"||this._xhr===null)){if(this._xhr.onreadystatechange=Dx,e)try{this._xhr.abort()}catch(s){}typeof document!="undefined"&&delete t.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Ke.requestsCount=0;Ke.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Nl);else if(typeof addEventListener=="function"){let t="onpagehide"in de?"pagehide":"unload";addEventListener(t,Nl,!1)}}function Nl(){for(let t in Ke.requests)Ke.requests.hasOwnProperty(t)&&Ke.requests[t].abort()}var sS=(function(){let t=jx({xdomain:!1});return t&&t.responseType!==null})();function jx(t){let e=t.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||Pl))return new XMLHttpRequest}catch(s){}if(!e)try{return new de[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(s){}}var Ux=Va.default||Va,$t=class extends tn{request(e={}){var s;return Object.assign(e,{xd:this.xd,cookieJar:(s=this.socket)===null||s===void 0?void 0:s._cookieJar},this.opts),new Ke(i=>new Ux(i),this.uri(),e)}};var iv=D(Cu(),1),nv=D(ir(),1),av=D(rr(),1),fr=D(fn(),1),rv=D(ju(),1);var Uu=D(ye(),1),cv=(0,Uu.default)("engine.io-client:websocket"),pv=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",xn=class extends Ge{get name(){return"websocket"}doOpen(){let e=this.uri(),s=this.opts.protocols,i=pv?{}:Qi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,s,i)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;Qs(i,this.supportsBinary,a=>{try{this.doWrite(i,a)}catch(r){cv("websocket closed before onclose event")}n&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Zi()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}},NS=de.WebSocket||de.MozWebSocket;var Xt=class extends xn{createSocket(e,s,i){var n;if(!((n=this.socket)===null||n===void 0)&&n._cookieJar){i.headers=i.headers||{},i.headers.cookie=typeof i.headers.cookie=="string"?[i.headers.cookie]:i.headers.cookie||[];for(let[a,r]of this.socket._cookieJar.cookies)i.headers.cookie.push(`${a}=${r.value}`)}return new fr.default(e,s,i)}doWrite(e,s){let i={};e.options&&(i.compress=e.options.compress),this.opts.perMessageDeflate&&(typeof s=="string"?Buffer.byteLength(s):s.length)<this.opts.perMessageDeflate.threshold&&(i.compress=!1),this.ws.send(s,i)}};var Iu=D(ye(),1),pi=(0,Iu.default)("engine.io-client:webtransport"),Qt=class extends Ge{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{pi("transport closed gracefully"),this.onClose()}).catch(e=>{pi("transport closed due to %s",e),this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let s=wl(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),n=_l();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();let a=()=>{i.read().then(({done:o,value:p})=>{if(o){pi("session is closed");return}pi("received chunk: %o",p),this.onPacket(p),a()}).catch(o=>{pi("an error occurred while reading: %s",o)})};a();let r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this._writer.write(r).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;this._writer.write(i).then(()=>{n&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var hr={websocket:Xt,webtransport:Qt,polling:$t};var lv=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,uv=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zt(t){if(t.length>8e3)throw"URI too long";let e=t,s=t.indexOf("["),i=t.indexOf("]");s!=-1&&i!=-1&&(t=t.substring(0,s)+t.substring(s,i).replace(/:/g,";")+t.substring(i,t.length));let n=lv.exec(t||""),a={},r=14;for(;r--;)a[uv[r]]=n[r]||"";return s!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=dv(a,a.path),a.queryKey=mv(a,a.query),a}function dv(t,e){let s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function mv(t,e){let s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,n,a){n&&(s[n]=a)}),s}var Fu=D(ye(),1),z=(0,Fu.default)("engine.io-client:socket"),xr=typeof addEventListener=="function"&&typeof removeEventListener=="function",li=[];xr&&addEventListener("offline",()=>{z("closing %d connection(s) because the network was lost",li.length),li.forEach(t=>t())},!1);var _t=class t extends ${constructor(e,s){if(super(),this.binaryType=El,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){let i=Zt(e);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Zt(s.host).host);Ve(this,s),this.secure=s.secure!=null?s.secure:typeof location!="undefined"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=s.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Rl(this.opts.query)),xr&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(z("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},li.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=Tl()),this._open()}createTransport(e){z('creating transport "%s"',e);let s=Object.assign({},this.opts.query);s.EIO=$a,s.transport=e,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return z("options: %j",i),new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){z("setting transport %s",e.name),this.transport&&(z("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){z("socket open"),this.readyState="open",t.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(z('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else z('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();z("flushing %d packets in socket",e.length),this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Sl(n)),i>0&&s>this._maxPayload)return z("only send %d out of %d packets",i,this.writeBuffer.length),this.writeBuffer.slice(0,i);s+=2}return z("payload size is %d (max: %d)",s,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(z("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,We(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let a={type:e,data:s,options:i};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),z("socket closing - telling transport to close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(z("socket error %j",e),t.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return z("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(z('socket close with reason: "%s"',e),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),xr&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=li.indexOf(this._offlineEventListener);i!==-1&&(z("removing listener for the 'offline' event"),li.splice(i,1))}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}};_t.protocol=$a;var gn=class extends _t{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){z("starting upgrade probes");for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}}_probe(e){z('probing transport "%s"',e);let s=this.createTransport(e),i=!1;_t.priorWebsocketSuccess=!1;let n=()=>{i||(z('probe transport "%s" opened',e),s.send([{type:"ping",data:"probe"}]),s.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(z('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;_t.priorWebsocketSuccess=s.name==="websocket",z('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{i||this.readyState!=="closed"&&(z("changing transport and sending upgrade packet"),c(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{z('probe transport "%s" failed',e);let f=new Error("probe error");f.transport=s.name,this.emitReserved("upgradeError",f)}}))};function a(){i||(i=!0,c(),s.close(),s=null)}let r=m=>{let f=new Error("probe error: "+m);f.transport=s.name,a(),z('probe transport "%s" failed because of error: %s',e,m),this.emitReserved("upgradeError",f)};function o(){r("transport closed")}function p(){r("socket closed")}function l(m){s&&m.name!==s.name&&(z('"%s" works - aborting "%s"',m.name,s.name),a())}let c=()=>{s.removeListener("open",n),s.removeListener("error",r),s.removeListener("close",o),this.off("close",p),this.off("upgrading",l)};s.once("open",n),s.once("error",r),s.once("close",o),this.once("close",p),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}},es=class extends gn{constructor(e,s={}){let i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(n=>hr[n]).filter(n=>!!n)),super(e,i)}};var sk=es.protocol;var zu=D(ye(),1),Mu=(0,zu.default)("socket.io-client:url");function $u(t,e="",s){let i=t;s=s||typeof location!="undefined"&&location,t==null&&(t=s.protocol+"//"+s.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=s.protocol+t:t=s.host+t),/^(https?|wss?):\/\//.test(t)||(Mu("protocol-less url %s",t),typeof s!="undefined"?t=s.protocol+"//"+t:t="https://"+t),Mu("parse %s",t),i=Zt(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let a=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+a+":"+i.port+e,i.href=i.protocol+"://"+a+(s&&s.port===i.port?"":":"+i.port),i}var Er={};_n(Er,{Decoder:()=>_r,Encoder:()=>br,PacketType:()=>O,isPacketValid:()=>Tv,protocol:()=>Ju});var gv=typeof ArrayBuffer=="function",vv=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Hu=Object.prototype.toString,yv=typeof Blob=="function"||typeof Blob!="undefined"&&Hu.call(Blob)==="[object BlobConstructor]",bv=typeof File=="function"||typeof File!="undefined"&&Hu.call(File)==="[object FileConstructor]";function di(t){return gv&&(t instanceof ArrayBuffer||vv(t))||yv&&t instanceof Blob||bv&&t instanceof File}function ui(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let s=0,i=t.length;s<i;s++)if(ui(t[s]))return!0;return!1}if(di(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return ui(t.toJSON(),!0);for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&ui(t[s]))return!0;return!1}function Wu(t){let e=[],s=t.data,i=t;return i.data=gr(s,e),i.attachments=e.length,{packet:i,buffers:e}}function gr(t,e){if(!t)return t;if(di(t)){let s={_placeholder:!0,num:e.length};return e.push(t),s}else if(Array.isArray(t)){let s=new Array(t.length);for(let i=0;i<t.length;i++)s[i]=gr(t[i],e);return s}else if(typeof t=="object"&&!(t instanceof Date)){let s={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=gr(t[i],e));return s}return t}function Vu(t,e){return t.data=vr(t.data,e),delete t.attachments,t}function vr(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let s=0;s<t.length;s++)t[s]=vr(t[s],e);else if(typeof t=="object")for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(t[s]=vr(t[s],e));return t}var Gu=D(ye(),1),yr=(0,Gu.default)("socket.io-parser"),Ku=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ju=5,O;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(O||(O={}));var br=class{constructor(e){this.replacer=e}encode(e){return yr("encoding packet %j",e),(e.type===O.EVENT||e.type===O.ACK)&&ui(e)?this.encodeAsBinary({type:e.type===O.EVENT?O.BINARY_EVENT:O.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===O.BINARY_EVENT||e.type===O.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),yr("encoded %j as %s",e,s),s}encodeAsBinary(e){let s=Wu(e),i=this.encodeAsString(s.packet),n=s.buffers;return n.unshift(i),n}},_r=class t extends ${constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);let i=s.type===O.BINARY_EVENT;i||s.type===O.BINARY_ACK?(s.type=i?O.EVENT:O.ACK,this.reconstructor=new wr(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(di(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let s=0,i={type:Number(e.charAt(0))};if(O[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===O.BINARY_EVENT||i.type===O.BINARY_ACK){let a=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);let r=e.substring(a,s);if(r!=Number(r)||e.charAt(s)!=="-")throw new Error("Illegal attachments");let o=Number(r);if(!Yu(o)||o<0)throw new Error("Illegal attachments");if(o>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=o}if(e.charAt(s+1)==="/"){let a=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(a,s)}else i.nsp="/";let n=e.charAt(s+1);if(n!==""&&Number(n)==n){let a=s+1;for(;++s;){let r=e.charAt(s);if(r==null||Number(r)!=r){--s;break}if(s===e.length)break}i.id=Number(e.substring(a,s+1))}if(e.charAt(++s)){let a=this.tryParse(e.substr(s));if(t.isPayloadValid(i.type,a))i.data=a;else throw new Error("invalid payload")}return yr("decoded %s as %j",e,i),i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(s){return!1}}static isPayloadValid(e,s){switch(e){case O.CONNECT:return vn(s);case O.DISCONNECT:return s===void 0;case O.CONNECT_ERROR:return typeof s=="string"||vn(s);case O.EVENT:case O.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Ku.indexOf(s[0])===-1);case O.ACK:case O.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},wr=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let s=Vu(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function _v(t){return typeof t=="string"}var Yu=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function wv(t){return t===void 0||Yu(t)}function vn(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ev(t,e){switch(t){case O.CONNECT:return e===void 0||vn(e);case O.DISCONNECT:return e===void 0;case O.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Ku.indexOf(e[0])===-1);case O.ACK:return Array.isArray(e);case O.CONNECT_ERROR:return typeof e=="string"||vn(e);default:return!1}}function Tv(t){return _v(t.nsp)&&wv(t.id)&&Ev(t.type,t.data)}function we(t,e,s){return t.on(e,s),function(){t.off(e,s)}}var Xu=D(ye(),1),Q=(0,Xu.default)("socket.io-client:socket"),Sv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ts=class extends ${constructor(e,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[we(e,"open",this.onopen.bind(this)),we(e,"packet",this.onpacket.bind(this)),we(e,"error",this.onerror.bind(this)),we(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,n,a;if(Sv.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;let r={type:O.EVENT,data:s};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){let c=this.ids++;Q("emitting packet with ack id %d",c);let m=s.pop();this._registerAckCallback(c,m),r.id=c}let o=(n=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||n===void 0?void 0:n.writable,p=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!o?Q("discard packet as the transport is not currently writable"):p?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,s){var i;let n=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(n===void 0){this.acks[e]=s;return}let a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(Q("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));Q("event with ack id %d has timed out after %d ms",e,n),s.call(this,new Error("operation has timed out"))},n),r=(...o)=>{this.io.clearTimeoutFn(a),s.apply(this,o)};r.withError=!0,this.acks[e]=r}emitWithAck(e,...s){return new Promise((i,n)=>{let a=(r,o)=>r?n(r):i(o);a.withError=!0,s.push(a),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...a)=>i!==this._queue[0]?Q("packet [%d] already acknowledged",i.id):(n!==null?i.tryCount>this._opts.retries&&(Q("packet [%d] is discarded after %d tries",i.id,i.tryCount),this._queue.shift(),s&&s(n)):(Q("packet [%d] was successfully sent",i.id),this._queue.shift(),s&&s(null,...a)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(Q("draining queue"),!this.connected||this._queue.length===0)return;let s=this._queue[0];if(s.pending&&!e){Q("packet [%d] has already been sent and is waiting for an ack",s.id);return}s.pending=!0,s.tryCount++,Q("sending packet [%d] (try n\xB0%d)",s.id,s.tryCount),this.flags=s.flags,this.emit.apply(this,s.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){Q("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:O.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,s){Q("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){let i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case O.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case O.EVENT:case O.BINARY_EVENT:this.onevent(e);break;case O.ACK:case O.BINARY_ACK:this.onack(e);break;case O.DISCONNECT:this.ondisconnect();break;case O.CONNECT_ERROR:this.destroy();let i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){let s=e.data||[];Q("emitting event %j",s),e.id!=null&&(Q("attaching ack callback to event"),s.push(this.ack(e.id))),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let s=this._anyListeners.slice();for(let i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let s=this,i=!1;return function(...n){i||(i=!0,Q("sending ack %j",n),s.packet({type:O.ACK,id:e,data:n}))}}onack(e){let s=this.acks[e.id];if(typeof s!="function"){Q("bad ack %s",e.id);return}delete this.acks[e.id],Q("calling ack %s with %j",e.id,e.data),s.withError&&e.data.unshift(null),s.apply(this,e.data)}onconnect(e,s){Q("socket connected with id %s",e),this.id=e,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){Q("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(Q("performing disconnect (%s)",this.nsp),this.packet({type:O.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let s=this._anyOutgoingListeners.slice();for(let i of s)i.apply(this,e.data)}}};function wt(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}wt.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-s:t+s}return Math.min(t,this.max)|0};wt.prototype.reset=function(){this.attempts=0};wt.prototype.setMin=function(t){this.ms=t};wt.prototype.setMax=function(t){this.max=t};wt.prototype.setJitter=function(t){this.jitter=t};var Qu=D(ye(),1),oe=(0,Qu.default)("socket.io-client:manager"),ss=class extends ${constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Ve(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new wt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;let n=s.parser||Er;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(oe("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;oe("opening %s",this.uri),this.engine=new es(this.uri,this.opts);let s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let n=we(s,"open",function(){i.onopen(),e&&e()}),a=o=>{oe("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},r=we(s,"error",a);if(this._timeout!==!1){let o=this._timeout;oe("connect attempt will timeout after %d",o);let p=this.setTimeoutFn(()=>{oe("connect attempt timed out after %d",o),n(),a(new Error("timeout")),s.close()},o);this.opts.autoUnref&&p.unref(),this.subs.push(()=>{this.clearTimeoutFn(p)})}return this.subs.push(n),this.subs.push(r),this}connect(e){return this.open(e)}onopen(){oe("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(we(e,"ping",this.onping.bind(this)),we(e,"data",this.ondata.bind(this)),we(e,"error",this.onerror.bind(this)),we(e,"close",this.onclose.bind(this)),we(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){We(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){oe("error",e),this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new ts(this,e,s),this.nsps[e]=i),i}_destroy(e){let s=Object.keys(this.nsps);for(let i of s)if(this.nsps[i].active){oe("socket %s is still active, skipping close",i);return}this._close()}_packet(e){oe("writing packet %j",e);let s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){oe("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){oe("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;oe("closed due to %s",e),this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)oe("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let s=this.backoff.duration();oe("will wait %dms before reconnect attempt",s),this._reconnecting=!0;let i=this.setTimeoutFn(()=>{e.skipReconnect||(oe("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(oe("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(oe("reconnect success"),e.onreconnect())}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ed=D(ye(),1),Zu=(0,ed.default)("socket.io-client"),mi={};function fi(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};let s=$u(t,e.path||"/socket.io"),i=s.source,n=s.id,a=s.path,r=mi[n]&&a in mi[n].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||r,p;return o?(Zu("ignoring socket cache for %s",i),p=new ss(i,e)):(mi[n]||(Zu("new io instance for %s",i),mi[n]=new ss(i,e)),p=mi[n]),s.query&&!e.query&&(e.query=s.queryKey),p.socket(s.path,e)}Object.assign(fi,{Manager:ss,Socket:ts,io:fi,connect:fi});var is=class{constructor(e){A(this,"client");A(this,"socket");A(this,"whatsapp");A(this,"crm");A(this,"media");A(this,"meet");A(this,"notifications");A(this,"email");A(this,"events");A(this,"webhooks");A(this,"storage");A(this,"marketing");A(this,"health");A(this,"queue");var o,p,l;if(!e.apiKey)throw new Ts("API Key is required");let s=e.baseUrl||"https://api.ecodrix.com",i=e.socketUrl||s,n=typeof window!="undefined"&&typeof window.document!="undefined",a=n?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",r=n?((o=globalThis.navigator)==null?void 0:o.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown";this.client=Mt.create({baseURL:s,headers:{"x-api-key":e.apiKey,"x-client-code":(p=e.clientCode)==null?void 0:p.toUpperCase(),"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:"1.0.0",runtime:a,os:r})}}),zi(this.client,{retries:3,retryDelay:zi.exponentialDelay,retryCondition:c=>{var m;return zi.isNetworkOrIdempotentRequestError(c)||((m=c.response)==null?void 0:m.status)===429}}),this.whatsapp=new As(this.client),this.crm=new Is(this.client),this.media=new Fs(this.client),this.meet=new Ms(this.client),this.notifications=new zs(this.client),this.email=new $s(this.client),this.events=new Hs(this.client),this.webhooks=new Ws,this.storage=new Vs(this.client),this.marketing=new Gs(this.client),this.health=new Ks(this.client),this.queue=new Js(this.client),this.socket=fi(i,{extraHeaders:{"x-api-key":e.apiKey,"x-client-code":((l=e.clientCode)==null?void 0:l.toUpperCase())||""}}),this.setupSocket(e.clientCode)}setupSocket(e){this.socket.on("connect",()=>{e&&this.socket.emit("join-room",e.toUpperCase())})}on(e,s){return this.socket.on(e,s),this}disconnect(){this.socket.disconnect()}request(e,s,i,n){return u(this,null,function*(){var a,r,o;try{return(yield this.client.request({method:e,url:s,data:i,params:n})).data}catch(p){throw p.response?new be(((a=p.response.data)==null?void 0:a.message)||((r=p.response.data)==null?void 0:r.error)||"Raw Execution Failed",p.response.status,(o=p.response.data)==null?void 0:o.code):new be(p.message||"Network Error")}})}};var kv=is;return pd(Rv);})();
|
|
19
|
+
`+a):i.stack=a}catch(r){}}throw i}})}_request(e,s){typeof e=="string"?(s=s||{},s.url=e):s=e||{},s=Ne(this.defaults,s);let{transitional:i,paramsSerializer:n,headers:a}=s;i!==void 0&&ws.assertOptions(i,{silentJSONParsing:Te.transitional(Te.boolean),forcedJSONParsing:Te.transitional(Te.boolean),clarifyTimeoutError:Te.transitional(Te.boolean),legacyInterceptorReqResOrdering:Te.transitional(Te.boolean)},!1),n!=null&&(d.isFunction(n)?s.paramsSerializer={serialize:n}:ws.assertOptions(n,{encode:Te.function,serialize:Te.function},!0)),s.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?s.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:s.allowAbsoluteUrls=!0),ws.assertOptions(s,{baseUrl:Te.spelling("baseURL"),withXsrfToken:Te.spelling("withXSRFToken")},!0),s.method=(s.method||this.defaults.method||"get").toLowerCase();let r=a&&d.merge(a.common,a[s.method]);a&&d.forEach(["delete","get","head","post","put","patch","common"],h=>{delete a[h]}),s.headers=V.concat(r,a);let o=[],p=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(s)===!1)return;p=p&&x.synchronous;let g=s.transitional||st;g&&g.legacyInterceptorReqResOrdering?o.unshift(x.fulfilled,x.rejected):o.push(x.fulfilled,x.rejected)});let l=[];this.interceptors.response.forEach(function(x){l.push(x.fulfilled,x.rejected)});let c,m=0,f;if(!p){let h=[Fi.bind(this),void 0];for(h.unshift(...o),h.push(...l),f=h.length,c=Promise.resolve(s);m<f;)c=c.then(h[m++],h[m++]);return c}f=o.length;let v=s;for(;m<f;){let h=o[m++],x=o[m++];try{v=h(v)}catch(g){x.call(this,g);break}}try{c=Fi.call(this,v)}catch(h){return Promise.reject(h)}for(m=0,f=l.length;m<f;)c=c.then(l[m++],l[m++]);return c}getUri(e){e=Ne(this.defaults,e);let s=pt(e.baseURL,e.url,e.allowAbsoluteUrls);return ct(s,e.params,e.paramsSerializer)}};d.forEach(["delete","get","head","options"],function(e){Ft.prototype[e]=function(s,i){return this.request(Ne(i||{},{method:e,url:s,data:(i||{}).data}))}});d.forEach(["post","put","patch"],function(e){function s(i){return function(a,r,o){return this.request(Ne(o||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:a,data:r}))}}Ft.prototype[e]=s(),Ft.prototype[e+"Form"]=s(!0)});var Es=Ft;var Na=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let s;this.promise=new Promise(function(a){s=a});let i=this;this.promise.then(n=>{if(!i._listeners)return;let a=i._listeners.length;for(;a-- >0;)i._listeners[a](n);i._listeners=null}),this.promise.then=n=>{let a,r=new Promise(o=>{i.subscribe(o),a=o}).then(n);return r.cancel=function(){i.unsubscribe(a)},r},e(function(a,r,o){i.reason||(i.reason=new ve(a,r,o),s(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let s=this._listeners.indexOf(e);s!==-1&&this._listeners.splice(s,1)}toAbortSignal(){let e=new AbortController,s=i=>{e.abort(i)};return this.subscribe(s),e.signal.unsubscribe=()=>this.unsubscribe(s),e.signal}static source(){let e;return{token:new t(function(n){e=n}),cancel:e}}},tl=Na;function La(t){return function(s){return t.apply(null,s)}}function qa(t){return d.isObject(t)&&t.isAxiosError===!0}var Ba={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Ba).forEach(([t,e])=>{Ba[e]=t});var sl=Ba;function il(t){let e=new Es(t),s=as(Es.prototype.request,e);return d.extend(s,Es.prototype,e,{allOwnKeys:!0}),d.extend(s,e,null,{allOwnKeys:!0}),s.create=function(n){return il(Ne(t,n))},s}var X=il(Pt);X.Axios=Es;X.CanceledError=ve;X.CancelToken=tl;X.isCancel=hs;X.VERSION=mt;X.toFormData=tt;X.AxiosError=_;X.Cancel=X.CanceledError;X.all=function(e){return Promise.all(e)};X.spread=La;X.isAxiosError=qa;X.mergeConfig=Ne;X.AxiosHeaders=V;X.formToJSON=t=>Oi(d.isHTMLForm(t)?new FormData(t):t);X.getAdapter=Ii.getAdapter;X.HttpStatusCode=sl;X.default=X;var Mt=X;var{Axios:_E,AxiosError:wE,CanceledError:EE,isCancel:TE,CancelToken:SE,VERSION:kE,all:RE,Cancel:CE,isAxiosError:AE,spread:OE,toFormData:PE,AxiosHeaders:NE,HttpStatusCode:LE,formToJSON:qE,getAdapter:BE,mergeConfig:DE}=Mt;var ol=D(al(),1);var Da="axios-retry";function cl(t){let e=["ERR_CANCELED","ECONNABORTED"];return t.response||!t.code||e.includes(t.code)?!1:(0,ol.default)(t)}var pl=["get","head","options"],gx=pl.concat(["put","delete"]);function ja(t){return t.code!=="ECONNABORTED"&&(!t.response||t.response.status===429||t.response.status>=500&&t.response.status<=599)}function vx(t){var e;return(e=t.config)!=null&&e.method?ja(t)&&pl.indexOf(t.config.method)!==-1:!1}function ll(t){var e;return(e=t.config)!=null&&e.method?ja(t)&&gx.indexOf(t.config.method)!==-1:!1}function ul(t){return cl(t)||ll(t)}function Ua(t=void 0){var i;let e=(i=t==null?void 0:t.response)==null?void 0:i.headers["retry-after"];if(!e)return 0;let s=(Number(e)||0)*1e3;return s===0&&(s=(new Date(e).valueOf()||0)-Date.now()),Math.max(0,s)}function yx(t=0,e=void 0){return Math.max(0,Ua(e))}function bx(t=0,e=void 0,s=100){let i=kr(2,t)*s,n=Math.max(i,Ua(e)),a=n*.2*Math.random();return n+a}function _x(t=100){return(e=0,s=void 0)=>{let i=e*t;return Math.max(i,Ua(s))}}var wx={retries:3,retryCondition:ul,retryDelay:yx,shouldResetTimeout:!1,onRetry:()=>{},onMaxRetryTimesExceeded:()=>{},validateResponse:null};function Ex(t,e){return N(N(N({},wx),e),t[Da])}function rl(t,e,s=!1){let i=Ex(t,e||{});return i.retryCount=i.retryCount||0,(!i.lastRequestTime||s)&&(i.lastRequestTime=Date.now()),t[Da]=i,i}function Tx(t,e){t.defaults.agent===e.agent&&delete e.agent,t.defaults.httpAgent===e.httpAgent&&delete e.httpAgent,t.defaults.httpsAgent===e.httpsAgent&&delete e.httpsAgent}function Sx(t,e){return u(this,null,function*(){let{retries:s,retryCondition:i}=t,n=(t.retryCount||0)<s&&i(e);if(typeof n=="object")try{return(yield n)!==!1}catch(a){return!1}return n})}function kx(t,e,s,i){return u(this,null,function*(){var p;e.retryCount+=1;let{retryDelay:n,shouldResetTimeout:a,onRetry:r}=e,o=n(e.retryCount,s);if(Tx(t,i),!a&&i.timeout&&e.lastRequestTime){let l=Date.now()-e.lastRequestTime,c=i.timeout-l-o;if(c<=0)return Promise.reject(s);i.timeout=c}return i.transformRequest=[l=>l],yield r(e.retryCount,s,i),(p=i.signal)!=null&&p.aborted?Promise.resolve(t(i)):new Promise(l=>{var f;let c=()=>{clearTimeout(m),l(t(i))},m=setTimeout(()=>{var v;l(t(i)),(v=i.signal)!=null&&v.removeEventListener&&i.signal.removeEventListener("abort",c)},o);(f=i.signal)!=null&&f.addEventListener&&i.signal.addEventListener("abort",c,{once:!0})})})}function Rx(t,e){return u(this,null,function*(){t.retryCount>=t.retries&&(yield t.onMaxRetryTimesExceeded(e,t.retryCount))})}var it=(t,e)=>{let s=t.interceptors.request.use(n=>{var a;return rl(n,e,!0),(a=n[Da])!=null&&a.validateResponse&&(n.validateStatus=()=>!1),n}),i=t.interceptors.response.use(null,n=>u(null,null,function*(){var o;let{config:a}=n;if(!a)return Promise.reject(n);let r=rl(a,e);return n.response&&((o=r.validateResponse)!=null&&o.call(r,n.response))?n.response:(yield Sx(r,n))?kx(t,r,n,a):(yield Rx(r,n),Promise.reject(n))}));return{requestInterceptorId:s,responseInterceptorId:i}};it.isNetworkError=cl;it.isSafeRequestError=vx;it.isIdempotentRequestError=ll;it.isNetworkOrIdempotentRequestError=ul;it.exponentialDelay=bx;it.linearDelay=_x;it.isRetryableError=ja;var zi=it;var Wa=D(fl(),1);var Le=Object.create(null);Le.open="0";Le.close="1";Le.ping="2";Le.pong="3";Le.message="4";Le.upgrade="5";Le.noop="6";var Ts=Object.create(null);Object.keys(Le).forEach(t=>{Ts[Le[t]]=t});var Ss={type:"error",data:"parser error"};var ks=({type:t,data:e},s,i)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?i(s?e:"b"+hl(e,!0).toString("base64")):i(Le[t]+(e||"")),hl=(t,e)=>Buffer.isBuffer(t)||t instanceof Uint8Array&&!e?t:t instanceof ArrayBuffer?Buffer.from(t):Buffer.from(t.buffer,t.byteOffset,t.byteLength),Fa;function xl(t,e){if(t.data instanceof ArrayBuffer||ArrayBuffer.isView(t.data))return e(hl(t.data,!1));ks(t,!0,s=>{Fa||(Fa=new TextEncoder),e(Fa.encode(s))})}var Rs=(t,e)=>{if(typeof t!="string")return{type:"message",data:gl(t,e)};let s=t.charAt(0);if(s==="b"){let i=Buffer.from(t.substring(1),"base64");return{type:"message",data:gl(i,e)}}return Ts[s]?t.length>1?{type:Ts[s],data:t.substring(1)}:{type:Ts[s]}:Ss},gl=(t,e)=>{switch(e){case"arraybuffer":return t instanceof ArrayBuffer?t:Buffer.isBuffer(t)?t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength):t.buffer;case"nodebuffer":default:return Buffer.isBuffer(t)?t:Buffer.from(t)}};var vl="",yl=(t,e)=>{let s=t.length,i=new Array(s),n=0;t.forEach((a,r)=>{ks(a,!1,o=>{i[r]=o,++n===s&&e(i.join(vl))})})},bl=(t,e)=>{let s=t.split(vl),i=[];for(let n=0;n<s.length;n++){let a=Rs(s[n],e);if(i.push(a),a.type==="error")break}return i};function _l(){return new TransformStream({transform(t,e){xl(t,s=>{let i=s.length,n;if(i<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,i);else if(i<65536){n=new Uint8Array(3);let a=new DataView(n.buffer);a.setUint8(0,126),a.setUint16(1,i)}else{n=new Uint8Array(9);let a=new DataView(n.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(s)})}})}var Ma;function $i(t){return t.reduce((e,s)=>e+s.length,0)}function Hi(t,e){if(t[0].length===e)return t.shift();let s=new Uint8Array(e),i=0;for(let n=0;n<e;n++)s[n]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),s}function wl(t,e){Ma||(Ma=new TextDecoder);let s=[],i=0,n=-1,a=!1;return new TransformStream({transform(r,o){for(s.push(r);;){if(i===0){if($i(s)<1)break;let p=Hi(s,1);a=(p[0]&128)===128,n=p[0]&127,n<126?i=3:n===126?i=1:i=2}else if(i===1){if($i(s)<2)break;let p=Hi(s,2);n=new DataView(p.buffer,p.byteOffset,p.length).getUint16(0),i=3}else if(i===2){if($i(s)<8)break;let p=Hi(s,8),l=new DataView(p.buffer,p.byteOffset,p.length),c=l.getUint32(0);if(c>Math.pow(2,21)-1){o.enqueue(Ss);break}n=c*Math.pow(2,32)+l.getUint32(4),i=3}else{if($i(s)<n)break;let p=Hi(s,n);o.enqueue(Rs(a?p:Ma.decode(p),e)),i=0}if(n===0||n>t){o.enqueue(Ss);break}}}})}var za=4;function $(t){if(t)return Ax(t)}function Ax(t){for(var e in $.prototype)t[e]=$.prototype[e];return t}$.prototype.on=$.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};$.prototype.once=function(t,e){function s(){this.off(t,s),e.apply(this,arguments)}return s.fn=e,this.on(t,s),this};$.prototype.off=$.prototype.removeListener=$.prototype.removeAllListeners=$.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var s=this._callbacks["$"+t];if(!s)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,n=0;n<s.length;n++)if(i=s[n],i===e||i.fn===e){s.splice(n,1);break}return s.length===0&&delete this._callbacks["$"+t],this};$.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),s=this._callbacks["$"+t],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(s){s=s.slice(0);for(var i=0,n=s.length;i<n;++i)s[i].apply(this,e)}return this};$.prototype.emitReserved=$.prototype.emit;$.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};$.prototype.hasListeners=function(t){return!!this.listeners(t).length};var We=process.nextTick,de=global,El="nodebuffer";function Tl(){return new $a}function Ox(t){let e=t.split("; "),s=e[0].indexOf("=");if(s===-1)return;let i=e[0].substring(0,s).trim();if(!i.length)return;let n=e[0].substring(s+1).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));let a={name:i,value:n};for(let r=1;r<e.length;r++){let o=e[r].split("=");if(o.length!==2)continue;let p=o[0].trim(),l=o[1].trim();switch(p){case"Expires":a.expires=new Date(l);break;case"Max-Age":let c=new Date;c.setUTCSeconds(c.getUTCSeconds()+parseInt(l,10)),a.expires=c;break;default:}}return a}var $a=class{constructor(){this._cookies=new Map}parseCookies(e){e&&e.forEach(s=>{let i=Ox(s);i&&this._cookies.set(i.name,i)})}get cookies(){let e=Date.now();return this._cookies.forEach((s,i)=>{var n;((n=s.expires)===null||n===void 0?void 0:n.getTime())<e&&this._cookies.delete(i)}),this._cookies.entries()}addCookies(e){let s=[];for(let[i,n]of this.cookies)s.push(`${i}=${n.value}`);s.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",s.join("; ")))}appendCookies(e){for(let[s,i]of this.cookies)e.append("cookie",`${s}=${i.value}`)}};function Wi(t,...e){return e.reduce((s,i)=>(t.hasOwnProperty(i)&&(s[i]=t[i]),s),{})}var Px=de.setTimeout,Nx=de.clearTimeout;function Ve(t,e){e.useNativeTimers?(t.setTimeoutFn=Px.bind(de),t.clearTimeoutFn=Nx.bind(de)):(t.setTimeoutFn=de.setTimeout.bind(de),t.clearTimeoutFn=de.clearTimeout.bind(de))}var Lx=1.33;function Sl(t){return typeof t=="string"?qx(t):Math.ceil((t.byteLength||t.size)*Lx)}function qx(t){let e=0,s=0;for(let i=0,n=t.length;i<n;i++)e=t.charCodeAt(i),e<128?s+=1:e<2048?s+=2:e<55296||e>=57344?s+=3:(i++,s+=4);return s}function Vi(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function kl(t){let e="";for(let s in t)t.hasOwnProperty(s)&&(e.length&&(e+="&"),e+=encodeURIComponent(s)+"="+encodeURIComponent(t[s]));return e}function Rl(t){let e={},s=t.split("&");for(let i=0,n=s.length;i<n;i++){let a=s[i].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}var Cl=D(ye(),1),Bx=(0,Cl.default)("engine.io-client:transport"),Gi=class extends Error{constructor(e,s,i){super(e),this.description=s,this.context=i,this.type="TransportError"}},Ge=class extends ${constructor(e){super(),this.writable=!1,Ve(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,s,i){return super.emitReserved("error",new Gi(e,s,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Bx("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let s=Rs(e,this.socket.binaryType);this.onPacket(s)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,s={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(s)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let s=kl(e);return s.length?"?"+s:""}};var Al=D(ye(),1),qe=(0,Al.default)("engine.io-client:polling"),Cs=class extends Ge{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";let s=()=>{qe("paused"),this.readyState="paused",e()};if(this._polling||!this.writable){let i=0;this._polling&&(qe("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){qe("pre-pause polling complete"),--i||s()})),this.writable||(qe("we are currently writing - waiting to pause"),i++,this.once("drain",function(){qe("pre-pause writing complete"),--i||s()}))}else s()}_poll(){qe("polling"),this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){qe("polling got data %s",e);let s=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};bl(e,this.socket.binaryType).forEach(s),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this._poll():qe('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{qe("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(qe("transport open - closing"),e()):(qe("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,yl(e,s=>{this.doWrite(s,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",s=this.query||{};return this.opts.timestampRequests!==!1&&(s[this.opts.timestampParam]=Vi()),!this.supportsBinary&&!s.sid&&(s.b64=1),this.createUri(e,s)}};var Ol=!1;try{Ol=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(t){}var Pl=Ol;var Ll=D(ye(),1),Ha=(0,Ll.default)("engine.io-client:polling");function Dx(){}var Ki=class extends Cs{constructor(e){if(super(e),typeof location!="undefined"){let s=location.protocol==="https:",i=location.port;i||(i=s?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||i!==e.port}}doWrite(e,s){let i=this.request({method:"POST",data:e});i.on("success",s),i.on("error",(n,a)=>{this.onError("xhr post error",n,a)})}doPoll(){Ha("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(s,i)=>{this.onError("xhr poll error",s,i)}),this.pollXhr=e}},Ke=class t extends ${constructor(e,s,i){super(),this.createRequest=e,Ve(this,i),this._opts=i,this._method=i.method||"GET",this._uri=s,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var e;let s=Wi(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");s.xdomain=!!this._opts.xd;let i=this._xhr=this.createRequest(s);try{Ha("xhr open %s: %s",this._method,this._uri),i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&i.setRequestHeader(n,this._opts.extraHeaders[n])}}catch(n){}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(n){}try{i.setRequestHeader("Accept","*/*")}catch(n){}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var n;i.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},Ha("xhr data %s",this._data),i.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document!="undefined"&&(this._index=t.requestsCount++,t.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr=="undefined"||this._xhr===null)){if(this._xhr.onreadystatechange=Dx,e)try{this._xhr.abort()}catch(s){}typeof document!="undefined"&&delete t.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Ke.requestsCount=0;Ke.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Nl);else if(typeof addEventListener=="function"){let t="onpagehide"in de?"pagehide":"unload";addEventListener(t,Nl,!1)}}function Nl(){for(let t in Ke.requests)Ke.requests.hasOwnProperty(t)&&Ke.requests[t].abort()}var gT=(function(){let t=jx({xdomain:!1});return t&&t.responseType!==null})();function jx(t){let e=t.xdomain;try{if(typeof XMLHttpRequest!="undefined"&&(!e||Pl))return new XMLHttpRequest}catch(s){}if(!e)try{return new de[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(s){}}var Ux=Wa.default||Wa,$t=class extends Ki{request(e={}){var s;return Object.assign(e,{xd:this.xd,cookieJar:(s=this.socket)===null||s===void 0?void 0:s._cookieJar},this.opts),new Ke(i=>new Ux(i),this.uri(),e)}};var iv=D(Cu(),1),nv=D(sr(),1),av=D(ar(),1),mr=D(on(),1),rv=D(ju(),1);var Uu=D(ye(),1),cv=(0,Uu.default)("engine.io-client:websocket"),pv=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",pn=class extends Ge{get name(){return"websocket"}doOpen(){let e=this.uri(),s=this.opts.protocols,i=pv?{}:Wi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,s,i)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;ks(i,this.supportsBinary,a=>{try{this.doWrite(i,a)}catch(r){cv("websocket closed before onclose event")}n&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",s=this.query||{};return this.opts.timestampRequests&&(s[this.opts.timestampParam]=Vi()),this.supportsBinary||(s.b64=1),this.createUri(e,s)}},GT=de.WebSocket||de.MozWebSocket;var Xt=class extends pn{createSocket(e,s,i){var n;if(!((n=this.socket)===null||n===void 0)&&n._cookieJar){i.headers=i.headers||{},i.headers.cookie=typeof i.headers.cookie=="string"?[i.headers.cookie]:i.headers.cookie||[];for(let[a,r]of this.socket._cookieJar.cookies)i.headers.cookie.push(`${a}=${r.value}`)}return new mr.default(e,s,i)}doWrite(e,s){let i={};e.options&&(i.compress=e.options.compress),this.opts.perMessageDeflate&&(typeof s=="string"?Buffer.byteLength(s):s.length)<this.opts.perMessageDeflate.threshold&&(i.compress=!1),this.ws.send(s,i)}};var Iu=D(ye(),1),js=(0,Iu.default)("engine.io-client:webtransport"),Qt=class extends Ge{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{js("transport closed gracefully"),this.onClose()}).catch(e=>{js("transport closed due to %s",e),this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let s=wl(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=e.readable.pipeThrough(s).getReader(),n=_l();n.readable.pipeTo(e.writable),this._writer=n.writable.getWriter();let a=()=>{i.read().then(({done:o,value:p})=>{if(o){js("session is closed");return}js("received chunk: %o",p),this.onPacket(p),a()}).catch(o=>{js("an error occurred while reading: %s",o)})};a();let r={type:"open"};this.query.sid&&(r.data=`{"sid":"${this.query.sid}"}`),this._writer.write(r).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let s=0;s<e.length;s++){let i=e[s],n=s===e.length-1;this._writer.write(i).then(()=>{n&&We(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}};var fr={websocket:Xt,webtransport:Qt,polling:$t};var lv=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,uv=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Zt(t){if(t.length>8e3)throw"URI too long";let e=t,s=t.indexOf("["),i=t.indexOf("]");s!=-1&&i!=-1&&(t=t.substring(0,s)+t.substring(s,i).replace(/:/g,";")+t.substring(i,t.length));let n=lv.exec(t||""),a={},r=14;for(;r--;)a[uv[r]]=n[r]||"";return s!=-1&&i!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=dv(a,a.path),a.queryKey=mv(a,a.query),a}function dv(t,e){let s=/\/{2,9}/g,i=e.replace(s,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&i.splice(0,1),e.slice(-1)=="/"&&i.splice(i.length-1,1),i}function mv(t,e){let s={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,n,a){n&&(s[n]=a)}),s}var Fu=D(ye(),1),z=(0,Fu.default)("engine.io-client:socket"),hr=typeof addEventListener=="function"&&typeof removeEventListener=="function",Us=[];hr&&addEventListener("offline",()=>{z("closing %d connection(s) because the network was lost",Us.length),Us.forEach(t=>t())},!1);var bt=class t extends ${constructor(e,s){if(super(),this.binaryType=El,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(s=e,e=null),e){let i=Zt(e);s.hostname=i.host,s.secure=i.protocol==="https"||i.protocol==="wss",s.port=i.port,i.query&&(s.query=i.query)}else s.host&&(s.hostname=Zt(s.host).host);Ve(this,s),this.secure=s.secure!=null?s.secure:typeof location!="undefined"&&location.protocol==="https:",s.hostname&&!s.port&&(s.port=this.secure?"443":"80"),this.hostname=s.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=s.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},s.transports.forEach(i=>{let n=i.prototype.name;this.transports.push(n),this._transportsByName[n]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},s),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Rl(this.opts.query)),hr&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(z("adding listener for the 'offline' event"),this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Us.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=Tl()),this._open()}createTransport(e){z('creating transport "%s"',e);let s=Object.assign({},this.opts.query);s.EIO=za,s.transport=e,this.id&&(s.sid=this.id);let i=Object.assign({},this.opts,{query:s,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return z("options: %j",i),new this._transportsByName[e](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&t.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let s=this.createTransport(e);s.open(),this.setTransport(s)}setTransport(e){z("setting transport %s",e.name),this.transport&&(z("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",s=>this._onClose("transport close",s))}onOpen(){z("socket open"),this.readyState="open",t.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(z('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let s=new Error("server error");s.code=e.data,this._onError(s);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else z('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();z("flushing %d packets in socket",e.length),this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let s=1;for(let i=0;i<this.writeBuffer.length;i++){let n=this.writeBuffer[i].data;if(n&&(s+=Sl(n)),i>0&&s>this._maxPayload)return z("only send %d out of %d packets",i,this.writeBuffer.length),this.writeBuffer.slice(0,i);s+=2}return z("payload size is %d (max: %d)",s,this._maxPayload),this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(z("throttled timer detected, scheduling connection close"),this._pingTimeoutTime=0,We(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,s,i){return this._sendPacket("message",e,s,i),this}send(e,s,i){return this._sendPacket("message",e,s,i),this}_sendPacket(e,s,i,n){if(typeof s=="function"&&(n=s,s=void 0),typeof i=="function"&&(n=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;let a={type:e,data:s,options:i};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),z("socket closing - telling transport to close"),this.transport.close()},s=()=>{this.off("upgrade",s),this.off("upgradeError",s),e()},i=()=>{this.once("upgrade",s),this.once("upgradeError",s)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():e()}):this.upgrading?i():e()),this}_onError(e){if(z("socket error %j",e),t.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return z("trying next transport"),this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,s){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(z('socket close with reason: "%s"',e),this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),hr&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let i=Us.indexOf(this._offlineEventListener);i!==-1&&(z("removing listener for the 'offline' event"),Us.splice(i,1))}this.readyState="closed",this.id=null,this.emitReserved("close",e,s),this.writeBuffer=[],this._prevBufferLen=0}}};bt.protocol=za;var ln=class extends bt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade){z("starting upgrade probes");for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}}_probe(e){z('probing transport "%s"',e);let s=this.createTransport(e),i=!1;bt.priorWebsocketSuccess=!1;let n=()=>{i||(z('probe transport "%s" opened',e),s.send([{type:"ping",data:"probe"}]),s.once("packet",m=>{if(!i)if(m.type==="pong"&&m.data==="probe"){if(z('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",s),!s)return;bt.priorWebsocketSuccess=s.name==="websocket",z('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{i||this.readyState!=="closed"&&(z("changing transport and sending upgrade packet"),c(),this.setTransport(s),s.send([{type:"upgrade"}]),this.emitReserved("upgrade",s),s=null,this.upgrading=!1,this.flush())})}else{z('probe transport "%s" failed',e);let f=new Error("probe error");f.transport=s.name,this.emitReserved("upgradeError",f)}}))};function a(){i||(i=!0,c(),s.close(),s=null)}let r=m=>{let f=new Error("probe error: "+m);f.transport=s.name,a(),z('probe transport "%s" failed because of error: %s',e,m),this.emitReserved("upgradeError",f)};function o(){r("transport closed")}function p(){r("socket closed")}function l(m){s&&m.name!==s.name&&(z('"%s" works - aborting "%s"',m.name,s.name),a())}let c=()=>{s.removeListener("open",n),s.removeListener("error",r),s.removeListener("close",o),this.off("close",p),this.off("upgrading",l)};s.once("open",n),s.once("error",r),s.once("close",o),this.once("close",p),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{i||s.open()},200):s.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let s=[];for(let i=0;i<e.length;i++)~this.transports.indexOf(e[i])&&s.push(e[i]);return s}},es=class extends ln{constructor(e,s={}){let i=typeof e=="object"?e:s;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(n=>fr[n]).filter(n=>!!n)),super(e,i)}};var g0=es.protocol;var zu=D(ye(),1),Mu=(0,zu.default)("socket.io-client:url");function $u(t,e="",s){let i=t;s=s||typeof location!="undefined"&&location,t==null&&(t=s.protocol+"//"+s.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=s.protocol+t:t=s.host+t),/^(https?|wss?):\/\//.test(t)||(Mu("protocol-less url %s",t),typeof s!="undefined"?t=s.protocol+"//"+t:t="https://"+t),Mu("parse %s",t),i=Zt(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let a=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+a+":"+i.port+e,i.href=i.protocol+"://"+a+(s&&s.port===i.port?"":":"+i.port),i}var wr={};_n(wr,{Decoder:()=>br,Encoder:()=>yr,PacketType:()=>O,isPacketValid:()=>Tv,protocol:()=>Ju});var gv=typeof ArrayBuffer=="function",vv=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Hu=Object.prototype.toString,yv=typeof Blob=="function"||typeof Blob!="undefined"&&Hu.call(Blob)==="[object BlobConstructor]",bv=typeof File=="function"||typeof File!="undefined"&&Hu.call(File)==="[object FileConstructor]";function Fs(t){return gv&&(t instanceof ArrayBuffer||vv(t))||yv&&t instanceof Blob||bv&&t instanceof File}function Is(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let s=0,i=t.length;s<i;s++)if(Is(t[s]))return!0;return!1}if(Fs(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Is(t.toJSON(),!0);for(let s in t)if(Object.prototype.hasOwnProperty.call(t,s)&&Is(t[s]))return!0;return!1}function Wu(t){let e=[],s=t.data,i=t;return i.data=xr(s,e),i.attachments=e.length,{packet:i,buffers:e}}function xr(t,e){if(!t)return t;if(Fs(t)){let s={_placeholder:!0,num:e.length};return e.push(t),s}else if(Array.isArray(t)){let s=new Array(t.length);for(let i=0;i<t.length;i++)s[i]=xr(t[i],e);return s}else if(typeof t=="object"&&!(t instanceof Date)){let s={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(s[i]=xr(t[i],e));return s}return t}function Vu(t,e){return t.data=gr(t.data,e),delete t.attachments,t}function gr(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let s=0;s<t.length;s++)t[s]=gr(t[s],e);else if(typeof t=="object")for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&(t[s]=gr(t[s],e));return t}var Gu=D(ye(),1),vr=(0,Gu.default)("socket.io-parser"),Ku=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Ju=5,O;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(O||(O={}));var yr=class{constructor(e){this.replacer=e}encode(e){return vr("encoding packet %j",e),(e.type===O.EVENT||e.type===O.ACK)&&Is(e)?this.encodeAsBinary({type:e.type===O.EVENT?O.BINARY_EVENT:O.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let s=""+e.type;return(e.type===O.BINARY_EVENT||e.type===O.BINARY_ACK)&&(s+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(s+=e.nsp+","),e.id!=null&&(s+=e.id),e.data!=null&&(s+=JSON.stringify(e.data,this.replacer)),vr("encoded %j as %s",e,s),s}encodeAsBinary(e){let s=Wu(e),i=this.encodeAsString(s.packet),n=s.buffers;return n.unshift(i),n}},br=class t extends ${constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let s;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");s=this.decodeString(e);let i=s.type===O.BINARY_EVENT;i||s.type===O.BINARY_ACK?(s.type=i?O.EVENT:O.ACK,this.reconstructor=new _r(s),s.attachments===0&&super.emitReserved("decoded",s)):super.emitReserved("decoded",s)}else if(Fs(e)||e.base64)if(this.reconstructor)s=this.reconstructor.takeBinaryData(e),s&&(this.reconstructor=null,super.emitReserved("decoded",s));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let s=0,i={type:Number(e.charAt(0))};if(O[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===O.BINARY_EVENT||i.type===O.BINARY_ACK){let a=s+1;for(;e.charAt(++s)!=="-"&&s!=e.length;);let r=e.substring(a,s);if(r!=Number(r)||e.charAt(s)!=="-")throw new Error("Illegal attachments");let o=Number(r);if(!Yu(o)||o<0)throw new Error("Illegal attachments");if(o>this.opts.maxAttachments)throw new Error("too many attachments");i.attachments=o}if(e.charAt(s+1)==="/"){let a=s+1;for(;++s&&!(e.charAt(s)===","||s===e.length););i.nsp=e.substring(a,s)}else i.nsp="/";let n=e.charAt(s+1);if(n!==""&&Number(n)==n){let a=s+1;for(;++s;){let r=e.charAt(s);if(r==null||Number(r)!=r){--s;break}if(s===e.length)break}i.id=Number(e.substring(a,s+1))}if(e.charAt(++s)){let a=this.tryParse(e.substr(s));if(t.isPayloadValid(i.type,a))i.data=a;else throw new Error("invalid payload")}return vr("decoded %s as %j",e,i),i}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch(s){return!1}}static isPayloadValid(e,s){switch(e){case O.CONNECT:return un(s);case O.DISCONNECT:return s===void 0;case O.CONNECT_ERROR:return typeof s=="string"||un(s);case O.EVENT:case O.BINARY_EVENT:return Array.isArray(s)&&(typeof s[0]=="number"||typeof s[0]=="string"&&Ku.indexOf(s[0])===-1);case O.ACK:case O.BINARY_ACK:return Array.isArray(s)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},_r=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let s=Vu(this.reconPack,this.buffers);return this.finishedReconstruction(),s}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function _v(t){return typeof t=="string"}var Yu=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function wv(t){return t===void 0||Yu(t)}function un(t){return Object.prototype.toString.call(t)==="[object Object]"}function Ev(t,e){switch(t){case O.CONNECT:return e===void 0||un(e);case O.DISCONNECT:return e===void 0;case O.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&Ku.indexOf(e[0])===-1);case O.ACK:return Array.isArray(e);case O.CONNECT_ERROR:return typeof e=="string"||un(e);default:return!1}}function Tv(t){return _v(t.nsp)&&wv(t.id)&&Ev(t.type,t.data)}function _e(t,e,s){return t.on(e,s),function(){t.off(e,s)}}var Xu=D(ye(),1),Q=(0,Xu.default)("socket.io-client:socket"),Sv=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ts=class extends ${constructor(e,s,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=s,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[_e(e,"open",this.onopen.bind(this)),_e(e,"packet",this.onpacket.bind(this)),_e(e,"error",this.onerror.bind(this)),_e(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...s){var i,n,a;if(Sv.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(s.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(s),this;let r={type:O.EVENT,data:s};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof s[s.length-1]=="function"){let c=this.ids++;Q("emitting packet with ack id %d",c);let m=s.pop();this._registerAckCallback(c,m),r.id=c}let o=(n=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||n===void 0?void 0:n.writable,p=this.connected&&!(!((a=this.io.engine)===null||a===void 0)&&a._hasPingExpired());return this.flags.volatile&&!o?Q("discard packet as the transport is not currently writable"):p?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,s){var i;let n=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(n===void 0){this.acks[e]=s;return}let a=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(Q("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));Q("event with ack id %d has timed out after %d ms",e,n),s.call(this,new Error("operation has timed out"))},n),r=(...o)=>{this.io.clearTimeoutFn(a),s.apply(this,o)};r.withError=!0,this.acks[e]=r}emitWithAck(e,...s){return new Promise((i,n)=>{let a=(r,o)=>r?n(r):i(o);a.withError=!0,s.push(a),this.emit(e,...s)})}_addToQueue(e){let s;typeof e[e.length-1]=="function"&&(s=e.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((n,...a)=>i!==this._queue[0]?Q("packet [%d] already acknowledged",i.id):(n!==null?i.tryCount>this._opts.retries&&(Q("packet [%d] is discarded after %d tries",i.id,i.tryCount),this._queue.shift(),s&&s(n)):(Q("packet [%d] was successfully sent",i.id),this._queue.shift(),s&&s(null,...a)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(e=!1){if(Q("draining queue"),!this.connected||this._queue.length===0)return;let s=this._queue[0];if(s.pending&&!e){Q("packet [%d] has already been sent and is waiting for an ack",s.id);return}s.pending=!0,s.tryCount++,Q("sending packet [%d] (try n\xB0%d)",s.id,s.tryCount),this.flags=s.flags,this.emit.apply(this,s.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){Q("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:O.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,s){Q("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,s),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(i=>String(i.id)===e)){let i=this.acks[e];delete this.acks[e],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case O.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case O.EVENT:case O.BINARY_EVENT:this.onevent(e);break;case O.ACK:case O.BINARY_ACK:this.onack(e);break;case O.DISCONNECT:this.ondisconnect();break;case O.CONNECT_ERROR:this.destroy();let i=new Error(e.data.message);i.data=e.data.data,this.emitReserved("connect_error",i);break}}onevent(e){let s=e.data||[];Q("emitting event %j",s),e.id!=null&&(Q("attaching ack callback to event"),s.push(this.ack(e.id))),this.connected?this.emitEvent(s):this.receiveBuffer.push(Object.freeze(s))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let s=this._anyListeners.slice();for(let i of s)i.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let s=this,i=!1;return function(...n){i||(i=!0,Q("sending ack %j",n),s.packet({type:O.ACK,id:e,data:n}))}}onack(e){let s=this.acks[e.id];if(typeof s!="function"){Q("bad ack %s",e.id);return}delete this.acks[e.id],Q("calling ack %s with %j",e.id,e.data),s.withError&&e.data.unshift(null),s.apply(this,e.data)}onconnect(e,s){Q("socket connected with id %s",e),this.id=e,this.recovered=s&&this._pid===s,this._pid=s,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){Q("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(Q("performing disconnect (%s)",this.nsp),this.packet({type:O.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let s=this._anyListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let s=this._anyOutgoingListeners;for(let i=0;i<s.length;i++)if(e===s[i])return s.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let s=this._anyOutgoingListeners.slice();for(let i of s)i.apply(this,e.data)}}};function _t(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}_t.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),s=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-s:t+s}return Math.min(t,this.max)|0};_t.prototype.reset=function(){this.attempts=0};_t.prototype.setMin=function(t){this.ms=t};_t.prototype.setMax=function(t){this.max=t};_t.prototype.setJitter=function(t){this.jitter=t};var Qu=D(ye(),1),oe=(0,Qu.default)("socket.io-client:manager"),ss=class extends ${constructor(e,s){var i;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(s=e,e=void 0),s=s||{},s.path=s.path||"/socket.io",this.opts=s,Ve(this,s),this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor((i=s.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new _t({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this._readyState="closed",this.uri=e;let n=s.parser||wr;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=s.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var s;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(s=this.backoff)===null||s===void 0||s.setMin(e),this)}randomizationFactor(e){var s;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(s=this.backoff)===null||s===void 0||s.setJitter(e),this)}reconnectionDelayMax(e){var s;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(s=this.backoff)===null||s===void 0||s.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(oe("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;oe("opening %s",this.uri),this.engine=new es(this.uri,this.opts);let s=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let n=_e(s,"open",function(){i.onopen(),e&&e()}),a=o=>{oe("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",o),e?e(o):this.maybeReconnectOnOpen()},r=_e(s,"error",a);if(this._timeout!==!1){let o=this._timeout;oe("connect attempt will timeout after %d",o);let p=this.setTimeoutFn(()=>{oe("connect attempt timed out after %d",o),n(),a(new Error("timeout")),s.close()},o);this.opts.autoUnref&&p.unref(),this.subs.push(()=>{this.clearTimeoutFn(p)})}return this.subs.push(n),this.subs.push(r),this}connect(e){return this.open(e)}onopen(){oe("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(_e(e,"ping",this.onping.bind(this)),_e(e,"data",this.ondata.bind(this)),_e(e,"error",this.onerror.bind(this)),_e(e,"close",this.onclose.bind(this)),_e(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(s){this.onclose("parse error",s)}}ondecoded(e){We(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){oe("error",e),this.emitReserved("error",e)}socket(e,s){let i=this.nsps[e];return i?this._autoConnect&&!i.active&&i.connect():(i=new ts(this,e,s),this.nsps[e]=i),i}_destroy(e){let s=Object.keys(this.nsps);for(let i of s)if(this.nsps[i].active){oe("socket %s is still active, skipping close",i);return}this._close()}_packet(e){oe("writing packet %j",e);let s=this.encoder.encode(e);for(let i=0;i<s.length;i++)this.engine.write(s[i],e.options)}cleanup(){oe("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){oe("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,s){var i;oe("closed due to %s",e),this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,s),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)oe("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let s=this.backoff.duration();oe("will wait %dms before reconnect attempt",s),this._reconnecting=!0;let i=this.setTimeoutFn(()=>{e.skipReconnect||(oe("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(n=>{n?(oe("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(oe("reconnect success"),e.onreconnect())}))},s);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var ed=D(ye(),1),Zu=(0,ed.default)("socket.io-client"),Ms={};function zs(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};let s=$u(t,e.path||"/socket.io"),i=s.source,n=s.id,a=s.path,r=Ms[n]&&a in Ms[n].nsps,o=e.forceNew||e["force new connection"]||e.multiplex===!1||r,p;return o?(Zu("ignoring socket cache for %s",i),p=new ss(i,e)):(Ms[n]||(Zu("new io instance for %s",i),Ms[n]=new ss(i,e)),p=Ms[n]),s.query&&!e.query&&(e.query=s.queryKey),p.socket(s.path,e)}Object.assign(zs,{Manager:ss,Socket:ts,io:zs,connect:zs});var dn=class extends Error{constructor(e){super(e),this.name="EcodrixError"}},we=class extends dn{constructor(s,i,n){super(s);A(this,"status");A(this,"code");this.name="APIError",this.status=i,this.code=n}},$s=class extends we{constructor(e="Invalid API Key or Client Code"){super(e,401,"AUTH_FAILED"),this.name="AuthenticationError"}},Er=class extends we{constructor(e="Too many requests. Please slow down."){super(e,429,"RATE_LIMIT_EXCEEDED"),this.name="RateLimitError"}};var S=class{constructor(e){this.client=e}post(e,s,i){return u(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.post(e,s,n)).data}catch(n){this.handleError(n)}})}get(e,s){return u(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.get(e,i)).data}catch(i){this.handleError(i)}})}patch(e,s,i){return u(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.patch(e,s,n)).data}catch(n){this.handleError(n)}})}put(e,s,i){return u(this,null,function*(){try{let n=this.buildConfig(i);return(yield this.client.put(e,s,n)).data}catch(n){this.handleError(n)}})}deleteRequest(e,s){return u(this,null,function*(){try{let i=this.buildConfig(s);return(yield this.client.delete(e,i)).data}catch(i){this.handleError(i)}})}buildConfig(e){if(!e)return;let s=N({},e);return e.idempotencyKey&&(s.headers=re(N({},s.headers),{"Idempotency-Key":e.idempotencyKey})),s}handleError(e){var s,i,n;throw e.response?new we(((s=e.response.data)==null?void 0:s.message)||((i=e.response.data)==null?void 0:i.error)||"API Request Failed",e.response.status,(n=e.response.data)==null?void 0:n.code):new we(e.message||"Network Error")}};var mn=class extends S{list(e){return u(this,null,function*(){return this.get(`/api/saas/crm/leads/${e}/notes`)})}create(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/leads/${e}/notes`,s)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/notes/${e}`,{content:s})})}pin(e,s=!0){return u(this,null,function*(){return this.patch(`/api/saas/crm/notes/${e}/pin`,{isPinned:s})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/notes/${e}`)})}},Hs=class extends S{constructor(s){super(s);A(this,"notes");this.notes=new mn(s)}timeline(s,i){return u(this,null,function*(){return this.get(`/api/saas/crm/leads/${s}/timeline`,{params:i})})}list(s,i){return u(this,null,function*(){return this.get("/api/saas/crm/activities",{params:N({leadId:s},i)})})}log(s){return u(this,null,function*(){return this.post("/api/saas/crm/activities",s)})}logCall(s,i){return u(this,null,function*(){return this.post(`/api/saas/crm/leads/${s}/calls`,i)})}};var Ws=class extends S{overview(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/overview",{params:e})})}funnel(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/funnel",{params:{pipelineId:e}})})}forecast(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/forecast",{params:{pipelineId:e}})})}sources(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/sources",{params:e})})}team(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/team",{params:e})})}heatmap(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/heatmap",{params:e})})}scores(){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/scores")})}stageTime(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/stage-time",{params:{pipelineId:e}})})}tiered(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/tiered",{params:e})})}summary(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/summary",{params:e})})}whatsapp(e){return u(this,null,function*(){return this.get("/api/saas/crm/analytics/whatsapp",{params:e})})}};var Vs=class extends S{stats(){return u(this,null,function*(){return this.get("/api/saas/crm/automation/stats")})}logs(e){return u(this,null,function*(){return this.get("/api/saas/crm/automation/logs",{params:e})})}retryFailedEvent(e){return u(this,null,function*(){return this.post(`/api/saas/crm/automation/logs/${e}/retry`,{})})}};var Gs=class extends S{list(){return u(this,null,function*(){return this.get("/api/saas/crm/automations")})}create(e){return u(this,null,function*(){return this.post("/api/saas/crm/automations",e)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/automations/${e}`,s)})}toggle(e){return u(this,null,function*(){return this.patch(`/api/saas/crm/automations/${e}/toggle`)})}deleteRule(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/automations/${e}`)})}bulkDelete(e){return u(this,null,function*(){return this.post("/api/saas/crm/automations/bulk-delete",{ids:e})})}test(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/${e}/test`,{leadId:s})})}getAvailableEvents(){return u(this,null,function*(){return this.post("/api/saas/crm/automations/events",{})})}enrollments(e,s){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/${e}/enrollments`,{params:s})})}getEnrollment(e){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/enrollments/${e}`)})}pauseEnrollment(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/${e}/enrollments/${s}/pause`,{})})}resumeEnrollment(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/${e}/enrollments/${s}/resume`,{})})}runs(e){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/${e}/runs`)})}getRun(e){return u(this,null,function*(){return this.get(`/api/saas/crm/automations/runs/${e}`)})}resumeRun(e){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/runs/${e}/resume`,{})})}abortRun(e){return u(this,null,function*(){return this.post(`/api/saas/crm/automations/runs/${e}/abort`,{})})}webhookEvent(e,s,i){return u(this,null,function*(){return this.post("/api/saas/crm/webhook-event",{ruleId:e,eventName:s,payload:i})})}};var Ks=class extends S{create(e){return u(this,null,function*(){return this.post("/api/services/leads",e)})}upsert(e){return u(this,null,function*(){return this.post("/api/services/leads/upsert",e)})}createMany(e,s=50){return u(this,null,function*(){let i=[];for(let n=0;n<e.length;n+=s){let r=e.slice(n,n+s).map(p=>this.create(p)),o=yield Promise.allSettled(r);for(let p of o)if(p.status==="fulfilled")i.push(p.value);else throw p.reason}return i})}import(e){return u(this,null,function*(){return this.post("/api/services/leads/import",{leads:e})})}list(e){return u(this,null,function*(){let s=N({},e);return Array.isArray(s.tags)&&(s.tags=s.tags.join(",")),this.get("/api/services/leads",{params:s})})}listAutoPaging(e){return je(this,null,function*(){let s=(e==null?void 0:e.page)||1,i=!0;for(;i;){let n=yield new Ce(this.list(re(N({},e),{page:s}))),a=Array.isArray(n.data)?n.data:n||[];if(a.length===0){i=!1;break}for(let r of a)yield r;n.pagination&&s<n.pagination.pages||!n.pagination&&a.length>0?s++:i=!1}})}retrieve(e){return u(this,null,function*(){return this.get(`/api/services/leads/${e}`)})}retrieveByPhone(e){return u(this,null,function*(){return this.get(`/api/services/leads/phone/${encodeURIComponent(e)}`)})}retrieveByRef(e,s){return u(this,null,function*(){return this.get(`/api/services/leads/ref/${encodeURIComponent(e)}/${encodeURIComponent(s)}`)})}update(e,s){return u(this,null,function*(){return this.post(`/api/services/leads/${e}`,s)})}move(e,s){return u(this,null,function*(){return this.patch(`/api/services/leads/${e}/move`,{stageId:s})})}convert(e,s,i){return u(this,null,function*(){return this.post(`/api/services/leads/${e}/convert`,{outcome:s,reason:i})})}tags(e,s){return u(this,null,function*(){return this.patch(`/api/services/leads/${e}/tags`,s)})}recalculateScore(e){return u(this,null,function*(){return this.post(`/api/services/leads/${e}/score`,{})})}updateMetadata(e,s){return u(this,null,function*(){return this.patch(`/api/services/leads/${e}/metadata`,s)})}fields(){return u(this,null,function*(){return this.get("/api/services/leads/fields")})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/services/leads/${e}`)})}bulkDelete(e){return u(this,null,function*(){return this.deleteRequest("/api/services/leads",{data:{ids:e}})})}};var Js=class extends S{capture(e){return u(this,null,function*(){return this.post("/api/saas/crm/payments/capture",e)})}};var Ys=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/crm/pipelines",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/crm/pipelines",e)})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/crm/pipelines/${e}`)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/pipelines/${e}`,s)})}setDefault(e){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/default`,{})})}duplicate(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/duplicate`,{newName:s})})}archive(e){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/archive`,{})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/pipelines/${e}`)})}board(e){return u(this,null,function*(){return this.get(`/api/saas/crm/pipelines/${e}/board`)})}forecast(e){return u(this,null,function*(){return this.get(`/api/saas/crm/pipelines/${e}/forecast`)})}addStage(e,s){return u(this,null,function*(){return this.post(`/api/saas/crm/pipelines/${e}/stages`,s)})}reorderStages(e,s){return u(this,null,function*(){return this.put(`/api/saas/crm/pipelines/${e}/stages/reorder`,{order:s})})}updateStage(e,s){return u(this,null,function*(){return this.patch(`/api/saas/crm/stages/${e}`,s)})}deleteStage(e,s){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/stages/${e}`,{data:s?{moveLeadsToStageId:s}:void 0})})}};var Xs=class extends S{getConfig(){return u(this,null,function*(){return this.get("/api/saas/crm/scoring")})}updateConfig(e){return u(this,null,function*(){return this.patch("/api/saas/crm/scoring",e)})}recalculate(e){return u(this,null,function*(){return this.post(`/api/saas/crm/scoring/${e}/recalculate`,{})})}};var Qs=class extends S{enroll(e){return u(this,null,function*(){return this.post("/api/saas/crm/sequences/enroll",e)})}unenroll(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/sequences/unenroll/${e}`)})}listForLead(e){return u(this,null,function*(){return this.get(`/api/saas/crm/sequences/lead/${e}`)})}};var Zs=class{constructor(e){A(this,"leads");A(this,"pipelines");A(this,"activities");A(this,"analytics");A(this,"automations");A(this,"sequences");A(this,"scoring");A(this,"payments");A(this,"automationDashboard");this.leads=new Ks(e),this.pipelines=new Ys(e),this.activities=new Hs(e),this.analytics=new Ws(e),this.automations=new Gs(e),this.sequences=new Qs(e),this.scoring=new Xs(e),this.payments=new Js(e),this.automationDashboard=new Vs(e)}};var ei=class extends S{sendEmailCampaign(e){return u(this,null,function*(){return this.post("/api/saas/emails/campaign",e)})}sendTestEmail(e){return u(this,null,function*(){return this.post("/api/saas/emails/test",{to:e})})}};var ti=class extends S{list(){return u(this,null,function*(){return this.get("/api/saas/events")})}assign(e){return u(this,null,function*(){return this.post("/api/saas/events/assign",e)})}unassign(e){return u(this,null,function*(){return this.post("/api/saas/events/unassign",{name:e})})}unassignBulk(e){return u(this,null,function*(){return this.post("/api/saas/events/unassign/bulk",{names:e})})}trigger(e){return u(this,null,function*(){return this.post("/api/saas/workflows/trigger",e)})}listCustomEvents(){return u(this,null,function*(){return this.get("/api/saas/crm/custom-events")})}createCustomEvent(e){return u(this,null,function*(){return this.post("/api/saas/crm/custom-events",e)})}deleteCustomEvent(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/crm/custom-events/${e}`)})}emit(e){return u(this,null,function*(){return this.post("/api/saas/crm/events/emit",e)})}};var si=class extends S{system(){return u(this,null,function*(){return(yield this.get("/api/saas/health",{headers:{accept:"application/json"}})).data})}clientHealth(){return u(this,null,function*(){return(yield this.get("/api/saas/health/client")).data})}jobStatus(e){return u(this,null,function*(){return(yield this.get(`/api/saas/jobs/status/${e}`)).data})}};var fn=class extends S{sendCampaign(e){return u(this,null,function*(){return this.post("/api/saas/marketing/emails/campaign",e)})}sendTest(e){return u(this,null,function*(){return this.post("/api/saas/marketing/emails/test",{to:e})})}},hn=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/marketing/campaigns",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/marketing/campaigns",e)})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/marketing/campaigns/${e}`)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/marketing/campaigns/${e}`,s)})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/marketing/campaigns/${e}`)})}send(e,s){return u(this,null,function*(){return this.post(`/api/saas/marketing/campaigns/${e}/send`,s||{})})}stats(e){return u(this,null,function*(){return this.get(`/api/saas/marketing/campaigns/${e}/stats`)})}},xn=class extends S{sendTemplate(e){return u(this,null,function*(){return this.post("/api/saas/marketing/whatsapp/send-template",e)})}},ii=class extends S{constructor(s){super(s);A(this,"emails");A(this,"campaigns");A(this,"whatsapp");this.emails=new fn(s),this.campaigns=new hn(s),this.whatsapp=new xn(s)}};var ni=class extends S{getUsage(){return u(this,null,function*(){return this.get("/api/saas/storage/usage")})}createFolder(e){return u(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}list(e,s){return u(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}delete(e){return u(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}getDownloadUrl(e){return u(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}upload(e,s){return u(this,null,function*(){let{data:i}=yield this.client.post("/api/saas/storage/upload-url",s),{uploadUrl:n,key:a}=i;yield Mt.put(n,e,{headers:{"Content-Type":s.contentType}});let r=e.size||e.byteLength||0;return this.post("/api/saas/storage/confirm-upload",{key:a,sizeBytes:r})})}};var ai=class extends S{create(e){return u(this,null,function*(){return this.post("/api/saas/meet",e)})}list(e){return u(this,null,function*(){return this.get("/api/saas/meet",{params:e})})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/meet/${e}`)})}update(e,s){return u(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}reschedule(e,s){return u(this,null,function*(){return this.patch(`/api/saas/meet/${e}`,s)})}delete(e){return u(this,null,function*(){return this.update(e,{status:"cancelled"})})}};var ri=class extends S{listLogs(e){return u(this,null,function*(){return this.get("/api/saas/events/logs",{params:e})})}retrieveLog(e){return u(this,null,function*(){return this.get(`/api/saas/events/logs/${e}`)})}getStats(e){return u(this,null,function*(){return this.get("/api/saas/events/stats",{params:e})})}listCallbacks(e){return u(this,null,function*(){return this.get("/api/saas/callbacks/logs",{params:e})})}listAlerts(e){return u(this,null,function*(){return this.get("/api/saas/crm/notifications",{params:e})})}dismissAlert(e){return u(this,null,function*(){return this.patch(`/api/saas/crm/notifications/${e}/dismiss`)})}clearAllAlerts(){return u(this,null,function*(){return this.deleteRequest("/api/saas/crm/notifications/clear-all")})}retryAction(e){return u(this,null,function*(){return this.post(`/api/saas/crm/notifications/${e}/retry`,{})})}};var oi=class extends S{listFailed(){return u(this,null,function*(){return this.get("/api/saas/queue/failed")})}getStats(){return u(this,null,function*(){return this.get("/api/saas/queue/stats")})}retryJob(e){return u(this,null,function*(){return this.post(`/api/saas/queue/${e}/retry`,{})})}deleteJob(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/queue/${e}`)})}};var gn=class extends S{create(e){return u(this,null,function*(){return this.post("/api/saas/storage/folders",{name:e})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/storage/folders/${encodeURIComponent(e)}`)})}},vn=class extends S{list(e,s){return u(this,null,function*(){return this.get(`/api/saas/storage/files/${e}`,{params:s})})}getUploadUrl(e){return u(this,null,function*(){return this.post("/api/saas/storage/upload-url",e)})}confirmUpload(e){return u(this,null,function*(){return this.post("/api/saas/storage/confirm-upload",e)})}getDownloadUrl(e){return u(this,null,function*(){return this.post("/api/saas/storage/download-url",{key:e})})}delete(e){return u(this,null,function*(){return this.deleteRequest("/api/saas/storage/files",{params:{key:e}})})}},ci=class extends S{constructor(s){super(s);A(this,"folders");A(this,"files");this.folders=new gn(s),this.files=new vn(s)}usage(){return u(this,null,function*(){return this.get("/api/saas/storage/usage")})}};var wt=class extends we{constructor(e){super(e,400,"invalid_signature"),this.name="WebhookSignatureError"}},pi=class{constructEvent(e,s,i){return u(this,null,function*(){if(!s)throw new wt("No webhook signature provided");let n=Array.isArray(s)?s[0]:s;n.startsWith("sha256=")&&(n=n.slice(7));try{let a=yield import("crypto"),o=a.createHmac("sha256",i).update(e).digest("hex");if(!a.timingSafeEqual(Buffer.from(o),Buffer.from(n)))throw new wt("Invalid webhook signature provided");return JSON.parse(e.toString("utf8"))}catch(a){throw a instanceof wt?a:new wt(`Webhook payload parsing failed: ${a.message}`)}})}};var li=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/chat/broadcasts",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/chat/broadcast",e)})}};var ui=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/chat/conversations",{params:e})})}create(e){return u(this,null,function*(){return this.post("/api/saas/chat/conversations",e)})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}`)})}messages(e,s){return u(this,null,function*(){return this.get(`/api/saas/chat/conversations/${e}/messages`,{params:s})})}linkLead(e,s,i){return u(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/link-lead`,{leadId:s,leadData:i})})}markRead(e){return u(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`,{})})}delete(e){return u(this,null,function*(){return this.deleteRequest(`/api/saas/chat/conversations/${e}`)})}bulkDelete(e){return u(this,null,function*(){return this.post("/api/saas/chat/conversations/bulk-delete",{ids:e})})}};var di=class extends S{send(e){return u(this,null,function*(){return this.post("/api/saas/chat/send",e)})}sendTemplate(e){return u(this,null,function*(){return this.post("/api/saas/chat/send",re(N({},e),{templateLanguage:e.language||"en_US"}))})}star(e,s){return u(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/star`,{isStarred:s})})}react(e,s){return u(this,null,function*(){return this.post(`/api/saas/chat/messages/${e}/react`,{reaction:s})})}markRead(e){return u(this,null,function*(){return this.post(`/api/saas/chat/conversations/${e}/read`)})}};var mi=class extends S{list(e){return u(this,null,function*(){return this.get("/api/saas/whatsapp/templates",{params:e})})}sync(){return u(this,null,function*(){return this.post("/api/saas/whatsapp/templates/sync",{})})}retrieve(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}`)})}create(e){return u(this,null,function*(){return this.post("/api/saas/whatsapp/templates",e)})}update(e,s){return u(this,null,function*(){return this.put(`/api/saas/whatsapp/templates/${e}`,s)})}deleteTemplate(e,s){return u(this,null,function*(){return this.deleteRequest(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}${s?"?force=true":""}`)})}mappingConfig(){return u(this,null,function*(){return this.get("/api/saas/whatsapp/templates/mapping/config")})}collections(){return u(this,null,function*(){return this.get("/api/saas/whatsapp/templates/collections")})}collectionFields(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/collections/${encodeURIComponent(e)}/fields`)})}updateMapping(e,s){return u(this,null,function*(){return this.put(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/mapping`,s)})}validate(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/validate`)})}preview(e,s){return u(this,null,function*(){return this.post(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/preview`,{context:s})})}checkUsage(e){return u(this,null,function*(){return this.get(`/api/saas/whatsapp/templates/${encodeURIComponent(e)}/usage`)})}};var fi=class extends S{constructor(s){super(s);A(this,"messages");A(this,"conversations");A(this,"broadcasts");A(this,"templates");this.messages=new di(s),this.conversations=new ui(s),this.broadcasts=new li(s),this.templates=new mi(s)}upload(s,i){return u(this,null,function*(){let n=new FormData;return n.append("file",s,i),this.post("/api/saas/whatsapp/upload",n,{headers:typeof n.getHeaders=="function"?n.getHeaders():void 0})})}sendTemplate(s){return u(this,null,function*(){return this.post("/api/saas/whatsapp/send-template",s)})}};var is=class{constructor(e){A(this,"client");A(this,"socket");A(this,"whatsapp");A(this,"crm");A(this,"media");A(this,"meet");A(this,"notifications");A(this,"email");A(this,"events");A(this,"webhooks");A(this,"storage");A(this,"marketing");A(this,"health");A(this,"queue");var o,p,l;if(!e.apiKey)throw new $s("API Key is required");let s=e.baseUrl||"https://api.ecodrix.com",i=e.socketUrl||s,n=typeof window!="undefined"&&typeof window.document!="undefined",a=n?"browser":typeof process!="undefined"?`node ${process.version}`:"unknown",r=n?((o=globalThis.navigator)==null?void 0:o.userAgent)||"browser":typeof process!="undefined"?process.platform:"unknown";this.client=Mt.create({baseURL:s,headers:{"x-api-key":e.apiKey,"x-client-code":(p=e.clientCode)==null?void 0:p.toUpperCase(),"Content-Type":"application/json","x-ecodrix-client-agent":JSON.stringify({sdk_version:"1.0.0",runtime:a,os:r})}}),zi(this.client,{retries:3,retryDelay:zi.exponentialDelay,retryCondition:c=>{var m;return zi.isNetworkOrIdempotentRequestError(c)||((m=c.response)==null?void 0:m.status)===429}}),this.whatsapp=new fi(this.client),this.crm=new Zs(this.client),this.media=new ni(this.client),this.meet=new ai(this.client),this.notifications=new ri(this.client),this.email=new ei(this.client),this.events=new ti(this.client),this.webhooks=new pi,this.storage=new ci(this.client),this.marketing=new ii(this.client),this.health=new si(this.client),this.queue=new oi(this.client),this.socket=zs(i,{extraHeaders:{"x-api-key":e.apiKey,"x-client-code":((l=e.clientCode)==null?void 0:l.toUpperCase())||""}}),this.setupSocket(e.clientCode)}setupSocket(e){this.socket.on("connect",()=>{e&&this.socket.emit("join-room",e.toUpperCase())})}on(e,s){return this.socket.on(e,s),this}disconnect(){this.socket.disconnect()}request(e,s,i,n){return u(this,null,function*(){var a,r,o;try{return(yield this.client.request({method:e,url:s,data:i,params:n})).data}catch(p){throw p.response?new we(((a=p.response.data)==null?void 0:a.message)||((r=p.response.data)==null?void 0:r.error)||"Raw Execution Failed",p.response.status,(o=p.response.data)==null?void 0:o.code):new we(p.message||"Network Error")}})}};var kv=is;return pd(Rv);})();
|
|
20
20
|
/*! Bundled license information:
|
|
21
21
|
|
|
22
22
|
mime-db/index.js:
|