opentrader
Version:
OpenTrader is a powerful open-source crypto trading bot designated to automate your trading strategies on various cryptocurrency exchanges.
8 lines • 53.9 kB
JavaScript
import{b1 as sr,b2 as re,b3 as Me,b0 as Sr}from"./index-Du-vO1Hr.js";import{z as ie}from"./__vite-browser-external-v7f2oYTb.js";import{i as jr,a as et,j as rt,k as tt,l as nt,b as at}from"./browser-rfzQWLT_.js";import{r as ot}from"./callBound-DcviPCZX.js";var ce=jr();const ye=sr(ce);var me=et();class qe extends Error{constructor(t,e){super(t),Error.captureStackTrace(this,this.constructor),this.type=e}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class de extends qe{constructor(t,e,o){super(t,e),o&&(this.code=this.errno=o.code,this.erroredSysCall=o.syscall)}}const Be=Symbol.toStringTag,Nr=r=>typeof r=="object"&&typeof r.append=="function"&&typeof r.delete=="function"&&typeof r.get=="function"&&typeof r.getAll=="function"&&typeof r.has=="function"&&typeof r.set=="function"&&typeof r.sort=="function"&&r[Be]==="URLSearchParams",Ue=r=>r&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&typeof r.constructor=="function"&&/^(Blob|File)$/.test(r[Be]),it=r=>typeof r=="object"&&(r[Be]==="AbortSignal"||r[Be]==="EventTarget"),st=(r,t)=>{const e=new URL(t).hostname,o=new URL(r).hostname;return e===o||e.endsWith(`.${o}`)},ft=(r,t)=>{const e=new URL(t).protocol,o=new URL(r).protocol;return e===o},lt=me.promisify(ye.pipeline),oe=Symbol("Body internals");class $e{constructor(t,{size:e=0}={}){let o=null;t===null?t=null:Nr(t)?t=re.from(t.toString()):Ue(t)||re.isBuffer(t)||(me.types.isAnyArrayBuffer(t)?t=re.from(t):ArrayBuffer.isView(t)?t=re.from(t.buffer,t.byteOffset,t.byteLength):t instanceof ye||(t=re.from(String(t))));let s=t;re.isBuffer(t)?s=ye.Readable.from(t):Ue(t)&&(s=ye.Readable.from(t.stream())),this[oe]={body:t,stream:s,boundary:o,disturbed:!1,error:null},this.size=e,t instanceof ye&&t.on("error",y=>{const w=y instanceof qe?y:new de(`Invalid response body while trying to fetch ${this.url}: ${y.message}`,"system",y);this[oe].error=w})}get body(){return this[oe].stream}get bodyUsed(){return this[oe].disturbed}async arrayBuffer(){const{buffer:t,byteOffset:e,byteLength:o}=await Je(this);return t.slice(e,e+o)}async blob(){const t=this.headers&&this.headers.get("content-type")||this[oe].body&&this[oe].body.type||"",e=await this.arrayBuffer();return new Blob([e],{type:t})}async json(){const t=await this.text();return JSON.parse(t)}async text(){const t=await Je(this);return new TextDecoder().decode(t)}buffer(){return Je(this)}}$e.prototype.buffer=me.deprecate($e.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties($e.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:me.deprecate(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function Je(r){if(r[oe].disturbed)throw new TypeError(`body used already for: ${r.url}`);if(r[oe].disturbed=!0,r[oe].error)throw r[oe].error;const{body:t}=r;if(t===null)return re.alloc(0);if(!(t instanceof ye))return re.alloc(0);const e=[];let o=0;try{for await(const s of t){if(r.size>0&&o+s.length>r.size){const y=new de(`content size at ${r.url} over limit: ${r.size}`,"max-size");throw t.destroy(y),y}o+=s.length,e.push(s)}}catch(s){throw s instanceof qe?s:new de(`Invalid response body while trying to fetch ${r.url}: ${s.message}`,"system",s)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return e.every(s=>typeof s=="string")?re.from(e.join("")):re.concat(e,o)}catch(s){throw new de(`Could not create Buffer from response body for ${r.url}: ${s.message}`,"system",s)}else throw new de(`Premature close of server response while trying to fetch ${r.url}`)}const fr=(r,t)=>{let e,o,{body:s}=r[oe];if(r.bodyUsed)throw new Error("cannot clone body after it is used");return s instanceof ye&&typeof s.getBoundary!="function"&&(e=new ce.PassThrough({highWaterMark:t}),o=new ce.PassThrough({highWaterMark:t}),s.pipe(e),s.pipe(o),r[oe].stream=e,s=o),s},ut=me.deprecate(r=>r.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),Mr=(r,t)=>r===null?null:typeof r=="string"?"text/plain;charset=UTF-8":Nr(r)?"application/x-www-form-urlencoded;charset=UTF-8":Ue(r)?r.type||null:re.isBuffer(r)||me.types.isAnyArrayBuffer(r)||ArrayBuffer.isView(r)?null:r&&typeof r.getBoundary=="function"?`multipart/form-data;boundary=${ut(r)}`:r instanceof ye?null:"text/plain;charset=UTF-8",ct=r=>{const{body:t}=r[oe];return t===null?0:Ue(t)?t.size:re.isBuffer(t)?t.length:t&&typeof t.getLengthSync=="function"&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},ht=async(r,{body:t})=>{t===null?r.end():await lt(t,r)},Ne=typeof ie.validateHeaderName=="function"?ie.validateHeaderName:r=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(r)){const t=new TypeError(`Header name must be a valid HTTP token [${r}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},nr=typeof ie.validateHeaderValue=="function"?ie.validateHeaderValue:(r,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){const e=new TypeError(`Invalid character in header content ["${r}"]`);throw Object.defineProperty(e,"code",{value:"ERR_INVALID_CHAR"}),e}};class ge extends URLSearchParams{constructor(t){let e=[];if(t instanceof ge){const o=t.raw();for(const[s,y]of Object.entries(o))e.push(...y.map(w=>[s,w]))}else if(t!=null)if(typeof t=="object"&&!me.types.isBoxedPrimitive(t)){const o=t[Symbol.iterator];if(o==null)e.push(...Object.entries(t));else{if(typeof o!="function")throw new TypeError("Header pairs must be iterable");e=[...t].map(s=>{if(typeof s!="object"||me.types.isBoxedPrimitive(s))throw new TypeError("Each header pair must be an iterable object");return[...s]}).map(s=>{if(s.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...s]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");return e=e.length>0?e.map(([o,s])=>(Ne(o),nr(o,String(s)),[String(o).toLowerCase(),String(s)])):void 0,super(e),new Proxy(this,{get(o,s,y){switch(s){case"append":case"set":return(w,d)=>(Ne(w),nr(w,String(d)),URLSearchParams.prototype[s].call(o,String(w).toLowerCase(),String(d)));case"delete":case"has":case"getAll":return w=>(Ne(w),URLSearchParams.prototype[s].call(o,String(w).toLowerCase()));case"keys":return()=>(o.sort(),new Set(URLSearchParams.prototype.keys.call(o)).keys());default:return Reflect.get(o,s,y)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(t){const e=this.getAll(t);if(e.length===0)return null;let o=e.join(", ");return/^content-encoding$/i.test(t)&&(o=o.toLowerCase()),o}forEach(t,e=void 0){for(const o of this.keys())Reflect.apply(t,e,[this.get(o),o,this])}*values(){for(const t of this.keys())yield this.get(t)}*entries(){for(const t of this.keys())yield[t,this.get(t)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((t,e)=>(t[e]=this.getAll(e),t),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((t,e)=>{const o=this.getAll(e);return e==="host"?t[e]=o[0]:t[e]=o.length>1?o:o[0],t},{})}}Object.defineProperties(ge.prototype,["get","entries","forEach","values"].reduce((r,t)=>(r[t]={enumerable:!0},r),{}));function pt(r=[]){return new ge(r.reduce((t,e,o,s)=>(o%2===0&&t.push(s.slice(o,o+2)),t),[]).filter(([t,e])=>{try{return Ne(t),nr(t,String(e)),!0}catch{return!1}}))}const dt=new Set([301,302,303,307,308]),Br=r=>dt.has(r),ue=Symbol("Response internals");class se extends $e{constructor(t=null,e={}){super(t,e);const o=e.status!=null?e.status:200,s=new ge(e.headers);if(t!==null&&!s.has("Content-Type")){const y=Mr(t);y&&s.append("Content-Type",y)}this[ue]={type:"default",url:e.url,status:o,statusText:e.statusText||"",headers:s,counter:e.counter,highWaterMark:e.highWaterMark}}get type(){return this[ue].type}get url(){return this[ue].url||""}get status(){return this[ue].status}get ok(){return this[ue].status>=200&&this[ue].status<300}get redirected(){return this[ue].counter>0}get statusText(){return this[ue].statusText}get headers(){return this[ue].headers}get highWaterMark(){return this[ue].highWaterMark}clone(){return new se(fr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,e=302){if(!Br(e))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new se(null,{headers:{location:new URL(t).toString()},status:e})}static error(){const t=new se(null,{status:0,statusText:""});return t[ue].type="error",t}static json(t=void 0,e={}){const o=JSON.stringify(t);if(o===void 0)throw new TypeError("data is not JSON serializable");const s=new ge(e&&e.headers);return s.has("content-type")||s.set("content-type","application/json"),new se(o,{...e,headers:s})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(se.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});var Ce={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var yt=Ce.exports,xr;function mt(){return xr||(xr=1,function(r,t){(function(e){var o=t&&!t.nodeType&&t,s=r&&!r.nodeType&&r,y=typeof Me=="object"&&Me;(y.global===y||y.window===y||y.self===y)&&(e=y);var w,d=2147483647,T=36,v=1,O=26,k=38,x=700,h=72,m=128,b="-",a=/^xn--/,l=/[^\x20-\x7E]/,n=/[\x2E\u3002\uFF0E\uFF61]/g,c={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=T-v,u=Math.floor,g=String.fromCharCode,$;function E(S){throw new RangeError(c[S])}function C(S,P){for(var I=S.length,U=[];I--;)U[I]=P(S[I]);return U}function R(S,P){var I=S.split("@"),U="";I.length>1&&(U=I[0]+"@",S=I[1]),S=S.replace(n,".");var M=S.split("."),z=C(M,P).join(".");return U+z}function B(S){for(var P=[],I=0,U=S.length,M,z;I<U;)M=S.charCodeAt(I++),M>=55296&&M<=56319&&I<U?(z=S.charCodeAt(I++),(z&64512)==56320?P.push(((M&1023)<<10)+(z&1023)+65536):(P.push(M),I--)):P.push(M);return P}function A(S){return C(S,function(P){var I="";return P>65535&&(P-=65536,I+=g(P>>>10&1023|55296),P=56320|P&1023),I+=g(P),I}).join("")}function Q(S){return S-48<10?S-22:S-65<26?S-65:S-97<26?S-97:T}function G(S,P){return S+22+75*(S<26)-((P!=0)<<5)}function N(S,P,I){var U=0;for(S=I?u(S/x):S>>1,S+=u(S/P);S>p*O>>1;U+=T)S=u(S/p);return u(U+(p+1)*S/(S+k))}function te(S){var P=[],I=S.length,U,M=0,z=m,W=h,J,Z,ee,Y,_,X,ne,K,V;for(J=S.lastIndexOf(b),J<0&&(J=0),Z=0;Z<J;++Z)S.charCodeAt(Z)>=128&&E("not-basic"),P.push(S.charCodeAt(Z));for(ee=J>0?J+1:0;ee<I;){for(Y=M,_=1,X=T;ee>=I&&E("invalid-input"),ne=Q(S.charCodeAt(ee++)),(ne>=T||ne>u((d-M)/_))&&E("overflow"),M+=ne*_,K=X<=W?v:X>=W+O?O:X-W,!(ne<K);X+=T)V=T-K,_>u(d/V)&&E("overflow"),_*=V;U=P.length+1,W=N(M-Y,U,Y==0),u(M/U)>d-z&&E("overflow"),z+=u(M/U),M%=U,P.splice(M++,0,z)}return A(P)}function fe(S){var P,I,U,M,z,W,J,Z,ee,Y,_,X=[],ne,K,V,Oe;for(S=B(S),ne=S.length,P=m,I=0,z=h,W=0;W<ne;++W)_=S[W],_<128&&X.push(g(_));for(U=M=X.length,M&&X.push(b);U<ne;){for(J=d,W=0;W<ne;++W)_=S[W],_>=P&&_<J&&(J=_);for(K=U+1,J-P>u((d-I)/K)&&E("overflow"),I+=(J-P)*K,P=J,W=0;W<ne;++W)if(_=S[W],_<P&&++I>d&&E("overflow"),_==P){for(Z=I,ee=T;Y=ee<=z?v:ee>=z+O?O:ee-z,!(Z<Y);ee+=T)Oe=Z-Y,V=T-Y,X.push(g(G(Y+Oe%V,0))),Z=u(Oe/V);X.push(g(G(Z,0))),z=N(I,K,U==M),I=0,++U}++I,++P}return X.join("")}function F(S){return R(S,function(P){return a.test(P)?te(P.slice(4).toLowerCase()):P})}function pe(S){return R(S,function(P){return l.test(P)?"xn--"+fe(P):P})}if(w={version:"1.4.1",ucs2:{decode:B,encode:A},decode:te,encode:fe,toASCII:pe,toUnicode:F},o&&s)if(r.exports==o)s.exports=w;else for($ in w)w.hasOwnProperty($)&&(o[$]=w[$]);else e.punycode=w})(yt)}(Ce,Ce.exports)),Ce.exports}var gt=mt();const vt=sr(gt);var Ze,Er;function wt(){if(Er)return Ze;Er=1;var r=typeof Map=="function"&&Map.prototype,t=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,e=r&&t&&typeof t.get=="function"?t.get:null,o=r&&Map.prototype.forEach,s=typeof Set=="function"&&Set.prototype,y=Object.getOwnPropertyDescriptor&&s?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,w=s&&y&&typeof y.get=="function"?y.get:null,d=s&&Set.prototype.forEach,T=typeof WeakMap=="function"&&WeakMap.prototype,v=T?WeakMap.prototype.has:null,O=typeof WeakSet=="function"&&WeakSet.prototype,k=O?WeakSet.prototype.has:null,x=typeof WeakRef=="function"&&WeakRef.prototype,h=x?WeakRef.prototype.deref:null,m=Boolean.prototype.valueOf,b=Object.prototype.toString,a=Function.prototype.toString,l=String.prototype.match,n=String.prototype.slice,c=String.prototype.replace,p=String.prototype.toUpperCase,u=String.prototype.toLowerCase,g=RegExp.prototype.test,$=Array.prototype.concat,E=Array.prototype.join,C=Array.prototype.slice,R=Math.floor,B=typeof BigInt=="function"?BigInt.prototype.valueOf:null,A=Object.getOwnPropertySymbols,Q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,G=typeof Symbol=="function"&&typeof Symbol.iterator=="object",N=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===G||!0)?Symbol.toStringTag:null,te=Object.prototype.propertyIsEnumerable,fe=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function F(i,f){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||g.call(/e/,f))return f;var D=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var q=i<0?-R(-i):R(i);if(q!==i){var H=String(q),L=n.call(f,H.length+1);return c.call(H,D,"$&_")+"."+c.call(c.call(L,/([0-9]{3})/g,"$&_"),/_$/,"")}}return c.call(f,D,"$&_")}var pe=rt,S=pe.custom,P=_(S)?S:null;Ze=function i(f,D,q,H){var L=D||{};if(K(L,"quoteStyle")&&L.quoteStyle!=="single"&&L.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(K(L,"maxStringLength")&&(typeof L.maxStringLength=="number"?L.maxStringLength<0&&L.maxStringLength!==1/0:L.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var ve=K(L,"customInspect")?L.customInspect:!0;if(typeof ve!="boolean"&&ve!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(K(L,"indent")&&L.indent!==null&&L.indent!==" "&&!(parseInt(L.indent,10)===L.indent&&L.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(K(L,"numericSeparator")&&typeof L.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var be=L.numericSeparator;if(typeof f>"u")return"undefined";if(f===null)return"null";if(typeof f=="boolean")return f?"true":"false";if(typeof f=="string")return cr(f,L);if(typeof f=="number"){if(f===0)return 1/0/f>0?"0":"-0";var ae=String(f);return be?F(f,ae):ae}if(typeof f=="bigint"){var we=String(f)+"n";return be?F(f,we):we}var We=typeof L.depth>"u"?5:L.depth;if(typeof q>"u"&&(q=0),q>=We&&We>0&&typeof f=="object")return M(f)?"[Array]":"[Object]";var Se=Zr(L,q);if(typeof H>"u")H=[];else if(ur(H,f)>=0)return"[Circular]";function le(xe,De,Xr){if(De&&(H=C.call(H),H.push(De)),Xr){var br={depth:L.depth};return K(L,"quoteStyle")&&(br.quoteStyle=L.quoteStyle),i(xe,br,q+1,H)}return i(xe,L,q+1,H)}if(typeof f=="function"&&!W(f)){var pr=Oe(f),dr=Ie(f,le);return"[Function"+(pr?": "+pr:" (anonymous)")+"]"+(dr.length>0?" { "+E.call(dr,", ")+" }":"")}if(_(f)){var yr=G?c.call(String(f),/^(Symbol\(.*\))_[^)]*$/,"$1"):Q.call(f);return typeof f=="object"&&!G?Re(yr):yr}if(Gr(f)){for(var Ae="<"+u.call(String(f.nodeName)),_e=f.attributes||[],Fe=0;Fe<_e.length;Fe++)Ae+=" "+_e[Fe].name+"="+I(U(_e[Fe].value),"double",L);return Ae+=">",f.childNodes&&f.childNodes.length&&(Ae+="..."),Ae+="</"+u.call(String(f.nodeName))+">",Ae}if(M(f)){if(f.length===0)return"[]";var He=Ie(f,le);return Se&&!Jr(He)?"["+ze(He,Se)+"]":"[ "+E.call(He,", ")+" ]"}if(J(f)){var Ke=Ie(f,le);return!("cause"in Error.prototype)&&"cause"in f&&!te.call(f,"cause")?"{ ["+String(f)+"] "+E.call($.call("[cause]: "+le(f.cause),Ke),", ")+" }":Ke.length===0?"["+String(f)+"]":"{ ["+String(f)+"] "+E.call(Ke,", ")+" }"}if(typeof f=="object"&&ve){if(P&&typeof f[P]=="function"&&pe)return pe(f,{depth:We-q});if(ve!=="symbol"&&typeof f.inspect=="function")return f.inspect()}if(Wr(f)){var mr=[];return o&&o.call(f,function(xe,De){mr.push(le(De,f,!0)+" => "+le(xe,f))}),hr("Map",e.call(f),mr,Se)}if(Kr(f)){var gr=[];return d&&d.call(f,function(xe){gr.push(le(xe,f))}),hr("Set",w.call(f),gr,Se)}if(_r(f))return ke("WeakMap");if(Vr(f))return ke("WeakSet");if(Hr(f))return ke("WeakRef");if(ee(f))return Re(le(Number(f)));if(X(f))return Re(le(B.call(f)));if(Y(f))return Re(m.call(f));if(Z(f))return Re(le(String(f)));if(typeof window<"u"&&f===window)return"{ [object Window] }";if(typeof globalThis<"u"&&f===globalThis||typeof Me<"u"&&f===Me)return"{ [object globalThis] }";if(!z(f)&&!W(f)){var Ve=Ie(f,le),vr=fe?fe(f)===Object.prototype:f instanceof Object||f.constructor===Object,Ge=f instanceof Object?"":"null prototype",wr=!vr&&N&&Object(f)===f&&N in f?n.call(V(f),8,-1):Ge?"Object":"",Yr=vr||typeof f.constructor!="function"?"":f.constructor.name?f.constructor.name+" ":"",Qe=Yr+(wr||Ge?"["+E.call($.call([],wr||[],Ge||[]),": ")+"] ":"");return Ve.length===0?Qe+"{}":Se?Qe+"{"+ze(Ve,Se)+"}":Qe+"{ "+E.call(Ve,", ")+" }"}return String(f)};function I(i,f,D){var q=(D.quoteStyle||f)==="double"?'"':"'";return q+i+q}function U(i){return c.call(String(i),/"/g,""")}function M(i){return V(i)==="[object Array]"&&(!N||!(typeof i=="object"&&N in i))}function z(i){return V(i)==="[object Date]"&&(!N||!(typeof i=="object"&&N in i))}function W(i){return V(i)==="[object RegExp]"&&(!N||!(typeof i=="object"&&N in i))}function J(i){return V(i)==="[object Error]"&&(!N||!(typeof i=="object"&&N in i))}function Z(i){return V(i)==="[object String]"&&(!N||!(typeof i=="object"&&N in i))}function ee(i){return V(i)==="[object Number]"&&(!N||!(typeof i=="object"&&N in i))}function Y(i){return V(i)==="[object Boolean]"&&(!N||!(typeof i=="object"&&N in i))}function _(i){if(G)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Q)return!1;try{return Q.call(i),!0}catch{}return!1}function X(i){if(!i||typeof i!="object"||!B)return!1;try{return B.call(i),!0}catch{}return!1}var ne=Object.prototype.hasOwnProperty||function(i){return i in this};function K(i,f){return ne.call(i,f)}function V(i){return b.call(i)}function Oe(i){if(i.name)return i.name;var f=l.call(a.call(i),/^function\s*([\w$]+)/);return f?f[1]:null}function ur(i,f){if(i.indexOf)return i.indexOf(f);for(var D=0,q=i.length;D<q;D++)if(i[D]===f)return D;return-1}function Wr(i){if(!e||!i||typeof i!="object")return!1;try{e.call(i);try{w.call(i)}catch{return!0}return i instanceof Map}catch{}return!1}function _r(i){if(!v||!i||typeof i!="object")return!1;try{v.call(i,v);try{k.call(i,k)}catch{return!0}return i instanceof WeakMap}catch{}return!1}function Hr(i){if(!h||!i||typeof i!="object")return!1;try{return h.call(i),!0}catch{}return!1}function Kr(i){if(!w||!i||typeof i!="object")return!1;try{w.call(i);try{e.call(i)}catch{return!0}return i instanceof Set}catch{}return!1}function Vr(i){if(!k||!i||typeof i!="object")return!1;try{k.call(i,k);try{v.call(i,v)}catch{return!0}return i instanceof WeakSet}catch{}return!1}function Gr(i){return!i||typeof i!="object"?!1:typeof HTMLElement<"u"&&i instanceof HTMLElement?!0:typeof i.nodeName=="string"&&typeof i.getAttribute=="function"}function cr(i,f){if(i.length>f.maxStringLength){var D=i.length-f.maxStringLength,q="... "+D+" more character"+(D>1?"s":"");return cr(n.call(i,0,f.maxStringLength),f)+q}var H=c.call(c.call(i,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Qr);return I(H,"single",f)}function Qr(i){var f=i.charCodeAt(0),D={8:"b",9:"t",10:"n",12:"f",13:"r"}[f];return D?"\\"+D:"\\x"+(f<16?"0":"")+p.call(f.toString(16))}function Re(i){return"Object("+i+")"}function ke(i){return i+" { ? }"}function hr(i,f,D,q){var H=q?ze(D,q):E.call(D,", ");return i+" ("+f+") {"+H+"}"}function Jr(i){for(var f=0;f<i.length;f++)if(ur(i[f],`
`)>=0)return!1;return!0}function Zr(i,f){var D;if(i.indent===" ")D=" ";else if(typeof i.indent=="number"&&i.indent>0)D=E.call(Array(i.indent+1)," ");else return null;return{base:D,prev:E.call(Array(f+1),D)}}function ze(i,f){if(i.length===0)return"";var D=`
`+f.prev+f.base;return D+E.call(i,","+D)+`
`+f.prev}function Ie(i,f){var D=M(i),q=[];if(D){q.length=i.length;for(var H=0;H<i.length;H++)q[H]=K(i,H)?f(i[H],i):""}var L=typeof A=="function"?A(i):[],ve;if(G){ve={};for(var be=0;be<L.length;be++)ve["$"+L[be]]=L[be]}for(var ae in i)K(i,ae)&&(D&&String(Number(ae))===ae&&ae<i.length||G&&ve["$"+ae]instanceof Symbol||(g.call(/[^\w$]/,ae)?q.push(f(ae,i)+": "+f(i[ae],i)):q.push(ae+": "+f(i[ae],i))));if(typeof A=="function")for(var we=0;we<L.length;we++)te.call(i,L[we])&&q.push("["+f(L[we])+"]: "+f(i[L[we]],i));return q}return Ze}var Ye,Tr;function bt(){if(Tr)return Ye;Tr=1;var r=tt(),t=ot(),e=wt(),o=nt(),s=r("%WeakMap%",!0),y=r("%Map%",!0),w=t("WeakMap.prototype.get",!0),d=t("WeakMap.prototype.set",!0),T=t("WeakMap.prototype.has",!0),v=t("Map.prototype.get",!0),O=t("Map.prototype.set",!0),k=t("Map.prototype.has",!0),x=function(a,l){for(var n=a,c;(c=n.next)!==null;n=c)if(c.key===l)return n.next=c.next,c.next=a.next,a.next=c,c},h=function(a,l){var n=x(a,l);return n&&n.value},m=function(a,l,n){var c=x(a,l);c?c.value=n:a.next={key:l,next:a.next,value:n}},b=function(a,l){return!!x(a,l)};return Ye=function(){var l,n,c,p={assert:function(u){if(!p.has(u))throw new o("Side channel does not contain "+e(u))},get:function(u){if(s&&u&&(typeof u=="object"||typeof u=="function")){if(l)return w(l,u)}else if(y){if(n)return v(n,u)}else if(c)return h(c,u)},has:function(u){if(s&&u&&(typeof u=="object"||typeof u=="function")){if(l)return T(l,u)}else if(y){if(n)return k(n,u)}else if(c)return b(c,u);return!1},set:function(u,g){s&&u&&(typeof u=="object"||typeof u=="function")?(l||(l=new s),d(l,u,g)):y?(n||(n=new y),O(n,u,g)):(c||(c={key:{},next:null}),m(c,u,g))}};return p},Ye}var Xe,Or;function lr(){if(Or)return Xe;Or=1;var r=String.prototype.replace,t=/%20/g,e={RFC1738:"RFC1738",RFC3986:"RFC3986"};return Xe={default:e.RFC3986,formatters:{RFC1738:function(o){return r.call(o,t,"+")},RFC3986:function(o){return String(o)}},RFC1738:e.RFC1738,RFC3986:e.RFC3986},Xe}var je,Rr;function Ur(){if(Rr)return je;Rr=1;var r=lr(),t=Object.prototype.hasOwnProperty,e=Array.isArray,o=function(){for(var a=[],l=0;l<256;++l)a.push("%"+((l<16?"0":"")+l.toString(16)).toUpperCase());return a}(),s=function(l){for(;l.length>1;){var n=l.pop(),c=n.obj[n.prop];if(e(c)){for(var p=[],u=0;u<c.length;++u)typeof c[u]<"u"&&p.push(c[u]);n.obj[n.prop]=p}}},y=function(l,n){for(var c=n&&n.plainObjects?Object.create(null):{},p=0;p<l.length;++p)typeof l[p]<"u"&&(c[p]=l[p]);return c},w=function a(l,n,c){if(!n)return l;if(typeof n!="object"){if(e(l))l.push(n);else if(l&&typeof l=="object")(c&&(c.plainObjects||c.allowPrototypes)||!t.call(Object.prototype,n))&&(l[n]=!0);else return[l,n];return l}if(!l||typeof l!="object")return[l].concat(n);var p=l;return e(l)&&!e(n)&&(p=y(l,c)),e(l)&&e(n)?(n.forEach(function(u,g){if(t.call(l,g)){var $=l[g];$&&typeof $=="object"&&u&&typeof u=="object"?l[g]=a($,u,c):l.push(u)}else l[g]=u}),l):Object.keys(n).reduce(function(u,g){var $=n[g];return t.call(u,g)?u[g]=a(u[g],$,c):u[g]=$,u},p)},d=function(l,n){return Object.keys(n).reduce(function(c,p){return c[p]=n[p],c},l)},T=function(a,l,n){var c=a.replace(/\+/g," ");if(n==="iso-8859-1")return c.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(c)}catch{return c}},v=1024,O=function(l,n,c,p,u){if(l.length===0)return l;var g=l;if(typeof l=="symbol"?g=Symbol.prototype.toString.call(l):typeof l!="string"&&(g=String(l)),c==="iso-8859-1")return escape(g).replace(/%u[0-9a-f]{4}/gi,function(Q){return"%26%23"+parseInt(Q.slice(2),16)+"%3B"});for(var $="",E=0;E<g.length;E+=v){for(var C=g.length>=v?g.slice(E,E+v):g,R=[],B=0;B<C.length;++B){var A=C.charCodeAt(B);if(A===45||A===46||A===95||A===126||A>=48&&A<=57||A>=65&&A<=90||A>=97&&A<=122||u===r.RFC1738&&(A===40||A===41)){R[R.length]=C.charAt(B);continue}if(A<128){R[R.length]=o[A];continue}if(A<2048){R[R.length]=o[192|A>>6]+o[128|A&63];continue}if(A<55296||A>=57344){R[R.length]=o[224|A>>12]+o[128|A>>6&63]+o[128|A&63];continue}B+=1,A=65536+((A&1023)<<10|C.charCodeAt(B)&1023),R[R.length]=o[240|A>>18]+o[128|A>>12&63]+o[128|A>>6&63]+o[128|A&63]}$+=R.join("")}return $},k=function(l){for(var n=[{obj:{o:l},prop:"o"}],c=[],p=0;p<n.length;++p)for(var u=n[p],g=u.obj[u.prop],$=Object.keys(g),E=0;E<$.length;++E){var C=$[E],R=g[C];typeof R=="object"&&R!==null&&c.indexOf(R)===-1&&(n.push({obj:g,prop:C}),c.push(R))}return s(n),l},x=function(l){return Object.prototype.toString.call(l)==="[object RegExp]"},h=function(l){return!l||typeof l!="object"?!1:!!(l.constructor&&l.constructor.isBuffer&&l.constructor.isBuffer(l))},m=function(l,n){return[].concat(l,n)},b=function(l,n){if(e(l)){for(var c=[],p=0;p<l.length;p+=1)c.push(n(l[p]));return c}return n(l)};return je={arrayToObject:y,assign:d,combine:m,compact:k,decode:T,encode:O,isBuffer:h,isRegExp:x,maybeMap:b,merge:w},je}var er,Ar;function St(){if(Ar)return er;Ar=1;var r=bt(),t=Ur(),e=lr(),o=Object.prototype.hasOwnProperty,s={brackets:function(a){return a+"[]"},comma:"comma",indices:function(a,l){return a+"["+l+"]"},repeat:function(a){return a}},y=Array.isArray,w=Array.prototype.push,d=function(b,a){w.apply(b,y(a)?a:[a])},T=Date.prototype.toISOString,v=e.default,O={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:t.encode,encodeValuesOnly:!1,format:v,formatter:e.formatters[v],indices:!1,serializeDate:function(a){return T.call(a)},skipNulls:!1,strictNullHandling:!1},k=function(a){return typeof a=="string"||typeof a=="number"||typeof a=="boolean"||typeof a=="symbol"||typeof a=="bigint"},x={},h=function b(a,l,n,c,p,u,g,$,E,C,R,B,A,Q,G,N,te,fe){for(var F=a,pe=fe,S=0,P=!1;(pe=pe.get(x))!==void 0&&!P;){var I=pe.get(a);if(S+=1,typeof I<"u"){if(I===S)throw new RangeError("Cyclic object value");P=!0}typeof pe.get(x)>"u"&&(S=0)}if(typeof C=="function"?F=C(l,F):F instanceof Date?F=A(F):n==="comma"&&y(F)&&(F=t.maybeMap(F,function(V){return V instanceof Date?A(V):V})),F===null){if(u)return E&&!N?E(l,O.encoder,te,"key",Q):l;F=""}if(k(F)||t.isBuffer(F)){if(E){var U=N?l:E(l,O.encoder,te,"key",Q);return[G(U)+"="+G(E(F,O.encoder,te,"value",Q))]}return[G(l)+"="+G(String(F))]}var M=[];if(typeof F>"u")return M;var z;if(n==="comma"&&y(F))N&&E&&(F=t.maybeMap(F,E)),z=[{value:F.length>0?F.join(",")||null:void 0}];else if(y(C))z=C;else{var W=Object.keys(F);z=R?W.sort(R):W}var J=$?l.replace(/\./g,"%2E"):l,Z=c&&y(F)&&F.length===1?J+"[]":J;if(p&&y(F)&&F.length===0)return Z+"[]";for(var ee=0;ee<z.length;++ee){var Y=z[ee],_=typeof Y=="object"&&typeof Y.value<"u"?Y.value:F[Y];if(!(g&&_===null)){var X=B&&$?Y.replace(/\./g,"%2E"):Y,ne=y(F)?typeof n=="function"?n(Z,X):Z:Z+(B?"."+X:"["+X+"]");fe.set(a,S);var K=r();K.set(x,fe),d(M,b(_,ne,n,c,p,u,g,$,n==="comma"&&N&&y(F)?null:E,C,R,B,A,Q,G,N,te,K))}}return M},m=function(a){if(!a)return O;if(typeof a.allowEmptyArrays<"u"&&typeof a.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof a.encodeDotInKeys<"u"&&typeof a.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(a.encoder!==null&&typeof a.encoder<"u"&&typeof a.encoder!="function")throw new TypeError("Encoder has to be a function.");var l=a.charset||O.charset;if(typeof a.charset<"u"&&a.charset!=="utf-8"&&a.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=e.default;if(typeof a.format<"u"){if(!o.call(e.formatters,a.format))throw new TypeError("Unknown format option provided.");n=a.format}var c=e.formatters[n],p=O.filter;(typeof a.filter=="function"||y(a.filter))&&(p=a.filter);var u;if(a.arrayFormat in s?u=a.arrayFormat:"indices"in a?u=a.indices?"indices":"repeat":u=O.arrayFormat,"commaRoundTrip"in a&&typeof a.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var g=typeof a.allowDots>"u"?a.encodeDotInKeys===!0?!0:O.allowDots:!!a.allowDots;return{addQueryPrefix:typeof a.addQueryPrefix=="boolean"?a.addQueryPrefix:O.addQueryPrefix,allowDots:g,allowEmptyArrays:typeof a.allowEmptyArrays=="boolean"?!!a.allowEmptyArrays:O.allowEmptyArrays,arrayFormat:u,charset:l,charsetSentinel:typeof a.charsetSentinel=="boolean"?a.charsetSentinel:O.charsetSentinel,commaRoundTrip:a.commaRoundTrip,delimiter:typeof a.delimiter>"u"?O.delimiter:a.delimiter,encode:typeof a.encode=="boolean"?a.encode:O.encode,encodeDotInKeys:typeof a.encodeDotInKeys=="boolean"?a.encodeDotInKeys:O.encodeDotInKeys,encoder:typeof a.encoder=="function"?a.encoder:O.encoder,encodeValuesOnly:typeof a.encodeValuesOnly=="boolean"?a.encodeValuesOnly:O.encodeValuesOnly,filter:p,format:n,formatter:c,serializeDate:typeof a.serializeDate=="function"?a.serializeDate:O.serializeDate,skipNulls:typeof a.skipNulls=="boolean"?a.skipNulls:O.skipNulls,sort:typeof a.sort=="function"?a.sort:null,strictNullHandling:typeof a.strictNullHandling=="boolean"?a.strictNullHandling:O.strictNullHandling}};return er=function(b,a){var l=b,n=m(a),c,p;typeof n.filter=="function"?(p=n.filter,l=p("",l)):y(n.filter)&&(p=n.filter,c=p);var u=[];if(typeof l!="object"||l===null)return"";var g=s[n.arrayFormat],$=g==="comma"&&n.commaRoundTrip;c||(c=Object.keys(l)),n.sort&&c.sort(n.sort);for(var E=r(),C=0;C<c.length;++C){var R=c[C];n.skipNulls&&l[R]===null||d(u,h(l[R],R,g,$,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,E))}var B=u.join(n.delimiter),A=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?A+="utf8=%26%2310003%3B&":A+="utf8=%E2%9C%93&"),B.length>0?A+B:""},er}var rr,Pr;function xt(){if(Pr)return rr;Pr=1;var r=Ur(),t=Object.prototype.hasOwnProperty,e=Array.isArray,o={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},s=function(x){return x.replace(/&#(\d+);/g,function(h,m){return String.fromCharCode(parseInt(m,10))})},y=function(x,h){return x&&typeof x=="string"&&h.comma&&x.indexOf(",")>-1?x.split(","):x},w="utf8=%26%2310003%3B",d="utf8=%E2%9C%93",T=function(h,m){var b={__proto__:null},a=m.ignoreQueryPrefix?h.replace(/^\?/,""):h;a=a.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var l=m.parameterLimit===1/0?void 0:m.parameterLimit,n=a.split(m.delimiter,l),c=-1,p,u=m.charset;if(m.charsetSentinel)for(p=0;p<n.length;++p)n[p].indexOf("utf8=")===0&&(n[p]===d?u="utf-8":n[p]===w&&(u="iso-8859-1"),c=p,p=n.length);for(p=0;p<n.length;++p)if(p!==c){var g=n[p],$=g.indexOf("]="),E=$===-1?g.indexOf("="):$+1,C,R;E===-1?(C=m.decoder(g,o.decoder,u,"key"),R=m.strictNullHandling?null:""):(C=m.decoder(g.slice(0,E),o.decoder,u,"key"),R=r.maybeMap(y(g.slice(E+1),m),function(A){return m.decoder(A,o.decoder,u,"value")})),R&&m.interpretNumericEntities&&u==="iso-8859-1"&&(R=s(R)),g.indexOf("[]=")>-1&&(R=e(R)?[R]:R);var B=t.call(b,C);B&&m.duplicates==="combine"?b[C]=r.combine(b[C],R):(!B||m.duplicates==="last")&&(b[C]=R)}return b},v=function(x,h,m,b){for(var a=b?h:y(h,m),l=x.length-1;l>=0;--l){var n,c=x[l];if(c==="[]"&&m.parseArrays)n=m.allowEmptyArrays&&(a===""||m.strictNullHandling&&a===null)?[]:[].concat(a);else{n=m.plainObjects?Object.create(null):{};var p=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,u=m.decodeDotInKeys?p.replace(/%2E/g,"."):p,g=parseInt(u,10);!m.parseArrays&&u===""?n={0:a}:!isNaN(g)&&c!==u&&String(g)===u&&g>=0&&m.parseArrays&&g<=m.arrayLimit?(n=[],n[g]=a):u!=="__proto__"&&(n[u]=a)}a=n}return a},O=function(h,m,b,a){if(h){var l=b.allowDots?h.replace(/\.([^.[]+)/g,"[$1]"):h,n=/(\[[^[\]]*])/,c=/(\[[^[\]]*])/g,p=b.depth>0&&n.exec(l),u=p?l.slice(0,p.index):l,g=[];if(u){if(!b.plainObjects&&t.call(Object.prototype,u)&&!b.allowPrototypes)return;g.push(u)}for(var $=0;b.depth>0&&(p=c.exec(l))!==null&&$<b.depth;){if($+=1,!b.plainObjects&&t.call(Object.prototype,p[1].slice(1,-1))&&!b.allowPrototypes)return;g.push(p[1])}if(p){if(b.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+b.depth+" and strictDepth is true");g.push("["+l.slice(p.index)+"]")}return v(g,m,b,a)}},k=function(h){if(!h)return o;if(typeof h.allowEmptyArrays<"u"&&typeof h.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof h.decodeDotInKeys<"u"&&typeof h.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(h.decoder!==null&&typeof h.decoder<"u"&&typeof h.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof h.charset<"u"&&h.charset!=="utf-8"&&h.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var m=typeof h.charset>"u"?o.charset:h.charset,b=typeof h.duplicates>"u"?o.duplicates:h.duplicates;if(b!=="combine"&&b!=="first"&&b!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var a=typeof h.allowDots>"u"?h.decodeDotInKeys===!0?!0:o.allowDots:!!h.allowDots;return{allowDots:a,allowEmptyArrays:typeof h.allowEmptyArrays=="boolean"?!!h.allowEmptyArrays:o.allowEmptyArrays,allowPrototypes:typeof h.allowPrototypes=="boolean"?h.allowPrototypes:o.allowPrototypes,allowSparse:typeof h.allowSparse=="boolean"?h.allowSparse:o.allowSparse,arrayLimit:typeof h.arrayLimit=="number"?h.arrayLimit:o.arrayLimit,charset:m,charsetSentinel:typeof h.charsetSentinel=="boolean"?h.charsetSentinel:o.charsetSentinel,comma:typeof h.comma=="boolean"?h.comma:o.comma,decodeDotInKeys:typeof h.decodeDotInKeys=="boolean"?h.decodeDotInKeys:o.decodeDotInKeys,decoder:typeof h.decoder=="function"?h.decoder:o.decoder,delimiter:typeof h.delimiter=="string"||r.isRegExp(h.delimiter)?h.delimiter:o.delimiter,depth:typeof h.depth=="number"||h.depth===!1?+h.depth:o.depth,duplicates:b,ignoreQueryPrefix:h.ignoreQueryPrefix===!0,interpretNumericEntities:typeof h.interpretNumericEntities=="boolean"?h.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:typeof h.parameterLimit=="number"?h.parameterLimit:o.parameterLimit,parseArrays:h.parseArrays!==!1,plainObjects:typeof h.plainObjects=="boolean"?h.plainObjects:o.plainObjects,strictDepth:typeof h.strictDepth=="boolean"?!!h.strictDepth:o.strictDepth,strictNullHandling:typeof h.strictNullHandling=="boolean"?h.strictNullHandling:o.strictNullHandling}};return rr=function(x,h){var m=k(h);if(x===""||x===null||typeof x>"u")return m.plainObjects?Object.create(null):{};for(var b=typeof x=="string"?T(x,m):x,a=m.plainObjects?Object.create(null):{},l=Object.keys(b),n=0;n<l.length;++n){var c=l[n],p=O(c,b[c],m,typeof x=="string");a=r.merge(a,p,m)}return m.allowSparse===!0?a:r.compact(a)},rr}var tr,Cr;function Et(){if(Cr)return tr;Cr=1;var r=St(),t=xt(),e=lr();return tr={formats:e,parse:t,stringify:r},tr}var Tt=Et();const Ot=sr(Tt);var Rt=vt;function he(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var At=/^([a-z0-9.+-]+:)/i,Pt=/:[0-9]*$/,Ct=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,$t=["<",">",'"',"`"," ","\r",`
`," "],Lt=["{","}","|","\\","^","`"].concat($t),ar=["'"].concat(Lt),$r=["%","/","?",";","#"].concat(ar),Lr=["/","?","#"],It=255,Ir=/^[+a-z0-9A-Z_-]{0,63}$/,Ft=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Dt={javascript:!0,"javascript:":!0},or={javascript:!0,"javascript:":!0},Te={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ir=Ot;function qr(r,t,e){if(r&&typeof r=="object"&&r instanceof he)return r;var o=new he;return o.parse(r,t,e),o}he.prototype.parse=function(r,t,e){if(typeof r!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof r);var o=r.indexOf("?"),s=o!==-1&&o<r.indexOf("#")?"?":"#",y=r.split(s),w=/\\/g;y[0]=y[0].replace(w,"/"),r=y.join(s);var d=r;if(d=d.trim(),!e&&r.split("#").length===1){var T=Ct.exec(d);if(T)return this.path=d,this.href=d,this.pathname=T[1],T[2]?(this.search=T[2],t?this.query=ir.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var v=At.exec(d);if(v){v=v[0];var O=v.toLowerCase();this.protocol=O,d=d.substr(v.length)}if(e||v||d.match(/^\/\/[^@/]+@[^@/]+/)){var k=d.substr(0,2)==="//";k&&!(v&&or[v])&&(d=d.substr(2),this.slashes=!0)}if(!or[v]&&(k||v&&!Te[v])){for(var x=-1,h=0;h<Lr.length;h++){var m=d.indexOf(Lr[h]);m!==-1&&(x===-1||m<x)&&(x=m)}var b,a;x===-1?a=d.lastIndexOf("@"):a=d.lastIndexOf("@",x),a!==-1&&(b=d.slice(0,a),d=d.slice(a+1),this.auth=decodeURIComponent(b)),x=-1;for(var h=0;h<$r.length;h++){var m=d.indexOf($r[h]);m!==-1&&(x===-1||m<x)&&(x=m)}x===-1&&(x=d.length),this.host=d.slice(0,x),d=d.slice(x),this.parseHost(),this.hostname=this.hostname||"";var l=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!l)for(var n=this.hostname.split(/\./),h=0,c=n.length;h<c;h++){var p=n[h];if(p&&!p.match(Ir)){for(var u="",g=0,$=p.length;g<$;g++)p.charCodeAt(g)>127?u+="x":u+=p[g];if(!u.match(Ir)){var E=n.slice(0,h),C=n.slice(h+1),R=p.match(Ft);R&&(E.push(R[1]),C.unshift(R[2])),C.length&&(d="/"+C.join(".")+d),this.hostname=E.join(".");break}}}this.hostname.length>It?this.hostname="":this.hostname=this.hostname.toLowerCase(),l||(this.hostname=Rt.toASCII(this.hostname));var B=this.port?":"+this.port:"",A=this.hostname||"";this.host=A+B,this.href+=this.host,l&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),d[0]!=="/"&&(d="/"+d))}if(!Dt[O])for(var h=0,c=ar.length;h<c;h++){var Q=ar[h];if(d.indexOf(Q)!==-1){var G=encodeURIComponent(Q);G===Q&&(G=escape(Q)),d=d.split(Q).join(G)}}var N=d.indexOf("#");N!==-1&&(this.hash=d.substr(N),d=d.slice(0,N));var te=d.indexOf("?");if(te!==-1?(this.search=d.substr(te),this.query=d.substr(te+1),t&&(this.query=ir.parse(this.query)),d=d.slice(0,te)):t&&(this.search="",this.query={}),d&&(this.pathname=d),Te[O]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var B=this.pathname||"",fe=this.search||"";this.path=B+fe}return this.href=this.format(),this};function Nt(r){return typeof r=="string"&&(r=qr(r)),r instanceof he?r.format():he.prototype.format.call(r)}he.prototype.format=function(){var r=this.auth||"";r&&(r=encodeURIComponent(r),r=r.replace(/%3A/i,":"),r+="@");var t=this.protocol||"",e=this.pathname||"",o=this.hash||"",s=!1,y="";this.host?s=r+this.host:this.hostname&&(s=r+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(y=ir.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var w=this.search||y&&"?"+y||"";return t&&t.substr(-1)!==":"&&(t+=":"),this.slashes||(!t||Te[t])&&s!==!1?(s="//"+(s||""),e&&e.charAt(0)!=="/"&&(e="/"+e)):s||(s=""),o&&o.charAt(0)!=="#"&&(o="#"+o),w&&w.charAt(0)!=="?"&&(w="?"+w),e=e.replace(/[?#]/g,function(d){return encodeURIComponent(d)}),w=w.replace("#","%23"),t+s+e+w+o};he.prototype.resolve=function(r){return this.resolveObject(qr(r,!1,!0)).format()};he.prototype.resolveObject=function(r){if(typeof r=="string"){var t=new he;t.parse(r,!1,!0),r=t}for(var e=new he,o=Object.keys(this),s=0;s<o.length;s++){var y=o[s];e[y]=this[y]}if(e.hash=r.hash,r.href==="")return e.href=e.format(),e;if(r.slashes&&!r.protocol){for(var w=Object.keys(r),d=0;d<w.length;d++){var T=w[d];T!=="protocol"&&(e[T]=r[T])}return Te[e.protocol]&&e.hostname&&!e.pathname&&(e.pathname="/",e.path=e.pathname),e.href=e.format(),e}if(r.protocol&&r.protocol!==e.protocol){if(!Te[r.protocol]){for(var v=Object.keys(r),O=0;O<v.length;O++){var k=v[O];e[k]=r[k]}return e.href=e.format(),e}if(e.protocol=r.protocol,!r.host&&!or[r.protocol]){for(var c=(r.pathname||"").split("/");c.length&&!(r.host=c.shift()););r.host||(r.host=""),r.hostname||(r.hostname=""),c[0]!==""&&c.unshift(""),c.length<2&&c.unshift(""),e.pathname=c.join("/")}else e.pathname=r.pathname;if(e.search=r.search,e.query=r.query,e.host=r.host||"",e.auth=r.auth,e.hostname=r.hostname||r.host,e.port=r.port,e.pathname||e.search){var x=e.pathname||"",h=e.search||"";e.path=x+h}return e.slashes=e.slashes||r.slashes,e.href=e.format(),e}var m=e.pathname&&e.pathname.charAt(0)==="/",b=r.host||r.pathname&&r.pathname.charAt(0)==="/",a=b||m||e.host&&r.pathname,l=a,n=e.pathname&&e.pathname.split("/")||[],c=r.pathname&&r.pathname.split("/")||[],p=e.protocol&&!Te[e.protocol];if(p&&(e.hostname="",e.port=null,e.host&&(n[0]===""?n[0]=e.host:n.unshift(e.host)),e.host="",r.protocol&&(r.hostname=null,r.port=null,r.host&&(c[0]===""?c[0]=r.host:c.unshift(r.host)),r.host=null),a=a&&(c[0]===""||n[0]==="")),b)e.host=r.host||r.host===""?r.host:e.host,e.hostname=r.hostname||r.hostname===""?r.hostname:e.hostname,e.search=r.search,e.query=r.query,n=c;else if(c.length)n||(n=[]),n.pop(),n=n.concat(c),e.search=r.search,e.query=r.query;else if(r.search!=null){if(p){e.host=n.shift(),e.hostname=e.host;var u=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;u&&(e.auth=u.shift(),e.hostname=u.shift(),e.host=e.hostname)}return e.search=r.search,e.query=r.query,(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!n.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var g=n.slice(-1)[0],$=(e.host||r.host||n.length>1)&&(g==="."||g==="..")||g==="",E=0,C=n.length;C>=0;C--)g=n[C],g==="."?n.splice(C,1):g===".."?(n.splice(C,1),E++):E&&(n.splice(C,1),E--);if(!a&&!l)for(;E--;E)n.unshift("..");a&&n[0]!==""&&(!n[0]||n[0].charAt(0)!=="/")&&n.unshift(""),$&&n.join("/").substr(-1)!=="/"&&n.push("");var R=n[0]===""||n[0]&&n[0].charAt(0)==="/";if(p){e.hostname=R?"":n.length?n.shift():"",e.host=e.hostname;var u=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;u&&(e.auth=u.shift(),e.hostname=u.shift(),e.host=e.hostname)}return a=a||e.host&&n.length,a&&!R&&n.unshift(""),n.length>0?e.pathname=n.join("/"):(e.pathname=null,e.path=null),(e.pathname!==null||e.search!==null)&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=r.auth||e.auth,e.slashes=e.slashes||r.slashes,e.href=e.format(),e};he.prototype.parseHost=function(){var r=this.host,t=Pt.exec(r);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),r=r.substr(0,r.length-t.length)),r&&(this.hostname=r)};var Mt=Nt,kr=function(r){function t(){var o=this||self;return delete r.prototype.__magic__,o}if(typeof globalThis=="object")return globalThis;if(this)return t();r.defineProperty(r.prototype,"__magic__",{configurable:!0,get:t});var e=__magic__;return e}(Object),Bt=Mt,Fr=kr.URL;kr.URLSearchParams;var Ut=function(t,e){var o,s,y,w;if(e===void 0&&(e={}),!(t instanceof Fr))return Bt(t);if(typeof e!="object"||e===null)throw new TypeError('The "options" argument must be of type object.');var d=(o=e.auth)!=null?o:!0,T=(s=e.fragment)!=null?s:!0,v=(y=e.search)!=null?y:!0;(w=e.unicode)!=null;var O=new Fr(t.toString());return d||(O.username="",O.password=""),T||(O.hash=""),v||(O.search=""),O.toString()};const qt=r=>{if(r.search)return r.search;const t=r.href.length-1,e=r.hash||(r.href[t]==="#"?"#":"");return r.href[t-e.length]==="?"?"?":""};function Dr(r,t=!1){return r==null||(r=new URL(r),/^(about|blob|data):$/.test(r.protocol))?"no-referrer":(r.username="",r.password="",r.hash="",t&&(r.pathname="",r.search=""),r)}const zr=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),kt="strict-origin-when-cross-origin";function zt(r){if(!zr.has(r))throw new TypeError(`Invalid referrerPolicy: ${r}`);return r}function Wt(r){if(/^(http|ws)s:$/.test(r.protocol))return!0;const t=r.host.replace(/(^\[)|(]$)/g,""),e=at.isIP(t);return e===4&&/^127\./.test(t)||e===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t)?!0:r.host==="localhost"||r.host.endsWith(".localhost")?!1:r.protocol==="file:"}function Ee(r){return/^about:(blank|srcdoc)$/.test(r)||r.protocol==="data:"||/^(blob|filesystem):$/.test(r.protocol)?!0:Wt(r)}function _t(r,{referrerURLCallback:t,referrerOriginCallback:e}={}){if(r.referrer==="no-referrer"||r.referrerPolicy==="")return null;const o=r.referrerPolicy;if(r.referrer==="about:client")return"no-referrer";const s=r.referrer;let y=Dr(s),w=Dr(s,!0);y.toString().length>4096&&(y=w),t&&(y=t(y)),e&&(w=e(w));const d=new URL(r.url);switch(o){case"no-referrer":return"no-referrer";case"origin":return w;case"unsafe-url":return y;case"strict-origin":return Ee(y)&&!Ee(d)?"no-referrer":w.toString();case"strict-origin-when-cross-origin":return y.origin===d.origin?y:Ee(y)&&!Ee(d)?"no-referrer":w;case"same-origin":return y.origin===d.origin?y:"no-referrer";case"origin-when-cross-origin":return y.origin===d.origin?y:w;case"no-referrer-when-downgrade":return Ee(y)&&!Ee(d)?"no-referrer":y;default:throw new TypeError(`Invalid referrerPolicy: ${o}`)}}function Ht(r){const t=(r.get("referrer-policy")||"").split(/[,\s]+/);let e="";for(const o of t)o&&zr.has(o)&&(e=o);return e}const j=Symbol("Request internals"),Pe=r=>typeof r=="object"&&typeof r[j]=="object",Kt=me.deprecate(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class Le extends $e{constructor(t,e={}){let o;if(Pe(t)?o=new URL(t.url):(o=new URL(t),t={}),o.username!==""||o.password!=="")throw new TypeError(`${o} is an url with embedded credentials.`);let s=e.method||t.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(s)&&(s=s.toUpperCase()),!Pe(e)&&"data"in e&&Kt(),(e.body!=null||Pe(t)&&t.body!==null)&&(s==="GET"||s==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");const y=e.body?e.body:Pe(t)&&t.body!==null?fr(t):null;super(y,{size:e.size||t.size||0});const w=new ge(e.headers||t.headers||{});if(y!==null&&!w.has("Content-Type")){const v=Mr(y);v&&w.set("Content-Type",v)}let d=Pe(t)?t.signal:null;if("signal"in e&&(d=e.signal),d!=null&&!it(d))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let T=e.referrer==null?t.referrer:e.referrer;if(T==="")T="no-referrer";else if(T){const v=new URL(T);T=/^about:(\/\/)?client$/.test(v)?"client":v}else T=void 0;this[j]={method:s,redirect:e.redirect||t.redirect||"follow",headers:w,parsedURL:o,signal:d,referrer:T},this.follow=e.follow===void 0?t.follow===void 0?20:t.follow:e.follow,this.compress=e.compress===void 0?t.compress===void 0?!0:t.compress:e.compress,this.counter=e.counter||t.counter||0,this.agent=e.agent||t.agent,this.highWaterMark=e.highWaterMark||t.highWaterMark||16384,this.insecureHTTPParser=e.insecureHTTPParser||t.insecureHTTPParser||!1,this.referrerPolicy=e.referrerPolicy||t.referrerPolicy||""}get method(){return this[j].method}get url(){return Ut(this[j].parsedURL)}get headers(){return this[j].headers}get redirect(){return this[j].redirect}get signal(){return this[j].signal}get referrer(){if(this[j].referrer==="no-referrer")return"";if(this[j].referrer==="client")return"about:client";if(this[j].referrer)return this[j].referrer.toString()}get referrerPolicy(){return this[j].referrerPolicy}set referrerPolicy(t){this[j].referrerPolicy=zt(t)}clone(){return new Le(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(Le.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});const Vt=r=>{const{parsedURL:t}=r[j],e=new ge(r[j].headers);e.has("Accept")||e.set("Accept","*/*");let o=null;if(r.body===null&&/^(post|put)$/i.test(r.method)&&(o="0"),r.body!==null){const d=ct(r);typeof d=="number"&&!Number.isNaN(d)&&(o=String(d))}o&&e.set("Content-Length",o),r.referrerPolicy===""&&(r.referrerPolicy=kt),r.referrer&&r.referrer!=="no-referrer"?r[j].referrer=_t(r):r[j].referrer="no-referrer",r[j].referrer instanceof URL&&e.set("Referer",r.referrer),e.has("User-Agent")||e.set("User-Agent","node-fetch"),r.compress&&!e.has("Accept-Encoding")&&e.set("Accept-Encoding","gzip, deflate, br");let{agent:s}=r;typeof s=="function"&&(s=s(t)),!e.has("Connection")&&!s&&e.set("Connection","close");const y=qt(t),w={path:t.pathname+y,method:r.method,headers:e[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:r.insecureHTTPParser,agent:s};return{parsedURL:t,options:w}};class Gt extends qe{constructor(t,e="aborted"){super(t,e)}}const Qt=new Set(["data:","http:","https:"]);async function Jt(r,t){return new Promise((e,o)=>{const s=new Le(r,t),{parsedURL:y,options:w}=Vt(s);if(!Qt.has(y.protocol))throw new TypeError(`node-fetch cannot load ${r}. URL scheme "${y.protocol.replace(/:$/,"")}" is not supported.`);const d=(y.protocol==="https:"?ie:ie).request,{signal:T}=s;let v=null;const O=()=>{const m=new Gt("The operation was aborted.");o(m),s.body&&s.body instanceof ye.Readable&&s.body.destroy(m),!(!v||!v.body)&&v.body.emit("error",m)};if(T&&T.aborted){O();return}const k=()=>{O(),h()},x=d(y.toString(),w);T&&T.addEventListener("abort",k);const h=()=>{x.abort(),T&&T.removeEventListener("abort",k)};x.on("error",m=>{o(new de(`request to ${s.url} failed, reason: ${m.message}`,"system",m)),h()}),Zt(x,m=>{v&&v.body&&v.body.destroy(m)}),Sr.version<"v14"&&x.on("socket",m=>{let b;m.prependListener("end",()=>{b=m._eventsCount}),m.prependListener("close",a=>{if(v&&b<m._eventsCount&&!a){const l=new Error("Premature close");l.code="ERR_STREAM_PREMATURE_CLOSE",v.body.emit("error",l)}})}),x.on("response",m=>{x.setTimeout(0);const b=pt(m.rawHeaders);if(Br(m.statusCode)){const p=b.get("Location");let u=null;try{u=p===null?null:new URL(p,s.url)}catch{if(s.redirect!=="manual"){o(new de(`uri requested responds with an invalid redirect URL: ${p}`,"invalid-redirect")),h();return}}switch(s.redirect){case"error":o(new de(`uri requested responds with a redirect, redirect mode is set to error: ${s.url}`,"no-redirect")),h();return;case"manual":break;case"follow":{if(u===null)break;if(s.counter>=s.follow){o(new de(`maximum redirect reached at: ${s.url}`,"max-redirect")),h();return}const g={headers:new ge(s.headers),follow:s.follow,counter:s.counter+1,agent:s.agent,compress:s.compress,method:s.method,body:fr(s),signal:s.signal,size:s.size,referrer:s.referrer,referrerPolicy:s.referrerPolicy};if(!st(s.url,u)||!ft(s.url,u))for(const E of["authorization","www-authenticate","cookie","cookie2"])g.headers.delete(E);if(m.statusCode!==303&&s.body&&t.body instanceof ye.Readable){o(new de("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}(m.statusCode===303||(m.statusCode===301||m.statusCode===302)&&s.method==="POST")&&(g.method="GET",g.body=void 0,g.headers.delete("content-length"));const $=Ht(b);$&&(g.referrerPolicy=$),e(Jt(new Le(u,g))),h();return}default:return o(new TypeError(`Redirect option '${s.redirect}' is not a valid value of RequestRedirect`))}}T&&m.once("end",()=>{T.removeEventListener("abort",k)});let a=ce.pipeline(m,new ce.PassThrough,p=>{p&&o(p)});Sr.version<"v12.10"&&m.on("aborted",k);const l={url:s.url,status:m.statusCode,statusText:m.statusMessage,headers:b,size:s.size,counter:s.counter,highWaterMark:s.highWaterMark},n=b.get("Content-Encoding");if(!s.compress||s.method==="HEAD"||n===null||m.statusCode===204||m.statusCode===304){v=new se(a,l),e(v);return}const c={flush:ie.Z_SYNC_FLUSH,finishFlush:ie.Z_SYNC_FLUSH};if(n==="gzip"||n==="x-gzip"){a=ce.pipeline(a,ie.createGunzip(c),p=>{p&&o(p)}),v=new se(a,l),e(v);return}if(n==="deflate"||n==="x-deflate"){const p=ce.pipeline(m,new ce.PassThrough,u=>{u&&o(u)});p.once("data",u=>{(u[0]&15)===8?a=ce.pipeline(a,ie.createInflate(),g=>{g&&o(g)}):a=ce.pipeline(a,ie.createInflateRaw(),g=>{g&&o(g)}),v=new se(a,l),e(v)}),p.once("end",()=>{v||(v=new se(a,l),e(v))});return}if(n==="br"){a=ce.pipeline(a,ie.createBrotliDecompress(),p=>{p&&o(p)}),v=new se(a,l),e(v);return}v=new se(a,l),e(v)}),ht(x,s).catch(o)})}function Zt(r,t){const e=re.from(`0\r
\r
`);let o=!1,s=!1,y;r.on("response",w=>{const{headers:d}=w;o=d["transfer-encoding"]==="chunked"&&!d["content-length"]}),r.on("socket",w=>{const d=()=>{if(o&&!s){const v=new Error("Premature close");v.code="ERR_STREAM_PREMATURE_CLOSE",t(v)}},T=v=>{s=re.compare(v.slice(-5),e)===0,!s&&y&&(s=re.compare(y.slice(-3),e.slice(0,3))===0&&re.compare(v.slice(-2),e.slice(3))===0),y=v};w.prependListener("close",d),w.on("data",T),r.on("close",()=>{w.removeListener("close",d),w.removeListener("data",T)})})}export{Gt as AbortError,de as FetchError,ge as Headers,Le as Request,se as Response,Jt as default,Br as isRedirect};