import { __require as I } from "./index-utils10.js";
import { __require as M } from "./index-buildURL.js";
import { __require as z } from "./index-InterceptorManager.js";
import { __require as S } from "./index-dispatchRequest.js";
import { __require as x } from "./index-mergeConfig.js";
import { __require as A } from "./index-buildFullPath.js";
import { __require as L } from "./index-validator.js";
var y, w;
function B() {
  if (w) return y;
  w = 1;
  var q = I(), C = M(), c = z(), R = S(), m = x(), P = A(), v = L(), t = v.validators;
  function n(h) {
    this.defaults = h, this.interceptors = {
      request: new c(),
      response: new c()
    };
  }
  return n.prototype.request = function(r, e) {
    typeof r == "string" ? (e = e || {}, e.url = r) : e = r || {}, e = m(this.defaults, e), e.method ? e.method = e.method.toLowerCase() : this.defaults.method ? e.method = this.defaults.method.toLowerCase() : e.method = "get";
    var i = e.transitional;
    i !== void 0 && v.assertOptions(i, {
      silentJSONParsing: t.transitional(t.boolean),
      forcedJSONParsing: t.transitional(t.boolean),
      clarifyTimeoutError: t.transitional(t.boolean)
    }, !1);
    var p = e.paramsSerializer;
    p !== void 0 && v.assertOptions(p, {
      encode: t.function,
      serialize: t.function
    }, !0), q.isFunction(p) && (e.paramsSerializer = { serialize: p });
    var o = [], d = !0;
    this.interceptors.request.forEach(function(s) {
      typeof s.runWhen == "function" && s.runWhen(e) === !1 || (d = d && s.synchronous, o.unshift(s.fulfilled, s.rejected));
    });
    var u = [];
    this.interceptors.response.forEach(function(s) {
      u.push(s.fulfilled, s.rejected);
    });
    var a;
    if (!d) {
      var l = [R, void 0];
      for (Array.prototype.unshift.apply(l, o), l = l.concat(u), a = Promise.resolve(e); l.length; )
        a = a.then(l.shift(), l.shift());
      return a;
    }
    for (var _ = e; o.length; ) {
      var b = o.shift(), E = o.shift();
      try {
        _ = b(_);
      } catch (f) {
        E(f);
        break;
      }
    }
    try {
      a = R(_);
    } catch (f) {
      return Promise.reject(f);
    }
    for (; u.length; )
      a = a.then(u.shift(), u.shift());
    return a;
  }, n.prototype.getUri = function(r) {
    r = m(this.defaults, r);
    var e = P(r.baseURL, r.url);
    return C(e, r.params, r.paramsSerializer);
  }, q.forEach(["delete", "get", "head", "options"], function(r) {
    n.prototype[r] = function(e, i) {
      return this.request(m(i || {}, {
        method: r,
        url: e,
        data: (i || {}).data
      }));
    };
  }), q.forEach(["post", "put", "patch"], function(r) {
    function e(i) {
      return function(o, d, u) {
        return this.request(m(u || {}, {
          method: r,
          headers: i ? {
            "Content-Type": "multipart/form-data"
          } : {},
          url: o,
          data: d
        }));
      };
    }
    n.prototype[r] = e(), n.prototype[r + "Form"] = e(!0);
  }), y = n, y;
}
export {
  B as __require
};
