"use strict";const d=require("./index.cjs227.js"),U=require("./index.cjs303.js"),E=require("./index.cjs304.js"),R=require("./index.cjs305.js"),q=require("./index.cjs230.js"),v=require("./index.cjs306.js"),m=require("./index.cjs307.js"),A=require("./index.cjs241.js"),i=m.validators;class w{constructor(t){this.defaults=t||{},this.interceptors={request:new E,response:new E}}async request(t,e){try{return await this._request(t,e)}catch(s){if(s instanceof Error){let l={};Error.captureStackTrace?Error.captureStackTrace(l):l=new Error;const a=l.stack?l.stack.replace(/^.+\n/,""):"";try{s.stack?a&&!String(s.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(s.stack+=`
`+a):s.stack=a}catch{}}throw s}}_request(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=q(this.defaults,e);const{transitional:s,paramsSerializer:l,headers:a}=e;s!==void 0&&m.assertOptions(s,{silentJSONParsing:i.transitional(i.boolean),forcedJSONParsing:i.transitional(i.boolean),clarifyTimeoutError:i.transitional(i.boolean)},!1),l!=null&&(d.isFunction(l)?e.paramsSerializer={serialize:l}:m.assertOptions(l,{encode:i.function,serialize:i.function},!0)),e.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),m.assertOptions(e,{baseUrl:i.spelling("baseURL"),withXsrfToken:i.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let f=a&&d.merge(a.common,a[e.method]);a&&d.forEach(["delete","get","head","post","put","patch","common"],r=>{delete a[r]}),e.headers=A.concat(f,a);const h=[];let y=!0;this.interceptors.request.forEach(function(n){typeof n.runWhen=="function"&&n.runWhen(e)===!1||(y=y&&n.synchronous,h.unshift(n.fulfilled,n.rejected))});const p=[];this.interceptors.response.forEach(function(n){p.push(n.fulfilled,n.rejected)});let u,o=0,c;if(!y){const r=[R.bind(this),void 0];for(r.unshift.apply(r,h),r.push.apply(r,p),c=r.length,u=Promise.resolve(e);o<c;)u=u.then(r[o++],r[o++]);return u}c=h.length;let b=e;for(o=0;o<c;){const r=h[o++],n=h[o++];try{b=r(b)}catch(S){n.call(this,S);break}}try{u=R.call(this,b)}catch(r){return Promise.reject(r)}for(o=0,c=p.length;o<c;)u=u.then(p[o++],p[o++]);return u}getUri(t){t=q(this.defaults,t);const e=v(t.baseURL,t.url,t.allowAbsoluteUrls);return U(e,t.params,t.paramsSerializer)}}d.forEach(["delete","get","head","options"],function(t){w.prototype[t]=function(e,s){return this.request(q(s||{},{method:t,url:e,data:(s||{}).data}))}});d.forEach(["post","put","patch"],function(t){function e(s){return function(a,f,h){return this.request(q(h||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:a,data:f}))}}w.prototype[t]=e(),w.prototype[t+"Form"]=e(!0)});module.exports=w;
//# sourceMappingURL=index.cjs229.js.map
