"use strict";const x=require("./index.cjs227.js"),C=require("./index.cjs381.js"),L=require("./index.cjs308.js"),r=require("./index.cjs238.js"),y=require("./index.cjs233.js"),D=require("./index.cjs382.js"),O=require("./index.cjs310.js"),v=require("./index.cjs241.js"),b=require("./index.cjs383.js"),U=require("./index.cjs384.js"),N=typeof XMLHttpRequest<"u",k=N&&function(o){return new Promise(function(H,s){const t=U(o);let E=t.data;const R=v.from(t.headers).normalize();let{responseType:a,onUploadProgress:T,onDownloadProgress:m}=t,i,q,h,d,p;function g(){d&&d(),p&&p(),t.cancelToken&&t.cancelToken.unsubscribe(i),t.signal&&t.signal.removeEventListener("abort",i)}let e=new XMLHttpRequest;e.open(t.method.toUpperCase(),t.url,!0),e.timeout=t.timeout;function w(){if(!e)return;const n=v.from("getAllResponseHeaders"in e&&e.getAllResponseHeaders()),l={data:!a||a==="text"||a==="json"?e.responseText:e.response,status:e.status,statusText:e.statusText,headers:n,config:o,request:e};C(function(f){H(f),g()},function(f){s(f),g()},l),e=null}"onloadend"in e?e.onloadend=w:e.onreadystatechange=function(){!e||e.readyState!==4||e.status===0&&!(e.responseURL&&e.responseURL.indexOf("file:")===0)||setTimeout(w)},e.onabort=function(){e&&(s(new r("Request aborted",r.ECONNABORTED,o,e)),e=null)},e.onerror=function(){s(new r("Network Error",r.ERR_NETWORK,o,e)),e=null},e.ontimeout=function(){let u=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const l=t.transitional||L;t.timeoutErrorMessage&&(u=t.timeoutErrorMessage),s(new r(u,l.clarifyTimeoutError?r.ETIMEDOUT:r.ECONNABORTED,o,e)),e=null},E===void 0&&R.setContentType(null),"setRequestHeader"in e&&x.forEach(R.toJSON(),function(u,l){e.setRequestHeader(l,u)}),x.isUndefined(t.withCredentials)||(e.withCredentials=!!t.withCredentials),a&&a!=="json"&&(e.responseType=t.responseType),m&&([h,p]=b.progressEventReducer(m,!0),e.addEventListener("progress",h)),T&&e.upload&&([q,d]=b.progressEventReducer(T),e.upload.addEventListener("progress",q),e.upload.addEventListener("loadend",d)),(t.cancelToken||t.signal)&&(i=n=>{e&&(s(!n||n.type?new y(null,o,e):n),e.abort(),e=null)},t.cancelToken&&t.cancelToken.subscribe(i),t.signal&&(t.signal.aborted?i():t.signal.addEventListener("abort",i)));const c=D(t.url);if(c&&O.protocols.indexOf(c)===-1){s(new r("Unsupported protocol "+c+":",r.ERR_BAD_REQUEST,o));return}e.send(E||null)})};module.exports=k;
//# sourceMappingURL=index.cjs313.js.map
