@ecodrix/erix-api 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,7 +16,7 @@
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 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);})();
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()}off(e,s){return this.socket.off(e,s),this}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: